From 80be48c42d96d9c7292bea213cdc9e8ef0d3c6d6 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 11 Mar 2018 21:31:56 +0100 Subject: SUPERNOVA: Removes redundant keypress check GameManager::processInput() already does the job --- engines/supernova/supernova.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 50731ae52f..f8ae784fb0 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -231,10 +231,6 @@ void SupernovaEngine::updateEvents() { (event.kbd.flags & Common::KBD_CTRL)) { _console->attach(); } - if (event.kbd.keycode == Common::KEYCODE_x && - (event.kbd.flags & Common::KBD_CTRL)) { - // TODO: Draw exit box - } _gm->processInput(event.kbd); break; -- cgit v1.2.3 From bb46e53667c017442bd456b3da384bbf82ca1347 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 11 Mar 2018 21:57:17 +0100 Subject: SUPERNOVA: Processes all keyboard queries in processInput() --- engines/supernova/supernova.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index f8ae784fb0..c9f6abab7a 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -227,14 +227,8 @@ void SupernovaEngine::updateEvents() { switch (event.type) { case Common::EVENT_KEYDOWN: _gm->_keyPressed = true; - if (event.kbd.keycode == Common::KEYCODE_d && - (event.kbd.flags & Common::KBD_CTRL)) { - _console->attach(); - } - _gm->processInput(event.kbd); break; - case Common::EVENT_LBUTTONUP: // fallthrough case Common::EVENT_RBUTTONUP: @@ -249,7 +243,6 @@ void SupernovaEngine::updateEvents() { if (_gm->_guiEnabled) _gm->processInput(); break; - default: break; } -- cgit v1.2.3 From ff5426c609a4affc0cd96cff38211f949c614989 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 11 Mar 2018 22:07:13 +0100 Subject: SUPERNOVA: Moves updateEvents() to GameManager updatEvents() depends on an initalized GameManager instance and mostly manipulates its state. So it seemed fitting to move it over. --- engines/supernova/supernova.cpp | 71 +---------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index c9f6abab7a..c3e4223947 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -165,7 +165,7 @@ Common::Error SupernovaEngine::run() { while (!shouldQuit()) { uint32 start = _system->getMillis(); - updateEvents(); + _gm->updateEvents(); _gm->executeRoom(); _console->onFrame(); _system->updateScreen(); @@ -179,75 +179,6 @@ Common::Error SupernovaEngine::run() { return Common::kNoError; } -void SupernovaEngine::updateEvents() { - _gm->handleTime(); - if (_gm->_animationEnabled && !_messageDisplayed && _gm->_animationTimer == 0) - _gm->_currentRoom->animation(); - - if (_gm->_state._eventCallback != kNoFn && _gm->_state._time >= _gm->_state._eventTime) { - _allowLoadGame = false; - _allowSaveGame = false; - _gm->_state._eventTime = kMaxTimerValue; - EventFunction fn = _gm->_state._eventCallback; - _gm->_state._eventCallback = kNoFn; - switch (fn) { - case kNoFn: - break; - case kSupernovaFn: - _gm->supernovaEvent(); - break; - case kGuardReturnedFn: - _gm->guardReturnedEvent(); - break; - case kGuardWalkFn: - _gm->guardWalkEvent(); - break; - case kTaxiFn: - _gm->taxiEvent(); - break; - case kSearchStartFn: - _gm->searchStartEvent(); - break; - } - _allowLoadGame = true; - _allowSaveGame = true; - return; - } - - if (_gm->_state._alarmOn && _gm->_state._timeAlarm <= _gm->_state._time) { - _gm->_state._alarmOn = false; - _gm->alarm(); - return; - } - - _gm->_mouseClicked = false; - _gm->_keyPressed = false; - Common::Event event; - while (g_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - _gm->_keyPressed = true; - _gm->processInput(event.kbd); - break; - case Common::EVENT_LBUTTONUP: - // fallthrough - case Common::EVENT_RBUTTONUP: - if (_gm->_currentRoom->getId() != INTRO && _mixer->isSoundHandleActive(_soundHandle)) - return; - _gm->_mouseClicked = true; - // fallthrough - case Common::EVENT_MOUSEMOVE: - _gm->_mouseClickType = event.type; - _gm->_mouseX = event.mouse.x; - _gm->_mouseY = event.mouse.y; - if (_gm->_guiEnabled) - _gm->processInput(); - break; - default: - break; - } - } -} bool SupernovaEngine::hasFeature(EngineFeature f) const { switch (f) { -- cgit v1.2.3 From dc38d6a8cde47e634bc1c869dbbed476ae34017c Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 11 Mar 2018 23:13:36 +0100 Subject: SUPERNOVA: Renames _timer1 to _messageDuration --- engines/supernova/supernova.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index c3e4223947..248fb2a818 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -550,7 +550,7 @@ void SupernovaEngine::renderMessage(const char *text, MessagePosition position) } _messageDisplayed = true; - _gm->_timer1 = (Common::strnlen(text, 512) + 20) * _textSpeed / 10; + _gm->_messageDuration = (Common::strnlen(text, 512) + 20) * _textSpeed / 10; } void SupernovaEngine::removeMessage() { -- cgit v1.2.3 From 26543be637feee241812e40785b731a9eff86cdf Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Wed, 21 Mar 2018 12:14:24 +0100 Subject: SUPERNOVA: Adds sound abstraction --- engines/supernova/supernova.cpp | 44 +++++++++++++---------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 248fb2a818..7ac8d59245 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -42,6 +42,7 @@ #include "graphics/thumbnail.h" #include "gui/saveload.h" +#include "supernova/sound.h" #include "supernova/supernova.h" #include "supernova/state.h" @@ -130,6 +131,7 @@ SupernovaEngine::~SupernovaEngine() { delete _currentImage; delete _console; delete _gm; + delete _sound; delete _soundMusicIntro; delete _soundMusicOutro; } @@ -145,12 +147,13 @@ Common::Error SupernovaEngine::run() { if (status.getCode() != Common::kNoError) return status; - _gm = new GameManager(this); - _console = new Console(this, _gm); - initData(); initPalette(); + _sound = new Sound(this, _mixer); + _gm = new GameManager(this, _sound); + _console = new Console(this, _gm); + CursorMan.replaceCursor(_mouseNormal, 16, 16, 0, 0, kColorCursorTransparent); CursorMan.replaceCursorPalette(initVGAPalette, 0, 16); CursorMan.showMouse(true); @@ -174,7 +177,7 @@ Common::Error SupernovaEngine::run() { _system->delayMillis(end); } - stopSound(); + _mixer->stopAll(); return Common::kNoError; } @@ -283,8 +286,8 @@ void SupernovaEngine::initData() { file.close(); } - _soundMusicIntro = convertToMod("msn_data.049"); - _soundMusicOutro = convertToMod("msn_data.052"); + _soundMusicIntro = convertToMod("msn_data.052"); + _soundMusicOutro = convertToMod("msn_data.049"); // Cursor const uint16 *bufferNormal = reinterpret_cast(mouseNormal); @@ -309,34 +312,15 @@ void SupernovaEngine::initPalette() { } void SupernovaEngine::playSound(AudioIndex sample) { - if (sample > kAudioNumSamples - 1) - return; - - Audio::SeekableAudioStream *audioStream = Audio::makeRawStream( - _soundSamples[sample]._buffer, _soundSamples[sample]._length, - 11931, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN, DisposeAfterUse::NO); - stopSound(); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, audioStream); + _sound->play(sample); } -void SupernovaEngine::stopSound() { - if (_mixer->isSoundHandleActive(_soundHandle)) - _mixer->stopHandle(_soundHandle); +void SupernovaEngine::stopAudio() { + _sound->stop(); } -void SupernovaEngine::playSoundMod(int filenumber) -{ - Audio::AudioStream *audioStream; - if (filenumber == 49) - audioStream = Audio::makeProtrackerStream(_soundMusicIntro); - else if (filenumber == 52) - audioStream = Audio::makeProtrackerStream(_soundMusicOutro); - else - return; - - stopSound(); - _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, audioStream, - -1, Audio::Mixer::kMaxChannelVolume, 0); +void SupernovaEngine::playSound(MusicIndex index) { + _sound->play(index); } void SupernovaEngine::renderImageSection(int section) { -- cgit v1.2.3 From 32877639d7bef9fe60f19717561d68d7656ad820 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Wed, 21 Mar 2018 12:19:47 +0100 Subject: SUPERNOVA: Adds init function to SupernovaEngine --- engines/supernova/supernova.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 7ac8d59245..641801cdfa 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -137,6 +137,25 @@ SupernovaEngine::~SupernovaEngine() { } Common::Error SupernovaEngine::run() { + init(); + + while (!shouldQuit()) { + uint32 start = _system->getMillis(); + _gm->updateEvents(); + _gm->executeRoom(); + _console->onFrame(); + _system->updateScreen(); + int end = _delay - (_system->getMillis() - start); + if (end > 0) + _system->delayMillis(end); + } + + _mixer->stopAll(); + + return Common::kNoError; +} + +void SupernovaEngine::init() { Graphics::ModeList modes; modes.push_back(Graphics::Mode(320, 200)); modes.push_back(Graphics::Mode(640, 480)); @@ -145,7 +164,7 @@ Common::Error SupernovaEngine::run() { Common::Error status = loadGameStrings(); if (status.getCode() != Common::kNoError) - return status; + error("Failed reading game strings"); initData(); initPalette(); @@ -165,24 +184,8 @@ Common::Error SupernovaEngine::run() { if (loadGameState(saveSlot).getCode() != Common::kNoError) error("Failed to load save game from slot %i", saveSlot); } - - while (!shouldQuit()) { - uint32 start = _system->getMillis(); - _gm->updateEvents(); - _gm->executeRoom(); - _console->onFrame(); - _system->updateScreen(); - int end = _delay - (_system->getMillis() - start); - if (end > 0) - _system->delayMillis(end); - } - - _mixer->stopAll(); - - return Common::kNoError; } - bool SupernovaEngine::hasFeature(EngineFeature f) const { switch (f) { case kSupportsRTL: -- cgit v1.2.3 From 07f5f34d42346fbe5bbe147d12a526e172433b08 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Wed, 21 Mar 2018 12:28:21 +0100 Subject: SUPERNOVA: Removes stopAudio() --- engines/supernova/supernova.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 641801cdfa..68650babba 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -318,10 +318,6 @@ void SupernovaEngine::playSound(AudioIndex sample) { _sound->play(sample); } -void SupernovaEngine::stopAudio() { - _sound->stop(); -} - void SupernovaEngine::playSound(MusicIndex index) { _sound->play(index); } -- cgit v1.2.3 From b2dc8d54240ba96a3329b94b3d28ea0cba2dd73c Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Fri, 23 Mar 2018 01:42:58 +0100 Subject: SUPERNOVA: Adds resource abstraction The resource abstraction includes loading of sound files and cursor graphics. --- engines/supernova/supernova.cpp | 275 +--------------------------------------- 1 file changed, 4 insertions(+), 271 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 68650babba..9410ce1f4d 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -20,7 +20,6 @@ * */ -#include "audio/mods/protracker.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/debug-channels.h" @@ -42,34 +41,13 @@ #include "graphics/thumbnail.h" #include "gui/saveload.h" +#include "supernova/resman.h" #include "supernova/sound.h" #include "supernova/supernova.h" #include "supernova/state.h" namespace Supernova { -const AudioInfo audioInfo[kAudioNumSamples] = { - {44, 0, -1}, - {45, 0, -1}, - {46, 0, 2510}, - {46, 2510, 4020}, - {46, 4020, -1}, - {47, 0, 24010}, - {47, 24010, -1}, - {48, 0, 2510}, - {48, 2510, 10520}, - {48, 10520, 13530}, - {48, 13530, -1}, - {50, 0, 12786}, - {50, 12786, -1}, - {51, 0, -1}, - {53, 0, -1}, - {54, 0, 8010}, - {54, 8010, 24020}, - {54, 24020, 30030}, - {54, 30030, 31040}, - {54, 31040, -1} -}; const Object Object::nullObject; @@ -102,8 +80,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) , _console(NULL) , _gm(NULL) , _currentImage(NULL) - , _soundMusicIntro(NULL) - , _soundMusicOutro(NULL) , _rnd("supernova") , _brightness(255) , _menuBrightness(255) @@ -132,8 +108,7 @@ SupernovaEngine::~SupernovaEngine() { delete _console; delete _gm; delete _sound; - delete _soundMusicIntro; - delete _soundMusicOutro; + delete _resMan; } Common::Error SupernovaEngine::run() { @@ -166,17 +141,11 @@ void SupernovaEngine::init() { if (status.getCode() != Common::kNoError) error("Failed reading game strings"); - initData(); - initPalette(); - - _sound = new Sound(this, _mixer); + _resMan = new ResourceManager(this); + _sound = new Sound(_mixer, _resMan); _gm = new GameManager(this, _sound); _console = new Console(this, _gm); - CursorMan.replaceCursor(_mouseNormal, 16, 16, 0, 0, kColorCursorTransparent); - CursorMan.replaceCursorPalette(initVGAPalette, 0, 16); - CursorMan.showMouse(true); - setTotalPlayTime(0); int saveSlot = ConfMan.getInt("save_slot"); @@ -263,57 +232,6 @@ Common::Error SupernovaEngine::loadGameStrings() { return Common::kReadingFailed; } -void SupernovaEngine::initData() { - // Sound - // Note: - // - samples start with a header of 6 bytes: 01 SS SS 00 AD 00 - // where SS SS (LE uint16) is the size of the sound sample + 2 - // - samples end with a footer of 4 bytes: 00 00 - // Skip those in the buffer - Common::File file; - - for (int i = 0; i < kAudioNumSamples; ++i) { - if (!file.open(Common::String::format("msn_data.%03d", audioInfo[i]._filenumber))) { - error("File %s could not be read!", file.getName()); - } - - if (audioInfo[i]._offsetEnd == -1) { - file.seek(0, SEEK_END); - _soundSamples[i]._length = file.pos() - audioInfo[i]._offsetStart - 10; - } else { - _soundSamples[i]._length = audioInfo[i]._offsetEnd - audioInfo[i]._offsetStart - 10; - } - _soundSamples[i]._buffer = new byte[_soundSamples[i]._length]; - file.seek(audioInfo[i]._offsetStart + 6); - file.read(_soundSamples[i]._buffer, _soundSamples[i]._length); - file.close(); - } - - _soundMusicIntro = convertToMod("msn_data.052"); - _soundMusicOutro = convertToMod("msn_data.049"); - - // Cursor - const uint16 *bufferNormal = reinterpret_cast(mouseNormal); - const uint16 *bufferWait = reinterpret_cast(mouseWait); - for (uint i = 0; i < sizeof(mouseNormal) / 4; ++i) { - for (uint bit = 0; bit < 16; ++bit) { - uint mask = 0x8000 >> bit; - uint bitIndex = i * 16 + bit; - - _mouseNormal[bitIndex] = (READ_LE_UINT16(bufferNormal + i) & mask) ? kColorCursorTransparent : kColorBlack; - if (READ_LE_UINT16(bufferNormal + i + 16) & mask) - _mouseNormal[bitIndex] = kColorLightRed; - _mouseWait[bitIndex] = (READ_LE_UINT16(bufferWait + i) & mask) ? kColorCursorTransparent : kColorBlack; - if (READ_LE_UINT16(bufferWait + i + 16) & mask) - _mouseWait[bitIndex] = kColorLightRed; - } - } -} - -void SupernovaEngine::initPalette() { - _system->getPaletteManager()->setPalette(initVGAPalette, 0, 256); -} - void SupernovaEngine::playSound(AudioIndex sample) { _sound->play(sample); } @@ -781,191 +699,6 @@ bool SupernovaEngine::quitGameDialog() { return quit; } -Common::MemoryReadStream *SupernovaEngine::convertToMod(const char *filename, int version) { - // MSN format - struct { - uint16 seg; - uint16 start; - uint16 end; - uint16 loopStart; - uint16 loopEnd; - char volume; - char dummy[5]; - } instr2[22]; - int nbInstr2; // 22 for version1, 15 for version 2 - int16 songLength; - char arrangement[128]; - int16 patternNumber; - int32 note2[28][64][4]; - - nbInstr2 = ((version == 1) ? 22 : 15); - - Common::File msnFile; - msnFile.open(filename); - if (!msnFile.isOpen()) { - warning("Data file '%s' not found", msnFile.getName()); - return NULL; - } - - for (int i = 0 ; i < nbInstr2 ; ++i) { - instr2[i].seg = msnFile.readUint16LE(); - instr2[i].start = msnFile.readUint16LE(); - instr2[i].end = msnFile.readUint16LE(); - instr2[i].loopStart = msnFile.readUint16LE(); - instr2[i].loopEnd = msnFile.readUint16LE(); - instr2[i].volume = msnFile.readByte(); - msnFile.read(instr2[i].dummy, 5); - } - songLength = msnFile.readSint16LE(); - msnFile.read(arrangement, 128); - patternNumber = msnFile.readSint16LE(); - for (int p = 0 ; p < patternNumber ; ++p) { - for (int n = 0 ; n < 64 ; ++n) { - for (int k = 0 ; k < 4 ; ++k) { - note2[p][n][k] = msnFile.readSint32LE(); - } - } - } - - /* MOD format */ - struct { - char iname[22]; - uint16 length; - char finetune; - char volume; - uint16 loopStart; - uint16 loopLength; - } instr[31]; - int32 note[28][64][4]; - - // We can't recover some MOD effects since several of them are mapped to 0. - // Assume the MSN effect of value 0 is Arpeggio (MOD effect of value 0). - const char invConvEff[8] = {0, 1, 2, 3, 10, 12, 13 ,15}; - - // Reminder from convertToMsn - // 31 30 29 28 27 26 25 24 - 23 22 21 20 19 18 17 16 - 15 14 13 12 11 10 09 08 - 07 06 05 04 03 02 01 00 - // h h h h g g g g f f f f e e e e d d d d c c c c b b b b a a a a - // - // MSN: - // hhhh (4 bits) Cleared to 0 - // dddd c (5 bits) Sample index | after mapping through convInstr - // ccc (3 bits) Effect type | after mapping through convEff - // bbbb aaaa (8 bits) Effect value | unmodified - // gggg ffff eeee (12 bits) Sample period | unmodified - // - // MS2: - // hhhh (4 bits) Cleared to 0 - // dddd (4 bits) Sample index | after mapping through convInstr - // cccc (4 bits) Effect type | unmodified - // bbbb aaaa (8 bits) Effect value | unmodified - // gggg ffff eeee (12 bits) Sample period | transformed (0xE000 / p) - 256 - // - // MOD: - // hhhh dddd (8 bits) Sample index - // cccc (4 bits) Effect type for this channel/division - // bbbb aaaa (8 bits) Effect value - // gggg ffff eeee (12 bits) Sample period - - // Can we recover the instruments mapping? I don't think so as part of the original instrument index is cleared. - // And it doesn't really matter as long as we are consistent. - // However we need to make sure 31 (or 15 in MS2) is mapped to 0 in MOD. - // We just add 1 to all other values, and this means a 1 <-> 1 mapping for the instruments - for (int p = 0; p < patternNumber; ++p) { - for (int n = 0; n < 64; ++n) { - for (int k = 0; k < 4; ++k) { - int32* l = &(note[p][n][k]); - *l = note2[p][n][k]; - int32 i = 0; - if (nbInstr2 == 22) { // version 1 - i = ((*l & 0xF800) >> 11); - int32 e = ((*l & 0x0700) >> 8); - int32 e1 = invConvEff[e]; - *l &= 0x0FFF00FF; - *l |= (e1 << 8); - } else { // version 2 - int32 h = (*l >> 16); - i = ((*l & 0xF000) >> 12); - *l &= 0x00000FFF; - if (h) - h = 0xE000 / (h + 256); - *l |= (h << 16); - if (i == 15) - i = 31; - } - - // Add back index in note - if (i != 31) { - ++i; - *l |= ((i & 0x0F) << 12); - *l |= ((i & 0xF0) << 24); - } - } - } - } - - for (int i = 0; i < 31; ++i) { - // iname is not stored in the mod file. Just set it to 'instrument#' - // finetune is not stored either. Assume 0. - memset(instr[i].iname, 0, 22); - sprintf(instr[i].iname, "instrument%d", i+1); - instr[i].length = 0; - instr[i].finetune = 0; - instr[i].volume = 0; - instr[i].loopStart = 0; - instr[i].loopLength = 0; - - if (i < nbInstr2) { - instr[i].length = ((instr2[i].end - instr2[i].start) >> 1); - instr[i].loopStart = ((instr2[i].loopStart - instr2[i].start) >> 1); - instr[i].loopLength = (( instr2[i].loopEnd - instr2[i].loopStart) >> 1); - instr[i].volume = instr2[i].volume; - } - } - - // The ciaaSpeed is kind of useless and not present in the MSN file. - // Traditionally 0x78 in SoundTracker. Was used in NoiseTracker as a restart point. - // ProTracker uses 0x7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses 0x7F like ProTracker. - // You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types. - char ciaaSpeed = 0x7F; - - // The mark cannot be recovered either. Since we have 4 channels and 31 instrument it can be either ID='M.K.' or ID='4CHN'. - // Assume 'M.K.' - const char mark[4] = { 'M', '.', 'K', '.' }; - - Common::MemoryWriteStreamDynamic buffer(DisposeAfterUse::NO); - - buffer.write(msnFile.getName(), 19); - buffer.writeByte(0); - - for (int i = 0 ; i < 31 ; ++i) { - buffer.write(instr[i].iname, 22); - buffer.writeUint16BE(instr[i].length); - buffer.writeByte(instr[i].finetune); - buffer.writeByte(instr[i].volume); - buffer.writeUint16BE(instr[i].loopStart); - buffer.writeUint16BE(instr[i].loopLength); - } - buffer.writeByte((char)songLength); - buffer.writeByte(ciaaSpeed); - buffer.write(arrangement, 128); - buffer.write(mark, 4); - - for (int p = 0 ; p < patternNumber ; ++p) { - for (int n = 0 ; n < 64 ; ++n) { - for (int k = 0 ; k < 4 ; ++k) { -// buffer.writeUint32BE(*((uint32*)(note[p][n]+k))); - buffer.writeSint32BE(note[p][n][k]); - } - } - } - - uint nb; - char buf[4096]; - while ((nb = msnFile.read(buf, 4096)) > 0) - buffer.write(buf, nb); - - return new Common::MemoryReadStream(buffer.getData(), buffer.size(), DisposeAfterUse::YES); -} bool SupernovaEngine::canLoadGameStateCurrently() { return _allowLoadGame; -- cgit v1.2.3 From d963827dbb4282a7b39efca390bbc2fb58d4eee5 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Fri, 23 Mar 2018 02:16:01 +0100 Subject: SUPERNOVA: Renames MSNImageDecoder to MSNImage --- engines/supernova/supernova.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 9410ce1f4d..f109d010c6 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -312,7 +312,7 @@ bool SupernovaEngine::setCurrentImage(int filenumber) { return true; delete _currentImage; - _currentImage = new MSNImageDecoder(); + _currentImage = new MSNImage(); if (!_currentImage->init(filenumber)) { delete _currentImage; _currentImage = NULL; -- cgit v1.2.3 From 6187e251994270400b9e3b509871a9ab177bbc73 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Fri, 23 Mar 2018 02:22:10 +0100 Subject: SUPERNOVA: Renames NULL to nullptr --- engines/supernova/supernova.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index f109d010c6..ce2ec1d1ef 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -77,9 +77,9 @@ ObjectType &operator^=(ObjectType &a, ObjectType b) { SupernovaEngine::SupernovaEngine(OSystem *syst) : Engine(syst) - , _console(NULL) - , _gm(NULL) - , _currentImage(NULL) + , _console(nullptr) + , _gm(nullptr) + , _currentImage(nullptr) , _rnd("supernova") , _brightness(255) , _menuBrightness(255) @@ -315,7 +315,7 @@ bool SupernovaEngine::setCurrentImage(int filenumber) { _currentImage = new MSNImage(); if (!_currentImage->init(filenumber)) { delete _currentImage; - _currentImage = NULL; + _currentImage = nullptr; return false; } -- cgit v1.2.3 From ab208d107758837fbad1f75dd0de6edce05cd0bb Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sat, 24 Mar 2018 17:12:54 +0100 Subject: SUPERNOVA: Implements image buffering --- engines/supernova/supernova.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index ce2ec1d1ef..d1e1311a5a 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -104,7 +104,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) SupernovaEngine::~SupernovaEngine() { DebugMan.clearAllDebugChannels(); - delete _currentImage; delete _console; delete _gm; delete _sound; @@ -308,19 +307,10 @@ void SupernovaEngine::renderImage(int section) { } bool SupernovaEngine::setCurrentImage(int filenumber) { - if (_currentImage && _currentImage->_filenumber == filenumber) - return true; - - delete _currentImage; - _currentImage = new MSNImage(); - if (!_currentImage->init(filenumber)) { - delete _currentImage; - _currentImage = nullptr; - return false; - } - + _currentImage = _resMan->getImage(filenumber); _system->getPaletteManager()->setPalette(_currentImage->getPalette(), 16, 239); paletteBrightness(); + return true; } -- cgit v1.2.3 From 2ead17f09fb9c3c4af46cd86736fee654e6ad072 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 00:07:37 +0100 Subject: SUPERNOVA: Implements render functions Although SupernovaEngine forwards render calls to screen, it also exposed members publicly like _brightness. Therefore, a few changes were necessary in rooms and state. --- engines/supernova/supernova.cpp | 429 +++++++--------------------------------- 1 file changed, 75 insertions(+), 354 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index d1e1311a5a..d1921a8574 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -42,13 +42,13 @@ #include "gui/saveload.h" #include "supernova/resman.h" +#include "supernova/screen.h" #include "supernova/sound.h" #include "supernova/supernova.h" #include "supernova/state.h" namespace Supernova { - const Object Object::nullObject; ObjectType operator|(ObjectType a, ObjectType b) { @@ -79,25 +79,17 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) : Engine(syst) , _console(nullptr) , _gm(nullptr) - , _currentImage(nullptr) + , _sound(nullptr) + , _resMan(nullptr) + , _screen(nullptr) , _rnd("supernova") - , _brightness(255) - , _menuBrightness(255) , _delay(33) , _textSpeed(kTextSpeed[2]) - , _screenWidth(320) - , _screenHeight(200) - , _messageDisplayed(false) , _allowLoadGame(true) - , _allowSaveGame(true) -{ -// const Common::FSNode gameDataDir(ConfMan.get("path")); -// SearchMan.addSubDirectoryMatching(gameDataDir, "sound"); - + , _allowSaveGame(true) { if (ConfMan.hasKey("textspeed")) _textSpeed = ConfMan.getInt("textspeed"); - // setup engine specific debug channels DebugMan.addDebugChannel(kDebugGeneral, "general", "Supernova general debug channel"); } @@ -108,6 +100,7 @@ SupernovaEngine::~SupernovaEngine() { delete _gm; delete _sound; delete _resMan; + delete _screen; } Common::Error SupernovaEngine::run() { @@ -134,7 +127,7 @@ void SupernovaEngine::init() { modes.push_back(Graphics::Mode(320, 200)); modes.push_back(Graphics::Mode(640, 480)); initGraphicsModes(modes); - initGraphics(_screenWidth, _screenHeight); + initGraphics(320, 200); Common::Error status = loadGameStrings(); if (status.getCode() != Common::kNoError) @@ -143,6 +136,7 @@ void SupernovaEngine::init() { _resMan = new ResourceManager(this); _sound = new Sound(_mixer, _resMan); _gm = new GameManager(this, _sound); + _screen = new Screen(this, _gm, _resMan); _console = new Console(this, _gm); setTotalPlayTime(0); @@ -231,6 +225,20 @@ Common::Error SupernovaEngine::loadGameStrings() { return Common::kReadingFailed; } +const Common::String &SupernovaEngine::getGameString(int idx) const { + if (idx < 0 || idx >= (int)_gameStrings.size()) + return _nullString; + return _gameStrings[idx]; +} + +void SupernovaEngine::setGameString(int idx, const Common::String &string) { + if (idx < 0) + return; + while ((int)_gameStrings.size() <= idx) + _gameStrings.push_back(Common::String()); + _gameStrings[idx] = string; +} + void SupernovaEngine::playSound(AudioIndex sample) { _sound->play(sample); } @@ -240,348 +248,114 @@ void SupernovaEngine::playSound(MusicIndex index) { } void SupernovaEngine::renderImageSection(int section) { - // Note: inverting means we are removing the section. So we should get the rect for that - // section but draw the background (section 0) instead. - bool invert = false; - if (section > 128) { - section -= 128; - invert = true; - } - if (!_currentImage || section > _currentImage->_numSections - 1) - return; - - Common::Rect sectionRect(_currentImage->_section[section].x1, - _currentImage->_section[section].y1, - _currentImage->_section[section].x2 + 1, - _currentImage->_section[section].y2 + 1) ; - if (_currentImage->_filenumber == 1 || _currentImage->_filenumber == 2) { - sectionRect.setWidth(640); - sectionRect.setHeight(480); - if (_screenWidth != 640) { - _screenWidth = 640; - _screenHeight = 480; - initGraphics(_screenWidth, _screenHeight); - } - } else { - if (_screenWidth != 320) { - _screenWidth = 320; - _screenHeight = 200; - initGraphics(_screenWidth, _screenHeight); - } - } - - uint offset = 0; - int pitch = sectionRect.width(); - if (invert) { - pitch = _currentImage->_pitch; - offset = _currentImage->_section[section].y1 * pitch + _currentImage->_section[section].x1; - section = 0; - } - - _system->copyRectToScreen(static_cast(_currentImage->_sectionSurfaces[section]->getPixels()) + offset, - pitch, - sectionRect.left, sectionRect.top, - sectionRect.width(), sectionRect.height()); + _screen->renderImageSection(section); } void SupernovaEngine::renderImage(int section) { - if (!_currentImage) - return; - - bool sectionVisible = true; - - if (section > 128) { - sectionVisible = false; - section -= 128; - } - - _gm->_currentRoom->setSectionVisible(section, sectionVisible); - - do { - if (sectionVisible) - renderImageSection(section); - else - renderImageSection(section + 128); - section = _currentImage->_section[section].next; - } while (section != 0); + _screen->renderImage(section); } bool SupernovaEngine::setCurrentImage(int filenumber) { - _currentImage = _resMan->getImage(filenumber); - _system->getPaletteManager()->setPalette(_currentImage->getPalette(), 16, 239); - paletteBrightness(); - - return true; + _screen->setCurrentImage(filenumber); } void SupernovaEngine::saveScreen(int x, int y, int width, int height) { - _screenBuffer.push(x, y, width, height); + _screen->saveScreen(x, y, width, height); } void SupernovaEngine::saveScreen(const GuiElement &guiElement) { - saveScreen(guiElement.left, guiElement.top, guiElement.width(), guiElement.height()); + _screen->saveScreen(guiElement); } void SupernovaEngine::restoreScreen() { - _screenBuffer.restore(); + _screen->restoreScreen(); } void SupernovaEngine::renderRoom(Room &room) { - if (room.getId() == INTRO) - return; - - if (setCurrentImage(room.getFileNumber())) { - for (int i = 0; i < _currentImage->_numSections; ++i) { - int section = i; - if (room.isSectionVisible(section)) { - do { - renderImageSection(section); - section = _currentImage->_section[section].next; - } while (section != 0); - } - } - } + _screen->renderRoom(room); } -int SupernovaEngine::textWidth(const uint16 key) { - char text[2]; - text[0] = key & 0xFF; - text[1] = 0; - return textWidth(text); +void SupernovaEngine::renderMessage(const char *text, MessagePosition position) { + _screen->renderMessage(text, position); } -int SupernovaEngine::textWidth(const char *text) { - int charWidth = 0; - while (*text != '\0') { - byte c = *text++; - if (c < 32) { - continue; - } else if (c == 225) { - c = 35; - } - - for (uint i = 0; i < 5; ++i) { - if (font[c - 32][i] == 0xff) { - break; - } - ++charWidth; - } - ++charWidth; - } - - return charWidth; +void SupernovaEngine::renderMessage(const Common::String &text, MessagePosition position) { + _screen->renderMessage(text, position); } -void SupernovaEngine::renderMessage(const char *text, MessagePosition position) { - Common::String t(text); - char *row[20]; - Common::String::iterator p = t.begin(); - uint numRows = 0; - int rowWidthMax = 0; - int x = 0; - int y = 0; - byte textColor = 0; - - while (*p != '\0') { - row[numRows] = p; - ++numRows; - while ((*p != '\0') && (*p != '|')) { - ++p; - } - if (*p == '|') { - *p = '\0'; - ++p; - } - } - for (uint i = 0; i < numRows; ++i) { - int rowWidth = textWidth(row[i]); - if (rowWidth > rowWidthMax) - rowWidthMax = rowWidth; - } - - switch (position) { - case kMessageNormal: - x = 160 - rowWidthMax / 2; - textColor = kColorWhite99; - break; - case kMessageTop: - x = 160 - rowWidthMax / 2; - textColor = kColorLightYellow; - break; - case kMessageCenter: - x = 160 - rowWidthMax / 2; - textColor = kColorLightRed; - break; - case kMessageLeft: - x = 3; - textColor = kColorLightYellow; - break; - case kMessageRight: - x = 317 - rowWidthMax; - textColor = kColorLightGreen; - break; - } - - if (position == kMessageNormal) { - y = 70 - ((numRows * 9) / 2); - } else if (position == kMessageTop) { - y = 5; - } else { - y = 142; - } - - int message_columns = x - 3; - int message_rows = y - 3; - int message_width = rowWidthMax + 6; - int message_height = numRows * 9 + 5; - saveScreen(message_columns, message_rows, message_width, message_height); - renderBox(message_columns, message_rows, message_width, message_height, kColorWhite35); - for (uint i = 0; i < numRows; ++i) { - renderText(row[i], x, y, textColor); - y += 9; - } - - _messageDisplayed = true; - _gm->_messageDuration = (Common::strnlen(text, 512) + 20) * _textSpeed / 10; +void SupernovaEngine::renderMessage(StringID stringId, MessagePosition position, Common::String var1, Common::String var2) { + _screen->renderMessage(stringId, position, var1, var2); } void SupernovaEngine::removeMessage() { - if (_messageDisplayed) { - restoreScreen(); - _messageDisplayed = false; - } + _screen->removeMessage(); } -void SupernovaEngine::renderText(const char *text, int x, int y, byte color) { - Graphics::Surface *screen = _system->lockScreen(); - byte *cursor = static_cast(screen->getBasePtr(x, y)); - const byte *basePtr = cursor; - - byte c; - while ((c = *text++) != '\0') { - if (c < 32) { - continue; - } else if (c == 225) { - c = 128; - } +void SupernovaEngine::renderText(const uint16 character) { + _screen->renderText(character); +} - for (uint i = 0; i < 5; ++i) { - if (font[c - 32][i] == 0xff) { - break; - } +void SupernovaEngine::renderText(const char *text) { + _screen->renderText(text); +} - byte *ascentLine = cursor; - for (byte j = font[c - 32][i]; j != 0; j >>= 1) { - if (j & 1) { - *cursor = color; - } - cursor += kScreenWidth; - } - cursor = ++ascentLine; - } - ++cursor; - } - _system->unlockScreen(); +void SupernovaEngine::renderText(const Common::String &text) { + _screen->renderText(text); +} - uint numChars = cursor - basePtr; - uint absPosition = y * kScreenWidth + x + numChars; - _textCursorX = absPosition % kScreenWidth; - _textCursorY = absPosition / kScreenWidth; - _textColor = color; +void SupernovaEngine::renderText(StringID stringId) { + _screen->renderText(stringId); +} + +void SupernovaEngine::renderText(const GuiElement &guiElement) { + _screen->renderText(guiElement); } void SupernovaEngine::renderText(const uint16 character, int x, int y, byte color) { - char text[2]; - text[0] = character & 0xFF; - text[1] = 0; - renderText(text, x, y, color); + _screen->renderText(character, x, y, color); } -void SupernovaEngine::renderText(const char *text) { - renderText(text, _textCursorX, _textCursorY, _textColor); +void SupernovaEngine::renderText(const char *text, int x, int y, byte color) { + _screen->renderText(text, x, y, color); } -void SupernovaEngine::renderText(const uint16 character) { - char text[2]; - text[0] = character & 0xFF; - text[1] = 0; - renderText(text, _textCursorX, _textCursorY, _textColor); +void SupernovaEngine::renderText(const Common::String &text, int x, int y, byte color) { + _screen->renderText(text, x, y, color); } -void SupernovaEngine::renderText(const GuiElement &guiElement) { - renderText(guiElement.getText(), guiElement.getTextPos().x, - guiElement.getTextPos().y, guiElement.getTextColor()); + +void SupernovaEngine::renderText(StringID stringId, int x, int y, byte color) { + _screen->renderText(stringId, x, y, color); } void SupernovaEngine::renderBox(int x, int y, int width, int height, byte color) { - Graphics::Surface *screen = _system->lockScreen(); - screen->fillRect(Common::Rect(x, y, x + width, y + height), color); - _system->unlockScreen(); + _screen->renderBox(x, y, width, height, color); } void SupernovaEngine::renderBox(const GuiElement &guiElement) { - renderBox(guiElement.left, guiElement.top, guiElement.width(), - guiElement.height(), guiElement.getBackgroundColor()); + _screen->renderBox(guiElement); } void SupernovaEngine::paletteBrightness() { - byte palette[768]; - - _system->getPaletteManager()->grabPalette(palette, 0, 255); - for (uint i = 0; i < 48; ++i) { - palette[i] = (initVGAPalette[i] * _menuBrightness) >> 8; - } - for (uint i = 0; i < 717; ++i) { - const byte *imagePalette; - if (_currentImage && _currentImage->getPalette()) { - imagePalette = _currentImage->getPalette(); - } else { - imagePalette = palette + 48; - } - palette[i + 48] = (imagePalette[i] * _brightness) >> 8; - } - _system->getPaletteManager()->setPalette(palette, 0, 255); + _screen->paletteBrightness(); } void SupernovaEngine::paletteFadeOut() { - while (_menuBrightness > 10) { - _menuBrightness -= 10; - if (_brightness > _menuBrightness) - _brightness = _menuBrightness; - paletteBrightness(); - _system->updateScreen(); - _system->delayMillis(_delay); - } - _menuBrightness = 0; - _brightness = 0; - paletteBrightness(); - _system->updateScreen(); + _screen->paletteFadeOut(); } void SupernovaEngine::paletteFadeIn() { - while (_menuBrightness < 245) { - if (_brightness < _gm->_roomBrightness) - _brightness += 10; - _menuBrightness += 10; - paletteBrightness(); - _system->updateScreen(); - _system->delayMillis(_delay); - } - _menuBrightness = 255; - _brightness = _gm->_roomBrightness; - paletteBrightness(); - _system->updateScreen(); + _screen->paletteFadeIn(); } void SupernovaEngine::setColor63(byte value) { - byte color[3] = {value, value, value}; - _system->getPaletteManager()->setPalette(color, 63, 1); + _screen->setColor63(value); } void SupernovaEngine::setTextSpeed() { - const Common::String& textSpeedString = getGameString(kStringTextSpeed); - int stringWidth = textWidth(textSpeedString); - int textX = (320 - stringWidth) / 2; + const Common::String &textSpeedString = getGameString(kStringTextSpeed); + int stringWidth = Screen::textWidth(textSpeedString); + int textX = (kScreenWidth - stringWidth) / 2; int textY = 100; stringWidth += 4; - int boxX = stringWidth > 110 ? (320 - stringWidth) / 2 : 105; + int boxX = stringWidth > 110 ? (kScreenWidth - stringWidth) / 2 : 105; int boxY = 97; int boxWidth = stringWidth > 110 ? stringWidth : 110; int boxHeight = 27; @@ -743,10 +517,11 @@ bool SupernovaEngine::loadGame(int slot) { _gm->deserialize(savefile, saveVersion); if (saveVersion >= 5) { - _menuBrightness = savefile->readByte(); - _brightness = savefile->readByte(); + _screen->setGuiBrightness(savefile->readByte()); + _screen->setViewportBrightness(savefile->readByte()); } else { - _menuBrightness = _brightness = 255; + _screen->setGuiBrightness(255); + _screen->setViewportBrightness(255); } delete savefile; @@ -779,8 +554,8 @@ bool SupernovaEngine::saveGame(int slot, const Common::String &description) { Graphics::saveThumbnail(*savefile); _gm->serialize(savefile); - savefile->writeByte(_menuBrightness); - savefile->writeByte(_brightness); + savefile->writeByte(_screen->getGuiBrightness()); + savefile->writeByte(_screen->getViewportBrightness()); savefile->finalize(); delete savefile; @@ -795,59 +570,5 @@ void SupernovaEngine::errorTempSave(bool saving) { error("Unrecoverable error"); } -ScreenBufferStack::ScreenBufferStack() - : _last(_buffer) { -} - -void ScreenBufferStack::push(int x, int y, int width, int height) { - if (_last == ARRAYEND(_buffer)) - return; - - Graphics::Surface* screenSurface = g_system->lockScreen(); - - if (x < 0) { - width += x; - x = 0; - } - if (x + width > screenSurface->w) - width = screenSurface->w - x; - - if (y < 0) { - height += y; - y = 0; - } - if (y + height > screenSurface->h) - height = screenSurface->h - y; - - _last->_pixels = new byte[width * height]; - byte *pixels = _last->_pixels; - const byte *screen = static_cast(screenSurface->getBasePtr(x, y)); - for (int i = 0; i < height; ++i) { - Common::copy(screen, screen + width, pixels); - screen += screenSurface->pitch; - pixels += width; - } - g_system->unlockScreen(); - - _last->_x = x; - _last->_y = y; - _last->_width = width; - _last->_height = height; - - ++_last; -} - -void ScreenBufferStack::restore() { - if (_last == _buffer) - return; - - --_last; - g_system->lockScreen()->copyRectToSurface( - _last->_pixels, _last->_width, _last->_x, _last->_y, - _last->_width, _last->_height); - g_system->unlockScreen(); - - delete[] _last->_pixels; -} } -- cgit v1.2.3 From 6ea629f9446f6f1b44eafa619449d96b2870bcc7 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 01:08:26 +0100 Subject: SUPERNOVA: Moves VGA Palette to screenstatic.cpp --- engines/supernova/supernova.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index d1921a8574..36b57a93fa 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -133,7 +133,7 @@ void SupernovaEngine::init() { if (status.getCode() != Common::kNoError) error("Failed reading game strings"); - _resMan = new ResourceManager(this); + _resMan = new ResourceManager(); _sound = new Sound(_mixer, _resMan); _gm = new GameManager(this, _sound); _screen = new Screen(this, _gm, _resMan); -- cgit v1.2.3 From 5008e88d4bd4b3b211d714678b5ac2f238b6e7b8 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 01:14:32 +0100 Subject: SUPERNOVA: Fixes setCurrentImage --- engines/supernova/supernova.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 36b57a93fa..da88cc0054 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -256,7 +256,7 @@ void SupernovaEngine::renderImage(int section) { } bool SupernovaEngine::setCurrentImage(int filenumber) { - _screen->setCurrentImage(filenumber); + return _screen->setCurrentImage(filenumber); } void SupernovaEngine::saveScreen(int x, int y, int width, int height) { -- cgit v1.2.3 From 93dde5d2351c5735279d8867abf44364441c7ec1 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 04:00:05 +0200 Subject: SUPERNOVA: Renames Music/AudioIndex to Music/AudioId --- engines/supernova/supernova.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index da88cc0054..d9c6d6d392 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -239,11 +239,11 @@ void SupernovaEngine::setGameString(int idx, const Common::String &string) { _gameStrings[idx] = string; } -void SupernovaEngine::playSound(AudioIndex sample) { +void SupernovaEngine::playSound(AudioId sample) { _sound->play(sample); } -void SupernovaEngine::playSound(MusicIndex index) { +void SupernovaEngine::playSound(MusicId index) { _sound->play(index); } -- cgit v1.2.3 From 3749f98dea6eda097e14fbc2139498fba84bece1 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 06:06:56 +0200 Subject: SUPERNOVA: Fixes type camel case --- engines/supernova/supernova.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index d9c6d6d392..a2b34bd6c5 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -282,7 +282,7 @@ void SupernovaEngine::renderMessage(const Common::String &text, MessagePosition _screen->renderMessage(text, position); } -void SupernovaEngine::renderMessage(StringID stringId, MessagePosition position, Common::String var1, Common::String var2) { +void SupernovaEngine::renderMessage(StringId stringId, MessagePosition position, Common::String var1, Common::String var2) { _screen->renderMessage(stringId, position, var1, var2); } @@ -302,7 +302,7 @@ void SupernovaEngine::renderText(const Common::String &text) { _screen->renderText(text); } -void SupernovaEngine::renderText(StringID stringId) { +void SupernovaEngine::renderText(StringId stringId) { _screen->renderText(stringId); } @@ -322,7 +322,7 @@ void SupernovaEngine::renderText(const Common::String &text, int x, int y, byte _screen->renderText(text, x, y, color); } -void SupernovaEngine::renderText(StringID stringId, int x, int y, byte color) { +void SupernovaEngine::renderText(StringId stringId, int x, int y, byte color) { _screen->renderText(stringId, x, y, color); } -- cgit v1.2.3 From 0668f9d363afc3295cb4eb8227eecc126d996657 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sun, 25 Mar 2018 06:29:26 +0200 Subject: SUPERNOVA: Removes unused RNG instance --- engines/supernova/supernova.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index a2b34bd6c5..99bf77c653 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -82,7 +82,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) , _sound(nullptr) , _resMan(nullptr) , _screen(nullptr) - , _rnd("supernova") , _delay(33) , _textSpeed(kTextSpeed[2]) , _allowLoadGame(true) -- cgit v1.2.3 From a4ac8895daf33f2ee6955f1334b521b772d7dcca Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Mon, 26 Mar 2018 01:13:25 +0200 Subject: SUPERNOVA: Removes renderImageSection() from SupernovaEngine This function is never called by itself. It is a helper function for renderImage(). --- engines/supernova/supernova.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 99bf77c653..035238b3ac 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -246,10 +246,6 @@ void SupernovaEngine::playSound(MusicId index) { _sound->play(index); } -void SupernovaEngine::renderImageSection(int section) { - _screen->renderImageSection(section); -} - void SupernovaEngine::renderImage(int section) { _screen->renderImage(section); } -- cgit v1.2.3 From d4592b6077aebaf1630b05d1904723c6544d4537 Mon Sep 17 00:00:00 2001 From: Joseph-Eugene Winzer Date: Sat, 14 Apr 2018 11:40:08 +0200 Subject: SUPERNOVA: Removes global nullObject Before nullObject was a static member of Object class and now a member of GameManager. Also the Inventory constructor was extended for taking a pointer to the nullObject that Invetory::get() returns if no Object was found. --- engines/supernova/supernova.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/supernova/supernova.cpp') diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 035238b3ac..c47e476de7 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -49,8 +49,6 @@ namespace Supernova { -const Object Object::nullObject; - ObjectType operator|(ObjectType a, ObjectType b) { return static_cast(+a | +b); } -- cgit v1.2.3