diff options
Diffstat (limited to 'engines/m4')
43 files changed, 398 insertions, 398 deletions
diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp index c7c90ac3ae..ab670f5a55 100644 --- a/engines/m4/actor.cpp +++ b/engines/m4/actor.cpp @@ -101,7 +101,7 @@ void Actor::unloadWalkers() { } void Actor::setWalkerPalette() { - _vm->_palette->setPalette(_walkerSprites[kFacingSouthEast]->getPalette(), 0, + _vm->_palette->setPalette(_walkerSprites[kFacingSouthEast]->getPalette(), 0, _walkerSprites[kFacingSouthEast]->getColorCount()); } @@ -157,7 +157,7 @@ void Inventory::removeFromBackpack(uint32 objectIndex) { _vm->_interfaceView->inventoryRemove(_inventory[objectIndex]->name); } -bool Inventory::isInCurrentScene(char* name) { +bool Inventory::isInCurrentScene(char* name) { return (getScene(name) == _vm->_scene->getCurrentScene()); } @@ -195,8 +195,8 @@ void Inventory::clear() { for (uint i = 0; i < _inventory.size(); i++) { delete _inventory[i]->name; delete _inventory[i]; - _inventory.remove_at(i); + _inventory.remove_at(i); } } - + } // End of namespace M4 diff --git a/engines/m4/actor.h b/engines/m4/actor.h index a39398db55..4bf212b2cc 100644 --- a/engines/m4/actor.h +++ b/engines/m4/actor.h @@ -86,7 +86,7 @@ private: // TODO: the original game capitalizes all inventory object names // internally, which we do as well, but perhaps we could make sure // that all object names are parsed with the same case and avoid -// case-insensitive string comparing through scumm_stricmp, using +// case-insensitive string comparing through scumm_stricmp, using // the normal strcmp method instead class Inventory { public: diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 6c9d90a3d2..4b063241fc 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -74,7 +74,7 @@ void Animation::load(const char *filename) { //printf("%03d: %s\n", i, _spriteSeriesNames[i].c_str()); spriteSeriesStream = _vm->res()->get(_spriteSeriesNames[i].c_str()); - _spriteSeries = new SpriteAsset(_vm, spriteSeriesStream, + _spriteSeries = new SpriteAsset(_vm, spriteSeriesStream, spriteSeriesStream->size(), _spriteSeriesNames[i].c_str()); _vm->res()->toss(_spriteSeriesNames[i].c_str()); @@ -101,7 +101,7 @@ void Animation::load(const char *filename) { //printf("Chunk 1, size %i\n", animStream->size()); _frameEntries = new AnimationFrame[_frameEntryCount]; - + for (int i = 0; i < _frameEntryCount; i++) { frame.animFrameIndex = animStream->readUint16LE(); @@ -112,7 +112,7 @@ void Animation::load(const char *filename) { frame.y = animStream->readUint16LE(); frame.v = animStream->readByte(); frame.w = animStream->readByte(); - + _frameEntries[i] = frame; /* @@ -187,7 +187,7 @@ bool Animation::updateAnim() { //printf("_curFrameEntry = %d\n", _curFrameEntry); _curFrameEntry++; } - + //printf("_curFrame = %d\n", _curFrame); _curFrame++; diff --git a/engines/m4/animation.h b/engines/m4/animation.h index 6aafc53310..d11765facf 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -51,7 +51,7 @@ class Animation { void start(); bool updateAnim(); void stop(); - + private: bool _playing; M4Engine *_vm; diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp index 0488f17d8f..1dbf9e79c7 100644 --- a/engines/m4/assets.cpp +++ b/engines/m4/assets.cpp @@ -152,7 +152,7 @@ void SpriteAsset::loadM4SpriteAsset(M4Engine *vm, Common::SeekableReadStream* st // Load & unpack RLE data if it's not a streaming animation if (frame.stream != 1) { - + frame.frame = new M4Sprite(stream, frame.x, frame.y, frame.w, frame.h, true, frame.comp); #if 0 char fn[512]; @@ -191,7 +191,7 @@ void SpriteAsset::loadMadsSpriteAsset(M4Engine *vm, Common::SeekableReadStream* int numColors = 0; RGB8 *palData = Palette::decodeMadsPalette(spriteStream, &numColors); Common::copy(palData, &palData[numColors], &_palette[0]); - if (numColors < 256) + if (numColors < 256) Common::set_to((byte *)&_palette[numColors], (byte *)&_palette[256], 0); _colorCount = numColors; delete[] palData; @@ -241,7 +241,7 @@ int32 SpriteAsset::parseSprite(bool isBigEndian) { uint32 numColors = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE(); // TODO //if (palette) { - // TODO: A sprite set palette specifies the indexes, which need not start at + // TODO: A sprite set palette specifies the indexes, which need not start at // index 0. For now, I'm simply preloading the currently active palette // before starting to replace existing entries @@ -321,7 +321,7 @@ RGBList *SpriteAsset::getRgbList() { } void SpriteAsset::translate(RGBList *list, bool isTransparent) { - for (int frameIndex = 0; frameIndex < _frameCount; ++frameIndex) + for (int frameIndex = 0; frameIndex < _frameCount; ++frameIndex) _frames[frameIndex].frame->translate(list, isTransparent); } @@ -329,7 +329,7 @@ int32 SpriteAsset::getFrameSize(int index) { /* if (index + 1 == _frameCount) { } else { - + } */ return _frameOffsets[index + 1] - _frameOffsets[index]; @@ -417,7 +417,7 @@ bool AssetManager::loadAsset(const char *assetName, RGB8 *palette) { // Until loading code is complete, so that chunks not fully read are skipped correctly uint32 nextOfs = assetS->pos() + chunkSize; - + switch (chunkType) { case CHUNK_MACH: printf("MACH\n"); @@ -484,7 +484,7 @@ int32 AssetManager::addSpriteAsset(const char *assetName, int32 hash, RGB8 *pale printf("AssetManager::addSpriteAsset() asset %s not loaded, loading into %d\n", assetName, hash); clearAssets(kAssetTypeCELS, hash, hash); - + Common::SeekableReadStream *assetS = _vm->res()->get(assetName); _CELS[hash] = new SpriteAsset(_vm, assetS, assetS->size(), assetName); _vm->res()->toss(assetName); diff --git a/engines/m4/assets.h b/engines/m4/assets.h index efc9afed83..a1d5d2b0c3 100644 --- a/engines/m4/assets.h +++ b/engines/m4/assets.h @@ -31,7 +31,7 @@ #include "m4/sprite.h" namespace M4 { - + // Sequence chunks #define CHUNK_SCEN MKID_BE('SCEN') #define CHUNK_MACH MKID_BE('MACH') diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp index 7dbb11f685..543fbd1fef 100644 --- a/engines/m4/compression.cpp +++ b/engines/m4/compression.cpp @@ -36,7 +36,7 @@ bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { char tempBuffer[8]; stream->seek(0); if (stream->read(tempBuffer, 8) == 8) { - if (!strncmp(tempBuffer, madsPackString, 8)) + if (!strncmp(tempBuffer, madsPackString, 8)) return true; } @@ -60,7 +60,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { stream->seek(14); _count = stream->readUint16LE(); _items = new MadsPackEntry[_count]; - + byte *headerData = new byte[0xA0]; byte *header = headerData; stream->read(headerData, 0xA0); @@ -79,7 +79,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { // Decompress the entry byte *compressedData = new byte[_items[i].compressedSize]; stream->read(compressedData, _items[i].compressedSize); - + FabDecompressor fab; fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size); delete[] compressedData; @@ -102,7 +102,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; byte *destP; - + // Validate that the data starts with the FAB header if (strncmp((const char *)srcData, "FAB", 3) != 0) error("FabDecompressor - Invalid compressed data"); @@ -121,7 +121,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat _srcData = srcData; _srcP = _srcData + 6; _srcSize = srcSize; - _bitsLeft = 16; + _bitsLeft = 16; _bitBuffer = READ_LE_UINT16(srcData + 4); for (;;) { diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp index ccf6d98f33..1950371edd 100644 --- a/engines/m4/console.cpp +++ b/engines/m4/console.cpp @@ -170,9 +170,9 @@ bool Console::cmdDumpFile(int argc, const char **argv) { bool Console::cmdShowSprite(int argc, const char **argv) { View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view == NULL) + if (view == NULL) DebugPrintf("The scene view isn't currently active\n"); - else if (argc < 2) + else if (argc < 2) DebugPrintf("Usage: %s resource_name\n", argv[0]); else { char resourceName[20]; @@ -188,7 +188,7 @@ bool Console::cmdShowSprite(int argc, const char **argv) { RGBList *palData = new RGBList(asset->getColorCount(), asset->getPalette(), true); _vm->_palette->addRange(palData); - + // Get the scene background surface M4Surface *bg = _vm->_scene->getBackgroundSurface(); diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp index 11131783e2..5567c8888a 100644 --- a/engines/m4/converse.cpp +++ b/engines/m4/converse.cpp @@ -39,7 +39,7 @@ namespace M4 { #define CONV_ENTRIES_HEIGHT 20 #define CONV_MAX_SHOWN_ENTRIES 5 -#define CONVERSATION_ENTRY_HIGHLIGHTED 22 +#define CONVERSATION_ENTRY_HIGHLIGHTED 22 #define CONVERSATION_ENTRY_NORMAL 3 // Conversation chunks @@ -75,7 +75,7 @@ namespace M4 { #define CHUNK_WPRL MKID_BE('WPRL') // weighted preply chunk -ConversationView::ConversationView(M4Engine *vm): View(vm, Common::Rect(0, +ConversationView::ConversationView(M4Engine *vm): View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())) { _screenType = VIEWID_CONVERSATION; @@ -110,7 +110,7 @@ void ConversationView::setNode(int32 nodeIndex) { continue; if ((int)_activeItems.size() > CONV_MAX_SHOWN_ENTRIES) { - warning("TODO: scrolling. Max shown entries are %i, skipping entry %i", + warning("TODO: scrolling. Max shown entries are %i, skipping entry %i", CONV_MAX_SHOWN_ENTRIES, i); } @@ -124,7 +124,7 @@ void ConversationView::setNode(int32 nodeIndex) { } // Figure out the longest string to determine where option highlighting ends - int tempX = _vm->_font->getWidth(node->entries[i]->text, 0) + + int tempX = _vm->_font->getWidth(node->entries[i]->text, 0) + CONV_ENTRIES_X_OFFSET + 10; _xEnd = MAX(_xEnd, tempX); } @@ -134,7 +134,7 @@ void ConversationView::setNode(int32 nodeIndex) { // Fallthrough if (node->fallthroughMinEntries >= 0 && node->fallthroughOffset >= 0) { - //printf("Current node falls through node at offset %i when entries are less or equal than %i\n", + //printf("Current node falls through node at offset %i when entries are less or equal than %i\n", // node->fallthroughOffset, node->fallthroughMinEntries); if (_activeItems.size() <= (uint32)node->fallthroughMinEntries) { const EntryInfo *entryInfo = _vm->_converse->getEntryInfo(node->fallthroughOffset); @@ -166,7 +166,7 @@ void ConversationView::onRefresh(RectList *rects, M4Surface *destSurface) { _vm->_font->setColor((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED : CONVERSATION_ENTRY_NORMAL); - _vm->_font->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET, + _vm->_font->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET, CONV_ENTRIES_Y_OFFSET + CONV_ENTRIES_HEIGHT * i, 0, 0); } } @@ -178,7 +178,7 @@ bool ConversationView::onEvent(M4EventType eventType, int param, int x, int y, b // return false; if (!_entriesShown) return false; - if (eventType == KEVENT_KEY) + if (eventType == KEVENT_KEY) return false; int localY = y - _coords.top; @@ -267,7 +267,7 @@ void ConversationView::playNextReply() { if (currentEntry->isConditional) { if (!_vm->_converse->evaluateCondition( - _vm->_converse->getValue(currentEntry->condition.offset), + _vm->_converse->getValue(currentEntry->condition.offset), currentEntry->condition.op, currentEntry->condition.val)) continue; // don't play this reply } @@ -313,7 +313,7 @@ void ConversationView::playNextReply() { // If we reached here, there are no more replies, so perform the active entry's actions - //printf("Current selection does %i actions\n", _activeItems[entryIndex]->actions.size()); + //printf("Current selection does %i actions\n", _activeItems[entryIndex]->actions.size()); for (uint32 i = 0; i < _activeItems[_highlightedIndex]->actions.size(); i++) { if (!_vm->_converse->performAction(_activeItems[_highlightedIndex]->actions[i])) break; @@ -327,7 +327,7 @@ void ConversationView::playNextReply() { // Check if the conversation has been ended if (_currentNodeIndex == -1) { - _conversationState = kNoConversation; + _conversationState = kNoConversation; } } @@ -350,7 +350,7 @@ void Converse::startConversation(const char *convName, bool showConverseBox, Con if (showConverseBox) { _vm->_conversationView->show(); _vm->_mouse->lockCursor(CURSOR_ARROW); - + if (_interfaceWasVisible) _vm->_interfaceView->hide(); @@ -397,7 +397,7 @@ void Converse::loadConversation(const char *convName) { if (header != HEAD_CONV) { warning("Unexpected conversation file external header"); return; - } + } size = convS->readUint32LE(); // is this used at all? if (debugFlag) printf("Conv chunk size (external header): %i\n", size); @@ -486,7 +486,7 @@ void Converse::loadConversation(const char *convName) { curEntry->autoSelect = false; } _convNodes[curNode]->entries.push_back(curEntry); - setEntryInfo(curEntry->offset, curEntry->entryType, + setEntryInfo(curEntry->offset, curEntry->entryType, curNode, _convNodes[curNode]->entries.size() - 1); replyEntry = NULL; break; @@ -542,7 +542,7 @@ void Converse::loadConversation(const char *convName) { } curEntry->entries.push_back(replyEntry); - setEntryInfo(replyEntry->offset, replyEntry->entryType, + setEntryInfo(replyEntry->offset, replyEntry->entryType, curNode, _convNodes[curNode]->entries.size() - 1); // Seek to chunk data (i.e. TEXT/MESG tag, which is usually right // after this chunk but it can be further on in conditional reply chunks @@ -566,9 +566,9 @@ void Converse::loadConversation(const char *convName) { } if (replyEntry == NULL) { - parentEntry = curEntry; + parentEntry = curEntry; } else if (replyEntry != NULL && replyEntry->entryType != kWeightedReply) { - parentEntry = replyEntry; + parentEntry = replyEntry; } else if (replyEntry != NULL && replyEntry->entryType == kWeightedReply) { parentEntry = replyEntry->entries[currentWeightedEntry]; currentWeightedEntry++; @@ -636,7 +636,7 @@ void Converse::loadConversation(const char *convName) { case CHUNK_DSTR: // Destroy entry case CHUNK_EXIT: // Exit conversation curAction = new EntryAction(); - + // Conditional part if (chunk == CHUNK_CCGO || chunk == CHUNK_CHDE || chunk == CHUNK_CUHD || chunk == CHUNK_CDST || chunk == CHUNK_CEGO) { @@ -885,9 +885,9 @@ void Converse::loadConversationMads(const char *convName) { curEntry->id = convS->readUint16LE(); curEntry->offset = convS->readUint16LE(); curEntry->size = convS->readUint16LE(); - + _convNodes[i]->entries.push_back(curEntry); - //printf("Node %i, entry %i, id %i, offset %i, size %i, text: %s\n", + //printf("Node %i, entry %i, id %i, offset %i, size %i, text: %s\n", // i, j, curEntry->id, curEntry->offset, curEntry->size, curEntry->text); } } @@ -1026,7 +1026,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur if (hasText1 == 1) { messageIndex = convS->readUint16LE(); - printf("Message 1 index: %i, text:\n", messageIndex); + printf("Message 1 index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1035,7 +1035,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur if (hasText2 == 1) { messageIndex = convS->readUint16LE(); if (hasText1 == 0) { - printf("Message 2 index: %i, text:\n", messageIndex); + printf("Message 2 index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1048,7 +1048,7 @@ void Converse::readConvEntryActions(Common::SubReadStream *convS, ConvEntry *cur for (int k = 0; k < 4; k++) convS->readByte(); messageIndex = convS->readUint16LE(); - printf("Message index: %i, text:\n", messageIndex); + printf("Message index: %i, text:\n", messageIndex); for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) { printf("%s\n", _madsMessageList[messageIndex]->messageStrings[i]); } @@ -1107,7 +1107,7 @@ void Converse::setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32 //printf("Set entry info: offset %i, type %i, node %i, entry %i\n", offset, type, nodeIndex, entryIndex); } -const EntryInfo* Converse::getEntryInfo(int32 offset) { +const EntryInfo* Converse::getEntryInfo(int32 offset) { char hashOffset[10]; sprintf(hashOffset, "%i", offset); OffsetHashMap::const_iterator entry = _offsetMap.find(hashOffset); @@ -1161,13 +1161,13 @@ bool Converse::evaluateCondition(int32 leftVal, int32 op, int32 rightVal) { bool Converse::performAction(EntryAction *action) { if (action->isConditional) { - if (!evaluateCondition(getValue(action->condition.offset), + if (!evaluateCondition(getValue(action->condition.offset), action->condition.op, action->condition.val)) return true; // don't perform this action } if (action->actionType == kAssignValue) { - //printf("Assigning variable at offset %i to value %i\n", + //printf("Assigning variable at offset %i to value %i\n", // action->targetOffset, action->value); setValue(action->targetOffset, action->value); return true; // nothing else to do in an assignment action diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp index 101a41015f..5c9313cbfb 100644 --- a/engines/m4/events.cpp +++ b/engines/m4/events.cpp @@ -91,7 +91,7 @@ M4EventType Events::handleEvents() { // State machine for moving between states switch (_mouseState) { - case MSTATE_NO_EVENT: + case MSTATE_NO_EVENT: if (_mouseButtons & LEFT_BUTTON_DOWN) { if ((dclickTime != 0) && (g_system->getMillis() < dclickTime)) { _mouseState = MSTATE_DOUBLECLICK_DOWN; @@ -199,7 +199,7 @@ bool Mouse::init(const char *seriesName, RGB8 *palette) { data = _cursorSprites->getFrame(i)->getBasePtr(x, y); if (*data == 1) { // It seems that some cursors have more than one hotspot - // In such a case, the first hotspot seems to set the x and + // In such a case, the first hotspot seems to set the x and // the second one the y hotspot offset if (!hotSpotSet) { _cursorSprites->getFrame(i)->xOffset = x; @@ -232,7 +232,7 @@ bool Mouse::setCursorNum(int cursorIndex) { return false; _lockedCursor = cursorIndex; - if (_locked) + if (_locked) // Cursor is locked, so don't go ahead with changing cursor return true; @@ -241,7 +241,7 @@ bool Mouse::setCursorNum(int cursorIndex) { // Set the cursor to the sprite CursorMan.replaceCursor((const byte *)_cursor->getData(), _cursor->w, _cursor->h, _cursor->xOffset, _cursor->yOffset, 0); - + return true; } @@ -284,7 +284,7 @@ const char *Mouse::getVerb() { } void Mouse::resetMouse() { - _hideRect.left = -1; + _hideRect.left = -1; _hideRect.top = -1; _hideRect.right = -1; _hideRect.bottom = -1; @@ -342,7 +342,7 @@ bool Mouse::inHideArea() { if ((_showRect.top == -1) && (_showRect.left == -1)) // No show rect defined return false; - + // Return true if the mouse is outside the show area return (_currentPos.x < _showRect.left) || (_currentPos.x > _showRect.right) || (_currentPos.y < _showRect.top) || (_currentPos.y > _showRect.bottom); diff --git a/engines/m4/events.h b/engines/m4/events.h index d261f29013..5f309e0a03 100644 --- a/engines/m4/events.h +++ b/engines/m4/events.h @@ -41,7 +41,7 @@ namespace M4 { #define RIGHT_BUTTON_DOWN 1 << 1 enum M4EventType { - MEVENT_NO_EVENT, MEVENT_MOVE, + MEVENT_NO_EVENT, MEVENT_MOVE, MEVENT_LEFT_CLICK, MEVENT_LEFT_HOLD, MEVENT_LEFT_DRAG, MEVENT_LEFT_RELEASE, MEVENT_RIGHT_CLICK, MEVENT_RIGHT_HOLD, MEVENT_RIGHT_DRAG, MEVENT_RIGHT_RELEASE, MEVENT_BOTH_CLICK, MEVENT_BOTH_HOLD, MEVENT_BOTH_DRAG, MEVENT_BOTH_RELEASE, @@ -79,7 +79,7 @@ public: Common::Event &event() { return _event; } Common::EventType type() { return _event.type; } - + // M4-centric methods M4EventType handleEvents(); bool kbdCheck(uint32 &keyCode); @@ -117,7 +117,7 @@ public: bool getCursorOn() { return _cursorOn; } void lockCursor(int cursorIndex); void unlockCursor(); - + const char *getVerb(); void resetMouse(); diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp index 119e7297cf..a0ca27f745 100644 --- a/engines/m4/font.cpp +++ b/engines/m4/font.cpp @@ -55,7 +55,7 @@ void Font::setFont(const char *filename) { void Font::setFontM4(const char *filename) { Common::SeekableReadStream *fontFile = _vm->res()->openFile(filename); - + if (fontFile->readUint32LE() != MKID_BE('FONT')) { printf("Font::Font: FONT tag expected\n"); return; @@ -64,7 +64,7 @@ void Font::setFontM4(const char *filename) { _maxHeight = fontFile->readByte(); _maxWidth = fontFile->readByte(); uint32 fontSize = fontFile->readUint32LE(); - + //printf("Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize); if (fontFile->readUint32LE() != MKID_BE('WIDT')) { @@ -137,8 +137,8 @@ Font::~Font() { void Font::setColor(uint8 color) { if (_sysFont) _fontColors[1] = color; - else - _fontColors[3] = color; + else + _fontColors[3] = color; } void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) { @@ -166,7 +166,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, x++; y++; - + int skipY = 0; if (y < 0) { skipY = -y; @@ -194,7 +194,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, unsigned char theChar = (*text++) & 0x7F; int charWidth = _charWidths[theChar]; - + if (charWidth > 0) { if (xPos + charWidth >= width) @@ -244,7 +244,7 @@ int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, } xPos += charWidth + spaceWidth; - + } surface->freeData(); diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp index 98d007f67e..56f78ce835 100644 --- a/engines/m4/globals.cpp +++ b/engines/m4/globals.cpp @@ -47,7 +47,7 @@ Kernel::Kernel(M4Engine *vm) : _vm(vm) { previousRoom = 0; trigger = 0; triggerMode = KT_DAEMON; - + _globalDaemonFn = NULL; _globalParserFn = NULL; @@ -88,17 +88,17 @@ bool Kernel::handleTrigger(int32 triggerNum) { bool result = false; int room = (triggerNum >> 16) & 0xFFF; - + printf("room = %d; currentRoom = %d\n", room, currentRoom); fflush(stdout); - + if (room != currentRoom) { printf("Kernel::handleTrigger() Trigger from another room\n"); return false; } - + trigger = triggerNum & 0xFFFF; KernelTriggerType mode = (KernelTriggerType)(triggerNum >> 28); - + switch (mode) { case KT_PREPARSE: diff --git a/engines/m4/globals.h b/engines/m4/globals.h index a80e8bf710..ec32c29fda 100644 --- a/engines/m4/globals.h +++ b/engines/m4/globals.h @@ -109,7 +109,7 @@ public: // TODO: Move to some palette/fading class int fadeUpDuration, firstFadeColorIndex; int minPalEntry, maxPalEntry; - + bool paused; //machine* myWalker; bool repeatedlyCallDeamon; @@ -120,7 +120,7 @@ public: int32 trigger; KernelTriggerType triggerMode; - + int32 createTrigger(int32 triggerNum); bool sendTrigger(int32 triggerNum); bool handleTrigger(int32 triggerNum); @@ -128,7 +128,7 @@ public: void loadGlobalScriptFunctions(); void loadSectionScriptFunctions(); void loadRoomScriptFunctions(); - + void globalDaemon(); void globalParser(); @@ -190,10 +190,10 @@ public: // Variables Common::Point position; // Player's current position int facing; // Facing direction - + char verb[PLAYER_FIELD_LENGTH]; // Action strings - char noun[PLAYER_FIELD_LENGTH]; - char prep[PLAYER_FIELD_LENGTH]; + char noun[PLAYER_FIELD_LENGTH]; + char prep[PLAYER_FIELD_LENGTH]; char object[PLAYER_FIELD_LENGTH]; Common::String assetName, shadowName; int walkerType, shadowType; diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 1846f1c1e7..6d933d476b 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -190,7 +190,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c printf("M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight); fflush(stdout); */ - + int clipX = 0, clipY = 0; // Clip the sprite's width and height according to the clip rectangle's dimensions // This clips the sprite to the bottom and right @@ -302,7 +302,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c } } - + delete[] scaledLineBuf; } @@ -383,7 +383,7 @@ void M4Surface::loadBackgroundRiddle(const char *sceneName) { Common::SeekableReadStream *stream; // Loads a Riddle scene sprintf(resourceName, "%s.tt", sceneName); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); m4LoadBackground(stream); _vm->_resourceManager->toss(resourceName); } @@ -398,17 +398,17 @@ void M4Surface::loadBackground(int sceneNumber, RGBList **palData) { if (_vm->getGameType() == GType_RexNebular) { // Load Rex Nebular screen sprintf(resourceName, "rm%d.art", sceneNumber); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); rexLoadBackground(stream, palData); } else { // Loads M4 game scene if (palData) *palData = NULL; sprintf(resourceName, "%i.tt", sceneNumber); - stream = _vm->_resourceManager->get(resourceName); + stream = _vm->_resourceManager->get(resourceName); m4LoadBackground(stream); } - + _vm->_resourceManager->toss(resourceName); } else { @@ -519,7 +519,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) { // -------------------------------------------------------------------------------- // Loop through the mapping data to place the tiles on the screen - + uint16 *tIndex = &tileMap[0]; for (int y = 0; y < tileCountY; y++) { for (int x = 0; x < tileCountX; x++) { @@ -569,7 +569,7 @@ void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList ** byte *pData = (byte *)pixels; sourceUnc->read(pData, sceneSize); - + freeData(); delete sourceUnc; } @@ -593,9 +593,9 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { uint8 blackIndex = 0; // Debug - //printf("loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n", + //printf("loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n", // widthVal, heightVal, size, tilesX, tilesY, tileWidth, tileHeight); - + // BGR data, which is converted to RGB8 for (uint i = 0; i < 256; i++) { palette[i].b = source->readByte() << 2; @@ -606,7 +606,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) { if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b) blackIndex = i; } - + _vm->_palette->setPalette(palette, 0, 256); // resize or create the surface @@ -644,7 +644,7 @@ void M4Surface::madsloadInterface(int index, RGBList **palData) { // Chunk 0, palette Common::SeekableReadStream *intStream = intFile.getItemStream(0); - + for (int i = 0; i < 16; i++) { palette[i].r = intStream->readByte() << 2; palette[i].g = intStream->readByte() << 2; @@ -711,14 +711,14 @@ static void makeTranslationList(RGB8 *palData, byte transList[NUM_GREENS]) { if (minDistance == 0) break; } - + transList[i] = bestIndex; } } // Support function for fading in or out -static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, +static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, int numSteps, uint delayAmount) { RGB8 tempPal[256]; @@ -733,11 +733,11 @@ static void fadeRange(M4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex for (int i = startIndex; i <= endIndex; ++i) { // Handle the intermediate rgb values for fading - tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); - tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); - tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); + tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); + tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); + tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); } - + vm->_palette->setPalette(&tempPal[startIndex], startIndex, endIndex - startIndex + 1); vm->_viewManager->refreshAll(); } @@ -845,7 +845,7 @@ void Palette::fadeToGreen(int numSteps, uint delayAmount) { // using palette indexes in the range the range #32-63 into values from #64-255 makeTranslationList(destPalette, translationList); - + // Use palette indexes from #32-63 for the range of possible shades for (i = GREEN_START; i <= GREEN_END; ++i, greenAmount += 8) { @@ -854,12 +854,12 @@ void Palette::fadeToGreen(int numSteps, uint delayAmount) { } // Remap all pixels into the #32-63 range - + tempP = _vm->_scene->getData(); - for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height(); + for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height(); ++pixelCtr, ++tempP) { // If pixel is in #32-63 range already, remap to higher palette entries - if ((*tempP >= GREEN_START) && (*tempP <= GREEN_END)) + if ((*tempP >= GREEN_START) && (*tempP <= GREEN_END)) *tempP = translationList[*tempP - GREEN_START]; *tempP = (uint8) (GREEN_START + (destPalette[*tempP].g >> 3)); @@ -883,7 +883,7 @@ void Palette::fadeFromGreen(int numSteps, uint delayAmount, bool fadeToBlack) { destPalette = &blackPalette[0]; } - // Initially restore the faded palette + // Initially restore the faded palette _vm->_palette->setPalette(fadedPalette, 0, 256); _vm->_viewManager->refreshAll(); @@ -956,7 +956,7 @@ void Palette::setMadsSystemPalette() { palData[1].r = palData[1].g = palData[1].b = 0x54; palData[2].r = palData[2].g = palData[2].b = 0xb4; palData[3].r = palData[3].g = palData[3].b = 0xff; - + setPalette(palData, 0, 4); blockRange(0, 4); } @@ -976,18 +976,18 @@ void Palette::addRange(RGBList *list) { RGB8 palData[256]; g_system->grabPalette((byte *)&palData[0], 0, 256); bool paletteChanged = false; - + for (int colIndex = 0; colIndex < list->size(); ++colIndex) { // Scan through for an existing copy of the RGB value - int palIndex = -1; + int palIndex = -1; while (++palIndex < 256) { if (_usageCount[palIndex] <= 0) // Palette index is to be skipped continue; - if ((palData[palIndex].r == data[colIndex].r) && + if ((palData[palIndex].r == data[colIndex].r) && (palData[palIndex].g == data[colIndex].g) && - (palData[palIndex].b == data[colIndex].b)) + (palData[palIndex].b == data[colIndex].b)) // Match found break; } @@ -1000,7 +1000,7 @@ void Palette::addRange(RGBList *list) { break; } - if (palIndex == 256) + if (palIndex == 256) error("addRange - Ran out of palette space to allocate"); palData[palIndex].r = data[colIndex].r; diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h index 84fc77656f..c210caef1e 100644 --- a/engines/m4/graphics.h +++ b/engines/m4/graphics.h @@ -51,7 +51,7 @@ struct M4Rect { class M4Surface; // RGBList -// Implements a list of RGB entries +// Implements a list of RGB entries class RGBList { private: @@ -92,7 +92,7 @@ private: void madsLoadBackground(int roomNumber, RGBList **palData = NULL); void m4LoadBackground(Common::SeekableReadStream *source); public: - M4Surface(bool isScreen = false) { + M4Surface(bool isScreen = false) { create(g_system->getWidth(), g_system->getHeight(), 1); _isScreen = isScreen; } @@ -118,7 +118,7 @@ public: void line(int x1, int y1, int x2, int y2, byte color); void frameRect(int x1, int y1, int x2, int y2); void fillRect(int x1, int y1, int x2, int y2); - + void drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect); // Surface methods @@ -134,16 +134,16 @@ public: void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY, int transparentColor = -1); - void update() { + void update() { if (_isScreen) { g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); - g_system->updateScreen(); + g_system->updateScreen(); } } // copyTo methods - void copyTo(M4Surface *dest, int transparentColor = -1) { - dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); + void copyTo(M4Surface *dest, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); } void copyTo(M4Surface *dest, int x, int y, int transparentColor = -1) { dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColor); diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp index 67c1c7a1a7..42fc068909 100644 --- a/engines/m4/gui.cpp +++ b/engines/m4/gui.cpp @@ -103,7 +103,7 @@ void MenuObject::onExecute() { //-------------------------------------------------------------------------- // MenuButton class // -// Defines a button object +// Defines a button object //-------------------------------------------------------------------------- MenuButton::MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, @@ -164,9 +164,9 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject if (isInside(x, y)) { if (currentItem) { callbackFlag = true; - if (_objectType == OBJTYPE_OM_SWITCH_ON) + if (_objectType == OBJTYPE_OM_SWITCH_ON) _objectType = OBJTYPE_OM_SWITCH_OFF; - else if (_objectType == OBJTYPE_OM_SWITCH_OFF) + else if (_objectType == OBJTYPE_OM_SWITCH_OFF) _objectType = OBJTYPE_OM_SWITCH_ON; } else { @@ -183,7 +183,7 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject handledFlag = false; } break; - + case MEVENT_MOVE: if (isInside(x, y)) { currentItem = this; @@ -222,7 +222,7 @@ bool MenuButton::onEvent(M4EventType event, int param, int x, int y, MenuObject // If a callback is flagged, then handle it - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -268,8 +268,8 @@ void MenuButton::onRefresh() { case OBJTYPE_OM_DONE: sprite = sprites[OM_DONE_BTN_GREYED + _objectState]; - break; - + break; + case OBJTYPE_OM_CANCEL: sprite = (_objectState == OS_GREYED) ? sprites[OM_CANCEL_BTN_NORMAL] : sprites[OM_CANCEL_BTN_NORMAL + _objectState - 1]; @@ -291,26 +291,26 @@ void MenuButton::onRefresh() { case OBJTYPE_SL_TEXT: switch (_objectState) { case OS_MOUSEOVER: - _vm->_font->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND, TEXT_COLOR_MOUSEOVER_HILIGHT); sprite = sprites[SL_LINE_MOUSEOVER]; break; case OS_PRESSED: - _vm->_font->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND, TEXT_COLOR_PRESSED_HILIGHT); sprite = sprites[SL_LINE_PRESSED]; break; case OS_GREYED: - _vm->_font->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND, TEXT_COLOR_GREYED_HILIGHT); sprite = sprites[SL_LINE_NORMAL]; break; default: case OS_NORMAL: - _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, TEXT_COLOR_NORMAL_HILIGHT); sprite = sprites[SL_LINE_NORMAL]; break; @@ -344,10 +344,10 @@ void MenuButton::onRefresh() { // Defines a horizontal slider that allows selection of a percentage //-------------------------------------------------------------------------- -MenuHorizSlider::MenuHorizSlider(DialogView *owner, int objectId, int xs, int ys, +MenuHorizSlider::MenuHorizSlider(DialogView *owner, int objectId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { - + _objectType = OBJTYPE_SLIDER; _callback = callbackFn; @@ -366,7 +366,7 @@ void MenuHorizSlider::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -377,7 +377,7 @@ void MenuHorizSlider::onRefresh() { // Fill in the area to the left of the thumbnail if (_thumbX > 2) { - Common::Rect leftBounds(_bounds.left + 3, _bounds.top + 9, _bounds.left + _thumbX, + Common::Rect leftBounds(_bounds.left + 3, _bounds.top + 9, _bounds.left + _thumbX, _bounds.top + _thumbSize.y - 9); parent()->fillRect(leftBounds, SLIDER_BAR_COLOR); } @@ -397,7 +397,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb switch (event) { case MEVENT_LEFT_CLICK: case MEVENT_DOUBLECLICK: - if (isInside(x, y) && (x - _bounds.left >= _thumbX) && + if (isInside(x, y) && (x - _bounds.left >= _thumbX) && (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) { // The thumbnail has been clicked _sliderState = HSLIDER_THUMB_PRESSED; @@ -427,7 +427,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb _percent = _thumbX * 100 / _maxThumbX; redrawFlag = callbackFlag = true; } - movingX = CLIP(x, _bounds.left + _thumbX, + movingX = CLIP(x, _bounds.left + _thumbX, _bounds.left + _thumbX + _thumbSize.x - 1); } else { currentItem = NULL; @@ -452,7 +452,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb redrawFlag = true; callbackFlag = true; break; - + case MEVENT_MOVE: if (isInside(x, y) && (x - _bounds.left >= _thumbX) && (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) { @@ -469,7 +469,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb } redrawFlag = true; break; - + default: break; } @@ -477,7 +477,7 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb if (redrawFlag) onRefresh(); - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -489,10 +489,10 @@ bool MenuHorizSlider::onEvent(M4EventType event, int param, int x, int y, MenuOb // Defines a vertical slider that's used in the save/load dialog //-------------------------------------------------------------------------- -MenuVertSlider::MenuVertSlider(DialogView *owner, int objectId, int xs, int ys, +MenuVertSlider::MenuVertSlider(DialogView *owner, int objectId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { - + _objectType = OBJTYPE_SLIDER; _callback = callbackFn; @@ -527,7 +527,7 @@ void MenuVertSlider::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -544,22 +544,22 @@ void MenuVertSlider::onRefresh() { thumbSprite = NULL; } else if (_objectState == OS_MOUSEOVER) { - if (_sliderState == VSLIDER_UP) + if (_sliderState == VSLIDER_UP) upSprite = sprites[SL_UP_BTN_MOUSEOVER]; - else if (_sliderState == VSLIDER_THUMBNAIL) + else if (_sliderState == VSLIDER_THUMBNAIL) thumbSprite = sprites[SL_SLIDER_BTN_MOUSEOVER]; else if (_sliderState == VSLIDER_DOWN) downSprite = sprites[SL_DOWN_BTN_MOUSEOVER]; } else if (_objectState == OS_PRESSED) { - if (_sliderState == VSLIDER_UP) + if (_sliderState == VSLIDER_UP) upSprite = sprites[SL_UP_BTN_PRESSED]; - else if (_sliderState == VSLIDER_THUMBNAIL) + else if (_sliderState == VSLIDER_THUMBNAIL) thumbSprite = sprites[SL_SLIDER_BTN_PRESSED]; - else if (_sliderState == VSLIDER_DOWN) + else if (_sliderState == VSLIDER_DOWN) downSprite = sprites[SL_DOWN_BTN_PRESSED]; } - + // Draw the sprites upSprite->copyTo(parent(), _bounds.left, _bounds.top, 0); barSprite->copyTo(parent(), _bounds.left, _bounds.top + upSprite->height(), 0); @@ -615,7 +615,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj case MEVENT_LEFT_DRAG: case MEVENT_DOUBLECLICK_DRAG: - if (!currentItem) + if (!currentItem) return true; if (movingFlag) { @@ -639,9 +639,9 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj } movingY = y; - if (movingY < (_thumbY + _bounds.top)) + if (movingY < (_thumbY + _bounds.top)) movingY = _thumbY + _bounds.top; - else if (movingY > (_bounds.top + _thumbY + _thumbSize.y - 1)) + else if (movingY > (_bounds.top + _thumbY + _thumbSize.y - 1)) movingY = _bounds.top + _thumbY + _thumbSize.y - 1; } else { @@ -654,7 +654,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj setState(OS_PRESSED); redrawFlag = true; } - if (currentTime - callbackTime > 100) + if (currentTime - callbackTime > 100) callbackFlag = true; } else { @@ -672,13 +672,13 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj } } break; - + case MEVENT_LEFT_RELEASE: case MEVENT_DOUBLECLICK_RELEASE: movingFlag = false; if (isInside(x, y)) { tempState = getSliderArea(y - _bounds.top); - if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) + if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) setState(OS_NORMAL); else { setState(OS_MOUSEOVER); @@ -693,13 +693,13 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj if (parent()->getMenuType() == LOAD_MENU) updateThumbnails(); break; - + case MEVENT_MOVE: if (isInside(x, y)) { currentItem = this; tempState = getSliderArea(y - _bounds.top); if (_sliderState != tempState) { - if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) + if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) _objectState = OS_NORMAL; else { _sliderState = tempState; @@ -725,9 +725,9 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj if (isInside(x, y)) { tempState = getSliderArea(y - _bounds.top); - + if (_sliderState == tempState) { - if (currentTime - callbackTime > 100) + if (currentTime - callbackTime > 100) callbackFlag = true; } } @@ -737,7 +737,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj break; } - if (redrawFlag) + if (redrawFlag) onRefresh(); if (callbackFlag) { @@ -748,7 +748,7 @@ bool MenuVertSlider::onEvent(M4EventType event, int param, int x, int y, MenuObj return handledFlag; } -void MenuVertSlider::setPercentage(int value) { +void MenuVertSlider::setPercentage(int value) { _percent = value; _thumbY = _minThumbY + ((_percent * (_maxThumbY - _minThumbY)) / 100); onRefresh(); @@ -760,7 +760,7 @@ void MenuVertSlider::setPercentage(int value) { // Defines a message menu object //-------------------------------------------------------------------------- -MenuMessage::MenuMessage(DialogView *owner, int objectId, int xs, int ys, int width, int height, +MenuMessage::MenuMessage(DialogView *owner, int objectId, int xs, int ys, int width, int height, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { } @@ -772,7 +772,7 @@ void MenuMessage::onRefresh() { // Get the correct sprite to use switch (_objectId) { case SLTAG_SAVELOAD_LABEL: - sprite = (parent()->getMenuType() == SAVE_MENU) ? sprites[SL_SAVE_LABEL] : + sprite = (parent()->getMenuType() == SAVE_MENU) ? sprites[SL_SAVE_LABEL] : sprites[SL_LOAD_LABEL]; break; } @@ -783,7 +783,7 @@ void MenuMessage::onRefresh() { // Transparent button if (!_background) return; - + // Restore original background and then do a transparent copy of the sprite _background->copyTo(parent(), _bounds.left, _bounds.top); } @@ -797,7 +797,7 @@ void MenuMessage::onRefresh() { // Defines a menu item that displays a given surface //-------------------------------------------------------------------------- -MenuImage::MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, +MenuImage::MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, M4Surface *image, bool transparent): MenuObject(owner, objectId, xs, ys, width, height, false, transparent) { @@ -813,7 +813,7 @@ void MenuImage::onRefresh() { // Transparent button if (!_background) return; - + // Restore original background and then do a transparent copy of the sprite _background->copyTo(parent(), _bounds.left, _bounds.top); } @@ -828,7 +828,7 @@ void MenuImage::onRefresh() { // Defines a save/load dialog text entry //-------------------------------------------------------------------------- -MenuSaveLoadText::MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, +MenuSaveLoadText::MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, Callback callbackFn, bool greyed, bool transparent, bool loadFlag, const char *displayText, int displayValue): MenuButton(owner, textId, xs, ys, width, height, callbackFn, greyed, transparent, OBJTYPE_SL_TEXT) { @@ -882,7 +882,7 @@ bool MenuSaveLoadText::onEvent(M4::M4EventType event, int param, int x, int y, M delete parent()->_savegameThumbnail; parent()->_highlightedSlot = _index; - parent()->_savegameThumbnail = _vm->_saveLoad->getThumbnail(_index + 1); + parent()->_savegameThumbnail = _vm->_saveLoad->getThumbnail(_index + 1); thumbnail->setSprite(parent()->_savegameThumbnail); } @@ -901,12 +901,12 @@ bool MenuSaveLoadText::onEvent(M4::M4EventType event, int param, int x, int y, M parent()->_highlightedSlot = -1; } } - + return handledFlag; } -void MenuSaveLoadText::setVisible(bool value) { - _visible = value; +void MenuSaveLoadText::setVisible(bool value) { + _visible = value; parent()->refresh(_bounds); } @@ -916,8 +916,8 @@ void MenuSaveLoadText::setVisible(bool value) { // Defines a text entry field //-------------------------------------------------------------------------- -MenuTextField::MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, - int height, bool greyed, Callback callbackFn, +MenuTextField::MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, + int height, bool greyed, Callback callbackFn, const char *displayText, int displayValue, bool transparent): MenuObject(owner, fieldId, xs, ys, width, height, greyed, transparent) { @@ -946,7 +946,7 @@ void MenuTextField::onRefresh() { // Transparent button if (!_background) return; - + _background->copyTo(parent(), _bounds.left, _bounds.top, 0); } @@ -956,7 +956,7 @@ void MenuTextField::onRefresh() { // Draw the text _vm->_font->setFont(FONT_MENU); - _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, + _vm->_font->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND, TEXT_COLOR_NORMAL_HILIGHT); int xp = _bounds.left + 4; @@ -989,7 +989,7 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje char tempStr[MAX_SAVEGAME_NAME]; int tempLen; char *tempP; - bool handledFlag = false, redrawFlag = false, callbackFlag = false; + bool handledFlag = false, redrawFlag = false, callbackFlag = false; if (_objectState == OS_GREYED) return false; @@ -1102,7 +1102,7 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje tempLen = _vm->_font->getWidth(_displayText); if ((strlen(_displayText) < MAX_SAVEGAME_NAME - 1) && (tempLen < _pixelWidth - 12) && (param >= 32) && (param <= 127)) { - + // Valid displayable character if (_cursor < _promptEnd) { strcpy(tempStr, _cursor); @@ -1124,10 +1124,10 @@ bool MenuTextField::onEvent(M4EventType event, int param, int x, int y, MenuObje break; } - if (redrawFlag) + if (redrawFlag) onRefresh(); - if (callbackFlag) + if (callbackFlag) onExecute(); return handledFlag; @@ -1148,8 +1148,8 @@ void GUITextField::onRefresh() { //-------------------------------------------------------------------------- -GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, - M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite): +GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, + M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite): GUIRect(owner, bounds, tag) { _normalSprite = normalSprite; @@ -1161,7 +1161,7 @@ GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag, void GUIButton::onRefresh() { _parent->fillRect(_bounds, _vm->_palette->BLACK); - + if (_visible) { switch (_buttonState) { case BUTTON_MOUSEOVER: diff --git a/engines/m4/gui.h b/engines/m4/gui.h index 3f7e6f20c3..9bef495f76 100644 --- a/engines/m4/gui.h +++ b/engines/m4/gui.h @@ -92,7 +92,7 @@ enum ObjectType { enum GameMenuSpriteType { GM_DIALOG_BOX, - + GM_BUTTON_GREYED, GM_BUTTON_NORMAL, GM_BUTTON_MOUSEOVER, @@ -178,7 +178,7 @@ enum TextColors { TEXT_COLOR_PRESSED_HILIGHT = 236, TEXT_COLOR_PRESSED_FOREGROUND = 130, - TEXT_COLOR_PRESSED_SHADOW = 129 + TEXT_COLOR_PRESSED_SHADOW = 129 }; #define MENU_SS_FIELD_NORMAL 5 @@ -261,8 +261,8 @@ public: DialogView *parent() { return (DialogView *)_parent; } MenuObjectState getState() { return _objectState; } - virtual void setState(MenuObjectState state) { - _objectState = state; + virtual void setState(MenuObjectState state) { + _objectState = state; onRefresh(); } int getObjectId() { return _objectId; } @@ -273,7 +273,7 @@ public: class MenuButton: public MenuObject { public: - MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, + MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height, Callback callbackFn = NULL, bool greyed = false, bool transparent = false, ObjectType buttonType = OBJTYPE_BUTTON); @@ -293,7 +293,7 @@ protected: int _percent; int _thumbX; public: - MenuHorizSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, + MenuHorizSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn = NULL, bool transparent = false); void onRefresh(); @@ -322,7 +322,7 @@ protected: MenuVertSliderState getSliderArea(int y); void updateThumbnails() {} public: - MenuVertSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, + MenuVertSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height, int initialPercentage, Callback callbackFn = NULL, bool transparent = false); void onRefresh(); @@ -343,13 +343,13 @@ class MenuImage: public MenuObject { private: M4Surface *_sprite; public: - MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, + MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height, M4Surface *image, bool transparent = false); void onRefresh(); const M4Surface *sprite() { return _sprite; } - void setSprite(M4Surface *v) { - _sprite = v; + void setSprite(M4Surface *v) { + _sprite = v; onRefresh(); } }; @@ -362,7 +362,7 @@ private: int _index; bool _visible; public: - MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, + MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height, Callback callbackFn = NULL, bool greyed = false, bool transparent = false, bool loadFlag = false, const char *displayText = NULL, int displayValue = 0); @@ -383,8 +383,8 @@ private: char *_promptEnd; char *_cursor; public: - MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, int height, - bool greyed, Callback callbackFn = NULL, const char *displayText = NULL, + MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, int height, + bool greyed, Callback callbackFn = NULL, const char *displayText = NULL, int displayValue = 0, bool transparent = true); void onRefresh(); @@ -414,7 +414,7 @@ protected: bool _visible; bool _tracking; public: - GUIButton(View *owner, const Common::Rect &bounds, int tag, + GUIButton(View *owner, const Common::Rect &bounds, int tag, M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite); void onRefresh(); @@ -427,11 +427,11 @@ private: Common::String _text; public: GUITextField(View *owner, const Common::Rect &bounds); - void setText(const char *value) { - _text = value; + void setText(const char *value) { + _text = value; onRefresh(); } - + void onRefresh(); }; diff --git a/engines/m4/hotspot.cpp b/engines/m4/hotspot.cpp index a8057cf21d..7de66b375b 100644 --- a/engines/m4/hotspot.cpp +++ b/engines/m4/hotspot.cpp @@ -258,7 +258,7 @@ void HotSpotList::loadHotSpots(Common::SeekableReadStream* hotspotStream, int ho strLength = hotspotStream->readUint32LE(); // prepLength hotspotStream->read(buffer, strLength); // prep str_upper(buffer); - + if (strlen(buffer) > 0 && strcmp(buffer, "--") != 0 && strcmp(buffer, "ON") != 0) currentHotSpot->setPrep(buffer); else diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp index 6cc81bf274..60e74fd127 100644 --- a/engines/m4/m4.cpp +++ b/engines/m4/m4.cpp @@ -75,7 +75,7 @@ void escapeHotkeyHandler(M4Engine *vm, View *view, uint32 key) { void textviewHotkeyHandler(M4Engine *vm, View *view, uint32 key) { // Deactivate the scene if it's currently active View *sceneView = vm->_viewManager->getView(VIEWID_SCENE); - if (sceneView != NULL) + if (sceneView != NULL) vm->_viewManager->deleteView(sceneView); // Activate the textview view @@ -206,7 +206,7 @@ void M4Engine::eventHandler() { _viewManager->handleMouseEvents(event); } - if (_events->kbdCheck(keycode)) + if (_events->kbdCheck(keycode)) _viewManager->handleKeyboardEvents(keycode); } @@ -217,9 +217,9 @@ bool M4Engine::delay(int duration, bool keyAborts, bool clickAborts) { while (!_events->quitFlag && (g_system->getMillis() < endTime)) { event = _events->handleEvents(); - if (clickAborts && (event == MEVENT_LEFT_RELEASE) || (event == MEVENT_RIGHT_RELEASE)) + if (clickAborts && (event == MEVENT_LEFT_RELEASE) || (event == MEVENT_RIGHT_RELEASE)) return true; - + if (_events->kbdCheck(keycode)) { if (keyAborts) return true; @@ -403,7 +403,7 @@ Common::Error M4Engine::goM4() { _viewManager->addView(_scene); // Setup game wide hotkeys. Note that Orion Burger used F2/F3 for Save/Restore, - // but for standardisation with most other games, F5/F7 are also mapped + // but for standardisation with most other games, F5/F7 are also mapped _viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler); _viewManager->systemHotkeys().add(Common::KEYCODE_F2, &saveGameHotkeyHandler); @@ -454,7 +454,7 @@ Common::Error M4Engine::goM4() { _kernel->loadRoomScriptFunctions(); _kernel->roomInit(); - + #ifdef INTRO_TEST if (_kernel->currentRoom == 951) { curPart = 0; @@ -505,13 +505,13 @@ Common::Error M4Engine::goM4() { _ws->update(); _viewManager->refreshAll(); nextFrame = g_system->getMillis();// + GAME_FRAME_DELAY; - + // TEST STUFF ONLY if (_player->commandReady) { _kernel->roomParser(); _player->commandReady = false; } - + } g_system->delayMillis(10); diff --git a/engines/m4/m4.h b/engines/m4/m4.h index ac3262e7b8..69887b0fa4 100644 --- a/engines/m4/m4.h +++ b/engines/m4/m4.h @@ -116,7 +116,7 @@ protected: virtual Common::Error go(); void shutdown(); - + MidiPlayer *_midi; public: diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp index 09c0afe313..88bcf85d05 100644 --- a/engines/m4/m4_menus.cpp +++ b/engines/m4/m4_menus.cpp @@ -139,7 +139,7 @@ void OrionCallbacks::saveLoadSaveFn(DialogView *view, MenuObject *item) { GUI::MessageDialog dialog("Save game failed!"); dialog.runModal(); } - + // Close the menu closeMenuFn(view, item); } @@ -170,7 +170,7 @@ void OrionCallbacks::saveLoadSlotFn(DialogView *view, MenuObject *item) { if (view->getMenuType() == SAVE_MENU) { // Add in a text field for entry of the savegame name vw->items().push_back(new MenuTextField(view, SLTAG_TEXTFIELD, - slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), false, + slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), false, saveLoadSaveFn, (button->getText() == EmptySaveString) ? NULL : button->getText(), button->getIndex() + 1)); @@ -180,7 +180,7 @@ void OrionCallbacks::saveLoadSlotFn(DialogView *view, MenuObject *item) { saveLoadLoadFn, button->getText(), button->getIndex() + 1)); } - // Hide the existing slot + // Hide the existing slot button->setVisible(false); // Disable the slider @@ -207,7 +207,7 @@ void OrionCallbacks::saveLoadCancelFn(DialogView *view, MenuObject *item) { currentItem->setState(OS_NORMAL); } } - + // Show the previously hidden slot again MenuSaveLoadText *slot = (MenuSaveLoadText *) view->getItem(SLTAG_SLOTS_START + view->_selectedSlot); slot->setVisible(true); @@ -257,7 +257,7 @@ void OrionCallbacks::saveLoadSliderFn(DialogView *view, MenuObject *item) { switch (slider->sliderState()) { case VSLIDER_UP: - if (newIndex > 0) + if (newIndex > 0) --newIndex; break; @@ -344,9 +344,9 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool _menuObjects.push_back(new MenuButton(this, BTNID_RESUME, 45, 135, 24, 24, &OrionCallbacks::closeMenuFn)); _menuObjects.push_back(new MenuButton(this, BTNID_QUIT, 141, 135, 24, 24, &OrionCallbacks::gameExitFn)); _menuObjects.push_back(new MenuButton(this, BTNID_SAVE, 141, 53, 24, 24, &OrionCallbacks::gameSaveGameFn, _calledFromMainMenu)); - _menuObjects.push_back(new MenuButton(this, BTNID_LOAD, 141, 94, 24, 24, &OrionCallbacks::gameLoadGameFn, + _menuObjects.push_back(new MenuButton(this, BTNID_LOAD, 141, 94, 24, 24, &OrionCallbacks::gameLoadGameFn, !_vm->_saveLoad->hasSaves())); - + _escapeHandler = &OrionCallbacks::closeMenuFn; _returnHandler = &OrionCallbacks::closeMenuFn; break; @@ -359,13 +359,13 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool // Add menu contents // TODO: Currently the Digi slider isn't hooked up to anything - _menuObjects.push_back(new MenuButton(this, OPTIONID_CANCEL, 93, 141, 74, 43, + _menuObjects.push_back(new MenuButton(this, OPTIONID_CANCEL, 93, 141, 74, 43, &OrionCallbacks::optionsCancelFn, false, false, OBJTYPE_OM_CANCEL)); - _menuObjects.push_back(new MenuButton(this, OPTIONID_DONE, 168, 141, 74, 43, + _menuObjects.push_back(new MenuButton(this, OPTIONID_DONE, 168, 141, 74, 43, &OrionCallbacks::optionsDoneFn, false, false, OBJTYPE_OM_DONE)); - _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_MIDI, 47, 64, 212, 24, + _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_MIDI, 47, 64, 212, 24, _originalMidiVolume * 100 / 255, &OrionCallbacks::optionsMidiSliderFn, true)); - _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_DIGI, 47, 104, 212, 24, + _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_DIGI, 47, 104, 212, 24, 0, &OrionCallbacks::optionsDigiSliderFn, true)); _escapeHandler = &OrionCallbacks::optionsEscapeFn; @@ -381,21 +381,21 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool _selectedSlot = -1; _highlightedSlot = -1; _saveNames = _vm->_saveLoad->getSaves(); - + // Set up menu elements _menuObjects.push_back(new MenuMessage(this, SLTAG_SAVELOAD_LABEL, 50, 241, 70, 16)); - _menuObjects.push_back(new MenuButton(this, SLTAG_SAVELOAD, 214, 384, 72, 41, - (menuType == SAVE_MENU) ? &OrionCallbacks::saveLoadSaveFn : &OrionCallbacks::saveLoadLoadFn, + _menuObjects.push_back(new MenuButton(this, SLTAG_SAVELOAD, 214, 384, 72, 41, + (menuType == SAVE_MENU) ? &OrionCallbacks::saveLoadSaveFn : &OrionCallbacks::saveLoadLoadFn, true, true, (menuType == SAVE_MENU) ? OBJTYPE_SL_SAVE : OBJTYPE_SL_LOAD)); - _menuObjects.push_back(new MenuButton(this, SLTAG_CANCEL, 139, 384, 74, 43, + _menuObjects.push_back(new MenuButton(this, SLTAG_CANCEL, 139, 384, 74, 43, &OrionCallbacks::saveLoadCancelFn, false, false, OBJTYPE_SL_CANCEL)); - _menuObjects.push_back(new MenuVertSlider(this, SLTAG_VSLIDER, 291, 255, 23, 127, 0, + _menuObjects.push_back(new MenuVertSlider(this, SLTAG_VSLIDER, 291, 255, 23, 127, 0, &OrionCallbacks::saveLoadSliderFn)); if (_menuType == SAVE_MENU) _savegameThumbnail = createThumbnail(); - _menuObjects.push_back(new MenuImage(this, SLTAG_THUMBNAIL, 66, 28, 215, 162, + _menuObjects.push_back(new MenuImage(this, SLTAG_THUMBNAIL, 66, 28, 215, 162, (_savegameThumbnail == NULL) ? _sprites->getFrame(SL_EMPTY_THUMBNAIL) : _savegameThumbnail)); @@ -405,9 +405,9 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool // Get save slot bool isEmpty = (slotIndex >= _saveNames->size()) || (*slot).empty(); - _menuObjects.push_back(new MenuSaveLoadText(this, SLTAG_SLOTS_START + slotIndex, + _menuObjects.push_back(new MenuSaveLoadText(this, SLTAG_SLOTS_START + slotIndex, 50, 256 + slotIndex * 15, 238, 15, &OrionCallbacks::saveLoadSlotFn, - (menuType == LOAD_MENU) && isEmpty, true, (menuType == LOAD_MENU), + (menuType == LOAD_MENU) && isEmpty, true, (menuType == LOAD_MENU), isEmpty ? EmptySaveString : slot->c_str(), slotIndex + 1)); } } @@ -428,7 +428,7 @@ OrionMenuView::OrionMenuView(M4Engine *Vm, int x, int y, MenuType menuType, bool OrionMenuView::~OrionMenuView() { delete _sprites; - + for (MenuObjectList::iterator i = _menuObjects.begin(); i != _menuObjects.end(); ++i) delete *i; _menuObjects.clear(); @@ -506,7 +506,7 @@ M4Surface *OrionMenuView::createThumbnail() { for (int yCtr = yStart; yCtr <= yEnd; yCtr += 3) { srcP = (byte *)srcSurface.pixels + (yCtr * _vm->_screen->width()); - for (int xCtr = 0; xCtr < result->width(); ++xCtr, srcP += 3) + for (int xCtr = 0; xCtr < result->width(); ++xCtr, srcP += 3) *destP++ = *srcP; } @@ -518,7 +518,7 @@ void OrionMenuView::destroyView() { bool interfaceVisible = _interfaceWasVisible; engine->_viewManager->deleteView(this); - // Fade the game back in if no menu views are active (such as if a button was pressed in one menu + // Fade the game back in if no menu views are active (such as if a button was pressed in one menu // to activate another menu dialog) bool fadeIn = engine->_viewManager->getView(VIEWID_MENU) == NULL; @@ -589,7 +589,7 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool } if (_currentItem) { - captureEvents = + captureEvents = (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end()); if (!captureEvents) // The menu object is no longer active, so reset current item @@ -614,11 +614,11 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool return handledFlag; } else { - // Handle mouse events by scanning the item list to see if the cursor is within any + // Handle mouse events by scanning the item list to see if the cursor is within any for (i = _menuObjects.begin(); (i != _menuObjects.end()) && !handledFlag; ++i) { MenuObject *menuObj = *i; - + if (menuObj->isInside(localX, localY)) { // Found an item, so pass it the event menuObj->onEvent(eventType, param, localX, localY, _currentItem); @@ -631,7 +631,7 @@ bool OrionMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool } if (_currentItem) { - captureEvents = + captureEvents = (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end()); if (!captureEvents) // The menu object is no longer active, so reset current item @@ -708,7 +708,7 @@ void OrionMenuView::setTopSaveSlot(int slotNumber) { bool isEmpty = (slotIndex >= _saveNames->size()) || slot->empty(); item->setDisplay(slotIndex + 1, isEmpty ? EmptySaveString : slot->c_str()); - + item->setState((_menuType == SAVE_MENU) || !isEmpty ? OS_NORMAL : OS_GREYED); } } diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp index 777356467b..f9ad5a6fbd 100644 --- a/engines/m4/m4_views.cpp +++ b/engines/m4/m4_views.cpp @@ -31,7 +31,7 @@ namespace M4 { -GUIInventory::GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, +GUIInventory::GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, int vertCells, int cellWidth, int cellHeight, int tag): GUIRect(owner, bounds, tag) { _vm = vm; @@ -60,7 +60,7 @@ void GUIInventory::onRefresh() { //kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK)); _scrollable = false; - + // Get to the starting inventory position for display ItemsIterator i = _inventoryItems.begin(); int index = _scrollPosition; @@ -70,7 +70,7 @@ void GUIInventory::onRefresh() { for (index = 0; (i != _inventoryItems.end()) && (index < _cellCount.x * _cellCount.y); ++index, ++i) { GUIInventoryItem *item = (*i).get(); const Common::Point cellPos = getCellPosition(index); -/* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset, +/* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset, _bounds.top + cellPos.y + yOffset, _bounds.left + cellPos.x + xOffset + _cellSize.x, _bounds.top + cellPos.y + _cellSize.y);*/ @@ -83,9 +83,9 @@ void GUIInventory::onRefresh() { item->icon->copyTo(_parent, iconPt.x, iconPt.y, 0); - if (_highlightedIndex == index) + if (_highlightedIndex == index) _parent->frameRect(Common::Rect(iconPt.x - 2, iconPt.y - 2, - iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2), + iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2), _vm->_palette->LIGHT_GRAY); } } @@ -203,13 +203,13 @@ void GUIInventory::setHighlight(int index) { _highlightedIndex = index; } -void GUIInventory::setScrollPosition(int value) { +void GUIInventory::setScrollPosition(int value) { if (value < 0) return; else if (value >= (int)_inventoryItems.size() - (_cellCount.x * _cellCount.y)) return; - _scrollPosition = value; + _scrollPosition = value; } //-------------------------------------------------------------------------- @@ -218,8 +218,8 @@ const char *INTERFACE_SERIES = "999intr"; #define SPR(x) _sprites->getFrame(x) -GameInterfaceView::GameInterfaceView(M4Engine *vm): - View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, +GameInterfaceView::GameInterfaceView(M4Engine *vm): + View(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())), _statusText(GUITextField(this, Common::Rect(200, 1, 450, 21))), _inventory(GUIInventory(this, vm, Common::Rect(188, 22, 539, 97), 9, 1, 39, 75, 3)) { @@ -249,7 +249,7 @@ GameInterfaceView::GameInterfaceView(M4Engine *vm): _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(580, 10, 620, 69), 3, SPR(69), SPR(70), SPR(71)))); // abduction _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(582, 70, 619, 105), 4, SPR(76), SPR(77), SPR(78)))); // menu - + _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(168, 22, 188, 97), 5, SPR(60), SPR(61), SPR(62)))); // Scroll left _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(539, 22, 559, 97), 6, SPR(64), SPR(65), SPR(66)))); // Scroll right } @@ -272,7 +272,7 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, static bool selectionFlag = false; if (eventType == MEVENT_LEFT_RELEASE) selectionFlag = false; - + captureEvents = isInside(x, y); if (!captureEvents) return false; @@ -284,7 +284,7 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, _statusText.onEvent(eventType, param, localX, localY, currentItem); _inventory.onEvent(eventType, param, localX, localY, currentItem); - if (_vm->_mouse->getCursorNum() != CURSOR_LOOK && + if (_vm->_mouse->getCursorNum() != CURSOR_LOOK && _vm->_mouse->getCursorNum() != CURSOR_TAKE && _vm->_mouse->getCursorNum() != CURSOR_USE && _vm->_interfaceView->_inventory.getSelectedIndex() == -1) { @@ -329,13 +329,13 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y, return true; } - + void GameInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { clear(); _statusText.onRefresh(); _inventory.onRefresh(); - for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i) + for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i) ((*i).get())->onRefresh(); View::onRefresh(rects, destSurface); diff --git a/engines/m4/m4_views.h b/engines/m4/m4_views.h index 2f2d450332..ac1a2537ca 100644 --- a/engines/m4/m4_views.h +++ b/engines/m4/m4_views.h @@ -60,7 +60,7 @@ private: int _selectedIndex; M4Engine *_vm; public: - GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, + GUIInventory(View *owner, M4Engine *vm, const Common::Rect &bounds, int horizCells, int vertCells, int cellWidth, int cellHeight, int tag); void onRefresh(); @@ -71,14 +71,14 @@ public: int getInsideIndex(int x, int y); int getSelectedIndex() { return _selectedIndex; } const char *getSelectedObjectName(); - void clearSelected() { + void clearSelected() { _selectedIndex = -1; setHighlight(-1); } const Common::Point &getCellPosition(int index); void setHighlight(int index); bool needLeftButton() { return _scrollPosition != 0; } - bool needRightButton() { + bool needRightButton() { return (uint)(_inventoryItems.size() - _scrollPosition) > (uint)(_cellCount.x * _cellCount.y); } void setScrollPosition(int value); diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index f9374f866a..39ff2b739f 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -116,10 +116,10 @@ void TextviewView::setScript(const char *resourceName, TextviewCallback callback _script = _vm->res()->get(_resourceName); - processLines(); + processLines(); } -bool TextviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { +bool TextviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { if (!_processEvents) return false; @@ -180,7 +180,7 @@ void TextviewView::updateState() { byte *lineTemp = new byte[_panX]; for (int y = 0; y < _bgSurface.height(); ++y) { byte *pixelsP = _bgSurface.getBasePtr(0, y); - + // Copy the first X pixels into temp buffer, move the rest of the line // to the start of the line, and then move temp buffer pixels to end of line Common::copy(pixelsP, pixelsP + _panX, lineTemp); @@ -231,10 +231,10 @@ void TextviewView::updateState() { // Refresh the view int yp = (height() - _bgSurface.height()) / 2; _bgSurface.copyTo(this, 0, yp); - _textSurface.copyTo(this, Common::Rect(0, 0, _textSurface.width(), _bgSurface.height()), + _textSurface.copyTo(this, Common::Rect(0, 0, _textSurface.width(), _bgSurface.height()), 0, yp, _vm->_palette->BLACK); } - + void TextviewView::scriptDone() { TextviewCallback fn = _callback; M4Engine *vm = _vm; @@ -242,7 +242,7 @@ void TextviewView::scriptDone() { // Remove this view from manager and destroy it _vm->_viewManager->deleteView(this); - if (fn) + if (fn) fn(vm); } @@ -341,7 +341,7 @@ void TextviewView::processCommand() { // Set sound number paramP = commandStr + 5; //int soundId = getParameter(¶mP); - + //TODO: Proper handling of the sound drivers/sounds //if (!_soundDriverLoaded) // error("Attempted to set sound without loading any driver\n"); @@ -433,7 +433,7 @@ void TextviewView::processText() { // Copy the text line onto the bottom of the textSurface surface, which will allow it // to gradually scroll onto the screen int yp = _textSurface.height() - _vm->_font->getHeight() - TEXTVIEW_LINE_SPACING; - _textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()), + _textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()), _vm->_palette->BLACK); _vm->_font->writeString(&_textSurface, _currentLine, xStart, yp); } @@ -492,10 +492,10 @@ void AnimviewView::setScript(const char *resourceName, AnimviewCallback callback _script = _vm->res()->get(_resourceName); - processLines(); + processLines(); } -bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { +bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { // Wait for the Escape key or a mouse press if (((eventType == KEVENT_KEY) && (param == Common::KEYCODE_ESCAPE)) || (eventType == MEVENT_LEFT_RELEASE) || (eventType == MEVENT_RIGHT_RELEASE)) { @@ -510,7 +510,7 @@ bool AnimviewView::onEvent(M4EventType eventType, int param, int x, int y, bool void AnimviewView::updateState() { char bgFile[10]; int bgNumber = 0; - + // Only update state if wait period has expired if (_previousUpdate > 0) { if (g_system->getMillis() - _previousUpdate < 3000) { @@ -584,7 +584,7 @@ void AnimviewView::updateState() { // Read next line processLines(); } - + void AnimviewView::scriptDone() { AnimviewCallback fn = _callback; M4Engine *vm = _vm; @@ -592,7 +592,7 @@ void AnimviewView::scriptDone() { // Remove this view from manager and destroy it _vm->_viewManager->deleteView(this); - if (fn) + if (fn) fn(vm); } diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index 713e3bbfd5..4d380bbda8 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -48,7 +48,7 @@ typedef void (*TextviewCallback)(M4Engine *vm); class TextviewView: public View { private: bool _animating; - + char _resourceName[80]; Common::SeekableReadStream *_script; uint16 _spareScreens[10]; diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp index 2857fc8080..3782b58e01 100644 --- a/engines/m4/mads_menus.cpp +++ b/engines/m4/mads_menus.cpp @@ -33,12 +33,12 @@ namespace M4 { #define DRAGON_MENUSCREEN 922 static Common::Point rexMenuItemPosList[6] = { - Common::Point(12, 68), Common::Point(12, 87), Common::Point(12, 107), + Common::Point(12, 68), Common::Point(12, 87), Common::Point(12, 107), Common::Point(184, 75), Common::Point(245, 75), Common::Point(184, 99) }; static Common::Point dragonMenuItemPosList[6] = { - Common::Point(46, 187), Common::Point(92, 187), Common::Point(138, 187), + Common::Point(46, 187), Common::Point(92, 187), Common::Point(138, 187), Common::Point(184, 187), Common::Point(230, 187), Common::Point(276, 187) }; @@ -85,7 +85,7 @@ RexMainMenuView::~RexMainMenuView() { for (uint i = 0; i < _itemPalData.size(); ++i) { _vm->_palette->deleteRange(_itemPalData[i]); delete _itemPalData[i]; - } + } } bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -100,7 +100,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo case Common::KEYCODE_F1: handleAction(START_GAME); break; - + case Common::KEYCODE_F2: handleAction(RESUME_GAME); break; @@ -162,7 +162,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo menuIndex = getHighlightedItem(x, y); if (menuIndex != _highlightedIndex) { _bgSurface->copyTo(this, 0, row); - + _highlightedIndex = menuIndex; if (_highlightedIndex != -1) { M4Sprite *spr = _menuItem->getFrame(_highlightedIndex); @@ -184,7 +184,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bo default: break; } - + return false; } @@ -195,7 +195,7 @@ void RexMainMenuView::updateState() { int itemSize; uint32 currTime = g_system->getMillis(); - if (currTime < _delayTimeout) + if (currTime < _delayTimeout) return; _delayTimeout = currTime + MADS_MENU_ANIM_DELAY; @@ -213,8 +213,8 @@ void RexMainMenuView::updateState() { if (_menuItem) { // Draw the final frame of the menuitem M4Sprite *spr = _menuItem->getFrame(0); - itemSize = _menuItem->getFrame(0)->height(); - spr->copyTo(this, rexMenuItemPosList[_menuItemIndex - 1].x, + itemSize = _menuItem->getFrame(0)->height(); + spr->copyTo(this, rexMenuItemPosList[_menuItemIndex - 1].x, rexMenuItemPosList[_menuItemIndex - 1].y + row + (itemSize / 2) - (spr->height() / 2), 0); delete _menuItem; @@ -243,7 +243,7 @@ void RexMainMenuView::updateState() { if (_menuItem) { delete _menuItem; - // Copy over the current display surface area to the background, so the final frame + // Copy over the current display surface area to the background, so the final frame // of the previous menuitem should be kept on the screen copyTo(_bgSurface, Common::Rect(0, row, width(), row + MADS_SURFACE_HEIGHT), 0, 0); } @@ -262,7 +262,7 @@ void RexMainMenuView::updateState() { _frameIndex = _menuItem->getCount() - 1; - // If the final resource is now loaded, which contains the highlighted versions of + // If the final resource is now loaded, which contains the highlighted versions of // each menuitem, then the startup animation is complete if (_menuItemIndex == 7) { _vm->_mouse->cursorOn(); @@ -274,7 +274,7 @@ void RexMainMenuView::updateState() { // Move to the next menuitem frame - itemSize = _menuItem->getFrame(0)->height(); + itemSize = _menuItem->getFrame(0)->height(); _bgSurface->copyTo(this, 0, row); M4Sprite *spr = _menuItem->getFrame(_frameIndex); @@ -289,7 +289,7 @@ int RexMainMenuView::getHighlightedItem(int x, int y) { const Common::Point &pt = rexMenuItemPosList[index]; M4Sprite *spr = _menuItem->getFrame(index); - if ((x >= pt.x) && (y >= pt.y) && (x < (pt.x + spr->width())) && (y < (pt.y + spr->height()))) + if ((x >= pt.x) && (y >= pt.y) && (x < (pt.x + spr->width())) && (y < (pt.y + spr->height()))) return index; } @@ -346,9 +346,9 @@ void RexMainMenuView::handleAction(MadsGameAction action) { //-------------------------------------------------------------------------- -MadsMainMenuView::MadsMainMenuView(M4Engine *vm): +MadsMainMenuView::MadsMainMenuView(M4Engine *vm): View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) { - + } bool MadsMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -391,7 +391,7 @@ DragonMainMenuView::~DragonMainMenuView() { for (uint i = 0; i < _itemPalData.size(); ++i) { _vm->_palette->deleteRange(_itemPalData[i]); delete _itemPalData[i]; - } + } } bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, bool &captureEvents) { @@ -409,7 +409,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, case Common::KEYCODE_F1: handleAction(START_GAME); break; - + case Common::KEYCODE_F2: handleAction(RESUME_GAME); break; @@ -439,7 +439,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, if (_vm->_mouse->getCursorOn()) { menuIndex = getHighlightedItem(x, y); if (menuIndex != _highlightedIndex) { - + _highlightedIndex = menuIndex; if (_highlightedIndex != -1) { sprintf(resName, "MAIN%d.SS", menuIndex); @@ -465,7 +465,7 @@ bool DragonMainMenuView::onEvent(M4EventType eventType, int param, int x, int y, default: break; } - + return false; } diff --git a/engines/m4/midi.h b/engines/m4/midi.h index 78dacdf77e..8e157cfbd1 100644 --- a/engines/m4/midi.h +++ b/engines/m4/midi.h @@ -93,7 +93,7 @@ protected: byte *convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize); }; -} // End of namespace M4 +} // End of namespace M4 #endif - + diff --git a/engines/m4/rails.cpp b/engines/m4/rails.cpp index 0153934a88..18b3bf7232 100644 --- a/engines/m4/rails.cpp +++ b/engines/m4/rails.cpp @@ -174,10 +174,10 @@ long SqrtF16(long n) { uint32 v = (uint32)n; for (int i = 15; i <= 0; i--) { - s = r + (1L << i * 2); + s = r + (1L << i * 2); r >>= 1; - if (s <= v) { - v -= s; + if (s <= v) { + v -= s; r |= (1L << i * 2); } } @@ -254,7 +254,7 @@ void Rails::createEdge(int32 node1, int32 node2) { } -void Rails::restoreNodeEdges(int32 nodeID) { +void Rails::restoreNodeEdges(int32 nodeID) { for (int32 i = 0; i < MAXRAILNODES; i++) { createEdge(i, nodeID); } @@ -305,7 +305,7 @@ bool Rails::removeRailNode(int32 nodeID, bool restoreEdges) { int16 Rails::getEdgeLength(int32 node1, int32 node2) { int32 index; - if (_edges.empty() || node1 == node2) + if (_edges.empty() || node1 == node2) return 0; if (node2 < node1) SWAP(node1, node2); diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp index 265e4dae0b..eb9a69998c 100644 --- a/engines/m4/resource.cpp +++ b/engines/m4/resource.cpp @@ -124,7 +124,7 @@ Common::SeekableReadStream *FileSystem::loadFile(const char *resourceName, bool else // Creates a SeekableSubReadStream, which will read the data in from disk as the // caller reads in data - result = new Common::SeekableSubReadStream(hagEntry->hagFile, hfe->offset, + result = new Common::SeekableSubReadStream(hagEntry->hagFile, hfe->offset, hfe->offset + hfe->size); } else { @@ -193,7 +193,7 @@ Common::SeekableReadStream *ResourceManager::get(const char *resourceName, bool newRes->name[63] = '\0'; newRes->flags = 0; newRes->stream = loadResource(resourceName, preloadFlag); - + _resources.push_back(ResourceList::value_type(newRes)); return newRes->stream; } @@ -231,7 +231,7 @@ void ResourceManager::dump() { ResourceIterator i; for (i = _resources.begin(); i != _resources.end(); ++i) { Resource *r = (*i).get(); - + if (!(r->flags & kResourcePurge)) { _vm->_events->getConsole()->DebugPrintf( "Resource #%i, name: %s, handle pointer: %p, size: %d, flags: %02X\n", @@ -272,7 +272,7 @@ ResourceType MADSResourceManager::getResourceType(const char *resourceName) { } else if (!strncmp(resourceName, "SPCHC", 5)) { // SPEECH resource return RESTYPE_SPEECH; - } + } // Check for a known extension const char *extPos = strchr(resourceName, '.'); @@ -313,7 +313,7 @@ Common::SeekableReadStream *MADSResourceManager::loadResource(const char *resour uint32 offset = 0, size = 0; // If the first character is a '@' then look for an external file - + if (*resourceName == '@') { ++resourceName; @@ -354,7 +354,7 @@ Common::SeekableReadStream *MADSResourceManager::loadResource(const char *resour } if (resIndex == numEntries) - error("Invalid resource '%s' specified", resourceName); + error("Invalid resource '%s' specified", resourceName); // Get the resource, either loading it in it's entirely or getting a stream reference @@ -426,7 +426,7 @@ Common::SeekableReadStream *M4ResourceManager::loadResource(const char *resource } else { error("M4ResourceManager::loadResource() No FileSystem attached"); } - return result; + return result; } bool M4ResourceManager::resourceExists(const char *resourceName) { diff --git a/engines/m4/saveload.cpp b/engines/m4/saveload.cpp index b46783ef4d..9147cd0906 100644 --- a/engines/m4/saveload.cpp +++ b/engines/m4/saveload.cpp @@ -38,7 +38,7 @@ SaveLoad::SaveLoad(M4Engine *vm) : _vm(vm) { // For Orion Burger, check the existance of a 'saves.dir' file to determine whether to // act exactly like the original. Otherwise, we'll use the ScummVM standard, where we'll // keep all the data for a savegame in a single file - + Common::File file; _emulateOriginal = file.exists(orionSavesList); } @@ -100,7 +100,7 @@ SaveGameList *SaveLoad::getSaves() { } else { // Skip over byte offset assert(saveFile->readUint32LE() < 0x100); - + // Read in savegame name saveFile->read(&saveName[0], MAX_SAVEGAME_NAME); result->push_back(Common::String(saveName)); @@ -133,7 +133,7 @@ M4Surface *SaveLoad::getThumbnail(int slotNumber) { // Open up savegame for access via savefile manager saveFile = _vm->saveManager()->openForLoading(generateSaveName(slotNumber)); } - if (!saveFile) + if (!saveFile) return NULL; dataOffset = saveFile->readUint32LE(); diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp index c2de811d38..45659b8696 100644 --- a/engines/m4/scene.cpp +++ b/engines/m4/scene.cpp @@ -127,7 +127,7 @@ void Scene::loadScene(int sceneNumber) { } } - if (_vm->getGameType() == GType_Burger && + if (_vm->getGameType() == GType_Burger && sceneNumber != TITLE_SCENE_BURGER && sceneNumber != MAINMENU_SCENE_BURGER) _vm->_interfaceView->setStatusText(""); @@ -148,7 +148,7 @@ void Scene::loadScene(int sceneNumber) { // Load scene walk path file (*.COD/*.WW?) loadSceneCodes(sceneNumber); - + // Load inverse color table file (*.IPL) loadSceneInverseColorTable(sceneNumber); @@ -277,7 +277,7 @@ void Scene::loadSceneInverseColorTable(int sceneNumber) { // TODO? return; } - + } diff --git a/engines/m4/scene.h b/engines/m4/scene.h index 77578f5a02..4cf05ddddd 100644 --- a/engines/m4/scene.h +++ b/engines/m4/scene.h @@ -91,7 +91,7 @@ public: void checkHotspotAtMousePosMads(int x, int y); void showHotSpots(); void showCodes(); - int getCurrentScene() { return _currentScene; } + int getCurrentScene() { return _currentScene; } SceneResources getSceneResources() { return _sceneResources; } M4Surface *getBackgroundSurface() const { return _backgroundSurface; } byte *getInverseColorTable() const { return _inverseColorTable; } diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp index c1725cbfdd..439c111ce9 100644 --- a/engines/m4/script.cpp +++ b/engines/m4/script.cpp @@ -59,9 +59,9 @@ enum OpcodeType { opXor, opShl, opShr, - + opDebug, - + opInvalid }; @@ -262,7 +262,7 @@ void ScriptInterpreter::open(const char *filename) { } _functions.push_back(new ScriptFunctionEntry(offset)); } - + int dataCount = _scriptFile->readUint32LE(); printf("dataCount = %d\n", dataCount); for (int i = 0; i < dataCount; i++) { @@ -304,7 +304,7 @@ void ScriptInterpreter::initScriptKernel() { _kernelFunctions = kernelFunctions; _kernelFunctionsMax = ARRAYSIZE(kernelFunctions) + 1; - + _kernelVars = kernelVars; _kernelVarsMax = ARRAYSIZE(kernelVars) + 1; @@ -360,7 +360,7 @@ int ScriptInterpreter::runFunction(ScriptFunction *scriptFunction) { done = !execOpcode(opcode); fflush(stdout); } - + _localStackPtr = oldLocalStackPtr; _runningFunction = oldRunningFunction; @@ -425,11 +425,11 @@ const char *ScriptInterpreter::toString(const ScriptValue &value) { case kConstString: return _constStrings[value.value]; - + default: printf("ScriptInterpreter::toString() Invalid type %d!\n", value.type); return NULL; - + } } @@ -487,7 +487,7 @@ void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceVal case kRegister: _registers[destValue.value] = sourceValue; break; - + case kLogicVar: // TODO: Move to own method if (sourceValue.type == kInteger) { @@ -546,7 +546,7 @@ void ScriptInterpreter::derefValue(ScriptValue &value) { void ScriptInterpreter::callKernelFunction(uint32 index) { printf("ScriptInterpreter::callKernelFunction() index = %d\n", index); - + if (index > _kernelFunctionsMax) { printf("ScriptInterpreter::callKernelFunction() Invalid kernel functionindex (%d)\n", index); return; @@ -558,7 +558,7 @@ void ScriptInterpreter::callKernelFunction(uint32 index) { // Now remove values from the stack if the function used any if (args > 4) _stackPtr -= args - 4; - + printf("-------------\n"); } @@ -656,7 +656,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) { printf("-> ofs = %08X\n", temp); _runningFunction->jumpAbsolute(temp); return true; - + case opJl: temp = _runningFunction->readUint32(); if (_cmpFlags < 0) { @@ -779,7 +779,7 @@ bool ScriptInterpreter::execOpcode(byte opcode) { default: printf("Invalid opcode %d!\n", opcode); return false; - + } return false; @@ -947,13 +947,13 @@ int ScriptInterpreter::o1_playSound() { int room = INTEGER(4); printf("name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n", name, channel, volume, trigger, room); - + Common::String soundName = Common::String(name) + ".raw"; _vm->_sound->playVoice(soundName.c_str(), 100); - + // HACK until fixed _vm->_kernel->sendTrigger(trigger); - + return 5; } @@ -994,10 +994,10 @@ int ScriptInterpreter::o1_fadeInit() { int trigger = INTEGER(5); printf("first = %d; last = %d; percent = %d; ticks = %d; trigger = %d\n", first, last, percent, ticks, trigger); - + // HACK until palette fading is implemented _vm->_kernel->sendTrigger(trigger); - + return 6; } @@ -1029,12 +1029,12 @@ int ScriptInterpreter::o1_hasPlayerSaid() { for (int i = 0; i < 3; i++) words[i] = STRING(i); printf("'%s', '%s', '%s'\n", words[0], words[1], words[2]); - + int result = _vm->_player->said(words[0], words[1], words[2]); printf(" -> '%d'\n", result); fflush(stdout); - + RETURN(result); return 3; } @@ -1046,7 +1046,7 @@ int ScriptInterpreter::o1_hasPlayerSaidAny() { printf("'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'\n", words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]); - + int result = _vm->_player->saidAny(words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]); printf(" -> '%d'\n", result); fflush(stdout); @@ -1097,9 +1097,9 @@ int ScriptInterpreter::o1_setHotspot() { const char *name = STRING(1); int value = INTEGER(2); printf("name = '%s' -> %d\n", name, value); - + _vm->_scene->getSceneResources().hotspots->setActive(name, (value != 0)); - + return 2; } @@ -1110,7 +1110,7 @@ int ScriptInterpreter::o1_loadConversation() { // TODO; just to show something _vm->_converse->startConversation(name); - + return 3; } @@ -1126,7 +1126,7 @@ int ScriptInterpreter::o1_playSeries() { int y = INTEGER(8); int firstFrame = INTEGER(9); int lastFrame = INTEGER(10); - + printf("name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n", name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame); fflush(stdout); @@ -1165,9 +1165,9 @@ int ScriptInterpreter::o1_loadSeries() { printf("name = %s; hash = %d\n", name, hash); fflush(stdout); - + int result = _vm->_ws->loadSeries(name, hash, NULL); - + RETURN(result); return 3; } @@ -1210,10 +1210,10 @@ int ScriptInterpreter::o1_triggerTimerProc() { int ScriptInterpreter::o1_dispatchTrigger() { int trigger = INTEGER(0); printf("trigger = %d\n", trigger); - + _vm->_kernel->sendTrigger(trigger); //g_system->delayMillis(5000); - + return 1; } @@ -1226,11 +1226,11 @@ int ScriptInterpreter::o1_getRangedRandomValue() { int ScriptInterpreter::o1_wilburSaid() { const SaidArray& saidArray = DATA(0, SaidArray); - + int result = 0; // NOTE: The "Common::String soundName" stuff is just temporary until playVoice is fixed. - + for (int i = 0; i < saidArray.size(); i++) { SaidArrayItem *item = saidArray[i]; @@ -1265,7 +1265,7 @@ int ScriptInterpreter::o1_wilburSaid() { } printf(" -> '%d'\n", result); fflush(stdout); - + RETURN(result); return 1; } @@ -1287,13 +1287,13 @@ int ScriptInterpreter::o1_wilburSpeech() { printf("%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot); fflush(stdout); //g_system->delayMillis(5000); - + KernelTriggerType oldTriggerMode = _vm->_kernel->triggerMode; // TODO Common::String soundName = Common::String(name) + ".raw"; _vm->_sound->playVoice(soundName.c_str(), 100); - + _vm->_kernel->triggerMode = oldTriggerMode; return 6; @@ -1346,7 +1346,7 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) { case kPlayerCommandReady: value = (int)_vm->_player->commandReady; break; - + default: printf("ScriptInterpreter::getKernelVar() Invalid kernel var %d!\n", var); //g_system->delayMillis(2000); @@ -1358,14 +1358,14 @@ void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) { void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { printf("ScriptInterpreter::setKernelVar() index = %d\n", index); - + if (index > _kernelVarsMax) { printf("ScriptInterpreter::setKernelVar() Invalid kernel var index %d!\n", index); return; } printf("ScriptInterpreter::setKernelVar() name = %s\n", _kernelVars[index].desc); - + ScriptKernelVariable var = _kernelVars[index].var; switch (var) { @@ -1374,7 +1374,7 @@ void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { _vm->_kernel->trigger = toInteger(value); printf("kKernelTrigger -> %d\n", toInteger(value)); break; - + case kKernelTriggerMode: _vm->_kernel->triggerMode = (KernelTriggerType)toInteger(value); printf("kKernelTrigger -> %d\n", toInteger(value)); @@ -1389,7 +1389,7 @@ void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) { _vm->_kernel->newRoom = toInteger(value); printf("kGameNewRoom -> %d\n", toInteger(value)); break; - + case kPlayerCommandReady: // TODO printf("kPlayerCommandReady -> %d\n", toInteger(value)); diff --git a/engines/m4/script.h b/engines/m4/script.h index 2a937040e9..63dc32958b 100644 --- a/engines/m4/script.h +++ b/engines/m4/script.h @@ -98,7 +98,7 @@ struct ScriptValue { value = intValue; return *this; } - + }; class ScriptDataItem { @@ -284,13 +284,13 @@ public: //TODO void unloadData(); /* Executes a function. */ int runFunction(ScriptFunction *scriptFunction); - + void push(const ScriptValue &value); void pop(ScriptValue &value); void dumpStack(); void dumpRegisters(); void dumpGlobalVars(); - + int toInteger(const ScriptValue &value); const char *toString(const ScriptValue &value); @@ -320,10 +320,10 @@ protected: Common::File *_scriptFile; /* An array of offset/ScriptFunction* pairs for each script function */ Common::Array<ScriptFunctionEntry*> _functions; - + // DEBUG only Common::Array<Common::String> _scriptFunctionNames; - + Common::Array<ScriptDataEntry*> _data; /* Maps function name -> index of function in _functions array */ FunctionNameMap _functionNames; @@ -339,7 +339,7 @@ protected: int _globalVarCount; ScriptValue _globalVars[1024]; - + int _logicGlobals[512]; int _cmpFlags; @@ -369,7 +369,7 @@ protected: void writeValue(ScriptValue &value); void copyValue(ScriptValue &destValue, ScriptValue &sourceValue); void derefValue(ScriptValue &value); - + void callKernelFunction(uint32 index); ScriptValue getArg(uint32 index); void dumpArgs(uint32 count); diff --git a/engines/m4/sound.cpp b/engines/m4/sound.cpp index 3091592313..542e8ebdcd 100644 --- a/engines/m4/sound.cpp +++ b/engines/m4/sound.cpp @@ -80,7 +80,7 @@ void Sound::playSound(const char *soundName, int volume, bool loop, int channel) } else { warning("Attempted to play a sound on a channel that isn't free"); return; - } + } } int bufferSize = soundStream->size(); @@ -124,7 +124,7 @@ void Sound::stopSound(int channel) { } else { warning("Attempted to stop a sound on a channel that is already free"); return; - } + } } for (int i = 0; i < SOUND_HANDLES; i++) { @@ -215,7 +215,7 @@ void Sound::loadDSRFile(const char *fileName) { printf("\n"); */ } - + _vm->res()->toss(fileName); _dsrFileLoaded = true; @@ -264,11 +264,11 @@ void Sound::playDSRSound(int soundIndex, int volume, bool loop) { fileStream->read(compData, _dsrFile.dsrEntries[soundIndex]->compSize); _vm->res()->toss(_dsrFile.fileName); - fab.decompress(compData, _dsrFile.dsrEntries[soundIndex]->compSize, + fab.decompress(compData, _dsrFile.dsrEntries[soundIndex]->compSize, buffer, _dsrFile.dsrEntries[soundIndex]->uncompSize); // Play sound - _mixer->playRaw(Audio::Mixer::kSFXSoundType, &handle->handle, buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, &handle->handle, buffer, _dsrFile.dsrEntries[soundIndex]->uncompSize, _dsrFile.dsrEntries[soundIndex]->frequency, flags, -1, volume); diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp index 3862435216..6c7911b2e9 100644 --- a/engines/m4/sprite.cpp +++ b/engines/m4/sprite.cpp @@ -53,7 +53,7 @@ M4Sprite::M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int w } else { loadMadsSprite(source); } - + xOffset = xOfs; yOffset = yOfs; diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp index b74e598c6c..8bd56fab61 100644 --- a/engines/m4/viewmgr.cpp +++ b/engines/m4/viewmgr.cpp @@ -169,7 +169,7 @@ void View::restore(int x1, int y1, int x2, int y2) { void View::onRefresh(RectList *rects, M4Surface *destSurface) { assert(destSurface); - if (rects == NULL) + if (rects == NULL) // No rect list specified, so copy entire surface copyTo(destSurface, _coords.left, _coords.top, _transparent ? 0 : -1); else { @@ -222,7 +222,7 @@ void ViewManager::handleKeyboardEvents(uint32 keycode) { // Scan view list for one which accepts or blocks keyboard events. If one is found, // then the event is passed to it - + view = NULL; handledFlag = false; foundFlag = false; @@ -241,7 +241,7 @@ void ViewManager::handleKeyboardEvents(uint32 keycode) { handledFlag = (view->onEvent)(KEVENT_KEY, keycode, mousePos.x, mousePos.y, _captureEvents); } } - + // Scan view list for one with a hotkey list, aborting if a view is found that either // blocks keyboard events, or has a hotkey list that includes the keycode @@ -303,9 +303,9 @@ void ViewManager::handleMouseEvents(M4EventType event) { if (foundFlag) view->onEvent(event, 0, mousePos.x, mousePos.y, _captureEvents); - else + else _captureEvents = false; - if (_captureEvents) + if (_captureEvents) _captureScreen = view; } } @@ -363,7 +363,7 @@ View *ViewManager::getView(int screenType) { return *i; ++i; } - + return NULL; } @@ -395,7 +395,7 @@ void ViewManager::refreshAll() { void ViewManager::showTextView(const char *textViewName, bool returnToMainMenu) { // Deactivate the scene if it's currently active View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view != NULL) + if (view != NULL) _vm->_viewManager->deleteView(view); // Deactivate the main menu if it's currently active @@ -416,7 +416,7 @@ void ViewManager::showTextView(const char *textViewName, bool returnToMainMenu) void ViewManager::showAnimView(const char *animViewName, bool returnToMainMenu) { // Deactivate the scene if it's currently active View *view = _vm->_viewManager->getView(VIEWID_SCENE); - if (view != NULL) + if (view != NULL) _vm->_viewManager->deleteView(view); // Deactivate the main menu if it's currently active diff --git a/engines/m4/viewmgr.h b/engines/m4/viewmgr.h index d3e7b1622d..4c4f227c5c 100644 --- a/engines/m4/viewmgr.h +++ b/engines/m4/viewmgr.h @@ -43,7 +43,7 @@ class ViewManager; enum {SCREEN_DIALOG, SCREEN_BUFFER, SCREEN_TEXT, SCREEN_TRANSPARENT}; enum ScreenEventType {SCREVENT_NONE = 0, SCREVENT_KEY = 1, SCREVENT_MOUSE = 2, SCREVENT_ALL = 3}; enum ScreenLayers { - LAYER_BACKGROUND = 0, LAYER_DRIFTER = 1, LAYER_INTERFACE = 1, LAYER_FLOATER = 2, + LAYER_BACKGROUND = 0, LAYER_DRIFTER = 1, LAYER_INTERFACE = 1, LAYER_FLOATER = 2, LAYER_SURFACE = 3, LAYER_MENU = 9, LAYER_MOUSE = 15 }; @@ -121,7 +121,7 @@ public: void moveRelative(int x, int y); void resize(int newWidth, int newHeight); void restore(int x1, int y1, int x2, int y2); - + Common::Rect bounds() const { return _coords; } bool isInside(int x, int y) const { return _coords.contains(x, y); } ScreenFlags screenFlags() const { return _screenFlags; } diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp index 15d86a407e..25cfaa7664 100644 --- a/engines/m4/woodscript.cpp +++ b/engines/m4/woodscript.cpp @@ -159,9 +159,9 @@ WoodScript::WoodScript(M4Engine *vm) { _assets = new AssetManager(vm); _globals = new long[256]; //FIXME Find out how many globals there should be memset(_globals, 0, sizeof(long)); - + _backgroundSurface = NULL; - + Common::Rect viewBounds = Common::Rect(0, 0, 640, 480); //_surfaceView = new View(viewBounds); } @@ -206,10 +206,10 @@ Machine *WoodScript::createMachine(int32 machineHash, Sequence *parentSeq, _machineId++; _machines.push_back(machine); - + // goto first state for initialization machine->enterState(); - + return machine; } @@ -278,7 +278,7 @@ Machine *WoodScript::showSeries(const char *seriesName, long layer, uint32 flags _globals[kGlobTemp16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0; return createMachine(1, NULL, -1, -1, kCallbackTriggerDispatch, seriesName); - + } Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long layer, int32 triggerNum) { @@ -297,7 +297,7 @@ Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long void WoodScript::update() { // TODO: Don't show hidden sequences etc. - // TODO: For now, prevent any engine action if a menu is being displayed - eventually this should be + // TODO: For now, prevent any engine action if a menu is being displayed - eventually this should be // changed to a proper check of the engine paused variable, which the menus should set while active if (_vm->_viewManager->getView(VIEWID_MENU) != NULL) return; @@ -334,11 +334,11 @@ void WoodScript::update() { // TODO: Use correct clipRect etc. Common::Rect clipRect = Common::Rect(0, 0, 640, 480); Common::Rect updateRect; - + sequence->draw(_surfaceView, clipRect, updateRect); } - + // Handle end-of-sequence requests if (_endOfSequenceRequestList.size() > 0) { for (Common::Array<Sequence*>::iterator it = _endOfSequenceRequestList.begin(); it != _endOfSequenceRequestList.end(); it++) { @@ -357,11 +357,11 @@ void WoodScript::clear() { for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); it++) delete *it; _sequences.clear(); - + for (Common::Array<Machine*>::iterator it = _machines.begin(); it != _machines.end(); it++) delete *it; _machines.clear(); - + _layers.clear(); _endOfSequenceRequestList.clear(); diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h index 7e968742b8..4a135e29ad 100644 --- a/engines/m4/woodscript.h +++ b/engines/m4/woodscript.h @@ -110,14 +110,14 @@ public: long *getVarPtr(int index); long *getParentVarPtr(int index); long *getDataPtr(int index); - + void setActive(bool active) { _active = active; } bool isActive() const { return _active; } bool isTerminated() const { return _terminated; } void draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect); - + bool s1_end(Instruction &instruction); bool s1_clearVars(Instruction &instruction); bool s1_set(Instruction &instruction); @@ -185,9 +185,9 @@ protected: EndOfSequenceRequestItem _endOfSequenceRequest; int32 _indexReg; - + M4Sprite *_curFrame; - + int32 _sequenceHash; int32 _returnHashes[8]; //FIXME: Use constant instead of 8 @@ -305,7 +305,7 @@ public: /* Misc */ void setDepthTable(int16 *depthTable); - + long *getGlobalPtr(int index); long getGlobal(int index); void setGlobal(int index, long value); @@ -316,9 +316,9 @@ public: void setBackgroundSurface(M4Surface *backgroundSurface); // Sets the view which is used for drawing void setSurfaceView(View *view); - + RGB8 *getMainPalette() const; - + void setInverseColorTable(byte *inverseColorTable) { _inverseColorTable = inverseColorTable; } byte *getInverseColorTable() const { return _inverseColorTable; } @@ -331,7 +331,7 @@ protected: int32 _machineId; long *_globals; - + Common::Array<Sequence*> _endOfSequenceRequestList; int32 _indexReg; diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp index ece76fe5ab..0410f29f5b 100644 --- a/engines/m4/ws_machine.cpp +++ b/engines/m4/ws_machine.cpp @@ -125,7 +125,7 @@ bool Machine::searchPersistentMessages(uint32 messageHash, uint32 messageValue, void Machine::enterState() { MachineAsset *machineAsset = _ws->assets()->getMachine(_machHash); - + _code->jumpAbsolute(machineAsset->getStateOffset(_currentState)); int32 instruction = -1; @@ -207,7 +207,7 @@ void Machine::execBlock(int32 offset, int32 count) { instruction = execInstruction(); //g_system->delayMillis(500); } - + //printf("---------------------------------------\n"); fflush(stdout); if (instruction == 3) { diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp index 918979ad17..e980d91675 100644 --- a/engines/m4/ws_sequence.cpp +++ b/engines/m4/ws_sequence.cpp @@ -284,7 +284,7 @@ long *Sequence::getDataPtr(int index) { void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect) { SpriteInfo info; - + info.sprite = _curFrame; info.hotX = _curFrame->xOffset; info.hotY = _curFrame->yOffset; @@ -297,19 +297,19 @@ void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Re info.scaleX = _vars[kSeqVarWidth] < 0 ? -scaler : scaler; info.scaleY = scaler; surface->drawSprite(_vars[kSeqVarX] >> 16, _vars[kSeqVarY] >> 16, info, clipRect); - + } bool Sequence::s1_end(Instruction &instruction) { //printf("Sequence::s1_end()\n"); - + _terminated = true; return false; } bool Sequence::s1_clearVars(Instruction &instruction) { //printf("Sequence::s1_clearVars()\n"); - + clearVars(); _vars[kSeqVarMachineID] = _machine->getId(); return true; @@ -317,7 +317,7 @@ bool Sequence::s1_clearVars(Instruction &instruction) { bool Sequence::s1_set(Instruction &instruction) { //printf("Sequence::s1_set()\n"); - + *instruction.argp[0] = instruction.getValue(); return true; } @@ -337,7 +337,7 @@ bool Sequence::s1_compare(Instruction &instruction) { bool Sequence::s1_add(Instruction &instruction) { //printf("Sequence::s1_add()\n"); - + *instruction.argp[0] += instruction.getValue(); return true; } @@ -429,28 +429,28 @@ bool Sequence::s1_cos(Instruction &instruction) { bool Sequence::s1_abs(Instruction &instruction) { //printf("Sequence::s1_abs()\n"); - + *instruction.argp[0] = ABS(instruction.argv[1]); return true; } bool Sequence::s1_min(Instruction &instruction) { //printf("Sequence::s1_min()\n"); - + *instruction.argp[0] = MIN(instruction.argv[1], instruction.argv[2]); return true; } bool Sequence::s1_max(Instruction &instruction) { //printf("Sequence::s1_max()\n"); - + *instruction.argp[0] = MAX(instruction.argv[1], instruction.argv[2]); return true; } bool Sequence::s1_mod(Instruction &instruction) { //printf("Sequence::s1_mod()\n"); - + *instruction.argp[0] = instruction.argv[0] % instruction.getValue(); return true; } @@ -521,7 +521,7 @@ bool Sequence::s1_crunch(Instruction &instruction) { } // TODO: Update if walking etc. - + return false; } @@ -564,7 +564,7 @@ bool Sequence::s1_branch(Instruction &instruction) { bool Sequence::s1_setFrame(Instruction &instruction) { //printf("Sequence::s1_setFrame()\n"); - + int32 frameIndex; if (instruction.argc == 3) { frameIndex = _vm->imath_ranged_rand(instruction.argv[1] >> 16, instruction.argv[2] >> 16); @@ -573,10 +573,10 @@ bool Sequence::s1_setFrame(Instruction &instruction) { } else { frameIndex = (instruction.argv[0] & 0xFF0000) >> 16; } - + //printf("Sequence::s1_setFrame() spriteHash = %d\n", (uint32)instruction.argv[0] >> 24); //printf("Sequence::s1_setFrame() frameIndex = %d\n", frameIndex); - + SpriteAsset *spriteAsset = _ws->assets()->getSprite((uint32)instruction.argv[0] >> 24); _curFrame = spriteAsset->getFrame(frameIndex); @@ -603,7 +603,7 @@ bool Sequence::s1_pop(Instruction &instruction) { bool Sequence::s1_jumpSub(Instruction &instruction) { //printf("Sequence::s1_jumpSub()\n"); - + _returnHashes[_returnStackIndex] = _sequenceHash; _returnOffsets[_returnStackIndex] = _code->pos(); _returnStackIndex++; @@ -715,7 +715,7 @@ bool Sequence::s1_closeStream(Instruction &instruction) { bool Sequence::streamOpen() { _streamSpriteAsset = new SpriteAsset(_vm, _stream, _stream->size(), "stream", true); - + _vars[kSeqVarSpriteFrameNumber] = -0x10000; _vars[kSeqVarSpriteFrameCount] = _streamSpriteAsset->getCount() << 16; _vars[kSeqVarSpriteFrameRate] = _streamSpriteAsset->getFrameRate() << 16; |