Ticket #6186: loom-doubleclick2.diff
File loom-doubleclick2.diff, 3.0 KB (added by , 12 years ago) |
---|
-
engines/scumm/script.cpp
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index d8c4948..605d831 100644
a b void ScummEngine::runInputScript(int clickArea, int val, int mode) { 1363 1363 args[1] = VAR(82 + (val - 100)); 1364 1364 } 1365 1365 } 1366 } 1366 1367 1367 // Clicks are handled differently in Indy3 mac: param 2 of the1368 // input script is set to 0 for normal clicks, and to 1 for double clicks.1368 // Double clicks are handled differently in Mac Indy3 and Loom 1369 if (_game.platform == Common::kPlatformMacintosh && (_game.id == GID_INDY3 || _game.id == GID_LOOM)) { 1369 1370 uint32 time = _system->getMillis(); 1370 args[2] = (time < _lastInputScriptTime + 500); // 500 ms double click delay 1371 bool doubleClick = false; 1372 1373 // The DOS EGA version of Loom checks not only the time between 1374 // the clicks, but also that the mouse position hasn't changed 1375 // to much. That seems like a good idea to use here as well. 1376 // 1377 // We use a 500 ms as the double click delay, though at least 1378 // DOS EGA Loom uses timer variables instead. 1379 doubleClick = (time < _lastInputScriptTime + 500) && 1380 (ABS(_lastInputScriptClickX - VAR(VAR_VIRT_MOUSE_X)) < 6) && 1381 (ABS(_lastInputScriptClickY - VAR(VAR_VIRT_MOUSE_Y)) < 3); 1382 1383 if (_game.id == GID_INDY3) { 1384 // param 2 of the input script is set to 0 for normal 1385 // clicks, and to 1 for double clicks. 1386 args[2] = doubleClick; 1387 } else if (_game.id == GID_LOOM) { 1388 // DOS EGA Loom uses variables 50 and upwards to store 1389 // information about drafts. The Mac version uses 1390 // variables 55 and upwards. Variable 52 appears to be 1391 // the flag indicating double click. It's currently 1392 // unknown what the other extra variables are, or if 1393 // they are even used. 1394 VAR(52) = doubleClick; 1395 } 1396 1371 1397 _lastInputScriptTime = time; 1398 _lastInputScriptClickX = VAR(VAR_VIRT_MOUSE_X); 1399 _lastInputScriptClickY = VAR(VAR_VIRT_MOUSE_Y); 1372 1400 } 1373 1401 1374 1402 if (verbScript) -
engines/scumm/scumm.cpp
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 6a4fe23..2bbf743 100644
a b ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) 200 200 _leftBtnPressed = 0; 201 201 _rightBtnPressed = 0; 202 202 _lastInputScriptTime = 0; 203 _lastInputScriptClickX = 0; 204 _lastInputScriptClickY = 0; 203 205 _bootParam = 0; 204 206 _dumpScripts = false; 205 207 _debugMode = 0; -
engines/scumm/scumm.h
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index a77c1c0..6403c56 100644
a b protected: 574 574 575 575 /** 576 576 * Last time runInputScript was run (measured in terms of OSystem::getMillis()). 577 * This is currently only used for Indy3 macto detect "double clicks".577 * This is currently only used for Mac Indy3 and Loom to detect "double clicks". 578 578 */ 579 579 uint32 _lastInputScriptTime; 580 int _lastInputScriptClickX; 581 int _lastInputScriptClickY; 580 582 581 583 /** The bootparam, to be passed to the script 1, the bootscript. */ 582 584 int _bootParam;