[Scummvm-cvs-logs] SF.net SVN: scummvm:[54615] scummvm/trunk/engines/mohawk
bgk at users.sourceforge.net
bgk at users.sourceforge.net
Mon Nov 29 21:55:11 CET 2010
Revision: 54615
http://scummvm.svn.sourceforge.net/scummvm/?rev=54615&view=rev
Author: bgk
Date: 2010-11-29 20:55:11 +0000 (Mon, 29 Nov 2010)
Log Message:
-----------
MOHAWK: Disabled hotspots are now unclickable areas. Display blue rects for unreachable zip destinations when drawing resource rects.
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/console.cpp
scummvm/trunk/engines/mohawk/graphics.cpp
scummvm/trunk/engines/mohawk/graphics.h
scummvm/trunk/engines/mohawk/myst.cpp
scummvm/trunk/engines/mohawk/myst_areas.cpp
scummvm/trunk/engines/mohawk/myst_areas.h
scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp
Modified: scummvm/trunk/engines/mohawk/console.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/console.cpp 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/console.cpp 2010-11-29 20:55:11 UTC (rev 54615)
@@ -191,7 +191,7 @@
return true;
}
- _vm->_gfx->drawRect(Common::Rect((uint16)atoi(argv[1]), (uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4])), true);
+ _vm->_gfx->drawRect(Common::Rect((uint16)atoi(argv[1]), (uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4])), kRectEnabled);
return false;
}
Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/graphics.cpp 2010-11-29 20:55:11 UTC (rev 54615)
@@ -287,15 +287,17 @@
}
}
-void MystGraphics::drawRect(Common::Rect rect, bool active) {
+void MystGraphics::drawRect(Common::Rect rect, RectState state) {
// Useful with debugging. Shows where hotspots are on the screen and whether or not they're active.
if (rect.left < 0 || rect.top < 0 || rect.right > 544 || rect.bottom > 333 || !rect.isValidRect() || rect.width() == 0 || rect.height() == 0)
return;
Graphics::Surface *screen = _vm->_system->lockScreen();
- if (active)
+ if (state == kRectEnabled)
screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0));
+ else if (state == kRectUnreachable)
+ screen->frameRect(rect, _pixelFormat.RGBToColor(0, 0, 255));
else
screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0));
Modified: scummvm/trunk/engines/mohawk/graphics.h
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.h 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/graphics.h 2010-11-29 20:55:11 UTC (rev 54615)
@@ -41,6 +41,12 @@
class MohawkBitmap;
class MystBitmap;
+enum RectState{
+ kRectEnabled,
+ kRectDisabled,
+ kRectUnreachable
+};
+
class MohawkSurface {
public:
MohawkSurface();
@@ -99,9 +105,8 @@
void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
void copyImageToScreen(uint16 image, Common::Rect dest);
void updateScreen();
+ void drawRect(Common::Rect rect, RectState state);
- void drawRect(Common::Rect rect, bool active);
-
protected:
MohawkSurface *decodeImage(uint16 id);
Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/myst.cpp 2010-11-29 20:55:11 UTC (rev 54615)
@@ -250,12 +250,12 @@
else if (getFeatures() & GF_DEMO)
changeToStack(kDemoStack);
else
- changeToStack(kIntroStack);
+ changeToStack(kSeleniticStack);
if (getFeatures() & GF_DEMO)
changeToCard(2000);
else
- changeToCard(1);
+ changeToCard(1285);
// Load game from launcher/command line if requested
if (ConfMan.hasKey("save_slot") && !(getFeatures() & GF_DEMO)) {
@@ -299,21 +299,21 @@
if (!_dragResource) {
checkCurrentResource();
}
- if (_curResource >= 0 && _mouseClicked) {
+ if (_curResource >= 0 && _resources[_curResource]->isEnabled() && _mouseClicked) {
debug(2, "Sending mouse move event to resource %d\n", _curResource);
_resources[_curResource]->handleMouseDrag(&event.mouse);
}
break;
case Common::EVENT_LBUTTONUP:
_mouseClicked = false;
- if (_curResource >= 0) {
+ if (_curResource >= 0 && _resources[_curResource]->isEnabled()) {
debug(2, "Sending mouse up event to resource %d\n", _curResource);
_resources[_curResource]->handleMouseUp(&event.mouse);
}
break;
case Common::EVENT_LBUTTONDOWN:
_mouseClicked = true;
- if (_curResource >= 0) {
+ if (_curResource >= 0 && _resources[_curResource]->isEnabled()) {
debug(2, "Sending mouse up event to resource %d\n", _curResource);
_resources[_curResource]->handleMouseDown(&event.mouse);
}
@@ -496,8 +496,14 @@
void MohawkEngine_Myst::drawResourceRects() {
for (uint16 i = 0; i < _resources.size(); i++) {
_resources[i]->getRect().debugPrint(0);
- if (_resources[i]->getRect().isValidRect())
- _gfx->drawRect(_resources[i]->getRect(), _resources[i]->isEnabled());
+ if (_resources[i]->getRect().isValidRect()) {
+ if (_resources[i]->unreachableZipDest())
+ _gfx->drawRect(_resources[i]->getRect(), kRectUnreachable);
+ else if (_resources[i]->isEnabled())
+ _gfx->drawRect(_resources[i]->getRect(), kRectEnabled);
+ else
+ _gfx->drawRect(_resources[i]->getRect(), kRectDisabled);
+ }
}
_system->updateScreen();
@@ -508,11 +514,14 @@
bool foundResource = false;
for (uint16 i = 0; i < _resources.size(); i++)
- if (_resources[i]->isEnabled() && _resources[i]->contains(_system->getEventManager()->getMousePos())) {
+ if (!_resources[i]->unreachableZipDest() &&
+ _resources[i]->contains(_system->getEventManager()->getMousePos())) {
if (_curResource != i) {
- if (_curResource != -1)
+ if (_curResource != -1 && _resources[_curResource]->isEnabled())
_resources[_curResource]->handleMouseLeave();
- _resources[i]->handleMouseEnter();
+
+ if (_resources[i]->isEnabled())
+ _resources[i]->handleMouseEnter();
}
_curResource = i;
Modified: scummvm/trunk/engines/mohawk/myst_areas.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.cpp 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/myst_areas.cpp 2010-11-29 20:55:11 UTC (rev 54615)
@@ -63,16 +63,6 @@
debugC(kDebugResource, "\tright: %d", _rect.right);
debugC(kDebugResource, "\tbottom: %d", _rect.bottom);
debugC(kDebugResource, "\tdest: %d", _dest);
-
- // Default Enable based on flags...
- if (_vm->_zipMode)
- _enabled = (_flags & kMystZipModeEnableFlag) != 0 ||
- (_flags & kMystHotspotEnableFlag) != 0 ||
- (_flags & kMystSubimageEnableFlag) != 0;
- else
- _enabled = (_flags & kMystZipModeEnableFlag) == 0 &&
- ((_flags & kMystHotspotEnableFlag) != 0 ||
- (_flags & kMystSubimageEnableFlag) != 0);
}
MystResource::~MystResource() {
@@ -85,6 +75,22 @@
warning("Movement type resource with null destination at position (%d, %d), (%d, %d)", _rect.left, _rect.top, _rect.right, _rect.bottom);
}
+bool MystResource::unreachableZipDest() {
+ return (_flags & kMystZipModeEnableFlag) && !_vm->_zipMode;
+}
+
+bool MystResource::isEnabled() {
+ return _flags & kMystHotspotEnableFlag;
+}
+
+void MystResource::setEnabled(bool enabled) {
+ if (enabled) {
+ _flags |= kMystHotspotEnableFlag;
+ } else {
+ _flags &= ~kMystHotspotEnableFlag;
+ }
+}
+
MystResourceType5::MystResourceType5(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) {
debugC(kDebugResource, "\tResource Type 5 Script:");
Modified: scummvm/trunk/engines/mohawk/myst_areas.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.h 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/myst_areas.h 2010-11-29 20:55:11 UTC (rev 54615)
@@ -44,10 +44,11 @@
virtual void drawConditionalDataToScreen(uint16 state) {}
virtual void handleAnimation() {}
virtual Common::Rect getRect() { return _rect; }
- bool isEnabled() { return _enabled; }
- void setEnabled(bool enabled) { _enabled = enabled; }
+ bool isEnabled();
+ void setEnabled(bool enabled);
uint16 getDest() { return _dest; }
virtual uint16 getType8Var() { return 0xFFFF; }
+ bool unreachableZipDest();
// Mouse interface
virtual void handleMouseUp(Common::Point *mouse);
@@ -62,7 +63,6 @@
uint16 _flags;
Common::Rect _rect;
uint16 _dest;
- bool _enabled;
};
class MystResourceType5 : public MystResource {
Modified: scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp 2010-11-29 20:54:52 UTC (rev 54614)
+++ scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp 2010-11-29 20:55:11 UTC (rev 54615)
@@ -594,7 +594,7 @@
MystResourceType10 *slider = soundLockSliderFromVar(var);
- _vm->_gfx->changeCursor(700);
+ _vm->_cursor->setCursor(700);
_vm->_sound->pauseBackground();
_sound_lock_sound_id = soundLockCurrentSound(slider->_pos.y, true);
@@ -668,7 +668,7 @@
_vm->_sound->pauseBackground();
_vm->_sound->playSound(1147);
_sound_lock_button->drawConditionalDataToScreen(1);
- _vm->_gfx->hideCursor();
+ _vm->_cursor->hideCursor();
soundLockCheckSolution(_sound_lock_slider_1, selenitic_vars[13], 5, solved);
soundLockCheckSolution(_sound_lock_slider_2, selenitic_vars[14], 9, solved);
@@ -690,7 +690,7 @@
_sound_lock_button->drawConditionalDataToScreen(0);
}
- _vm->_gfx->showCursor();
+ _vm->_cursor->showCursor();
}
void MystScriptParser_Selenitic::o_117_soundReceiverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list