mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-19 16:18:45 +00:00
MOHAWK: Disabled hotspots are now unclickable areas. Display blue rects for unreachable zip destinations when drawing resource rects.
svn-id: r54615
This commit is contained in:
parent
0ac6af59d1
commit
92d74fa56d
@ -191,7 +191,7 @@ bool MystConsole::Cmd_DrawRect(int argc, const char **argv) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -287,15 +287,17 @@ void MystGraphics::updateScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
@ -41,6 +41,12 @@ class MohawkEngine_Riven;
|
||||
class MohawkBitmap;
|
||||
class MystBitmap;
|
||||
|
||||
enum RectState{
|
||||
kRectEnabled,
|
||||
kRectDisabled,
|
||||
kRectUnreachable
|
||||
};
|
||||
|
||||
class MohawkSurface {
|
||||
public:
|
||||
MohawkSurface();
|
||||
@ -99,8 +105,7 @@ public:
|
||||
void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
|
||||
void copyImageToScreen(uint16 image, Common::Rect dest);
|
||||
void updateScreen();
|
||||
|
||||
void drawRect(Common::Rect rect, bool active);
|
||||
void drawRect(Common::Rect rect, RectState state);
|
||||
|
||||
protected:
|
||||
MohawkSurface *decodeImage(uint16 id);
|
||||
|
@ -250,12 +250,12 @@ Common::Error MohawkEngine_Myst::run() {
|
||||
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 @@ Common::Error MohawkEngine_Myst::run() {
|
||||
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::changeToCard(uint16 card) {
|
||||
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 @@ void MohawkEngine_Myst::checkCurrentResource() {
|
||||
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;
|
||||
|
@ -63,16 +63,6 @@ MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rl
|
||||
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 @@ void MystResource::handleMouseUp(Common::Point *mouse) {
|
||||
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:");
|
||||
|
||||
|
@ -44,10 +44,11 @@ public:
|
||||
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 @@ protected:
|
||||
uint16 _flags;
|
||||
Common::Rect _rect;
|
||||
uint16 _dest;
|
||||
bool _enabled;
|
||||
};
|
||||
|
||||
class MystResourceType5 : public MystResource {
|
||||
|
@ -594,7 +594,7 @@ void MystScriptParser_Selenitic::o_113_soundLockStartMove(uint16 op, uint16 var,
|
||||
|
||||
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 @@ void MystScriptParser_Selenitic::o_115_soundLockButton(uint16 op, uint16 var, ui
|
||||
_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 @@ void MystScriptParser_Selenitic::o_115_soundLockButton(uint16 op, uint16 var, ui
|
||||
_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) {
|
||||
|
Loading…
Reference in New Issue
Block a user