Ticket #5386: agi-controllers.diff
File agi-controllers.diff, 2.9 KB (added by , 14 years ago) |
---|
-
engines/agi/cycle.cpp
387 387 388 388 if (_restartGame) { 389 389 setflag(fRestartGame, true); 390 _game.lastController = 0;391 390 setvar(vTimeDelay, 2); // "normal" speed 392 391 _restartGame = false; 393 392 } -
engines/agi/agi.cpp
555 555 _predictiveDictLineCount = 0; 556 556 _firstSlot = 0; 557 557 558 // NOTE: On game reload the keys do not get set again, 559 // thus it is incorrect to reset it in agiInit(). Fixes bug #2823762 560 _game.lastController = 0; 561 for (int i = 0; i < MAX_DIRS; i++) 562 _game.controllerOccured[i] = false; 558 resetControllers(); 563 559 564 560 setupOpcodes(); 565 561 _curLogic = NULL; -
engines/agi/op_cmd.cpp
1388 1388 } 1389 1389 1390 1390 void AgiEngine::cmd_set_key(uint8 *p) { 1391 int key;1391 debugC(4, kDebugLevelScripts, "%d %d %d", p0, p1, p2); 1392 1392 1393 if (_game.lastController >= MAX_CONTROLLERS) { 1393 int key = 256 * p1 + p0; 1394 int slot = -1; 1395 1396 for (int i = 0; i < MAX_CONTROLLERS; i++) { 1397 if (slot == -1 && !_game.controllers[i].keycode) { 1398 slot = i; 1399 } 1400 1401 if (_game.controllers[i].keycode == key && _game.controllers[i].controller == p2) { 1402 return; 1403 } 1404 } 1405 1406 if (slot == -1) { 1394 1407 warning("Number of set.keys exceeded %d", MAX_CONTROLLERS); 1395 1408 return; 1396 1409 } 1397 1410 1398 debugC(4, kDebugLevelScripts, "%d %d %d", p0, p1, p2); 1411 _game.controllers[slot].keycode = key; 1412 _game.controllers[slot].controller = p2; 1399 1413 1400 key = 256 * p1 + p0;1401 1402 _game.controllers[_game.lastController].keycode = key;1403 _game.controllers[_game.lastController].controller = p2;1404 _game.lastController++;1405 1406 1414 _game.controllerOccured[p2] = false; 1407 1415 } 1408 1416 -
engines/agi/keyboard.cpp
117 117 118 118 debugC(3, kDebugLevelInput, "key = %04x", key); 119 119 120 for (i = 0; i < _game.lastController; i++) {120 for (i = 0; i < MAX_CONTROLLERS; i++) { 121 121 if (_game.controllers[i].keycode == key) { 122 122 debugC(3, kDebugLevelInput, "event %d: key press", _game.controllers[i].controller); 123 123 _game.controllerOccured[_game.controllers[i].controller] = true; -
engines/agi/agi.h
603 603 604 604 bool controllerOccured[MAX_DIRS]; /**< keyboard keypress events */ 605 605 AgiController controllers[MAX_CONTROLLERS]; 606 int lastController;607 606 608 607 char strings[MAX_STRINGS + 1][MAX_STRINGLEN]; /**< strings */ 609 608