aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/neverhood/detection.cpp3
-rw-r--r--engines/neverhood/diskplayerscene.cpp56
-rw-r--r--engines/neverhood/diskplayerscene.h10
-rw-r--r--engines/neverhood/entity.cpp1
-rw-r--r--engines/neverhood/gamemodule.cpp92
-rw-r--r--engines/neverhood/gamevars.cpp3
-rw-r--r--engines/neverhood/gamevars.h1
-rw-r--r--engines/neverhood/graphics.cpp26
-rw-r--r--engines/neverhood/graphics.h2
-rw-r--r--engines/neverhood/menumodule.cpp2
-rw-r--r--engines/neverhood/module.cpp3
-rw-r--r--engines/neverhood/module1000.cpp7
-rw-r--r--engines/neverhood/module1100.cpp2
-rw-r--r--engines/neverhood/module2200.cpp6
-rw-r--r--engines/neverhood/module2900.cpp12
-rw-r--r--engines/neverhood/scene.cpp16
-rw-r--r--engines/neverhood/scene.h1
17 files changed, 105 insertions, 138 deletions
diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp
index 9dc4582ba7..043cf02723 100644
--- a/engines/neverhood/detection.cpp
+++ b/engines/neverhood/detection.cpp
@@ -72,7 +72,6 @@ static const NeverhoodGameDescription gameDescriptions[] = {
{
// Neverhood English version
- // TODO: Maybe additional files are needed to properly detect different versions
{
"neverhood",
0,
@@ -147,7 +146,7 @@ bool NeverhoodMetaEngine::hasFeature(MetaEngineFeature f) const {
bool Neverhood::NeverhoodEngine::hasFeature(EngineFeature f) const {
return
-// (f == kSupportsRTL) || // TODO: Not yet...
+ (f == kSupportsRTL) ||
(f == kSupportsLoadingDuringRuntime) ||
(f == kSupportsSavingDuringRuntime);
}
diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp
index 907e027bc3..d972943759 100644
--- a/engines/neverhood/diskplayerscene.cpp
+++ b/engines/neverhood/diskplayerscene.cpp
@@ -240,40 +240,40 @@ void DiskplayerPlayButton::release() {
}
}
-DiskplayerSlot::DiskplayerSlot(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene, int elementIndex, int value)
- : Entity(vm, 0), _diskplayerScene(diskplayerScene), _elementIndex(elementIndex), _value(value),
- _isLocked(false), _isBlinking(false), _countdown(0), _initialCountdown(2), _inactiveSlot(NULL), _appearSlot(NULL), _activeSlot(NULL) {
-
- if (value != 0 && elementIndex < 20) {
- _inactiveSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes1[_elementIndex], 1100));
- _appearSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes2[_elementIndex], 1000));
- _activeSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes3[_elementIndex], 1100));
+DiskplayerSlot::DiskplayerSlot(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene, int slotIndex, bool isAvailable)
+ : Entity(vm, 0), _diskplayerScene(diskplayerScene), _isLocked(false), _isBlinking(false),
+ _blinkCountdown(0), _initialBlinkCountdown(2), _inactiveSlot(NULL), _appearSlot(NULL), _activeSlot(NULL) {
+
+ if (isAvailable && slotIndex < 20) {
+ _inactiveSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes1[slotIndex], 1100));
+ _appearSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes2[slotIndex], 1000));
+ _activeSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes3[slotIndex], 1100));
_inactiveSlot->setVisible(false);
_appearSlot->setVisible(false);
_activeSlot->setVisible(false);
loadSound(0, 0x46210074);
- setSoundPan(0, elementIndex * 100 / 19);
- } else if (elementIndex != 20) {
- _activeSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes4[_elementIndex], 1100));
+ setSoundPan(0, slotIndex * 100 / 19);
+ } else if (slotIndex != 20) {
+ _activeSlot = _diskplayerScene->addSprite(new StaticSprite(_vm, kDiskplayerSlotFileHashes4[slotIndex], 1100));
_activeSlot->setVisible(false);
}
SetUpdateHandler(&DiskplayerSlot::update);
}
void DiskplayerSlot::update() {
- if (_countdown != 0 && (--_countdown == 0)) {
+ if (_blinkCountdown != 0 && (--_blinkCountdown == 0)) {
if (_isBlinking) {
if (_inactiveSlot)
_inactiveSlot->setVisible(true);
if (_activeSlot)
_activeSlot->setVisible(false);
- _countdown = _initialCountdown / 2;
+ _blinkCountdown = _initialBlinkCountdown / 2;
} else {
if (_inactiveSlot)
_inactiveSlot->setVisible(false);
if (_activeSlot)
_activeSlot->setVisible(true);
- _countdown = _initialCountdown;
+ _blinkCountdown = _initialBlinkCountdown;
}
_isBlinking = !_isBlinking;
}
@@ -295,13 +295,13 @@ void DiskplayerSlot::play() {
if (_activeSlot)
_activeSlot->setVisible(true);
_isBlinking = true;
- _countdown = 0;
+ _blinkCountdown = 0;
}
}
void DiskplayerSlot::activate() {
if (!_isLocked)
- _countdown = _initialCountdown;
+ _blinkCountdown = _initialBlinkCountdown;
}
void DiskplayerSlot::stop() {
@@ -311,7 +311,7 @@ void DiskplayerSlot::stop() {
if (_activeSlot)
_activeSlot->setVisible(false);
_isBlinking = false;
- _countdown = 0;
+ _blinkCountdown = 0;
}
}
@@ -330,17 +330,17 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int
_asKey = insertSprite<AsDiskplayerSceneKey>();
for (int i = 0; i < 20; i++) {
- _diskAvailable[i] = 0;
+ _diskAvailable[i] = false;
if (getSubVar(VA_IS_TAPE_INSERTED, i))
availableDisksCount++;
}
for (int i = 0; i < availableDisksCount; i++)
- _diskAvailable[kDiskplayerInitArray[i] - 1] = 1;
+ _diskAvailable[kDiskplayerInitArray[i] - 1] = true;
- for (int i = 0; i < 20; i++) {
- _diskSlots[i] = new DiskplayerSlot(_vm, this, i, _diskAvailable[i]);
- addEntity(_diskSlots[i]);
+ for (int slotIndex = 0; slotIndex < 20; slotIndex++) {
+ _diskSlots[slotIndex] = new DiskplayerSlot(_vm, this, slotIndex, _diskAvailable[slotIndex]);
+ addEntity(_diskSlots[slotIndex]);
}
_hasAllDisks = availableDisksCount == 20;
@@ -348,7 +348,7 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int
if (_hasAllDisks && !getGlobalVar(V_HAS_FINAL_KEY))
_dropKey = true;
- _finalDiskSlot = new DiskplayerSlot(_vm, this, 20, 0);
+ _finalDiskSlot = new DiskplayerSlot(_vm, this, 20, false);
addEntity(_finalDiskSlot);
insertPuzzleMouse(0x000408A8, 20, 620);
@@ -372,11 +372,10 @@ void DiskplayerScene::update() {
Scene::update();
if (_updateStatus == kUSTuningIn && _diskSmackerPlayer->isDone()) {
- if (_diskAvailable[_diskIndex]) {
+ if (_diskAvailable[_diskIndex])
playDisk();
- } else {
+ else
playStatic();
- }
} else if (_updateStatus == kUSPlaying && _diskSmackerPlayer->isDone()) {
_diskSlots[_diskIndex]->stop();
_diskIndex++;
@@ -456,11 +455,10 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam &param,
_diskIndex = (param.asPoint().x - 38) / 28;
_diskSlots[_diskIndex]->activate();
if (_updateStatus == kUSPlaying) {
- if (_diskAvailable[_diskIndex]) {
+ if (_diskAvailable[_diskIndex])
playDisk();
- } else {
+ else
playStatic();
- }
}
}
break;
diff --git a/engines/neverhood/diskplayerscene.h b/engines/neverhood/diskplayerscene.h
index 7225ff6341..f3fd9ea874 100644
--- a/engines/neverhood/diskplayerscene.h
+++ b/engines/neverhood/diskplayerscene.h
@@ -54,7 +54,7 @@ protected:
class DiskplayerSlot : public Entity {
public:
- DiskplayerSlot(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene, int elementIndex, int value);
+ DiskplayerSlot(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene, int slotIndex, bool isAvailable);
void activate();
void stop();
void appear();
@@ -65,11 +65,9 @@ protected:
Sprite *_inactiveSlot;
Sprite *_appearSlot;
Sprite *_activeSlot;
- int _elementIndex;
- int _initialCountdown;
- int _countdown;
+ int _initialBlinkCountdown;
+ int _blinkCountdown;
bool _isLocked;
- int _value;
bool _isBlinking;
void update();
};
@@ -92,7 +90,7 @@ protected:
DiskplayerSlot *_diskSlots[20];
DiskplayerSlot *_finalDiskSlot;
int _updateStatus;
- byte _diskAvailable[20];
+ bool _diskAvailable[20];
int _diskIndex;
int _appearCountdown;
int _tuneInCountdown;
diff --git a/engines/neverhood/entity.cpp b/engines/neverhood/entity.cpp
index c7f1659399..8b1298916c 100644
--- a/engines/neverhood/entity.cpp
+++ b/engines/neverhood/entity.cpp
@@ -55,6 +55,7 @@ Entity::~Entity() {
}
void Entity::draw() {
+ // Empty
}
void Entity::handleUpdate() {
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index be56c73e03..c9310571f0 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -195,8 +195,7 @@ void GameModule::initMemoryPuzzle() {
}
setSubVar(VA_IS_PUZZLE_INIT, 0xC8606803, 1);
- // DEBUG>>>
- // TODO: Some debug code: Leave two matching tiles open
+ // DEBUG>>> Some debug code: Leave two matching tiles open
for (int i = 0; i < 48; i++)
setSubVar(VA_IS_TILE_MATCH, i, 1);
int debugIndex = 0;
@@ -313,9 +312,8 @@ uint32 GameModule::handleMessage(int messageNum, const MessageParam &param, Enti
}
void GameModule::startup() {
- // TODO: Displaying of error text probably not needed in ScummVM
-#if 1
- createModule(1500, 0); // Logos and intro video //Real
+#if 0
+ createModule(1500, 0); // Logos and intro video // Real game start
#else
// DEBUG>>>
/*
@@ -362,13 +360,6 @@ void GameModule::startup() {
// <<<DEBUG
#if 0
- /*
- //DEBUG>>>
- createScene(_vm->gameState().sceneNum, _vm->gameState().which);
- return;
- //DEBUG<<<
- */
-
_vm->gameState().which = 0;
_vm->gameState().sceneNum = 14;
createModule(2700, -1);
@@ -386,9 +377,9 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 5;
createModule(2200, -1);
#endif
-#if 0
- _vm->gameState().sceneNum = 1;
- createModule(1000, -1);
+#if 1
+ _vm->gameState().sceneNum = 7;
+ createModule(2200, -1);
#endif
#if 0
_vm->gameState().sceneNum = 1;
@@ -425,7 +416,7 @@ void GameModule::startup() {
_vm->gameState().sceneNum = 0;
createModule(2500, -1);
#endif
-#if 1
+#if 0
_vm->gameState().sceneNum = 1;
createModule(2300, -1);
#endif
@@ -626,65 +617,60 @@ void GameModule::updateModule() {
createModule(2300, 0);
break;
case 1200:
- if (_moduleResult == 1) {
+ if (_moduleResult == 1)
createModule(2600, 0);
- } else {
+ else
createModule(2300, 2);
- }
break;
case 1100:
- if (_moduleResult == 0) {
+ if (_moduleResult == 0)
createModule(2900, 2);
- } else {
+ else {
setGlobalVar(V_ENTRANCE_OPEN, 1);
createModule(1300, 0);
}
break;
case 1300:
if (_moduleResult == 1) {
+ // The game was successfully finished
+ // TODO Restart the game/show main menu
// TODO _gameState.clear();
// TODO GameModule_handleKeyEscape
- } else {
+ } else
createModule(2900, 0);
- }
break;
case 1400:
- if (_moduleResult == 1) {
- error("WEIRD!");
- } else {
- createModule(1600, 1);
- }
+ createModule(1600, 1);
break;
case 1500:
createModule(1000, 0);
break;
case 1600:
- if (_moduleResult == 1) {
+ if (_moduleResult == 1)
createModule(1400, 0);
- } else if (_moduleResult == 2) {
+ else if (_moduleResult == 2)
createModule(1700, 0);
- } else {
+ else
createModule(2100, 0);
- }
break;
case 1700:
- if (_moduleResult == 1) {
+ if (_moduleResult == 1)
createModule(2900, 3);
- } else {
+ else
createModule(1600, 2);
- }
break;
case 1800:
if (_moduleResult == 1) {
- // TODO GameState_clear();
- // TODO GameModule_handleKeyEscape();
- } else if (_moduleResult == 2) {
+ // Game over, Klaymen jumped into the hole
+ // TODO Restart the game/show main menu
+ // TODO _gameState.clear();
+ // TODO GameModule_handleKeyEscape
+ } else if (_moduleResult == 2)
createModule(2700, 0);
- } else if (_moduleResult == 3) {
+ else if (_moduleResult == 3)
createModule(3000, 3);
- } else {
+ else
createModule(2800, 0);
- }
break;
case 1900:
createModule(3000, 1);
@@ -693,11 +679,10 @@ void GameModule::updateModule() {
createModule(2900, 4);
break;
case 2100:
- if (_moduleResult == 1) {
+ if (_moduleResult == 1)
createModule(2900, 1);
- } else {
+ else
createModule(1600, 0);
- }
break;
case 2200:
createModule(2300, 1);
@@ -738,7 +723,7 @@ void GameModule::updateModule() {
createModule(1800, 0);
break;
case 2900:
- if (_moduleResult != 0xFFFFFFFF) {
+ if (_moduleResult != (uint32)-1) {
switch (_moduleResult) {
case 0:
createModule(1300, 5);
@@ -787,17 +772,16 @@ void GameModule::updateModule() {
setGlobalVar(V_TELEPORTER_CURR_LOCATION, 0);
break;
case 3000:
- if (_moduleResult == 1) {
+ // NOTE _moduleResult 2 never used
+ // TODO Check if _moduleResult 4 is used
+ if (_moduleResult == 1)
createModule(1900, 0);
- } else if (_moduleResult == 2) {
- // WEIRD: Sets the errorFlag
- } else if (_moduleResult == 3) {
+ else if (_moduleResult == 3)
createModule(1800, 3);
- } else if (_moduleResult == 4) {
+ else if (_moduleResult == 4)
createModule(3000, 0);
- } else {
+ else
createModule(2300, 4);
- }
break;
case 9999:
createModuleByHash(getGlobalVar(V_MODULE_NAME));
@@ -814,7 +798,7 @@ void GameModule::openMainMenu() {
// If there's no module, create one so there's something to return to
createModule(1000, 0);
}
- // TODO Save FPS, Smacker handle, screen offsets, collisition sprites
+ // TODO Save FPS, Smacker handle, screen offsets
_mainMenuRequested = false;
createMenuModule();
}
@@ -833,7 +817,7 @@ void GameModule::updateMenuModule() {
if (!updateChild()) {
// TODO Restore FPS?
_childObject = _prevChildObject;
- // TODO Restore Smacker handle, screen offsets, collision sprites
+ // TODO Restore Smacker handle, screen offsets
sendMessage(_childObject, 0x101E, 0); // TODO CHECKME Is this needed?
_prevChildObject = NULL;
_moduleNum = _prevModuleNum;
diff --git a/engines/neverhood/gamevars.cpp b/engines/neverhood/gamevars.cpp
index 7bf9f30e25..57d9547ac2 100644
--- a/engines/neverhood/gamevars.cpp
+++ b/engines/neverhood/gamevars.cpp
@@ -28,9 +28,6 @@ GameVars::GameVars() {
addVar(0, 0);
}
-GameVars::~GameVars() {
-}
-
void GameVars::loadState(Common::InSaveFile *in) {
uint varCount;
_vars.clear();
diff --git a/engines/neverhood/gamevars.h b/engines/neverhood/gamevars.h
index a62b33c297..d3fe15fb5e 100644
--- a/engines/neverhood/gamevars.h
+++ b/engines/neverhood/gamevars.h
@@ -172,7 +172,6 @@ struct GameVar {
class GameVars {
public:
GameVars();
- ~GameVars();
void loadState(Common::InSaveFile *in);
void saveState(Common::OutSaveFile *out);
uint32 getGlobalVar(uint32 nameHash);
diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 1c3769dc65..5426821133 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -112,25 +112,17 @@ void BaseSurface::drawMouseCursorResource(MouseCursorResource &mouseCursorResour
}
}
-void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect, bool transparent) {
- // TODO: Clipping
+void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect) {
+ // Copy a rectangle from sourceSurface, no clipping is performed, 0 is the transparent color
byte *source = (byte*)sourceSurface->getBasePtr(sourceRect.x, sourceRect.y);
byte *dest = (byte*)_surface->getBasePtr(x, y);
int height = sourceRect.height;
- if (!transparent) {
- while (height--) {
- memcpy(dest, source, sourceRect.width);
- source += sourceSurface->pitch;
- dest += _surface->pitch;
- }
- } else {
- while (height--) {
- for (int xc = 0; xc < sourceRect.width; xc++)
- if (source[xc] != 0)
- dest[xc] = source[xc];
- source += sourceSurface->pitch;
- dest += _surface->pitch;
- }
+ while (height--) {
+ for (int xc = 0; xc < sourceRect.width; xc++)
+ if (source[xc] != 0)
+ dest[xc] = source[xc];
+ source += sourceSurface->pitch;
+ dest += _surface->pitch;
}
++_version;
}
@@ -179,7 +171,7 @@ void FontSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr)
sourceRect.y = (chr / _charsPerRow) * _charHeight;
sourceRect.width = _charWidth;
sourceRect.height = _charHeight;
- destSurface->copyFrom(_surface, x, y, sourceRect, true);
+ destSurface->copyFrom(_surface, x, y, sourceRect);
}
void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen) {
diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h
index a900cea10f..a0ac1f09d5 100644
--- a/engines/neverhood/graphics.h
+++ b/engines/neverhood/graphics.h
@@ -91,7 +91,7 @@ public:
void drawSpriteResourceEx(SpriteResource &spriteResource, bool flipX, bool flipY, int16 width, int16 height);
void drawAnimResource(AnimResource &animResource, uint frameIndex, bool flipX, bool flipY, int16 width, int16 height);
void drawMouseCursorResource(MouseCursorResource &mouseCursorResource, int frameNum);
- void copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect, bool transparent);
+ void copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, NDrawRect &sourceRect);
int getPriority() const { return _priority; }
void setPriority(int priority) { _priority = priority; }
NDrawRect& getDrawRect() { return _drawRect; }
diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index 726ab91b8c..2b7561c431 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -577,7 +577,7 @@ void TextEditWidget::drawCursor() {
if (_cursorSurface->getVisible() && _cursorPos >= 0 && _cursorPos <= _maxVisibleChars) {
NDrawRect sourceRect(0, 0, _cursorWidth, _cursorHeight);
_surface->copyFrom(_cursorSurface->getSurface(), _rect.x1 + _cursorPos * _fontSurface->getCharWidth(),
- _rect.y1 + (_rect.y2 - _cursorHeight - _rect.y1 + 1) / 2, sourceRect, true);
+ _rect.y1 + (_rect.y2 - _cursorHeight - _rect.y1 + 1) / 2, sourceRect);
} else
_cursorSurface->setVisible(false);
}
diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp
index aeeb62f65c..36607d771f 100644
--- a/engines/neverhood/module.cpp
+++ b/engines/neverhood/module.cpp
@@ -48,8 +48,7 @@ void Module::draw() {
uint32 Module::handleMessage(int messageNum, const MessageParam &param, Entity *sender) {
switch (messageNum) {
case 0x0008:
- if (_parentModule)
- sendMessage(_parentModule, 8, 0);
+ sendMessage(_parentModule, 8, 0);
return 0;
case 0x1009:
_moduleResult = param.asInteger();
diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp
index 44bb778645..12fe408040 100644
--- a/engines/neverhood/module1000.cpp
+++ b/engines/neverhood/module1000.cpp
@@ -34,13 +34,12 @@ Module1000::Module1000(NeverhoodEngine *vm, Module *parentModule, int which)
_vm->_soundMan->addMusic(0x03294419, 0x061880C6);
_vm->_soundMan->addMusic(0x03294419, _musicFileHash);
- if (which < 0) {
+ if (which < 0)
createScene(_vm->gameState().sceneNum, -1);
- } else if (which == 0) {
+ else if (which == 0)
createScene(0, 0);
- } else if (which == 1) {
+ else if (which == 1)
createScene(1, 1);
- }
}
diff --git a/engines/neverhood/module1100.cpp b/engines/neverhood/module1100.cpp
index c39845e44b..2ee389703c 100644
--- a/engines/neverhood/module1100.cpp
+++ b/engines/neverhood/module1100.cpp
@@ -573,8 +573,6 @@ void Scene1105::createObjects() {
_asTeddyBear->show();
- // TODO: Find a nicer way
- deleteSprite((Sprite**)&_mouseCursor);
insertPuzzleMouse(0x18666208, 20, 620);
}
diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp
index 6448955934..a53bd468f4 100644
--- a/engines/neverhood/module2200.cpp
+++ b/engines/neverhood/module2200.cpp
@@ -2241,20 +2241,20 @@ void Scene2208::drawRow(int16 rowIndex) {
sourceRect.y = y;
sourceRect.width = 640;
sourceRect.height = 48;
- _background->getSurface()->copyFrom(_topBackgroundSurface->getSurface(), 0, y, sourceRect, true);
+ _background->getSurface()->copyFrom(_topBackgroundSurface->getSurface(), 0, y, sourceRect);
} else if (rowIndex > _maxRowIndex - 5) {
sourceRect.x = 0;
sourceRect.y = (rowIndex - _maxRowIndex + 4) * 48;
sourceRect.width = 640;
sourceRect.height = 48;
- _background->getSurface()->copyFrom(_bottomBackgroundSurface->getSurface(), 0, y, sourceRect, true);
+ _background->getSurface()->copyFrom(_bottomBackgroundSurface->getSurface(), 0, y, sourceRect);
} else {
rowIndex -= 4;
sourceRect.x = 0;
sourceRect.y = (rowIndex * 48) % 480;
sourceRect.width = 640;
sourceRect.height = 48;
- _background->getSurface()->copyFrom(_backgroundSurface->getSurface(), 0, y, sourceRect, true);
+ _background->getSurface()->copyFrom(_backgroundSurface->getSurface(), 0, y, sourceRect);
if (rowIndex < (int)_strings.size()) {
const char *text = _strings[rowIndex];
_fontSurface->drawString(_background->getSurface(), 95, y, (const byte*)text);
diff --git a/engines/neverhood/module2900.cpp b/engines/neverhood/module2900.cpp
index b5a6ab2c88..1e14d37fd5 100644
--- a/engines/neverhood/module2900.cpp
+++ b/engines/neverhood/module2900.cpp
@@ -82,8 +82,8 @@ void Module2900::updateScene() {
if (!updateChild()) {
switch (_sceneNum) {
case 0:
- if (_moduleResult == 0xFFFFFFFF) {
- leaveModule(0xFFFFFFFF);
+ if (_moduleResult == (uint32)-1) {
+ leaveModule((uint32)-1);
} else {
_teleporterModuleResult = _moduleResult;
switch (getGlobalVar(V_TELEPORTER_WHICH)) {
@@ -417,14 +417,12 @@ uint32 Scene2901::handleMessage(int messageNum, const MessageParam &param, Entit
Scene::handleMessage(messageNum, param, sender);
switch (messageNum) {
case 0x0001:
- if (param.asPoint().x <= 20 || param.asPoint().x >= 620) {
- leaveScene(0xFFFFFFFF);
- }
+ if (param.asPoint().x <= 20 || param.asPoint().x >= 620)
+ leaveScene((uint32)-1);
break;
case 0x2000:
- if (_currLocationButtonNum != _selectedButtonNum) {
+ if (_currLocationButtonNum != _selectedButtonNum)
leaveScene(_selectedButtonNum);
- }
break;
case 0x2001:
if (_currLocationButtonNum == _selectedButtonNum)
diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp
index e34f9334ec..c22683ae37 100644
--- a/engines/neverhood/scene.cpp
+++ b/engines/neverhood/scene.cpp
@@ -199,18 +199,15 @@ void Scene::insertScreenMouse(uint32 fileHash, const NRect *mouseRect) {
NRect rect(-1, -1, -1, -1);
if (mouseRect)
rect = *mouseRect;
- _mouseCursor = new Mouse(_vm, fileHash, rect);
- addEntity(_mouseCursor);
+ insertMouse(new Mouse(_vm, fileHash, rect));
}
void Scene::insertPuzzleMouse(uint32 fileHash, int16 x1, int16 x2) {
- _mouseCursor = new Mouse(_vm, fileHash, x1, x2);
- addEntity(_mouseCursor);
+ insertMouse(new Mouse(_vm, fileHash, x1, x2));
}
void Scene::insertNavigationMouse(uint32 fileHash, int type) {
- _mouseCursor = new Mouse(_vm, fileHash, type);
- addEntity(_mouseCursor);
+ insertMouse(new Mouse(_vm, fileHash, type));
}
void Scene::showMouse(bool visible) {
@@ -561,4 +558,11 @@ void Scene::checkCollision(Sprite *sprite, uint16 flags, int messageNum, uint32
}
}
+void Scene::insertMouse(Mouse *mouseCursor) {
+ if (_mouseCursor)
+ deleteSprite((Sprite**)&_mouseCursor);
+ _mouseCursor = mouseCursor;
+ addEntity(_mouseCursor);
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h
index cb345674f0..f03275f569 100644
--- a/engines/neverhood/scene.h
+++ b/engines/neverhood/scene.h
@@ -217,6 +217,7 @@ protected:
void clearHitRects();
void clearCollisionSprites();
+ void insertMouse(Mouse *mouseCursor);
};
} // End of namespace Neverhood