ScummVM
script_mr.cpp
Go to the documentation of this file.
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "kyra/engine/kyra_mr.h"
24 #include "kyra/text/text_mr.h"
25 #include "kyra/resource/resource.h"
26 
27 #include "common/system.h"
28 
29 namespace Kyra {
30 
32  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getMaloclmShapes(%p) ()", (const void *)script);
33  return _characterShapeFile;
34 }
35 
37  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
38  int x = stackPos(0);
39  int y = stackPos(1);
40 
41  if (x != -1 && y != -1) {
42  x &= ~3;
43  y &= ~1;
44  }
45 
48 
49  return 0;
50 }
51 
53  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_defineObject(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)", (const void *)script,
56  strcpy(obj.filename, stackPosString(1));
57  obj.sceneAnim = stackPos(2);
58  obj.sceneScript = stackPos(3);
59  obj.x = stackPos(4);
60  obj.y = stackPos(5);
61  obj.color = stackPos(6);
62  obj.sceneId = stackPos(7);
63  return 0;
64 }
65 
67  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_refreshCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
68  const int frame = stackPos(0);
69  const int facing = stackPos(1);
70  const bool updateNeed = stackPos(2) != 0;
71 
72  if (facing >= 0)
73  _mainCharacter.facing = facing;
74 
75  if (frame >= 0 && frame != 87)
77  else
79 
81 
82  if (updateNeed)
84  return 0;
85 }
86 
88  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getMalcolmsMood(%p) ()", (const void *)script);
89  return _malcolmsMood;
90 }
91 
93  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getCharacterFrameFromFacing(%p) ()", (const void *)script);
95 }
96 
98  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0));
100  return 0;
101 }
102 
104  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showSceneFileMessage(%p) (%d)", (const void *)script, stackPos(0));
105  showMessage((const char *)getTableEntry(_scenesFile, stackPos(0)), 0xFF, 0xF0);
106  return 0;
107 }
108 
110  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterAnimFrameFromFacing(%p) ()", (const void *)script);
111  updateCharPal(0);
115  return 0;
116 }
117 
119  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showBadConscience(%p) ()", (const void *)script);
121  return 0;
122 }
123 
125  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_hideBadConscience(%p) ()", (const void *)script);
127  return 0;
128 }
129 
131  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showAlbum(%p) ()", (const void *)script);
132  showAlbum();
133  return 0;
134 }
135 
137  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setInventorySlot(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
138  const int slot = MAX<int16>(0, MIN<int16>(10, stackPos(0)));
139  return (_mainCharacter.inventory[slot] = stackPos(1));
140 }
141 
143  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getInventorySlot(%p) (%d)", (const void *)script, stackPos(0));
144  return _mainCharacter.inventory[stackPos(0)];
145 }
146 
148  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_addItemToInventory(%p) (%d)", (const void *)script, stackPos(0));
149  int slot = findFreeInventorySlot();
150  if (slot >= 0) {
151  _mainCharacter.inventory[slot] = stackPos(0);
152  if (_inventoryState) {
153  redrawInventory(0);
154  }
155  }
156  return slot;
157 }
158 
160  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_addItemToCurScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
161  const uint16 item = stackPos(0);
162  int x = stackPos(1);
163  int y = stackPos(2);
164  int itemSlot = findFreeItem();
165 
166  if (x < 20)
167  x = 20;
168  else if (x > 299)
169  x = 299;
170 
171  if (y < 18)
172  y = 18;
173  else if (y > 187)
174  y = 187;
175 
176  if (itemSlot >= 0) {
177  _itemList[itemSlot].x = x;
178  _itemList[itemSlot].y = y;
179  _itemList[itemSlot].id = item;
181  addItemToAnimList(itemSlot);
183  }
184 
185  return itemSlot;
186 }
187 
189  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_objectChat(%p) (%d)", (const void *)script, stackPos(0));
190  int id = stackPos(0);
191  const char *str = (const char *)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id);
192  if (str) {
193  objectChat(str, 0, _vocHigh, id);
194  playStudioSFX(str);
195  }
196  return 0;
197 }
198 
200  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_resetInventory(%p) ()", (const void *)script);
201  memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory));
202  return 0;
203 }
204 
206  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeInventoryItemInstances(%p) (%d)", (const void *)script, stackPos(0));
207  const int item = stackPos(0);
208  for (int i = 0; i < 10; ++i) {
209  if (_mainCharacter.inventory[i] == item)
211  }
212  return 0;
213 }
214 
216  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_countInventoryItemInstances(%p) (%d)", (const void *)script, stackPos(0));
217  const int item = stackPos(0);
218  int count = 0;
219 
220  for (int i = 0; i < 10; ++i) {
221  if (_mainCharacter.inventory[i] == item)
222  ++count;
223  }
224 
225  if (_itemInHand == item)
226  ++count;
227 
228  return count;
229 }
230 
232  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_npcChatSequence(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
233  const int id = stackPos(0);
234  const char *str = (const char *)getTableEntry(_sceneStrings, id);
235  if (str)
236  npcChatSequence(str, stackPos(1), _vocHigh, id);
237  return 0;
238 }
239 
241  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_badConscienceChat(%p) (%d)", (const void *)script, stackPos(0));
242  int id = stackPos(0);
243  const char *str = (const char *)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id);
244  badConscienceChat(str, _vocHigh, id);
245  return 0;
246 }
247 
249  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_wipeDownMouseItem(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2));
250  _screen->hideMouse();
251  const int x = stackPos(1) - 12;
252  const int y = stackPos(2) - 19;
253 
254  if (_itemInHand >= 0) {
255  backUpGfxRect32x32(x, y);
256  uint8 *shape = getShapePtr(_itemInHand+248);
257  for (int curY = y, height = 20; height > 0; height -= 2, curY += 2) {
258  restoreGfxRect32x32(x, y);
260  const uint32 waitTime = _system->getMillis() + _tickLength;
261  _screen->drawShape(0, shape, x, curY, 0, 0);
263  delayUntil(waitTime);
264  }
265  restoreGfxRect32x32(x, y);
266  _screen->resetShapeHeight(shape);
267  }
268 
269  _screen->showMouse();
270  removeHandItem();
271 
272  return 0;
273 }
274 
276  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setMalcolmsMood(%p) (%d)", (const void *)script, stackPos(0));
277  return (_malcolmsMood = stackPos(0));
278 }
279 
281  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_updateScore(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
282  return updateScore(stackPos(0), stackPos(1)) ? 1 : 0;
283 }
284 
286  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_makeSecondChanceSave(%p) ()", (const void *)script);
287  saveGameStateIntern(999, "Autosave", 0);
288  return 0;
289 }
290 
292  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setSceneFilename(%p) (%d, '%s')", (const void *)script, stackPos(0), stackPosString(1));
293  strcpy(_sceneList[stackPos(0)].filename1, stackPosString(1));
294  _sceneList[stackPos(0)].filename1[9] = 0;
295  return 0;
296 }
297 
299  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeItemsFromScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
300  const uint16 itemId = stackPos(0);
301  const uint16 sceneId = stackPos(1);
302  const bool allItems = (stackPos(2) != 0);
303 
304  int retValue = 0;
305 
306  for (int i = 0; i < 50; ++i) {
307  if (_itemList[i].sceneId == sceneId && _itemList[i].id == itemId) {
308  resetItem(i);
309  retValue = 1;
310  if (!allItems)
311  return 1;
312  }
313  }
314 
315  return retValue;
316 }
317 
319  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_disguiseMalcolm(%p) (%d)", (const void *)script, stackPos(0));
321  updateDlgIndex();
322  return 0;
323 }
324 
326  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_drawSceneShape(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
327 
328  int shape = stackPos(0);
329  int flag = (stackPos(1) != 0) ? 1 : 0;
330 
331  restorePage3();
332 
333  const int x = _sceneShapeDescs[shape].drawX;
334  const int y = _sceneShapeDescs[shape].drawY;
335 
336  _screen->drawShape(2, _sceneShapes[shape], x, y, 2, flag);
337 
338  _screen->copyRegionToBuffer(3, 0, 0, 320, 200, _gamePlayBuffer);
339 
340  _screen->drawShape(0, _sceneShapes[shape], x, y, 2, flag);
341 
344  return 0;
345 }
346 
348  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_drawSceneShapeOnPage(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
349  const int shape = stackPos(0);
350 
351  int x = _sceneShapeDescs[shape].drawX;
352  int y = _sceneShapeDescs[shape].drawY;
353  _screen->drawShape(stackPos(2), _sceneShapes[shape], x, y, 2, (stackPos(1) != 0) ? 1 : 0);
354  return 0;
355 }
356 
358  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_checkInRect(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script,
359  stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
360  const int x1 = stackPos(0);
361  const int y1 = stackPos(1);
362  const int x2 = stackPos(2);
363  const int y2 = stackPos(3);
364  int x = stackPos(4), y = stackPos(5);
365  if (_itemInHand >= 0) {
366  const int8 *desc = &_itemBuffer2[_itemInHand*2];
367  x -= 12;
368  x += desc[0];
369  y -= 19;
370  y += desc[1];
371  }
372 
373  if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
374  return 1;
375  else
376  return 0;
377 }
378 
380  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_updateConversations(%p) (%d)", (const void *)script, stackPos(0));
381  int dlgIndex = stackPos(0);
382  switch (_currentChapter-2) {
383  case 0:
384  dlgIndex -= 34;
385  break;
386 
387  case 1:
388  dlgIndex -= 54;
389  break;
390 
391  case 2:
392  dlgIndex -= 55;
393  break;
394 
395  case 3:
396  dlgIndex -= 70;
397  break;
398 
399  default:
400  break;
401  }
402 
403  int convs[4];
404  Common::fill(convs, convs+4, -1);
405 
406  if (_currentChapter == 1) {
407  switch (_mainCharacter.dlgIndex) {
408  case 0:
409  convs[0] = 6;
410  convs[1] = 12;
411  break;
412 
413  case 2:
414  convs[0] = 8;
415  convs[1] = 14;
416  break;
417 
418  case 3:
419  convs[0] = 9;
420  convs[1] = 15;
421  break;
422 
423  case 4:
424  convs[0] = 10;
425  convs[1] = 16;
426  break;
427 
428  case 5:
429  convs[0] = 11;
430  convs[1] = 17;
431  break;
432 
433  case 6:
434  convs[0] = 0;
435  convs[1] = 12;
436  break;
437 
438  case 8:
439  convs[0] = 2;
440  convs[1] = 14;
441  break;
442 
443  case 9:
444  convs[0] = 3;
445  convs[1] = 15;
446  break;
447 
448  case 10:
449  convs[0] = 4;
450  convs[1] = 16;
451  break;
452 
453  case 11:
454  convs[0] = 5;
455  convs[1] = 17;
456  break;
457 
458  case 12:
459  convs[0] = 0;
460  convs[1] = 6;
461  break;
462 
463  case 14:
464  convs[0] = 2;
465  convs[1] = 8;
466  break;
467 
468  case 15:
469  convs[0] = 3;
470  convs[1] = 9;
471  break;
472 
473  case 16:
474  convs[0] = 4;
475  convs[1] = 10;
476  break;
477 
478  case 17:
479  convs[0] = 5;
480  convs[1] = 11;
481  break;
482 
483  default:
484  break;
485  }
486  } else if (_currentChapter == 2) {
487  switch (_mainCharacter.dlgIndex) {
488  case 0:
489  convs[0] = 4;
490  convs[1] = 8;
491  convs[2] = 5;
492  convs[3] = 9;
493  break;
494 
495  case 1:
496  convs[0] = 4;
497  convs[1] = 8;
498  convs[2] = 0;
499  convs[3] = 5;
500  break;
501 
502  case 2:
503  convs[0] = 6;
504  convs[2] = 11;
505  break;
506 
507  case 3:
508  convs[0] = 7;
509  convs[2] = 12;
510  break;
511 
512  case 4:
513  convs[0] = 0;
514  convs[1] = 8;
515  convs[2] = 1;
516  convs[3] = 9;
517  break;
518 
519  case 5:
520  convs[0] = 0;
521  convs[1] = 8;
522  convs[2] = 4;
523  convs[3] = 1;
524  break;
525 
526  case 6:
527  convs[0] = 2;
528  convs[1] = 10;
529  break;
530 
531  case 7:
532  convs[0] = 3;
533  convs[1] = 11;
534  break;
535 
536  case 8:
537  convs[0] = 0;
538  convs[1] = 4;
539  convs[2] = 1;
540  break;
541 
542  case 9:
543  convs[0] = 0;
544  convs[1] = 4;
545  convs[2] = 0;
546  convs[3] = 1;
547  break;
548 
549  case 10:
550  convs[0] = 2;
551  convs[1] = 6;
552  break;
553 
554  case 11:
555  convs[0] = 3;
556  convs[1] = 7;
557  break;
558 
559  default:
560  break;
561  }
562  } else if (_currentChapter == 4) {
563  if (_malcolmsMood == 0) {
564  convs[0] = _mainCharacter.dlgIndex - 10;
565  convs[1] = _mainCharacter.dlgIndex - 5;
566  } else if (_malcolmsMood == 1) {
567  convs[0] = _mainCharacter.dlgIndex + 5;
568  convs[1] = _mainCharacter.dlgIndex + 10;
569  } else if (_malcolmsMood == 2) {
570  convs[0] = _mainCharacter.dlgIndex - 5;
571  convs[1] = _mainCharacter.dlgIndex + 5;
572  }
573  }
574 
575  for (int i = 0; i < 4; ++i) {
576  if (convs[i] != -1)
577  _conversationState[dlgIndex][convs[i]] = 0;
578  }
579 
580  return 1;
581 }
582 
584  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeItemSlot(%p) (%d)", (const void *)script, stackPos(0));
587  return 1;
588 }
589 
591  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setSceneDim(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
592  _sceneMinX = stackPos(0);
593  _sceneMaxX = stackPos(1);
594  return 0;
595 }
596 
598  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setSceneAnimPosAndFrame(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script,
599  stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
600  SceneAnim &anim = _sceneAnims[stackPos(0)];
601  const int newX2 = stackPos(1);
602  const int newY2 = stackPos(2);
603  const int newX = stackPos(3);
604  const int newY = stackPos(4);
605 
606  if (newX2 >= 0)
607  anim.x2 = newX2;
608  if (newY2 >= 0)
609  anim.y2 = newY2;
610 
611  if (newX >= 0)
612  anim.x = newX;
613  else
614  anim.x = anim.x2 + (anim.width >> 1);
615 
616  if (newY >= 0)
617  anim.y = newY;
618  else
619  anim.y = anim.y2 + anim.height - 1;
620 
623  return 0;
624 }
625 
627  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeItemInstances(%p) (%d)", (const void *)script, stackPos(0));
628  const int16 item = stackPos(0);
629 
630  int deleted = 0;
631 
632  for (int i = 0; i < 10; ++i) {
633  if (_mainCharacter.inventory[i] == item) {
635  ++deleted;
636  }
637  }
638 
639  if (_itemInHand == item) {
640  removeHandItem();
641  ++deleted;
642  }
643 
644  for (int i = 0; i < 50; ++i) {
645  if (_itemList[i].id == item) {
646  _itemList[i].id = kItemNone;
647  ++deleted;
648  }
649  }
650 
651  return deleted;
652 }
653 
655  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_disableInventory(%p) ()", (const void *)script);
656  _enableInventory = false;
657  return 0;
658 }
659 
661  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_enableInventory(%p) ()", (const void *)script);
662  _enableInventory = true;
663  return 1;
664 }
665 
667  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_enterNewScene(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0),
668  stackPos(1), stackPos(2), stackPos(3), stackPos(4));
669 
670  _screen->hideMouse();
672 
673  _unk5 = 1;
674 
675  if (_mainCharX == -1 || _mainCharY == -1) {
678  }
679  _screen->showMouse();
680 
681  return 0;
682 }
683 
685  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_switchScene(%p) (%d)", (const void *)script, stackPos(0));
686  setGameFlag(1);
689  _noScriptEnter = false;
691  _noScriptEnter = true;
692  return 0;
693 }
694 
696  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setMalcolmPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
697  _mainCharX = stackPos(0);
698  _mainCharY = stackPos(1);
699 
700  if (_mainCharX == -1 && _mainCharY == -1)
702  else
704 
705  return 0;
706 }
707 
709  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_stopMusic(%p) ()", (const void *)script);
710  stopMusicTrack();
711  return 0;
712 }
713 
715  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_playSoundEffect(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
717  return 0;
718 }
719 
721  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getScore(%p) ()", (const void *)script);
722  return _score;
723 }
724 
726  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_daggerWarning(%p) ()", (const void *)script);
727  int selection = 1;
728 
729  _screen->hideMouse();
730  _screen->copyRegionToBuffer(1, 0, 0, 320, 200, _screenBuffer);
731  int curPageBackUp = _screen->_curPage;
732  _screen->_curPage = 2;
733 
734  _screen->drawFilledBox(0, 0, 0x13F, 0xC7, 0xB4, 0xB3, 0xB6);
735  _screen->drawFilledBox(0xF, 0xAA, 0x68, 0xBA, 0xB4, 0xB3, 0xB6);
736  _screen->drawFilledBox(0x73, 0xAA, 0xCC, 0xBA, 0xB4, 0xB3, 0xB6);
737  _screen->drawFilledBox(0xD6, 0xAA, 0x12F, 0xBA, 0xB4, 0xB3, 0xB6);
738 
739  int y = 15;
740  for (int i = 100; i <= 107; ++i) {
741  const char *str = (const char *)getTableEntry(_cCodeFile, i);
742  int x = _text->getCenterStringX(str, 0, 0x13F);
743  _text->printText(str, x, y, 0xFF, 0xF0, 0x00);
744  y += 10;
745  }
746  y += 15;
747  for (int i = 110; i <= 113; ++i) {
748  const char *str = (const char *)getTableEntry(_cCodeFile, i);
749  int x = _text->getCenterStringX(str, 0, 0x13F);
750  _text->printText(str, x, y, 0xFF, 0xF0, 0x00);
751  y += 10;
752  }
753 
754  const char *str = 0;
755  int x = 0;
756 
757  str = (const char *)getTableEntry(_cCodeFile, 120);
758  x = _text->getCenterStringX(str, 0xF, 0x68);
759  _text->printText(str, x, 174, 0xFF, 0xF0, 0x00);
760 
761  str = (const char *)getTableEntry(_cCodeFile, 121);
762  x = _text->getCenterStringX(str, 0x73, 0xCC);
763  _text->printText(str, x, 174, 0xFF, 0xF0, 0x00);
764 
765  str = (const char *)getTableEntry(_cCodeFile, 122);
766  x = _text->getCenterStringX(str, 0xD6, 0x12F);
767  _text->printText(str, x, 174, 0xFF, 0xF0, 0x00);
768 
769  _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
771 
772  _screen->_curPage = curPageBackUp;
773  _screen->showMouse();
774 
775  while (!shouldQuit()) {
776  int keys = checkInput(0);
777  removeInputTop();
778 
779  if (keys == 198 || keys == 199) {
780  if (_mouseX >= 15 && _mouseX <= 104 && _mouseY >= 170 && _mouseY <= 186) {
781  selection = 1;
782  break;
783  } else if (_mouseX >= 115 && _mouseX <= 204 && _mouseY >= 170 && _mouseY <= 186) {
784  selection = 2;
785  break;
786  } else if (_mouseX >= 214 && _mouseX <= 303 && _mouseY >= 170 && _mouseY <= 186) {
787  selection = 3;
788  break;
789  }
790  }
791 
792  delay(10);
793  }
794 
795  restorePage3();
796  _screen->copyBlockToPage(1, 0, 0, 320, 200, _screenBuffer);
797  return selection;
798 }
799 
801  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_blockOutWalkableRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
802  const int x1 = stackPos(0);
803  int y1 = stackPos(1);
804  const int x2 = stackPos(2);
805  int y2 = stackPos(3);
806 
807  if (y1 < _maskPageMinY)
808  y1 = _maskPageMinY;
809  if (y2 > _maskPageMaxY)
810  y2 = _maskPageMaxY;
811 
812  _screen->blockOutRegion(x1, y1, x2-x1+1, y2-y1+1);
813  return 0;
814 }
815 
817  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showSceneStringsMessage(%p) (%d)", (const void *)script, stackPos(0));
818  showMessage((const char *)getTableEntry(_sceneStrings, stackPos(0)), 0xFF, 0xF0);
819  return 0;
820 }
821 
823  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_showGoodConscience(%p) ()", (const void *)script);
825  return 0;
826 }
827 
829  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_goodConscienceChat(%p) (%d)", (const void *)script, stackPos(0));
830  int id = stackPos(0);
831  const char *str = (const char *)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id);
832  goodConscienceChat(str, _vocHigh, id);
833  return 0;
834 }
835 
837  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_hideGoodConscience(%p) ()", (const void *)script);
839  return 0;
840 }
841 
843  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_defineSceneAnim(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')",
844  (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7),
845  stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12));
846  const int animId = stackPos(0);
847  SceneAnim &anim = _sceneAnims[animId];
848 
849  uint16 flags = anim.flags = stackPos(1);
850  int x = anim.x = stackPos(2);
851  int y = anim.y = stackPos(3);
852  int x2 = anim.x2 = stackPos(4);
853  int y2 = anim.y2 = stackPos(5);
854  int w = anim.width = stackPos(6);
855  int h = anim.height = stackPos(7);
856  anim.specialSize = stackPos(9);
857  anim.shapeIndex = stackPos(11);
858  const char *filename = stackPosString(12);
859 
860  if (filename)
861  strcpy(anim.filename, filename);
862 
863  if (flags & 8) {
864  _sceneAnimMovie[animId]->open(filename, 1, 0);
865  if (_sceneAnimMovie[animId]->opened()) {
866  anim.wsaFlag = 1;
867  if (x2 == -1)
868  x2 = _sceneAnimMovie[animId]->xAdd();
869  if (y2 == -1)
870  y2 = _sceneAnimMovie[animId]->yAdd();
871  if (w == -1)
872  w = _sceneAnimMovie[animId]->width();
873  if (h == -1)
874  h = _sceneAnimMovie[animId]->height();
875  if (x == -1)
876  x = (w >> 1) + x2;
877  if (y == -1)
878  y = y2 + h - 1;
879 
880  anim.x = x;
881  anim.y = y;
882  anim.x2 = x2;
883  anim.y2 = y2;
884  anim.width = w;
885  anim.height = h;
886  }
887  }
888 
889  return 9;
890 }
891 
893  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_updateSceneAnim(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
896  return 0;
897 }
898 
900  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_runActorScript(%p) ()", (const void *)script);
901  EMCData data;
902  EMCState state;
903  memset(&data, 0, sizeof(data));
904  memset(&state, 0, sizeof(state));
905 
906  _res->exists("_ACTOR.EMC", true);
907  _emc->load("_ACTOR.EMC", &data, &_opcodes);
908  _emc->init(&state, &data);
909  _emc->start(&state, 0);
910 
911  state.regs[4] = _itemInHand;
912  state.regs[0] = _mainCharacter.sceneId;
913 
914  int vocHigh = _vocHigh;
915  _vocHigh = 200;
916  _useActorBuffer = true;
917 
918  while (_emc->isValid(&state))
919  _emc->run(&state);
920 
921  _useActorBuffer = false;
922  _vocHigh = vocHigh;
923  _emc->unload(&data);
924 
925  if (queryGameFlag(0x218)) {
926  resetGameFlag(0x218);
927  enterNewScene(78, -1, 0, 0, 0);
928  }
929 
930  return 0;
931 }
932 
934  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_doDialog(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
935  doDialog(stackPos(0), stackPos(1));
936  return 0;
937 }
938 
940  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setConversationState(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
941  int id = stackPos(0);
942  const int dlgIndex = stackPos(1);
943  const int value = stackPos(2);
944 
945  switch (_currentChapter-2) {
946  case 0:
947  id -= 34;
948  break;
949 
950  case 1:
951  id -= 54;
952  break;
953 
954  case 2:
955  id -= 55;
956  break;
957 
958  case 3:
959  id -= 70;
960  break;
961 
962  default:
963  break;
964  }
965 
966  return (_conversationState[id][dlgIndex] = value);
967 }
968 
970  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getConversationState(%p) (%d)", (const void *)script, stackPos(0));
971  int id = stackPos(0);
972  const int dlgIndex = _mainCharacter.dlgIndex;
973 
974  switch (_currentChapter-2) {
975  case 0:
976  id -= 34;
977  break;
978 
979  case 1:
980  id -= 54;
981  break;
982 
983  case 2:
984  id -= 55;
985  break;
986 
987  case 3:
988  id -= 70;
989  break;
990 
991  default:
992  break;
993  }
994 
995  return _conversationState[id][dlgIndex];
996 }
997 
999  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_changeChapter(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
1001  return 0;
1002 }
1003 
1005  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
1006  int count = 0;
1007  const int16 item = stackPos(0);
1008 
1009  for (int i = 0; i < 10; ++i) {
1010  if (_mainCharacter.inventory[i] == item)
1011  ++count;
1012  }
1013 
1014  if (_itemInHand == item)
1015  ++count;
1016 
1017  for (int i = 0; i < 50; ++i) {
1018  if (_itemList[i].id == item)
1019  ++count;
1020  }
1021 
1022  return count;
1023 }
1024 
1026  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_dialogStartScript(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
1028  return 0;
1029 }
1030 
1032  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_dialogEndScript(%p) (%d)", (const void *)script, stackPos(0));
1034  return 0;
1035 }
1036 
1038  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_customChat(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
1039  const int id = stackPos(0);
1040  const int object = stackPos(1);
1041  const char *str = (const char *)getTableEntry(_sceneStrings, id);
1042 
1043  if (!str)
1044  return 0;
1045 
1046  strcpy(_stringBuffer, str);
1048  _chatObject = object;
1049  _chatVocHigh = _chatVocLow = -1;
1050  objectChatInit(_stringBuffer, object, _vocHigh, id);
1051  playVoice(_vocHigh, id);
1052  return 0;
1053 }
1054 
1056  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_customChatFinish(%p) ()", (const void *)script);
1057  _text->restoreScreen();
1058  _chatText = 0;
1059  _chatObject = -1;
1060  return 0;
1061 }
1062 
1064  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setupSceneAnimObject(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %s)", (const void *)script,
1065  stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9),
1066  stackPos(10), stackPos(11), stackPosString(12));
1068  stackPos(9), stackPos(10), stackPos(11), stackPosString(12));
1069  return 0;
1070 }
1071 
1073  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_removeSceneAnimObject(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
1075  return 0;
1076 }
1077 
1079  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_dummy(%p) ()", (const void *)script);
1080  return 0;
1081 }
1082 
1083 #pragma mark -
1084 
1086  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3a_setCharacterFrame(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
1087  static const uint8 frameTable[] = {
1088  0x58, 0xD8, 0xD8, 0x98, 0x78, 0x78, 0xB8, 0xB8
1089  };
1090 
1091  _animNewFrame = stackPos(0);
1092  if (_useFrameTable)
1093  _animNewFrame += frameTable[_mainCharacter.facing];
1094 
1095  _animDelayTime = stackPos(1);
1096  _animNeedUpdate = true;
1097  return 0;
1098 }
1099 
1101  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3a_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
1102  snd_playSoundEffect(stackPos(0), 200);
1103  return 0;
1104 }
1105 
1106 #pragma mark -
1107 
1109  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3d_updateAnim(%p) (%d)", (const void *)script, stackPos(0));
1110  if (_dialogSceneAnim >= 0)
1112  return 0;
1113 }
1114 
1116  debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3d_delay(%p) (%d)", (const void *)script, stackPos(0));
1117  delayUntil(_system->getMillis() + stackPos(0) * _tickLength, false, true);
1118  return 0;
1119 }
1120 
1121 #pragma mark -
1122 
1124 #define SetOpcodeTable(x) table = &x;
1125 #define Opcode(x) table->push_back(new OpcodeV3(this, &KyraEngine_MR::x))
1126 #define OpcodeUnImpl() table->push_back(new OpcodeV3(this, 0))
1128  Common::Array<const Opcode *> *table = 0;
1129 
1130  _opcodes.reserve(176);
1132  // 0x00
1137  // 0x04
1142  // 0x08
1144  Opcode(o3_dummy);
1145  Opcode(o3_dummy);
1147  // 0x0C
1152  // 0x10
1153  OpcodeUnImpl();
1155  Opcode(o3_dummy);
1156  Opcode(o3_dummy);
1157  // 0x14
1160  Opcode(o3_dummy);
1162  // 0x18
1163  OpcodeUnImpl();
1167  // 0x1C
1169  OpcodeUnImpl();
1172  // 0x20
1174  Opcode(o3_dummy);
1177  // 0x24
1182  // 0x28
1187  // 0x2C
1192  // 0x30
1196  Opcode(o3_dummy);
1197  // 0x34
1200  Opcode(o3_dummy);
1201  Opcode(o2_delay);
1202  // 0x38
1206  OpcodeUnImpl();
1207  // 0x3C
1212  // 0x40
1216  Opcode(o3_dummy);
1217  // 0x44
1218  Opcode(o3_dummy);
1220  OpcodeUnImpl();
1221  Opcode(o3_dummy);
1222  // 0x48
1223  Opcode(o3_dummy);
1224  Opcode(o3_dummy);
1226  Opcode(o2_update);
1227  // 0x4C
1229  Opcode(o3_dummy);
1232  // 0x50
1236  Opcode(o3_dummy);
1237  // 0x54
1238  Opcode(o3_dummy);
1239  Opcode(o3_dummy);
1242  // 0x58
1247  // 0x5C
1249  Opcode(o3_dummy);
1251  OpcodeUnImpl();
1252  // 0x60
1253  Opcode(o1_getRand);
1254  Opcode(o3_dummy);
1257  // 0x64
1260  Opcode(o3_dummy);
1261  Opcode(o3_dummy);
1262  // 0x68
1263  Opcode(o3_dummy);
1264  Opcode(o3_dummy);
1265  Opcode(o3_dummy);
1267  // 0x6C
1268  Opcode(o3_dummy);
1272  // 0x70
1274  Opcode(o3_dummy);
1276  Opcode(o3_dummy);
1277  // 0x74
1282  // 0x78
1286  OpcodeUnImpl();
1287  // 0x7C
1288  OpcodeUnImpl();
1290  Opcode(o3_dummy);
1291  Opcode(o3_dummy);
1292  // 0x80
1293  Opcode(o3_dummy);
1295  Opcode(o3_dummy);
1296  Opcode(o3_dummy);
1297  // 0x84
1298  Opcode(o3_dummy);
1299  Opcode(o3_dummy);
1300  Opcode(o3_dummy);
1301  Opcode(o3_dummy);
1302  // 0x88
1304  Opcode(o3_dummy);
1306  Opcode(o3_dummy);
1307  // 0x8C
1309  Opcode(o3_dummy);
1310  Opcode(o3_dummy);
1312  // 0x90
1315  Opcode(o3_dummy);
1317  // 0x94
1319  Opcode(o3_dummy);
1320  Opcode(o3_dummy);
1321  OpcodeUnImpl();
1322  // 0x98
1327  // 0x9C
1331  OpcodeUnImpl();
1332  // 0xA0
1333  Opcode(o3_dummy);
1334  Opcode(o3_dummy);
1335  Opcode(o3_dummy);
1336  Opcode(o3_dummy);
1337  // 0xA4
1338  OpcodeUnImpl();
1339  OpcodeUnImpl();
1340  OpcodeUnImpl();
1342  // 0xA8
1344  OpcodeUnImpl();
1345  OpcodeUnImpl();
1346  OpcodeUnImpl();
1347  // 0xAC
1348  OpcodeUnImpl();
1349  Opcode(o3_dummy);
1350  OpcodeUnImpl();
1351  Opcode(o3_dummy);
1352 
1353  _opcodesAnimation.reserve(8);
1355  // 0x00
1359  Opcode(o3_dummy);
1360  // 0x04
1362  Opcode(o1_getRand);
1364  Opcode(o3_dummy);
1365 
1366  _opcodesDialog.reserve(5);
1368  // 0x00
1370  Opcode(o3d_delay);
1371  Opcode(o1_getRand);
1373  // 0x04
1374  Opcode(o3_dummy);
1375 }
1376 
1377 } // End of namespace Kyra
int o2_disableTimer(EMCState *script)
Definition: script_v2.cpp:293
int o2_setSpecialSceneScriptState(EMCState *script)
Definition: script_v2.cpp:266
int o3_getCharacterFrameFromFacing(EMCState *script)
Definition: script_mr.cpp:92
Character _mainCharacter
Definition: kyra_v2.h:330
unsigned short uint16
Definition: cdtypes.h:27
int o2_addSpecialExit(EMCState *script)
Definition: script_v2.cpp:103
int o2_setTimerCountdown(EMCState *script)
Definition: script_v2.cpp:305
int o2_getCharacterFacing(EMCState *script)
Definition: script_v2.cpp:41
uint8 * _gamePlayBuffer
Definition: kyra_mr.h:192
Common::Functor1Mem< EMCState *, int, KyraEngine_MR > OpcodeV3
Definition: script_mr.cpp:1123
int width() const
Definition: wsamovie.h:66
int o3d_updateAnim(EMCState *script)
Definition: script_mr.cpp:1108
int o3_setCharacterFacing(EMCState *script)
Definition: script_mr.cpp:97
int o3_setupSceneAnimObject(EMCState *script)
Definition: script_mr.cpp:1063
unsigned int uint32
Definition: cdtypes.h:26
int o2_getCharacterScene(EMCState *script)
Definition: script_v2.cpp:46
int o3_setConversationState(EMCState *script)
Definition: script_mr.cpp:939
void playVoice(int high, int low)
Definition: kyra_mr.cpp:451
int count
Definition: voc.cpp:116
int o1_showMouse(EMCState *script)
Definition: script_v1.cpp:60
int o3_showSceneStringsMessage(EMCState *script)
Definition: script_mr.cpp:816
#define stackPosString(x)
Definition: script.h:63
void addItemToAnimList(int item)
Screen_MR * _screen
Definition: kyra_mr.h:82
int o3a_setCharacterFrame(EMCState *script)
Definition: script_mr.cpp:1085
signed char int8
Definition: cdtypes.h:31
Common::Array< const Opcode * > _opcodesAnimation
Definition: kyra_v2.h:227
static uint16 keys
Definition: keys.cpp:82
byte id
Definition: action.cpp:1401
int o3_removeItemSlot(EMCState *script)
Definition: script_mr.cpp:583
bool _specialSceneScriptRunFlag
Definition: kyra_v2.h:220
bool start(EMCState *script, int function)
Definition: script.cpp:155
int findFreeInventorySlot()
Definition: items_mr.cpp:41
int o2_checkForItem(EMCState *script)
Definition: script_v2.cpp:83
int o3_showAlbum(EMCState *script)
Definition: script_mr.cpp:130
int o3_setSceneAnimPosAndFrame(EMCState *script)
Definition: script_mr.cpp:597
int o3_updateSceneAnim(EMCState *script)
Definition: script_mr.cpp:892
u16 flags
Definition: zipreader.h:215
int o3_makeSecondChanceSave(EMCState *script)
Definition: script_mr.cpp:285
uint8 * getShapePtr(int index) const
Definition: kyra_v2.cpp:191
void goodConscienceChat(const char *str, int vocHigh, int vocLow)
Definition: text_mr.cpp:422
int setGameFlag(int flag)
Definition: kyra_v1.cpp:511
SceneDesc * _sceneList
Definition: kyra_v2.h:174
int checkInput(Button *buttonList, bool mainLoop=false, int eventFlag=0x8000)
Definition: kyra_v1.cpp:239
uint8 * _actorFile
Definition: kyra_mr.h:273
int o1_setDeathHandler(EMCState *script)
Definition: script_v1.cpp:89
int y
Definition: dialogs.cpp:409
int o3_addItemToCurScene(EMCState *script)
Definition: script_mr.cpp:159
void resetItem(int index)
Definition: items_v2.cpp:77
static const BdfFontData desc
void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2)
Definition: text_mr.cpp:130
int o3_showBadConscience(EMCState *script)
Definition: script_mr.cpp:118
unsigned char uint8
Definition: cdtypes.h:28
int o1_setHandItem(EMCState *script)
Definition: script_v1.cpp:72
void doDialog(int dlgIndex, int funcNum)
Definition: text_mr.cpp:849
int o3_daggerWarning(EMCState *script)
Definition: script_mr.cpp:725
int o1_setMousePos(EMCState *script)
Definition: script_v1.cpp:66
static CodeValue value
Definition: decode.cpp:55
int open(const char *filename, int unk1, Palette *palette)
Definition: wsamovie.cpp:364
int o3_disguiseMalcolm(EMCState *script)
Definition: script_mr.cpp:318
int o3_runActorScript(EMCState *script)
Definition: script_mr.cpp:899
void debugC(int level, uint32 debugChannels, const char *s,...)
Definition: debug.cpp:205
byte flag
int o3_setMalcolmPos(EMCState *script)
Definition: script_mr.cpp:695
int o3_customChatFinish(EMCState *script)
Definition: script_mr.cpp:1055
int o2_getCharacterX(EMCState *script)
Definition: script_v2.cpp:31
int o1_removeHandItem(EMCState *script)
Definition: script_v1.cpp:78
SceneAnim _sceneAnims[16]
Definition: kyra_v2.h:210
bool isValid(EMCState *script)
Definition: script.cpp:175
debug level for o::_* functions
Definition: kyra_v1.h:148
EMCInterpreter * _emc
Definition: kyra_v1.h:269
int o3_countInventoryItemInstances(EMCState *script)
Definition: script_mr.cpp:215
int o3_defineObject(EMCState *script)
Definition: script_mr.cpp:52
int o2_waitForConfirmationClick(EMCState *script)
Definition: script_v2.cpp:156
int o1_queryGameFlag(EMCState *script)
Definition: script_v1.cpp:30
int o3_switchScene(EMCState *script)
Definition: script_mr.cpp:684
bool updateScore(int scoreId, int strId)
Definition: kyra_mr.cpp:1289
Common::Array< const Opcode * > _opcodesDialog
Definition: kyra_mr.h:466
int o3_addItemToInventory(EMCState *script)
Definition: script_mr.cpp:147
int o3a_playSoundEffect(EMCState *script)
Definition: script_mr.cpp:1100
int o2_setVocHigh(EMCState *script)
Definition: script_v2.cpp:311
void playStudioSFX(const char *str)
Definition: kyra_mr.cpp:471
uint16 height
Definition: thumbnail.cpp:41
int o3_drawSceneShapeOnPage(EMCState *script)
Definition: script_mr.cpp:347
int o3_stopMusic(EMCState *script)
Definition: script_mr.cpp:708
uint8 * _sceneStrings
Definition: kyra_mr.h:275
int resetGameFlag(int flag)
Definition: kyra_v1.cpp:522
int o3_showSceneFileMessage(EMCState *script)
Definition: script_mr.cpp:103
int o3_setMalcolmsMood(EMCState *script)
Definition: script_mr.cpp:275
static bool shouldQuit()
Return whether the ENGINE should quit respectively should return to the launcher. ...
Definition: engine.cpp:669
int o2_getVocHigh(EMCState *script)
Definition: script_v2.cpp:317
int yAdd() const
Definition: wsamovie.h:123
int o2_delay(EMCState *script)
Definition: script_v2.cpp:117
int o3_objectChat(EMCState *script)
Definition: script_mr.cpp:188
void changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing)
Definition: kyra_mr.cpp:1342
Resource * _res
Definition: kyra_v1.h:264
void updateScreen()
Definition: screen.cpp:324
int o2_getDlgIndex(EMCState *script)
Definition: script_v2.cpp:192
OSystem * _system
Definition: engine.h:59
int queryGameFlag(int flag) const
Definition: kyra_v1.cpp:517
virtual uint32 getMillis(bool skipRecord=false)=0
Get the number of milliseconds since the program was started.
int o2_runAnimationScript(EMCState *script)
Definition: script_v2.cpp:227
bool exists(const char *file, bool errorOutOnFail=false)
Definition: resource.cpp:308
int o3_goodConscienceChat(EMCState *script)
Definition: script_mr.cpp:828
int o3_customChat(EMCState *script)
Definition: script_mr.cpp:1037
void hideMouse()
Definition: screen.cpp:3029
int _curPage
Definition: screen.h:628
void copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags=0)
Definition: screen.cpp:1007
int o3_doDialog(EMCState *script)
Definition: script_mr.cpp:933
void showMessage(const char *string, uint8 c0, uint8 c1)
Definition: gui_mr.cpp:105
int o3_defineSceneAnim(EMCState *script)
Definition: script_mr.cpp:842
void badConscienceChat(const char *str, int vocHigh, int vocLow)
Definition: text_mr.cpp:366
int o3_drawSceneShape(EMCState *script)
Definition: script_mr.cpp:325
int o3_wipeDownMouseItem(EMCState *script)
Definition: script_mr.cpp:248
void showMouse()
Definition: screen.cpp:3034
int o3_removeItemsFromScene(EMCState *script)
Definition: script_mr.cpp:298
virtual void delayUntil(uint32 timestamp, bool updateGameTimers=false, bool update=false, bool isMainLoop=false)
Definition: kyra_v1.cpp:528
int o3_badConscienceChat(EMCState *script)
Definition: script_mr.cpp:240
int o1_getRand(EMCState *script)
Definition: script_v1.cpp:45
int o3_hideBadConscience(EMCState *script)
Definition: script_mr.cpp:124
int o3_disableInventory(EMCState *script)
Definition: script_mr.cpp:654
Common::Array< const Opcode * > _opcodes
Definition: kyra_v1.h:327
int o3_countItemInstances(EMCState *script)
Definition: script_mr.cpp:1004
int o2_defineScene(EMCState *script)
Definition: script_v2.cpp:242
Constant for invalid item.
Definition: item.h:36
uint8 * _scenesFile
Definition: kyra_mr.h:270
void setupSceneAnimObject(int anim, uint16 flags, int x, int y, int x2, int y2, int w, int h, int unk10, int specialSize, int unk14, int shape, const char *filename)
int o3_changeChapter(EMCState *script)
Definition: script_mr.cpp:998
int o3_setSceneFilename(EMCState *script)
Definition: script_mr.cpp:291
void backUpGfxRect32x32(int x, int y)
Definition: kyra_mr.cpp:1224
uint8 * _sceneShapes[20]
Definition: kyra_mr.h:333
Common::String filename
Definition: action.cpp:479
void redrawInventory(int page)
Definition: gui_mr.cpp:429
int o3_getConversationState(EMCState *script)
Definition: script_mr.cpp:969
int o3_hideGoodConscience(EMCState *script)
Definition: script_mr.cpp:836
int o3_removeInventoryItemInstances(EMCState *script)
Definition: script_mr.cpp:205
InventoryItem item
Definition: action.cpp:650
void blockOutRegion(int x, int y, int width, int height)
Definition: screen.cpp:3199
Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail)
Definition: saveload_mr.cpp:33
int resetShapeHeight(uint8 *shape)
Definition: screen.cpp:3179
int o2_update(EMCState *script)
Definition: script_v2.cpp:140
ItemDefinition * _itemList
Definition: kyra_v2.h:296
void enterNewScene(uint16 scene, int facing, int unk1, int unk2, int unk3)
Definition: scene_mr.cpp:32
char * _stringBuffer
Definition: kyra_mr.h:521
int o2_defineItem(EMCState *script)
Definition: script_v2.cpp:88
int o2a_setAnimationShapes(EMCState *script)
Definition: script_v2.cpp:324
This is the namespace of the Kyra engine.
Definition: chargen.cpp:37
int o3_dialogEndScript(EMCState *script)
Definition: script_mr.cpp:1031
int o2_trySceneChange(EMCState *script)
Definition: script_v2.cpp:58
void dialogEndScript(int object)
Definition: text_mr.cpp:778
int o2_setDlgIndex(EMCState *script)
Definition: script_v2.cpp:186
void loadCharacterShapes(int newShapes)
Definition: kyra_mr.cpp:720
void delay(uint32 time, bool update=false, bool isMainLoop=false)
Definition: kyra_v2.cpp:149
int setNewShapeHeight(uint8 *shape, int height)
Definition: screen.cpp:3170
int o2_setHiddenItemsEntry(EMCState *script)
Definition: script_v2.cpp:283
void copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest)
Definition: screen.cpp:1067
int o3_blockOutWalkableRegion(EMCState *script)
Definition: script_mr.cpp:800
void dialogStartScript(int object, int funcNum)
Definition: text_mr.cpp:758
int o3_resetInventory(EMCState *script)
Definition: script_mr.cpp:199
void updateSceneAnim(int anim, int newFrame)
int o2_setSpecialSceneScriptRunTime(EMCState *script)
Definition: script_v2.cpp:235
Functor object for an unary class member function.
Definition: func.h:443
int o3_checkInRect(EMCState *script)
Definition: script_mr.cpp:357
int o3_removeItemInstances(EMCState *script)
Definition: script_mr.cpp:626
int o1_setGameFlag(EMCState *script)
Definition: script_v1.cpp:35
TextDisplayer_MR * _text
Definition: kyra_mr.h:657
int8 * _itemBuffer2
Definition: kyra_mr.h:282
uint16 _tickLength
Definition: kyra_v1.h:311
signed short int16
Definition: cdtypes.h:30
WSAMovie_v2 * _sceneAnimMovie[16]
Definition: kyra_v2.h:211
int o3_npcChatSequence(EMCState *script)
Definition: script_mr.cpp:231
void refreshAnimObjectsIfNeed()
int o3_enterNewScene(EMCState *script)
Definition: script_mr.cpp:666
int o2a_setResetFrame(EMCState *script)
Definition: script_v2.cpp:336
static const uint8 _characterFrameTable[]
Definition: kyra_mr.h:388
int xAdd() const
Definition: wsamovie.h:122
bool run(EMCState *script)
Definition: script.cpp:181
Common::Functor1< EMCState *, int > Opcode
Definition: script.h:33
int o3_updateScore(EMCState *script)
Definition: script_mr.cpp:280
void npcChatSequence(const char *str, int object, int vocHigh, int vocLow)
Definition: text_mr.cpp:793
int o2_getCharacterY(EMCState *script)
Definition: script_v2.cpp:36
int o3_removeSceneAnimObject(EMCState *script)
Definition: script_mr.cpp:1072
int selection
Definition: parser.cpp:50
bool load(const char *filename, EMCData *data, const Common::Array< const Opcode *> *opcodes)
Definition: script.cpp:98
int o3_refreshCharacter(EMCState *script)
Definition: script_mr.cpp:66
int o2_randomSceneChat(EMCState *script)
Definition: script_v2.cpp:180
virtual void drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags,...)
Definition: screen.cpp:1542
void unload(EMCData *data)
Definition: script.cpp:135
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:83
int o3_setSceneDim(EMCState *script)
Definition: script_mr.cpp:590
void objectChatInit(const char *text, int object, int vocHigh, int vocLow)
Definition: text_mr.cpp:235
#define stackPos(x)
Definition: script.h:62
uint8 frame
Definition: trainline.cpp:37
int o3_playSoundEffect(EMCState *script)
Definition: script_mr.cpp:714
int o3_dummy(EMCState *script)
Definition: script_mr.cpp:1078
int o3_setCharacterPos(EMCState *script)
Definition: script_mr.cpp:36
#define SetOpcodeTable(x)
Definition: script_mr.cpp:1124
int o3_getInventorySlot(EMCState *script)
Definition: script_mr.cpp:142
uint8 * getTableEntry(uint8 *buffer, int id)
Definition: kyra_mr.cpp:1246
void restoreGfxRect32x32(int x, int y)
Definition: kyra_mr.cpp:1228
int getCenterStringX(const char *str, int x1, int x2)
Definition: text.cpp:46
void deleteItemAnimEntry(int item)
int o3d_delay(EMCState *script)
Definition: script_mr.cpp:1115
int o2_enableTimer(EMCState *script)
Definition: script_v2.cpp:299
SceneShapeDesc _sceneShapeDescs[20]
Definition: kyra_mr.h:377
int o2_moveCharacter(EMCState *script)
Definition: script_v2.cpp:77
const char * _chatText
Definition: kyra_v2.h:346
int o2_setCharacterFacingOverwrite(EMCState *script)
Definition: script_v2.cpp:51
uint8 * _screenBuffer
Definition: kyra_v2.h:162
int o3_getMalcolmShapes(EMCState *script)
Definition: script_mr.cpp:31
int o3_dialogStartScript(EMCState *script)
Definition: script_mr.cpp:1025
int o3_showGoodConscience(EMCState *script)
Definition: script_mr.cpp:822
int o3_getScore(EMCState *script)
Definition: script_mr.cpp:720
int o2_clearSpecialSceneScriptState(EMCState *script)
Definition: script_v2.cpp:272
int o2_getShapeFlag1(EMCState *script)
Definition: script_v2.cpp:151
int o1_hideMouse(EMCState *script)
Definition: script_v1.cpp:54
void drawFilledBox(int x1, int y1, int x2, int y2, uint8 c1, uint8 c2, uint8 c3)
Definition: screen_mr.cpp:118
int o3_enableInventory(EMCState *script)
Definition: script_mr.cpp:660
int o1_resetGameFlag(EMCState *script)
Definition: script_v1.cpp:40
int8 _conversationState[30][30]
Definition: kyra_mr.h:440
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src)
Definition: screen.cpp:1104
uint8 * _cCodeFile
Definition: kyra_mr.h:269
int o3_setCharacterAnimFrameFromFacing(EMCState *script)
Definition: script_mr.cpp:109
int o3_setInventorySlot(EMCState *script)
Definition: script_mr.cpp:136
int o2_getHiddenItemsEntry(EMCState *script)
Definition: script_v2.cpp:288
ObjectIndex object
Definition: action.cpp:490
#define OpcodeUnImpl()
Definition: script_mr.cpp:1126
int o2_defineRoomEntrance(EMCState *script)
Definition: script_v2.cpp:198
u8 state
Definition: ps2kbd.h:101
void removeSceneAnimObject(int anim, int refresh)
int o1_playWanderScoreViaMap(EMCState *script)
Definition: script_v1.cpp:95
int o3_getMalcolmsMood(EMCState *script)
Definition: script_mr.cpp:87
int height() const
Definition: wsamovie.h:67
void updateCharacterAnim(int charId)
void init(EMCState *scriptState, const EMCData *data)
Definition: script.cpp:147
int o3_updateConversations(EMCState *script)
Definition: script_mr.cpp:379
int o1_getMouseState(EMCState *script)
Definition: script_v1.cpp:84
int o2_querySpecialSceneScriptState(EMCState *script)
Definition: script_v2.cpp:278
void updateCharPal(int unk1)
Definition: kyra_mr.cpp:834
void objectChat(const char *text, int object, int vocHigh, int vocLow)
Definition: text_mr.cpp:193
void snd_playSoundEffect(int item, int volume)
Definition: kyra_mr.cpp:441
int16 regs[30]
Definition: script.h:58
TalkObject * _talkObjectList
Definition: kyra_mr.h:412