MOHAWK: Don't change current resource when dragging

svn-id: r54607
This commit is contained in:
Bastien Bouclet 2010-11-29 20:53:14 +00:00
parent b4913548d0
commit 8da42b4221
3 changed files with 13 additions and 1 deletions

View File

@ -67,6 +67,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_curCard = 0;
_needsUpdate = false;
_curResource = -1;
_dragResource = 0;
_gfx = NULL;
_console = NULL;
@ -294,7 +295,10 @@ Common::Error MohawkEngine_Myst::run() {
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
_needsUpdate = true;
checkCurrentResource();
// Keep the same resource when dragging
if (!_dragResource) {
checkCurrentResource();
}
if (_curResource >= 0 && _mouseClicked) {
debug(2, "Sending mouse move event to resource %d\n", _curResource);
_resources[_curResource]->handleMouseDrag(&event.mouse);
@ -482,6 +486,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) {
// TODO: Handle Script Resources
// Make sure we have the right cursor showing
_dragResource = 0;
_curResource = -1;
checkCurrentResource();

View File

@ -190,6 +190,7 @@ public:
MystSaveLoad *_saveLoad;
MystScriptParser *_scriptParser;
Common::Array<MystResource*> _resources;
MystResource *_dragResource;
bool _showResourceRects;
MystResource *loadResource(Common::SeekableReadStream *rlstStream, MystResource *parent);

View File

@ -527,6 +527,9 @@ void MystResourceType10::drawDataToScreen() {
}
void MystResourceType10::handleMouseDown(Common::Point *mouse) {
// Tell the engine we are dragging a resource
_vm->_dragResource = this;
updatePosition(mouse);
MystResourceType8::handleMouseDown(mouse);
@ -550,6 +553,9 @@ void MystResourceType10::handleMouseUp(Common::Point *mouse) {
// Draw slider
drawConditionalDataToScreen(1);
// No longer in drag mode
_vm->_dragResource = 0;
}
void MystResourceType10::handleMouseDrag(Common::Point *mouse) {