diff options
63 files changed, 937 insertions, 898 deletions
diff --git a/audio/softsynth/opl/nuked.h b/audio/softsynth/opl/nuked.h index 3326add7bf..6cddbe8686 100644 --- a/audio/softsynth/opl/nuked.h +++ b/audio/softsynth/opl/nuked.h @@ -173,7 +173,7 @@ public: byte read(int a); void writeReg(int r, int v); - + bool isStereo() const { return true; } protected: diff --git a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp index 222cf0c6ef..5e6afc2a57 100644 --- a/backends/graphics/psp2sdl/psp2sdl-graphics.cpp +++ b/backends/graphics/psp2sdl/psp2sdl-graphics.cpp @@ -238,7 +238,7 @@ void PSP2SdlGraphicsManager::setAspectRatioCorrection(bool enable) { SDL_Surface *PSP2SdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { SDL_Surface *screen = SurfaceSdlGraphicsManager::SDL_SetVideoMode(width, height, bpp, flags); - + if (screen != nullptr) { vita2d_set_vblank_wait(true); _vitatex_hwscreen = vita2d_create_empty_texture_format(width, height, SCE_GXM_TEXTURE_FORMAT_R5G6B5); diff --git a/backends/platform/androidsdl/androidsdl-sdl.cpp b/backends/platform/androidsdl/androidsdl-sdl.cpp index 697acca4d6..2ed644ecb2 100644 --- a/backends/platform/androidsdl/androidsdl-sdl.cpp +++ b/backends/platform/androidsdl/androidsdl-sdl.cpp @@ -44,18 +44,18 @@ void OSystem_ANDROIDSDL::initBackend() { if (!ConfMan.hasKey("gfx_mode")) ConfMan.set("gfx_mode", "2x"); - + if (!ConfMan.hasKey("swap_menu_and_back_buttons")) ConfMan.setBool("swap_menu_and_back_buttons", true); else swapMenuAndBackButtons(ConfMan.getBool("swap_menu_and_back_buttons")); - + if (!ConfMan.hasKey("touchpad_mouse_mode")) { const bool enable = SDL_ANDROID_GetMouseEmulationMode(); ConfMan.setBool("touchpad_mouse_mode", enable); } else touchpadMode(ConfMan.getBool("touchpad_mouse_mode")); - + if (!ConfMan.hasKey("onscreen_control")) { const bool enable = SDL_ANDROID_GetScreenKeyboardShown(); ConfMan.setBool("onscreen_control", enable); @@ -115,7 +115,7 @@ void OSystem_ANDROIDSDL::setFeatureState(Feature f, bool enable) { swapMenuAndBackButtons(enable); break; } - + OSystem_POSIX::setFeatureState(f, enable); } diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h index e0ac599b1d..9b9d2bdee0 100644 --- a/backends/platform/ios7/ios7_osys_main.h +++ b/backends/platform/ios7/ios7_osys_main.h @@ -123,7 +123,7 @@ public: static OSystem_iOS7 *sharedInstance(); virtual void initBackend(); - + virtual void engineInit(); virtual void engineDone(); diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp index 7a2047f28e..8e5f170a7d 100644 --- a/backends/platform/psp/input.cpp +++ b/backends/platform/psp/input.cpp @@ -336,7 +336,7 @@ bool Nub::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad) { // keep track of remainder for true sub-pixel cursor position _hiresX %= 1024; _hiresY %= 1024; - + int32 oldX = _cursor->getX(); int32 oldY = _cursor->getY(); diff --git a/backends/platform/sdl/psp2/psp2-main.cpp b/backends/platform/sdl/psp2/psp2-main.cpp index 0bdf0b34bc..70cc52388e 100644 --- a/backends/platform/sdl/psp2/psp2-main.cpp +++ b/backends/platform/sdl/psp2/psp2-main.cpp @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { scePowerSetBusClockFrequency(222); scePowerSetGpuClockFrequency(222); scePowerSetGpuXbarClockFrequency(166); - + // Create our OSystem instance g_system = new OSystem_PSP2(); assert(g_system); @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { // Free OSystem delete (OSystem_PSP2 *)g_system; - + #ifdef __PSP2_DEBUG__ psp2shell_exit(); #endif diff --git a/backends/platform/sdl/psp2/psp2.cpp b/backends/platform/sdl/psp2/psp2.cpp index 3034b6d886..80604a69d5 100644 --- a/backends/platform/sdl/psp2/psp2.cpp +++ b/backends/platform/sdl/psp2/psp2.cpp @@ -55,11 +55,11 @@ OSystem_PSP2::OSystem_PSP2(Common::String baseConfigName) } void OSystem_PSP2::init() { - + #if __PSP2_DEBUG__ gDebugLevel = 3; #endif - + // Initialze File System Factory sceIoMkdir("ux0:data", 0755); sceIoMkdir("ux0:data/scummvm", 0755); @@ -71,7 +71,7 @@ void OSystem_PSP2::init() { } void OSystem_PSP2::initBackend() { - + ConfMan.set("joystick_num", 0); ConfMan.registerDefault("fullscreen", true); ConfMan.registerDefault("aspect_ratio", false); @@ -105,7 +105,7 @@ void OSystem_PSP2::initBackend() { ConfMan.setBool("frontpanel_touchpad_mode", false); } - + // Create the savefile manager if (_savefileManager == 0) _savefileManager = new DefaultSaveFileManager("ux0:data/scummvm/saves"); diff --git a/backends/platform/sdl/riscos/riscos-main.cpp b/backends/platform/sdl/riscos/riscos-main.cpp index 2ff8294c1a..3f7058e3b8 100644 --- a/backends/platform/sdl/riscos/riscos-main.cpp +++ b/backends/platform/sdl/riscos/riscos-main.cpp @@ -29,7 +29,7 @@ #include "base/main.h" int main(int argc, char *argv[]) { - + // Create our OSystem instance g_system = new OSystem_RISCOS(); assert(g_system); diff --git a/backends/platform/sdl/riscos/riscos.cpp b/backends/platform/sdl/riscos/riscos.cpp index 0cdbceb902..73c0fdae03 100644 --- a/backends/platform/sdl/riscos/riscos.cpp +++ b/backends/platform/sdl/riscos/riscos.cpp @@ -101,4 +101,4 @@ Common::WriteStream *OSystem_RISCOS::createLogFile() { } #endif -
+ diff --git a/backends/platform/wii/osystem_events.cpp b/backends/platform/wii/osystem_events.cpp index 2499300a56..ae9c27f03b 100644 --- a/backends/platform/wii/osystem_events.cpp +++ b/backends/platform/wii/osystem_events.cpp @@ -228,7 +228,7 @@ bool OSystem_Wii::pollKeyboard(Common::Event &event) { keyboard_event kbdEvent; s32 res = KEYBOARD_GetEvent(&kbdEvent); - + if (!res) return false; diff --git a/common/hashmap.h b/common/hashmap.h index 56e80b89aa..1f93b68455 100644 --- a/common/hashmap.h +++ b/common/hashmap.h @@ -406,7 +406,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) { if (shrinkArray && _mask >= HASHMAP_MIN_CAPACITY) { delete[] _storage; - _mask = HASHMAP_MIN_CAPACITY; + _mask = HASHMAP_MIN_CAPACITY - 1; _storage = new Node *[HASHMAP_MIN_CAPACITY]; assert(_storage != nullptr); memset(_storage, 0, HASHMAP_MIN_CAPACITY * sizeof(Node *)); diff --git a/common/osd_message_queue.cpp b/common/osd_message_queue.cpp index b8abf18bb5..d150737165 100644 --- a/common/osd_message_queue.cpp +++ b/common/osd_message_queue.cpp @@ -26,18 +26,18 @@ namespace Common { DECLARE_SINGLETON(OSDMessageQueue); - + OSDMessageQueue::OSDMessageQueue() : _lastUpdate(0) { } OSDMessageQueue::~OSDMessageQueue() { g_system->getEventManager()->getEventDispatcher()->unregisterSource(this); } - + void OSDMessageQueue::registerEventSource() { g_system->getEventManager()->getEventDispatcher()->registerSource(this, false); } - + void OSDMessageQueue::addMessage(const char *msg) { _mutex.lock(); _messages.push(msg); diff --git a/common/osd_message_queue.h b/common/osd_message_queue.h index 7aa7cf4792..10fe96bc6a 100644 --- a/common/osd_message_queue.h +++ b/common/osd_message_queue.h @@ -38,9 +38,9 @@ class OSDMessageQueue : public Singleton<OSDMessageQueue>, public EventSource { public: OSDMessageQueue(); ~OSDMessageQueue(); - + void registerEventSource(); - + enum { kMinimumDelay = 1000 /** < Minimum delay between two OSD messages (in milliseconds) */ }; @@ -49,7 +49,7 @@ public: * Add a message to the OSD message queue. */ void addMessage(const char *msg); - + /** * Common::EventSource interface * diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp index ca6d4bf790..817eda3d20 100644 --- a/devtools/create_cryo/create_cryo_dat.cpp +++ b/devtools/create_cryo/create_cryo_dat.cpp @@ -93,7 +93,7 @@ static void emitStatic(FILE *f) { const int kNumCharacters = 20; const int kNumActionCursors = 299; const int kNumAreas = 12; - + for (int i = 0; i < kNumFollowers; i++) { writeLE<char>(f, followerList[i]._id); writeLE<char>(f, followerList[i]._spriteNum); @@ -105,13 +105,13 @@ static void emitStatic(FILE *f) { writeLE<int16>(f, followerList[i].ff_C); writeLE<int16>(f, followerList[i].ff_E); } - + fwrite(kLabyrinthPath, 1, kNumLabyrinthPath, f); fwrite(kDinoSpeedForCitaLevel, 1, kNumDinoSpeedForCitaLevel, f); fwrite(kTabletView, 1, kNumTabletView, f); fwrite(kPersoRoomBankTable, 1, kNumPersoRoomBankTable, f); fwrite(gotos, 5, kNumGotos, f); // sizeof(Goto) - + for (int i = 0; i < kNumObjects; i++) { writeLE<byte>(f, _objects[i]._id); writeLE<byte>(f, _objects[i]._flags); @@ -120,11 +120,11 @@ static void emitStatic(FILE *f) { writeLE<uint16>(f, _objects[i]._powerMask); writeLE<int16>(f, _objects[i]._count); } - + for (int i = 0; i < kNumObjectLocations; i++) { writeLE<uint16>(f, kObjectLocations[i]); } - + for (int i = 0; i < kNumPersons; i++) { writeLE<uint16>(f, kPersons[i]._roomNum); writeLE<uint16>(f, kPersons[i]._actionId); @@ -140,7 +140,7 @@ static void emitStatic(FILE *f) { writeLE<byte>(f, kPersons[i]._speed); writeLE<byte>(f, kPersons[i]._steps); } - + for (int i = 0; i < kNumCitadel; i++) { writeLE<int16>(f, _citadelList[i]._id); for (int j = 0; j < 8; j++) @@ -148,16 +148,16 @@ static void emitStatic(FILE *f) { for (int j = 0; j < 8; j++) writeLE<int16>(f, _citadelList[i]._video[j]); } - + for (int i = 0; i < kNumCharacterRects; i++) { writeLE<int16>(f, _characterRects[i].left); writeLE<int16>(f, _characterRects[i].top); writeLE<int16>(f, _characterRects[i].right); writeLE<int16>(f, _characterRects[i].bottom); } - + fwrite(_characterArray, 5, kNumCharacters, f); - + for (int i = 0; i < kNumAreas; i++) { writeLE<byte>(f, kAreasTable[i]._num); writeLE<byte>(f, kAreasTable[i]._type); @@ -168,15 +168,15 @@ static void emitStatic(FILE *f) { // pointer to _citadelRoomPtr is always initialized to null writeLE<int16>(f, kAreasTable[i]._visitCount); } - + for (int i = 0; i < 64; i++) { writeLE<uint16>(f, tab_2CEF0[i]); } - + for (int i = 0; i < 64; i++) { writeLE<uint16>(f, tab_2CF70[i]); } - + fwrite(kActionCursors, 1, kNumActionCursors, f); fwrite(mapMode, 1, 12, f); fwrite(cubeTextureCoords, 6 * 2 * 3 * 2, 3, f); @@ -193,11 +193,11 @@ static int emitData(char *outputFilename) { fwrite("CRYODATA", 8, 1, f); writeLE<uint32>(f, CRYO_DAT_VER); - + emitIcons(f); emitRooms(f); emitStatic(f); - + fclose(f); printf("Done!\n"); diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index c0cc8af87c..cbf30adae8 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -300,7 +300,7 @@ int main(int argc, char *argv[]) { for (EngineDescList::iterator j = setup.engines.begin(); j != setup.engines.end(); ++j) j->enable = false; } - + // Disable engines for which we are missing dependencies for (EngineDescList::const_iterator i = setup.engines.begin(); i != setup.engines.end(); ++i) { if (i->enable) { diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 9f662ae806..fc3df8154a 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -86,7 +86,7 @@ struct EngineDesc { * Whether the engine should be included in the build or not. */ bool enable; - + /** * Features required for this engine. */ diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index eb87dbb5d3..a5e813a977 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -1152,7 +1152,7 @@ void writeResource(const char *sectionStr, uint32 resId, bool isEnglish = true) sprintf(nameBuffer, "%s/%u", sectionStr, resId); if (!isEnglish) strcat(nameBuffer, "/DE"); - + writeResource(nameBuffer, sectionStr, resId, isEnglish); } diff --git a/devtools/create_xeen/cc.h b/devtools/create_xeen/cc.h index 3220abb89e..db1bd1f0de 100644 --- a/devtools/create_xeen/cc.h +++ b/devtools/create_xeen/cc.h @@ -57,7 +57,7 @@ private: * Convert a resource name to it's equivalent hash key */ uint16 convertNameToId(const Common::String &resourceName); - + /** * Loads an index from the file */ diff --git a/devtools/create_xeen/map.cpp b/devtools/create_xeen/map.cpp index 6ca1987a7a..35435426b9 100644 --- a/devtools/create_xeen/map.cpp +++ b/devtools/create_xeen/map.cpp @@ -125,7 +125,7 @@ void writeMazeName(CCArchive &cc) { memset(mazeName, 0, 33); strcpy(mazeName, "ScummVM"); f.write(mazeName, 33); - + cc.add("xeenx255.txt", f); } @@ -134,7 +134,7 @@ void writeMazeName(CCArchive &cc) { */ void writeMazeEvents(CCArchive &cc) { Common::MemFile f; - + // Mirror events const byte MIRROR_EVENTS[32] = { 6, 7, 0, 2, 0, 40, 1, // Play VOC: "Where to?" @@ -143,7 +143,7 @@ void writeMazeEvents(CCArchive &cc) { 8, 7, 0, 2, 3, 7, 0, 0, 0 // Teleport and exit }; f.write(MIRROR_EVENTS, 32); - + // Bench 1 events const byte BENCH1_EVENTS[32] = { 10, 7, 8, 0, 0, 5, 1, 2, 3, 1, 2, // NPC diff --git a/engines/bladerunner/actor_combat.h b/engines/bladerunner/actor_combat.h index 2f65f1904d..8f36445008 100644 --- a/engines/bladerunner/actor_combat.h +++ b/engines/bladerunner/actor_combat.h @@ -66,7 +66,7 @@ public: void combatOff(); void tick(); - + void hitAttempt(); void save(SaveFileWriteStream &f); diff --git a/engines/bladerunner/fog.cpp b/engines/bladerunner/fog.cpp index c732b598c2..cb8235ba64 100644 --- a/engines/bladerunner/fog.cpp +++ b/engines/bladerunner/fog.cpp @@ -66,7 +66,7 @@ int Fog::readCommon(Common::ReadStream *stream) { void Fog::readAnimationData(Common::ReadStream *stream, int size) { _animatedParameters = stream->readUint32LE(); - + int floatCount = size / 4; _animationData = new float[floatCount]; for (int i = 0; i < floatCount; i++) { diff --git a/engines/bladerunner/item_pickup.h b/engines/bladerunner/item_pickup.h index 97d98ead36..0328bf428e 100644 --- a/engines/bladerunner/item_pickup.h +++ b/engines/bladerunner/item_pickup.h @@ -43,7 +43,7 @@ class ItemPickup { int _timeLeft; int _timeLast; Common::Rect _screenRect; - + public: ItemPickup(BladeRunnerEngine *vm); ~ItemPickup(); diff --git a/engines/chewy/chewy.cpp b/engines/chewy/chewy.cpp index 75c2a8d51b..81f8c7d03a 100644 --- a/engines/chewy/chewy.cpp +++ b/engines/chewy/chewy.cpp @@ -94,7 +94,7 @@ Common::Error ChewyEngine::run() { }*/ //_graphics->playVideo(0); - + _scene->change(0); //_sound->playSpeech(1); //_sound->playSound(1); diff --git a/engines/chewy/console.cpp b/engines/chewy/console.cpp index 65c4a681d6..af62bf017b 100644 --- a/engines/chewy/console.cpp +++ b/engines/chewy/console.cpp @@ -113,7 +113,7 @@ bool Console::Cmd_DrawImage(int argc, const char **argv) { Common::String filename = argv[1]; int resNum = atoi(argv[2]); - + _vm->_graphics->drawImage(filename, resNum); return false; diff --git a/engines/chewy/detection.cpp b/engines/chewy/detection.cpp index f6f66efba0..7b7f29f9e8 100644 --- a/engines/chewy/detection.cpp +++ b/engines/chewy/detection.cpp @@ -70,7 +70,7 @@ static const ChewyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, - + { // Chewy - ESC von F5 - German // Master version 1.1 (CHEWY.EXE - offset 0x8AB28) @@ -87,7 +87,7 @@ static const ChewyGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, }, - + { // Chewy - ESC von F5 - German // Master version 1.0 (CHEWY.EXE - offset 0x8AB10) diff --git a/engines/chewy/scene.cpp b/engines/chewy/scene.cpp index 11bb4b38cd..5398a8da12 100644 --- a/engines/chewy/scene.cpp +++ b/engines/chewy/scene.cpp @@ -138,7 +138,7 @@ void Scene::change(uint scene) { _curScene = scene; _vm->_cursor->setCursor(0); _vm->_cursor->showCursor(); - + loadSceneInfo(); draw(); } @@ -320,14 +320,14 @@ void Scene::loadSceneInfo() { _sceneInfo->roomInfo.picNum = indexFile.readByte(); _sceneInfo->roomInfo.autoMoveCount = indexFile.readByte(); _sceneInfo->roomInfo.loadTaf = indexFile.readByte(); - + _sceneInfo->roomInfo.tafName = ""; for (int i = 0; i < 14; i++) _sceneInfo->roomInfo.tafName += indexFile.readByte(); _sceneInfo->roomInfo.zoomFactor = indexFile.readByte(); indexFile.readByte(); // padding - + for (int i = 0; i < MAX_AUTOMOVE; i++) { _sceneInfo->autoMove[i].x = indexFile.readSint16LE(); _sceneInfo->autoMove[i].y = indexFile.readSint16LE(); diff --git a/engines/cryo/sound.cpp b/engines/cryo/sound.cpp index 68f067588f..95bf39eca9 100644 --- a/engines/cryo/sound.cpp +++ b/engines/cryo/sound.cpp @@ -1,113 +1,113 @@ -/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "cryo/sound.h"
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
-namespace Cryo {
-
-CSoundChannel::CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits) : _mixer(mixer), _sampleRate(sampleRate), _stereo(stereo) {
- _bufferFlags = is16bits ? (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS) : Audio::FLAG_UNSIGNED;
- if (stereo)
- _bufferFlags |= Audio::FLAG_STEREO;
- _audioStream = nullptr;
- _volumeLeft = _volumeRight = Audio::Mixer::kMaxChannelVolume;
-}
-
-CSoundChannel::~CSoundChannel() {
- stop();
- if (_audioStream)
- delete _audioStream;
-}
-
-void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue, bool buffering) {
- if (playNow)
- stop();
-
- if (!buffer || !size)
- return;
-
- if (!_audioStream)
- _audioStream = Audio::makeQueuingAudioStream(_sampleRate, _stereo);
-
- if (buffering) {
- byte *localBuffer = (byte*)malloc(size);
- memcpy(localBuffer, buffer, size);
- _audioStream->queueBuffer(localBuffer, size, DisposeAfterUse::YES, _bufferFlags);
- } else
- _audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags);
- if (playNow || playQueue)
- play();
-}
-
-void CSoundChannel::play() {
- if (!_audioStream)
- return;
- if (!_mixer->isSoundHandleActive(_soundHandle)) {
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
- applyVolumeChange();
- }
-}
-
-void CSoundChannel::stop() {
- if (_mixer->isSoundHandleActive(_soundHandle))
- _mixer->stopHandle(_soundHandle);
-
- if (_audioStream) {
- _audioStream->finish();
- delete _audioStream;
- _audioStream = nullptr;
- }
-}
-
-unsigned int CSoundChannel::numQueued() {
- return _audioStream ? _audioStream->numQueuedStreams() : 0;
-}
-
-unsigned int CSoundChannel::getVolume() {
- return (_volumeRight + _volumeLeft) / 2;
-}
-
-void CSoundChannel::setVolume(unsigned int volumeLeft, unsigned int volumeRight) {
- _volumeLeft = volumeLeft;
- _volumeRight = volumeRight;
- applyVolumeChange();
-}
-
-void CSoundChannel::setVolumeLeft(unsigned int volume) {
- setVolume(volume, _volumeRight);
-}
-
-void CSoundChannel::setVolumeRight(unsigned int volume) {
- setVolume(_volumeLeft, volume);
-}
-
-void CSoundChannel::applyVolumeChange() {
- unsigned int volume = (_volumeRight + _volumeLeft) / 2;
- int balance = (signed int)(_volumeRight - _volumeLeft) / 2;
- _mixer->setChannelVolume(_soundHandle, volume);
- _mixer->setChannelBalance(_soundHandle, balance);
-}
-
-}
+/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "cryo/sound.h" +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "audio/decoders/raw.h" + +namespace Cryo { + +CSoundChannel::CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits) : _mixer(mixer), _sampleRate(sampleRate), _stereo(stereo) { + _bufferFlags = is16bits ? (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS) : Audio::FLAG_UNSIGNED; + if (stereo) + _bufferFlags |= Audio::FLAG_STEREO; + _audioStream = nullptr; + _volumeLeft = _volumeRight = Audio::Mixer::kMaxChannelVolume; +} + +CSoundChannel::~CSoundChannel() { + stop(); + if (_audioStream) + delete _audioStream; +} + +void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue, bool buffering) { + if (playNow) + stop(); + + if (!buffer || !size) + return; + + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(_sampleRate, _stereo); + + if (buffering) { + byte *localBuffer = (byte*)malloc(size); + memcpy(localBuffer, buffer, size); + _audioStream->queueBuffer(localBuffer, size, DisposeAfterUse::YES, _bufferFlags); + } else + _audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags); + if (playNow || playQueue) + play(); +} + +void CSoundChannel::play() { + if (!_audioStream) + return; + if (!_mixer->isSoundHandleActive(_soundHandle)) { + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); + applyVolumeChange(); + } +} + +void CSoundChannel::stop() { + if (_mixer->isSoundHandleActive(_soundHandle)) + _mixer->stopHandle(_soundHandle); + + if (_audioStream) { + _audioStream->finish(); + delete _audioStream; + _audioStream = nullptr; + } +} + +unsigned int CSoundChannel::numQueued() { + return _audioStream ? _audioStream->numQueuedStreams() : 0; +} + +unsigned int CSoundChannel::getVolume() { + return (_volumeRight + _volumeLeft) / 2; +} + +void CSoundChannel::setVolume(unsigned int volumeLeft, unsigned int volumeRight) { + _volumeLeft = volumeLeft; + _volumeRight = volumeRight; + applyVolumeChange(); +} + +void CSoundChannel::setVolumeLeft(unsigned int volume) { + setVolume(volume, _volumeRight); +} + +void CSoundChannel::setVolumeRight(unsigned int volume) { + setVolume(_volumeLeft, volume); +} + +void CSoundChannel::applyVolumeChange() { + unsigned int volume = (_volumeRight + _volumeLeft) / 2; + int balance = (signed int)(_volumeRight - _volumeLeft) / 2; + _mixer->setChannelVolume(_soundHandle, volume); + _mixer->setChannelBalance(_soundHandle, balance); +} + +} diff --git a/engines/cryo/sound.h b/engines/cryo/sound.h index 72232cc4f1..ad5312f527 100644 --- a/engines/cryo/sound.h +++ b/engines/cryo/sound.h @@ -1,70 +1,70 @@ -/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#pragma once
-
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
-#include "cryo/cryolib.h"
-
-namespace Cryo {
-
-class CryoEngine;
-
-class CSoundChannel {
-private:
- Audio::Mixer *_mixer;
- Audio::QueuingAudioStream *_audioStream;
- Audio::SoundHandle _soundHandle;
- unsigned int _sampleRate;
- bool _stereo;
- unsigned int _bufferFlags;
-
- void applyVolumeChange();
-
-public:
- CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits = false);
- ~CSoundChannel();
-
- // Queue a new buffer, cancel any previously queued buffers if playNow is set
- void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true);
-
- // Play any queued buffers
- void play();
-
- // Stop playing and purge play queue
- void stop();
-
- // How many buffers in queue (including currently playing one)
- unsigned int numQueued();
-
- // Volume control
- int _volumeLeft, _volumeRight;
- unsigned int getVolume();
- void setVolume(unsigned int volumeLeft, unsigned int volumeRight);
- void setVolumeLeft(unsigned int volume);
- void setVolumeRight(unsigned int volume);
-};
-
-}
+/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#pragma once + +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "audio/decoders/raw.h" + +#include "cryo/cryolib.h" + +namespace Cryo { + +class CryoEngine; + +class CSoundChannel { +private: + Audio::Mixer *_mixer; + Audio::QueuingAudioStream *_audioStream; + Audio::SoundHandle _soundHandle; + unsigned int _sampleRate; + bool _stereo; + unsigned int _bufferFlags; + + void applyVolumeChange(); + +public: + CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits = false); + ~CSoundChannel(); + + // Queue a new buffer, cancel any previously queued buffers if playNow is set + void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true); + + // Play any queued buffers + void play(); + + // Stop playing and purge play queue + void stop(); + + // How many buffers in queue (including currently playing one) + unsigned int numQueued(); + + // Volume control + int _volumeLeft, _volumeRight; + unsigned int getVolume(); + void setVolume(unsigned int volumeLeft, unsigned int volumeRight); + void setVolumeLeft(unsigned int volume); + void setVolumeRight(unsigned int volume); +}; + +} diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index b8d9749052..c908b2e591 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -1596,7 +1596,7 @@ int yydebug; # define YYMAXDEPTH 10000 #endif - + #if YYERROR_VERBOSE @@ -1807,7 +1807,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) } } #endif /* YYERROR_VERBOSE */ - + /*-----------------------------------------------. | Release the memory associated to this symbol. | @@ -1839,7 +1839,7 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - + /* Prevent warnings from -Wmissing-prototypes. */ @@ -1896,7 +1896,7 @@ yyparse () #endif #endif { - + int yystate; int yyn; int yyresult; diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 7b0398367b..de7005275d 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -168,7 +168,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -225,7 +225,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -963,7 +963,7 @@ YY_DECL register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + #line 85 "engines/director/lingo/lingo-lex.l" @@ -1859,7 +1859,7 @@ static int yy_get_next_buffer (void) { register yy_state_type yy_current_state; register char *yy_cp; - + yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); @@ -1920,7 +1920,7 @@ static int yy_get_next_buffer (void) { int c; - + *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) @@ -1994,7 +1994,7 @@ static int yy_get_next_buffer (void) */ void yyrestart (FILE * input_file ) { - + if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = @@ -2011,7 +2011,7 @@ static int yy_get_next_buffer (void) */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - + /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); @@ -2057,7 +2057,7 @@ static void yy_load_buffer_state (void) YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -2084,7 +2084,7 @@ static void yy_load_buffer_state (void) */ void yy_delete_buffer (YY_BUFFER_STATE b ) { - + if ( ! b ) return; @@ -2100,7 +2100,7 @@ static void yy_load_buffer_state (void) #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ - + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -2109,7 +2109,7 @@ extern int isatty (int ); { int oerrno = errno; - + yy_flush_buffer(b ); b->yy_input_file = file; @@ -2125,7 +2125,7 @@ extern int isatty (int ); } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - + errno = oerrno; } @@ -2214,7 +2214,7 @@ void yypop_buffer_state (void) static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; - + if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this @@ -2227,9 +2227,9 @@ static void yyensure_buffer_stack (void) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2263,7 +2263,7 @@ static void yyensure_buffer_stack (void) YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) @@ -2299,7 +2299,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - + return yy_scan_bytes(yystr,strlen(yystr) ); } @@ -2315,7 +2315,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len YY_BUFFER_STATE b; char *buf; yy_size_t n, i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); @@ -2373,7 +2373,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int yyget_lineno (void) { - + return yylineno; } @@ -2416,7 +2416,7 @@ char *yyget_text (void) */ void yyset_lineno (int line_number ) { - + yylineno = line_number; } @@ -2477,7 +2477,7 @@ static int yy_init_globals (void) /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index e748583146..22b33e7bcc 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -176,7 +176,7 @@ void DirectorEngine::loadEXEv4(Common::SeekableReadStream *stream) { void DirectorEngine::loadEXEv5(Common::SeekableReadStream *stream) { uint32 ver = stream->readUint32LE(); - + if (ver != MKTAG('P', 'J', '9', '5')) error("Invalid projector tag found in v5 EXE [%s]", tag2str(ver)); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 042f1fb859..3fdb6636ec 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -2395,7 +2395,7 @@ bool ModalDemo::init(int counterDiff) { if (_clickedQuit == -1) return true; - g_system->openUrl("http://www.amazon.de/EuroVideo-Bildprogramm-GmbH-Full-Pipe/dp/B003TO51YE/ref=sr_1_1?ie=UTF8&s=videogames&qid=1279207213&sr=8-1"); + g_system->openUrl("http://www.amazon.de/EuroVideo-Bildprogramm-GmbH-Full-Pipe/dp/B003TO51YE/ref=sr_1_1"); g_fp->_gameContinue = false; diff --git a/engines/mohawk/riven_stacks/jspit.cpp b/engines/mohawk/riven_stacks/jspit.cpp index eeff81005b..b1f15a10c0 100644 --- a/engines/mohawk/riven_stacks/jspit.cpp +++ b/engines/mohawk/riven_stacks/jspit.cpp @@ -369,7 +369,7 @@ int JSpit::jspitElevatorLoop() { return 1; } } - + return 0; } diff --git a/engines/plumbers/plumbers.h b/engines/plumbers/plumbers.h index 5dbb337f92..430c696c6d 100644 --- a/engines/plumbers/plumbers.h +++ b/engines/plumbers/plumbers.h @@ -111,7 +111,7 @@ private: }; Common::Queue<Action> _actions; - + void loadImage(const Common::String &dirname, const Common::String &filename); void drawScreen(); diff --git a/engines/queen/detection.cpp b/engines/queen/detection.cpp index aed8b7dcb1..0ad1b8322c 100644 --- a/engines/queen/detection.cpp +++ b/engines/queen/detection.cpp @@ -422,6 +422,45 @@ static const QueenGameDescription gameDescriptions[] = { }, #endif + // GoG.com Release - German + { + { + "queen", + "Talkie", + AD_ENTRY1s("queen.1", "28f78dbec7e20f603a10c2f8ea889a5c", 108738717), + Common::DE_DEU, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GAMEOPTION_ALT_INTRO) + }, + }, + + // GoG.com Release - French + { + { + "queen", + "Talkie", + AD_ENTRY1s("queen.1", "67e3020f8a35e1df7b1c753b5aaa71e1", 97382620), + Common::FR_FRA, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GAMEOPTION_ALT_INTRO) + }, + }, + + // GoG.com Release - Italian + { + { + "queen", + "Talkie", + AD_ENTRY1s("queen.1", "2f72b715ed753cf905a37cdcc7ea611e", 98327801), + Common::IT_ITA, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GAMEOPTION_ALT_INTRO) + }, + }, + { AD_TABLE_END_MARKER } }; diff --git a/engines/sludge/detection.cpp b/engines/sludge/detection.cpp index a530a5c796..361d44b1e1 100644 --- a/engines/sludge/detection.cpp +++ b/engines/sludge/detection.cpp @@ -86,11 +86,11 @@ public: virtual const char *getName() const { return "Sludge Engine"; } - + virtual const char *getOriginalCopyright() const { return "Copyright (C) 2000-2014 Hungry Software and contributors"; } - + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Sludge::SludgeGameDescription *gd = (const Sludge::SludgeGameDescription *)desc; if (gd) { diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp index 589c95de3b..65833d1de8 100644 --- a/engines/testbed/graphics.cpp +++ b/engines/testbed/graphics.cpp @@ -601,7 +601,7 @@ TestExitStatus GFXtests::filteringMode() { return passed; } - + /** * Tests the aspect ratio correction by: drawing an ellipse, when corrected the ellipse should render to a circle */ diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp index 8d16289647..ced0c78ef1 100644 --- a/engines/titanic/game/chicken_dispensor.cpp +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -106,7 +106,7 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { bool CChickenDispensor::MovieEndMsg(CMovieEndMsg *msg) { int movieFrame = msg->_endFrame; - + if (movieFrame == 16) { // Dispensed a chicken _cursorId = CURSOR_HAND; diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp index 882325c08a..99ead2f8eb 100644 --- a/engines/titanic/sound/music_room_instrument.cpp +++ b/engines/titanic/sound/music_room_instrument.cpp @@ -77,7 +77,7 @@ CMusicRoomInstrument::CMusicRoomInstrument(CProjectItem *project, CSoundManager _gameObjects[0] = static_cast<CGameObject *>(_project->findByName("Tubular Bells")); _insStartTime = 0.4; break; - + case MV_SNAKE: _gameObjects[0] = static_cast<CGameObject *>(_project->findByName("Snake_Hammer")); _gameObjects[1] = static_cast<CGameObject *>(_project->findByName("Snake_Glass")); diff --git a/engines/titanic/star_control/base_stars.cpp b/engines/titanic/star_control/base_stars.cpp index 0fcf8a964f..00206b1a9d 100644 --- a/engines/titanic/star_control/base_stars.cpp +++ b/engines/titanic/star_control/base_stars.cpp @@ -462,7 +462,7 @@ void CBaseStars::draw4(CSurfaceArea *surfaceArea, CStarCamera *camera, CStarClos + vector._z * pose._row3._z + pose._vector._z; if (tempZ <= minVal) continue; - + tempY = vector._x * pose._row1._y + vector._y * pose._row2._y + vector._z * pose._row3._y + pose._vector._y; tempX = vector._x * pose._row1._x + vector._y * pose._row2._x + vector._z * pose._row3._x + pose._vector._x; total2 = tempY * tempY + tempX * tempX + tempZ * tempZ; diff --git a/engines/titanic/star_control/camera_auto_mover.cpp b/engines/titanic/star_control/camera_auto_mover.cpp index 71f7de85b2..d8808653eb 100644 --- a/engines/titanic/star_control/camera_auto_mover.cpp +++ b/engines/titanic/star_control/camera_auto_mover.cpp @@ -78,7 +78,7 @@ void CCameraAutoMover::calcSpeeds(int val1, int val2, float distance) { _field40 = nMoverTransitions-1; _field48 = nMoverTransitions-1; _field3C = (double)val2 * _field38; - + // Calculate the speeds for a graduated movement between stars double base = 0.0, total = 0.0, power = 4.0, baseInc = 0.03125; for (int idx = nMoverTransitions - 1; idx >= 0; --idx) { @@ -86,7 +86,7 @@ void CCameraAutoMover::calcSpeeds(int val1, int val2, float distance) { total += _speeds[idx]; base += baseInc; } - + for (int idx = 0; idx < nMoverTransitions; ++idx) { _speeds[idx] = _speeds[idx] * _field3C / total; } diff --git a/engines/titanic/star_control/frect.h b/engines/titanic/star_control/frect.h index 654c578cfd..d792eb69b4 100644 --- a/engines/titanic/star_control/frect.h +++ b/engines/titanic/star_control/frect.h @@ -41,7 +41,7 @@ public: * Returns true if the rects equal */ bool operator==(const FRect &p) const; - + /** * Returns true if the rects are not equal */ diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h index f2d27212fe..9d0c954765 100644 --- a/engines/titanic/star_control/star_camera.h +++ b/engines/titanic/star_control/star_camera.h @@ -234,7 +234,7 @@ public: * Lock in the first matched star marker */ bool lockMarker1(FVector v1, FVector v2, FVector v3); - + /** * Lock in the second matched star marker */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 8464262b31..7922a2f7f2 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -241,7 +241,7 @@ void CStarControl::doAction(StarControlAction action) { pet->starsSetReference(); break; } - + case STAR_FADE_IN: _view.fn3(true); break; diff --git a/engines/titanic/star_control/star_crosshairs.h b/engines/titanic/star_control/star_crosshairs.h index d60541c205..3d060fd91d 100644 --- a/engines/titanic/star_control/star_crosshairs.h +++ b/engines/titanic/star_control/star_crosshairs.h @@ -80,12 +80,12 @@ public: bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarCamera *camera); void fn2(CVideoSurface *surface, CStarField *starField, CStarMarkers *markers); - + /** * Increments the index for the number of matches */ void incMatches(); - + /** * Draw the crosshairs for a given star */ @@ -101,12 +101,12 @@ public: * Erase crosshairs for the most recently selected star */ void eraseCurrent(CSurfaceArea *surfaceArea); - + /** * Draw crosshairs at the given position */ void drawAt(const FPoint &pt, CSurfaceArea *surfaceArea); - + /** * Returns the position of the most recently selected star */ diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index bd3f8aecb6..3b1c3db2b5 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -78,17 +78,17 @@ public: void set2(int val); int get54() const; void set54(int val); - + /** * Gets the current display mode */ StarMode getMode() const; - + /** * Sets the display mode */ void setMode(StarMode mode); - + /** * Toggles whether the big box is visible */ diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 553195b0c7..241efbcde5 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -148,14 +148,14 @@ public: * Toggles between starfield and photo modes */ void toggleMode(); - + void fn11(); /** * Toggles whether the viewpoint box is visible in the starfield */ void toggleBox(); - + void fn13(); void fn14(); @@ -163,7 +163,7 @@ public: * Called when the photograph is used on the navigation computer */ void setHasReference(); - + /** * Handles locking in a star */ diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp index c879dc25e8..401f550bee 100644 --- a/engines/titanic/star_control/unmarked_camera_mover.cpp +++ b/engines/titanic/star_control/unmarked_camera_mover.cpp @@ -48,7 +48,7 @@ void CUnmarkedCameraMover::moveTo(const FVector &srcV, const FVector &destV, con void CUnmarkedCameraMover::transitionBetweenOrientations(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) { if (isLocked()) decLockCount(); - + FVector vector1 = v1; FVector vector2 = v2; FPose matrix1 = vector2.getFrameTransform(vector1); diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp index e368dfa317..d66ff423c6 100644 --- a/engines/titanic/star_control/viewport.cpp +++ b/engines/titanic/star_control/viewport.cpp @@ -178,7 +178,7 @@ void CViewport::randomizeOrientation() { FPose m1(X_AXIS, ranRotAngleX); FPose m2(Y_AXIS, ranRotAngleY); FPose m3(Z_AXIS, ranRotAngleZ); - + FPose s1(m1, m2); FPose s2(s1, m3); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 3b22a4fee2..ff439abe25 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -489,7 +489,7 @@ Graphics::ManagedSurface *AVISurface::duplicateTransparency() const { bool AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { if (g_vm->shouldQuit()) return false; - + // TODO: Fixes slight "jumping back" when rotating in place in Top Of Well // balcony between two elevators. Need a more generalized fix at some point if (_movieName == "z48.avi") diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 5daf399b04..0931d91806 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -190,7 +190,7 @@ void TitanicEngine::setRoomNames() { bool TitanicEngine::canLoadGameStateCurrently() { CGameManager *gameManager = _window->_gameManager; CScreenManager *screenMan = CScreenManager::_screenManagerPtr; - + if (!gameManager) // Allow loading from copyright screen and continue dialogs return true; diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 4f0b59c044..68b77d8b75 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -54,7 +54,7 @@ public: * End the speech */ void endSpeech(int val); - + /** * Called when a speech is finished, to signal to the associated character * that the speech is over diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index e9fc098749..0269e71cee 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -1,585 +1,585 @@ -/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "titanic/true_talk/tt_vocab.h"
-#include "titanic/true_talk/script_handler.h"
-#include "titanic/true_talk/tt_action.h"
-#include "titanic/true_talk/tt_adj.h"
-#include "titanic/true_talk/tt_major_word.h"
-#include "titanic/true_talk/tt_picture.h"
-#include "titanic/true_talk/tt_pronoun.h"
-#include "titanic/titanic.h"
-#include "titanic/translation.h"
-#include "common/file.h"
-
-namespace Titanic {
-
-TTvocab::TTvocab(VocabMode vocabMode): _headP(nullptr), _tailP(nullptr),
- _word(nullptr), _vocabMode(vocabMode) {
- load("STVOCAB");
-}
-
-TTvocab::~TTvocab() {
- if (_headP) {
- _headP->deleteSiblings();
- delete _headP;
- _headP = _tailP = nullptr;
- }
-}
-
-int TTvocab::load(const CString &name) {
- SimpleFile *file = g_vm->_exeResources._owner->openResource(name);
- int result = 0;
- bool skipFlag;
-
- while (!result && !file->eos()) {
- skipFlag = false;
- WordClass wordClass = (WordClass)file->readNumber();
- TTstring space(" ");
-
- switch (wordClass) {
- case WC_UNKNOWN: {
- if (_word)
- result = _word->readSyn(file);
- skipFlag = true;
- break;
- }
-
- case WC_ACTION: {
- TTaction *word = new TTaction(space, WC_UNKNOWN, 0, 0, 0);
- result = word->load(file);
- _word = word;
- break;
- }
-
- case WC_THING: {
- TTpicture *word = new TTpicture(space, WC_UNKNOWN, 0, 0, 0, 0, 0);
- result = word->load(file);
- _word = word;
- break;
- }
-
- case WC_ABSTRACT:
- case WC_ADVERB: {
- TTmajorWord *word = new TTmajorWord(space, WC_UNKNOWN, 0, 0);
- result = word->load(file, wordClass);
- _word = word;
- break;
- }
-
- case WC_ARTICLE:
- case WC_CONJUNCTION:
- case WC_PREPOSITION: {
- TTword *word = new TTword(space, WC_UNKNOWN, 0);
- result = word->load(file, wordClass);
- _word = word;
- break;
- }
-
- case WC_ADJECTIVE: {
- TTadj *word = new TTadj(space, WC_UNKNOWN, 0, 0, 0);
- result = word->load(file);
- _word = word;
- break;
- }
-
- case WC_PRONOUN: {
- TTpronoun *word = new TTpronoun(space, WC_UNKNOWN, 0, 0, 0);
- result = word->load(file);
- _word = word;
- break;
- }
-
- default:
- result = 4;
- break;
- }
-
- if (!skipFlag && _word) {
- if (result) {
- // Something wrong occurred, so delete word
- delete _word;
- _word = nullptr;
- } else {
- // Add the word to the master vocab list
- addWord(_word);
- }
- }
- }
-
- // Close resource and return result
- delete file;
- return result;
-}
-
-void TTvocab::addWord(TTword *word) {
- TTword *existingWord = g_language == Common::DE_DEU ? nullptr :
- findWord(word->_text);
-
- if (existingWord) {
- if (word->_synP) {
- // Move over the synonym
- existingWord->appendNode(word->_synP);
- word->_synP = nullptr;
- }
-
- _word = nullptr;
- if (word)
- delete word;
- } else if (_tailP) {
- _tailP->_nextP = word;
- _tailP = word;
- } else {
- if (!_headP)
- _headP = word;
-
- _tailP = word;
- }
-}
-
-TTword *TTvocab::findWord(const TTstring &str) {
- TTsynonym *tempNode = new TTsynonym();
- bool flag = false;
- TTword *word = _headP;
-
- while (word && !flag) {
- if (_vocabMode != VOCAB_MODE_EN || strcmp(word->c_str(), str)) {
- if (word->findSynByName(str, tempNode, _vocabMode))
- flag = true;
- else
- word = word->_nextP;
- } else {
- flag = true;
- }
- }
-
- delete tempNode;
- return word;
-}
-
-TTword *TTvocab::getWord(TTstring &str, TTword **srcWord) const {
- TTword *word = getPrimeWord(str, srcWord);
-
- if (!word) {
- TTstring tempStr(str);
- if (tempStr.size() > 2) {
- word = getSuffixedWord(tempStr, srcWord);
-
- if (!word)
- word = getPrefixedWord(tempStr, srcWord);
- }
- }
-
- return word;
-}
-
-TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const {
- TTsynonym tempSyn;
- char c = str.charAt(0);
- TTword *newWord = nullptr;
- TTword *vocabP;
-
- if (Common::isDigit(c)) {
- // Number
- vocabP = _headP;
- newWord = new TTword(str, WC_ABSTRACT, 300);
- } else {
- // Standard word
- for (vocabP = _headP; vocabP; vocabP = vocabP->_nextP) {
- if (_vocabMode == VOCAB_MODE_EN && !strcmp(str.c_str(), vocabP->c_str())) {
- newWord = vocabP->copy();
- newWord->_nextP = nullptr;
- newWord->setSyn(nullptr);
- break;
- } else if (vocabP->findSynByName(str, &tempSyn, _vocabMode)) {
- // Create a copy of the word and the found synonym
- TTsynonym *newSyn = new TTsynonym(tempSyn);
- newSyn->_nextP = newSyn->_priorP = nullptr;
- newWord = vocabP->copy();
- newWord->_nextP = nullptr;
- newWord->setSyn(newSyn);
- break;
- }
- }
- }
-
- if (srcWord)
- // Pass out the pointer to the original word
- *srcWord = vocabP;
-
- // Return the new copy of the word
- return newWord;
-}
-
-TTword *TTvocab::getSuffixedWord(TTstring &str, TTword **srcWord) const {
- TTstring tempStr(str);
- TTword *word = nullptr;
-
- if (g_language == Common::DE_DEU) {
- static const char *const SUFFIXES[11] = {
- "est", "em", "en", "er", "es", "et", "st",
- "s", "e", "n", "t"
- };
-
- for (int idx = 0; idx < 11; ++idx) {
- if (tempStr.hasSuffix(SUFFIXES[idx])) {
- tempStr.deleteSuffix(strlen(SUFFIXES[idx]));
- word = getPrimeWord(tempStr, srcWord);
- if (word)
- break;
- tempStr = str;
- }
- }
-
- if (word)
- word->setSynStr(str);
- return word;
- }
-
- if (tempStr.hasSuffix("s")) {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (!word) {
- if (!tempStr.hasSuffix("e")) {
- tempStr = str;
- } else {
- tempStr.deleteLastChar();
- word = getPrimeWord(tempStr);
- }
- }
-
- } else if (tempStr.hasSuffix("ing")) {
- tempStr.deleteSuffix(3);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == 1) {
- delete word;
- word = nullptr;
- } else {
- delete word;
- word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0);
- }
- } else {
- tempStr += "e";
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass != 1) {
- delete word;
- word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0);
- }
- } else {
- tempStr.deleteSuffix(2);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass != 1) {
- delete word;
- word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0);
- }
- } else {
- tempStr = str;
- }
- }
- }
-
- } else if (tempStr.hasSuffix("ed")) {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (!word) {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
- }
-
- if (word) {
- if (word->_wordClass == WC_ACTION) {
- TTaction *action = dynamic_cast<TTaction *>(word);
- assert(action);
- action->setVal(1);
- }
- } else {
- tempStr = str;
- }
-
- } else if (tempStr.hasSuffix("ly")) {
- tempStr.deleteSuffix(2);
- word = getPrimeWord(tempStr);
-
- if (word) {
- delete word;
- word = new TTword(str, WC_ADVERB, 0);
- } else {
- tempStr = str;
- }
-
- } else if (tempStr.hasSuffix("er")) {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- } else {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = dynamic_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- } else {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (word && word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = dynamic_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- }
- }
-
- } else if (tempStr.hasSuffix("est")) {
- tempStr.deleteSuffix(2);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- } else {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = dynamic_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- } else {
- tempStr.deleteSuffix(1);
- word = getPrimeWord(tempStr);
-
- if (word) {
- TTadj *adj = dynamic_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0) {
- adj->adjFn1(val1);
- }
- } else {
- if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
- }
- }
-
- } else if (tempStr.hasSuffix("s*")) {
- tempStr.deleteSuffix(2);
- word = getPrimeWord(tempStr);
-
- if (word) {
- if (word->_wordClass == WC_PRONOUN || word->_wordClass == WC_ADVERB) {
- delete word;
- TTstring isStr("is");
- word = getPrimeWord(isStr);
- } else {
- switch (word->_id) {
- case 200:
- if (word->proc10() == 2) {
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5);
- } else if (word->proc10() == 1) {
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 4);
- }
- break;
-
- case 201:
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5);
- break;
-
- case 202:
- case 203:
- if (word->proc10() == 2) {
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5);
- } else {
- int val = word->proc10() == 1 ? 0 : 4;
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, val);
- }
- break;
-
- case 204:
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 6);
- break;
-
- default:
- delete word;
- word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 0);
- break;
- }
- }
- }
- }
-
- if (word)
- word->setSynStr(str);
-
- return word;
-}
-
-TTword *TTvocab::getPrefixedWord(TTstring &str, TTword **srcWord) const {
- TTstring tempStr(str);
- TTword *word = nullptr;
- int prefixLen = 0;
-
- if (tempStr.hasPrefix("pre")) {
- prefixLen = 3;
- } else if (tempStr.hasPrefix("re") || tempStr.hasPrefix("co")) {
- prefixLen = 2;
- } else if (tempStr.hasPrefix("inter") || tempStr.hasPrefix("multi")) {
- prefixLen = 5;
- } else if (tempStr.hasPrefix("over") || tempStr.hasPrefix("post") || tempStr.hasPrefix("self")) {
- prefixLen = 4;
- }
-
- if (prefixLen) {
- // Known prefix found, so scan for word without prefix
- tempStr.deletePrefix(prefixLen);
- word = getPrimeWord(tempStr);
- if (word)
- tempStr = str;
-
- } else if (tempStr.hasPrefix("anti") || tempStr.hasPrefix("counter")) {
- prefixLen = tempStr[0] == 'a' ? 4 : 7;
-
- tempStr.deletePrefix(prefixLen);
- word = getPrimeWord(tempStr);
- if (!word)
- tempStr = str;
- else if (word->_wordClass == 8) {
- delete word;
- word = nullptr;
- }
-
- } else if (tempStr.hasPrefix("hyper") || tempStr.hasPrefix("super") ||
- tempStr.hasPrefix("ultra")) {
- tempStr.deletePrefix(5);
- word = getPrimeWord(tempStr);
-
- if (!word)
- tempStr = str;
- else if (word->_wordClass == WC_ADJECTIVE) {
- TTadj *adj = static_cast<TTadj *>(word);
- int val1 = word->proc15();
- int val2 = word->proc15();
-
- if (val2 < 5) {
- if (--val1 > 0)
- adj->adjFn1(val1);
- } else if (++val1 < 11) {
- adj->adjFn1(val1);
- }
- }
- }
-
- if (word) {
- // Set the original word on either the found word or synonym
- if (word->hasSynonyms())
- word->setSynStr(str);
- else
- word->_text = str;
- }
-
- return word;
-}
-
-} // End of namespace Titanic
+/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/true_talk/tt_vocab.h" +#include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_action.h" +#include "titanic/true_talk/tt_adj.h" +#include "titanic/true_talk/tt_major_word.h" +#include "titanic/true_talk/tt_picture.h" +#include "titanic/true_talk/tt_pronoun.h" +#include "titanic/titanic.h" +#include "titanic/translation.h" +#include "common/file.h" + +namespace Titanic { + +TTvocab::TTvocab(VocabMode vocabMode): _headP(nullptr), _tailP(nullptr), + _word(nullptr), _vocabMode(vocabMode) { + load("STVOCAB"); +} + +TTvocab::~TTvocab() { + if (_headP) { + _headP->deleteSiblings(); + delete _headP; + _headP = _tailP = nullptr; + } +} + +int TTvocab::load(const CString &name) { + SimpleFile *file = g_vm->_exeResources._owner->openResource(name); + int result = 0; + bool skipFlag; + + while (!result && !file->eos()) { + skipFlag = false; + WordClass wordClass = (WordClass)file->readNumber(); + TTstring space(" "); + + switch (wordClass) { + case WC_UNKNOWN: { + if (_word) + result = _word->readSyn(file); + skipFlag = true; + break; + } + + case WC_ACTION: { + TTaction *word = new TTaction(space, WC_UNKNOWN, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case WC_THING: { + TTpicture *word = new TTpicture(space, WC_UNKNOWN, 0, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case WC_ABSTRACT: + case WC_ADVERB: { + TTmajorWord *word = new TTmajorWord(space, WC_UNKNOWN, 0, 0); + result = word->load(file, wordClass); + _word = word; + break; + } + + case WC_ARTICLE: + case WC_CONJUNCTION: + case WC_PREPOSITION: { + TTword *word = new TTword(space, WC_UNKNOWN, 0); + result = word->load(file, wordClass); + _word = word; + break; + } + + case WC_ADJECTIVE: { + TTadj *word = new TTadj(space, WC_UNKNOWN, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case WC_PRONOUN: { + TTpronoun *word = new TTpronoun(space, WC_UNKNOWN, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + default: + result = 4; + break; + } + + if (!skipFlag && _word) { + if (result) { + // Something wrong occurred, so delete word + delete _word; + _word = nullptr; + } else { + // Add the word to the master vocab list + addWord(_word); + } + } + } + + // Close resource and return result + delete file; + return result; +} + +void TTvocab::addWord(TTword *word) { + TTword *existingWord = g_language == Common::DE_DEU ? nullptr : + findWord(word->_text); + + if (existingWord) { + if (word->_synP) { + // Move over the synonym + existingWord->appendNode(word->_synP); + word->_synP = nullptr; + } + + _word = nullptr; + if (word) + delete word; + } else if (_tailP) { + _tailP->_nextP = word; + _tailP = word; + } else { + if (!_headP) + _headP = word; + + _tailP = word; + } +} + +TTword *TTvocab::findWord(const TTstring &str) { + TTsynonym *tempNode = new TTsynonym(); + bool flag = false; + TTword *word = _headP; + + while (word && !flag) { + if (_vocabMode != VOCAB_MODE_EN || strcmp(word->c_str(), str)) { + if (word->findSynByName(str, tempNode, _vocabMode)) + flag = true; + else + word = word->_nextP; + } else { + flag = true; + } + } + + delete tempNode; + return word; +} + +TTword *TTvocab::getWord(TTstring &str, TTword **srcWord) const { + TTword *word = getPrimeWord(str, srcWord); + + if (!word) { + TTstring tempStr(str); + if (tempStr.size() > 2) { + word = getSuffixedWord(tempStr, srcWord); + + if (!word) + word = getPrefixedWord(tempStr, srcWord); + } + } + + return word; +} + +TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { + TTsynonym tempSyn; + char c = str.charAt(0); + TTword *newWord = nullptr; + TTword *vocabP; + + if (Common::isDigit(c)) { + // Number + vocabP = _headP; + newWord = new TTword(str, WC_ABSTRACT, 300); + } else { + // Standard word + for (vocabP = _headP; vocabP; vocabP = vocabP->_nextP) { + if (_vocabMode == VOCAB_MODE_EN && !strcmp(str.c_str(), vocabP->c_str())) { + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(nullptr); + break; + } else if (vocabP->findSynByName(str, &tempSyn, _vocabMode)) { + // Create a copy of the word and the found synonym + TTsynonym *newSyn = new TTsynonym(tempSyn); + newSyn->_nextP = newSyn->_priorP = nullptr; + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(newSyn); + break; + } + } + } + + if (srcWord) + // Pass out the pointer to the original word + *srcWord = vocabP; + + // Return the new copy of the word + return newWord; +} + +TTword *TTvocab::getSuffixedWord(TTstring &str, TTword **srcWord) const { + TTstring tempStr(str); + TTword *word = nullptr; + + if (g_language == Common::DE_DEU) { + static const char *const SUFFIXES[11] = { + "est", "em", "en", "er", "es", "et", "st", + "s", "e", "n", "t" + }; + + for (int idx = 0; idx < 11; ++idx) { + if (tempStr.hasSuffix(SUFFIXES[idx])) { + tempStr.deleteSuffix(strlen(SUFFIXES[idx])); + word = getPrimeWord(tempStr, srcWord); + if (word) + break; + tempStr = str; + } + } + + if (word) + word->setSynStr(str); + return word; + } + + if (tempStr.hasSuffix("s")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (!word) { + if (!tempStr.hasSuffix("e")) { + tempStr = str; + } else { + tempStr.deleteLastChar(); + word = getPrimeWord(tempStr); + } + } + + } else if (tempStr.hasSuffix("ing")) { + tempStr.deleteSuffix(3); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == 1) { + delete word; + word = nullptr; + } else { + delete word; + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); + } + } else { + tempStr += "e"; + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass != 1) { + delete word; + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); + } + } else { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass != 1) { + delete word; + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); + } + } else { + tempStr = str; + } + } + } + + } else if (tempStr.hasSuffix("ed")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (!word) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + } + + if (word) { + if (word->_wordClass == WC_ACTION) { + TTaction *action = dynamic_cast<TTaction *>(word); + assert(action); + action->setVal(1); + } + } else { + tempStr = str; + } + + } else if (tempStr.hasSuffix("ly")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + delete word; + word = new TTword(str, WC_ADVERB, 0); + } else { + tempStr = str; + } + + } else if (tempStr.hasSuffix("er")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = dynamic_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word && word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = dynamic_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } + } + + } else if (tempStr.hasSuffix("est")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = dynamic_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + TTadj *adj = dynamic_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + adj->adjFn1(val1); + } + } else { + if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + } + } + + } else if (tempStr.hasSuffix("s*")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordClass == WC_PRONOUN || word->_wordClass == WC_ADVERB) { + delete word; + TTstring isStr("is"); + word = getPrimeWord(isStr); + } else { + switch (word->_id) { + case 200: + if (word->proc10() == 2) { + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); + } else if (word->proc10() == 1) { + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 4); + } + break; + + case 201: + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); + break; + + case 202: + case 203: + if (word->proc10() == 2) { + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); + } else { + int val = word->proc10() == 1 ? 0 : 4; + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, val); + } + break; + + case 204: + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 6); + break; + + default: + delete word; + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 0); + break; + } + } + } + } + + if (word) + word->setSynStr(str); + + return word; +} + +TTword *TTvocab::getPrefixedWord(TTstring &str, TTword **srcWord) const { + TTstring tempStr(str); + TTword *word = nullptr; + int prefixLen = 0; + + if (tempStr.hasPrefix("pre")) { + prefixLen = 3; + } else if (tempStr.hasPrefix("re") || tempStr.hasPrefix("co")) { + prefixLen = 2; + } else if (tempStr.hasPrefix("inter") || tempStr.hasPrefix("multi")) { + prefixLen = 5; + } else if (tempStr.hasPrefix("over") || tempStr.hasPrefix("post") || tempStr.hasPrefix("self")) { + prefixLen = 4; + } + + if (prefixLen) { + // Known prefix found, so scan for word without prefix + tempStr.deletePrefix(prefixLen); + word = getPrimeWord(tempStr); + if (word) + tempStr = str; + + } else if (tempStr.hasPrefix("anti") || tempStr.hasPrefix("counter")) { + prefixLen = tempStr[0] == 'a' ? 4 : 7; + + tempStr.deletePrefix(prefixLen); + word = getPrimeWord(tempStr); + if (!word) + tempStr = str; + else if (word->_wordClass == 8) { + delete word; + word = nullptr; + } + + } else if (tempStr.hasPrefix("hyper") || tempStr.hasPrefix("super") || + tempStr.hasPrefix("ultra")) { + tempStr.deletePrefix(5); + word = getPrimeWord(tempStr); + + if (!word) + tempStr = str; + else if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast<TTadj *>(word); + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) + adj->adjFn1(val1); + } else if (++val1 < 11) { + adj->adjFn1(val1); + } + } + } + + if (word) { + // Set the original word on either the found word or synonym + if (word->hasSynonyms()) + word->setSynStr(str); + else + word->_text = str; + } + + return word; +} + +} // End of namespace Titanic diff --git a/engines/xeen/dialogs/credits_screen.cpp b/engines/xeen/dialogs/credits_screen.cpp index 09547ba282..d0269ad716 100644 --- a/engines/xeen/dialogs/credits_screen.cpp +++ b/engines/xeen/dialogs/credits_screen.cpp @@ -28,7 +28,7 @@ namespace Xeen { void CreditsScreen::show(XeenEngine *vm) { CreditsScreen *dlg = new CreditsScreen(vm); - + switch (vm->getGameID()) { case GType_Clouds: dlg->execute(Res.CLOUDS_CREDITS); @@ -41,7 +41,7 @@ void CreditsScreen::show(XeenEngine *vm) { dlg->execute(Res.DARK_SIDE_CREDITS); break; } - + delete dlg; } diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 3cc8afe4bd..c1628da13f 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -209,7 +209,7 @@ void Interface::mainIconsPrint() { Windows &windows = *_vm->_windows; windows[38].close(); windows[12].close(); - + res._globalSprites.draw(0, 7, Common::Point(232, 74)); drawButtons(&windows[0]); windows[34].update(); diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index b4b57e75ee..5ae53d69c6 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -1603,7 +1603,7 @@ uint Party::getScore() { uint time = _vm->_events->playTime() / GAME_FRAME_RATE; int minutes = (time % 3600) / 60; int hours = time / 3600; - + score += minutes + (hours * 100); return score; } diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index 513b1b7986..58f2926e9c 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -32,7 +32,7 @@ Resources *g_resources; Resources::Resources() { g_resources = this; g_vm->_files->setGameCc(1); - + _globalSprites.load("global.icn"); if (g_vm->getGameID() == GType_Swords) _logoSprites.load("logo.int"); diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 96490c8937..82e294921b 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -272,7 +272,7 @@ bool SavesManager::loadGame() { bool SavesManager::saveGame() { Map &map = *g_vm->_map; - + if (map.mazeData()._mazeFlags & RESTRICTION_SAVE) { ErrorScroll::show(g_vm, Res.SAVE_OFF_LIMITS, WT_NONFREEZED_WAIT); return false; diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index ee55ffeeff..66e9013cda 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -479,7 +479,7 @@ bool Scripts::cmdTeleport(ParamsIterator ¶ms) { Sound &sound = *_vm->_sound; windows.closeAll(); - + bool restartFlag = _event->_opcode == OP_TeleportAndContinue; int mapId = params.readByte(); Common::Point pt; diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 9cd4b6f101..89b6bda250 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -278,7 +278,7 @@ private: * Moves the position of an object */ bool cmdMoveObj(ParamsIterator ¶ms); - + /** * Take or give amounts from various character or party figures */ @@ -319,13 +319,13 @@ private: * Gives up to three different item/amounts to various character and/or party properties */ bool cmdGiveMulti(ParamsIterator ¶ms); - + /** * Prompts the user to enter a word for passwords or mirror * teleport destinations */ bool cmdConfirmWord(ParamsIterator ¶ms); - + /** * Deals damage to a character */ diff --git a/engines/xeen/subtitles.h b/engines/xeen/subtitles.h index 37148dbc92..55c5faaa26 100644 --- a/engines/xeen/subtitles.h +++ b/engines/xeen/subtitles.h @@ -65,7 +65,7 @@ public: * Set which subtitle line to display */ void setLine(int line); - + /** * Resets subtitles, stopping any display */ diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp index 4192c4058a..fa0d3fac9b 100644 --- a/gui/editgamedialog.cpp +++ b/gui/editgamedialog.cpp @@ -384,35 +384,35 @@ void EditGameDialog::open() { void EditGameDialog::apply() { ConfMan.set("description", _descriptionWidget->getEditString(), _domain); - + Common::Language lang = (Common::Language)_langPopUp->getSelectedTag(); if (lang < 0) ConfMan.removeKey("language", _domain); else ConfMan.set("language", Common::getLanguageCode(lang), _domain); - + String gamePath(_gamePathWidget->getLabel()); if (!gamePath.empty()) ConfMan.set("path", gamePath, _domain); - + String extraPath(_extraPathWidget->getLabel()); if (!extraPath.empty() && (extraPath != _c("None", "path"))) ConfMan.set("extrapath", extraPath, _domain); else ConfMan.removeKey("extrapath", _domain); - + String savePath(_savePathWidget->getLabel()); if (!savePath.empty() && (savePath != _("Default"))) ConfMan.set("savepath", savePath, _domain); else ConfMan.removeKey("savepath", _domain); - + Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag(); if (platform < 0) ConfMan.removeKey("platform", _domain); else ConfMan.set("platform", Common::getPlatformCode(platform), _domain); - + // Set the state of engine-specific checkboxes for (uint i = 0; i < _engineOptions.size(); i++) { ConfMan.setBool(_engineOptions[i].configOption, _engineCheckboxes[i]->getState(), _domain); diff --git a/gui/options.h b/gui/options.h index b1666c2fff..bc58d7a63e 100644 --- a/gui/options.h +++ b/gui/options.h @@ -81,7 +81,7 @@ protected: ButtonWidget *_soundFontButton; StaticTextWidget *_soundFont; ButtonWidget *_soundFontClearButton; - + virtual void build(); virtual void clean(); void rebuild(); @@ -115,7 +115,7 @@ protected: int _pathsTabId; private: - + // // Control controls // @@ -143,7 +143,7 @@ private: CheckboxWidget *_aspectCheckbox; StaticTextWidget *_renderModePopUpDesc; PopUpWidget *_renderModePopUp; - + // // Shader controls // |