aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-06-19 11:40:51 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commitee5b907f6279d8b28b799922ca11e2bbaaa72c46 (patch)
tree1c1a5495dd3d506c1d9746e29607a3df6400d3ee /engines
parentde4dac5693f53360e2a6c34d721ee2676028839b (diff)
downloadscummvm-rg350-ee5b907f6279d8b28b799922ca11e2bbaaa72c46.tar.gz
scummvm-rg350-ee5b907f6279d8b28b799922ca11e2bbaaa72c46.tar.bz2
scummvm-rg350-ee5b907f6279d8b28b799922ca11e2bbaaa72c46.zip
SUPERNOVA: Rearange supernova and supernova2 files
Rearange files so that similar code is in the same order in both engines.
Diffstat (limited to 'engines')
-rw-r--r--engines/supernova/screen.h1
-rw-r--r--engines/supernova/supernova.cpp18
-rw-r--r--engines/supernova2/graphics.cpp1
-rw-r--r--engines/supernova2/ms2_def.h2
-rw-r--r--engines/supernova2/resman.cpp34
-rw-r--r--engines/supernova2/resman.h2
-rw-r--r--engines/supernova2/screen.cpp14
-rw-r--r--engines/supernova2/screen.h2
-rw-r--r--engines/supernova2/sound.h3
-rw-r--r--engines/supernova2/state.cpp308
-rw-r--r--engines/supernova2/state.h3
-rw-r--r--engines/supernova2/supernova2.cpp22
12 files changed, 203 insertions, 207 deletions
diff --git a/engines/supernova/screen.h b/engines/supernova/screen.h
index bd135d85ae..3e90e21b1a 100644
--- a/engines/supernova/screen.h
+++ b/engines/supernova/screen.h
@@ -29,6 +29,7 @@
#include "supernova/imageid.h"
#include "supernova/msn_def.h"
+#include "supernova2/resman.h"
namespace Supernova {
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index c64755e4af..ba309e8b49 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -236,11 +236,13 @@ void SupernovaEngine::setGameString(int idx, const Common::String &string) {
}
void SupernovaEngine::playSound(AudioId sample) {
- _sound->play(sample);
+ if (!shouldQuit())
+ _sound->play(sample);
}
void SupernovaEngine::playSound(MusicId index) {
- _sound->play(index);
+ if (!shouldQuit())
+ _sound->play(index);
}
void SupernovaEngine::renderImage(int section) {
@@ -264,6 +266,7 @@ bool SupernovaEngine::setCurrentImage(int filenumber) {
void SupernovaEngine::saveScreen(int x, int y, int width, int height) {
_screen->saveScreen(x, y, width, height);
}
+
void SupernovaEngine::saveScreen(const GuiElement &guiElement) {
_screen->saveScreen(guiElement);
}
@@ -344,12 +347,15 @@ void SupernovaEngine::paletteBrightness() {
}
void SupernovaEngine::paletteFadeOut() {
- _screen->paletteFadeOut();
+ if (!shouldQuit())
+ _screen->paletteFadeOut();
}
void SupernovaEngine::paletteFadeIn() {
- _gm->roomBrightness();
- _screen->paletteFadeIn(_gm->_roomBrightness);
+ if (!shouldQuit()) {
+ _gm->roomBrightness();
+ _screen->paletteFadeIn(_gm->_roomBrightness);
+ }
}
void SupernovaEngine::setColor63(byte value) {
@@ -531,7 +537,6 @@ bool SupernovaEngine::quitGameDialog() {
guiQuitNo.setTextPosition(173, 112);
_gm->animationOff();
- _gm->saveTime();
saveScreen(guiQuitBox);
renderBox(guiQuitBox);
@@ -565,7 +570,6 @@ bool SupernovaEngine::quitGameDialog() {
_gm->resetInputState();
restoreScreen();
- _gm->loadTime();
_gm->animationOn();
return quit;
diff --git a/engines/supernova2/graphics.cpp b/engines/supernova2/graphics.cpp
index b629041cc9..0021534cd9 100644
--- a/engines/supernova2/graphics.cpp
+++ b/engines/supernova2/graphics.cpp
@@ -74,7 +74,6 @@ bool MS2Image::init(int filenumber) {
}
_filenumber = filenumber;
-
loadStream(file);
return true;
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
index 84f5cdde3a..c51d72d9e2 100644
--- a/engines/supernova2/ms2_def.h
+++ b/engines/supernova2/ms2_def.h
@@ -131,7 +131,7 @@ kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk,
kStringConversationEnd, kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen,
kStringStatusCommandClose, kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk,
kStringStatusCommandGive, kPhrasalVerbParticleGiveTo, kPhrasalVerbParticleUseWith, kString23, kString24,
-kString25, kString26, kString27, kStringTextSpeed, kString29,
+kString25, kString26, kString27, kStringTextSpeed, kStringLeaveGame,
kString30, kString31, kStringGenericInteract1, kStringGenericInteract2, kStringGenericInteract3,
kStringGenericInteract4, kStringGenericInteract5, kStringGenericInteract6, kStringGenericInteract7, kStringGenericInteract8,
kStringGenericInteract9, kStringGenericInteract10, kStringGenericInteract11, kStringGenericInteract12, kStringGenericInteract13,
diff --git a/engines/supernova2/resman.cpp b/engines/supernova2/resman.cpp
index f753277540..0cde229f2d 100644
--- a/engines/supernova2/resman.cpp
+++ b/engines/supernova2/resman.cpp
@@ -133,7 +133,6 @@ void ResourceManager::initSoundFiles() {
_musicIntroBuffer.reset(convertToMod("ms2_data.052"));
_musicMadMonkeysBuffer.reset(convertToMod("ms2_data.056"));
- _musicOutroBuffer.reset(convertToMod("ms2_data.049"));
}
void ResourceManager::initGraphics() {
@@ -185,9 +184,6 @@ Audio::AudioStream *ResourceManager::getSoundStream(MusicId index) {
case kMusicMadMonkeys:
_musicMadMonkeys.reset(Audio::makeProtrackerStream(_musicMadMonkeysBuffer.get()));
return _musicMadMonkeys.get();
- case kMusicOutro:
- _musicOutro.reset(Audio::makeProtrackerStream(_musicOutroBuffer.get()));
- return _musicOutro.get();
default:
error("Invalid music constant in playAudio()");
}
@@ -204,21 +200,6 @@ MS2Image *ResourceManager::getImage(int filenumber) {
return nullptr;
}
-int ResourceManager::getAudioRate() {
- return _audioRate;
-}
-
-const byte *ResourceManager::getCursor(CursorId id) const {
- switch (id) {
- case kCursorNormal:
- return _cursorNormal;
- case kCursorWait:
- return _cursorWait;
- default:
- return nullptr;
- }
-}
-
// Generate a tone which minimal length is the length and ends at the end
// of sine period
// NOTE: Size of the SineTable has to be the same as audioRate and a multiple of 4
@@ -446,5 +427,20 @@ static Common::MemoryReadStream *convertToMod(const char *filename, int version)
return new Common::MemoryReadStream(buffer.getData(), buffer.size(), DisposeAfterUse::YES);
}
+int ResourceManager::getAudioRate() {
+ return _audioRate;
+}
+
+const byte *ResourceManager::getCursor(CursorId id) const {
+ switch (id) {
+ case kCursorNormal:
+ return _cursorNormal;
+ case kCursorWait:
+ return _cursorWait;
+ default:
+ return nullptr;
+ }
+}
+
}
diff --git a/engines/supernova2/resman.h b/engines/supernova2/resman.h
index 6716bf53f1..d3fa460284 100644
--- a/engines/supernova2/resman.h
+++ b/engines/supernova2/resman.h
@@ -70,11 +70,9 @@ private:
Common::ScopedPtr<Audio::SeekableAudioStream> _soundSamples[kAudioNumSamples];
Common::ScopedPtr<Common::MemoryReadStream> _musicIntroBuffer;
Common::ScopedPtr<Common::MemoryReadStream> _musicMadMonkeysBuffer;
- Common::ScopedPtr<Common::MemoryReadStream> _musicOutroBuffer;
Common::ScopedPtr<Audio::AudioStream> _musicIntro;
Common::ScopedPtr<Audio::AudioStream> _sirenStream;
Common::ScopedPtr<Audio::AudioStream> _musicMadMonkeys;
- Common::ScopedPtr<Audio::AudioStream> _musicOutro;
int _audioRate;
MS2Image _images[kNumImageFiles];
byte _cursorNormal[256];
diff --git a/engines/supernova2/screen.cpp b/engines/supernova2/screen.cpp
index 60c2179638..fd2eabec19 100644
--- a/engines/supernova2/screen.cpp
+++ b/engines/supernova2/screen.cpp
@@ -195,13 +195,6 @@ Screen::Screen(Supernova2Engine *vm, ResourceManager *resMan)
changeCursor(ResourceManager::kCursorNormal);
}
-void Screen::changeCursor(ResourceManager::CursorId id) {
- CursorMan.replaceCursor(_resMan->getCursor(id),
- 16, 16, 0, 0, kColorCursorTransparent);
- CursorMan.replaceCursorPalette(initVGAPalette, 0, 16);
- CursorMan.showMouse(true);
-}
-
int Screen::getGuiBrightness() const {
return _guiBrightness;
}
@@ -639,4 +632,11 @@ void Screen::setColor63(byte value) {
_vm->_system->getPaletteManager()->setPalette(color, 63, 1);
}
+void Screen::changeCursor(ResourceManager::CursorId id) {
+ CursorMan.replaceCursor(_resMan->getCursor(id),
+ 16, 16, 0, 0, kColorCursorTransparent);
+ CursorMan.replaceCursorPalette(initVGAPalette, 0, 16);
+ CursorMan.showMouse(true);
+}
+
}
diff --git a/engines/supernova2/screen.h b/engines/supernova2/screen.h
index b5c3388017..21d5cf600b 100644
--- a/engines/supernova2/screen.h
+++ b/engines/supernova2/screen.h
@@ -137,7 +137,6 @@ public:
public:
Screen(Supernova2Engine *vm, ResourceManager *resMan);
- void changeCursor(ResourceManager::CursorId);
int getViewportBrightness() const;
void setViewportBrightness(int brightness);
int getGuiBrightness() const;
@@ -177,6 +176,7 @@ public:
byte getTextCursorColor();
void setTextCursorColor(byte color);
void update();
+ void changeCursor(ResourceManager::CursorId);
private:
void renderImageSection(const MS2Image *image, int section, bool invert);
diff --git a/engines/supernova2/sound.h b/engines/supernova2/sound.h
index 4b8f1b94c2..13ea4dd48c 100644
--- a/engines/supernova2/sound.h
+++ b/engines/supernova2/sound.h
@@ -55,8 +55,7 @@ enum AudioId {
enum MusicId {
kMusicIntro = 52,
- kMusicMadMonkeys = 56,
- kMusicOutro = 55
+ kMusicMadMonkeys = 56
};
class Sound {
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 41c092ef28..0a35090ac0 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -145,16 +145,6 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
return !in->err();
}
-StringId GameManager::guiCommands[] = {
- kStringCommandGo, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose,
- kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive
-};
-
-StringId GameManager::guiStatusCommands[] = {
- kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen, kStringStatusCommandClose,
- kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk, kStringStatusCommandGive
-};
-
void Inventory::add(Object &obj) {
if (_numObjects < kMaxCarry) {
_inventory[_numObjects++] = &obj;
@@ -206,6 +196,7 @@ Object *Inventory::get(ObjectId id) const {
return _nullObject;
}
+
GuiElement::GuiElement()
: _isHighlighted(false)
, _bgColorNormal(kColorWhite25)
@@ -254,9 +245,20 @@ void GuiElement::setHighlight(bool isHighlighted_) {
}
}
-GameManager::GameManager(Supernova2Engine *vm)
+StringId GameManager::guiCommands[] = {
+ kStringCommandGo, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose,
+ kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive
+};
+
+StringId GameManager::guiStatusCommands[] = {
+ kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen, kStringStatusCommandClose,
+ kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk, kStringStatusCommandGive
+};
+
+GameManager::GameManager(Supernova2Engine *vm, Sound *sound)
: _inventory(&_nullObject, _inventoryScroll)
, _vm(vm)
+ , _sound(sound)
, _mouseClickType(Common::EVENT_INVALID) {
initRooms();
changeRoom(INTRO);
@@ -594,14 +596,14 @@ void GameManager::processInput(Common::KeyState &state) {
// show game info
break;
case Common::KEYCODE_F4:
- //_vm->setTextSpeed();
+ _vm->setTextSpeed();
break;
case Common::KEYCODE_F5:
// load/save
break;
case Common::KEYCODE_x:
if (state.flags & Common::KBD_ALT) {
- //if (_vm->quitGameDialog())
+ if (_vm->quitGameDialog())
_vm->quitGame();
}
break;
@@ -827,146 +829,6 @@ bool GameManager::isNullObject(Object *obj) {
return obj == &_nullObject;
}
-void GameManager::screenShake() {
- for (int i = 0; i < 12; ++i) {
- _vm->_system->setShakePos(8);
- wait(1);
- _vm->_system->setShakePos(0);
- wait(1);
- }
-}
-
-void GameManager::showMenu() {
- _vm->renderBox(0, 138, 320, 62, 0);
- _vm->renderBox(0, 140, 320, 9, kColorWhite25);
- drawCommandBox();
- _vm->renderBox(281, 161, 39, 39, kColorWhite25);
- drawInventory();
-}
-
-void GameManager::drawMapExits() {
-// TODO: Preload _exitList on room entry instead on every call
- _vm->renderBox(281, 161, 39, 39, kColorWhite25);
-
- if ((_currentRoom >= _rooms[PYR_ENTRANCE] && _currentRoom <= _rooms[HOLE_ROOM]) ||
- (_currentRoom >= _rooms[FLOORDOOR] && _currentRoom <= _rooms[BST_DOOR]))
- compass();
- else {
- for (int i = 0; i < 25; i++)
- _exitList[i] = -1;
- for (int i = 0; i < kMaxObject; i++) {
- if (_currentRoom->getObject(i)->hasProperty(EXIT)) {
- byte r = _currentRoom->getObject(i)->_direction;
- _exitList[r] = i;
- int x = 284 + 7 * (r % 5);
- int y = 164 + 7 * (r / 5);
- _vm->renderBox(x, y, 5, 5, kColorDarkRed);
- }
- }
- }
-}
-
-void GameManager::animationOff() {
- _animationEnabled = false;
-}
-
-void GameManager::animationOn() {
- _animationEnabled = true;
-}
-
-void GameManager::edit(Common::String &input, int x, int y, uint length) {
- bool isEditing = true;
- uint cursorIndex = input.size();
- // NOTE: Pixels for char needed = kFontWidth + 2px left and right side bearing
- int overdrawWidth = ((int)((length + 1) * (kFontWidth + 2)) > (kScreenWidth - x)) ?
- kScreenWidth - x : (length + 1) * (kFontWidth + 2);
-
- _guiEnabled = false;
- while (isEditing) {
- _vm->_screen->setTextCursorPos(x, y);
- _vm->_screen->setTextCursorColor(kColorWhite99);
- _vm->renderBox(x, y - 1, overdrawWidth, 9, kColorWhite35);
- for (uint i = 0; i < input.size(); ++i) {
- // Draw char highlight depending on cursor position
- if (i == cursorIndex) {
- _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1,
- Screen::textWidth(input[i]), 9, kColorWhite99);
- _vm->_screen->setTextCursorColor(kColorWhite35);
- _vm->renderText(input[i]);
- _vm->_screen->setTextCursorColor(kColorWhite99);
- } else
- _vm->renderText(input[i]);
- }
-
- if (cursorIndex == input.size()) {
- _vm->renderBox(_vm->_screen->getTextCursorPos().x + 1, y - 1, 6, 9, kColorWhite35);
- _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1, 1, 9, kColorWhite99);
- }
-
- getKeyInput(true);
- if (_vm->shouldQuit())
- break;
- switch (_key.keycode) {
- case Common::KEYCODE_RETURN:
- case Common::KEYCODE_ESCAPE:
- isEditing = false;
- break;
- case Common::KEYCODE_UP:
- case Common::KEYCODE_DOWN:
- cursorIndex = input.size();
- break;
- case Common::KEYCODE_LEFT:
- if (cursorIndex != 0)
- --cursorIndex;
- break;
- case Common::KEYCODE_RIGHT:
- if (cursorIndex != input.size())
- ++cursorIndex;
- break;
- case Common::KEYCODE_DELETE:
- if (cursorIndex != input.size())
- input.deleteChar(cursorIndex);
- break;
- case Common::KEYCODE_BACKSPACE:
- if (cursorIndex != 0) {
- --cursorIndex;
- input.deleteChar(cursorIndex);
- }
- break;
- default:
- if (Common::isPrint(_key.ascii) && input.size() < length) {
- input.insertChar(_key.ascii, cursorIndex);
- ++cursorIndex;
- }
- break;
- }
- }
- _guiEnabled = true;
-}
-
-void GameManager::takeMoney(int amount) {
- _state._money += amount;
- _vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
-}
-
-void GameManager::drawStatus() {
- int index = static_cast<int>(_inputVerb);
- _vm->renderBox(0, 140, 320, 9, kColorWhite25);
- _vm->renderText(_vm->getGameString(guiStatusCommands[index]), 1, 141, kColorDarkGreen);
-
- if (isNullObject(_inputObject[0]))
- _vm->renderText(_currentInputObject->_name);
- else {
- _vm->renderText(_inputObject[0]->_name);
- if (_inputVerb == ACTION_GIVE)
- _vm->renderText(kPhrasalVerbParticleGiveTo);
- else if (_inputVerb == ACTION_USE)
- _vm->renderText(kPhrasalVerbParticleUseWith);
-
- _vm->renderText(_currentInputObject->_name);
- }
-}
-
void GameManager::sentence(int number, bool brightness) {
if (number < 0)
return;
@@ -1248,6 +1110,146 @@ void GameManager::pauseTimer(bool pause) {
}
}
+void GameManager::screenShake() {
+ for (int i = 0; i < 12; ++i) {
+ _vm->_system->setShakePos(8);
+ wait(1);
+ _vm->_system->setShakePos(0);
+ wait(1);
+ }
+}
+
+void GameManager::showMenu() {
+ _vm->renderBox(0, 138, 320, 62, 0);
+ _vm->renderBox(0, 140, 320, 9, kColorWhite25);
+ drawCommandBox();
+ _vm->renderBox(281, 161, 39, 39, kColorWhite25);
+ drawInventory();
+}
+
+void GameManager::drawMapExits() {
+// TODO: Preload _exitList on room entry instead on every call
+ _vm->renderBox(281, 161, 39, 39, kColorWhite25);
+
+ if ((_currentRoom >= _rooms[PYR_ENTRANCE] && _currentRoom <= _rooms[HOLE_ROOM]) ||
+ (_currentRoom >= _rooms[FLOORDOOR] && _currentRoom <= _rooms[BST_DOOR]))
+ compass();
+ else {
+ for (int i = 0; i < 25; i++)
+ _exitList[i] = -1;
+ for (int i = 0; i < kMaxObject; i++) {
+ if (_currentRoom->getObject(i)->hasProperty(EXIT)) {
+ byte r = _currentRoom->getObject(i)->_direction;
+ _exitList[r] = i;
+ int x = 284 + 7 * (r % 5);
+ int y = 164 + 7 * (r / 5);
+ _vm->renderBox(x, y, 5, 5, kColorDarkRed);
+ }
+ }
+ }
+}
+
+void GameManager::animationOff() {
+ _animationEnabled = false;
+}
+
+void GameManager::animationOn() {
+ _animationEnabled = true;
+}
+
+void GameManager::edit(Common::String &input, int x, int y, uint length) {
+ bool isEditing = true;
+ uint cursorIndex = input.size();
+ // NOTE: Pixels for char needed = kFontWidth + 2px left and right side bearing
+ int overdrawWidth = ((int)((length + 1) * (kFontWidth + 2)) > (kScreenWidth - x)) ?
+ kScreenWidth - x : (length + 1) * (kFontWidth + 2);
+
+ _guiEnabled = false;
+ while (isEditing) {
+ _vm->_screen->setTextCursorPos(x, y);
+ _vm->_screen->setTextCursorColor(kColorWhite99);
+ _vm->renderBox(x, y - 1, overdrawWidth, 9, kColorWhite35);
+ for (uint i = 0; i < input.size(); ++i) {
+ // Draw char highlight depending on cursor position
+ if (i == cursorIndex) {
+ _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1,
+ Screen::textWidth(input[i]), 9, kColorWhite99);
+ _vm->_screen->setTextCursorColor(kColorWhite35);
+ _vm->renderText(input[i]);
+ _vm->_screen->setTextCursorColor(kColorWhite99);
+ } else
+ _vm->renderText(input[i]);
+ }
+
+ if (cursorIndex == input.size()) {
+ _vm->renderBox(_vm->_screen->getTextCursorPos().x + 1, y - 1, 6, 9, kColorWhite35);
+ _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1, 1, 9, kColorWhite99);
+ }
+
+ getKeyInput(true);
+ if (_vm->shouldQuit())
+ break;
+ switch (_key.keycode) {
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_ESCAPE:
+ isEditing = false;
+ break;
+ case Common::KEYCODE_UP:
+ case Common::KEYCODE_DOWN:
+ cursorIndex = input.size();
+ break;
+ case Common::KEYCODE_LEFT:
+ if (cursorIndex != 0)
+ --cursorIndex;
+ break;
+ case Common::KEYCODE_RIGHT:
+ if (cursorIndex != input.size())
+ ++cursorIndex;
+ break;
+ case Common::KEYCODE_DELETE:
+ if (cursorIndex != input.size())
+ input.deleteChar(cursorIndex);
+ break;
+ case Common::KEYCODE_BACKSPACE:
+ if (cursorIndex != 0) {
+ --cursorIndex;
+ input.deleteChar(cursorIndex);
+ }
+ break;
+ default:
+ if (Common::isPrint(_key.ascii) && input.size() < length) {
+ input.insertChar(_key.ascii, cursorIndex);
+ ++cursorIndex;
+ }
+ break;
+ }
+ }
+ _guiEnabled = true;
+}
+
+void GameManager::takeMoney(int amount) {
+ _state._money += amount;
+ _vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
+}
+
+void GameManager::drawStatus() {
+ int index = static_cast<int>(_inputVerb);
+ _vm->renderBox(0, 140, 320, 9, kColorWhite25);
+ _vm->renderText(_vm->getGameString(guiStatusCommands[index]), 1, 141, kColorDarkGreen);
+
+ if (isNullObject(_inputObject[0]))
+ _vm->renderText(_currentInputObject->_name);
+ else {
+ _vm->renderText(_inputObject[0]->_name);
+ if (_inputVerb == ACTION_GIVE)
+ _vm->renderText(kPhrasalVerbParticleGiveTo);
+ else if (_inputVerb == ACTION_USE)
+ _vm->renderText(kPhrasalVerbParticleUseWith);
+
+ _vm->renderText(_currentInputObject->_name);
+ }
+}
+
void GameManager::dead(StringId messageId) {
_vm->paletteFadeOut();
_guiEnabled = false;
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
index 941cdef133..1851da50fc 100644
--- a/engines/supernova2/state.h
+++ b/engines/supernova2/state.h
@@ -135,7 +135,7 @@ private:
class GameManager {
public:
- GameManager(Supernova2Engine *vm);
+ GameManager(Supernova2Engine *vm, Sound *sound);
~GameManager();
void updateEvents();
@@ -148,6 +148,7 @@ public:
static StringId guiCommands[];
static StringId guiStatusCommands[];
Supernova2Engine *_vm;
+ Sound *_sound;
Common::KeyState _key;
Common::EventType _mouseClickType;
bool _mouseClicked;
diff --git a/engines/supernova2/supernova2.cpp b/engines/supernova2/supernova2.cpp
index e59f07d84a..938cfe6a52 100644
--- a/engines/supernova2/supernova2.cpp
+++ b/engines/supernova2/supernova2.cpp
@@ -42,12 +42,11 @@
#include "gui/saveload.h"
#include "supernova2/resman.h"
-#include "supernova2/sound.h"
#include "supernova2/screen.h"
+#include "supernova2/sound.h"
#include "supernova2/supernova2.h"
#include "supernova2/state.h"
-
namespace Supernova2 {
ObjectType operator|(ObjectType a, ObjectType b) {
@@ -90,7 +89,7 @@ Supernova2Engine::Supernova2Engine(OSystem *syst)
if (ConfMan.hasKey("textspeed"))
_textSpeed = ConfMan.getInt("textspeed");
- DebugMan.addDebugChannel(1 , "general", "Supernova 2 general debug channel");
+ DebugMan.addDebugChannel(kDebugGeneral , "general", "Supernova 2 general debug channel");
}
Supernova2Engine::~Supernova2Engine() {
@@ -118,6 +117,8 @@ Common::Error Supernova2Engine::run() {
_system->delayMillis(end);
}
+ _mixer->stopAll();
+
return Common::kNoError;
}
@@ -134,7 +135,7 @@ void Supernova2Engine::init() {
_resMan = new ResourceManager();
_sound = new Sound(_mixer, _resMan);
- _gm = new GameManager(this);
+ _gm = new GameManager(this, _sound);
_screen = new Screen(this, _resMan);
_console = new Console(this, _gm);
@@ -165,7 +166,6 @@ void Supernova2Engine::pauseEngineIntern(bool pause) {
_gm->pauseTimer(pause);
}
-
Common::Error Supernova2Engine::loadGameStrings() {
Common::String cur_lang = ConfMan.get("language");
Common::String string_id("TEXT");
@@ -364,7 +364,7 @@ void Supernova2Engine::setColor63(byte value) {
_screen->setColor63(value);
}
-/*void Supernova2Engine::setTextSpeed() {
+void Supernova2Engine::setTextSpeed() {
const Common::String &textSpeedString = getGameString(kStringTextSpeed);
int stringWidth = Screen::textWidth(textSpeedString);
int textX = (kScreenWidth - stringWidth) / 2;
@@ -376,7 +376,6 @@ void Supernova2Engine::setColor63(byte value) {
int boxHeight = 27;
_gm->animationOff();
- _gm->saveTime();
saveScreen(boxX, boxY, boxWidth, boxHeight);
renderBox(boxX, boxY, boxWidth, boxHeight, kColorBlue);
@@ -414,11 +413,10 @@ void Supernova2Engine::setColor63(byte value) {
_gm->resetInputState();
restoreScreen();
- _gm->loadTime();
_gm->animationOn();
-}*/
+}
-/*bool Supernova2Engine::quitGameDialog() {
+bool Supernova2Engine::quitGameDialog() {
bool quit = false;
GuiElement guiQuitBox;
@@ -438,7 +436,6 @@ void Supernova2Engine::setColor63(byte value) {
guiQuitNo.setTextPosition(173, 112);
_gm->animationOff();
- _gm->saveTime();
saveScreen(guiQuitBox);
renderBox(guiQuitBox);
@@ -472,11 +469,10 @@ void Supernova2Engine::setColor63(byte value) {
_gm->resetInputState();
restoreScreen();
- _gm->loadTime();
_gm->animationOn();
return quit;
-}*/
+}
bool Supernova2Engine::canLoadGameStateCurrently() {
return _allowLoadGame;