diff options
Diffstat (limited to 'engines')
253 files changed, 1393 insertions, 1393 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index a9f49b64c6..5763f8e63b 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2186,7 +2186,7 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -2250,7 +2250,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -2264,7 +2264,7 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl return desc; } - + return SaveStateDescriptor(); } @@ -2414,8 +2414,8 @@ const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSL // Check if we found a match with any of the fallback methods if (matchedUsingWag || matchedUsingFilenames) { _extra = description + (!_extra.empty() ? " " : "") + _extra; // Let's combine the description and extra - - // Override the gameid & extra values in g_fallbackDesc.desc. This only works + + // Override the gameid & extra values in g_fallbackDesc.desc. This only works // until the fallback detector is called again, and while the MetaEngine instance // is alive (as else the string storage is modified/deleted). g_fallbackDesc.desc.gameid = _gameid.c_str(); @@ -2454,11 +2454,11 @@ Common::Error AgiBase::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool AgiBase::canLoadGameStateCurrently() { +bool AgiBase::canLoadGameStateCurrently() { return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork)); } -bool AgiBase::canSaveGameStateCurrently() { +bool AgiBase::canSaveGameStateCurrently() { return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork)); } diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index bea57069c0..e784dad323 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -230,7 +230,7 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) { debugC(3, kDebugLevelResources, "offset = %d", agid->offset); debugC(3, kDebugLevelResources, "x = %x %x", x[0], x[1]); error("ACK! BAD RESOURCE"); - + _vm->quitGame(); } diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index a551394697..a3c3f0a035 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -46,7 +46,7 @@ * Version 1 (Sarien): view table has 256 entries (needed in KQ3) * Version 2 (ScummVM): first ScummVM version * Version 3 (ScummVM): added AGIPAL save/load support - * Version 4 (ScummVM): added thumbnails and save creation date/time + * Version 4 (ScummVM): added thumbnails and save creation date/time */ namespace Agi { diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 641c6e707e..a2c7467412 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -555,7 +555,7 @@ Common::Error AGOSEngine::init() { // Setup midi driver int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI); _nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32")); - + _driver = MidiDriver::createMidi(midiDriver); if (_nativeMT32) { @@ -890,7 +890,7 @@ AGOSEngine::~AGOSEngine() { free(_tablesHeapPtr - _tablesHeapCurPos); free(_mouseData); - + free(_gameOffsetsPtr); free(_iconFilePtr); free(_itemArrayPtr); @@ -1029,7 +1029,7 @@ Common::Error AGOSEngine::go() { /* I do not think that this will be used - * + * void AGOSEngine::shutdown() { // Sync with AGOSEngine::~AGOSEngine() // In Simon 2, this gets deleted along with _sound further down diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 5ca640d96c..4c400859f6 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -102,7 +102,7 @@ static const Common::ADParams detectionParams = { class AgosMetaEngine : public Common::AdvancedMetaEngine { public: AgosMetaEngine() : Common::AdvancedMetaEngine(detectionParams) {} - + virtual const char *getName() const { return "AGOS"; } @@ -110,7 +110,7 @@ public: virtual const char *getCopyright() const { return "AGOS (C) Adventure Soft"; } - + virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; virtual SaveStateList listSaves(const char *target) const; diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 4d60bbdbed..5558e9025a 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -58,7 +58,7 @@ public: BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigEndian = false); virtual ~BaseSound(); void close(); - + void playSound(uint sound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol = 0) { playSound(sound, sound, type, handle, flags, vol); } @@ -563,7 +563,7 @@ void Sound::readSfxFile(const char *filename) { void Sound::loadSfxTable(File *gameFile, uint32 base) { stopAll(); - + if (_effects) _effects->close(); diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 1d4f2e8ba6..07eb7306d8 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -541,7 +541,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) { error("Recursion error"); // WORKAROUND: If the game is saved, right after Simon is thrown in the dungeon of Sordid's Fortress of Doom, - // the saved game fails to load correctly. When loading the saved game, the sequence of Simon waking is started, + // the saved game fails to load correctly. When loading the saved game, the sequence of Simon waking is started, // before the scene is actually reloaded, due to a script bug. We manually add the extra script code from DOS CD // release, which fixed this particular script bug. if (getGameType() == GType_SIMON2 && !(getFeatures() & GF_TALKIE) && sub->id == 12101) { diff --git a/engines/agos/vga_s1.cpp b/engines/agos/vga_s1.cpp index b3ee374595..b1ae26437e 100644 --- a/engines/agos/vga_s1.cpp +++ b/engines/agos/vga_s1.cpp @@ -138,7 +138,7 @@ void AGOSEngine::vc22_setPaletteNew() { palptr[3] = 0; palptr += 4; - }; + }; } _paletteFlag = 2; diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index a0f998e02f..11ea4ea25c 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -585,7 +585,7 @@ int loadAni(const char *resourceName, int16 idx) { transparentColor = getAnimTransparentColor(resourceName); - // TODO: Merge this special case hack into getAnimTransparentColor somehow. + // TODO: Merge this special case hack into getAnimTransparentColor somehow. // HACK: Versions of TITRE.ANI with height 37 use color 0xF for transparency. // Versions of TITRE.ANI with height 57 use color 0x0 for transparency. // Fixes bug #2057619: FW: Glitches in title display of demo (regression). diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp index fddca078e5..8a79bfeea1 100644 --- a/engines/cine/bg_list.cpp +++ b/engines/cine/bg_list.cpp @@ -98,7 +98,7 @@ void loadBgIncrustFromSave(Common::SeekableReadStream &fHandle) { tmp.y = fHandle.readUint16BE(); tmp.frame = fHandle.readUint16BE(); tmp.part = fHandle.readUint16BE(); - + bgIncrustList.push_back(tmp); if (tmp.param == 0) { diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 3a2954f7d6..13991f0dec 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -98,7 +98,7 @@ Common::Error CineEngine::go() { delete renderer; delete[] collisionPage; delete g_sound; - + return Common::kNoError; } @@ -130,7 +130,7 @@ void CineEngine::initialize() { Common::set_to(zoneData.begin(), zoneData.end(), 0); // Resize zone query table to its correct size and reset all its elements - zoneQuery.resize(NUM_MAX_ZONE); + zoneQuery.resize(NUM_MAX_ZONE); Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); _timerDelayMultiplier = 12; // Set default speed diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp index 7b4e34c645..d7351879ba 100644 --- a/engines/cine/detection.cpp +++ b/engines/cine/detection.cpp @@ -589,7 +589,7 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const { if (pos < (sizeof(saveDesc) - 1)) { if (ch < 32 || in->eos()) { saveDesc[pos++] = '\0'; - } + } else if (ch >= 32) { saveDesc[pos++] = ch; } @@ -697,11 +697,11 @@ Common::Error CineEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; } -bool CineEngine::canLoadGameStateCurrently() { +bool CineEngine::canLoadGameStateCurrently() { return (!disableSystemMenu && !inMenu); } -bool CineEngine::canSaveGameStateCurrently() { +bool CineEngine::canSaveGameStateCurrently() { return (allowPlayerInput && !disableSystemMenu && !inMenu); } diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index e743d4227c..d388a9e206 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -329,7 +329,7 @@ void FWRenderer::drawPlainBox(int x, int y, int width, int height, byte color) { Common::Rect screenRect(320, 200); boxRect.clip(screenRect); - // Draw the filled rectangle + // Draw the filled rectangle byte *dest = _backBuffer + boxRect.top * 320 + boxRect.left; for (int i = 0; i < boxRect.height(); i++) { memset(dest + i * 320, color, boxRect.width()); @@ -1092,7 +1092,7 @@ void OSRenderer::renderOverlay(const Common::List<overlay>::iterator &it) { } _messageLen += messageTable[it->objIdx].size(); - drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); + drawMessage(messageTable[it->objIdx].c_str(), it->x, it->y, it->width, it->color); if (it->color >= 0) { // This test isn't in Future Wars's implementation waitForPlayerClick = 1; } diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index e88340479f..c6bca84e46 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -265,7 +265,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { errorVar = 0; - addScriptToGlobalScripts(bootScriptIdx); + addScriptToGlobalScripts(bootScriptIdx); menuVar = 0; @@ -337,7 +337,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { stopMusicAfterFadeOut(); di = executePlayerInput(); - + // Clear the zoneQuery table (Operation Stealth specific) if (g_cine->getGameType() == Cine::GType_OS) { Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp index c826db3bf3..08b16524fd 100644 --- a/engines/cine/msg.cpp +++ b/engines/cine/msg.cpp @@ -57,7 +57,7 @@ void loadMsg(char *pMsgName) { // buffer (e.g. message indexes 58-254 in BATEAU.MSG in PROCS08 in Operation Stealth). if (messageDataPos < sourceSize) { messageTable.push_back((const char *)(dataPtr + messageDataPos)); - } else { + } else { if (messageLen > 0) { // Only warn about overflowing non-empty strings warning("loadMsg(%s): message (%d. / %d) is overflowing the input buffer. Replacing it with an empty string", pMsgName, i + 1, count); } else { diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index c06f39fe03..78fea6b861 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -44,7 +44,7 @@ void loadPal(const char *fileName) { if (!palFileHandle.open(buffer)) error("loadPal(): Cannot open file %s", fileName); - uint16 palEntriesCount = palFileHandle.readUint16LE(); + uint16 palEntriesCount = palFileHandle.readUint16LE(); palFileHandle.readUint16LE(); // entry size palArray.resize(palEntriesCount); diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp index 7679d9d380..2cf9a52569 100644 --- a/engines/cine/part.cpp +++ b/engines/cine/part.cpp @@ -80,7 +80,7 @@ static Common::String fixVolCnfFileName(const uint8 *src, uint len) { // so that's why we have to convert them first. There's no trailing zero in them // either and they're always of the full length 11 with padding spaces. Extension // can be always found at offset 8 onwards. - // + // // Examples of filename mappings: // "AEROPORTMSG" -> "AEROPORT.MSG" // "MITRAILLHP " -> "MITRAILL.HP" (Notice the trailing space after the extension) @@ -160,7 +160,7 @@ void CineEngine::readVolCnf() { // US Amiga release. It uses a compressed 'vol.cnf' file but still uses // file names of length 13. So we try to deduce the file name length from // the data in the 'vol.cnf' file. - int fileNameLength; + int fileNameLength; if (fileNameLenMod11 != fileNameLenMod13) { // All file name blocks' sizes were divisible by either 11 or 13, but not with both. fileNameLength = (fileNameLenMod11 ? 11 : 13); diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp index 75581565e2..2917ad6d1b 100644 --- a/engines/cine/saveload.cpp +++ b/engines/cine/saveload.cpp @@ -103,7 +103,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle overlayEntrySize, bgIncrustEntrySize }; - + uint animEntrySize = animEntrySizeChoices[i]; // Jump over the animDataTable entries and the screen parameters int32 newPos = animDataTableStart + animEntrySize * animEntriesCount + sizeofScreenParams; @@ -128,7 +128,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle } fHandle.seek(newPos); } - + // If we could walk the chain successfully and // got exactly to the end of file then we've got a match. if (chainWalkSuccess && fHandle.pos() == fHandle.size()) { @@ -145,7 +145,7 @@ enum CineSaveGameFormat detectSaveGameFormat(Common::SeekableReadStream &fHandle assert(animEntrySize == oldAnimEntrySize || animEntrySize == newAnimEntrySize); if (animEntrySize == oldAnimEntrySize) { result = ANIMSIZE_23; - } else { // animEntrySize == newAnimEntrySize + } else { // animEntrySize == newAnimEntrySize // Check data and mask pointers in all of the animDataTable entries // to see whether we've got the version with the broken data and mask pointers or not. // In the broken format all data and mask pointers were always zero. @@ -484,7 +484,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { return false; } else if (hdr.version > CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected newer format version. Not loading savegame"); - return false; + return false; } else if ((int)hdr.version < (int)CURRENT_OS_SAVE_VER) { warning("loadTempSaveOS: Detected older format version. Trying to load nonetheless. Things may break"); } else { // hdr.id == TEMP_OS_FORMAT_ID && hdr.version == CURRENT_OS_SAVE_VER @@ -499,7 +499,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // Ok, so we've got a correct header for a temporary Operation Stealth savegame. // Let's start loading the plain savegame data then. - currentDisk = in.readUint16BE(); + currentDisk = in.readUint16BE(); in.read(currentPartName, 13); in.read(currentPrcName, 13); in.read(currentRelName, 13); @@ -509,7 +509,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { for (uint i = 0; i < 8; i++) { in.read(bgNames[i], 13); } - + in.read(currentCtName, 13); // Moved the loading of current procedure, relation, @@ -571,7 +571,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // TODO: Use the loaded value (Is music playing? (Uint16BE, Boolean)). in.readUint16BE(); - renderer->_cmdY = in.readUint16BE(); + renderer->_cmdY = in.readUint16BE(); in.readUint16BE(); // Some unknown variable that seems to always be zero allowPlayerInput = in.readUint16BE(); playerCommand = in.readUint16BE(); @@ -583,7 +583,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { var2 = in.readUint16BE(); commandVar2 = in.readUint16BE(); renderer->_messageBg = in.readUint16BE(); - + // TODO: Use the loaded value (adBgVar1 (Uint16BE)). in.readUint16BE(); @@ -625,7 +625,7 @@ bool CineEngine::loadTempSaveOS(Common::SeekableReadStream &in) { // TODO: Palette handling? if (in.pos() == in.size()) { - debug(3, "loadTempSaveOS: Loaded the whole savefile."); + debug(3, "loadTempSaveOS: Loaded the whole savefile."); } else { warning("loadTempSaveOS: Loaded the savefile but didn't exhaust it completely. Something was left over"); } @@ -784,7 +784,7 @@ bool CineEngine::makeLoad(char *saveName) { // 0x2315 + (255 * 30) + (2 * 6) + (206 + 206 + 20 + 20) * 512 = ~242kB // // I think it extremely unlikely that there would be over 512 global scripts, object scripts, - // overlays and background incrusts so 256kB seems like quite a safe upper limit. + // overlays and background incrusts so 256kB seems like quite a safe upper limit. // NOTE: If the savegame format is changed then this value might have to be re-evaluated! // Hopefully devices with more limited memory can also cope with this memory allocation. saveSize = 256 * 1024; @@ -815,7 +815,7 @@ bool CineEngine::makeLoad(char *saveName) { if (load) { // Reset the engine's state resetEngine(); - + if (saveGameFormat == TEMP_OS_FORMAT) { // Load the temporary Operation Stealth savegame format result = loadTempSaveOS(*in); @@ -882,7 +882,7 @@ void CineEngine::makeSaveFW(Common::OutSaveFile &out) { void CineEngine::makeSaveOS(Common::OutSaveFile &out) { int i; - // Make a temporary Operation Stealth savegame format chunk header and save it. + // Make a temporary Operation Stealth savegame format chunk header and save it. ChunkHeader header; header.id = TEMP_OS_FORMAT_ID; header.version = CURRENT_OS_SAVE_VER; @@ -918,7 +918,7 @@ void CineEngine::makeSaveOS(Common::OutSaveFile &out) { // 0x2934: Is music playing? (Uint16BE, Boolean). out.writeUint16BE(0); - out.writeUint16BE(renderer->_cmdY); + out.writeUint16BE(renderer->_cmdY); out.writeUint16BE(0); // Some unknown variable that seems to always be zero out.writeUint16BE(allowPlayerInput); out.writeUint16BE(playerCommand); @@ -930,7 +930,7 @@ void CineEngine::makeSaveOS(Common::OutSaveFile &out) { out.writeUint16BE(var2); out.writeUint16BE(commandVar2); out.writeUint16BE(renderer->_messageBg); - + // FIXME: Save proper value for this variable, currently writing zero. // An unknown variable at 0x295E: adBgVar1 (Uint16BE). out.writeUint16BE(0); diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp index e8f16ebfcc..792e75b42f 100644 --- a/engines/cine/script_os.cpp +++ b/engines/cine/script_os.cpp @@ -459,7 +459,7 @@ int FWScript::o2_modifySeqListElement() { byte e = getNextByte(); debugC(5, kCineDebugScript, "Line: %d: o2_modifySeqListElement(%d,%d,%d,%d,%d)", _line, a, b, c, d, e); - modifySeqListElement(a, 0, b, c, d, e); + modifySeqListElement(a, 0, b, c, d, e); return 0; } diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h index 2355df5ee1..96d6d20158 100644 --- a/engines/cine/unpack.h +++ b/engines/cine/unpack.h @@ -76,7 +76,7 @@ private: /** * Get bits from the source stream. * @note Changes the bit position in the source stream. - * @param numBits Number of bits to read from the source stream. + * @param numBits Number of bits to read from the source stream. * @return Integer value consisting of the bits read from the source stream (In range [0, (2 ** numBits) - 1]). * @return Later the bit was read from the source, the less significant it is in the return value. */ diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 3a826fab97..5b54bccc25 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -318,7 +318,7 @@ void CineEngine::resetEngine() { currentAdditionalBgIdx2 = 0; // TODO: Add resetting of the following variables // adBgVar1 = 0; - // adBgVar0 = 0; + // adBgVar0 = 0; // gfxFadeOutCompleted = 0; } } @@ -602,7 +602,7 @@ void makeCommandLine(void) { } } } - + if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) { if (playerCommand == 2) { getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); @@ -829,7 +829,7 @@ uint16 executePlayerInput(void) { renderer->setCommand(commandBuffer); isDrawCommandEnabled = 0; } - + getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); while (mouseButton && currentEntry < 200) { @@ -870,7 +870,7 @@ uint16 executePlayerInput(void) { commandBuffer += " "; commandBuffer += objectTable[si].name; - + isDrawCommandEnabled = 1; @@ -1408,14 +1408,14 @@ uint16 addAni(uint16 param1, uint16 objIdx, const int8 *ptr, SeqListElement &ele return 1; } -/*! +/*! * Permutates the overlay list into a different order according to some logic. * \todo Check this function for correctness (Wasn't very easy to reverse engineer so there may be errors) */ void resetGfxEntityEntry(uint16 objIdx) { Common::List<overlay>::iterator it, bObjsCutPoint; Common::List<overlay> aReverseObjs, bObjs; - bool foundCutPoint = false; + bool foundCutPoint = false; // Go through the overlay list and partition the whole list into two categories (Type A and type B objects) for (it = overlayList.begin(); it != overlayList.end(); ++it) { @@ -1429,14 +1429,14 @@ void resetGfxEntityEntry(uint16 objIdx) { } else { objectMask = objectTable[it->objIdx].mask; } - + if (objectTable[objIdx].mask > objectMask) { // Check for B objects' cut point bObjsCutPoint = bObjs.reverse_begin(); foundCutPoint = true; } } } - + // Recreate the overlay list in a different order. overlayList.clear(); if (foundCutPoint) { @@ -1461,7 +1461,7 @@ void processSeqListElement(SeqListElement &element) { int16 var_10; int16 var_4; int16 var_2; - + // Initial interpretations for variables addressed through ptr1 (8-bit addressing): // These may be inaccurate! // 0: ? diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index b45b6dc866..3c81c4d561 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -154,7 +154,7 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) { a1 = a2 = (int16*)str; a2 += sizeof(int16*) / sizeof(int16) + 6; // skip header - + int16* XArray = XMIN_XMAX; int minY = *XArray++; @@ -179,7 +179,7 @@ void makeCtStruct(uint8* str, int16 table[][40], int num, int z) { adrStructPoly = (uint8*)a2; *(uint16**)a2 = (uint16*)-1; //chained list terminator - + a1+=sizeof(int16*); *a1++=num; *a1++=walkboxColor[num]; diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index 4d476ceaf1..5538e4cd9f 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -134,7 +134,7 @@ int loadOverlay(const char *scriptName) { // Skip pointers s.skip(60); - + ovlData->arrayProc = NULL; ovlData->ptr1 = NULL; ovlData->arrayObject = NULL; @@ -221,7 +221,7 @@ int loadOverlay(const char *scriptName) { if (!ovlData->arrayNameRelocGlob) { return (-2); } - + s.read(ovlData->arrayNameRelocGlob, ovlData->nameExportSize); } @@ -341,7 +341,7 @@ int loadOverlay(const char *scriptName) { ovlData->ptr1[i].var18 = s.readUint16BE(); ovlData->ptr1[i].var1A = s.readUint16BE(); } - + tempPtr = (ovlData3Struct *) ovlData->ptr1; for (i = 0; i < ovlData->numRel; i++) { @@ -400,7 +400,7 @@ int loadOverlay(const char *scriptName) { ovlData->arrayObject[i]._numStates = s.readUint16BE(); ovlData->arrayObject[i]._varTableIdx = s.readUint16BE(); ovlData->arrayObject[i]._firstStateIdx = s.readUint16BE(); - ovlData->arrayObject[i]._stateTableIdx = s.readUint16BE(); + ovlData->arrayObject[i]._stateTableIdx = s.readUint16BE(); } // allocate states for object with multiple states diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index fb634bee97..26c3ca1217 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $URL$ - * $Id$ + * $Id$ */ #include "base/version.h" @@ -87,13 +87,13 @@ MainMenuDialog::MainMenuDialog(Engine *engine) StaticTextWidget *version = new StaticTextWidget(this, "GlobalMenu.Version", gScummVMVersionDate); version->setAlign(Graphics::kTextAlignCenter); - + new GUI::ButtonWidget(this, "GlobalMenu.Resume", "Resume", kPlayCmd, 'P'); _loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", "Load", kLoadCmd, 'L'); // TODO: setEnabled -> setVisible _loadButton->setEnabled(_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)); - + _saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", "Save", kSaveCmd, 'S'); // TODO: setEnabled -> setVisible _saveButton->setEnabled(_engine->hasFeature(Engine::kSupportsSavingDuringRuntime)); @@ -102,7 +102,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine) new GUI::ButtonWidget(this, "GlobalMenu.About", "About", kAboutCmd, 'A'); - _rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", "Return to Launcher", kRTLCmd, 'R'); + _rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", "Return to Launcher", kRTLCmd, 'R'); _rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL)); @@ -184,7 +184,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat eventRTL.type = Common::EVENT_RTL; g_system->getEventManager()->pushEvent(eventRTL); close(); - } + } break; case kQuitCmd: { Common::Event eventQ; @@ -199,7 +199,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } void MainMenuDialog::reflowLayout() { - if (_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)) + if (_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime)) _loadButton->setEnabled(_engine->canLoadGameStateCurrently()); if (_engine->hasFeature(Engine::kSupportsSavingDuringRuntime)) _saveButton->setEnabled(_engine->canSaveGameStateCurrently()); diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index ad7fe64d0e..d8177441e5 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -152,7 +152,7 @@ void DrasculaEngine::animation_1_1() { copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface); copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface); - copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, + copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, drawSurface2, screenSurface); updateScreen(); p++; diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index cef1a17486..81d9c9741a 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -34,11 +34,11 @@ void DrasculaEngine::playTalkSequence(int sequence) { if (_talkSequences[i].chapter == currentChapter && _talkSequences[i].sequence == sequence) { seen = true; - + doTalkSequenceCommand(_talkSequences[i]); } else if (seen) // Stop searching down the list break; - } + } } void DrasculaEngine::doTalkSequenceCommand(TalkSequenceCommand cmd) { @@ -138,7 +138,7 @@ void DrasculaEngine::converse(int index) { error("missing data file %s", fileName); int size = _arj.size(); - int game1 = kDialogOptionUnselected, + int game1 = kDialogOptionUnselected, game2 = kDialogOptionUnselected, game3 = kDialogOptionUnselected; char phrase1[78], phrase2[78], phrase3[78], phrase4[78]; diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 62a758bf9f..2016860f87 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -473,7 +473,7 @@ bool DrasculaEngine::runCurrentChapter() { if (menuScreen == 0 && takeObject == 1) checkObjects(); - + #ifdef _WIN32_WCE if (rightMouseButton) if (menuScreen) { @@ -502,7 +502,7 @@ bool DrasculaEngine::runCurrentChapter() { // Do not show the inventory screen in chapter 5, if the right mouse button is clicked // while the plug (object 16) is held // Fixes bug #2059621 - "DRASCULA: Plug bug" - if (rightMouseButton == 1 && menuScreen == 0 && + if (rightMouseButton == 1 && menuScreen == 0 && !(currentChapter == 5 && pickedObject == 16)) { #endif delay(100); @@ -578,7 +578,7 @@ bool DrasculaEngine::runCurrentChapter() { } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { loadPic("alcbar.alg", bgSurface, 255); } - + if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) if (currentChapter != 3) framesWithoutAction = 0; @@ -799,7 +799,7 @@ void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int w for (n = 0; n < newHeight; n++) { for (m = 0; m < newWidth; m++) { - copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n, + copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n, 1, 1, dir_inicio, dir_fin); pixelX += totalX; @@ -874,7 +874,7 @@ bool DrasculaEngine::loadDrasculaDat() { } ver = in.readByte(); - + if (ver != DRASCULA_DAT_VER) { snprintf(buf, 256, "File 'drascula.dat' is wrong version. Expected %d but got %d. Get it from the ScummVM website", DRASCULA_DAT_VER, ver); GUIErrorMessage(buf); diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index de35de5ab2..d97f95c5ef 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -224,7 +224,7 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { } // if } // for - copyRect(letterX, letterY, screenX, screenY, + copyRect(letterX, letterY, screenX, screenY, CHAR_WIDTH, CHAR_HEIGHT, tableSurface, screenSurface); screenX = screenX + CHAR_WIDTH; @@ -276,7 +276,7 @@ void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { } // if } // for - copyRect(letterX, letterY, screenX, screenY, + copyRect(letterX, letterY, screenX, screenY, CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC, backSurface, screenSurface); screenX = screenX + CHAR_WIDTH_OPC; @@ -516,7 +516,7 @@ int DrasculaEngine::playFrameSSN() { free(BufferSSN); waitFrameSSN(); if (FrameSSN) - mixVideo(VGA, screenSurface); + mixVideo(VGA, screenSurface); else memcpy(VGA, screenSurface, 64000); _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200); diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index c9c99aafa8..a64ee7e0cc 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -207,7 +207,7 @@ int DrasculaEngine::whichObject() { for (n = 1; n < 43; n++) { if (mouseX > _itemLocations[n].x && mouseY > _itemLocations[n].y && - mouseX < _itemLocations[n].x + OBJWIDTH && + mouseX < _itemLocations[n].x + OBJWIDTH && mouseY < _itemLocations[n].y + OBJHEIGHT) break; } diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 027685f56a..7aa4af059d 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1060,7 +1060,7 @@ void DrasculaEngine::updateRefresh() { // Check generic updaters for (int i = 0; i < _roomUpdatesSize; i++) { if (_roomUpdates[i].roomNum == roomNumber) { - if (_roomUpdates[i].flag < 0 || + if (_roomUpdates[i].flag < 0 || flags[_roomUpdates[i].flag] == _roomUpdates[i].flagValue) { if (_roomUpdates[i].type == 0) { copyBackground(_roomUpdates[i].sourceX, _roomUpdates[i].sourceY, @@ -1174,7 +1174,7 @@ void DrasculaEngine::update_2() { h = 22; } - copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]], + copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]], 239, 19, w, h, drawSurface3, screenSurface); difference = getTime() - savedTime; if (difference >= 6) { @@ -1214,7 +1214,7 @@ void DrasculaEngine::update_9_pre() { int blindY[] = {51, 51, 51, 51, 51, 51, 51, 127, 127}; int difference; - copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], + copyRect(blindX[actorFrames[kFrameBlind]], blindY[actorFrames[kFrameBlind]], 122, 57, 41, 72, drawSurface3, screenSurface); if (flags[9] == 0) { difference = getTime() - savedTime; @@ -1299,7 +1299,7 @@ void DrasculaEngine::update_18_pre() { if (flags[21] == 0) { copyBackground(1, 69, 120, 58, 56, 61, drawSurface3, screenSurface); - copyBackground(snore_x[actorFrames[kFrameSnore]], + copyBackground(snore_x[actorFrames[kFrameSnore]], snore_y[actorFrames[kFrameSnore]], 124, 59, 40, 37, drawSurface3, screenSurface); } else @@ -1877,7 +1877,7 @@ bool DrasculaEngine::exitRoom(int l) { int roomNum = 0; // Player can't exit the inn in chapter 1 - if (currentChapter == 1 && objectNum[l] == 104) { + if (currentChapter == 1 && objectNum[l] == 104) { return false; } @@ -1887,7 +1887,7 @@ bool DrasculaEngine::exitRoom(int l) { } updateDoor(l); - if (isDoor[l] != 0 && + if (isDoor[l] != 0 && ((currentChapter != 3 && currentChapter != 5) || visible[l] == 1)) { hideCursor(); @@ -1918,7 +1918,7 @@ bool DrasculaEngine::exitRoom(int l) { if (objectNum[l] == 173) { animation_35_2(); return true; - } + } if (objectNum[l] == 146 && flags[39] == 1) { flags[5] = 1; flags[11] = 1; @@ -1966,7 +1966,7 @@ void DrasculaEngine::updateDoor(int doorNum) { return; for (int i = 0; i < ARRAYSIZE(doors); i++) { - if (doors[i].chapter == currentChapter && + if (doors[i].chapter == currentChapter && objectNum[doorNum] == doors[i].doorNum) { isDoor[doorNum] = flags[doors[i].flag]; return; diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 4ecc3e20f2..8fc52a18b5 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -75,7 +75,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { copyBackground(); updateRefresh_pre(); } - + if (talkerType == kIgorDch) { placeIgor(); placeDrascula(); @@ -119,7 +119,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) { } } while (!isTalkFinished()); - if ((talkerType == kIgorFront && currentChapter == 6) || + if ((talkerType == kIgorFront && currentChapter == 6) || talkerType == kIgorDoor || talkerType == kIgorSeated || talkerType == kIgorWig) { updateRoom(); } @@ -776,7 +776,7 @@ void DrasculaEngine::talk_htel(int index) { copyBackground(x_talk[face], 1, 45, 24, 92, 108, frontSurface, screenSurface); else copyBackground(x_talk[face], 1, 45, 24, 92, 108, backSurface, screenSurface); - + if (!_subtitlesDisabled) centerText(said, 90, 50); @@ -912,7 +912,7 @@ void DrasculaEngine::talk_generic(const char* said, const char* filename, int* f copyBackground(); updateRefresh_pre(); - copyBackground(faces[face], coords[0], coords[1], coords[2], + copyBackground(faces[face], coords[0], coords[1], coords[2], coords[3], coords[4], surface, screenSurface); moveCharacters(); updateRefresh(); diff --git a/engines/engine.cpp b/engines/engine.cpp index 7831651a02..c0de2df66e 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -76,7 +76,7 @@ Engine::Engine(OSystem *syst) Engine::~Engine() { _mixer->stopAll(); - + delete _mainMenuDialog; g_engine = NULL; } @@ -156,9 +156,9 @@ void initGraphics(int width, int height, bool defaultTo1xScaler) { message += "'."; GUI::MessageDialog dialog(message); - dialog.runModal(); + dialog.runModal(); } - + if (gfxError & OSystem::kTransactionAspectRatioFailed) { GUI::MessageDialog dialog("Could not apply aspect ratio setting."); dialog.runModal(); diff --git a/engines/engine.h b/engines/engine.h index 0a84a122da..ac001de756 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -76,12 +76,12 @@ protected: Common::TimerManager *_timer; Common::EventManager *_eventMan; Common::SaveFileManager *_saveFileMan; - + GUI::Dialog *_mainMenuDialog; virtual int runDialog(GUI::Dialog &dialog); const Common::String _targetName; // target name for saves - + const Common::FSNode _gameDataDir; // FIXME: Get rid of this private: @@ -108,8 +108,8 @@ public: * the result of the Engine::shouldQuit() method appropriately). */ kSupportsRTL, - - /** + + /** * Loading savestates during runtime is supported, that is, this engine * implements loadGameState() and canLoadGameStateCurrently(). * If this feature is supported, then the corresponding MetaEngine *must* @@ -117,7 +117,7 @@ public: */ kSupportsLoadingDuringRuntime, - /** + /** * Loading savestates during runtime is supported, that is, this engine * implements saveGameState() and canSaveGameStateCurrently(). * If this feature is supported, then the corresponding MetaEngine *must* @@ -166,7 +166,7 @@ public: * Determine whether the engine supports the specified feature. */ virtual bool hasFeature(EngineFeature f) const { return false; } - + // virtual EnginePlugin *getMetaEnginePlugin() const; /** @@ -177,7 +177,7 @@ public: */ virtual void syncSoundSettings(); - /** + /** * Load a game state. * @param slot the slot from which a savestate should be loaded * @return returns kNoError on success, else an error code. diff --git a/engines/game.cpp b/engines/game.cpp index 3e6cdc2e79..c8cfcc663b 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -98,11 +98,11 @@ bool SaveStateDescriptor::getBool(const Common::String &key) const { if (contains(key)) { Common::String value = getVal(key); if (value.equalsIgnoreCase("true") || - value.equalsIgnoreCase("yes") || + value.equalsIgnoreCase("yes") || value.equals("1")) return true; if (value.equalsIgnoreCase("false") || - value.equalsIgnoreCase("no") || + value.equalsIgnoreCase("no") || value.equals("0")) return false; error("SaveStateDescriptor: %s '%s' has unknown value '%s' for boolean '%s'", diff --git a/engines/game.h b/engines/game.h index 21bfbce0f5..6c73941577 100644 --- a/engines/game.h +++ b/engines/game.h @@ -80,7 +80,7 @@ public: const Common::String &description() const { return getVal("description"); } Common::Language language() const { return contains("language") ? Common::parseLanguage(getVal("language")) : Common::UNK_LANG; } Common::Platform platform() const { return contains("platform") ? Common::parsePlatform(getVal("platform")) : Common::kPlatformUnknown; } - + const Common::String &preferredtarget() const { return contains("preferredtarget") ? getVal("preferredtarget") : getVal("gameid"); } @@ -169,7 +169,7 @@ public: * ratio of the game. If another ratio is required, contact the core team. */ const Graphics::Surface *getThumbnail() const { return _thumbnail.get(); } - + /** * Set a thumbnail graphics surface representing the savestate visually. * Ownership of the surface is transferred to the SaveStateDescriptor. diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 9803dba6eb..9d0ca76f87 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -127,7 +127,7 @@ bool Imd::load(Common::SeekableReadStream &stream) { return false; } - _soundSliceLength = (uint32) (((double) (1000 << 16)) / + _soundSliceLength = (uint32) (((double) (1000 << 16)) / ((double) _soundFreq / (double) _soundSliceSize)); _frameLength = _soundSliceLength >> 16; @@ -1027,7 +1027,7 @@ bool Vmd::load(Common::SeekableReadStream &stream) { _soundSliceSize = -_soundSliceSize; } - _soundSliceLength = (uint32) (((double) (1000 << 16)) / + _soundSliceLength = (uint32) (((double) (1000 << 16)) / ((double) _soundFreq / (double) _soundSliceSize)); _frameLength = _soundSliceLength >> 16; @@ -1116,7 +1116,7 @@ bool Vmd::load(Common::SeekableReadStream &stream) { if ((((uint32) data.realSize) >= ssize) || (data.name[0] == 0)) continue; - + _extraData.push_back(data); } else diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index e9830cf197..b182700dba 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -90,7 +90,7 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, int width = fontDesc->itemWidth; for (int k = 0; k < nWidth; k++) { - + data = *src++; for (int j = 0; j < MIN(8, width); j++) { if (data & 0x80) @@ -128,7 +128,7 @@ void VGAVideoDriver::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x; uint32 size = width * height; - + if (transp) { while (height--) { diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp index 2e2813d712..739531d899 100644 --- a/engines/gob/game_v6.cpp +++ b/engines/gob/game_v6.cpp @@ -161,7 +161,7 @@ void Game_v6::prepareStart(void) { if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") && Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) { _noCd = true; - } + } Game_v2::prepareStart(); } @@ -344,7 +344,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, _lastCollKey = checkMousePoint(1, &_lastCollId, &_lastCollAreaIndex); if ((_lastCollKey != 0) && (_lastCollId & 0x8000)) collAreaSub(_lastCollAreaIndex, 1); - } else + } else sub_1BA78(); } @@ -356,7 +356,7 @@ int16 Game_v6::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, *pResIndex = 0; return 0; - + } else if (handleMouse != 0) _vm->_draw->animateCursor(-1); diff --git a/engines/gob/goblin_v4.cpp b/engines/gob/goblin_v4.cpp index 1df5aab606..057e598727 100644 --- a/engines/gob/goblin_v4.cpp +++ b/engines/gob/goblin_v4.cpp @@ -615,19 +615,19 @@ int16 Goblin_v4::sub_20430(int16 state, uint16 dir) { case Map::kDirN: cx = 2; break; - + case Map::kDirNE: cx = 3; break; - + case Map::kDirW: cx = 0; break; - + case Map::kDirE: cx = 4; break; - + case Map::kDirSW: cx = 7; break; diff --git a/engines/gob/indeo3.h b/engines/gob/indeo3.h index f30b47806a..339581e2ea 100644 --- a/engines/gob/indeo3.h +++ b/engines/gob/indeo3.h @@ -75,7 +75,7 @@ private: uint16 y_w, y_h; uint16 uv_w, uv_h; }; - + int16 _width; int16 _height; YUVBufs _iv_frame[2]; diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 6bd4ddb625..ffdcb5b1c3 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -517,7 +517,7 @@ void Mult_v2::playMultInit() { } delete[] _objects; - + _vm->_util->setFrameRate(_multData->frameRate); _animTop = 0; _animLeft = 0; @@ -762,7 +762,7 @@ void Mult_v2::newCycleAnim(Mult_Object &animObj) { _vm->_vidPlayer->slotClose(animObj.videoSlot - 1); animObj.videoSlot = 0; } - + break; case 6: diff --git a/engines/gob/saveload.cpp b/engines/gob/saveload.cpp index 3d711ed0b5..e45ea661b7 100644 --- a/engines/gob/saveload.cpp +++ b/engines/gob/saveload.cpp @@ -313,7 +313,7 @@ uint32 StagedSave::getSize() const { else size += _stages[i].size; } - + return size; } diff --git a/engines/gob/saveload.h b/engines/gob/saveload.h index c00351e555..c14b4f2680 100644 --- a/engines/gob/saveload.h +++ b/engines/gob/saveload.h @@ -51,7 +51,7 @@ public: bool toBuffer(byte *buffer, int32 size, bool palette) const; bool fromBuffer(const byte *buffer, int32 size, bool palette); - + private: byte *_sprite; int16 _width; diff --git a/engines/gob/saveload_v2.cpp b/engines/gob/saveload_v2.cpp index fc11950368..69bda7de31 100644 --- a/engines/gob/saveload_v2.cpp +++ b/engines/gob/saveload_v2.cpp @@ -223,7 +223,7 @@ bool SaveLoad_v2::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); SaveLoad::setCurrentSlot(saveFile.destName, slot); diff --git a/engines/gob/saveload_v3.cpp b/engines/gob/saveload_v3.cpp index dab5fd9385..265f8a2c62 100644 --- a/engines/gob/saveload_v3.cpp +++ b/engines/gob/saveload_v3.cpp @@ -308,7 +308,7 @@ bool SaveLoad_v3::loadGame(SaveFile &saveFile, saveFile.slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", saveFile.slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", saveFile.slot); SaveLoad::setCurrentSlot(saveFile.destName, saveFile.slot); @@ -569,7 +569,7 @@ bool SaveLoad_v3::saveScreenshot(SaveFile &saveFile, if (!_screenshot.savePalette(_vm->_global->_pPaletteDesc->vgaPal)) return false; - + byte *buffer = new byte[_screenshotSize]; if (!_screenshot.toBuffer(buffer, _screenshotSize, palette)) { diff --git a/engines/gob/saveload_v4.cpp b/engines/gob/saveload_v4.cpp index 0bd3dc03e6..28a2a61604 100644 --- a/engines/gob/saveload_v4.cpp +++ b/engines/gob/saveload_v4.cpp @@ -291,7 +291,7 @@ bool SaveLoad_v4::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); SaveLoad::setCurrentSlot(saveFile.destName, slot); diff --git a/engines/gob/saveload_v6.cpp b/engines/gob/saveload_v6.cpp index 7396642e33..408b9fa6bd 100644 --- a/engines/gob/saveload_v6.cpp +++ b/engines/gob/saveload_v6.cpp @@ -190,7 +190,7 @@ bool SaveLoad_v6::loadGame(SaveFile &saveFile, int slot = getSlot(offset); int slotRem = getSlotRemainder(offset); - debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); if ((slot >= 60) || (slotRem != 0)) { warning("Invalid loading procedure (%d, %d, %d, %d, %d)", diff --git a/engines/gob/sound/soundblaster.cpp b/engines/gob/sound/soundblaster.cpp index eeedfaa3cb..23eea90688 100644 --- a/engines/gob/sound/soundblaster.cpp +++ b/engines/gob/sound/soundblaster.cpp @@ -88,7 +88,7 @@ void SoundBlaster::playComposition(int16 *composition, int16 freqVal, SoundDesc *sndDescs, int8 sndCount) { _compositionSamples = sndDescs; - _compositionSampleCount = sndCount; + _compositionSampleCount = sndCount; int i = -1; do { diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index e535505a87..58430f0d41 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -334,12 +334,12 @@ void Util::setScrollOffset(int16 x, int16 y) { processInput(); if (x >= 0) - _vm->_video->_scrollOffsetX = x; + _vm->_video->_scrollOffsetX = x; else _vm->_video->_scrollOffsetX = _vm->_draw->_scrollOffsetX; if (y >= 0) - _vm->_video->_scrollOffsetY = y; + _vm->_video->_scrollOffsetY = y; else _vm->_video->_scrollOffsetY = _vm->_draw->_scrollOffsetY; diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index b3db7702aa..6cfe7be819 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -284,7 +284,7 @@ void Video_v6::drawYUV(SurfaceDesc *destDesc, int16 x, int16 y, } delete dither; -} +} const byte Video_v6::_ditherPalette[768] = { 0x00,0x80,0x80,0x26,0x6B,0xC0,0x4B,0x56,0x4B,0x71,0x41,0x8B, diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index ef9d663b6f..9f07b550be 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -398,7 +398,7 @@ int VideoPlayer::getNextFreeSlot() { if (slot == _videoSlots.size()) _videoSlots.push_back(0); - + return slot; } diff --git a/engines/groovie/cell.cpp b/engines/groovie/cell.cpp index c1ddedff9d..a6954c3921 100644 --- a/engines/groovie/cell.cpp +++ b/engines/groovie/cell.cpp @@ -50,7 +50,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { if (0 == depth) { return 0; } - + for (i = 0; BOARDSIZE > i; i++) { // For every square on the board for (j = 0; BOARDSIZE > j; j++) { // if (color == *(origboard + i + (BOARDSIZE * j))) { // If the square is the desired colour @@ -62,7 +62,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { int8 nextlevel; debugC(5, kGroovieDebugCell | kGroovieDebugAll, "Depth: %d: Valid move %d, %d-> %d, %d", depth, i, j, i+di, j+dj); execMove (newboard, color, i, j, i+di, j+dj); - + nextlevel = calcMove (newboard, oppColor, depth - 1); debugC(5, kGroovieDebugCell | kGroovieDebugAll, "Depth: %d: Next level down returned %d", depth, nextlevel); currDiff = countBoard(newboard, color) - origBoardCount - nextlevel; @@ -84,7 +84,7 @@ int8 CellGame::calcMove(byte *origboard, uint8 color, uint8 depth) { } } } - + _startX = bestStartX; _startY = bestStartY; _endX = bestEndX; @@ -161,7 +161,7 @@ byte CellGame::getStartY() { byte CellGame::getEndX() { if (_endX > BOARDSIZE) { warning ("CellGame::getEndX: not calculated yet!"); - return 1; + return 1; } else { return _endX; } diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp index 4052149ed2..fef63c3c74 100644 --- a/engines/groovie/detection.cpp +++ b/engines/groovie/detection.cpp @@ -54,7 +54,7 @@ static const PlainGameDescriptor groovieGames[] = { static const GroovieGameDescription gameDescriptions[] = { // The 7th Guest DOS English - { + { { "t7g", "", AD_ENTRY1s("script.grv", "d1b8033b40aa67c076039881eccce90d", 16659), @@ -74,7 +74,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // The 7th Guest DOS Russian (Akella) - { + { { "t7g", "", { @@ -89,7 +89,7 @@ static const GroovieGameDescription gameDescriptions[] = { #ifdef GROOVIE_EXPERIMENTAL // The 11th Hour DOS English - { + { { "11h", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -97,7 +97,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, kGroovieV2, 1 }, - + // The 11th Hour DOS Demo English { { @@ -109,7 +109,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // The Making of The 11th Hour DOS English - { + { { "making11h", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -119,7 +119,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Clandestiny Trailer DOS English - { + { { "clantrailer", "", AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227), @@ -129,7 +129,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Clandestiny DOS English - { + { { "clandestiny", "", AD_ENTRY1s("disk.1", "f79fc1515174540fef6a34132efc4c53", 76), @@ -139,7 +139,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Uncle Henry's Playhouse PC English - { + { { "unclehenry", "", AD_ENTRY1s("disk.1", "0e1b1d3cecc4fc7efa62a968844d1f7a", 72), @@ -149,7 +149,7 @@ static const GroovieGameDescription gameDescriptions[] = { }, // Tender Loving Care PC English - { + { { "tlc", "", AD_ENTRY1s("disk.1", "32a1afa68478f1f9d2b25eeea427f2e3", 84), diff --git a/engines/groovie/font.cpp b/engines/groovie/font.cpp index 6b77984469..e7365fcfa5 100644 --- a/engines/groovie/font.cpp +++ b/engines/groovie/font.cpp @@ -56,7 +56,7 @@ void Font::printstring(char *messagein) { Common::Rect topbar(640, 80); Graphics::Surface *gamescreen; gamescreen = _syst->lockScreen(); - gamescreen->fillRect(topbar, 0); + gamescreen->fillRect(topbar, 0); _syst->unlockScreen(); for (i = 0; i < 14; i++) { @@ -121,7 +121,7 @@ uint8 Font::printletter(char letter, uint16 xoffset) { _sphinxfnt->read(data, width * height); _syst->copyRectToScreen(data, width, xoffset, 16, width, height); delete[] data; - + return width; } diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index bbae45da3a..554ae792de 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -136,7 +136,7 @@ Common::Error GroovieEngine::init() { return Common::kUnknownError; } } - + // Check the script file extension if (!filename.hasSuffix(".grv")) { error("%s isn't a valid script filename", filename.c_str()); @@ -162,7 +162,7 @@ Common::Error GroovieEngine::init() { Common::Error GroovieEngine::go() { // Check that the game files and the audio tracks aren't together run from // the same cd - + checkCD(); // Game timer counter @@ -224,7 +224,7 @@ Common::Error GroovieEngine::go() { _cursorMan->animate(); _system->updateScreen(); tmr++; - // Wait a little bit between increments. While mouse is moving, this triggers + // Wait a little bit between increments. While mouse is moving, this triggers // only negligably slower. if (tmr > 4) { _script.timerTick(); @@ -280,4 +280,4 @@ void GroovieEngine::waitForInput() { _waitingForInput = true; } -} // End of namespace Groovie +} // End of namespace Groovie diff --git a/engines/groovie/module.mk b/engines/groovie/module.mk index 4a5d79cfb8..d4216d3437 100644 --- a/engines/groovie/module.mk +++ b/engines/groovie/module.mk @@ -21,5 +21,5 @@ ifeq ($(ENABLE_GROOVIE), DYNAMIC_PLUGIN) PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 589251da31..0acf035b14 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -225,7 +225,7 @@ bool ROQPlayer::processBlockQuadVector(ROQBlockHeader &blockHeader) { // Upsample the 4x4 pixel block break; } - case 3: // CCC: + case 3: // CCC: //printf("coding type 3:\n"); processBlockQuadVectorSub(blockHeader); break; diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 0799ea913d..0f70bb36ca 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -139,7 +139,7 @@ bool Script::loadScript(Common::String filename) { _code[0x03C2] = 0x38; } else if (filename.equals("maze.grv")) { // GRAPHICS ENHANCEMENT - Leave a skeleton in the maze. - // Replaces one normal T intersection with the unused(?) + // Replaces one normal T intersection with the unused(?) // skeleton T intersection graphics. assert(_codeSize == 3652); @@ -147,7 +147,7 @@ bool Script::loadScript(Common::String filename) { _code[0x0769] = 0x46; _code[0x0774] = 0x3E; _code[0x077A] = 0x42; - + // T with branch on right _code[0x08E2] = 0x43; _code[0x08D7] = 0x44; @@ -380,7 +380,7 @@ void Script::savegame(uint slot) { for (int i = 0; i < 15; i++) { newchar = _variables[i] + 0x30; if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A)) { - save[i] = '\0'; + save[i] = '\0'; break; } else { save[i] = newchar; @@ -478,7 +478,7 @@ void Script::o_videofromref() { // 0x09 debugScript(1, true, "Use external file if available"); } break; - + case 0x400D: // floating objects in music room case 0x5060: // a sound from gamwav? case 0x5098: // a sound from gamwav? @@ -723,7 +723,7 @@ void Script::o_random() { void Script::o_jmp() { uint16 address = readScript16bits(); - + debugScript(1, true, "JMP @0x%04X", address); // Set the current address @@ -732,7 +732,7 @@ void Script::o_jmp() { void Script::o_loadstring() { uint16 varnum = readScript8or16bits(); - + debugScript(1, false, "LOADSTRING var[0x%04X..] =", varnum); do { setVariable(varnum++, readScriptChar(true, true, true)); @@ -743,7 +743,7 @@ void Script::o_loadstring() { void Script::o_ret() { uint8 val = readScript8bits(); - + debugScript(1, true, "RET %d", val); // Set the return value @@ -760,7 +760,7 @@ void Script::o_ret() { void Script::o_call() { uint16 address = readScript16bits(); - + debugScript(1, true, "CALL @0x%04X", address); // Save return address in the call stack @@ -773,7 +773,7 @@ void Script::o_call() { void Script::o_sleep() { uint16 time = readScript16bits(); - + debugScript(1, true, "SLEEP 0x%04X", time); _vm->_system->delayMillis(time * 3); @@ -852,7 +852,7 @@ void Script::o_vdxtransition() { // 0x1C void Script::o_swap() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - + debugScript(1, true, "SWAP var[0x%04X] <-> var[0x%04X]", varnum1, varnum2); uint8 tmp = _variables[varnum1]; @@ -862,7 +862,7 @@ void Script::o_swap() { void Script::o_inc() { uint16 varnum = readScript8or16bits(); - + debugScript(1, true, "INC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] + 1); @@ -870,7 +870,7 @@ void Script::o_inc() { void Script::o_dec() { uint16 varnum = readScript8or16bits(); - + debugScript(1, true, "DEC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] - 1); @@ -878,7 +878,7 @@ void Script::o_dec() { void Script::o_strcmpnejmp_var() { // 0x21 uint16 data = readScriptVar(); - + if (data > 9) { data -= 7; } @@ -887,7 +887,7 @@ void Script::o_strcmpnejmp_var() { // 0x21 do { if (_variables[data++] != readScriptChar(true, true, true)) { stringsmatch = 0; - } + } } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 offset = readScript16bits(); @@ -905,7 +905,7 @@ void Script::o_strcmpeqjmp() { // 0x23 uint16 varnum = readScript8or16bits(); uint8 val; uint8 result = 1; - + debugScript(1, false, "STRCMP-EQJMP: var[0x%04X..],", varnum); do { val = readScriptChar(true, true, true); @@ -938,7 +938,7 @@ void Script::o_mov() { void Script::o_add() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - + debugScript(1, true, "ADD var[0x%04X] += var[0x%04X]", varnum1, varnum2); setVariable(varnum1, _variables[varnum1] + _variables[varnum2]); @@ -996,7 +996,7 @@ void Script::o_endscript() { void Script::o_sethotspottop() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - + debugScript(5, true, "SETHOTSPOTTOP @0x%04X cursor=%d", address, cursor); _hotspotTopAction = address; @@ -1006,7 +1006,7 @@ void Script::o_sethotspottop() { void Script::o_sethotspotbottom() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - + debugScript(5, true, "SETHOTSPOTBOTTOM @0x%04X cursor=%d", address, cursor); _hotspotBottomAction = address; @@ -1016,7 +1016,7 @@ void Script::o_sethotspotbottom() { void Script::o_loadgame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - + debugScript(1, true, "LOADGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); loadgame(slot); @@ -1026,7 +1026,7 @@ void Script::o_loadgame() { void Script::o_savegame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - + debugScript(1, true, "SAVEGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); savegame(slot); @@ -1034,7 +1034,7 @@ void Script::o_savegame() { void Script::o_hotspotbottom_4() { //0x30 uint16 address = readScript16bits(); - + debugScript(5, true, "HOTSPOT-BOTTOM @0x%04X", address); // Mark the 80 pixels under the game area @@ -1045,7 +1045,7 @@ void Script::o_hotspotbottom_4() { //0x30 void Script::o_midivolume() { uint16 arg1 = readScript16bits(); uint16 arg2 = readScript16bits(); - + debugScript(1, true, "MIDI volume: %d %d", arg1, arg2); _vm->_musicPlayer->setGameVolume(arg1, arg2); } @@ -1054,7 +1054,7 @@ void Script::o_jne() { int16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); uint16 address = readScript16bits(); - + debugScript(1, false, "JNE: var[var[0x%04X] - 0x31] != var[0x%04X] @0x%04X", varnum1, varnum2, address); if (_variables[_variables[varnum1] - 0x31] != _variables[varnum2]) { @@ -1067,7 +1067,7 @@ void Script::o_jne() { void Script::o_loadstringvar() { uint16 varnum = readScript8or16bits(); - + varnum = _variables[varnum] - 0x31; debugScript(1, false, "LOADSTRINGVAR var[0x%04X..] =", varnum); do { @@ -1239,7 +1239,7 @@ void Script::o_hotspot_slot() { Graphics::Surface *gamescreen; gamescreen = _vm->_system->lockScreen(); - gamescreen->fillRect(topbar, 0); + gamescreen->fillRect(topbar, 0); _vm->_system->unlockScreen(); @@ -1288,7 +1288,7 @@ void Script::o_checkvalidsaves() { for (i = 0; i < 15; i++) { file->read(&temp, 1); savename[i] = temp + 0x30; - } + } delete file; } else { @@ -1359,7 +1359,7 @@ void Script::o_setvideoorigin() { // Read the two offset arguments int16 origX = readScript16bits(); int16 origY = readScript16bits(); - + // Set bitflag 7 _bitflags |= 1 << 7; @@ -1403,8 +1403,8 @@ void Script::o_cellmove() { startY = staufsMove.getStartY(); endX = staufsMove.getEndX(); endY = staufsMove.getEndY(); - - + + // Set the movement origin setVariable(0, startY); // y setVariable(1, startX); // x @@ -1491,7 +1491,7 @@ void Script::o_getcd() { void Script::o_playcd() { uint8 val = readScript8bits(); - + debugScript(1, true, "PLAYCD %d", val); if (val == 2) { @@ -1507,7 +1507,7 @@ void Script::o_hotspot_outrect() { uint16 right = readScript16bits(); uint16 bottom = readScript16bits(); uint16 address = readScript16bits(); - + debugScript(1, true, "HOTSPOT-OUTRECT(%d,%d,%d,%d) @0x%04X (TODO)", left, top, right, bottom, address); // Test if the current mouse position is outside the specified rectangle @@ -1525,20 +1525,20 @@ void Script::o_stub56() { uint32 val1 = readScript32bits(); uint8 val2 = readScript8bits(); uint8 val3 = readScript8bits(); - + debugScript(1, true, "STUB56: 0x%08X 0x%02X 0x%02X", val1, val2, val3); } void Script::o_stub59() { uint16 val1 = readScript8or16bits(); uint8 val2 = readScript8bits(); - + debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2); } Script::OpcodeFunc Script::_opcodes[NUM_OPCODES] = { &Script::o_nop, // 0x00 - &Script::o_nop, + &Script::o_nop, &Script::o_playsong, &Script::o_bf9on, &Script::o_palfadeout, // 0x04 diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index 137333c362..247d2c885e 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -65,7 +65,7 @@ uint16 VDXPlayer::loadInternal() { // - 1 Puzzle piece? Skip palette, don't redraw full screen, draw still to b/ack buffer // - 2 Transparent colour is 0xFF // - 5 Skip still chunks - // - 7 + // - 7 // - 8 Just show the first frame // - 9 Start a palette fade in _flagZero = ((_flags & (1 << 0)) != 0); @@ -161,7 +161,7 @@ bool VDXPlayer::playFrameInternal() { } // Wait until the current frame can be shown - + if (!(Common::getEnabledSpecialDebugLevels() & kGroovieDebugFast)) { waitFrame(); } diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp index c5d44d10af..5cc44f1b38 100644 --- a/engines/kyra/animator_hof.cpp +++ b/engines/kyra/animator_hof.cpp @@ -124,10 +124,10 @@ void KyraEngine_HoF::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1 || _inventorySaved) - return; + return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; - ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; + ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; _nextAnimItem = ++_nextAnimItem % _itemAnimDataSize; uint32 ctime = _system->getMillis(); diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp index 9702499fe7..5a26f9bcfd 100644 --- a/engines/kyra/animator_mr.cpp +++ b/engines/kyra/animator_mr.cpp @@ -201,7 +201,7 @@ void KyraEngine_MR::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1) - return; + return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; @@ -438,7 +438,7 @@ void KyraEngine_MR::setCharacterAnimDim(int w, int h) { _charBackUpWidth2 = _animObjects[0].width2; _charBackUpHeight = _animObjects[0].height; _charBackUpHeight2 = _animObjects[0].height2; - + _animObjects[0].width2 = (w - _charBackUpWidth) / 2; _animObjects[0].height2 = h - _charBackUpHeight; _animObjects[0].width = w; diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index 7ae5414d82..94238f31b8 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -449,8 +449,8 @@ bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) { DebugPrintf("value must be either 1 (on) or 0 (off)\n"); return true; } - - _vm->_dbgPass = val; + + _vm->_dbgPass = val; } else { DebugPrintf("Syntax: pass_codes <0/1>\n"); } diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 6902c03a81..d0a73800e6 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -478,7 +478,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -490,7 +490,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -502,7 +502,7 @@ const KYRAGameDescription adGameDescs[] = { KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY) }, - { + { { "kyra2", "CD", @@ -608,9 +608,9 @@ const KYRAGameDescription adGameDescs[] = { }, // Kyra3 - + // non installed version - { + { { "kyra3", 0, @@ -657,7 +657,7 @@ const KYRAGameDescription adGameDescs[] = { }, // installed version - { + { { "kyra3", 0, @@ -704,7 +704,7 @@ const KYRAGameDescription adGameDescs[] = { }, // Mac version - { + { { "kyra3", 0, @@ -843,7 +843,7 @@ const KYRAGameDescription adGameDescs[] = { }, KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA) }, - + // Lands of Lore CD { { @@ -860,7 +860,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -876,7 +876,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -908,7 +908,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -924,7 +924,7 @@ const KYRAGameDescription adGameDescs[] = { }, LOL_CD_FLAGS }, - + { { "lol", @@ -1144,7 +1144,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -1184,7 +1184,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s error = Kyra::KyraEngine_v1::readSaveHeader(in, true, header); delete in; - + if (error == Kyra::KyraEngine_v1::kRSHENoError) { SaveStateDescriptor desc(slot, header.description); @@ -1195,7 +1195,7 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } } - + return SaveStateDescriptor(); } diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index 7ec667dfe3..a0ce40f491 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -153,7 +153,7 @@ void GUI::initMenu(Menu &menu) { scrollUpButton->buttonCallback = getScrollUpButtonHandler(); scrollUpButton->nextButton = 0; scrollUpButton->mouseWheel = -1; - + _menuButtonList = addButtonToList(_menuButtonList, scrollUpButton); updateMenuButton(scrollUpButton); @@ -348,7 +348,7 @@ void GUI::checkTextfieldInput() { if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) _vm->quitGame(); else - _keyPressed = event.kbd; + _keyPressed = event.kbd; running = false; break; diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index c134745956..7930dbf2a0 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -320,7 +320,7 @@ void KyraEngine_HoF::scrollInventoryWheel() { int KyraEngine_HoF::bookButton(Button *button) { if (!queryGameFlag(1)) { - objectChat(getTableString(0xEB, _cCodeBuffer, 1), 0, 0x83, 0xEB); + objectChat(getTableString(0xEB, _cCodeBuffer, 1), 0, 0x83, 0xEB); return 0; } @@ -418,7 +418,7 @@ void KyraEngine_HoF::loadBookBkgd() { strcpy(filename, (_bookBkgd == 0) ? "_BOOKD.CPS" : "_BOOKC.CPS"); _bookBkgd ^= 1; - + if (_flags.isTalkie) { if (!_bookCurPage) strcpy(filename, "_XBOOKB.CPS"); @@ -475,7 +475,7 @@ void KyraEngine_HoF::showBookPage() { rightPage = _res->fileData(filename, 0); } } - + int rightPageY = _bookPageYOffset[_bookCurPage+1]; _screen->hideMouse(); @@ -508,7 +508,7 @@ void KyraEngine_HoF::bookLoop() { bookButtons[4].buttonCallback = BUTTON_FUNCTOR(KyraEngine_HoF, this, &KyraEngine_HoF::bookNextPage); Button *buttonList = 0; - + for (uint i = 0; i < ARRAYSIZE(bookButtons); ++i) buttonList = _gui->addButtonToList(buttonList, &bookButtons[i]); @@ -539,7 +539,7 @@ void KyraEngine_HoF::bookDecodeText(uint8 *str) { while (*op != 0x1A) { while (*op != 0x1A && *op != 0x0D) *dst++ = *op++; - + if (*op == 0x1A) break; @@ -619,7 +619,7 @@ int KyraEngine_HoF::cauldronButton(Button *button) { return 0; if (queryGameFlag(0xE4)) { - snd_playSoundEffect(0x0D); + snd_playSoundEffect(0x0D); return 0; } @@ -724,7 +724,7 @@ int GUI_HoF::optionsButton(Button *button) { initMenuLayout(_saveMenu); initMenuLayout(_savenameMenu); initMenuLayout(_deathMenu); - + _currentMenu = &_mainMenu; if (_vm->_menuDirectlyToLoad) { @@ -732,7 +732,7 @@ int GUI_HoF::optionsButton(Button *button) { setupPalette(); _loadedSave = false; - + loadMenu(0); if (_loadedSave) { @@ -1004,7 +1004,7 @@ int GUI_HoF::gameOptionsTalkie(Button *caller) { if (_vm->_lang != lang) { _reloadTemporarySave = true; - + Graphics::Surface thumb; createScreenThumbnail(thumb); _vm->saveGameState(999, "Autosave", &thumb); @@ -1053,7 +1053,7 @@ void GUI_HoF::setupOptionsButtons() { case 0: _gameOptions.item[1].itemId = 31; break; - + case 1: _gameOptions.item[1].itemId = 32; break; @@ -1079,7 +1079,7 @@ int GUI_HoF::sliderHandler(Button *caller) { assert(button >= 0 && button <= 3); int oldVolume = 0; - + if (_vm->gameFlags().isTalkie) { oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button)); } else { @@ -1151,7 +1151,7 @@ int GUI_HoF::sliderHandler(Button *caller) { _vm->_configTextspeed = newVolume; } } - + drawSliderBar(button, _vm->_buttonShapes[17]); if (playSoundEffect) _vm->snd_playSoundEffect(0x18); diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 6af4841084..665c38115b 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -275,7 +275,7 @@ int GUI_LoK::processButtonList(Button *list, uint16 inputFlag, int8 mouseWheel) list->flags2 &= 0xFFFE; processButton(list); } - + if (list->flags2 & 4) { list->flags2 &= 0xFFFB; processButton(list); diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index e3f250c20e..38b8c5a5a3 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -189,10 +189,10 @@ void KyraEngine_MR::showInventory() { redrawInventory(30); drawMalcolmsMoodPointer(-1, 30); drawScore(30, 215, 191); - + if (queryGameFlag(0x97)) drawJestersStaff(1, 30); - + _screen->hideMouse(); if (_itemInHand < 0) { @@ -238,7 +238,7 @@ void KyraEngine_MR::showInventory() { times = 0; waitTill = _system->getMillis() + _tickLength; } - + height += _inventoryScrollSpeed; y -= _inventoryScrollSpeed; } @@ -260,10 +260,10 @@ void KyraEngine_MR::hideInventory() { _inventoryState = false; updateCLState(); initMainButtonList(true); - + _screen->copyBlockToPage(3, 0, 0, 320, 56, _interface); _screen->hideMouse(); - + restorePage3(); flagAnimObjsForRefresh(); drawAnimObjects(); @@ -306,7 +306,7 @@ void KyraEngine_MR::hideInventory() { times = 0; waitTill = _system->getMillis() + _tickLength; } - + y += _inventoryScrollSpeed; y2 += _inventoryScrollSpeed; } @@ -479,9 +479,9 @@ void KyraEngine_MR::redrawInventory(int page) { _screen->showMouse(); _screen->_curPage = pageBackUp; - + if (page == 0 || page == 1) - _screen->updateScreen(); + _screen->updateScreen(); } void KyraEngine_MR::clearInventorySlot(int slot, int page) { @@ -602,7 +602,7 @@ int KyraEngine_MR::buttonMoodChange(Button *button) { drawMalcolmsMoodText(); updateDlgIndex(); - + EMCData data; EMCState state; memset(&data, 0, sizeof(data)); @@ -717,7 +717,7 @@ void KyraEngine_MR::showAlbum() { _album.leftPage.wsa->setX(_albumWSAX[_album.nextPage+0]); _album.leftPage.wsa->setY(_albumWSAY[_album.nextPage+0]); _album.leftPage.wsa->setDrawPage(2); - + _album.leftPage.wsa->displayFrame(_album.leftPage.curFrame, 0x4000); } if (_album.rightPage.wsa->opened()) { @@ -865,7 +865,7 @@ void KyraEngine_MR::processAlbum() { Button *buttonList = 0; for (int i = 0; i < 5; ++i) buttonList = _gui->addButtonToList(buttonList, &albumButtons[i]); - + _album.leftPage.timer = _album.rightPage.timer = _system->getMillis(); albumNewPage(); _album.running = true; @@ -876,7 +876,7 @@ void KyraEngine_MR::processAlbum() { removeInputTop(); musicUpdate(0); - + if (_album.curPage != _album.nextPage) { int oldPage = _album.curPage; _album.curPage = _album.nextPage; @@ -930,7 +930,7 @@ void KyraEngine_MR::albumNewPage() { int id = _album.curPage / 2 + 100; albumChat((const char *)getTableEntry(_album.file, id), 205, id); - + if (id == 107) { _screen->copyRegion(76, 100, 76, 100, 244, 100, 2, 0, Screen::CR_NO_P_CHECK); albumChat((const char *)getTableEntry(_album.file, 108), 205, 108); @@ -1303,7 +1303,7 @@ int GUI_MR::optionsButton(Button *button) { initMenuLayout(_saveMenu); initMenuLayout(_savenameMenu); initMenuLayout(_deathMenu); - + _currentMenu = &_mainMenu; _vm->musicUpdate(0); @@ -1312,7 +1312,7 @@ int GUI_MR::optionsButton(Button *button) { backUpPage1(_vm->_screenBuffer); _loadedSave = false; - + --_loadMenu.numberOfItems; loadMenu(0); ++_loadMenu.numberOfItems; @@ -1503,7 +1503,7 @@ void GUI_MR::setupOptionsButtons() { case 0: _gameOptions.item[1].itemId = 31; break; - + case 1: _gameOptions.item[1].itemId = 32; break; diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 500d816cb9..012a5b901b 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -65,7 +65,7 @@ void GUI_v2::processButton(Button *button) { } return; } - + int entry = button->flags2 & 5; byte val1 = 0, val2 = 0, val3 = 0; @@ -365,7 +365,7 @@ int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag, int8 mouseWh if ((*buttonList->buttonCallback.get())(buttonList)) break; } - + if (buttonList->flags & 0x20) break; } @@ -544,7 +544,7 @@ int GUI_v2::toggleWalkspeed(Button *caller) { int GUI_v2::toggleText(Button *caller) { updateMenuButton(caller); - + if (_vm->textEnabled()) { if (_vm->speechEnabled()) _vm->_configVoice = 1; @@ -636,7 +636,7 @@ int GUI_v2::clickSaveSlot(Button *caller) { int index = caller->index - _menuButtons[0].index; assert(index >= 0 && index <= 6); MenuItem &item = _saveMenu.item[index]; - + if (item.saveSlot >= 0) { if (_isDeleteMenu) { _slotToDelete = item.saveSlot; @@ -701,7 +701,7 @@ int GUI_v2::deleteMenu(Button *caller) { processHighlights(_saveMenu, _vm->_mouseX, _vm->_mouseY); getInput(); } - + if (_slotToDelete < 1) { restorePage1(_vm->_screenBuffer); backUpPage1(_vm->_screenBuffer); @@ -729,7 +729,7 @@ int GUI_v2::deleteMenu(Button *caller) { Common::String oldName = _vm->getSavegameFilename(*i); Common::String newName = _vm->getSavegameFilename(*i-1); _vm->_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str()); - } + } _saveMenu.menuNameId = _vm->gameFlags().isTalkie ? 9 : 17; return 0; } diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index a8e14d8831..3c162c8cc2 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -128,7 +128,7 @@ protected: virtual void restorePalette() {} virtual char *getTableString(int id) = 0; - + virtual uint8 textFieldColor1() const = 0; virtual uint8 textFieldColor2() const = 0; virtual uint8 textFieldColor3() const = 0; diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp index 299c826e80..f93ecc8d0c 100644 --- a/engines/kyra/items_mr.cpp +++ b/engines/kyra/items_mr.cpp @@ -138,7 +138,7 @@ bool KyraEngine_MR::processItemDrop(uint16 sceneId, uint16 item, int x, int y, i itemPos = -1; if (itemPos >= 0) { - exchangeMouseItem(itemPos, 1); + exchangeMouseItem(itemPos, 1); return true; } @@ -304,7 +304,7 @@ void KyraEngine_MR::itemDropDown(int startX, int startY, int dstX, int dstY, int } restoreGfxRect32x32(x, y); - } + } } _itemList[itemSlot].x = dstX; @@ -439,7 +439,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { } else { setGameFlag(0x1AE); } - + _timer->setCountdown(12, 1); _timer->enable(12); } @@ -458,7 +458,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { _screen->hideMouse(); deleteItemAnimEntry(itemSlot); addItemToAnimList(itemSlot); - + if (newItem == 0xFE) removeHandItem(); else if (newItem != 0xFF) @@ -468,7 +468,7 @@ bool KyraEngine_MR::itemListMagic(int handItem, int itemSlot) { if (_lang != 1) updateItemCommand(resItem, 3, 0xFF); - // Unlike the original we give points for when combining with scene items + // Unlike the original we give points for when combining with scene items if (resItem == 7) { updateScore(35, 100); delay(60*_tickLength, true); @@ -519,7 +519,7 @@ bool KyraEngine_MR::itemInventoryMagic(int handItem, int invSlot) { _screen->hideMouse(); clearInventorySlot(invSlot, 0); drawInventorySlot(0, resItem, invSlot); - + if (newItem == 0xFE) removeHandItem(); else if (newItem != 0xFF) diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 316e341a14..48986f1bda 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -97,7 +97,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn _itemAnimData = 0; _demoAnimData = 0; _nextAnimItem = 0; - + for (int i = 0; i < 15; i++) memset(&_activeItemAnim[i], 0, sizeof(ActiveItemAnim)); @@ -212,7 +212,7 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) { } _nextIdleAnim += pausedTime; - + for (int x = 0; x < _itemAnimDataSize; x++) _activeItemAnim[x].nextFrame += pausedTime; @@ -270,7 +270,7 @@ Common::Error KyraEngine_HoF::init() { for (int i = 0; i < 2; i++) addShapeToPool(shapes, i, i); - + delete[] shapes; _screen->setMouseCursor(0, 0, getShapePtr(0)); @@ -284,7 +284,7 @@ Common::Error KyraEngine_HoF::go() { if (_flags.isDemo && !_flags.isTalkie) { if (_flags.gameID == GI_LOL) - seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); + seq_playSequences(kSequenceLolDemoScene1, kSequenceLolDemoScene6); else seq_playSequences(kSequenceDemoVirgin, kSequenceDemoFisher); _menuChoice = 4; @@ -322,7 +322,7 @@ Common::Error KyraEngine_HoF::go() { if (!shouldQuit()) runLoop(); cleanup(); - + if (_showOutro) seq_playSequences(kSequenceFunters, kSequenceFrash); } @@ -1202,7 +1202,7 @@ int KyraEngine_HoF::inputSceneChange(int x, int y, int unk1, int unk2) { int vocH = _flags.isTalkie ? 131 : -1; if (_pathfinderFlag) { - if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { + if (findItem(curScene, 13) >= 0 && _unk3 <= -3) { strId = 252; } else if (_itemInHand == 72) { strId = 257; @@ -1539,7 +1539,7 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { // TODO ?? Maybe there is a way to let users select whether they want // voc, midi or adl sfx (even though it makes no sense to choose anything but voc). - // The PC-98 version has support for non-pcm sound effects, but only for tracks + // The PC-98 version has support for non-pcm sound effects, but only for tracks // which also have voc files. The syntax would be: // KyraEngine_v1::snd_playSoundEffect(vocIndex); } @@ -1748,7 +1748,7 @@ void KyraEngine_HoF::cauldronItemAnim(int item) { } snd_playSoundEffect(0x17); - + for (int i = 16; i > 0; i -= 2, curY += 2) { _screen->setNewShapeHeight(shape, i); restoreGfxRect32x32(x, y); @@ -1992,7 +1992,7 @@ void KyraEngine_HoF::writeSettings() { case 3: _flags.lang = Common::JA_JPN; break; - + case 0: default: _flags.lang = Common::EN_ANY; diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h index 31dc38b110..b1902103a6 100644 --- a/engines/kyra/kyra_hof.h +++ b/engines/kyra/kyra_hof.h @@ -724,7 +724,7 @@ protected: int o2_displayWsaSequentialFrames(EMCState *script); int o2_displayWsaSequence(EMCState *script); int o2_addItemToInventory(EMCState *script); - int o2_drawShape(EMCState *script); + int o2_drawShape(EMCState *script); int o2_addItemToCurScene(EMCState *script); int o2_loadSoundFile(EMCState *script); int o2_removeSlotFromInventory(EMCState *script); @@ -863,7 +863,7 @@ protected: const uint16 *_ingameTalkObjIndex; int _ingameTalkObjIndexSize; const char *const *_ingameTimJpStr; - int _ingameTimJpStrSize; + int _ingameTimJpStrSize; const HofSeqData *_sequences; const ItemAnimData_v2 *_itemAnimData; int _itemAnimDataSize; diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index 6e5bba3dc0..acc0421a59 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -209,7 +209,7 @@ Common::Error KyraEngine_MR::init() { KyraEngine_v1::init(); initStaticResource(); - + _debugger = new Debugger_v2(this); assert(_debugger); @@ -229,7 +229,7 @@ Common::Error KyraEngine_MR::init() { _screen->setFont(Screen::FID_6_FNT); _screen->setAnimBlockPtr(3500); _screen->setScreenDim(0); - + _res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768); _screen->setScreenPalette(_screen->getPalette(0)); @@ -545,7 +545,7 @@ void KyraEngine_MR::playStudioSFX(const char *str) { void KyraEngine_MR::preinit() { debugC(9, kDebugLevelMain, "KyraEngine_MR::preinit()"); - + _itemBuffer1 = new int8[72]; _itemBuffer2 = new int8[144]; initMouseShapes(); @@ -583,7 +583,7 @@ void KyraEngine_MR::startup() { _screen->setFont(Screen::FID_6_FNT); - _stringBuffer = new char[500]; + _stringBuffer = new char[500]; //XXX musicUpdate(0); //XXX @@ -676,7 +676,7 @@ void KyraEngine_MR::startup() { assert(_sceneList); memset(_sceneList, 0, sizeof(SceneDesc)*98); _sceneListSize = 98; - + musicUpdate(0); runStartupScript(1, 0); _res->exists("MOODOMTR.WSA", true); @@ -1014,7 +1014,7 @@ void KyraEngine_MR::runLoop() { } checkAutosave(); - + if (_system->getMillis() >= _nextIdleAnim) showIdleAnim(); @@ -1054,7 +1054,7 @@ void KyraEngine_MR::handleInput(int x, int y) { } setNextIdleAnimTimer(); - + int skip = 0; if (checkCharCollision(x, y) && _unk3 >= -1 && runSceneScript2()) { @@ -1381,7 +1381,7 @@ char *KyraEngine_MR::appendLanguage(char *buf, int lang, int bufSize) { int KyraEngine_MR::loadLanguageFile(const char *file, uint8 *&buffer) { debugC(9, kDebugLevelMain, "KyraEngine_MR::loadLanguageFile('%s', %p)", file, (const void*)buffer); - delete[] buffer; + delete[] buffer; buffer = 0; uint32 size = 0; @@ -1487,7 +1487,7 @@ void KyraEngine_MR::scoreIncrease(int count, const char *str) { drawScore(0, 215, 191); _screen->updateScreen(); delay(20, true); - + snd_playSoundEffect(0x0E, 0xC8); drawOld = 0; } @@ -1498,7 +1498,7 @@ void KyraEngine_MR::scoreIncrease(int count, const char *str) { #pragma mark - void KyraEngine_MR::changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing) { - debugC(9, kDebugLevelMain, "KyraEngine_MR::changeChapter(%d, %d, %d, %d)", newChapter, sceneId, malcolmShapes, facing); + debugC(9, kDebugLevelMain, "KyraEngine_MR::changeChapter(%d, %d, %d, %d)", newChapter, sceneId, malcolmShapes, facing); resetItemList(); _currentChapter = newChapter; diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h index a0e0af93b0..6c06a84433 100644 --- a/engines/kyra/kyra_mr.h +++ b/engines/kyra/kyra_mr.h @@ -252,7 +252,7 @@ private: void drawMalcolmsMoodText(); void drawMalcolmsMoodPointer(int frame, int page); void drawJestersStaff(int type, int page); - + void drawScore(int page, int x, int y); void drawScoreCounting(int oldScore, int newScore, int drawOld, const int x); int getScoreX(const char *str); @@ -494,7 +494,7 @@ private: // special script code bool _useFrameTable; - + int o3a_setCharacterFrame(EMCState *script); // special shape code @@ -523,7 +523,7 @@ private: int _score; int _scoreMax; - + const uint8 *_scoreTable; int _scoreTableSize; @@ -564,7 +564,7 @@ private: void printAlbumPageText(); void printAlbumText(int page, const char *str, int x, int y, uint8 c0); - + void processAlbum(); void albumNewPage(); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index b7b3fc60b7..eb0f929096 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -411,7 +411,7 @@ void KyraEngine_v1::registerDefaultSettings() { void KyraEngine_v1::readSettings() { _configWalkspeed = ConfMan.getInt("walkspeed"); _configMusic = 0; - + if (!ConfMan.getBool("music_mute")) { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) _configMusic = ConfMan.getBool("cdaudio") ? 2 : 1; @@ -501,7 +501,7 @@ void KyraEngine_v1::setVolume(kVolumeEntry vol, uint8 value) { case kVolumeSfx: ConfMan.setInt("sfx_volume", convertValueToMixer(value)); break; - + case kVolumeSpeech: ConfMan.setInt("speech_volume", convertValueToMixer(value)); break; @@ -524,7 +524,7 @@ uint8 KyraEngine_v1::getVolume(kVolumeEntry vol) { case kVolumeSfx: return convertValueFromMixer(ConfMan.getInt("sfx_volume")); break; - + case kVolumeSpeech: if (speechEnabled()) return convertValueFromMixer(ConfMan.getInt("speech_volume")); diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index e38f0b0633..af7e0385cc 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -290,7 +290,7 @@ protected: static const int8 _addYPosTable[]; // Character - + static const int8 _charAddXPosTable[]; static const int8 _charAddYPosTable[]; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 158206f73f..57f5cc029f 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -40,7 +40,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags, const Engi _itemList = 0; _itemListSize = 0; - + _characterShapeFile = -1; _updateCharPosNextUpdate = 0; diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 2d261d8c7b..bb3afe1b22 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -267,7 +267,7 @@ protected: int _characterShapeFile; virtual void loadCharacterShapes(int shapes) = 0; - + // pathfinder int _movFacingTable[600]; int _pathfinderFlag; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 19a0a851e7..8daf1d857f 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -36,7 +36,7 @@ namespace Kyra { LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(system, flags) { _screen = 0; - + switch (_flags.lang) { case Common::EN_ANY: case Common::EN_USA: @@ -59,7 +59,7 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy } memset(_shapes, 0, sizeof(_shapes)); - + _chargenWSA = 0; _lastUsedStringBuffer = 0; _landsFile = 0; @@ -74,7 +74,7 @@ LoLEngine::~LoLEngine() { delete _screen; delete _tim; - + for (Common::Array<const TIMOpcode*>::iterator i = _timIntroOpcodes.begin(); i != _timIntroOpcodes.end(); ++i) delete *i; _timIntroOpcodes.clear(); @@ -90,10 +90,10 @@ Common::Error LoLEngine::init() { _screen->setResolution(); KyraEngine_v1::init(); - + _tim = new TIMInterpreter(this, _screen, _system); assert(_tim); - + _screen->setAnimBlockPtr(10000); _screen->setScreenDim(0); @@ -210,9 +210,9 @@ void LoLEngine::preInit() { _eventList.clear(); //loadTalkFile(0); - + char filename[32]; - snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]); + snprintf(filename, sizeof(filename), "LANDS.%s", _languageExt[_lang]); _res->exists(filename, true); _landsFile = _res->fileData(filename, 0); @@ -233,7 +233,7 @@ int LoLEngine::mainMenu() { bool hasSave = saveFileLoadable(0); MainMenu::StaticData data = { - { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F }, { 0x2C, 0x19, 0x48, 0x2C }, Screen::FID_9_FNT, 1 @@ -253,9 +253,9 @@ int LoLEngine::mainMenu() { for (int i = 0; i < 5; ++i) { if (hasSave) - data.strings[i] = getLangString(mainMenuStrings[1 + tableOffs][i]); + data.strings[i] = getLangString(mainMenuStrings[1 + tableOffs][i]); else - data.strings[i] = getLangString(mainMenuStrings[tableOffs][i]); + data.strings[i] = getLangString(mainMenuStrings[tableOffs][i]); } MainMenu *menu = new MainMenu(this); @@ -333,9 +333,9 @@ void LoLEngine::setupPrologueData(bool load) { "INTRO.PAK", "INTROVOC.CMP", 0 }; - const char * const *fileList = _flags.isTalkie ? fileListCD : + const char * const *fileList = _flags.isTalkie ? fileListCD : (_flags.useInstallerPackage ? fileListFloppy : fileListFloppyExtracted); - + char filename[32]; for (uint i = 0; fileList[i]; ++i) { @@ -347,7 +347,7 @@ void LoLEngine::setupPrologueData(bool load) { } strcat(filename, fileList[i]); - + if (load) { if (!_res->loadPakFile(filename)) error("Couldn't load file: '%s'", filename); @@ -358,7 +358,7 @@ void LoLEngine::setupPrologueData(bool load) { _screen->clearPage(0); _screen->clearPage(3); - + if (load) { _chargenWSA = new WSAMovie_v2(this, _screen); assert(_chargenWSA); @@ -414,12 +414,12 @@ void LoLEngine::showIntro() { } _screen->showMouse(); _sound->voiceStop(); - + _eventList.clear(); - + _tim->unload(intro); _tim->clearLangData(); - + _screen->fadePalette(_screen->getPalette(1), 30, 0); } @@ -427,7 +427,7 @@ int LoLEngine::chooseCharacter() { debugC(9, kDebugLevelMain, "LoLEngine::chooseCharacter()"); _tim->setLangData("LOLINTRO.DIP"); - + _screen->loadFont(Screen::FID_9_FNT, "FONT9P.FNT"); _screen->loadBitmap("ITEMICN.SHP", 3, 3, 0); @@ -438,7 +438,7 @@ int LoLEngine::chooseCharacter() { _screen->loadBitmap("CHAR.CPS", 2, 2, _screen->getPalette(0)); _screen->loadBitmap("BACKGRND.CPS", 4, 4, _screen->getPalette(0)); - + if (!_chargenWSA->open("CHARGEN.WSA", 1, 0)) error("Couldn't load CHARGEN.WSA"); _chargenWSA->setX(113); @@ -448,7 +448,7 @@ int LoLEngine::chooseCharacter() { _screen->setFont(Screen::FID_9_FNT); _screen->_curPage = 2; - + for (int i = 0; i < 4; ++i) _screen->fprintStringIntro(_charPreviews[i].name, _charPreviews[i].x + 16, _charPreviews[i].y + 36, 0xC0, 0x00, 0x9C, 0x120); @@ -457,16 +457,16 @@ int LoLEngine::chooseCharacter() { _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 56, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[1]); _screen->fprintStringIntro("%d", _charPreviews[i].x + 21, _charPreviews[i].y + 64, 0x98, 0x00, 0x9C, 0x220, _charPreviews[i].attrib[2]); } - + _screen->fprintStringIntro(_tim->getCTableEntry(51), 36, 173, 0x98, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(53), 36, 181, 0x98, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(55), 36, 189, 0x98, 0x00, 0x9C, 0x20); - + _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK); _screen->_curPage = 0; - + _screen->fadePalette(_screen->getPalette(0), 30, 0); - + bool kingIntro = true; while (!shouldQuit()) { if (kingIntro) @@ -515,10 +515,10 @@ int LoLEngine::chooseCharacter() { void LoLEngine::kingSelectionIntro() { debugC(9, kDebugLevelMain, "LoLEngine::kingSelectionIntro()"); - + _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 38; - + _screen->fprintStringIntro(_tim->getCTableEntry(57), 8, y, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(58), 8, y + 10, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(59), 8, y + 20, 0x32, 0x00, 0x9C, 0x20); @@ -526,11 +526,11 @@ void LoLEngine::kingSelectionIntro() { _screen->fprintStringIntro(_tim->getCTableEntry(61), 8, y + 40, 0x32, 0x00, 0x9C, 0x20); _sound->voicePlay("KING01"); - + _chargenWSA->setX(113); _chargenWSA->setY(0); _chargenWSA->setDrawPage(0); - + int index = 4; while (_sound->voiceIsPlaying("KING01") && _charSelection == -1 && !shouldQuit() && !skipFlag()) { index = MAX(index, 4); @@ -550,9 +550,9 @@ void LoLEngine::kingSelectionIntro() { index = (index + 1) % 22; } - + resetSkipFlag(); - + _chargenWSA->displayFrame(0x10, 0, 0, 0); _screen->updateScreen(); _sound->voiceStop("KING01"); @@ -560,19 +560,19 @@ void LoLEngine::kingSelectionIntro() { void LoLEngine::kingSelectionReminder() { debugC(9, kDebugLevelMain, "LoLEngine::kingSelectionReminder()"); - + _screen->copyRegion(0, 0, 0, 0, 112, 120, 4, 0, Screen::CR_NO_P_CHECK); int y = 48; - + _screen->fprintStringIntro(_tim->getCTableEntry(62), 8, y, 0x32, 0x00, 0x9C, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(63), 8, y + 10, 0x32, 0x00, 0x9C, 0x20); - + _sound->voicePlay("KING02"); - + _chargenWSA->setX(113); _chargenWSA->setY(0); _chargenWSA->setDrawPage(0); - + int index = 0; while (_sound->voiceIsPlaying("KING02") && _charSelection == -1 && !shouldQuit() && index < 15) { _chargenWSA->displayFrame(_chargenFrameTable[index+9], 0, 0, 0); @@ -628,7 +628,7 @@ void LoLEngine::kingSelectionOutro() { void LoLEngine::processCharacterSelection() { debugC(9, kDebugLevelMain, "LoLEngine::processCharacterSelection()"); - + _charSelection = -1; while (!shouldQuit() && _charSelection == -1) { uint32 nextKingMessage = _system->getMillis() + 900 * _tickLength; @@ -681,22 +681,22 @@ int LoLEngine::selectionCharInfo(int character) { strcpy(filename, "FACE09.SHP"); vocFilename[3] = 'A'; break; - + case 1: strcpy(filename, "FACE01.SHP"); vocFilename[3] = 'M'; break; - + case 2: strcpy(filename, "FACE08.SHP"); vocFilename[3] = 'K'; break; - + case 3: strcpy(filename, "FACE05.SHP"); vocFilename[3] = 'C'; break; - + default: break; }; @@ -713,9 +713,9 @@ int LoLEngine::selectionCharInfo(int character) { _screen->fprintStringIntro(_tim->getCTableEntry(idx+2), 50, 147, 0x53, 0x00, 0xCF, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(idx+3), 50, 157, 0x53, 0x00, 0xCF, 0x20); _screen->fprintStringIntro(_tim->getCTableEntry(idx+4), 50, 167, 0x53, 0x00, 0xCF, 0x20); - + _screen->fprintStringIntro(_tim->getCTableEntry(69), 100, 168, 0x32, 0x00, 0xCF, 0x20); - + selectionCharInfoIntro(vocFilename); if (_charSelectionInfoResult == -1) { while (_charSelectionInfoResult == -1) { @@ -723,7 +723,7 @@ int LoLEngine::selectionCharInfo(int character) { _system->delayMillis(10); } } - + if (_charSelectionInfoResult != 1) { _charSelectionInfoResult = -1; _screen->copyRegion(0, 122, 0, 122, 320, 78, 2, 0, Screen::CR_NO_P_CHECK); @@ -743,7 +743,7 @@ int LoLEngine::selectionCharInfo(int character) { _screen->fprintStringIntro(_tim->getCTableEntry(68), 3, 68, 0x32, 0x00, 0x9C, 0x20); resetSkipFlag(); - kingSelectionOutro(); + kingSelectionOutro(); return character; } @@ -751,7 +751,7 @@ void LoLEngine::selectionCharInfoIntro(char *file) { debugC(9, kDebugLevelMain, "LoLEngine::selectionCharInfoIntro(%p)", (const void *)file); int index = 0; file[4] = '0'; - + while (_charSelectionInfoResult == -1 && !shouldQuit()) { if (!_sound->voicePlay(file)) break; @@ -789,21 +789,21 @@ int LoLEngine::getCharSelection() { return i; } } - + return -1; } int LoLEngine::selectionCharAccept() { int inputFlag = checkInput(0, false) & 0xCF; removeInputTop(); - + if (inputFlag == 200) { if (88 <= _mouseX && _mouseX <= 128 && 180 <= _mouseY && _mouseY <= 194) return 1; if (196 <= _mouseX && _mouseX <= 236 && 180 <= _mouseY && _mouseY <= 194) return 0; } - + return -1; } @@ -818,13 +818,13 @@ void LoLEngine::setupOpcodeTable() { Common::Array<const TIMOpcode*> *timTable = 0; SetTimOpcodeTable(_timIntroOpcodes); - + // 0x00 OpcodeTim(tlol_setupPaletteFade); OpcodeTimUnImpl(); OpcodeTim(tlol_loadPalette); OpcodeTim(tlol_setupPaletteFadeEx); - + // 0x04 OpcodeTim(tlol_processWsaFrame); OpcodeTim(tlol_displayText); @@ -865,15 +865,15 @@ int LoLEngine::tlol_processWsaFrame(const TIM *tim, const uint16 *param) { const int x2 = param[2]; const int y2 = param[3]; const int factor = MAX<int>(0, (int16)param[4]); - + const int x1 = anim->x; const int y1 = anim->y; - + int w1 = anim->wsa->width(); int h1 = anim->wsa->height(); int w2 = (w1 * factor) / 100; int h2 = (h1 * factor) / 100; - + anim->wsa->setDrawPage(2); anim->wsa->setX(x1); anim->wsa->setY(y1); diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index a984fdc36f..a6b7378b0f 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef KYRA_LOL_H #define KYRA_LOL_H @@ -41,7 +41,7 @@ class LoLEngine : public KyraEngine_v1 { public: LoLEngine(OSystem *system, const GameFlags &flags); ~LoLEngine(); - + Screen *screen(); private: Screen_LoL *_screen; @@ -61,13 +61,13 @@ private: void setupPrologueData(bool load); void showIntro(); - + struct CharacterPrev { const char *name; int x, y; int attrib[3]; }; - + static const CharacterPrev _charPreviews[]; WSAMovie_v2 *_chargenWSA; @@ -81,29 +81,29 @@ private: void updateSelectionAnims(); int selectionCharInfo(int character); void selectionCharInfoIntro(char *file); - + int getCharSelection(); int selectionCharAccept(); - + int _charSelection; int _charSelectionInfoResult; - + uint32 _selectionAnimTimers[4]; uint8 _selectionAnimFrames[4]; static const uint8 _selectionAnimIndexTable[]; - + static const uint16 _selectionPosTable[]; static const uint8 _selectionChar1IdxTable[]; static const uint8 _selectionChar2IdxTable[]; static const uint8 _selectionChar3IdxTable[]; static const uint8 _selectionChar4IdxTable[]; - + static const uint8 _reminderChar1IdxTable[]; static const uint8 _reminderChar2IdxTable[]; static const uint8 _reminderChar3IdxTable[]; static const uint8 _reminderChar4IdxTable[]; - + static const uint8 _charInfoFrameTable[]; // timer @@ -121,7 +121,7 @@ private: int tlol_setupPaletteFadeEx(const TIM *tim, const uint16 *param); int tlol_processWsaFrame(const TIM *tim, const uint16 *param); int tlol_displayText(const TIM *tim, const uint16 *param); - + // translation int _lang; @@ -137,7 +137,7 @@ private: // graphics uint8 *_shapes[138]; - + // unneeded void setWalkspeed(uint8) {} void setHandItem(uint16) {} diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 85378659da..061cb7e602 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -184,7 +184,7 @@ bool Resource::loadFileList(const Common::String &filedata) { if (filename.hasSuffix(".PAK")) { if (!exists(filename.c_str()) && _vm->gameFlags().isDemo) { - // the demo version supplied with Kyra3 does not + // the demo version supplied with Kyra3 does not // contain all pak files listed in filedata.fdt // so we don't do anything here if they are non // existant. diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index 827af4892f..ebe874ae2f 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -212,7 +212,7 @@ struct PlainArchiveListSearch { Common::Archive *ResLoaderPak::load(Common::SharedPtr<Common::ArchiveMember> memberFile, Common::SeekableReadStream &stream) const { int32 filesize = stream.size(); - + int32 startoffset = 0, endoffset = 0; bool switchEndian = false; bool firstFile = true; @@ -400,7 +400,7 @@ bool ResLoaderTlk::isLoadable(const Common::String &filename, Common::SeekableRe Common::Archive *ResLoaderTlk::load(Common::SharedPtr<Common::ArchiveMember> file, Common::SeekableReadStream &stream) const { uint16 entries = stream.readUint16LE(); PlainArchive::FileInputList files; - + for (uint i = 0; i < entries; ++i) { PlainArchive::InputEntry entry; @@ -451,7 +451,7 @@ private: }; void FileExpanderSource::advSrcBitsBy1() { - _key >>= 1; + _key >>= 1; if (!--_bitsLeft) { if (_dataPtr < _endofBuffer) _key = ((*_dataPtr++) << 8 ) | (_key & 0xff); @@ -479,7 +479,7 @@ uint16 FileExpanderSource::getKeyMasked(uint8 newIndex) { if (_index > 8) { newIndex = _index - 8; - res = (_key & 0xff) & mskTable[8]; + res = (_key & 0xff) & mskTable[8]; advSrcBitsByIndex(8); _index = newIndex; res |= (((_key & 0xff) & mskTable[_index]) << 8); @@ -518,7 +518,7 @@ uint16 FileExpanderSource::keyMaskedAlign(uint16 val) { void FileExpanderSource::advSrcRefresh() { _key = READ_LE_UINT16(_dataPtr); if (_dataPtr < _endofBuffer - 1) - _dataPtr += 2; + _dataPtr += 2; _bitsLeft = 8; } @@ -566,7 +566,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 0x10, 0x11, 0x12, 0x00, 0x08, 0x07, 0x09, 0x06, 0x0A, 0x05, 0x0B, 0x04, 0x0C, 0x03, 0x0D, 0x02, 0x0E, 0x01, 0x0F }; - + memset(_tables[0], 0, 3914); uint8 *d = dst; @@ -591,10 +591,10 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 tableSize0 = _src->getKeyMasked(5) + 257; tableSize1 = _src->getKeyMasked(5) + 1; memset(_tables[7], 0, 19); - + const uint8 *itbl = indexTable; int numbytes = _src->getKeyMasked(4) + 4; - + while (numbytes--) _tables[7][*itbl++] = _src->getKeyMasked(3); @@ -615,7 +615,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 uint8 tmpI = 0; if (cmd == 16) { cmd = _src->getKeyMasked(2) + 3; - tmpI = *(tmp - 1); + tmpI = *(tmp - 1); } else if (cmd == 17) { cmd = _src->getKeyMasked(3) + 3; } else { @@ -630,7 +630,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 error("decompression failure"); } } - + memcpy(_tables[1], _tables[0] + tableSize0, tableSize1); generateTables(0, 2, 3, tableSize0); generateTables(1, 4, 5, tableSize1); @@ -640,7 +640,7 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 postprocess = false; needrefresh = true; } else if (mode == 0){ - uint8 *d2 = _tables[0]; + uint8 *d2 = _tables[0]; memset(d2, 8, 144); memset(d2 + 144, 9, 112); memset(d2 + 256, 7, 24); @@ -659,9 +659,9 @@ bool FileExpander::process(uint8 *dst, const uint8 *src, uint32 outsize, uint32 if (!postprocess) continue; - + int16 cmd = 0; - + do { cmd = ((int16*) _tables[2])[_src->getKeyLower()]; _src->advSrcBitsByIndex(cmd < 0 ? calcCmdAndIndex(_tables[3], cmd) : _tables[0][cmd]); @@ -721,8 +721,8 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex const uint8 *s = tbl1; memset(_tables16[0], 0, 32); - - for (int i = 0; i < cnt; i++) + + for (int i = 0; i < cnt; i++) _tables16[0][(*s++)]++; _tables16[1][1] = 0; @@ -758,12 +758,12 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex if (t > 0) { uint16 v1 = *d; uint16 v2 = 0; - + do { v2 = (v2 << 1) | (v1 & 1); v1 >>= 1; } while (--t && v1); - + t++; uint8 c1 = (v1 & 1); while (t--) { @@ -775,7 +775,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex *d++ = v2; } else { d++; - } + } } memset(tbl2, 0, 512); @@ -794,7 +794,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex if (t && t < 9) { inc = 1 << t; uint16 o = *d; - + do { s2[o] = cnt; o += inc; @@ -824,7 +824,7 @@ void FileExpander::generateTables(uint8 srcIndex, uint8 dstIndex, uint8 dstIndex } while (--t); *s2 = cnt; } - d--; + d--; } while (--cnt >= 0); } @@ -909,7 +909,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi delete tmpFile; tmpFile = 0; - + pos += cs; if (cs == size) { if (!bytesleft) { @@ -960,7 +960,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi } uint32 size = (i == a->lastFile) ? a->endOffset : tmpFile->size(); - + if (startFile) { startFile = false; pos = a->startOffset + kExecSize; @@ -1009,7 +1009,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi tmpFile->seek(pos, SEEK_SET); } } - + sprintf(filenameExt, extension.c_str(), i + 1); filenameTemp = a->filename + Common::String(filenameExt); @@ -1022,12 +1022,12 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi } uint32 id = READ_LE_UINT32(hdr); - + if (id == 0x04034B50) { compressionType = hdr[8]; insize = READ_LE_UINT32(hdr + 18); outsize = READ_LE_UINT32(hdr + 22); - + uint16 filestrlen = READ_LE_UINT16(hdr + 26); *(hdr + 30 + filestrlen) = 0; entryStr = Common::String((const char *)(hdr + 30)); @@ -1047,7 +1047,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi if ((pos + insize) > size) { // this is for files that are split between two archive files inPart1 = size - pos; - inPart2 = insize - inPart1; + inPart2 = insize - inPart1; tmpFile->read(inbuffer, inPart1); } else { tmpFile->read(inbuffer, insize); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 2c410a6ff6..f9cbe09db7 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -64,7 +64,7 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab in->seek(0, SEEK_SET); in->read(descriptionBuffer, descriptionSize[i]); descriptionBuffer[descriptionSize[i]] = 0; - + type = in->readUint32BE(); header.version = in->readUint16LE(); if (type == MKID_BE('MBL3') && header.version == 100) { diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp index d1407c1d91..ba39ee28a3 100644 --- a/engines/kyra/saveload_hof.cpp +++ b/engines/kyra/saveload_hof.cpp @@ -146,7 +146,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { warning("Trying to load savegame from original interpreter, while this is possible, it is not officially supported"); bool setFlag1EE = (queryGameFlag(0x1EE) != 0); - + _deathHandler = -1; if (!_unkSceneScreenFlag1) { _sound->beginFadeOut(); @@ -203,7 +203,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { for (int i = 0; i < 31; ++i) _newSceneDlgState[i] = in.readUint16(); } - + _cauldronUseCount = in.readSint16(); if (header.originalSave) @@ -312,7 +312,7 @@ Common::Error KyraEngine_HoF::loadGameState(int slot) { _mainCharX = _mainCharacter.x2 = _mainCharacter.x1; _mainCharY = _mainCharacter.y2 = _mainCharacter.y1; _mainCharacter.facing = 4; - + enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); setHandItem(_itemInHand); diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index c437960907..3548723610 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -203,7 +203,7 @@ Common::Error KyraEngine_LoK::loadGameState(int slot) { _screen->updateScreen(); setMousePos(brandonX, brandonY); - + if (in->err() || in->eos()) { warning("Load failed ('%s', '%s').", fileName, header.description.c_str()); return Common::kUnknownError; @@ -223,14 +223,14 @@ Common::Error KyraEngine_LoK::saveGameState(int slot, const char *saveName, cons debugC(9, kDebugLevelMain, "KyraEngine_LoK::saveGame(%d, '%s', %p)", slot, saveName, (const void *)thumb); const char *fileName = getSavegameFilename(slot); - + if (shouldQuit()) return Common::kNoError; Common::OutSaveFile *out = openSaveForWriting(fileName, saveName, thumb); if (!out) return _saveFileMan->getError(); - + for (int i = 0; i < 11; i++) { out->writeUint16BE(_characterList[i].sceneId); out->writeByte(_characterList[i].height); diff --git a/engines/kyra/saveload_mr.cpp b/engines/kyra/saveload_mr.cpp index f2f10d635a..5193800b1d 100644 --- a/engines/kyra/saveload_mr.cpp +++ b/engines/kyra/saveload_mr.cpp @@ -184,7 +184,7 @@ Common::Error KyraEngine_MR::loadGameState(int slot) { for (int i = 0; i < 30; ++i) in.read(_conversationState[i], 30); - + if (!header.originalSave) { in.read(_newSceneDlgState, 40); } else { @@ -309,7 +309,7 @@ Common::Error KyraEngine_MR::loadGameState(int slot) { _badConsciencePosition = false; _goodConscienceShown = false; _goodConsciencePosition = false; - + enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); setHandItem(_itemInHand); diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp index b6c25a46c7..ad1632a231 100644 --- a/engines/kyra/scene_hof.cpp +++ b/engines/kyra/scene_hof.cpp @@ -91,7 +91,7 @@ void KyraEngine_HoF::enterNewScene(uint16 newScene, int facing, int unk1, int un waitTime = _system->getMillis() + 1000; _sound->beginFadeOut(); } - + _chatAltFlag = false; if (!unk3) { @@ -255,7 +255,7 @@ void KyraEngine_HoF::enterNewSceneUnk2(int unk1) { updateCharacterAnim(0); refreshAnimObjectsIfNeed(); } - } else if (_mainCharX != -1 && _mainCharY != -1) { + } else if (_mainCharX != -1 && _mainCharY != -1) { if (_characterFrameTable[_mainCharacter.facing] == 25) _mainCharacter.facing = 5; _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index 1ceb47155d..238e5ee447 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -765,7 +765,7 @@ int KyraEngine_MR::runSceneScript1(int x, int y) { return 0; if (_deathHandler >= 0) return 0; - + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = x; _sceneScriptState.regs[2] = y; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 44e66691a2..cd2227f130 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -80,8 +80,8 @@ bool Screen::init() { if (_vm->gameFlags().useHiResOverlay) { _useOverlays = true; _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN); - _sjisInvisibleColor = (_vm->gameFlags().gameID == GI_KYRA1) ? 0x80 : 0xF6; - + _sjisInvisibleColor = (_vm->gameFlags().gameID == GI_KYRA1) ? 0x80 : 0xF6; + for (int i = 0; i < SCREEN_OVLS_NUM; ++i) { if (!_sjisOverlayPtrs[i]) { _sjisOverlayPtrs[i] = new uint8[SCREEN_OVL_SJIS_SIZE]; @@ -440,7 +440,7 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { uint8 fadePal[768]; memcpy(fadePal, _screenPalette, 768); - + bool needRefresh = false; const int colors = (_vm->gameFlags().platform == Common::kPlatformAmiga ? 32 : 256) * 3; for (int i = 0; i < colors; ++i) { @@ -463,7 +463,7 @@ int Screen::fadePalStep(const uint8 *palette, int diff) { fadePal[i] = (uint8)c2; } } - + if (needRefresh) setScreenPalette(fadePal); @@ -1153,7 +1153,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int _dsTableLoopCount = 0; _dsTable2 = 0; _dsDrawLayer = 0; - + uint8 *table3 = 0; uint8 *table4 = 0; @@ -1242,7 +1242,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int &Screen::drawShapePlotType3_7, // used by Kyra 1 (invisibility) &Screen::drawShapePlotType8, // used by Kyra 2 &Screen::drawShapePlotType9, // used by Kyra 1 + 3 - 0, + 0, &Screen::drawShapePlotType11_15, // used by Kyra 1 (invisibility) + Kyra 3 (shadow) &Screen::drawShapePlotType12, // used by Kyra 2 &Screen::drawShapePlotType13, // used by Kyra 1 @@ -1253,7 +1253,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int }; int scaleCounterV = 0; - + f = flags & 0x0f; _dsProcessMargin = dsMarginFunc[f]; _dsScaleSkip = dsSkipFunc[f]; @@ -1304,7 +1304,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int if (flags & DSF_SCALE) { shapeHeight = (shapeHeight * _dsScaleH) >> 8; shpWidthScaled1 = shpWidthScaled2 = (shapeWidth * _dsScaleW) >> 8; - + if (!shapeHeight || !shpWidthScaled1) { va_end(args); return; @@ -1321,10 +1321,10 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int uint16 frameSize = READ_LE_UINT16(src); src += 2; int colorTableColors = ((_vm->gameFlags().gameID != GI_KYRA1) && (shapeFlags & 4)) ? *src++ : 16; - + if (!(flags & 0x8000) && (shapeFlags & 1)) _dsTable2 = src; - + if (flags & 0x400) src += colorTableColors; @@ -1479,7 +1479,7 @@ int Screen::drawShapeMarginNoScaleUpwind(uint8 *&dst, const uint8 *&src, int &cn continue; cnt = cnt + 1 - (*src++); } - + cnt++; dst -= cnt; return 0; @@ -1491,7 +1491,7 @@ int Screen::drawShapeMarginNoScaleDownwind(uint8 *&dst, const uint8 *&src, int & continue; cnt = cnt + 1 - (*src++); } - + cnt++; dst += cnt; return 0; @@ -1598,7 +1598,7 @@ void Screen::drawShapeProcessLineNoScaleUpwind(uint8 *&dst, const uint8 *&src, i c = *src++; dst += c; cnt -= c; - } + } } while (cnt > 0); } @@ -1613,7 +1613,7 @@ void Screen::drawShapeProcessLineNoScaleDownwind(uint8 *&dst, const uint8 *&src, c = *src++; dst -= c; cnt -= c; - } + } } while (cnt > 0); } @@ -1715,7 +1715,7 @@ void Screen::drawShapePlotType6(uint8 *dst, uint8 cmd) { int t = _drawShapeVar4 + _drawShapeVar5; if (t & 0xff00) { cmd = dst[_drawShapeVar3]; - t &= 0xff; + t &= 0xff; } else { cmd = _dsTable2[cmd]; } @@ -1794,7 +1794,7 @@ void Screen::drawShapePlotType14(uint8 *dst, uint8 cmd) { uint32 relOffs = dst - _dsDstPage; int t = (_shapePages[0][relOffs] & 0x7f) & 0x87; if (_dsDrawLayer < t) { - cmd = _shapePages[1][relOffs]; + cmd = _shapePages[1][relOffs]; } else { t = _drawShapeVar4 + _drawShapeVar5; if (t & 0xff00) { @@ -2701,7 +2701,7 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 * warning("couldn't load bitmap: '%s'", filename); return; } - + if (skip) srcData += 4; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 58744a9d2a..8299262d0e 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -322,7 +322,7 @@ protected: void drawShapePlotType0(uint8 *dst, uint8 cmd); void drawShapePlotType1(uint8 *dst, uint8 cmd); - void drawShapePlotType3_7(uint8 *dst, uint8 cmd); + void drawShapePlotType3_7(uint8 *dst, uint8 cmd); void drawShapePlotType4(uint8 *dst, uint8 cmd); void drawShapePlotType5(uint8 *dst, uint8 cmd); void drawShapePlotType6(uint8 *dst, uint8 cmd); @@ -331,7 +331,7 @@ protected: void drawShapePlotType11_15(uint8 *dst, uint8 cmd); void drawShapePlotType12(uint8 *dst, uint8 cmd); void drawShapePlotType13(uint8 *dst, uint8 cmd); - void drawShapePlotType14(uint8 *dst, uint8 cmd); + void drawShapePlotType14(uint8 *dst, uint8 cmd); typedef int (Screen::*DsMarginSkipFunc)(uint8 *&dst, const uint8 *&src, int &cnt); typedef void (Screen::*DsLineFunc)(uint8 *&dst, const uint8 *&src, int &cnt, int scaleState); diff --git a/engines/kyra/screen_lok.h b/engines/kyra/screen_lok.h index 5b4b8a9266..136c098160 100644 --- a/engines/kyra/screen_lok.h +++ b/engines/kyra/screen_lok.h @@ -40,7 +40,7 @@ public: bool init(); int getRectSize(int w, int h); - + void setScreenDim(int dim); const ScreenDim *getScreenDim(int dim); diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 1698c54bbf..8e7abee545 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -79,9 +79,9 @@ void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, u va_list args; va_start(args, flags); - vsnprintf(buffer, sizeof(buffer), format, args); + vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); - + if ((flags & 0x0F00) == 0x100) x -= getTextWidth(buffer) >> 1; if ((flags & 0x0F00) == 0x200) diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 07c5b89604..bba748813a 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -35,7 +35,7 @@ class LoLEngine; class Screen_LoL : public Screen_v2 { public: Screen_LoL(LoLEngine *vm, OSystem *system); - + void setScreenDim(int dim); const ScreenDim *getScreenDim(int dim); diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index c6ea6a93e8..b2952ee113 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -57,7 +57,7 @@ uint8 *Screen_v2::generateOverlay(const uint8 *palette, uint8 *buffer, int start uint8 processedPalette[3]; const uint8 *src = palette + i*3; byte col; - + col = *src++; col -= ((((col - col1) * factor) << 1) >> 8) & 0xFF; processedPalette[0] = col; @@ -487,13 +487,13 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) { debugC(9, kDebugLevelScreen, "Screen_v2::checkedPageUpdate(%d, %d)", srcPage, dstPage); - + const uint32 *src = (const uint32 *)getPagePtr(srcPage); uint32 *dst = (uint32 *)getPagePtr(dstPage); uint32 *page0 = (uint32 *)getPagePtr(0); - + bool updated = false; - + for (int y = 0; y < 200; ++y) { for (int x = 0; x < 80; ++x, ++src, ++dst, ++page0) { if (*src != *dst) { diff --git a/engines/kyra/screen_v2.h b/engines/kyra/screen_v2.h index 7bbdc4b6c3..d95bff35d1 100644 --- a/engines/kyra/screen_v2.h +++ b/engines/kyra/screen_v2.h @@ -46,7 +46,7 @@ public: uint8 *generateOverlay(const uint8 *palette, uint8 *buffer, int color, uint16 factor); void applyOverlay(int x, int y, int w, int h, int pageNum, const uint8 *overlay); int findLeastDifferentColor(const uint8 *paletteEntry, const uint8 *palette, uint16 numColors); - + virtual void getFadeParams(const uint8 *palette, int delay, int &delayInc, int &diff); // shape handling @@ -78,5 +78,5 @@ protected: } // end of namespace Kyra -#endif +#endif diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index e3a8bf95bc..4eb727a617 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -279,7 +279,7 @@ int KyraEngine_HoF::o2_wsaOpen(EMCState *script) { int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_displayWsaSequentialFrames(%p) (%d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6)); - + uint16 frameDelay = stackPos(2) * _tickLength; uint16 currentFrame = stackPos(3); uint16 lastFrame = stackPos(4); @@ -289,10 +289,10 @@ int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { _wsaSlots[index]->setX(stackPos(0)); _wsaSlots[index]->setY(stackPos(1)); _wsaSlots[index]->setDrawPage(0); - + _screen->hideMouse(); - while (currentFrame <= lastFrame) { + while (currentFrame <= lastFrame) { uint32 endTime = _system->getMillis() + frameDelay; _wsaSlots[index]->displayFrame(currentFrame++, copyParam, 0, 0); if (!skipFlag()) { @@ -309,7 +309,7 @@ int KyraEngine_HoF::o2_displayWsaSequentialFrames(EMCState *script) { int KyraEngine_HoF::o2_displayWsaSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_displayWsaSequence(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); - + const int frameDelay = stackPos(2) * _tickLength; const int index = stackPos(3); const bool doUpdate = (stackPos(4) != 0); @@ -318,13 +318,13 @@ int KyraEngine_HoF::o2_displayWsaSequence(EMCState *script) { _wsaSlots[index]->setX(stackPos(0)); _wsaSlots[index]->setY(stackPos(1)); _wsaSlots[index]->setDrawPage(0); - + _screen->hideMouse(); int currentFrame = 0; const int lastFrame = _wsaSlots[index]->frames(); - while (currentFrame <= lastFrame) { + while (currentFrame <= lastFrame) { uint32 endTime = _system->getMillis() + frameDelay; _wsaSlots[index]->displayFrame(currentFrame++, copyParam, 0, 0); if (!skipFlag()) { @@ -740,7 +740,7 @@ int KyraEngine_HoF::o2_setCauldronState(EMCState *script) { int KyraEngine_HoF::o2_showItemString(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_showItemString(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int item = stackPos(0); - + int string = 0; if (stackPos(1) == 1) { if (_lang == 1) @@ -798,7 +798,7 @@ int KyraEngine_HoF::o2_showLetter(EMCState *script) { _res->loadFileToBuf(filename, _screen->getPalette(0), 768); _screen->fadeToBlack(0x14); - + sprintf(filename, "LETTER%.1d.%s", letter, _languageExtension[_lang]); uint8 *letterBuffer = _res->fileData(filename, 0); if (!letterBuffer) { @@ -1142,11 +1142,11 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) { memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); for (int i = 1; i < 768; i += 3) - _screen->_currentPalette[i] = 0; + _screen->_currentPalette[i] = 0; snd_playSoundEffect(106); _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - + for (int i = 0; i < 768; i += 3) { _screen->_currentPalette[i] = _screen->_currentPalette[i + 1] = 0; _screen->_currentPalette[i + 2] += (((int8)_screen->_currentPalette[i + 2]) >> 1); @@ -1155,9 +1155,9 @@ int KyraEngine_HoF::o2_mushroomEffect(EMCState *script) { } snd_playSoundEffect(106); _screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor); - + memcpy(_screen->_currentPalette, _screen->getPalette(2), 768); - _screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor); + _screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor); return 0; } @@ -1232,7 +1232,7 @@ int KyraEngine_HoF::o2_setupSceneAnimation(EMCState *script) { obj->shapePtr = _sceneShapeTable[anim.shapeIndex]; else obj->shapePtr = 0; - + if (anim.flags & 0x40) { obj->shapeIndex3 = anim.shapeIndex; obj->animNum = index; @@ -1267,10 +1267,10 @@ int KyraEngine_HoF::o2_stopSceneAnimation(EMCState *script) { refreshAnimObjectsIfNeed(); obj.enabled = 0; _animList = deleteAnimListEntry(_animList, &_animObjects[1+index]); - + if (_sceneAnimMovie[index]->opened()) _sceneAnimMovie[index]->close(); - + return 0; } @@ -1425,7 +1425,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) { _sound->beginFadeOut(); _screen->fadeToBlack(); - + _runFlag = 0; return 0; } diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 5cd35a6063..4901b5e1c4 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -1356,7 +1356,7 @@ int KyraEngine_LoK::o1_waitForConfirmationMouseClick(EMCState *script) { _animator->updateAllObjectShapes(); updateInput(); - + int input = checkInput(_buttonList, false) & 0xFF; removeInputTop(); if (input == 200) diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index 3273d3b89f..ddad2d28c3 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -358,7 +358,7 @@ int KyraEngine_MR::o3_drawSceneShape(EMCState *script) { int KyraEngine_MR::o3_drawSceneShapeOnPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_drawSceneShapeOnPage(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const int shape = stackPos(0); - + int x = _sceneShapeDescs[shape].drawX; int y = _sceneShapeDescs[shape].drawY; _screen->drawShape(stackPos(2), _sceneShapes[shape], x, y, 2, (stackPos(1) != 0) ? 1 : 0); @@ -397,7 +397,7 @@ int KyraEngine_MR::o3_updateConversations(EMCState *script) { case 0: dlgIndex -= 34; break; - + case 1: dlgIndex -= 54; break; @@ -616,7 +616,7 @@ int KyraEngine_MR::o3_setSceneAnimPosAndFrame(EMCState *script) { const int newY2 = stackPos(2); const int newX = stackPos(3); const int newY = stackPos(4); - + if (newX2 >= 0) anim.x2 = newX2; if (newY2 >= 0) @@ -767,7 +767,7 @@ int KyraEngine_MR::o3_daggerWarning(EMCState *script) { const char *str = 0; int x = 0; - + str = (const char *)getTableEntry(_cCodeFile, 120); x = _text->getCenterStringX(str, 0xF, 0x68); _text->printText(str, x, 174, 0xFF, 0xF0, 0x00); @@ -1370,7 +1370,7 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o3_dummy); OpcodeUnImpl(); Opcode(o3_dummy); - + SetOpcodeTable(_opcodesAnimation); // 0x00 Opcode(o2a_setAnimationShapes); diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index b10a6adbba..24f7fce576 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -82,13 +82,13 @@ TIMInterpreter::TIMInterpreter(KyraEngine_v1 *vm, Screen_v2 *screen, OSystem *sy _commands = commandProcs; _commandsSize = ARRAYSIZE(commandProcs); - + memset(&_animations, 0, sizeof(_animations)); _langData = 0; _textDisplayed = false; _textAreaBuffer = new uint8[320*40]; assert(_textAreaBuffer); - + _palDelayInc = _palDiff = _palDelayAcc = 0; } @@ -134,10 +134,10 @@ TIM *TIMInterpreter::load(const char *filename, const Common::Array<const TIMOpc avtlChunkSize >>= 1; for (uint i = 0; i < avtlChunkSize; ++i) tim->avtl[i] = READ_LE_UINT16(tim->avtl + i); - + int num = (avtlChunkSize < TIM::kCountFuncs) ? avtlChunkSize : (int)TIM::kCountFuncs; for (int i = 0; i < num; ++i) - tim->func[i].avtl = tim->avtl + tim->avtl[i]; + tim->func[i].avtl = tim->avtl + tim->avtl[i]; strncpy(tim->filename, filename, 13); @@ -328,7 +328,7 @@ void TIMInterpreter::setupTextPalette(uint index, int fadePalette) { palette[1] = c2; palette[2] = c3; } - + if (!fadePalette && !_palDiff) { _screen->setScreenPalette(_screen->getPalette(0)); } else { @@ -347,14 +347,14 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char char file[32]; snprintf(file, 32, "%s.WSA", filename); - + if (_vm->resource()->exists(file)) { anim->wsa = new WSAMovie_v2(_vm, _screen); assert(anim->wsa); anim->wsa->open(file, wsaOpenFlags, (index == 1) ? _screen->getPalette(0) : 0); } - + if (anim->wsa && anim->wsa->opened()) { if (x == -1) anim->x = x = 0; @@ -382,7 +382,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char anim->wsa->setY(y); anim->wsa->setDrawPage(0); anim->wsa->displayFrame(0, 0, 0, 0); - } + } if (wsaFlags & 2) _screen->fadePalette(_screen->getPalette(0), 30, 0); @@ -406,7 +406,7 @@ TIMInterpreter::Animation *TIMInterpreter::initAnimStruct(int index, const char if (wsaFlags & 2) _screen->fadePalette(_screen->getPalette(0), 30, 0); } - + return anim; } @@ -460,13 +460,13 @@ int TIMInterpreter::cmd_initWSA(const uint16 *param) { const int index = param[0]; TIM::WSASlot &slot = _currentTim->wsa[index]; - + slot.x = int16(param[2]); slot.y = int16(param[3]); slot.offscreen = param[4]; slot.wsaFlags = param[5]; const char *filename = (const char *)(_currentTim->text + READ_LE_UINT16(_currentTim->text + (param[1]<<1))); - + slot.anim = initAnimStruct(index, filename, slot.x, slot.y, 10, slot.offscreen, slot.wsaFlags); return 1; } @@ -475,12 +475,12 @@ int TIMInterpreter::cmd_uninitWSA(const uint16 *param) { const int index = param[0]; TIM::WSASlot &slot = _currentTim->wsa[index]; - + if (!slot.anim) return 0; - + Animation &anim = _animations[index]; - + if (slot.offscreen) { delete anim.wsa; anim.wsa = 0; @@ -492,7 +492,7 @@ int TIMInterpreter::cmd_uninitWSA(const uint16 *param) { memset(&anim, 0, sizeof(Animation)); memset(&slot, 0, sizeof(TIM::WSASlot)); } - + return 1; } @@ -516,7 +516,7 @@ int TIMInterpreter::cmd_stopFunc(const uint16 *param) { int TIMInterpreter::cmd_wsaDisplayFrame(const uint16 *param) { Animation &anim = _animations[param[0]]; const int frame = param[1]; - + anim.wsa->setX(anim.x); anim.wsa->setY(anim.y); anim.wsa->setDrawPage((anim.wsaCopyParams & 0x4000) != 0 ? 2 : 8); @@ -553,7 +553,7 @@ int TIMInterpreter::cmd_playVocFile(const uint16 *param) { _vm->sound()->voicePlay(_vocFiles[index].c_str()/*, volume*/, true); else _vm->snd_playSoundEffect(index, volume); - + return 1; } @@ -579,7 +579,7 @@ int TIMInterpreter::cmd_setLoopIp(const uint16 *param) { int TIMInterpreter::cmd_continueLoop(const uint16 *param) { TIM::Function &func = _currentTim->func[_currentFunc]; - + if (!func.loopIp) return -2; @@ -591,7 +591,7 @@ int TIMInterpreter::cmd_continueLoop(const uint16 *param) { uint32 waitTime = (random * factor) / 0x8000; func.nextTime += waitTime * _vm->tickLength(); } - + return 1; } diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h index 68ef23fd6c..3299622a19 100644 --- a/engines/kyra/script_tim.h +++ b/engines/kyra/script_tim.h @@ -91,10 +91,10 @@ public: TIM *load(const char *filename, const Common::Array<const TIMOpcode*> *opcodes); void unload(TIM *&tim) const; - + void setLangData(const char *filename); void clearLangData() { delete[] _langData; _langData = 0; } - + const char *getCTableEntry(uint idx) const; void resetFinishedFlag() { _finished = false; } @@ -104,7 +104,7 @@ public: void stopCurFunc() { if (_currentTim) cmd_stopCurFunc(0); } void refreshTimersAfterPause(uint32 elapsedTime); - + void displayText(uint16 textId, int16 flags); void setupTextPalette(uint index, int fadePalette); @@ -118,15 +118,15 @@ private: int _currentFunc; bool _finished; - + Common::String _vocFiles[120]; - + Animation _animations[TIM::kWSASlots]; - + Animation *initAnimStruct(int index, const char *filename, int x, int y, int, int offscreenBuffer, uint16 wsaFlags); - + char _audioFilename[32]; - + uint8 *_langData; char *getTableEntry(uint idx); bool _textDisplayed; diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 7d0feaed16..7048225891 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -309,7 +309,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _eventList.clear(); if (_menuChoice == 2) { - seqNum = kSequenceTitle; + seqNum = kSequenceTitle; _menuChoice = 0; } } @@ -319,7 +319,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { _eventList.clear(); _screen->fadeToBlack(); } - + if (!_menuChoice) delay(1200); @@ -1798,7 +1798,7 @@ int KyraEngine_HoF::seq_demoDig(WSAMovie_v2 *wsaObj, int x, int y, int frm) { int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm) { uint8 *tmpPal = _screen->getPalette(2); - + if (!(_seqFrameCounter % 100)) { if (_seqFrameCounter == 0) { _sound->haltTrack(); @@ -1808,12 +1808,12 @@ int KyraEngine_HoF::seq_lolDemoScene1(WSAMovie_v2 *wsaObj, int x, int y, int frm for (int i = 3; i < 0x300; i++) { tmpPal[i] = ((int)tmpPal[i] * 120) / 64; if (tmpPal[i] > 0x3f) - tmpPal[i] = 0x3f; + tmpPal[i] = 0x3f; } seq_playTalkText(_rnd.getRandomBit()); _screen->setScreenPalette(tmpPal); _screen->updateScreen(); - delay(8); + delay(8); } else { _screen->setScreenPalette(_screen->getPalette(0)); _screen->updateScreen(); @@ -1853,7 +1853,7 @@ int KyraEngine_HoF::seq_lolDemoScene3(WSAMovie_v2 *wsaObj, int x, int y, int frm seq_playTalkText(6); else if (frm == 26) seq_playTalkText(7); - + _seqFrameCounter++; return frm; } @@ -1887,7 +1887,7 @@ int KyraEngine_HoF::seq_lolDemoScene4(WSAMovie_v2 *wsaObj, int x, int y, int frm default: break; } - + _seqFrameCounter++; return frm; } @@ -1929,7 +1929,7 @@ int KyraEngine_HoF::seq_lolDemoText5(WSAMovie_v2 *wsaObj, int x, int y, int frm) } int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm) { - while (_seqScrollTextCounter < 0x122) { + while (_seqScrollTextCounter < 0x122) { _seqEndTime = _system->getMillis() + 6 * _tickLength; if (!_seqFrameCounter) { _screen->loadBitmap("adtext.cps", 4, 4, 0); @@ -1947,17 +1947,17 @@ int KyraEngine_HoF::seq_lolDemoScene6(WSAMovie_v2 *wsaObj, int x, int y, int frm for (int i = 3; i < 0x300; i++) { tmpPal[i] = ((int)tmpPal[i] * 120) / 64; if (tmpPal[i] > 0x3f) - tmpPal[i] = 0x3f; + tmpPal[i] = 0x3f; } seq_playTalkText(_rnd.getRandomBit()); _screen->setScreenPalette(tmpPal); _screen->updateScreen(); delay(8); } - + if (_seqFrameCounter == 40 || _seqFrameCounter == 80 || _seqFrameCounter == 150 || _seqFrameCounter == 300) seq_playTalkText(3); - + _screen->copyPage(12, 2); seq_scrollPage(70, 130); _screen->copyPage(2, 0); @@ -2767,7 +2767,7 @@ void KyraEngine_HoF::seq_scrollPage(int bottom, int top) { if (dstH > 0) { if (_demoAnimData) { for (int i = 0; i < 4; i++) { - const ItemAnimData_v1 *def = &_demoAnimData[i]; + const ItemAnimData_v1 *def = &_demoAnimData[i]; ActiveItemAnim *a = &_activeItemAnim[i]; _screen->fillRect(12, def->y - 8, 28, def->y + 8, 0, 4); @@ -2830,7 +2830,7 @@ void KyraEngine_HoF::seq_init() { _res->unloadAllPakFiles(); _res->loadPakFile(StaticResource::staticDataFilename()); _res->loadFileList(_sequencePakList, _sequencePakListSize); - + if (_flags.platform == Common::kPlatformPC98) _sound->loadSoundFile("sound.dat"); @@ -2851,7 +2851,7 @@ void KyraEngine_HoF::seq_init() { numShp++; addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, numShp), numShp); } while (getShapePtr(numShp)); - } else { + } else { MainMenu::StaticData data = { { _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 }, diff --git a/engines/kyra/sequences_mr.cpp b/engines/kyra/sequences_mr.cpp index f41ed9c2f3..eb4c881e55 100644 --- a/engines/kyra/sequences_mr.cpp +++ b/engines/kyra/sequences_mr.cpp @@ -50,7 +50,7 @@ void KyraEngine_MR::showBadConscience() { if (_goodConscienceShown) _badConsciencePosition = !_goodConsciencePosition; - + int anim = _badConscienceAnim + (_badConsciencePosition ? 0 : 8); TalkObject &talkObject = _talkObjectList[1]; @@ -118,7 +118,7 @@ void KyraEngine_MR::showGoodConscience() { _goodConscienceShown = true; ++_goodConscienceAnim; _goodConscienceAnim %= 5; - + setNextIdleAnimTimer(); _goodConsciencePosition = (_mainCharacter.x1 <= 160); @@ -214,7 +214,7 @@ void KyraEngine_MR::eelScript() { case 2: runAnimationScript("EELS03.EMC", 0, 0, 1, 1); break; - + case 3: runAnimationScript("EELS04.EMC", 0, 0, 1, 1); break; diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index b456e96185..fc2e38d114 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -222,7 +222,7 @@ protected: enum { kNumChannelHandles = 4 }; - + struct SoundChannel { Common::String file; Audio::SoundHandle channelHandle; @@ -438,7 +438,7 @@ public: virtual kType getMusicType() const { return kPC98; } bool init(); - + void process() {} void loadSoundFile(uint file) {} void loadSoundFile(Common::String) {} @@ -484,7 +484,7 @@ protected: uint8 *_musicTrackData; uint8 *_sfxTrackData; - TownsPC98_OpnDriver *_driver; + TownsPC98_OpnDriver *_driver; }; class MixedSoundDriver : public Sound { diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 32b09ecd2d..1509f530a3 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -2311,7 +2311,7 @@ void SoundAdlibPC::play(uint8 track) { ++pauseCount; _vm->pauseEngine(false); } - + while ((_driver->callback(16, 0) & 8)) { // We call the system delay and not the game delay to avoid concurrency issues. _vm->_system->delayMillis(10); diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp index 20f3a7f9f9..b21336e993 100644 --- a/engines/kyra/sound_digital.cpp +++ b/engines/kyra/sound_digital.cpp @@ -56,7 +56,7 @@ private: int32 _fadeSamples; int32 _fadeCount; int _fading; - + bool _endOfData; }; @@ -69,13 +69,13 @@ void KyraAudioStream::beginFadeOut(uint32 millis) { int KyraAudioStream::readBuffer(int16 *buffer, const int numSamples) { int samplesRead = _impl->readBuffer(buffer, numSamples); - + if (_fading) { int samplesProcessed = 0; for (; samplesProcessed < samplesRead; ++samplesProcessed) { // To help avoid overflows for long fade times, we divide both // _fadeSamples and _fadeCount when calculating the new sample. - + int32 div = _fadeSamples / 256; if (_fading) { *buffer = (*buffer * (_fadeCount / 256)) / div; @@ -429,7 +429,7 @@ int SoundDigital::playSound(const char *filename, uint8 priority, Audio::Mixer:: if (volume > 255) volume = 255; volume = (volume * Audio::Mixer::kMaxChannelVolume) / 255; - + if (type == Audio::Mixer::kSpeechSoundType && _vm->heliumMode()) use->stream->setRate(32765); diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp index 357a1d1a0a..8870c2e516 100644 --- a/engines/kyra/sound_midi.cpp +++ b/engines/kyra/sound_midi.cpp @@ -176,7 +176,7 @@ void MidiOutput::send(uint32 b) { byte param2 = (b >> 16) & 0xFF; if (event == 0xE0) { // Pitch-Wheel - _channels[channel].pitchWheel = + _channels[channel].pitchWheel = _sources[_curSource].channelPW[channel] = (param2 << 8) | param1; } else if (event == 0xC0) { // Program change _channels[channel].program = @@ -382,7 +382,7 @@ int MidiOutput::lockChannel() { notes = _channels[i].noteCount; } } - + if (channel == -1) { if (flags & kChannelProtected) flags &= ~kChannelProtected; @@ -425,7 +425,7 @@ void MidiOutput::unlockChannel(int channel) { void MidiOutput::stopNotesOnChannel(int channel) { for (int i = 0; i < 4; ++i) { - SoundSource &sound = _sources[i]; + SoundSource &sound = _sources[i]; for (int j = 0; j < 32; ++j) { if (sound.notes[j].channel == channel) { sound.notes[j].channel = 0xFF; @@ -520,7 +520,7 @@ bool SoundMidiPC::init() { else pakFile = "INTROVOC.PAK"; } - + if (!midiFile) return true; @@ -701,7 +701,7 @@ void SoundMidiPC::onTimer(void *data) { for (int i = 0; i < 16; ++i) midi->_output->stopNotesOnChannel(i); for (int i = 0; i < 4; ++i) - midi->_output->deinitSource(i); + midi->_output->deinitSource(i); midi->_output->setSoundSource(0); midi->_music->stopPlaying(); diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 34c2c9c490..5edf662bd4 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -1174,7 +1174,7 @@ void TownsPC98_OpnOperator::keyOn() { void TownsPC98_OpnOperator::keyOff() { if (!_playing) return; - + _playing = false; if (_state != s_ready) _state = s_releasing; @@ -1361,7 +1361,7 @@ public: virtual void fadeStep(); void reset(); - const uint8 _idFlag; + const uint8 _idFlag; protected: void setupVibrato(); @@ -1623,7 +1623,7 @@ protected: private: void nextTick(int32 *buffer, uint32 bufferSize); void generateOutput(int32 &leftSample, int32 &rightSample, int32 *del, int32 *feed); - + struct ChanInternal { uint16 frqTemp; bool enableLeft; @@ -1637,7 +1637,7 @@ private: TownsPC98_OpnSquareSineSource *_ssg; TownsPC98_OpnPercussionSource *_prc; ChanInternal *_chanInternal; - + uint8 *_oprRates; uint8 *_oprRateshift; uint8 *_oprAttackDecay; @@ -1653,7 +1653,7 @@ private: struct OpnTimer { bool enabled; uint16 value; - + int32 smpTillCb; uint32 smpTillCbRem; int32 smpPerCb; @@ -1699,7 +1699,7 @@ public: void timerCallbackB(); void timerCallbackA(); - + bool looping() { return _looping == _updateChannelsFlag ? true : false; } bool musicPlaying() { return _musicPlaying; } @@ -1751,7 +1751,7 @@ protected: uint16 _sfxOffsets[2]; static const uint8 _drvTables[]; - + bool _ready; }; @@ -1897,7 +1897,7 @@ void TownsPC98_OpnChannel::processEvents() { void TownsPC98_OpnChannel::processFrequency() { if (_flags & CHS_RECALCFREQ) { - + _frequency = (((const uint16*)_drv->_opnFreqTable)[_frqBlockMSB & 0x0f] + _frqLSB) | (((_frqBlockMSB & 0x70) >> 1) << 8); _drv->writeReg(_part, _regOffset + 0xa4, (_frequency >> 8)); @@ -1970,7 +1970,7 @@ void TownsPC98_OpnChannel::reset() { _ticksLeft = 1; _flags = (_flags & ~CHS_EOT) | CHS_ALLOFF; - + _totalLevel = 0; _algorithm = 0; _flags = CHS_EOT; @@ -1986,7 +1986,7 @@ void TownsPC98_OpnChannel::reset() { _ssgTargetLvl = 0; _ssgStep = 0; _ssgTicksLeft = 0; - + _vbrInitDelayHi = 0; _vbrInitDelayLo = 0; _vbrModInitVal = 0; @@ -2101,7 +2101,7 @@ bool TownsPC98_OpnChannel::control_f8_toggleVibrato(uint8 para) { uint8 skipChannels = para / 36; uint8 entry = para % 36; TownsPC98_OpnDriver::TownsPC98_OpnChannel *t = &chan[skipChannels]; - + t->unnamedEntries[entry] = *_dataPtr++;*/ } return true; @@ -2571,7 +2571,7 @@ TownsPC98_OpnSquareSineSource::TownsPC98_OpnSquareSineSource(const uint32 timerb _reg[7] = &_chanEnable; _reg[8] = &_channels[0].vol; _reg[9] = &_channels[1].vol; - _reg[10] = &_channels[2].vol; + _reg[10] = &_channels[2].vol; reset(); } @@ -2731,7 +2731,7 @@ void TownsPC98_OpnSquareSineSource::updatesRegs() { TownsPC98_OpnPercussionSource::TownsPC98_OpnPercussionSource(const uint32 timerbase) : _tickLength(timerbase * 2), _timer(0), _ready(false) { - + memset(_rhChan, 0, sizeof(RhtChannel) * 6); _reg = new uint8 *[40]; @@ -2908,7 +2908,7 @@ void TownsPC98_OpnPercussionSource::advanceInput(RhtChannel *ins) { 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 }; - + uint8 cur = (int8) *ins->pos++; for (int i = 0; i < 2; i++) { @@ -2928,7 +2928,7 @@ TownsPC98_OpnCore::TownsPC98_OpnCore(Audio::Mixer *mixer, OpnType type) : _regProtectionFlag(false), _ready(false) { memset(&_timers[0], 0, sizeof(OpnTimer)); - memset(&_timers[1], 0, sizeof(OpnTimer)); + memset(&_timers[1], 0, sizeof(OpnTimer)); _timers[0].cb = &TownsPC98_OpnCore::timerCallbackA; _timers[1].cb = &TownsPC98_OpnCore::timerCallbackB; _timerbase = (uint32)(_baserate * 1000000.0f); @@ -2956,7 +2956,7 @@ bool TownsPC98_OpnCore::init() { } generateTables(); - + TownsPC98_OpnOperator **opr = new TownsPC98_OpnOperator*[_numChan << 2]; for (int i = 0; i < (_numChan << 2); i++) opr[i] = new TownsPC98_OpnOperator(_timerbase, _oprRates, _oprRateshift, _oprAttackDecay, _oprFrq, _oprSinTbl, _oprLevelOut, _oprDetune); @@ -2985,7 +2985,7 @@ bool TownsPC98_OpnCore::init() { return true; } -void TownsPC98_OpnCore::reset() { +void TownsPC98_OpnCore::reset() { for (int i = 0; i < _numChan; i++) { for (int ii = 0; ii < 4; ii++) _chanInternal[i].opr[ii]->reset(); @@ -3010,14 +3010,14 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { return; static const uint8 oprOrdr[] = { 0, 2, 1, 3 }; - + uint8 h = regAddress & 0xf0; uint8 l = (regAddress & 0x0f); ChanInternal *c = 0; TownsPC98_OpnOperator **co = 0; TownsPC98_OpnOperator *o = 0; - + if (regAddress > 0x2F) { c = &_chanInternal[(l & 3) + 3 * part]; co = c->opr; @@ -3052,7 +3052,7 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { _timers[0].value = (_timers[0].value & 0xff00) | value; } else if (l == 5) { // Timer A - _timers[0].value = (_timers[0].value & 0xff) | (value << 8); + _timers[0].value = (_timers[0].value & 0xff) | (value << 8); } else if (l == 6) { // Timer B _timers[1].value = value & 0xff; @@ -3071,12 +3071,12 @@ void TownsPC98_OpnCore::writeReg(uint8 part, uint8 regAddress, uint8 value) { if (value & 10) { _timers[0].smpTillCb = _timers[0].smpPerCb; _timers[0].smpTillCbRem = _timers[0].smpTillCbRem; - } + } if (value & 20) { _timers[1].smpTillCb = _timers[1].smpPerCb; _timers[1].smpTillCbRem = _timers[1].smpTillCbRem; - } + } } else if (l == 2) { // LFO warning("TownsPC98_OpnDriver: TRYING TO USE LFO (NOT SUPPORTED)"); @@ -3316,12 +3316,12 @@ void TownsPC98_OpnCore::nextTick(int32 *buffer, uint32 bufferSize) { for (uint32 ii = 0; ii < bufferSize ; ii++) { int32 phbuf1, phbuf2, output; phbuf1 = phbuf2 = output = 0; - + int32 *leftSample = &buffer[ii * 2]; int32 *rightSample = &buffer[ii * 2 + 1]; int32 *del = &_chanInternal[i].feedbuf[2]; int32 *feed = _chanInternal[i].feedbuf; - + switch (_chanInternal[i].algorithm) { case 0: o[0]->generateOutput(0, feed, phbuf1); @@ -3393,19 +3393,19 @@ void TownsPC98_OpnCore::nextTick(int32 *buffer, uint32 bufferSize) { } TownsPC98_OpnDriver::TownsPC98_OpnDriver(Audio::Mixer *mixer, OpnType type) : TownsPC98_OpnCore(mixer, type), - _channels(0), _ssgChannels(0), _sfxChannels(0), _rhythmChannel(0), - _trackPtr(0), _sfxData(0), _sfxOffs(0), _ssgPatches(0), + _channels(0), _ssgChannels(0), _sfxChannels(0), _rhythmChannel(0), + _trackPtr(0), _sfxData(0), _sfxOffs(0), _ssgPatches(0), _opnCarrier(_drvTables + 76), _opnFreqTable(_drvTables + 108), _opnFreqTableSSG(_drvTables + 132), _opnFxCmdLen(_drvTables + 36), _opnLvlPresets(_drvTables + (type == OD_TOWNS ? 52 : 84)), - + _updateChannelsFlag(type == OD_TYPE26 ? 0x07 : 0x3F), _finishedChannelsFlag(0), _updateSSGFlag(type == OD_TOWNS ? 0x00 : 0x07), _finishedSSGFlag(0), _updateRhythmFlag(type == OD_TYPE86 ? 0x01 : 0x00), _finishedRhythmFlag(0), _updateSfxFlag(type == OD_TOWNS ? 0x00 : 0x06), _finishedSfxFlag(0), - + _musicTickCounter(0), - + _musicPlaying(false), _sfxPlaying(false), _fading(false), _looping(0), _ready(false) { } @@ -3526,7 +3526,7 @@ void TownsPC98_OpnDriver::loadMusicData(uint8 *data, bool loadPaused) { _patches = src_a + 4; _finishedChannelsFlag = _finishedSSGFlag = _finishedRhythmFlag = 0; - _musicPlaying = (loadPaused ? false : true); + _musicPlaying = (loadPaused ? false : true); unlock(); } @@ -3596,7 +3596,7 @@ void TownsPC98_OpnDriver::fadeStep() { if (_updateChannelsFlag & _channels[j]->_idFlag) _channels[j]->fadeStep(); } - + for (int j = 0; j < _numSSG; j++) { if (_updateSSGFlag & _ssgChannels[j]->_idFlag) _ssgChannels[j]->fadeStep(); @@ -3637,7 +3637,7 @@ void TownsPC98_OpnDriver::timerCallbackB() { _ssgChannels[i]->processFrequency(); } } - + if (_hasPercussion) if (_updateRhythmFlag & _rhythmChannel->_idFlag) _rhythmChannel->processEvents(); @@ -4139,7 +4139,7 @@ bool SoundTownsPC98_v2::init() { if (_musicEnabled && (res->exists("track1.mp3") || res->exists("track1.ogg") || res->exists("track1.flac") || res->exists("track1.fla"))) _musicEnabled = 2; - + return _driver->init(); } diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 6653a6b47e..f97f5c808a 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -777,7 +777,7 @@ bool StaticResource::loadHofSequenceData(const char *filename, void *&ptr, int & tmp_f[ii].index = file->readUint16BE(); tmp_f[ii].delay = file->readUint16BE(); } - + tmp_n[i].wsaControl = (const FrameControl*) tmp_f; size += (num_c * sizeof(FrameControl)); @@ -807,7 +807,7 @@ bool StaticResource::loadShapeAnimData_v1(const char *filename, void *&ptr, int if (!file) return false; - size = file->readByte(); + size = file->readByte(); ItemAnimData_v1 *loadTo = new ItemAnimData_v1[size]; assert(loadTo); @@ -1251,7 +1251,7 @@ void KyraEngine_HoF::initStaticResource() { _sequencePakList = _staticres->loadStrings(k2SeqplayPakFiles, _sequencePakListSize); _ingamePakList = _staticres->loadStrings(k2IngamePakFiles, _ingamePakListSize); - _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); + _sequenceStrings = _staticres->loadStrings(k2SeqplayStrings, _sequenceStringsSize); _ingameSoundList = _staticres->loadStrings(k2IngameSfxFiles, _ingameSoundListSize); _ingameSoundIndex = (const uint16 *)_staticres->loadRawData(k2IngameSfxIndex, _ingameSoundIndexSize); _musicFileListIntro = _staticres->loadStrings(k2SeqplayIntroTracks, _musicFileListIntroSize); @@ -1395,9 +1395,9 @@ void KyraEngine_MR::initStaticResource() { int tmp = 0; _mainMenuStrings = _staticres->loadStrings(k3MainMenuStrings, _mainMenuStringsSize); _soundList = _staticres->loadStrings(k3MusicFiles, _soundListSize); - _scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize); + _scoreTable = _staticres->loadRawData(k3ScoreTable, _scoreTableSize); _sfxFileList = _staticres->loadStrings(k3SfxFiles, _sfxFileListSize); - _sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize); + _sfxFileMap = _staticres->loadRawData(k3SfxMap, _sfxFileMapSize); _itemAnimData = _staticres->loadShapeAnimData_v2(k3ItemAnimData, tmp); _itemMagicTable = _staticres->loadRawData(k3ItemMagicTable, tmp); _itemStringMap = _staticres->loadRawData(k3ItemStringMap, _itemStringMapSize); @@ -1499,13 +1499,13 @@ void GUI_LoK::initStaticResource() { _menu[0].item[2].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::gameControlsMenu); _menu[0].item[3].callback = quitPlayingFunctor; _menu[0].item[4].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::resumeGame); - + GUI_V1_MENU(_menu[1], -1, -1, 0x140, 0x38, 248, 249, 250, 0, 254,-1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[1].item[0], 1, 0, 0, 0, 0x18, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[1].item[1], 1, 0, 0, 0, 0xD8, 0, 0x1E, 0x48, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[1].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmYes); _menu[1].item[1].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::quitConfirmNo); - + GUI_V1_MENU(_menu[2], -1, -1, 0x120, 0xA0, 248, 249, 250, 0, 251, -1, 8, 0, 6, 132, 22, 132, 124); GUI_V1_MENU_ITEM(_menu[2].item[0], 1, 0, 0, 0, -1, 255, 0x27, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[2].item[1], 1, 0, 0, 0, -1, 255, 0x38, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); @@ -1514,13 +1514,13 @@ void GUI_LoK::initStaticResource() { GUI_V1_MENU_ITEM(_menu[2].item[4], 1, 0, 0, 0, -1, 255, 0x6B, 0x100, 0x0F, 252, 253, 5, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[2].item[5], 1, 0, 0, 0, 0xB8, 0, 0x86, 0x58, 0x0F, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[2].item[5].callback = cancelSubMenuFunctor; - + GUI_V1_MENU(_menu[3], -1, -1, 288, 67, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[3].item[0], 1, 0, 0, 0, 24, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[3].item[1], 1, 0, 0, 0, 179, 0, 44, 85, 15, 252, 253, -1, 255, 248, 249, 250, -1, 0, 0, 0, 0, 0); _menu[3].item[0].callback = BUTTON_FUNCTOR(GUI_LoK, this, &GUI_LoK::savegameConfirm); _menu[3].item[1].callback = cancelSubMenuFunctor; - + GUI_V1_MENU(_menu[4], -1, -1, 0xD0, 0x4C, 248, 249, 250, 0, 251, -1, 8, 0, 2, -1, -1, -1, -1); GUI_V1_MENU_ITEM(_menu[4].item[0], 1, 0, 0, 0, -1, -1, 0x1E, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); GUI_V1_MENU_ITEM(_menu[4].item[1], 1, 0, 0, 0, -1, -1, 0x2F, 0xB4, 0x0F, 252, 253, -1, 0, 248, 249, 250, -1, 0, 0, 0, 0, 0); @@ -1917,7 +1917,7 @@ void GUI_HoF::initStaticData() { _choiceMenu.item[i].enabled = false; for (int i = 0; i < 7; ++i) _choiceMenu.item[i].itemId = menuStr[3 * 8 + i + 1]; - + GUI_V2_MENU(_loadMenu, -1, -1, 0x120, 0xA0, 0xF8, 0xF9, 0xFA, menuStr[4 * 8], 0xFB, -1, 8, 0, 6, 0x84, 0x16, 0x84, 0x7C); GUI_V2_MENU_ITEM(_loadMenu.item[0], 1, 0x29, -1, 0x27, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); GUI_V2_MENU_ITEM(_loadMenu.item[1], 1, 0x2A, -1, 0x38, 0x100, 0xF, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); @@ -2103,7 +2103,7 @@ const char *KyraEngine_MR::_languageExtension[] = { "TRF", "TRG"/*, "TRI", Italian and Spanish were never included, the supported fan translations are using - "TRS" English/French extensions thus overwriting these languages */ + "TRS" English/French extensions thus overwriting these languages */ }; const int KyraEngine_MR::_languageExtensionSize = ARRAYSIZE(KyraEngine_MR::_languageExtension); diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp index 41b4c30245..dc3e1235c6 100644 --- a/engines/kyra/text_mr.cpp +++ b/engines/kyra/text_mr.cpp @@ -58,8 +58,8 @@ char *TextDisplayer_MR::preprocessString(const char *str) { offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); p += count + offs; // No update of textWidth here - } - + } + if (textWidth > (2*maxTextWidth)) { count = getCharLength(p, textWidth/3); offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); @@ -68,13 +68,13 @@ char *TextDisplayer_MR::preprocessString(const char *str) { } count = getCharLength(p, textWidth/2); - offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); + offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); p += count + offs; textWidth = _screen->getTextWidth(p); if (textWidth > maxTextWidth) { count = getCharLength(p, textWidth/2); - offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); + offs = dropCRIntoString(p, count, getCharLength(p, maxTextWidth)); } } @@ -250,7 +250,7 @@ void KyraEngine_MR::objectChatInit(const char *str, int object, int vocHigh, int debugC(9, kDebugLevelMain, "KyraEngine_MR::objectChatInit('%s', %d, %d, %d)", str, object, vocHigh, vocLow); str = _text->preprocessString(str); int lineNum = _text->buildMessageSubstrings(str); - + int xPos = 0, yPos = 0; if (!object) { @@ -508,7 +508,7 @@ void KyraEngine_MR::albumChat(const char *str, int vocHigh, int vocLow) { _talkObjectList[1].x = 190; _talkObjectList[1].y = 188; - + _chatVocHigh = _chatVocLow = -1; _albumChatActive = true; albumChatInit(str, 1, vocHigh, vocLow); @@ -543,7 +543,7 @@ void KyraEngine_MR::albumChatInit(const char *str, int object, int vocHigh, int str = _text->preprocessString(str); int lineNum = _text->buildMessageSubstrings(str); - + int xPos = 0, yPos = 0; if (!object) { @@ -670,7 +670,7 @@ void KyraEngine_MR::updateDlgBuffer() { snprintf(dlgFile, 16, "CH%.02d-S%.02d.", _currentChapter, _mainCharacter.dlgIndex); appendLanguage(dlgFile, _lang, 16); snprintf(cnvFile, 16, "CH%.02d-S%.02d.CNV", _currentChapter, _mainCharacter.dlgIndex); - + delete _cnvFile; delete _dlgBuffer; @@ -750,7 +750,7 @@ void KyraEngine_MR::processDialog(int vocHighIndex, int vocHighBase, int funcNum while (running) { uint16 cmd = _cnvFile->readUint16LE(); int object = cmd - 12; - + if (cmd == 10) { break; } else if (cmd == 4) { @@ -901,12 +901,12 @@ void KyraEngine_MR::randomSceneChat() { void KyraEngine_MR::runDialog(int dlgIndex, int funcNum) { debugC(9, kDebugLevelMain, "KyraEngine_MR::runDialog(%d, %d)", dlgIndex, funcNum); - + switch (_currentChapter-2) { case 0: dlgIndex -= 34; break; - + case 1: dlgIndex -= 54; break; diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index 777871d65a..da7e22f684 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -199,7 +199,7 @@ void TimerManager::setNextRun(uint8 id, uint32 nextRun) { Iterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id)); if (timer != _timers.end()) { - timer->nextRun = nextRun; + timer->nextRun = nextRun; return; } diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp index 0f6440fd47..851f36f742 100644 --- a/engines/kyra/vqa.cpp +++ b/engines/kyra/vqa.cpp @@ -657,7 +657,7 @@ void VQAMovie::play() { if (_vm->_mixer->isSoundHandleActive(_sound)) elapsedTime = _vm->_mixer->getSoundElapsedTime(_sound); - else + else elapsedTime = _system->getMillis() - startTick; if (elapsedTime >= (i * 1000) / _header.frameRate) diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp index 110755c3ba..818f3c691f 100644 --- a/engines/kyra/wsamovie.cpp +++ b/engines/kyra/wsamovie.cpp @@ -503,7 +503,7 @@ void WSAMovie_v2::displayFrame(int frameNum, ...) { const uint8 *unkPtr1 = va_arg(args, const uint8*); const uint8 *unkPtr2 = va_arg(args, const uint8*); va_end(args); - + _screen->copyWsaRect(_x, _y, _width, _height, 0, plotFunc, _offscreenBuffer, unk1, unkPtr1, unkPtr2); _screen->_curPage = pageBackUp; diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 5749e96bde..cb1f21ba9c 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -226,7 +226,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { diff --git a/engines/lure/game.cpp b/engines/lure/game.cpp index cf3d4ac125..860c64be35 100644 --- a/engines/lure/game.cpp +++ b/engines/lure/game.cpp @@ -138,12 +138,12 @@ void Game::execute() { screen.empty(); screen.setPaletteEmpty(); - + bool _loadSavegame = false; - + if (engine.gameToLoad() != -1) _loadSavegame = engine.loadGame(engine.gameToLoad()); - + if (!_loadSavegame) { // Flag for starting game setState(GS_RESTART); diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 8c9a20ba7e..772baea6fb 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -2277,7 +2277,7 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) { void Hotspot::saveToStream(Common::WriteStream *stream) { if (_data) _data->npcSchedule.saveToStream(stream); - else + else // Hotspot doesn't have an underlying data object, so write out an empty actions list stream->writeByte(0xff); @@ -2322,7 +2322,7 @@ void Hotspot::saveToStream(Common::WriteStream *stream) { void Hotspot::loadFromStream(Common::ReadStream *stream) { if (_data) _data->npcSchedule.loadFromStream(stream); - else + else // Dummy read of terminator for empty actions list assert(stream->readByte() == 0xff); diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp index a4676984c6..c2b84001fc 100644 --- a/engines/lure/intro.cpp +++ b/engines/lure/intro.cpp @@ -61,7 +61,7 @@ bool Introduction::showScreen(uint16 screenId, uint16 paletteId, uint16 delaySiz Palette p(paletteId); if (LureEngine::getReference().shouldQuit()) return true; - + if (isEGA) screen.setPalette(&p); else screen.paletteFadeIn(&p); diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 13173c8a96..e90059fa9b 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -118,14 +118,14 @@ LureEngine &LureEngine::getReference() { Common::Error LureEngine::go() { Game *gameInstance = new Game(); - + // If requested, load a savegame instead of showing the intro if (ConfMan.hasKey("save_slot")) { _gameToLoad = ConfMan.getInt("save_slot"); if (_gameToLoad < 0 || _gameToLoad > 999) _gameToLoad = -1; } - + if (_gameToLoad == -1) { if (ConfMan.getBool("copy_protection")) { CopyProtectionDialog *dialog = new CopyProtectionDialog(); @@ -249,7 +249,7 @@ void LureEngine::GUIError(const char *msg, ...) { GUIErrorMessage(buffer); } -void LureEngine::syncSoundSettings() { +void LureEngine::syncSoundSettings() { Sound.syncSounds(); } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 1c4fe883d0..7f97e533c1 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -785,7 +785,7 @@ void SequenceDelayList::add(uint16 delay, uint16 seqOffset, bool canClear) { void SequenceDelayList::tick() { SequenceDelayList::iterator i; - debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check start at time %d", + debugC(ERROR_DETAILED, kLureDebugScripts, "Delay List check start at time %d", g_system->getMillis()); for (i = begin(); i != end(); i++) { @@ -1221,7 +1221,7 @@ void BarmanLists::loadFromStream(Common::ReadStream *stream) { reset(); for (int index = 0; index < numEntries; ++index) { int16 value = stream->readUint16LE(); - _barList[index].currentCustomer = ((value < 1) || (value > NUM_SERVE_CUSTOMERS)) ? NULL : + _barList[index].currentCustomer = ((value < 1) || (value > NUM_SERVE_CUSTOMERS)) ? NULL : &_barList[index].customers[value - 1]; for (int ctr = 0; ctr < NUM_SERVE_CUSTOMERS; ++ctr) { diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp index 569058b282..ab43b3619a 100644 --- a/engines/lure/sound.cpp +++ b/engines/lure/sound.cpp @@ -598,7 +598,7 @@ MidiMusic::MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS], if (_isMusic) setVolume(ConfMan.getInt("music_volume")); else - setVolume(ConfMan.getInt("sfx_volume")); + setVolume(ConfMan.getInt("sfx_volume")); _passThrough = false; 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; diff --git a/engines/made/database.cpp b/engines/made/database.cpp index 8de30e28e8..b317862951 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -122,10 +122,10 @@ int ObjectV2::load(Common::SeekableReadStream &source) { delete[] _objData; _freeData = true; - + byte header[4]; source.read(header, 4); - + uint16 type = READ_LE_UINT16(header); if (type == 0x7FFF) { _objSize = READ_LE_UINT16(header + 2); @@ -370,11 +370,11 @@ GameDatabaseV2::~GameDatabaseV2() { } void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) { - + // TODO: Read/verifiy header - + sourceS.seek(0x1C); - + uint32 textOffs = sourceS.readUint16LE() * 512; uint16 objectCount = sourceS.readUint16LE(); uint16 varObjectCount = sourceS.readUint16LE(); @@ -409,7 +409,7 @@ void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) { sourceS.skip(objSize % 2); _objects.push_back(obj); } - + } void GameDatabaseV2::reloadFromStream(Common::SeekableReadStream &sourceS) { @@ -700,7 +700,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i } return NULL; - + } const char *GameDatabaseV3::getString(uint16 offset) { diff --git a/engines/made/database.h b/engines/made/database.h index 3a6a0d6268..6d12e20b2b 100644 --- a/engines/made/database.h +++ b/engines/made/database.h @@ -82,11 +82,11 @@ public: byte getCount1(); byte getCount2(); byte *getData(); - + bool isConstant() { return false; } - + }; class ObjectV3 : public Object { @@ -100,11 +100,11 @@ public: byte getCount1(); byte getCount2(); byte *getData(); - + bool isConstant() { return !(getFlags() & 1); } - + }; class GameDatabase { diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp index 57597ced37..afc1fdd9a3 100644 --- a/engines/made/detection.cpp +++ b/engines/made/detection.cpp @@ -244,7 +244,7 @@ static const MadeGameDescription gameDescriptions[] = { GF_DEMO, 0, }, - + { // The Manhole: New and Enhanced { diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp index ee702893a0..35b00b466c 100644 --- a/engines/made/graphics.cpp +++ b/engines/made/graphics.cpp @@ -183,7 +183,7 @@ void decompressMovieImage(byte *source, Graphics::Surface &surface, uint16 cmdOf int bitBufLastCount = ((width + 3) >> 2) & 7; if (bitBufLastCount == 0) bitBufLastCount = 8; - + debug(1, "width = %d; bw = %d", width, bw); while (height > 0) { diff --git a/engines/made/made.cpp b/engines/made/made.cpp index fe4fcee63d..4baed339d5 100644 --- a/engines/made/made.cpp +++ b/engines/made/made.cpp @@ -79,7 +79,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng int cd_num = ConfMan.getInt("cdrom"); if (cd_num >= 0) _system->openCD(cd_num); - + _pmvPlayer = new PmvPlayer(this, _mixer); _res = new ProjectReader(); _screen = new Screen(this); @@ -279,7 +279,7 @@ Common::Error MadeEngine::go() { _autoStopSound = false; _eventNum = _eventKey = _eventMouseX = _eventMouseY = 0; - + #ifdef DUMP_SCRIPTS _script->dumpAllScripts(); #else diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 92497b74de..3cf35baf9c 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -84,7 +84,7 @@ void PmvPlayer::play(const char *filename) { uint32 palSize = 0; byte *frameData, *audioData, *soundData, *palData, *imageData; bool firstTime = true; - + uint32 soundStartTime = 0, skipFrames = 0; uint32 frameNum; @@ -106,7 +106,7 @@ void PmvPlayer::play(const char *filename) { frameData = new byte[chunkSize]; _fd->read(frameData, chunkSize); - + soundChunkOfs = READ_LE_UINT32(frameData + 8); palChunkOfs = READ_LE_UINT32(frameData + 16); @@ -156,7 +156,7 @@ void PmvPlayer::play(const char *filename) { } decompressMovieImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize); - + if (firstTime) { _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream); soundStartTime = g_system->getMillis(); @@ -188,7 +188,7 @@ void PmvPlayer::play(const char *filename) { _audioStream->finish(); _mixer->stopHandle(_audioStreamHandle); - + //delete _audioStream; delete _fd; delete _surface; @@ -221,7 +221,7 @@ void PmvPlayer::handleEvents() { } void PmvPlayer::updateScreen() { - _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, + _vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, (320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h); _vm->_system->updateScreen(); } diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp index a61d122041..1ce416c9f1 100644 --- a/engines/made/redreader.cpp +++ b/engines/made/redreader.cpp @@ -40,10 +40,10 @@ Common::MemoryReadStream *RedReader::load(const char *redFilename, const char *f error("RedReader::RedReader() Could not find %s in archive %s", filename, redFilename); byte *fileBuf = (byte *)malloc(fileEntry.origSize); - + LzhDecompressor lzhDec; lzhDec.decompress(fd, fileBuf, fileEntry.compSize, fileEntry.origSize); - + return new Common::MemoryReadStream(fileBuf, fileEntry.origSize, true); } diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index 2cae8b276c..bfd94ea86f 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -57,7 +57,7 @@ PictureResource::~PictureResource() { void PictureResource::load(byte *source, int size) { Common::MemoryReadStream *sourceS = new Common::MemoryReadStream(source, size); - + _hasPalette = (sourceS->readByte() != 0); byte cmdFlags = sourceS->readByte(); byte pixelFlags = sourceS->readByte(); @@ -109,7 +109,7 @@ void AnimationResource::load(byte *source, int size) { sourceS->readUint32LE(); sourceS->readUint32LE(); sourceS->readUint16LE(); - + _flags = sourceS->readUint16LE(); _width = sourceS->readUint16LE(); _height = sourceS->readUint16LE(); @@ -137,7 +137,7 @@ void AnimationResource::load(byte *source, int size) { uint16 maskOffs = sourceS->readUint16LE(); sourceS->readUint16LE(); uint16 lineSize = sourceS->readUint16LE(); - + Graphics::Surface *frame = new Graphics::Surface(); frame->create(frameWidth, frameHeight, 1); @@ -148,7 +148,7 @@ void AnimationResource::load(byte *source, int size) { } delete sourceS; - + } /* SoundResource */ @@ -165,16 +165,16 @@ void SoundResource::load(byte *source, int size) { uint16 chunkCount = READ_LE_UINT16(source + 8); uint16 chunkSize = READ_LE_UINT16(source + 12); - + _soundSize = chunkCount * chunkSize; _soundData = new byte[_soundSize]; - decompressSound(source + 14, _soundData, chunkSize, chunkCount); + decompressSound(source + 14, _soundData, chunkSize, chunkCount); } Audio::AudioStream *SoundResource::getAudioStream(int soundRate, bool loop) { byte flags = Audio::Mixer::FLAG_UNSIGNED; - if (loop) + if (loop) flags |= Audio::Mixer::FLAG_LOOP; return Audio::makeLinearInputStream(_soundData, _soundSize, soundRate, flags, 0, 0); diff --git a/engines/made/resource.h b/engines/made/resource.h index cb6e0b65f4..db327d6a3c 100644 --- a/engines/made/resource.h +++ b/engines/made/resource.h @@ -81,7 +81,7 @@ public: ~AnimationResource(); void load(byte *source, int size); int getCount() const { return _frames.size(); } - Graphics::Surface *getFrame(int index) const { + Graphics::Surface *getFrame(int index) const { if ((uint)index < _frames.size()) { return _frames[index]; } else { diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 38a4baffc5..e3e56381e6 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -70,10 +70,10 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) { _clip = 0; _exclude = 0; _mask = 0; - + _visualEffectNum = 0; _fx = new ScreenEffects(this); - + _textX = 0; _textY = 0; _textColor = 0; @@ -138,7 +138,7 @@ void Screen::setExcludeArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { _excludeClipArea[3].clipRect = Common::Rect(x2, y1, 320, y2); _excludeClipAreaEnabled[3] = true; } - + } void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo) { @@ -148,7 +148,7 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f int startY = 0; int clipWidth = sourceSurface->w; int clipHeight = sourceSurface->h; - + if (x < clipInfo.clipRect.left) { startX = clipInfo.clipRect.left - x; clipWidth -= startX; @@ -280,17 +280,17 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask _excludeClipArea[i].destSurface = clipInfo.destSurface; _clipArea.destSurface = clipInfo.destSurface; - + for (uint16 i = 0; i < _channelsUsedCount; i++) { - + debug(2, "drawSpriteChannels() i = %d\n", i); - + if (((_channels[i].state & includeStateMask) == includeStateMask) && (_channels[i].state & excludeStateMask) == 0) { int16 flipX = _channels[i].state & 0x10; int16 flipY = _channels[i].state & 0x20; - + debug(2, "drawSpriteChannels() type = %d; index = %04X\n", _channels[i].type, _channels[i].index); - + switch (_channels[i].type) { case 1: // drawFlex @@ -306,7 +306,7 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask drawFlex(_channels[i].index, _channels[i].x, _channels[i].y, flipX, flipY, _channels[i].mask, clipInfo); } break; - + case 2: // drawObjectText printObjectText(_channels[i].index, _channels[i].x, _channels[i].y, _channels[i].fontNum, _channels[i].textColor, _channels[i].outlineColor, clipInfo); break; @@ -328,14 +328,14 @@ void Screen::drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask case 4: // drawMenuText // Never used in any game break; - + default: break; } } - + } } @@ -349,9 +349,9 @@ void Screen::updateSprites() { drawSpriteChannels(_workScreenDrawCtx, 1, 2); _vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h); - + _vm->_system->updateScreen(); - + } void Screen::clearChannels() { @@ -432,30 +432,30 @@ uint16 Screen::placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 if (channelIndex < 1 || channelIndex >= 100) return 0; - + channelIndex--; - + PictureResource *flex = _vm->_res->getPicture(flexIndex); - + if (flex) { Graphics::Surface *surf = flex->getPicture(); - + int16 state = 1; int16 x1, y1, x2, y2; - + x1 = x; y1 = y; x2 = x + surf->w + 1; y2 = y + surf->h + 1; //TODO: clipRect(x1, y1, x2, y2); - + if (_ground == 0) state |= 2; if (_clip != 0) state |= 4; if (_exclude != 0) state |= 8; - + _channels[channelIndex].state = state; _channels[channelIndex].type = 1; _channels[channelIndex].index = flexIndex; @@ -564,7 +564,7 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i int textWidth = _font->getTextWidth(text); int textHeight = _font->getHeight(); - + if (outlineColor != -1) { textWidth += 2; textHeight += 2; @@ -582,9 +582,9 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i x++; y++; } - + int16 state = 1; - + if (_ground == 0) state |= 2; @@ -652,7 +652,7 @@ void Screen::printChar(uint c, int16 x, int16 y, byte color) { uint width = 8, height = _font->getHeight(); byte *charData = _font->getChar(c); - + if (!charData) return; @@ -683,9 +683,9 @@ void Screen::printText(const char *text) { int linePos = 1; int16 x = _textX; int16 y = _textY; - + for (int textPos = 0; textPos < textLen; textPos++) { - + uint c = ((const byte*)text)[textPos]; int charWidth = _font->getCharWidth(c); @@ -714,17 +714,17 @@ void Screen::printText(const char *text) { // TODO: text[textPos] = '\x01'; } } - + if (x + charWidth > _textRect.right) { linePos = 1; x = _textRect.left; y += textHeight; } - + if (y + textHeight > _textRect.bottom) { // TODO } - + if (c >= 28 && c <= 255) { if (_dropShadowColor != -1) { printChar(c, x + 1, y + 1, _dropShadowColor); @@ -743,7 +743,7 @@ void Screen::printText(const char *text) { x += charWidth; linePos++; } - + } _textX = x; @@ -760,7 +760,7 @@ void Screen::printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int1 ClipInfo oldFontDrawCtx = _fontDrawCtx; _fontDrawCtx = clipInfo; - + getTextRect(oldTextRect); setFont(fontNum); setTextColor(textColor); @@ -770,7 +770,7 @@ void Screen::printTextEx(const char *text, int16 x, int16 y, int16 fontNum, int1 setTextRect(oldTextRect); setFont(oldFontNum); _fontDrawCtx = oldFontDrawCtx; - + } void Screen::printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, int16 textColor, int16 outlineColor, const ClipInfo &clipInfo) { @@ -780,7 +780,7 @@ void Screen::printObjectText(int16 objectIndex, int16 x, int16 y, int16 fontNum, Object *obj = _vm->_dat->getObject(objectIndex); const char *text = obj->getString(); - + printTextEx(text, x, y, fontNum, textColor, outlineColor, clipInfo); } diff --git a/engines/made/screen.h b/engines/made/screen.h index 5d55085e5c..0e3b8a44f2 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -88,9 +88,9 @@ public: ~Screen(); void clearScreen(); - + void drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo); - + void loadRGBPalette(byte *palRGB, int count = 256); void setRGBPalette(byte *palRGB, int start = 0, int count = 256); bool isPaletteLocked() { return _paletteLock; } @@ -127,16 +127,16 @@ public: _dropShadowColor = -1; } - void setDropShadowColor(int16 color) { + void setDropShadowColor(int16 color) { _outlineColor = -1; _dropShadowColor = color; } - + void setTextXY(int16 x, int16 y) { _textX = x; _textY = y; } - + void homeText() { _textX = _textRect.left; _textY = _textRect.top; @@ -153,18 +153,18 @@ public: void drawSpriteChannels(const ClipInfo &clipInfo, int16 includeStateMask, int16 excludeStateMask); void updateSprites(); void clearChannels(); - + uint16 drawFlex(uint16 flexIndex, int16 x, int16 y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo); void drawAnimFrame(uint16 animIndex, int16 x, int16 y, int16 frameNum, int16 flipX, int16 flipY, const ClipInfo &clipInfo); uint16 drawPic(uint16 index, int16 x, int16 y, int16 flipX, int16 flipY); uint16 drawMask(uint16 index, int16 x, int16 y); - + uint16 drawAnimPic(uint16 animIndex, int16 x, int16 y, int16 frameNum, int16 flipX, int16 flipY); - + void addSprite(uint16 spriteIndex); - + uint16 drawSprite(uint16 flexIndex, int16 x, int16 y); uint16 placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16 y); @@ -173,7 +173,7 @@ public: int16 getAnimFrame(uint16 channelIndex); uint16 placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, int16 y, uint16 fontNum, int16 textColor, int16 outlineColor); - + void show(); void flash(int count); @@ -193,13 +193,13 @@ public: int16 addToSpriteList(int16 index, int16 xofs, int16 yofs); SpriteListItem getFromSpriteList(int16 index); void clearSpriteList(); - + void setDefaultMouseCursor(); protected: MadeEngine *_vm; ScreenEffects *_fx; - + bool _screenLock; bool _paletteLock; @@ -219,18 +219,18 @@ protected: int16 _clip, _exclude, _ground, _mask; int _visualEffectNum; - + Graphics::Surface *_backgroundScreen, *_workScreen, *_screenMask; ClipInfo _clipArea, _backgroundScreenDrawCtx, _workScreenDrawCtx, _maskDrawCtx; - + ClipInfo _excludeClipArea[4]; bool _excludeClipAreaEnabled[4]; - + uint16 _channelsUsedCount; SpriteChannel _channels[100]; - + Common::Array<SpriteListItem> _spriteList; - + }; } // End of namespace Made diff --git a/engines/made/script.cpp b/engines/made/script.cpp index e4fd82b90f..45497b81a7 100644 --- a/engines/made/script.cpp +++ b/engines/made/script.cpp @@ -179,7 +179,7 @@ ScriptInterpreter::ScriptInterpreter(MadeEngine *vm) : _vm(vm) { _functions = new ScriptFunctions(_vm); _functions->setupExternalsTable(); - + #undef COMMAND } @@ -574,20 +574,20 @@ void ScriptInterpreter::cmd_send() { debug(4, "\nENTER: stackPtr = %d; _localStackPos = %d", _stack.getStackPos(), _localStackPos); byte argc = readByte(); - + debug(4, "argc = %d", argc); - + _stack.push(argc); _stack.push(_codeIp - _codeBase); _stack.push(_runningScriptObjectIndex); _stack.push(kScriptStackLimit - _localStackPos); _localStackPos = _stack.getStackPos(); - + int16 propertyId = _stack.peek(_localStackPos + argc + 2); int16 objectIndex = _stack.peek(_localStackPos + argc + 4); debug(4, "objectIndex = %d (%04X); propertyId = %d(%04X)", objectIndex, objectIndex, propertyId, propertyId); - + if (objectIndex != 0) { objectIndex = _vm->_dat->getObject(objectIndex)->getClass(); } else { @@ -625,9 +625,9 @@ void ScriptInterpreter::cmd_extend() { int16 result = _functions->callFunction(func, argc, argv); debug(2, "result = %04X (%d)", result, result); - + _stack.free(argc); - + _stack.setTop(result); } @@ -685,7 +685,7 @@ void ScriptInterpreter::dumpScript(int16 objectIndex, int *opcodeStats, int *ext Object *obj = _vm->_dat->getObject(objectIndex); byte *code = obj->getData(), *codeStart = code, *codeEnd = code + obj->getSize(); - + while (code < codeEnd) { byte opcode = *code++; if (opcode >= 1 && opcode <= _commandsMax) { diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index 835d846108..72ce3e238c 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -93,7 +93,7 @@ void ScriptFunctions::setupExternalsTable() { External(sfLoadMouseCursor); External(sfSetSpriteGround); External(sfLoadResText); - + if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) { External(sfAddScreenMask); External(sfSetSpriteMask); @@ -113,7 +113,7 @@ void ScriptFunctions::setupExternalsTable() { External(sfGetCdTime); External(sfPlayCdSegment); } - + if (_vm->getGameID() == GID_RTZ) { External(sfPrintf); External(sfClearMono); @@ -236,7 +236,7 @@ int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) { _vm->_autoStopSound = (argv[0] == 1); } if (soundNum > 0) { - _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, + _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false)); } return 0; @@ -833,18 +833,18 @@ int16 ScriptFunctions::sfGetMenuCount(int16 argc, int16 *argv) { } int16 ScriptFunctions::sfSaveGame(int16 argc, int16 *argv) { - + int16 saveNum = argv[2]; int16 descObjectIndex = argv[1]; int16 version = argv[0]; - + if (saveNum > 999) return 6; const char *description = _vm->_dat->getObjectString(descObjectIndex); Common::String filename = _vm->getSavegameFilename(saveNum); return _vm->_dat->savegame(filename.c_str(), description, version); - + } int16 ScriptFunctions::sfLoadGame(int16 argc, int16 *argv) { @@ -857,11 +857,11 @@ int16 ScriptFunctions::sfLoadGame(int16 argc, int16 *argv) { Common::String filename = _vm->getSavegameFilename(saveNum); return _vm->_dat->loadgame(filename.c_str(), version); - + } int16 ScriptFunctions::sfGetGameDescription(int16 argc, int16 *argv) { - + int16 descObjectIndex = argv[2]; int16 saveNum = argv[1]; /*int16 version = argv[0];*/ diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h index 9879556c3f..39dd9ad77e 100644 --- a/engines/made/scriptfuncs.h +++ b/engines/made/scriptfuncs.h @@ -63,7 +63,7 @@ protected: Common::Array<const ExternalFunc*> _externalFuncs; Common::Array<const char *> _externalFuncNames; GenericResource *_musicRes; - + int16 sfSystemCall(int16 argc, int16 *argv); int16 sfInitGraf(int16 argc, int16 *argv); int16 sfRestoreGraf(int16 argc, int16 *argv); diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index 27cf516b11..98426ea20b 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -59,7 +59,7 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou workChunkSize /= 4; type = (*source++) & 0x0F; - + workSample = prevSample; switch (type) { diff --git a/engines/metaengine.h b/engines/metaengine.h index af01c2658f..0a4ac680b5 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -113,9 +113,9 @@ public: } /** - * Remove the specified save state. + * Remove the specified save state. * - * For most engines this just amounts to calling _saveFileMan->removeSaveFile(). + * For most engines this just amounts to calling _saveFileMan->removeSaveFile(). * Engines which keep an index file will also update it accordingly. * * @note MetaEngines must indicate that this function has been implemented @@ -141,7 +141,7 @@ public: /** @name MetaEngineFeature flags */ //@{ - + /** * A feature in this context means an ability of the engine which can be * either available or not. @@ -153,7 +153,7 @@ public: * Used for --list-saves support, as well as the GMM load dialog. */ kSupportsListSaves, - + /** * Loading from the Launcher / command line (-x) */ @@ -189,7 +189,7 @@ public: kSavesSupportThumbnail, /** - * Features 'save_date' and 'save_time' entries in the + * Features 'save_date' and 'save_time' entries in the * savestate returned by querySaveMetaInfo. Those values * indicate the date/time the savegame was created. * This flag may only be set when 'kSavesSupportMetaInfo' is set. @@ -208,7 +208,7 @@ public: /** * Determine whether the engine supports the specified MetaEngine feature. * Used by e.g. the launcher to determine whether to enable the "Load" button. - */ + */ virtual bool hasFeature(MetaEngineFeature f) const { return false; } diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index ce4144d39d..e0241fb014 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -147,13 +147,13 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { for (int i = 0; i < 4; i++) in->readUint32BE(); - in->read(saveDesc, 32); + in->read(saveDesc, 32); saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); delete in; } @@ -353,7 +353,7 @@ Common::Error QueenEngine::saveGameState(int slot, const char *desc) { warning("Can't create file '%s', game not saved", name); err = Common::kCreatingFileFailed; } - + return err; } diff --git a/engines/queen/queen.h b/engines/queen/queen.h index 34ba0ab8e7..3f7e40fc0f 100644 --- a/engines/queen/queen.h +++ b/engines/queen/queen.h @@ -102,7 +102,7 @@ public: void talkSpeed(int speed) { _talkSpeed = speed; } bool subtitles() const { return _subtitles; } void subtitles(bool enable) { _subtitles = enable; } - + void update(bool checkPlayerInput = false); bool canLoadOrSave() const; diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 2d42ba336f..53540186d6 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -198,7 +198,7 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -285,7 +285,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -298,7 +298,7 @@ SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int s return desc; } - + return SaveStateDescriptor(); } @@ -358,12 +358,12 @@ Common::Error SagaEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool SagaEngine::canLoadGameStateCurrently() { +bool SagaEngine::canLoadGameStateCurrently() { return !_scene->isInIntro(); } -bool SagaEngine::canSaveGameStateCurrently() { - return !_scene->isInIntro() && +bool SagaEngine::canSaveGameStateCurrently() { + return !_scene->isInIntro() && (_interface->getMode() == kPanelMain || _interface->getMode() == kPanelChapterSelection); } diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 072a755f5d..166eb97d55 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -912,7 +912,7 @@ void Interface::drawPanelText(InterfacePanel *panel, PanelButton *panelButton) { textPoint.x = rect.left; textPoint.y = rect.top + 1; - _vm->_font->textDraw(textFont, text, textPoint, + _vm->_font->textDraw(textFont, text, textPoint, _vm->KnownColor2ColorId(kKnownColorVerbText), _vm->KnownColor2ColorId(textShadowKnownColor), kFontShadow); } @@ -1642,7 +1642,7 @@ void Interface::setOption(PanelButton *panelButton) { _vm->_subtitlesEnabled = true; // Set it to "Text" _vm->_voicesEnabled = false; } - + _vm->_speechVolume = _vm->_speechVolume + 25; if (_vm->_speechVolume > 255) _vm->_speechVolume = 0; ConfMan.setInt("speech_volume", _vm->_speechVolume); @@ -2378,8 +2378,8 @@ void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnown point.y = _mainPanel.y + panelButton->yOffset + 12; } - _vm->_font->textDraw(kKnownFontVerb, text, point, - _vm->KnownColor2ColorId(textKnownColor), _vm->KnownColor2ColorId(textShadowKnownColor), + _vm->_font->textDraw(kKnownFontVerb, text, point, + _vm->KnownColor2ColorId(textKnownColor), _vm->KnownColor2ColorId(textShadowKnownColor), (textShadowKnownColor != kKnownColorTransparent) ? kFontShadow : kFontNormal); } diff --git a/engines/saga/introproc_fta2.cpp b/engines/saga/introproc_fta2.cpp index 0629ebe8e2..4e9541d0b9 100644 --- a/engines/saga/introproc_fta2.cpp +++ b/engines/saga/introproc_fta2.cpp @@ -48,7 +48,7 @@ public: } ~MoviePlayerSMK(void) { closeFile(); } - bool load(const char *filename) { + bool load(const char *filename) { _skipVideo = false; return loadFile(filename); } @@ -100,8 +100,8 @@ void MoviePlayerSMK::playVideo() { bool MoviePlayerSMK::processFrame() { Graphics::Surface *screen = _vm->_system->lockScreen(); - copyFrameToBuffer((byte *)screen->pixels, - (_vm->getDisplayInfo().width - getWidth()) / 2, + copyFrameToBuffer((byte *)screen->pixels, + (_vm->getDisplayInfo().width - getWidth()) / 2, (_vm->getDisplayInfo().height - getHeight()) / 2, _vm->getDisplayInfo().width); _vm->_system->unlockScreen(); diff --git a/engines/saga/itedata.cpp b/engines/saga/itedata.cpp index b8b14427b1..7f323b5587 100644 --- a/engines/saga/itedata.cpp +++ b/engines/saga/itedata.cpp @@ -257,7 +257,7 @@ ObjectTableData ITE_ObjectTable[ITE_OBJECTCOUNT] = { { 40, 269, 644, 416, 0, 41, 39, kObjNotFlat }, // Electrical Cable { 41, 12, 280, 516, 0, 43, 17, kObjUseWith }, // Piece of flint { 42, 5, 876, 332, 32, 65, 18, 0 }, // Rat Cloak - { 43, 52, 556, 1612, 0, 49, 28, kObjUseWith | + { 43, 52, 556, 1612, 0, 49, 28, kObjUseWith | kObjNotFlat }, // Bucket { 48, 52, 732, 948, 0, 50, 27, kObjUseWith }, // Cup { 49, 52, 520, 1872, 0, 53, 29, 0 }, // Fertilizer diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 167861e7f2..8ed978791f 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -442,7 +442,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { uint32 loopStart; debug(2, "Music::play %d, %d", resourceId, flags); - + if (isPlaying() && _trackNumber == resourceId) { return; } @@ -450,7 +450,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { _trackNumber = resourceId; _player->stopMusic(); _mixer->stopHandle(_musicHandle); - + int realTrackNumber; if (_vm->getGameId() == GID_ITE) { diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index 688eed226e..599fde20e5 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -180,7 +180,7 @@ void Render::drawScene() { textPoint.x = (_vm->_gfx->getBackBufferWidth() - _vm->_font->getStringWidth(kKnownFontPause, pauseString, 0, kFontOutline)) / 2; textPoint.y = 90; - _vm->_font->textDraw(kKnownFontPause, pauseString, textPoint, + _vm->_font->textDraw(kKnownFontPause, pauseString, textPoint, _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline); } diff --git a/engines/saga/resource_hrs.cpp b/engines/saga/resource_hrs.cpp index 72f83981a6..cc59f7ccc9 100644 --- a/engines/saga/resource_hrs.cpp +++ b/engines/saga/resource_hrs.cpp @@ -56,7 +56,7 @@ bool Resource_HRS::loadResContext_v2(ResourceContext *context, uint32 contextSiz debug(3, "Context %s =====", context->fileName); context->file->seek(0, SEEK_SET); - + readElement(context->file, origin); // Check if the file is valid diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index f6249a7d0f..7f9fd6870c 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -233,7 +233,7 @@ Common::Error SagaEngine::init() { // Initialize system specific sound _sound = new Sound(this, _mixer); - + if (!isSaga2()) { _interface->converseInit(); _script->setVerb(_script->getVerbType(kVerbWalkTo)); diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp index a81635d587..1384f1bf47 100644 --- a/engines/saga/script.cpp +++ b/engines/saga/script.cpp @@ -86,7 +86,7 @@ Script::Script(SagaEngine *vm) : _vm(vm) { } uint32 scriptResourceId = 0; - + if (!_vm->isSaga2()) { scriptResourceId = _vm->getResourceDescription()->moduleLUTResourceId; debug(3, "Loading module LUT from resource %i", scriptResourceId); diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index 01fe8c6c69..26933a36ea 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -279,7 +279,7 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) { // Normally, when objects are picked up, they should always have the same // _spriteListResourceId as their _index value. Some don't in IHNM, so // we fix their sprite here - // Fixes bugs #2057200 - "IHNM: Invisible inventory objects", + // Fixes bugs #2057200 - "IHNM: Invisible inventory objects", // #1861126 - "IHNM: Crash when Gorrister cuts sheet in the mooring ring" // and some incorrect objects in the IHNM demo if (_vm->getGameId() == GID_IHNM) diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 4a32e4f929..38dacf0667 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -193,7 +193,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { char soundFileName[40]; int dirIndex = resourceId / 64; - + if ((context->fileType & GAME_VOICEFILE) != 0) { if (_voiceSerial == 0) { sprintf(soundFileName, "Voices/VoicesS/Voices%d/VoicesS%03x", dirIndex, resourceId); @@ -203,7 +203,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff } else { sprintf(soundFileName, "SFX/SFX%d/SFX%03x", dirIndex, resourceId); } - + file = new Common::File(); file->open(soundFileName); @@ -212,7 +212,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff ResourceData* resourceData = context->getResourceData(resourceId); file = context->getFile(resourceData); - + file->seek(resourceData->offset); soundResourceLength = resourceData->size; diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index e693e16629..50d4a2a766 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -63,7 +63,7 @@ SndHandle *Sound::getHandle() { return NULL; } -void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, +void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, sndHandleType handleType, bool loop) { byte flags; @@ -85,10 +85,10 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) { if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { Audio::AudioStream *stream = NULL; @@ -127,20 +127,20 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int default: // No compression, play it as raw sound if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); break; } if (stream != NULL) { if (handleType == kVoiceHandle) - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, volume, 0, true, false); else - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, volume, 0, true, false); } } diff --git a/engines/saga/sound.h b/engines/saga/sound.h index 6d9e42a49d..cf6ca4a1a0 100644 --- a/engines/saga/sound.h +++ b/engines/saga/sound.h @@ -90,7 +90,7 @@ public: private: - void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, + void playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, sndHandleType handleType, bool loop); SndHandle *getHandle(); diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index fc82490223..c246a8fafb 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -404,7 +404,7 @@ void Sprite::drawOccluded(SpriteList &spriteList, int spriteNumber, const Point sourceRowPointer += width; } - _vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y, + _vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y, clipData.drawSource.x + width, clipData.drawSource.y + height)); } diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 1ea0da86d8..fdb066a4a3 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -1440,7 +1440,7 @@ void Actor::drawActorCostume(bool hitTestMode) { } setupActorScale(); - + BaseCostumeRenderer *bcr = _vm->_costumeRenderer; prepareDrawActorCostume(bcr); @@ -1456,7 +1456,7 @@ void Actor::drawActorCostume(bool hitTestMode) { } } - + void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { bcr->_actorID = _number; @@ -1507,7 +1507,7 @@ void Actor::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { void ActorHE::prepareDrawActorCostume(BaseCostumeRenderer *bcr) { Actor::prepareDrawActorCostume(bcr); - + bcr->_actorX += _heOffsX; bcr->_actorY += _heOffsY; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 326ee6d4c2..d9db5fc574 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -683,11 +683,11 @@ public: virtual const char *getName() const; virtual const char *getCopyright() const; - virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; virtual GameList detectGames(const Common::FSList &fslist) const; - + virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; virtual SaveStateList listSaves(const char *target) const; @@ -984,7 +984,7 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 2 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 2); - + if (slotNum >= 0 && slotNum <= 99) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -1016,7 +1016,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int // TODO: Cleanup Graphics::Surface *thumbnail = ScummEngine::loadThumbnailFromSlot(target, slot); - + SaveStateDescriptor desc(slot, saveDesc); desc.setDeletableFlag(true); desc.setThumbnail(thumbnail); @@ -1029,7 +1029,7 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int int year = infos.date & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (infos.time >> 8) & 0xFF; int minutes = infos.time & 0xFF; diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 6738e8d71a..cdbc2e3661 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -228,7 +228,7 @@ enum { SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, bool saveMode, ScummEngine *engine) : Dialog("ScummSaveLoad"), _saveMode(saveMode), _list(0), _chooseButton(0), _gfxWidget(0), _vm(engine) { - + _backgroundType = GUI::ThemeEngine::kDialogBackgroundSpecial; new StaticTextWidget(this, "ScummSaveLoad.Title", title); @@ -318,17 +318,17 @@ void SaveLoadChooser::reflowLayout() { if (g_gui.xmlEval()->getVar("Globals.ScummSaveLoad.ExtInfo.Visible") == 1) { int16 x, y; uint16 w, h; - + if (!g_gui.xmlEval()->getWidgetData("ScummSaveLoad.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails."); - - int thumbW = kThumbnailWidth; + + int thumbW = kThumbnailWidth; int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1); int thumbX = x + (w >> 1) - (thumbW >> 1); int thumbY = y + kLineHeight; - + _container->resize(x, y, w, h); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); int height = thumbY + thumbH + kLineHeight; @@ -380,7 +380,7 @@ void SaveLoadChooser::updateInfos(bool redraw) { InfoStuff infos; memset(&infos, 0, sizeof(InfoStuff)); - if (selItem >= 0 && !_list->getSelectedString().empty() + if (selItem >= 0 && !_list->getSelectedString().empty() && _vm->loadInfosFromSlot(_saveMode ? selItem + 1 : selItem, &infos)) { char buffer[32]; snprintf(buffer, 32, "Date: %.2d.%.2d.%.4d", @@ -654,13 +654,13 @@ void HelpDialog::reflowLayout() { int lineHeight = g_gui.getFontHeight(); int16 x, y; uint16 w, h; - + g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h); - + int keyW = w * 20 / 100; int dscX = x + keyW + 32; int dscW = w * 80 / 100; - + int xoff = (_w >> 1) - (w >> 1); for (int i = 0; i < HELP_NUM_LINES; i++) { diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 4e8c22479d..04cde129fa 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -614,13 +614,13 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i const uint32 *src32 = (const uint32 *)src; const uint32 *text32 = (const uint32 *)text; uint32 *dst32 = (uint32 *)_compositeBuf; - + vsPitch >>= 2; const int textPitch = (_textSurface.pitch - width * m) >> 2; for (int h = height * m; h > 0; --h) { for (int w = width*m; w > 0; w-=4) { uint32 temp = *text32++; - + // Generate a byte mask for those text pixels (bytes) with // value CHARSET_MASK_TRANSPARENCY. In the end, each byte // in mask will be either equal to 0x00 or 0xFF. @@ -629,7 +629,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i uint32 mask = temp ^ CHARSET_MASK_TRANSPARENCY_32; mask = (((mask & 0x7f7f7f7f) + 0x7f7f7f7f) | mask) & 0x80808080; mask = ((mask >> 7) + 0x7f7f7f7f) ^ 0x80808080; - + // The following line is equivalent to this code: // *dst32++ = (*src32++ & mask) | (temp & ~mask); // However, some compilers can generate somewhat better diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 74789bcc1e..49d0e2f729 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -526,7 +526,7 @@ int Win32ResExtractor::do_resources_recurs(WinLibrary *fi, WinResource *base, else return 0; } - + /* process each resource listed */ for (c = 0 ; c < rescnt ; c++) { /* (over)write the corresponding WinResource holder with the current */ diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index aa78757c53..55dc62c38d 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -475,7 +475,7 @@ void ScummEngine_v80he::o80_readConfigFile() { memcpy(section, "BluesTreasureHunt-Disc1\0", 24); else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2")) memcpy(section, "BluesTreasureHunt-Disc2\0", 24); - } + } Common::ConfigFile ConfFile; if (!strcmp((char *)filename + r, "map.ini")) @@ -543,7 +543,7 @@ void ScummEngine_v80he::o80_writeConfigFile() { memcpy(section, "BluesTreasureHunt-Disc1\0", 24); else if (!strcmp((char *)section, "Blue'sTreasureHunt-Disc2")) memcpy(section, "BluesTreasureHunt-Disc2\0", 24); - } + } Common::ConfigFile ConfFile; ConfFile.loadFromSaveFile((const char *)filename + r); diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index c661812d09..55fc6cc900 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -933,7 +933,7 @@ uint8 Wiz::getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint return (READ_LE_UINT16(data) & 1) ? color : READ_LE_UINT16(data + 1); else return (data[0] & 1) ? color : data[1]; - + } uint8 Wiz::getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint bitDepth, uint8 color) { diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp index 757b4a453f..719328d23f 100644 --- a/engines/scumm/player_v2a.cpp +++ b/engines/scumm/player_v2a.cpp @@ -1474,7 +1474,7 @@ private: uint16 _curfreq; }; -// plays a series of double-looped sounds at varying frequencies and delays, very specialized +// plays a series of double-looped sounds at varying frequencies and delays, very specialized // Guardian of the Sphinx, perhaps? class V2A_Sound_Special_Zak82 : public V2A_Sound_Base<4> { public: @@ -1616,7 +1616,7 @@ public: } _mod->stopChannel(_id | 0x000); _mode = 1; - + size = 0x2B8E; offset = _offset; assert(offset + size <= _offset + _size); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 76ebab0f7c..e040cb1593 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -626,7 +626,7 @@ protected: void loadResource(Serializer *ser, int type, int index); Common::String makeSavegameName(int slot, bool temporary) const { - return makeSavegameName(_targetName, slot, temporary); + return makeSavegameName(_targetName, slot, temporary); } int getKeyState(int key); diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index 4bf2581365..62bc0bb098 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -566,7 +566,7 @@ Codec47Decoder::~Codec47Decoder() { bool Codec47Decoder::decode(byte *dst, const byte *src) { if ((_tableBig == NULL) || (_tableSmall == NULL) || (_deltaBuf == NULL)) return false; - + _offset1 = _deltaBufs[1] - _curBuf; _offset2 = _deltaBufs[0] - _curBuf; diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index fd34a8f60d..cab836fcc8 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -139,7 +139,7 @@ bool ImuseChannel::handleMap(byte *data) { default: error("Unknown iMUS subChunk found : %s, %d", tag2str(subType), subSize); } - + data += subSize; size -= subSize; } diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp index 69b17a8093..e6cc131f47 100644 --- a/engines/sky/detection.cpp +++ b/engines/sky/detection.cpp @@ -69,7 +69,7 @@ public: virtual bool hasFeature(MetaEngineFeature f) const; virtual GameList getSupportedGames() const; virtual GameDescriptor findGame(const char *gameid) const; - virtual GameList detectGames(const Common::FSList &fslist) const; + virtual GameList detectGames(const Common::FSList &fslist) const; virtual Common::Error createInstance(OSystem *syst, Engine **engine) const; @@ -303,11 +303,11 @@ Common::Error SkyEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; } -bool SkyEngine::canLoadGameStateCurrently() { +bool SkyEngine::canLoadGameStateCurrently() { return _systemVars.pastIntro && _skyControl->loadSaveAllowed(); } -bool SkyEngine::canSaveGameStateCurrently() { +bool SkyEngine::canSaveGameStateCurrently() { return _systemVars.pastIntro && _skyControl->loadSaveAllowed(); } diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index f4a4307501..eb61ffe4b3 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -729,7 +729,7 @@ void Control::readSavegameDescriptions(void) { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 3); - + while (num < slotNum) { _saveNames.push_back(""); num++; @@ -818,7 +818,7 @@ void Control::checkForOldSaveGames() { slot++; } while ((ch != 255) && (!inf->eos())); - delete inf; + delete inf; // Delete index file _saveFileMan->removeSavefile("SAVEGAME.INF"); @@ -1050,7 +1050,7 @@ bool Control::restoreGameFromFile(uint8 slot) { if (saveHeader != SAVEGAME_HEADER) { // Display an error message, and do nothing displayMessage(0, "Save game '%s' is corrupt", fName); - return false; + return false; } inf->skip(40); // skip description @@ -1060,7 +1060,7 @@ bool Control::restoreGameFromFile(uint8 slot) { warning("Different save game version"); return false; } - + bool hasThumbnail = inf->readByte(); if (hasThumbnail) { @@ -1156,7 +1156,7 @@ bool Control::convertSaveGame(uint8 slot, char* desc) { free(saveData); saveData = NULL; return false; - } + } newSave->writeUint32LE(SAVEGAME_HEADER); newSave->write(desc, 40); diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 657364cc11..b478199f86 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -203,7 +203,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { @@ -264,7 +264,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int int year = saveDate & 0xFFFF; desc.setSaveDate(year, month, day); - + int hour = (saveTime >> 8) & 0xFF; int minutes = saveTime & 0xFF; @@ -276,7 +276,7 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int return desc; } - + return SaveStateDescriptor(); } @@ -305,11 +305,11 @@ Common::Error SwordEngine::saveGameState(int slot, const char *desc) { return Common::kNoError; // TODO: return success/failure } -bool SwordEngine::canLoadGameStateCurrently() { +bool SwordEngine::canLoadGameStateCurrently() { return mouseIsActive(); } -bool SwordEngine::canSaveGameStateCurrently() { +bool SwordEngine::canSaveGameStateCurrently() { return mouseIsActive(); } #endif diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 39c04da592..398eaada3e 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -187,7 +187,7 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const { for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(file->c_str() + file->size() - 3); - + if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); if (in) { diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp index c2402285b8..6020fa7d24 100644 --- a/engines/tinsel/actors.cpp +++ b/engines/tinsel/actors.cpp @@ -285,7 +285,7 @@ static void ActorTinselProcess(CORO_PARAM, const void *param) { // Run the Glitter code assert(actorInfo[atp->id - 1].actorCode); // no code to run - _ctx->pic = InitInterpretContext(GS_ACTOR, actorInfo[atp->id - 1].actorCode, + _ctx->pic = InitInterpretContext(GS_ACTOR, actorInfo[atp->id - 1].actorCode, atp->event, NOPOLY, atp->id, NULL); CORO_INVOKE_1(Interpret, _ctx->pic); @@ -374,7 +374,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca ano, // Actor NULL, // No object myEscape); - + if (atp.pic != NULL) { _ctx->pProc = g_scheduler->createProcess(PID_TCODE, ActorTinselProcess, &atp, sizeof(atp)); AttachInterpret(atp.pic, _ctx->pProc); @@ -386,7 +386,7 @@ void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEsca CORO_END_CODE; } - + /** * Called at the start of each scene for each actor with a code block. * @param as Actor structure @@ -1525,7 +1525,7 @@ bool ActorTagIsWanted(int actor) { } /** - * Given cursor position and an actor number, ascertains + * Given cursor position and an actor number, ascertains * whether the cursor is within the actor's tag area. * Returns True for a positive result, False for negative. */ @@ -1664,7 +1664,7 @@ int GetActorFilmNumber(int ano) { void StoreActorReel(int actor, int column, OBJECT *pObj) { RANGE_CHECK(actor); int i; - + for (i = 0; i < MAX_REELS; i++) { if (actorInfo[actor-1].presColumns[i] == -1) { // Store reel and object diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp index 055e0bba94..b52d01860b 100644 --- a/engines/tinsel/anim.cpp +++ b/engines/tinsel/anim.cpp @@ -44,8 +44,8 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) { const ANI_SCRIPT *pAni = (const ANI_SCRIPT *)LockMem(pAnim->hScript); while (1) { // repeat until a real image - debugC(DEBUG_DETAILED, kTinselDebugAnimations, - "DoNextFrame %ph index=%d, op=%xh", (byte *)pAnim, pAnim->scriptIndex, + debugC(DEBUG_DETAILED, kTinselDebugAnimations, + "DoNextFrame %ph index=%d, op=%xh", (byte *)pAnim, pAnim->scriptIndex, FROM_LE_32(pAni[pAnim->scriptIndex].op)); switch ((int32)FROM_LE_32(pAni[pAnim->scriptIndex].op)) { @@ -212,7 +212,7 @@ SCRIPTSTATE DoNextFrame(ANIM *pAnim) { void InitStepAnimScript(ANIM *pAnim, OBJECT *pAniObj, SCNHANDLE hNewScript, int aniSpeed) { OBJECT *pObj; // multi-object list iterator - debugC(DEBUG_DETAILED, kTinselDebugAnimations, + debugC(DEBUG_DETAILED, kTinselDebugAnimations, "InitStepAnimScript Object=(%d,%d,%xh) script=%xh aniSpeed=%d rec=%ph", !pAniObj ? 0 : fracToInt(pAniObj->xPos), !pAniObj ? 0 : fracToInt(pAniObj->yPos), diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp index a5b4170673..0f83760987 100644 --- a/engines/tinsel/bg.cpp +++ b/engines/tinsel/bg.cpp @@ -211,7 +211,7 @@ static void BGotherProcess(CORO_PARAM, const void *param) { while (StepAnimScript(&_ctx->anim) != ScriptFinished) CORO_SLEEP(1); - + CORO_END_CODE; } diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp index feac5d2c76..ef23ce06be 100644 --- a/engines/tinsel/bmv.cpp +++ b/engines/tinsel/bmv.cpp @@ -285,7 +285,7 @@ static void PrepBMV(const byte *sourceData, int length, short deltaFetchDisp) { // Shift another 2 bits to get hi nibble eax = (eax & 0xffffff00) | ((eax & 0xff) >> 2); NEXT_BYTE(esi); - + if ((eax & 0xC) != 0) { flag = true; ROL(eax, ecx); @@ -679,10 +679,10 @@ static int FollowingPacket(int thisPacket, bool bReallyImportant) { // Following 3 bytes are the length if (bReallyImportant) { // wrapped round or at least 3 bytes - assert(((nextReadSlot * SLOT_SIZE) < thisPacket) || + assert(((nextReadSlot * SLOT_SIZE) < thisPacket) || ((thisPacket + 3) < (nextReadSlot * SLOT_SIZE))); - if ((nextReadSlot * SLOT_SIZE >= thisPacket) && + if ((nextReadSlot * SLOT_SIZE >= thisPacket) && ((thisPacket + 3) >= nextReadSlot*SLOT_SIZE)) { // MaintainBuffer calls this back, but with false MaintainBuffer(); @@ -1005,7 +1005,7 @@ static bool DoBMVFrame(void) { xscr = -640; else xscr = 0; - + PrepBMV(bigBuffer + graphOffset, length, xscr); currentFrame++; @@ -1112,7 +1112,7 @@ void CopyMovieToScreen(void) { int yStart = (SCREEN_HEIGHT - SCREEN_HIGH) / 2; memset(_vm->screen().getBasePtr(0, 0), 0, yStart * SCREEN_WIDTH); memcpy(_vm->screen().getBasePtr(0, yStart), ScreenBeg, SCREEN_WIDTH * SCREEN_HIGH); - memset(_vm->screen().getBasePtr(0, yStart + SCREEN_HIGH), 0, + memset(_vm->screen().getBasePtr(0, yStart + SCREEN_HIGH), 0, (SCREEN_HEIGHT - SCREEN_HIGH - yStart) * SCREEN_WIDTH); BmvDrawText(true); diff --git a/engines/tinsel/cliprect.cpp b/engines/tinsel/cliprect.cpp index b67ae7b17f..bd84cc0049 100644 --- a/engines/tinsel/cliprect.cpp +++ b/engines/tinsel/cliprect.cpp @@ -128,7 +128,7 @@ void FindMovingObjects(OBJECT *pObjList, Common::Point *pWin, Common::Rect *pCli if ((pObj->flags & DMA_CHANGED) || // object changed HasPalMoved(pObj->pPal)) { // or palette moved // object has changed in some way - + Common::Rect rcClip; // objects clipped bounding rectangle Common::Rect rcObj; // objects bounding rectangle @@ -152,7 +152,7 @@ void FindMovingObjects(OBJECT *pObjList, Common::Point *pWin, Common::Rect *pCli rcObj.right = rcObj.left + pObj->width; rcObj.bottom = rcObj.top + pObj->height; - // calc intersection of object with clipping rect + // calc intersection of object with clipping rect if (IntersectRectangle(rcClip, rcObj, *pClip)) { // current position is within clipping rect AddClipRect(rcClip); diff --git a/engines/tinsel/config.cpp b/engines/tinsel/config.cpp index bec286a96b..4695a2e435 100644 --- a/engines/tinsel/config.cpp +++ b/engines/tinsel/config.cpp @@ -83,10 +83,10 @@ void WriteConfig(void) { default: lang = Common::EN_ANY; } - + ConfMan.set("language", Common::getLanguageCode(lang)); } - + // Write to disk ConfMan.flushToDisk(); } diff --git a/engines/tinsel/coroutine.h b/engines/tinsel/coroutine.h index 8cdbd44b19..30d90970b6 100644 --- a/engines/tinsel/coroutine.h +++ b/engines/tinsel/coroutine.h @@ -35,7 +35,7 @@ namespace Tinsel { * <http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html>. * However, many improvements and tweaks have been made, in particular * by taking advantage of C++ features not available in C. - * + * * Why is this code here? Well, the Tinsel engine apparently used * setjmp/longjmp based coroutines as a core tool from the start, and * so they are deeply ingrained into the whole code base. When we @@ -45,7 +45,7 @@ namespace Tinsel { * would have meant a major restructuring of the entire code base, a * rather daunting task. Also, it would have very likely introduced * tons of regressons. - * + * * So instead of getting rid of the coroutines, we chose to implement * them in an alternate way, using Simon Tatham's trick as described * above. While the trick is dirty, the result seems to be clear enough, diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp index 3fc3b974e9..c58a15849d 100644 --- a/engines/tinsel/cursor.cpp +++ b/engines/tinsel/cursor.cpp @@ -172,7 +172,7 @@ void SetCursorXY(int newx, int newy) { int Loffset, Toffset; // Screen offset PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); - newx -= Loffset; + newx -= Loffset; newy -= Toffset; if (GetDriverPosition(&x, &y)) @@ -210,7 +210,7 @@ bool GetCursorXYNoWait(int *x, int *y, bool absolute) { *x += Loffset; *y += Toffset; } - + return true; } @@ -443,7 +443,7 @@ static void DoCursorMove(void) { // get new mouse driver position - could have been modified ptMouse = _vm->getMousePosition(); - + if (lastCursorX != ptMouse.x || lastCursorY != ptMouse.y) { resetUserEventTime(); diff --git a/engines/tinsel/debugger.cpp b/engines/tinsel/debugger.cpp index 904763e228..b3cb2d1b92 100644 --- a/engines/tinsel/debugger.cpp +++ b/engines/tinsel/debugger.cpp @@ -46,7 +46,7 @@ extern SCNHANDLE GetSceneHandle(void); //----------------- SUPPORT FUNCTIONS --------------------- -//static +//static int strToInt(const char *s) { if (!*s) // No string at all diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 4cae5885b5..32d4562ad9 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -52,8 +52,8 @@ uint32 TinselEngine::getFeatures() const { return _gameDescription->features; } -Common::Language TinselEngine::getLanguage() const { - return _gameDescription->desc.language; +Common::Language TinselEngine::getLanguage() const { + return _gameDescription->desc.language; } Common::Platform TinselEngine::getPlatform() const { @@ -454,14 +454,14 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; - virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool hasFeature(MetaEngineFeature f) const; virtual SaveStateList listSaves(const char *target) const; virtual int getMaximumSaveSlot() const; virtual void removeSaveState(const char *target, int slot) const; }; bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const { - return + return (f == kSupportsListSaves) || // TODO: See tinsel.cpp ll 994-1005 #if 0 @@ -561,7 +561,7 @@ Common::Error TinselEngine::loadGameState(int slot) { // slot numbers instead of savelist entry numbers for loading. // This would also allow '-2' as slot for CD changes without // any major hackery. - + int listSlot = -1; const int numStates = Tinsel::getList(); for (int i = 0; i < numStates; ++i) { diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp index b807abce57..c5d7449d3b 100644 --- a/engines/tinsel/dialogs.cpp +++ b/engines/tinsel/dialogs.cpp @@ -351,9 +351,9 @@ struct INV_DEF { int FirstDisp; // Index to first item currently displayed int inventoryX; // } Display position - int inventoryY; // } + int inventoryY; // } int otherX; // } Display position - int otherY; // } + int otherY; // } int MaxInvObj; // Max. allowed contents @@ -417,7 +417,7 @@ static OBJECT *RectObject = 0, *SlideObject = 0; // Current display objects, for // objects are in objArray. static int sliderYpos = 0; // For positioning the slider -static int sliderYmax = 0, sliderYmin = 0; // +static int sliderYmax = 0, sliderYmin = 0; // #define sliderRange (sliderYmax - sliderYmin) @@ -541,14 +541,14 @@ enum BFUNC { OPENQUIT, INITGAME, MUSICVOL, - + HOPPER2, // Call up Scene Hopper 2 BF_CHANGESCENE, CLANG, RLANG #ifdef MAC_OPTIONS - , MASTERVOL, SAMPVOL + , MASTERVOL, SAMPVOL #endif }; @@ -1418,7 +1418,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) { */ void InvTinselEvent(INV_OBJECT *pinvo, TINSEL_EVENT event, PLR_EVENT be, int index) { OP_INIT to = { pinvo, event, be, 0 }; - + if (InventoryHidden || (TinselV2 && !pinvo->hScript)) return; @@ -1523,7 +1523,7 @@ void InvLoadGame(void) { if (iconArray[HL1] != NULL) { MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); iconArray[HL1] = NULL; - } + } RestoreGame(rGame+cd.extraBase); } } @@ -1643,7 +1643,7 @@ void Select(int i, bool force) { // New highlight box switch (cd.box[i].boxType) { case RGROUP: - iconArray[HL2] = RectangleObject(BgPal(), + iconArray[HL2] = RectangleObject(BgPal(), (TinselV2 ? HighlightColour() : COL_HILIGHT), cd.box[i].w, cd.box[i].h); MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]); MultiSetAniXY(iconArray[HL2], @@ -1745,8 +1745,8 @@ void AddToInventory(int invno, int icon, bool hold) { INV_OBJECT *invObj; // Validate trying to add to a legal inventory - assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV - || invno == INV_OPEN || (invno == INV_DEFAULT && TinselV2)); + assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV + || invno == INV_OPEN || (invno == INV_DEFAULT && TinselV2)); if (invno == INV_OPEN) { assert(InventoryState == ACTIVE_INV && (ino == INV_1 || ino == INV_2)); // addopeninv() with inventry not open @@ -2219,11 +2219,11 @@ static int WhichMenuBox(int curX, int curY, bool bSlides) { // Slider on extra window if (cd.bExtraWin) { const Common::Rect &r = TinselV2 ? - Common::Rect(411, 46, 425, 339) : + Common::Rect(411, 46, 425, 339) : Common::Rect(20 + 181, 24 + 2, 20 + 181 + 8, 24 + 139 + 5); if (r.contains(curX, curY)) { - + if (curY < (r.top + (TinselV2 ? 18 : 5))) return IB_UP; else if (curY > (r.bottom - (TinselV2 ? 18 : 5))) @@ -2269,7 +2269,7 @@ void InvBoxes(bool InBody, int curX, int curY) { if (iconArray[HL1] != NULL) { MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); iconArray[HL1] = NULL; - } + } } else if (index != cd.pointBox) { cd.pointBox = index; // A new box is pointed to - high-light it @@ -2281,7 +2281,7 @@ void InvBoxes(bool InBody, int curX, int curY) { ///* I don't agree */ cd.box[cd.pointBox].boxType == RGROUP || cd.box[cd.pointBox].boxType == AATBUT || cd.box[cd.pointBox].boxType == AABUT) { - iconArray[HL1] = RectangleObject(BgPal(), + iconArray[HL1] = RectangleObject(BgPal(), (TinselV2 ? HighlightColour() : COL_HILIGHT), cd.box[cd.pointBox].w, cd.box[cd.pointBox].h); MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]); @@ -2633,7 +2633,7 @@ static void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV, // add it to display list and position it MultiInsertObject(GetPlayfieldList(FIELD_STATUS), *rect); - MultiSetAniXY(*rect, InvD[ino].inventoryX + NM_BG_POS_X, + MultiSetAniXY(*rect, InvD[ino].inventoryX + NM_BG_POS_X, InvD[ino].inventoryY + NM_BG_POS_Y); MultiSetZPosition(*rect, Z_INV_BRECT); @@ -2752,7 +2752,7 @@ void AddBox(int *pi, int i) { *pi += 1; // Stick in the text - if ((cd.box[i].textMethod == TM_POINTER) || + if ((cd.box[i].textMethod == TM_POINTER) || (!TinselV2 && (cd.box[i].ixText == USE_POINTER))) { if (cd.box[i].boxText != NULL) { if (cd.box[i].boxType == RGROUP) { @@ -2849,7 +2849,7 @@ void AddBox(int *pi, int i) { assert(cd.box[i].ixText != USE_POINTER); LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ); } - iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), + iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0, x + MDTEXT_XOFF, y + MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT); MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT); *pi += 1; @@ -2915,7 +2915,7 @@ void AddBox(int *pi, int i) { assert(cd.box[i].ixText != USE_POINTER); LoadStringRes(configStrings[cd.box[i].ixText], TextBufferAddr(), TBUFSZ); } - iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), + iconArray[*pi] = ObjectTextOut(nullContext, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0, x+MDTEXT_XOFF, y+MDTEXT_YOFF, GetTagFontHandle(), TXT_RIGHT); MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT); *pi += 1; @@ -3060,7 +3060,7 @@ int AddExtraWindow(int x, int y, OBJECT **retObj) { MultiSetZPosition(retObj[n], Z_INV_MFRAME); n++; retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Bottom - MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y + + MultiSetAniXY(retObj[n], x + (TinselV2 ? TLwidth : 6), y + (TinselV2 ? TLheight + 208 + BLheight + NM_BSY : 143)); MultiSetZPosition(retObj[n], Z_INV_MFRAME); n++; @@ -3241,7 +3241,7 @@ void ConstructInventory(InventoryType filling) { // Bottom side extra retObj[n] = AddObject(&pfilm->reels[IX_H26], -1); MultiSetAniXY(retObj[n], invX + offx, invY + TLheight + eV + BLheight + NM_BSY); - + MultiSetZPosition(retObj[n], zpos); n++; } @@ -3387,7 +3387,7 @@ bool RePosition(void) { InvD[ino].inventoryY += MAXTOP - p; bMoveitMoveit = true; // I like to.... } - + return bMoveitMoveit; } @@ -3731,7 +3731,7 @@ void HideConversation(bool bHide) { case CONV_DEF: InvD[INV_CONV].inventoryY = y - SysVar(SV_CONV_ABOVE_Y); break; - + default: break; } @@ -3764,7 +3764,7 @@ void HideConversation(bool bHide) { int Loffset, Toffset; PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); - y = GetActorBottom(thisConvActor) - MultiHighest(RectObject) + + y = GetActorBottom(thisConvActor) - MultiHighest(RectObject) + SysVar(SV_CONV_BELOW_Y); y -= Toffset; } @@ -3816,7 +3816,7 @@ bool ConvIsHidden(void) { * Start up an inventory window. */ void PopUpInventory(int invno) { - assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV + assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV || invno == INV_CONF || invno == INV_MENU); // Trying to open illegal inventory if (InventoryState == IDLE_INV) { @@ -4220,7 +4220,7 @@ void InventoryProcess(CORO_PARAM, const void *) { } } else CORO_INVOKE_1(ButtonToggle, g_buttonEffect.box); - + g_buttonEffect.bButAnim = false; } @@ -5098,7 +5098,7 @@ void InvPickup(int index) { return; // If not holding anything - if (HeldItem == INV_NOICON && InvD[ino].contents[index] && + if (HeldItem == INV_NOICON && InvD[ino].contents[index] && (!TinselV2 || InvD[ino].contents[index] != HeldItem)) { // Pick-up invObj = GetInvObject(InvD[ino].contents[index]); @@ -5186,7 +5186,7 @@ static void InvWalkTo(const Common::Point &coOrds) { // To cater for drop in dead space between icons, // look 1 pixel right, then 1 down, then 1 right and down. - if (i == INV_NOICON && HeldItem != INV_NOICON && + if (i == INV_NOICON && HeldItem != INV_NOICON && (ino == INV_1 || ino == INV_2)) { pt.x += 1; // 1 to the right i = InvItem(pt, false); @@ -5203,7 +5203,7 @@ static void InvWalkTo(const Common::Point &coOrds) { if (ino == INV_CONV) { ConvAction(i); - } else + } else InvPickup(i); } break; diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h index faf95c7d1c..670f695a06 100644 --- a/engines/tinsel/dialogs.h +++ b/engines/tinsel/dialogs.h @@ -69,7 +69,7 @@ struct INV_OBJECT { void PopUpInventory(int invno); enum CONFTYPE { - MAIN_MENU, SAVE_MENU, LOAD_MENU, QUIT_MENU, RESTART_MENU, SOUND_MENU, + MAIN_MENU, SAVE_MENU, LOAD_MENU, QUIT_MENU, RESTART_MENU, SOUND_MENU, CONTROLS_MENU, SUBTITLES_MENU, HOPPER_MENU1, HOPPER_MENU2, TOP_WINDOW }; diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp index 91f75fe71e..ea5dbf0655 100644 --- a/engines/tinsel/events.cpp +++ b/engines/tinsel/events.cpp @@ -310,7 +310,7 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P GetCursorXY(&aniX, &aniY, true); // There could be a poly involved which has no tag. - if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY || + if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY || (!TinselV2 && ((hPoly = InPolygon(aniX, aniY, EXIT)) != NOPOLY))) { if (TinselV2 && (uEvent != PROV_WALKTO)) PolygonEvent(nullContext, hPoly, uEvent, 0, false, 0); @@ -391,7 +391,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) { "PLR_MENU", "PLR_QUIT", "PLR_PGUP", "PLR_PGDN", "PLR_HOME", "PLR_END", "PLR_DRAG1_START", "PLR_DRAG1_END", "PLR_DRAG2_START", "PLR_DRAG2_END", "PLR_JUMP", "PLR_NOEVENT"}; - debugC(DEBUG_BASIC, kTinselDebugActions, "%s - (%d,%d)", + debugC(DEBUG_BASIC, kTinselDebugActions, "%s - (%d,%d)", actionList[pEvent], coOrds.x, coOrds.y); static uint32 lastRealAction = 0; @@ -602,7 +602,7 @@ void PolyTinselProcess(CORO_PARAM, const void *param) { /** * Run the Polygon process with the given event */ -void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait, +void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bool bWait, int myEscape, bool *result) { CORO_BEGIN_CONTEXT; PTP_INIT to; diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp index 210bff0d5f..4209d1fe33 100644 --- a/engines/tinsel/graphics.cpp +++ b/engines/tinsel/graphics.cpp @@ -63,7 +63,7 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply int leftClip = applyClipping ? pObj->leftClip : 0; int rightClip = applyClipping ? pObj->rightClip : 0; - + // Horizontal loop for (int x = 0; x < pObj->width; ) { uint32 numBytes = READ_UINT32(srcP); @@ -91,7 +91,7 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply } else { // Copy a specified sequence length of pixels srcP += clipAmount; - + int runLength = numBytes - clipAmount; int rptLength = MAX(MIN(runLength, pObj->width - rightClip - x), 0); if (yClip == 0) { @@ -209,7 +209,7 @@ static void WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyCl tempDest += boxBounds.right - boxBounds.left + 1; width -= 3 - boxBounds.left + 1; - + // None of the remaining horizontal blocks should be left clipped boxBounds.left = 0; } @@ -340,7 +340,7 @@ static void WrtTrans(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) { return; } - // Set up the offset between destination lines + // Set up the offset between destination lines int lineOffset = SCREEN_WIDTH - pObj->width; // Loop through any remaining lines @@ -350,7 +350,7 @@ static void WrtTrans(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) { --pObj->height; destP += lineOffset; - } + } } /** @@ -494,7 +494,7 @@ void ClearScreen() { void *pDest = _vm->screen().getBasePtr(0, 0); memset(pDest, 0, SCREEN_WIDTH * SCREEN_HEIGHT); g_system->clearScreen(); - g_system->updateScreen(); + g_system->updateScreen(); } /** @@ -505,7 +505,7 @@ void UpdateScreenRect(const Common::Rect &pClip) { byte *pSrc = (byte *)_vm->screen().getBasePtr(pClip.left, pClip.top); g_system->copyRectToScreen(pSrc, _vm->screen().pitch, pClip.left, pClip.top + yOffset, pClip.width(), pClip.height()); - g_system->updateScreen(); + g_system->updateScreen(); } /** @@ -515,7 +515,7 @@ void DrawObject(DRAWOBJECT *pObj) { uint8 *srcPtr = NULL; uint8 *destPtr; - if ((pObj->width <= 0) || (pObj->height <= 0)) + if ((pObj->width <= 0) || (pObj->height <= 0)) // Empty image, so return immediately return; @@ -527,7 +527,7 @@ void DrawObject(DRAWOBJECT *pObj) { pObj->transOffset = 0; } else { byte *p = (byte *)LockMem(pObj->hBits & HANDLEMASK); - + srcPtr = p + (pObj->hBits & OFFSETMASK); pObj->charBase = (char *)p + READ_LE_UINT32(p + 0x10); pObj->transOffset = READ_LE_UINT32(p + 0x14); @@ -536,7 +536,7 @@ void DrawObject(DRAWOBJECT *pObj) { // Get destination starting point destPtr = (byte *)_vm->screen().getBasePtr(pObj->xPos, pObj->yPos); - + // Handle various draw types uint8 typeId = pObj->flags & 0xff; diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp index 41774a9c88..b463244123 100644 --- a/engines/tinsel/handle.cpp +++ b/engines/tinsel/handle.cpp @@ -411,7 +411,7 @@ uint8 *LockMem(SCNHANDLE offset) { if (pH->pNode->pBaseAddr && (pH->filesize & fLoaded)) // already allocated and loaded return pH->pNode->pBaseAddr + (offset & OFFSETMASK); - + if (pH->pNode->pBaseAddr == NULL) // must have been discarded - reallocate the memory MemoryReAlloc(pH->pNode, pH->filesize & FSIZE_MASK, diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp index 704f3c8104..e77f505edb 100644 --- a/engines/tinsel/heapmem.cpp +++ b/engines/tinsel/heapmem.cpp @@ -259,7 +259,7 @@ bool HeapCompact(long size, bool bDiscard) { } } } - + if (pOldest) // discard the oldest block MemoryDiscard(pOldest); diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp index 20e4175e01..4422a7cf4a 100644 --- a/engines/tinsel/move.cpp +++ b/engines/tinsel/move.cpp @@ -1195,7 +1195,7 @@ static void NewCoOrdinates(int fromx, int fromy, int *targetX, int *targetY, // Ignore if already in it (it may have just appeared) if (!InMoverBlock(pMover, pMover->objX, pMover->objY)) { *s2 = ENTERING_MBLOCK; // Trying to walk through an actor - + *hS2p = -1; if (collisionActor) *collisionActor = ma; @@ -1359,7 +1359,7 @@ int SetActorDest(PMOVER pMover, int clickX, int clickY, bool igPath, SCNHANDLE h } } else { int wodResult = WorkOutDestination(clickX, clickY, &targetX, &targetY); - + if (pMover->actorID == GetLeadId()) { lastLeadXdest = targetX; lastLeadYdest = targetY; diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp index 979fc61270..4e5b890335 100644 --- a/engines/tinsel/music.cpp +++ b/engines/tinsel/music.cpp @@ -124,7 +124,7 @@ const int enhancedAudioSCNVersion[] = { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 52, 4, - 0, 0, 0, 0 + 0, 0, 0, 0 }; int GetTrackNumber(SCNHANDLE hMidi) { @@ -918,8 +918,8 @@ void dumpMusic() { int outFileSize = 0; char buffer[20000]; - int total = (_vm->getFeatures() & GF_SCNFILES) ? - ARRAYSIZE(midiOffsetsSCNVersion) : + int total = (_vm->getFeatures() & GF_SCNFILES) ? + ARRAYSIZE(midiOffsetsSCNVersion) : ARRAYSIZE(midiOffsetsGRAVersion); for (int i = 0; i < total; i++) { diff --git a/engines/tinsel/object.cpp b/engines/tinsel/object.cpp index c9766631f9..6add275341 100644 --- a/engines/tinsel/object.cpp +++ b/engines/tinsel/object.cpp @@ -252,7 +252,7 @@ void SortObjectList(OBJECT *pObjList) { // set head of list dummy OBJ Z Y values to lowest possible head.yPos = intToFrac(MIN_INT16); head.zPos = MIN_INT; - + for (pPrev = &head, pObj = head.pNext; pObj != NULL; pPrev = pObj, pObj = pObj->pNext) { // check Z order if (pObj->zPos < pPrev->zPos) { diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index afbe6555fc..cd628439ad 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -376,7 +376,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) { // Copy all the colours memcpy(pPalQ->palRGB, pNewPal->palRGB, pNewPal->numColours * sizeof(COLORREF)); - + if (!pPalQ->bFading) // Q the change to the video DAC UpdateDACqueue(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColours), pPalQ->palRGB); @@ -496,7 +496,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) { // map the Value field to one of the 4 colours reserved for the translucent palette val /= 63; - transPalette[i + 1] = (uint8)((val == 0) ? 0 : val + + transPalette[i + 1] = (uint8)((val == 0) ? 0 : val + (TinselV2 ? TranslucentColour() : COL_HILIGHT) - 1); } } diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 81e7459c71..b90a90bfc2 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -160,7 +160,7 @@ static void FreeWaitCheck(PINT_CONTEXT pic, bool bVoluntary) { (icList + i)->waitNumber2 = 0; break; } - } + } } // Is someone waiting for this? @@ -249,7 +249,7 @@ void FreeMasterInterpretContext(void) { * @param actorId Associated actor (if any) * @param pinvo Associated inventory object */ -INT_CONTEXT *InitInterpretContext(GSORT gsort, SCNHANDLE hCode, TINSEL_EVENT event, +INT_CONTEXT *InitInterpretContext(GSORT gsort, SCNHANDLE hCode, TINSEL_EVENT event, HPOLYGON hpoly, int actorid, INV_OBJECT *pinvo, int myEscape) { INT_CONTEXT *ic; @@ -326,7 +326,7 @@ void RegisterGlobals(int num) { if (TinselV2) { // read initial values CdCD(nullContext); - + Common::File f; if (!f.open(GLOBALS_FILENAME)) error(CANNOT_FIND_FILE, GLOBALS_FILENAME); @@ -340,7 +340,7 @@ void RegisterGlobals(int num) { if (f.ioFailed()) error(FILE_IS_CORRUPT, GLOBALS_FILENAME); - + f.close(); } } @@ -514,7 +514,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { // same spot (i.e. here). // // The reasons we do it this way, instead of turning Interpret into - // a 'proper' coroutine are (1) we avoid implementation problems + // a 'proper' coroutine are (1) we avoid implementation problems // (CORO_INVOKE involves adding 'case' statements, but Interpret // already has a huge switch/case, so that would not work out of the // box), (2) we incurr less overhead, (3) it's easier to debug, diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h index fef45d5e03..ec8b9e4587 100644 --- a/engines/tinsel/pcode.h +++ b/engines/tinsel/pcode.h @@ -41,7 +41,7 @@ enum RESUME_STATE { }; enum { - PCODE_STACK_SIZE = 128 //!< interpeters stack size + PCODE_STACK_SIZE = 128 //!< interpeters stack size }; enum GSORT { @@ -128,7 +128,7 @@ void WaitInterpret(CORO_PARAM, PPROCESS pWaitProc, bool *result); #define CONV_BOTTOM 1 // conversation() parameter #define CONV_END 2 // -#define CONTROL_OFF 0 // control() +#define CONTROL_OFF 0 // control() #define CONTROL_ON 1 // parameter #define CONTROL_OFFV 2 // #define CONTROL_OFFV2 3 // diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp index 8cb6fcde0e..0eecaf28ef 100644 --- a/engines/tinsel/pdisplay.cpp +++ b/engines/tinsel/pdisplay.cpp @@ -317,7 +317,7 @@ int GetTaggedActor(void) { } /** - * Tag process keeps us updated as to which polygon is currently tagged + * Tag process keeps us updated as to which polygon is currently tagged * (if one is). Tag process asks us for this information, as does ProcessUserEvent(). */ static void SaveTaggedPoly(HPOLYGON hp) { @@ -559,7 +559,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) { int strLen; if (GetPolyTagHandle(hp) != 0) strLen = LoadStringRes(GetPolyTagHandle(hp), TextBufferAddr(), TBUFSZ); - else + else strLen = LoadStringRes(hTagtext, TextBufferAddr(), TBUFSZ); if (strLen == 0) @@ -656,7 +656,7 @@ void TagProcess(CORO_PARAM, const void *) { CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); - + _ctx->pText = NULL; _ctx->Tag = NO_HOTSPOT_TAG; @@ -735,7 +735,7 @@ static void leavingpoly(CORO_PARAM, HPOLYGON hp) { SetPolyTagWanted(hp, false, false, 0); } else if (PolyTagState(hp) == TAG_ON) { - // Delete this tag entry + // Delete this tag entry SetPolyTagState(hp, TAG_OFF); } diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp index e42a531939..55616863ee 100644 --- a/engines/tinsel/play.cpp +++ b/engines/tinsel/play.cpp @@ -277,7 +277,7 @@ static void SoundReel(CORO_PARAM, SCNHANDLE hFilm, int column, int speed, } else if (pAni[_ctx->frameNumber].op == ANI_ADJUSTXY) { _ctx->frameNumber += 3; } else { - // ANI_STOP, ANI_HIDE, ANI_HFLIP, + // ANI_STOP, ANI_HIDE, ANI_HFLIP, // ANI_VFLIP, ANI_HVFLIP, default _ctx->frameNumber++; } @@ -388,7 +388,7 @@ static void ResSoundReel(CORO_PARAM, const void *) { CORO_BEGIN_CODE(_ctx); - CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, soundReels[i].hFilm, soundReels[i].column, + CORO_INVOKE_ARGS(SoundReel, (CORO_SUBCTX, soundReels[i].hFilm, soundReels[i].column, -1, 0, soundReels[i].actorCol)); CORO_KILL_SELF(); @@ -422,11 +422,11 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) { CORO_BEGIN_CONTEXT; OBJECT *pPlayObj; // Object ANIM thisAnim; // Animation structure - + bool mActor; // Gets set if this is a moving actor bool lifeNoMatter; bool replaced; - + const FREEL *pfreel; // The 'column' to play int stepCount; int frameCount; @@ -658,13 +658,13 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) { /** * - Don't bother if this reel is already playing for this actor. * - If explicit co-ordinates, use these, If embedded co-ordinates, - * leave alone, otherwise use actor's current position. - * - Moving actors get hidden during this play, other actors get - * replaced by this play. + * leave alone, otherwise use actor's current position. + * - Moving actors get hidden during this play, other actors get + * replaced by this play. * - Column 0 of a film gets its appropriate Z-position, slave columns - * get slightly bigger Z-positions, in column order. + * get slightly bigger Z-positions, in column order. * - Play proceeds until the script finishes, another reel starts up for - * this actor, or the actor gets killed. + * this actor, or the actor gets killed. * - If called from an splay(), moving actor's co-ordinates are updated * after the play, any walk still in progress will go on from there. * @param x Co-ordinates from the play(), set to (-1, -1) if none @@ -854,7 +854,7 @@ static void t2PlayReel(CORO_PARAM, int x, int y, bool bRestore, int speed, SCNHA */ InitStepAnimScript(&_ctx->thisAnim, _ctx->pPlayObj, _ctx->pFreel->script, speed); - if (bRestore || (ActorEsc(_ctx->reelActor) == true && + if (bRestore || (ActorEsc(_ctx->reelActor) == true && ActorEev(_ctx->reelActor) != GetEscEvents())) { // From restore, step to jump or end SkipFrames(&_ctx->thisAnim, -1); @@ -938,7 +938,7 @@ static void PlayProcess(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); if (TinselV2) - CORO_INVOKE_ARGS(t2PlayReel, (CORO_SUBCTX, ppi->x, ppi->y, ppi->bRestore, ppi->speed, + CORO_INVOKE_ARGS(t2PlayReel, (CORO_SUBCTX, ppi->x, ppi->y, ppi->bRestore, ppi->speed, ppi->hFilm, ppi->column, ppi->myescEvent, ppi->bTop)); else CORO_INVOKE_1(t1PlayReel, ppi); @@ -968,7 +968,7 @@ void NewestFilm(SCNHANDLE film, const FREEL *reel) { * NOTE: The processes are started in reverse order so that the first * column's process kicks in first. */ -void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, +void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop) { assert(hFilm != 0); // Trying to play NULL film const FILM *pFilm; @@ -1027,7 +1027,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int myescEvent, bool bT * Start up a play process for each slave column in a film. * Play the first column directly from the parent process. */ -void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, +void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop) { CORO_BEGIN_CONTEXT; PPINIT ppi; @@ -1039,7 +1039,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla assert(hFilm != 0); // Trying to play NULL film const FILM *pFilm; - + pFilm = (const FILM *)LockMem(hFilm); // Now allowed empty films! @@ -1059,7 +1059,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla _ctx->ppi.escOn = escOn; _ctx->ppi.myescEvent = myescEvent; - // Start display process for each secondary reel in the film in Tinsel 1, + // Start display process for each secondary reel in the film in Tinsel 1, // or all of them in Tinsel 2 for (int i = FROM_LE_32(pFilm->numreels) - 1; i >= (TinselV2 ? 0 : 1); i--) { NewestFilm(hFilm, &pFilm->reels[i]); diff --git a/engines/tinsel/play.h b/engines/tinsel/play.h index 5cdca25faa..dd79b304f8 100644 --- a/engines/tinsel/play.h +++ b/engines/tinsel/play.h @@ -47,7 +47,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE film, int x, int y, int actorid, bool splay, void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int myescEvent, bool bTop); -void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, +void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay, bool sfact, bool escOn, int myescEvent, bool bTop); void RestoreActorReels(SCNHANDLE hFilm, short reelnum, short z, int x, int y); diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp index 7d00a8a37a..184bd24f6b 100644 --- a/engines/tinsel/polygons.cpp +++ b/engines/tinsel/polygons.cpp @@ -95,7 +95,7 @@ struct POLYGON { int a[4]; // y1-y2 } int b[4]; // x2-x1 } See IsInPolygon() long c[4]; // y1x2 - x1y2 } - + /* * Internal derived data for speed and conveniance * set up by PseudoCentre() @@ -173,7 +173,7 @@ public: int32 nodecount; //!<The number of nodes in this polygon int32 pnodelistx,pnodelisty; //!<offset in chunk to this array if present int32 plinelist; - + SCNHANDLE hScript; //!< handle of code segment for polygon events }; @@ -219,7 +219,7 @@ void Poly::nextPoly() { for (int i = 0; i < 4; ++i) x[i] = nextLong(_pData); for (int i = 0; i < 4; ++i) y[i] = nextLong(_pData); - + if (TinselV2) { xoff = nextLong(_pData); yoff = nextLong(_pData); @@ -599,7 +599,7 @@ void FindBestPoint(HPOLYGON hp, int *x, int *y, int *pline) { int32 b2 = (int)FROM_LE_32(line->b2); //!< b squared int32 a2pb2 = (int)FROM_LE_32(line->a2pb2); //!< a squared + b squared int32 ra2pb2 = (int)FROM_LE_32(line->ra2pb2); //!< root(a squared + b squared) - + int32 ab = (int)FROM_LE_32(line->ab); int32 ac = (int)FROM_LE_32(line->ac); int32 bc = (int)FROM_LE_32(line->bc); @@ -736,7 +736,7 @@ static const POLYGON *TryPath(POLYGON *last, POLYGON *whereto, POLYGON *current) */ static HPOLYGON PathOnTheWay(HPOLYGON from, HPOLYGON to) { // TODO: Fingolfin says: This code currently uses DFS (depth first search), - // in the TryPath function, to compute a path between 'from' and 'to'. + // in the TryPath function, to compute a path between 'from' and 'to'. // However, a BFS (breadth first search) might yield more natural results, // at least in cases where there are multiple possible paths. // There is a small risk of regressions caused by such a change, though. @@ -753,7 +753,7 @@ static HPOLYGON PathOnTheWay(HPOLYGON from, HPOLYGON to) { for (i = 0; i < MAX_POLY; i++) { // For each polygon.. POLYGON *p = Polys[i]; - if (p && p->polyType == PATH) //...if it's a path + if (p && p->polyType == PATH) //...if it's a path p->tried = false; } Polys[from]->tried = true; @@ -818,7 +818,7 @@ int NearestEndNode(HPOLYGON hPath, int x, int y) { nlistx = (int32 *)(pps + (int)FROM_LE_32(ptp.pnodelistx)); nlisty = (int32 *)(pps + (int)FROM_LE_32(ptp.pnodelisty)); - + const int nodecount = (int)FROM_LE_32(ptp.nodecount); d1 = ABS(x - (int)FROM_LE_32(nlistx[0])) + ABS(y - (int)FROM_LE_32(nlisty[0])); @@ -926,7 +926,7 @@ int NearestNodeWithin(HPOLYGON hNpath, int x, int y) { */ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { const POLYGON *psp, *pdp; - int j; + int j; int ncorn = 0; // nearest corner HPOLYGON hNpath = NOPOLY; // path containing nearest corner int ThisD, SmallestD = 1000; @@ -942,7 +942,7 @@ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { for (j = 0; j < 4; j++) { if (IsInPolygon(psp->cx[j], psp->cy[j], hDestPoly)) { ThisD = ABS(*x - psp->cx[j]) + ABS(*y - psp->cy[j]); - if (ThisD < SmallestD) { + if (ThisD < SmallestD) { hNpath = hStartPoly; ncorn = j; // Try to ignore it if virtually stood on it @@ -956,7 +956,7 @@ void NearestCorner(int *x, int *y, HPOLYGON hStartPoly, HPOLYGON hDestPoly) { for (j = 0; j < 4; j++) { if (IsInPolygon(pdp->cx[j], pdp->cy[j], hStartPoly)) { ThisD = ABS(*x - pdp->cx[j]) + ABS(*y - pdp->cy[j]); - if (ThisD < SmallestD) { + if (ThisD < SmallestD) { hNpath = hDestPoly; ncorn = j; // Try to ignore it if virtually stood on it @@ -1187,7 +1187,7 @@ bool deadPolys[MAX_POLY]; // Currently just for dead blocks void RebootDeadTags(void) { nextfreeT = numScenesT = 0; nextfreeE = numScenesE = 0; - + memset(SceneTags, 0, sizeof(SceneTags)); memset(SceneExits, 0, sizeof(SceneExits)); memset(TagStates, 0, sizeof(TagStates)); @@ -1357,14 +1357,14 @@ static void SetPathAdjacencies() { // For each polygon.. for (i1 = 0; i1 < MAX_POLY-1; i1++) { - // Get polygon, but only carry on if it's a path + // Get polygon, but only carry on if it's a path p1 = Polys[i1]; if (!p1 || p1->polyType != PATH) continue; // For each subsequent polygon.. for (i2 = i1 + 1; i2 < MAX_POLY; i2++) { - // Get polygon, but only carry on if it's a path + // Get polygon, but only carry on if it's a path p2 = Polys[i2]; if (!p2 || p2->polyType != PATH) continue; @@ -1421,7 +1421,7 @@ void CheckNPathIntegrity() { for (i = 0; i < MAX_POLY; i++) { // For each polygon.. rp = Polys[i]; - if (rp && rp->polyType == PATH && rp->subtype == NODE) { //...if it's a node path + if (rp && rp->polyType == PATH && rp->subtype == NODE) { //...if it's a node path // Get compiled polygon structure cp = (const POLY *)pps + rp->pIndex; // This polygon nlistx = (int32 *)(pps + (int)FROM_LE_32(cp.pnodelistx)); @@ -1495,7 +1495,7 @@ static void SetExTags(SCNHANDLE ph) { return; } } - + i = numScenesT++; currentTScene = i; assert(numScenesT < MAX_SCENES); // Dead tag remembering: scene limit @@ -1582,7 +1582,7 @@ static void FiddlyBit(POLYGON *p) { p->lright[t1] = MAX(p->cx[t1], p->cx[(t1+1)%4]); p->lleft[t1] = MIN(p->cx[t1], p->cx[(t1+1)%4]); - p->ltop[t1] = MIN(p->cy[t1], p->cy[(t1+1)%4]); + p->ltop[t1] = MIN(p->cy[t1], p->cy[(t1+1)%4]); p->lbottom[t1] = MAX(p->cy[t1], p->cy[(t1+1)%4]); p->a[t1] = p->cy[t1] - p->cy[(t1+1)%4]; diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp index 6590aed749..f92b8800db 100644 --- a/engines/tinsel/rince.cpp +++ b/engines/tinsel/rince.cpp @@ -229,7 +229,7 @@ void HideMover(PMOVER pMover, int sf) { if (!TinselV2) { // sf is only passed in Tinsel v1 pMover->SlowFactor = sf; - } else { + } else { // Tinsel 2 specific code if (IsTaggedActor(pMover->actorID)) { // It may be pointed to @@ -575,7 +575,7 @@ void AlterMover(PMOVER pMover, SCNHANDLE film, AR_FUNCTION fn) { StepAnimScript(&pMover->actorAnim); // 04/01/95 #endif } - + // Hang on, we may not want him yet! 04/01/95 if (pMover->bHidden) MultiSetZPosition(pMover->actorObj, -1); @@ -689,7 +689,7 @@ static void InitialPathChecks(PMOVER pMover, int xpos, int ypos) { z = GetScale(FirstPathPoly(), pMover->objY); } - SetMoverWalkReel(pMover, FORWARD, z, false); + SetMoverWalkReel(pMover, FORWARD, z, false); } static void MoverProcessHelper(int X, int Y, int id, PMOVER pMover) { @@ -758,7 +758,7 @@ void T1MoverProcess(CORO_PARAM, const void *param) { const PMOVER pActor = *(const PMOVER *)param; CORO_BEGIN_CODE(_ctx); - + while (1) { if (pActor->bSpecReel) { if (!pActor->bHidden) @@ -882,7 +882,7 @@ PMOVER InMoverBlock(PMOVER pMover, int x, int y) { caR = GetMoverRight(pMover) + x - caX; for (int i = 0; i < MAX_MOVERS; i++) { - if (pMover == &Movers[i] || + if (pMover == &Movers[i] || (TinselV2 && (Movers[i].actorObj == NULL)) || (!TinselV2 && !Movers[i].bActive)) continue; diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 02153aed59..05fad82a66 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -157,7 +157,7 @@ static bool syncSaveGameHeader(Serializer &s, SaveGameHeader &hdr) { } static void syncSavedMover(Serializer &s, SAVED_MOVER &sm) { - SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels, + SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels, (SCNHANDLE *)&sm.standReels, (SCNHANDLE *)&sm.talkReels }; s.syncAsUint32LE(sm.bActive); @@ -165,7 +165,7 @@ static void syncSavedMover(Serializer &s, SAVED_MOVER &sm) { s.syncAsSint32LE(sm.objX); s.syncAsSint32LE(sm.objY); s.syncAsUint32LE(sm.hLastfilm); - + for (int pIndex = 0; pIndex < 3; ++pIndex) { SCNHANDLE *p = pList[pIndex]; for (int i = 0; i < TOTAL_SCALES * 4; ++i) @@ -281,7 +281,7 @@ static char *NewName(void) { static char result[FNAMELEN]; int i; int ano = 1; // Allocated number - + while (1) { Common::String fname = _vm->getSavegameFilename(ano); strcpy(result, fname.c_str()); @@ -343,7 +343,7 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target) if (difftime(mktime(&hdr.dateTime), mktime(&savedFiles[i].dateTime)) > 0) { Common::copy_backward(&savedFiles[i], &savedFiles[numSfiles], &savedFiles[numSfiles + 1]); break; - } + } } #endif @@ -366,7 +366,7 @@ int getList(void) { // TODO/FIXME: Just always reload this data? Be careful about slow downs!!! if (!NeedLoad) return numSfiles; - + return getList(_vm->getSaveFileMan(), _vm->getTargetName()); } @@ -478,7 +478,7 @@ static void DoSave(void) { return; Serializer s(0, f); - + // Write out a savegame header SaveGameHeader hdr; hdr.id = SAVEGAME_ID; diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp index 66564f1c81..32f375290f 100644 --- a/engines/tinsel/savescn.cpp +++ b/engines/tinsel/savescn.cpp @@ -226,7 +226,7 @@ static void SortMAProcess(CORO_PARAM, const void *) { HideMover(GetMover(rsd->SavedMoverInfo[_ctx->i].actorID)); } - ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID, + ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID, rsd->SavedMoverInfo[_ctx->i].startColour, rsd->SavedMoverInfo[_ctx->i].paletteLength); if (rsd->SavedMoverInfo[_ctx->i].brightness != BOGUS_BRIGHTNESS) @@ -237,7 +237,7 @@ static void SortMAProcess(CORO_PARAM, const void *) { SetSysVar(ISV_DIVERT_ACTOR, _ctx->viaActor); bNotDoneYet = false; - + CORO_END_CODE; } @@ -311,7 +311,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) { case RS_COUNT: _vm->_sound->stopAllSamples(); ClearScreen(); - + // Master script only affected on restore game, not restore scene if (TinselV2 && (sd == &sgData)) { g_scheduler->killMatchingProcess(PID_MASTER_SCR); @@ -350,7 +350,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) { PlayfieldSetPos(FIELD_WORLD, sd->SavedLoffset, sd->SavedToffset); SetNoBlocking(sd->SavedNoBlocking); } - + RestoreNoScrollData(&sd->SavedNoScrollData); if (TinselV2) { @@ -422,7 +422,7 @@ void SaveGame(char *name, char *desc) { DoSaveScene(&sgData); RequestSaveGame(name, desc, &sgData, &savedSceneCount, ssData); - + // Actual saving is performed by ProcessSRQueue } diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index 8826d97099..b0aac5b605 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -245,7 +245,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { // Music stuff char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME); assert(cptr); - _vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript), + _vm->_pcmMusic->setMusicSceneDetails(FROM_LE_32(ss->hMusicScript), FROM_LE_32(ss->hMusicSegment), cptr); } @@ -289,7 +289,7 @@ static void LoadScene(SCNHANDLE scene, int entry) { ++es; else es = (const ENTRANCE_STRUC *)((const byte *)es + 8); - + } if (i == FROM_LE_32(ss->numEntrance)) diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp index 526ad3fcf6..8ced3ba9c0 100644 --- a/engines/tinsel/sched.cpp +++ b/engines/tinsel/sched.cpp @@ -69,17 +69,17 @@ Scheduler::Scheduler() { #endif pRCfunction = 0; - + active = new PROCESS; active->pPrevious = NULL; - + g_scheduler = this; // FIXME HACK } Scheduler::~Scheduler() { free(processList); processList = NULL; - + delete active; active = 0; } @@ -342,7 +342,7 @@ PROCESS *Scheduler::createProcess(int pid, CORO_ADDR coroAddr, const void *pPara if (pProc->pNext) pProc->pNext->pPrevious = pProc; active->pNext = pProc; - + } // set coroutine entry point @@ -377,7 +377,7 @@ PROCESS *Scheduler::createProcess(int pid, CORO_ADDR coroAddr, const void *pPara void Scheduler::killProcess(PROCESS *pKillProc) { // make sure a valid process pointer assert(pKillProc >= processList && pKillProc <= processList + NUM_PROCESS - 1); - + // can not kill the current process using killProcess ! assert(pCurrent != pKillProc); @@ -490,7 +490,7 @@ int Scheduler::killMatchingProcess(int pidKill, int pidMask) { /** * Set pointer to a function to be called by killProcess(). - * + * * May be called by a resource allocator, the function supplied is * called by killProcess() to allow the resource allocator to free * resources allocated to the dying process. @@ -603,7 +603,7 @@ void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait if (_ctx->pic == NULL) return; - _ctx->pProc = g_scheduler->createProcess(PID_PROCESS + i, ProcessTinselProcess, + _ctx->pProc = g_scheduler->createProcess(PID_PROCESS + i, ProcessTinselProcess, &_ctx->pic, sizeof(_ctx->pic)); AttachInterpret(_ctx->pic, _ctx->pProc); break; diff --git a/engines/tinsel/sched.h b/engines/tinsel/sched.h index 1e2d3f796e..67b11271cd 100644 --- a/engines/tinsel/sched.h +++ b/engines/tinsel/sched.h @@ -49,7 +49,7 @@ struct PROCESS { PROCESS *pPrevious; //!< pointer to previous process in active or free list CoroContext state; //!< the state of the coroutine - CORO_ADDR coroAddr; //!< the entry point of the coroutine + CORO_ADDR coroAddr; //!< the entry point of the coroutine int sleepTime; //!< number of scheduler cycles to sleep int pid; //!< process ID @@ -66,18 +66,18 @@ class Scheduler { public: /** Pointer to a function of the form "void function(PPROCESS)" */ typedef void (*VFPTRPP)(PROCESS *); - + private: - + /** list of all processes */ PROCESS *processList; - + /** active process list - also saves scheduler state */ PROCESS *active; - + /** pointer to free process list */ PROCESS *pFreeProcesses; - + /** the currently active process */ PROCESS *pCurrent; @@ -88,7 +88,7 @@ private: void CheckStack(); #endif - + /** * Called from killProcess() to enable other resources * a process may be allocated to be released. @@ -102,11 +102,11 @@ public: ~Scheduler(); void reset(); - + #ifdef DEBUG void printStats(); #endif - + void schedule(); void rescheduleAll(); void reschedule(PPROCESS pReSchedProc = NULL); @@ -114,12 +114,12 @@ public: PROCESS *createProcess(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam); void killProcess(PROCESS *pKillProc); - + PROCESS *getCurrentProcess(); int getCurrentPID() const; int killMatchingProcess(int pidKill, int pidMask = -1); - - + + void setResourceCallback(VFPTRPP pFunc); }; @@ -131,7 +131,7 @@ extern Scheduler *g_scheduler; // FIXME: Temporary global var, to be used until void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess); void CallSceneProcess(uint32 procID); void KillSceneProcess(uint32 procID); -void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, +void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, int myEscape, bool *result = NULL); void RestoreSceneProcess(INT_CONTEXT *pic); diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp index 2825a90fe3..e0b4188b90 100644 --- a/engines/tinsel/scn.cpp +++ b/engines/tinsel/scn.cpp @@ -55,7 +55,7 @@ byte *FindChunk(SCNHANDLE handle, uint32 chunk) { // V0 chunk types can be found by substracting 2 from the // chunk type. Note that CHUNK_STRING and CHUNK_BITMAP are // the same in V0 and V1 - if (TinselVersion == TINSEL_V0 && + if (TinselVersion == TINSEL_V0 && chunk != CHUNK_STRING && chunk != CHUNK_BITMAP) chunk -= 0x2L; diff --git a/engines/tinsel/scroll.cpp b/engines/tinsel/scroll.cpp index 579775c91f..f31f596c43 100644 --- a/engines/tinsel/scroll.cpp +++ b/engines/tinsel/scroll.cpp @@ -58,11 +58,11 @@ static int oldx = 0, oldy = 0; /** Boundaries and numbers of boundaries */ static SCROLLDATA sd = { { - {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, + {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, { - {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, + {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, 0, @@ -415,9 +415,9 @@ void ScrollProcess(CORO_PARAM, const void *) { CORO_BEGIN_CODE(_ctx); - // In Tinsel v2, scenes may play movies, so the background may not always + // In Tinsel v2, scenes may play movies, so the background may not always // already be initialised like it is in v1 - while (!GetBgObject()) + while (!GetBgObject()) CORO_SLEEP(1); ImageH = BgHeight(); // Dimensions diff --git a/engines/tinsel/serializer.h b/engines/tinsel/serializer.h index 98ee398ef8..8984cb4757 100644 --- a/engines/tinsel/serializer.h +++ b/engines/tinsel/serializer.h @@ -45,7 +45,7 @@ namespace Tinsel { } \ _bytesSynced += SIZE; \ } - + // TODO: Write comment for this // TODO: Inspired by the SCUMM engine -- move to common/ code and use in more engines? @@ -58,9 +58,9 @@ public: bool isSaving() { return (_saveStream != 0); } bool isLoading() { return (_loadStream != 0); } - + uint bytesSynced() const { return _bytesSynced; } - + void syncBytes(byte *buf, uint16 size) { if (_loadStream) _loadStream->read(buf, size); @@ -90,7 +90,7 @@ protected: #undef SYNC_AS -// TODO: Make a subclass "VersionedSerializer", which makes it easy to support +// TODO: Make a subclass "VersionedSerializer", which makes it easy to support // multiple versions of a savegame format (again inspired by SCUMM). /* class VersionedSerializer : public Serializer { diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index 9d1996ca01..aec61b410e 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -88,7 +88,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound // get file offset for this sample uint32 dwSampleIndex = _sampleIndex[id]; - + // move to correct position in the sample file _sampleStream.seek(dwSampleIndex); if (_sampleStream.ioFailed() || (uint32)_sampleStream.pos() != dwSampleIndex) @@ -190,7 +190,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p // get file offset for this sample uint32 dwSampleIndex = _sampleIndex[id]; - + if (dwSampleIndex == 0) { warning("Tinsel2 playSample, non-existant sample %d", id); return false; @@ -305,7 +305,7 @@ int8 SoundManager::getPan(int x) { if (x < 0) { if (x < (-SCREEN_WIDTH / 2)) return -127; - + x = (-x * 127) / (SCREEN_WIDTH / 2); return 0 - x; diff --git a/engines/tinsel/sound.h b/engines/tinsel/sound.h index 9b980822dc..8b969a5f48 100644 --- a/engines/tinsel/sound.h +++ b/engines/tinsel/sound.h @@ -103,12 +103,12 @@ public: void stopAllSamples(void); // Stops any currently playing sample void stopSpecSample(int id, int sub = 0); // Stops a specific sample - + void setSFXVolumes(uint8 volume); bool sampleExists(int id); bool sampleIsPlaying(int id = -1); - + // TODO: Internal method, make this protected? void openSampleFiles(void); void closeSampleStream(void); diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp index ad28c48334..2d963ae8bb 100644 --- a/engines/tinsel/strres.cpp +++ b/engines/tinsel/strres.cpp @@ -80,7 +80,7 @@ LANGUAGE textLanguage, sampleLanguage = TXT_ENGLISH; void ChangeLanguage(LANGUAGE newLang) { Common::File f; uint32 textLen = 0; // length of buffer - + textLanguage = newLang; sampleLanguage = newLang; @@ -98,8 +98,8 @@ void ChangeLanguage(LANGUAGE newLang) { error(CANNOT_FIND_FILE, _vm->getTextFile(newLang)); } - // Check whether the file is compressed or not - for compressed files the - // first long is the filelength and for uncompressed files it is the chunk + // Check whether the file is compressed or not - for compressed files the + // first long is the filelength and for uncompressed files it is the chunk // identifier textLen = f.readUint32LE(); if (f.ioFailed()) @@ -392,12 +392,12 @@ LANGUAGE NextLanguage(LANGUAGE thisOne) { int i; for (i = thisOne+1; i < NUM_LANGUAGES; i++) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } for (i = 0; i < thisOne; i++) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } @@ -409,12 +409,12 @@ LANGUAGE PrevLanguage(LANGUAGE thisOne) { int i; for (i = thisOne-1; i >= 0; i--) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } for (i = NUM_LANGUAGES-1; i > thisOne; i--) { - if (languages[i].bPresent) + if (languages[i].bPresent) return (LANGUAGE)i; } diff --git a/engines/tinsel/sysvar.h b/engines/tinsel/sysvar.h index 869a99caa3..8866558e62 100644 --- a/engines/tinsel/sysvar.h +++ b/engines/tinsel/sysvar.h @@ -86,7 +86,7 @@ typedef enum { SV_DEFAULT_INV, ISV_GHOST_ACTOR, ISV_GHOST_BASE, ISV_GHOST_COLOUR, - + SV_TOPVALID } SYSVARS; diff --git a/engines/tinsel/text.cpp b/engines/tinsel/text.cpp index 7e36e5236f..fbeee9b8ed 100644 --- a/engines/tinsel/text.cpp +++ b/engines/tinsel/text.cpp @@ -107,7 +107,7 @@ int JustifyText(char *szStr, int xPos, const FONT *pFont, int mode) { * @param mode Mode flags for the string * @param sleepTime Sleep time between each character (if non-zero) */ -OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, +OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime) { int xJustify; // x position of text after justification int yOffset; // offset to next line of text @@ -153,7 +153,7 @@ OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, } else { // printable character int aniX, aniY; // char image animation offsets - + OBJ_INIT oi; oi.hObjImg = FROM_LE_32(pFont->fontInit.hObjImg); oi.objFlags = FROM_LE_32(pFont->fontInit.objFlags); @@ -265,7 +265,7 @@ OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, */ bool IsCharImage(SCNHANDLE hFont, char c) { byte c2 = (byte)c; - + // Inventory save game name editor needs to be more clever for // multi-byte characters. This bodge will stop it erring. if (bMultiByte && (c2 & 0x80)) diff --git a/engines/tinsel/text.h b/engines/tinsel/text.h index 0fcc965ff9..29e1a08bfe 100644 --- a/engines/tinsel/text.h +++ b/engines/tinsel/text.h @@ -98,7 +98,7 @@ struct TEXTOUT { * @param mode mode flags for the string * @param sleepTime Sleep time between each character (if non-zero) */ -OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, +OBJECT *ObjectTextOut(CORO_PARAM, OBJECT *pList, char *szStr, int colour, int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime = 0); OBJECT *ObjectTextOutIndirect( // output a string of text diff --git a/engines/tinsel/timers.cpp b/engines/tinsel/timers.cpp index 92abf4c028..8446aad0fa 100644 --- a/engines/tinsel/timers.cpp +++ b/engines/tinsel/timers.cpp @@ -23,7 +23,7 @@ * * Handles timers. * - * Note: As part of the transition to ScummVM, the ticks field of a timer has been changed + * Note: As part of the transition to ScummVM, the ticks field of a timer has been changed * to a millisecond value, rather than ticks at 24Hz. Most places should be able to use * the timers without change, since the ONE_SECOND constant has been set to be in MILLISECONDS */ diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 788b999142..0a29a9fe82 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -150,7 +150,7 @@ enum MASTER_LIB_CODES { CLOSEINVENTORY, CONTROL, CONVERSATION, CONVTOPIC, CURSOR, CURSORXPOS, CURSORYPOS, CUTSCENE, DECCONVW, DECCSTRINGS, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, DECLARELANGUAGE, DECLEAD, DECSCALE, DECTAGFONT, DECTALKFONT, DELICON, - DELINV, DELTOPIC, DIMMUSIC, DROP, DROPEVERYTHING, DROPOUT, EFFECTACTOR, ENABLEMENU, + DELINV, DELTOPIC, DIMMUSIC, DROP, DROPEVERYTHING, DROPOUT, EFFECTACTOR, ENABLEMENU, ENDACTOR, ESCAPE, ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEMIDI, FADEOUT, FRAMEGRAB, FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, HAILSCENE, HASRESTARTED, HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, @@ -164,8 +164,8 @@ enum MASTER_LIB_CODES { RESUMELASTGAME, RUNMODE, SAMPLEPLAYING, SAVESCENE, SAY, SAYAT, SCALINGREELS, SCANICON, SCREENXPOS, SCREENYPOS, SCROLL, SCROLLPARAMETERS, SENDACTOR, SENDGLOBALPROCESS, SENDOBJECT, SENDPROCESS, SENDTAG, SETACTOR, SETBLOCK, SETBRIGHTNESS, SETEXIT, SETINVLIMIT, - SETINVSIZE, SETLANGUAGE, SETPALETTE, SETSYSTEMREEL, SETSYSTEMSTRING, SETSYSTEMVAR, - SETTAG, SETTIMER, SHELL, SHOWACTOR, SHOWBLOCK, SHOWEFFECT, SHOWMENU, SHOWPATH, + SETINVSIZE, SETLANGUAGE, SETPALETTE, SETSYSTEMREEL, SETSYSTEMSTRING, SETSYSTEMVAR, + SETTAG, SETTIMER, SHELL, SHOWACTOR, SHOWBLOCK, SHOWEFFECT, SHOWMENU, SHOWPATH, SHOWPOS, SHOWREFER, SHOWSTRING, SHOWTAG, SPLAY, STAND, STANDTAG, STARTGLOBALPROCESS, STARTPROCESS, STARTTIMER, STOPMIDI, STOPSAMPLE, STOPWALK, SUBTITLES, SWALK, SWALKZ, SYSTEMVAR, TAGACTOR, TAGTAGXPOS, TAGTAGYPOS, TAGWALKXPOS, TAGWALKYPOS, TALK, TALKAT, @@ -223,14 +223,14 @@ const MASTER_LIB_CODES DW2_CODES[] = { ACTORREF, ACTORRGB, ACTORSCALE, ACTORXPOS, ACTORYPOS, ADDHIGHLIGHT, ADDINV, ADDINV1, ADDINV2, ADDOPENINV, ADDTOPIC, BACKGROUND, CALLACTOR, CALLGLOBALPROCESS, CALLOBJECT, - CALLPROCESS, CALLSCENE, CALLTAG, CAMERA, CDCHANGESCENE, + CALLPROCESS, CALLSCENE, CALLTAG, CAMERA, CDCHANGESCENE, CDDOCHANGE, CDLOAD, CDPLAY, CLEARHOOKSCENE, CLOSEINVENTORY, CONTROL, CONVERSATION, CURSOR, CURSORXPOS, CURSORYPOS, DECCONVW, DECCURSOR, DECFLAGS, DECINV1, DECINV2, DECINVW, DECLEAD, DECSCALE, DECTAGFONT, DECTALKFONT, DELTOPIC, DIMMUSIC, DROP, DROPOUT, EFFECTACTOR, ENABLEMENU, ENDACTOR, ESCAPEOFF, ESCAPEON, EVENT, FACETAG, FADEIN, FADEOUT, FRAMEGRAB, - FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, + FREEZECURSOR, GETINVLIMIT, GHOST, GLOBALVAR, GRABMOVIE, HASRESTARTED, HAVE, HELDOBJECT, HIDEACTOR, HIDEBLOCK, HIDEEFFECT, HIDEPATH, HIDEREFER, HIDETAG, HOLD, HOOKSCENE, IDLETIME, INSTANTSCROLL, INVENTORY, INVPLAY, INWHICHINV, KILLACTOR, @@ -292,7 +292,7 @@ void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, int hold, bool ig //----------------- SUPPORT FUNCTIONS -------------------- /** - * For Scroll() and Offset(), work out top left for a + * For Scroll() and Offset(), work out top left for a * given screen position. */ static void DecodeExtreme(EXTREME extreme, int *px, int *py) { @@ -582,7 +582,7 @@ static void AddTopic(int icon) { */ static void AddInv(int invno, int object) { // illegal inventory number - assert(invno == INV_1 || invno == INV_2 || invno == INV_OPEN || invno == INV_DEFAULT); + assert(invno == INV_1 || invno == INV_2 || invno == INV_OPEN || invno == INV_DEFAULT); AddToInventory(invno, object, false); } @@ -1160,13 +1160,13 @@ static int GetInvLimit(int invno) { */ static void Ghost(int actor, int tColour, int tPalOffset) { SetSysVar(ISV_GHOST_ACTOR, actor); - SetSysVar(ISV_GHOST_COLOUR, tColour); + SetSysVar(ISV_GHOST_COLOUR, tColour); SetSysVar(ISV_GHOST_BASE, tPalOffset); CreateGhostPalette(BgPal()); } /** - * + * */ static void HailScene(SCNHANDLE scene) { DoHailScene(scene); @@ -1463,7 +1463,7 @@ void Offset(EXTREME extreme, int x, int y) { if (TinselV2) DecodeExtreme(extreme, &x, &y); - + PlayfieldSetPos(FIELD_WORLD, x, y); } @@ -1798,7 +1798,7 @@ static void PostActor(CORO_PARAM, int actor, TINSEL_EVENT event, HPOLYGON hp, assert(hp == NOPOLY && taggedActor); assert(IsTaggedActor(actor)); } - + if (IsTaggedActor(actor)) { assert(actor); ActorEvent(coroParam, actor, event, false, myEscape); @@ -1895,7 +1895,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust if (time == 0) { // This is a 'talky' print _ctx->time = TextTime(TextBufferAddr()); - + // Cut short-able if sustain was not set _ctx->myleftEvent = bSustain ? 0 : GetLeftEvents(); } else { @@ -1923,7 +1923,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust int Loffset, Toffset; // Screen position PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); _ctx->pText = ObjectTextOut(coroParam, GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), - 0, x - Loffset, y - Toffset, + 0, x - Loffset, y - Toffset, TinselV2 ? GetTagFontHandle() : GetTalkFontHandle(), TXT_CENTRE); assert(_ctx->pText); // string produced NULL text if (IsTopWindow()) @@ -2197,7 +2197,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo, if (_ctx->bTookControl) ControlOn(); // Free control if we took it } - + } else { if (event == POINTED) { // FIXME: Is there ever an associated sound if in POINTED mode??? @@ -2341,7 +2341,7 @@ static void PrintObjNonPointed(CORO_PARAM, const SCNHANDLE text, const OBJECT *p static void PrintTag(HPOLYGON hp, SCNHANDLE text, int actor = 0, bool bCursor = false) { // printtag() may only be called from a polygon code block in Tinsel 1, or // additionally from a moving actor code block in Tinsel 2 - assert((hp != NOPOLY) || (TinselV2 && (actor != 0))); + assert((hp != NOPOLY) || (TinselV2 && (actor != 0))); if (hp != NOPOLY) { // Poly handling @@ -3264,7 +3264,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x } else if (_ctx->whatSort == IS_TALKAT) { _ctx->bTalkReel = false; - + } else if ((_ctx->whatSort == IS_SAY) || (_ctx->whatSort == IS_SAYAT)) { _ctx->bTalkReel = false; if (IsTaggedActor(_ctx->actor)) { @@ -3338,7 +3338,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x yshift = MultiHighest(_ctx->pText); if (yshift < 4) MultiMoveRelXY(_ctx->pText, 0, 4 - yshift); // Not off top - + /* * Don't go off the side of the screen */ @@ -3392,7 +3392,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x // Handle timeout decrementing and Escape presses if (TinselV2) { - if ((_ctx->escEvents && _ctx->escEvents != GetEscEvents()) || + if ((_ctx->escEvents && _ctx->escEvents != GetEscEvents()) || (!bSustain && LeftEventChange(_ctx->myLeftEvent)) || (--_ctx->timeout <= 0)) { // Left event only kills current sub-string @@ -3748,7 +3748,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) { if (!MenuActive()) return; - + do { CORO_SLEEP(1); } while (MenuActive()); @@ -3804,14 +3804,14 @@ static void WaitTime(CORO_PARAM, int time, bool frame, bool escOn, int myEscape) if (escOn && myEscape != GetEscEvents()) break; } while (_ctx->time--); - + CORO_END_CODE; } /** * Set a moving actor off on a walk. */ -void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool igPath, +void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool igPath, int zOverride, bool escOn, int myescEvent) { CORO_BEGIN_CONTEXT; int thisWalk; @@ -3933,7 +3933,7 @@ static void Walked(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, bool esc } else { // Pause before starting the walk CORO_SLEEP(ONE_SECOND); - + assert(pMover->hCpath != NOPOLY); // moving actor not in path // Briefly aquire token to kill off any other normal walk @@ -4563,7 +4563,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi // DW2 only DimMusic(); return 0; - + case DROP: // DW2 only Drop(pp[0]); @@ -4603,7 +4603,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi case EVENT: // Common to both DW1 & DW2 - if (TinselVersion == TINSEL_V2) + if (TinselVersion == TINSEL_V2) pp[0] = pic->event; else pp[0] = TINSEL1_EVENT_MAP[pic->event]; @@ -4890,7 +4890,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi if (*pResumeState == RES_1 && IsCdPlayHandle(pp[0])) *pResumeState = RES_NOT; else { - Play(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape, false, + Play(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape, false, pic->event, pic->hPoly, pic->idActor); if (coroParam) @@ -5442,7 +5442,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi // DW2 only pp[0] = ThisObject(pic->pinvo); return 0; - + case THISTAG: // DW2 only pp[0] = ThisTag(pic->hPoly); diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index eab2844a4e..9341b0fe4e 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -161,7 +161,7 @@ void KeyboardProcess(CORO_PARAM, const void *) { keypresses.erase(keypresses.begin()); const Common::Point mousePos = _vm->getMousePosition(); - // Switch for special keys + // Switch for special keys switch (evt.kbd.keycode) { // Drag action case Common::KEYCODE_LALT: @@ -196,7 +196,7 @@ void KeyboardProcess(CORO_PARAM, const void *) { if (evt.type == Common::EVENT_KEYUP) continue; - if (_vm->_keyHandler != NULL) + if (_vm->_keyHandler != NULL) // Keyboard is hooked, so pass it on to that handler first if (!_vm->_keyHandler(evt.kbd)) continue; @@ -221,11 +221,11 @@ void KeyboardProcess(CORO_PARAM, const void *) { case Common::KEYCODE_ESCAPE: #if 0 if (!TinselV2) { - // WORKAROUND: For Discworld 1, check if any of the starting logo screens are + // WORKAROUND: For Discworld 1, check if any of the starting logo screens are // active, and if so manually skip to the title screen, allowing them to be bypassed int sceneOffset = (_vm->getFeatures() & GF_SCNFILES) ? 1 : 0; int sceneNumber = (GetSceneHandle() >> SCNHANDLE_SHIFT) - sceneOffset; - if ((g_language == TXT_GERMAN) && + if ((g_language == TXT_GERMAN) && ((sceneNumber >= 25 && sceneNumber <= 27) || (sceneNumber == 17))) { // Skip to title screen // It seems the German CD version uses scenes 25,26,27,17 for the intro, @@ -386,7 +386,7 @@ static void MouseProcess(CORO_PARAM, const void *) { } else { // Initial mouse down - either for a single click, or potentially // the start of a double-click action - + if (TinselV2) { PlayerEvent(PLR_DRAG1_START, mousePos); @@ -412,7 +412,7 @@ static void MouseProcess(CORO_PARAM, const void *) { if (_ctx->lastLWasDouble == false) { _ctx->lastLeftClick = DwGetCurrentTime(); - // If player control is enabled, start a process which, if it times out, + // If player control is enabled, start a process which, if it times out, // will activate a single button click if (TinselV2 && ControlIsOn()) { clickPos = mousePos; @@ -630,7 +630,7 @@ static void RestoredProcess(CORO_PARAM, const void *param) { _ctx->pic = RestoreInterpretContext(_ctx->pic); _ctx->bConverse = TinselV2 && (_ctx->pic->event == CONVERSE); - + CORO_INVOKE_1(Interpret, _ctx->pic); // Restore control after CallScene() from a conversation icon @@ -690,7 +690,7 @@ bool ChangeScene(bool bReset) { } else if (--CountOut == 0) { if (!TinselV2) ClearScreen(); - + StartNewScene(NextScene.scene, NextScene.entry); NextScene.scene = 0; @@ -745,7 +745,7 @@ void LoadBasicChunks(void) { numObjects = (cptr != NULL) ? READ_LE_UINT32(cptr) : 0; cptr = FindChunk(INV_OBJ_SCNHANDLE, CHUNK_OBJECTS); - + #ifdef SCUMM_BIG_ENDIAN //convert to native endianness INV_OBJECT *io = (INV_OBJECT *)cptr; @@ -756,7 +756,7 @@ void LoadBasicChunks(void) { io->attribute = FROM_LE_32(io->attribute); } #endif - + RegisterIcons(cptr, numObjects); cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_POLY); @@ -837,7 +837,7 @@ const char *TinselEngine::_textFiles[][3] = { }; -TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : +TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _vm = this; @@ -861,7 +861,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) int cd_num = ConfMan.getInt("cdrom"); if (cd_num >= 0) _system->openCD(cd_num); - + int midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI); bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32")); //bool adlib = (midiDriver == MD_ADLIB); @@ -876,7 +876,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) //_midiMusic->setAdlib(adlib); _musicVolume = ConfMan.getInt("music_volume"); - + _sound = new SoundManager(this); _mousePos.x = 0; @@ -922,7 +922,7 @@ Common::Error TinselEngine::init() { g_system->getEventManager()->registerRandomSource(_random, "tinsel"); _console = new Console(); - + _scheduler = new Scheduler(); InitSysVars(); @@ -1067,7 +1067,7 @@ void TinselEngine::NextGameCycle(void) { if (MoviePlaying()) CopyMovieToScreen(); - else + else // redraw background DrawBackgnd(); @@ -1078,8 +1078,8 @@ void TinselEngine::NextGameCycle(void) { bool TinselEngine::pollEvent() { Common::Event event; - - if (!g_system->getEventManager()->pollEvent(event)) + + if (!g_system->getEventManager()->pollEvent(event)) return false; // Handle the various kind of events @@ -1094,7 +1094,7 @@ bool TinselEngine::pollEvent() { case Common::EVENT_MOUSEMOVE: { - // This fragment takes care of Tinsel 2 when it's been compiled with + // This fragment takes care of Tinsel 2 when it's been compiled with // blank areas at the top and bottom of thes creen int ySize = (g_system->getHeight() - _vm->screen().h) / 2; if ((event.mouse.y >= ySize) && (event.mouse.y < (g_system->getHeight() - ySize))) @@ -1106,7 +1106,7 @@ bool TinselEngine::pollEvent() { case Common::EVENT_KEYUP: ProcessKeyEvent(event); break; - + default: break; } @@ -1176,8 +1176,8 @@ void TinselEngine::RestartDrivers(void) { _scheduler->reset(); // init the event handlers - pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0); - pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0); + pMouseProcess = _scheduler->createProcess(PID_MOUSE, MouseProcess, NULL, 0); + pKeyboardProcess = _scheduler->createProcess(PID_KEYBOARD, KeyboardProcess, NULL, 0); // open MIDI files OpenMidiFiles(); @@ -1254,7 +1254,7 @@ void TinselEngine::ProcessKeyEvent(const Common::Event &event) { return; } - // All other keypresses add to the queue for processing in KeyboardProcess + // All other keypresses add to the queue for processing in KeyboardProcess keypresses.push_back(event); } |