ScummVM
scene_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"
26 #include "kyra/resource/resource.h"
27 
28 #include "common/system.h"
29 
30 namespace Kyra {
31 
32 void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2, int unk3) {
34  _screen->hideMouse();
35 
36  showMessage(0, 0xF0, 0xF0);
37  if (_inventoryState)
38  hideInventory();
39 
43  }
44 
45  if (unk1) {
46  int x = _mainCharacter.x1;
47  int y = _mainCharacter.y1;
48 
49  switch (facing) {
50  case 0:
51  y -= 6;
52  break;
53 
54  case 2:
55  x = 343;
56  break;
57 
58  case 4:
59  y = 191;
60  break;
61 
62  case 6:
63  x = -24;
64  break;
65  }
66 
67  moveCharacter(facing, x, y);
68  }
69 
70  uint32 waitUntilTimer = 0;
71  if (_lastMusicCommand != _sceneList[sceneId].sound) {
72  fadeOutMusic(60);
73  waitUntilTimer = _system->getMillis() + 60 * _tickLength;
74  }
75 
76  _chatAltFlag = false;
77 
78  if (!unk3) {
81  while (_emc->isValid(&_sceneScriptState))
83  }
84 
87 
88  _mainCharacter.sceneId = sceneId;
89  _sceneList[sceneId].flags &= ~1;
90  unloadScene();
91 
92  for (int i = 0; i < 4; ++i) {
95  }
97  loadScenePal();
98 
99  if (queryGameFlag(0x1D9)) {
100  char filename[20];
101  if (queryGameFlag(0x20D)) {
102  resetGameFlag(0x20D);
103  strcpy(filename, "COW1_");
104  } else if (queryGameFlag(0x20E)) {
105  resetGameFlag(0x20E);
106  strcpy(filename, "COW2_");
107  } else if (queryGameFlag(0x20F)) {
108  resetGameFlag(0x20F);
109  strcpy(filename, "COW3_");
110  } else if (queryGameFlag(0x20C)) {
111  resetGameFlag(0x20C);
112  strcpy(filename, "BOAT");
113  } else if (queryGameFlag(0x210)) {
114  resetGameFlag(0x210);
115  strcpy(filename, "JUNG");
116  }
117 
118  playVQA(filename);
119 
120  resetGameFlag(0x1D9);
121  }
122 
123  loadSceneMsc();
124  _sceneExit1 = _sceneList[sceneId].exit1;
125  _sceneExit2 = _sceneList[sceneId].exit2;
126  _sceneExit3 = _sceneList[sceneId].exit3;
127  _sceneExit4 = _sceneList[sceneId].exit4;
128 
129  while (_system->getMillis() < waitUntilTimer)
130  _system->delayMillis(10);
131 
132  initSceneScript(unk3);
133 
134  if (_overwriteSceneFacing) {
135  facing = _mainCharacter.facing;
136  _overwriteSceneFacing = false;
137  }
138 
139  enterNewSceneUnk1(facing, unk2, unk3);
141  _sceneScriptState.regs[3] = 1;
142  enterNewSceneUnk2(unk3);
143  if (queryGameFlag(0)) {
144  _showOutro = true;
145  _runFlag = false;
146  } else {
147  if (!--_enterNewSceneLock)
148  _unk5 = 0;
149 
151 
152  if (_itemInHand < 0) {
156  }
157 
158  Common::Point pos = getMousePos();
159  if (pos.y > 187)
160  setMousePos(pos.x, 179);
161  }
162  _screen->showMouse();
163 
164  _currentScene = sceneId;
165 }
166 
167 void KyraEngine_MR::enterNewSceneUnk1(int facing, int unk1, int unk2) {
168  int x = 0, y = 0;
169  int x2 = 0, y2 = 0;
170  bool needProc = true;
171 
172  if (_mainCharX == -1 && _mainCharY == -1) {
173  switch (facing+1) {
174  case 1: case 2: case 8:
175  x2 = _sceneEnterX3;
176  y2 = _sceneEnterY3;
177  break;
178 
179  case 3:
180  x2 = _sceneEnterX4;
181  y2 = _sceneEnterY4;
182  break;
183 
184  case 4: case 5: case 6:
185  x2 = _sceneEnterX1;
186  y2 = _sceneEnterY1;
187  break;
188 
189  case 7:
190  x2 = _sceneEnterX2;
191  y2 = _sceneEnterY2;
192  break;
193 
194  default:
195  x2 = y2 = -1;
196  }
197 
198  if (x2 >= 316)
199  x2 = 312;
200  if (y2 >= 185)
201  y2 = 183;
202  if (x2 <= 4)
203  x2 = 8;
204  }
205 
206  if (_mainCharX >= 0) {
207  x = x2 = _mainCharX;
208  needProc = false;
209  }
210 
211  if (_mainCharY >= 0) {
212  y = y2 = _mainCharY;
213  needProc = false;
214  }
215 
216  _mainCharX = _mainCharY = -1;
217 
218  if (unk1 && needProc) {
219  x = x2;
220  y = y2;
221 
222  switch (facing) {
223  case 0:
224  y2 = 191;
225  break;
226 
227  case 2:
228  x2 = -24;
229  break;
230 
231  case 4:
232  y2 = y - 4;
233  break;
234 
235  case 6:
236  x2 = 343;
237  break;
238 
239  default:
240  break;
241  }
242  }
243 
244  x2 &= ~3;
245  x &= ~3;
246  y2 &= ~1;
247  y &= ~1;
248 
249  _mainCharacter.facing = facing;
252  initSceneAnims(unk2);
253 
256  if (!unk2)
258 
259  if (unk1 && !unk2 && _mainCharacter.animFrame != 87)
260  moveCharacter(facing, x, y);
261 }
262 
264  _savedMouseState = -1;
265  if (_mainCharX == -1 && _mainCharY == -1 && !unk1) {
269  }
270 
271  if (!unk1) {
272  runSceneScript4(0);
274  }
275 
276  _unk4 = 0;
277  _savedMouseState = -1;
278 }
279 
281  delete[] _sceneStrings;
282  _sceneStrings = 0;
284  freeSceneShapes();
285  freeSceneAnims();
286 }
287 
289  for (uint i = 0; i < ARRAYSIZE(_sceneShapes); ++i) {
290  delete[] _sceneShapes[i];
291  _sceneShapes[i] = 0;
292  }
293 }
294 
296  char filename[16];
297  _screen->copyPalette(2, 0);
298  strcpy(filename, _sceneList[_mainCharacter.sceneId].filename1);
299  strcat(filename, ".COL");
300 
301  _screen->loadBitmap(filename, 3, 3, 0);
302  _screen->getPalette(2).copy(_screen->getCPagePtr(3), 0, 144);
303  _screen->getPalette(2).fill(0, 1, 0);
304 
305  for (int i = 144; i <= 167; ++i) {
306  uint8 *palette = _screen->getPalette(2).getData() + i * 3;
307  palette[0] = palette[2] = 63;
308  palette[1] = 0;
309  }
310 
312 
314 }
315 
317  char filename[16];
318  strcpy(filename, _sceneList[_mainCharacter.sceneId].filename1);
319  strcat(filename, ".MSC");
320 
321  _res->exists(filename, true);
322  Common::SeekableReadStream *stream = _res->createReadStream(filename);
323  assert(stream);
324  int16 minY = 0, height = 0;
325  minY = stream->readSint16LE();
326  height = stream->readSint16LE();
327  delete stream;
328  stream = 0;
329  _maskPageMinY = minY;
330  _maskPageMaxY = minY + height - 1;
331 
333 
334  _screen->loadBitmap(filename, 5, 5, 0, true);
335 
336  // HACK
337  uint8 *data = new uint8[320*200];
338  _screen->copyRegionToBuffer(5, 0, 0, 320, 200, data);
339  _screen->clearPage(5);
340  _screen->copyBlockToPage(5, 0, _maskPageMinY, 320, height, data);
341  delete[] data;
342 
343 }
344 
346  const SceneDesc &scene = _sceneList[_mainCharacter.sceneId];
347 
348  char filename[16];
349  strcpy(filename, scene.filename1);
350  strcat(filename, ".DAT");
351 
352  _res->exists(filename, true);
353  Common::SeekableReadStream *stream = _res->createReadStream(filename);
354  assert(stream);
355  stream->seek(2, SEEK_CUR);
356 
357  byte scaleTable[15];
358  stream->read(scaleTable, 15);
359  stream->read(_sceneDatPalette, 45);
360  stream->read(_sceneDatLayerTable, 15);
361  int16 shapesCount = stream->readSint16LE();
362 
363  for (int i = 0; i < 15; ++i)
364  _scaleTable[i] = (uint16(scaleTable[i]) << 8) / 100;
365 
366  if (shapesCount > 0) {
367  strcpy(filename, scene.filename1);
368  strcat(filename, "9.CPS");
369  _screen->loadBitmap(filename, 3, 3, 0);
370  int pageBackUp = _screen->_curPage;
371  _screen->_curPage = 2;
372  for (int i = 0; i < shapesCount; ++i) {
373  int16 x = stream->readSint16LE();
374  int16 y = stream->readSint16LE();
375  int16 w = stream->readSint16LE();
376  int16 h = stream->readSint16LE();
377  _sceneShapeDescs[i].drawX = stream->readSint16LE();
378  _sceneShapeDescs[i].drawY = stream->readSint16LE();
379  _sceneShapes[i] = _screen->encodeShape(x, y, w, h, 0);
380  assert(_sceneShapes[i]);
381  }
382  _screen->_curPage = pageBackUp;
383  }
384  delete stream;
385  stream = 0;
386 
387  strcpy(filename, scene.filename1);
388  strcat(filename, ".CPS");
389  _screen->loadBitmap(filename, 3, 3, 0);
390 
392  _sceneEnterX1 = 160;
393  _sceneEnterY1 = 0;
394  _sceneEnterX2 = 296;
395  _sceneEnterY2 = 93;
396  _sceneEnterX3 = 160;
397  _sceneEnterY3 = 171;
398  _sceneEnterX4 = 24;
399  _sceneEnterY4 = 93;
400  _sceneMinX = 0;
401  _sceneMaxX = 319;
402 
404  strcpy(filename, scene.filename2);
405  strcat(filename, ".EMC");
406  _res->exists(filename, true);
407  _emc->load(filename, &_sceneScriptData, &_opcodes);
408 
409  strcpy(filename, scene.filename2);
410  strcat(filename, ".");
411  loadLanguageFile(filename, _sceneStrings);
412 
413  runSceneScript8();
416  _sceneScriptState.regs[5] = unk1;
417  while (_emc->isValid(&_sceneScriptState))
419 
420  _screen->copyRegionToBuffer(3, 0, 0, 320, 200, _gamePlayBuffer);
421 
422  for (int i = 0; i < 10; ++i) {
424  _emc->start(&_sceneSpecialScripts[i], i+9);
426  }
427 
428  _sceneEnterX1 &= ~3;
429  _sceneEnterY1 &= ~1;
430  _sceneEnterX2 &= ~3;
431  _sceneEnterY2 &= ~1;
432  _sceneEnterX3 &= ~3;
433  _sceneEnterY3 &= ~1;
434  _sceneEnterX4 &= ~3;
435  _sceneEnterY4 &= ~1;
436 }
437 
439  for (int i = 0; i < 67; ++i)
440  _animObjects[i].enabled = false;
441 
442  AnimObj *obj = &_animObjects[0];
443 
444  if (_mainCharacter.animFrame != 87 && !unk1)
446 
447  obj->enabled = true;
448  obj->xPos1 = _mainCharacter.x1;
449  obj->yPos1 = _mainCharacter.y1;
452  obj->xPos2 = _mainCharacter.x1;
453  obj->yPos2 = _mainCharacter.y1;
455  obj->xPos3 = obj->xPos2 += (_malcolmShapeXOffset * _charScale) >> 8;
456  obj->yPos3 = obj->yPos2 += (_malcolmShapeYOffset * _charScale) >> 8;
459  obj->needRefresh = true;
460  _animList = 0;
461 
462  for (int i = 0; i < 16; ++i) {
463  const SceneAnim &anim = _sceneAnims[i];
464  obj = &_animObjects[i+1];
465  obj->enabled = false;
466  obj->needRefresh = false;
467 
468  if (anim.flags & 1) {
469  obj->enabled = true;
470  obj->needRefresh = true;
471  }
472 
473  obj->specialRefresh = (anim.flags & 0x20) ? 1 : 0;
474  obj->flags = (anim.flags & 0x10) ? 0x800 : 0;
475  if (anim.flags & 2)
476  obj->flags |= 1;
477 
478  obj->xPos1 = anim.x;
479  obj->yPos1 = anim.y;
480 
481  if ((anim.flags & 4) && anim.shapeIndex != -1)
482  obj->shapePtr = _sceneShapes[anim.shapeIndex];
483  else
484  obj->shapePtr = 0;
485 
486  if (anim.flags & 8) {
487  obj->shapeIndex3 = anim.shapeIndex;
488  obj->animNum = i;
489  } else {
490  obj->shapeIndex3 = 0xFFFF;
491  obj->animNum = 0xFFFF;
492  }
493 
494  obj->xPos3 = obj->xPos2 = anim.x2;
495  obj->yPos3 = obj->yPos2 = anim.y2;
496  obj->width = anim.width;
497  obj->height = anim.height;
498  obj->width2 = obj->height2 = anim.specialSize;
499 
500  if (anim.flags & 1) {
501  if (_animList)
503  else
505  }
506  }
507 
508  if (_animList)
510  else
512 
513  for (int i = 0; i < 50; ++i) {
514  obj = &_animObjects[i+17];
515  const ItemDefinition &item = _itemList[i];
516  if (item.id != kItemNone && item.sceneId == _mainCharacter.sceneId) {
517  obj->xPos1 = item.x;
518  obj->yPos1 = item.y;
520  obj->shapePtr = 0;
521  obj->shapeIndex1 = obj->shapeIndex2 = item.id + 248;
522  obj->xPos2 = item.x;
523  obj->yPos2 = item.y;
524 
525  int scale = getScale(obj->xPos1, obj->yPos1);
526  const uint8 *shape = getShapePtr(obj->shapeIndex1);
527  obj->xPos3 = obj->xPos2 -= (_screen->getShapeScaledWidth(shape, scale) >> 1);
528  obj->yPos3 = obj->yPos2 -= _screen->getShapeScaledHeight(shape, scale) - 1;
529  obj->enabled = true;
530  obj->needRefresh = true;
531 
532  if (_animList)
534  else
536  } else {
537  obj->enabled = false;
538  obj->needRefresh = false;
539  }
540  }
541 
542  for (int i = 0; i < 67; ++i)
543  _animObjects[i].needRefresh = _animObjects[i].enabled;
544 
545  restorePage3();
546  drawAnimObjects();
547  _screen->hideMouse();
548  initSceneScreen(unk1);
549  _screen->showMouse();
551 }
552 
554  _screen->copyBlockToPage(2, 0, 188, 320, 12, _interfaceCommandLine);
555 
556  if (_unkSceneScreenFlag1) {
557  _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
558  return;
559  }
560 
561  if (_noScriptEnter) {
562  _screen->getPalette(0).fill(0, 144, 0);
563  if (!_wasPlayingVQA)
565  }
566 
567  _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
568 
569  if (_noScriptEnter) {
570  if (!_wasPlayingVQA)
572  _screen->getPalette(0).copy(_screen->getPalette(2), 0, 144);
573  if (_wasPlayingVQA) {
574  _screen->fadeFromBlack(0x3C);
575  _wasPlayingVQA = false;
576  }
577  }
578 
579  updateCharPal(0);
581 
582  if (!_menuDirectlyToLoad) {
584  _sceneScriptState.regs[5] = unk1;
585 
586  while (_emc->isValid(&_sceneScriptState))
588  }
589 }
590 
591 int KyraEngine_MR::trySceneChange(int *moveTable, int unk1, int updateChar) {
592  bool running = true;
593  bool unkFlag = false;
594  int changedScene = 0;
595  const int *moveTableStart = moveTable;
596  _unk4 = 0;
597 
598  while (running && !shouldQuit()) {
599  if (*moveTable >= 0 && *moveTable <= 7) {
601  unkFlag = true;
602  } else {
603  if (*moveTable == 8) {
604  running = false;
605  } else {
606  ++moveTable;
607  unkFlag = false;
608  }
609  }
610 
611  if (checkSceneChange()) {
612  running = false;
613  changedScene = 1;
614  }
615 
616  if (unk1) {
617  // Notice that we can't use KyraEngine_MR's skipFlag handling
618  // here, since Kyra3 allows disabling of skipFlag support
619  if (KyraEngine_v2::skipFlag()) {
620  resetSkipFlag(false);
621  running = false;
622  _unk4 = 1;
623  }
624  }
625 
626  if (!unkFlag || !running)
627  continue;
628 
629  int ret = 0;
630  if (moveTable == moveTableStart || moveTable[1] == 8)
631  ret = updateCharPos(0, 0);
632  else
633  ret = updateCharPos(moveTable, 0);
634 
635  if (ret)
636  ++moveTable;
637 
638  delay(10, true);
639  }
640 
641  if (updateChar)
643 
646 
647  return changedScene;
648 }
649 
651  const SceneDesc &curScene = _sceneList[_mainCharacter.sceneId];
652  int charX = _mainCharacter.x1, charY = _mainCharacter.y1;
653  int facing = 0;
654  int process = 0;
655 
656  if (_screen->getLayer(charX, charY) == 1 && _savedMouseState == -7) {
657  facing = 0;
658  process = 1;
659  } else if (charX >= 316 && _savedMouseState == -6) {
660  facing = 2;
661  process = 1;
662  } else if (charY >= 186 && _savedMouseState == -5) {
663  facing = 4;
664  process = 1;
665  } else if (charX <= 4 && _savedMouseState == -4) {
666  facing = 6;
667  process = 1;
668  }
669 
670  if (!process)
671  return 0;
672 
673  uint16 newScene = 0xFFFF;
674  switch (facing) {
675  case 0:
676  newScene = curScene.exit1;
677  break;
678 
679  case 2:
680  newScene = curScene.exit2;
681  break;
682 
683  case 4:
684  newScene = curScene.exit3;
685  break;
686 
687  case 6:
688  newScene = curScene.exit4;
689  break;
690 
691  default:
692  newScene = _mainCharacter.sceneId;
693  }
694 
695  if (newScene == 0xFFFF)
696  return 0;
697 
698  enterNewScene(newScene, facing, 1, 1, 0);
699  return 1;
700 }
702  if (y > 187 && _savedMouseState > -4)
703  return 0;
704  if (_deathHandler >= 0)
705  return 0;
706 
708  _sceneScriptState.regs[1] = x;
709  _sceneScriptState.regs[2] = y;
710  _sceneScriptState.regs[3] = 0;
712 
714  while (_emc->isValid(&_sceneScriptState))
716 
717  return _sceneScriptState.regs[3];
718 }
719 
723  _sceneScriptState.regs[3] = 0;
725 
727  while (_emc->isValid(&_sceneScriptState))
729 
730  return _sceneScriptState.regs[3];
731 }
732 
735  _sceneScriptState.regs[5] = unk1;
736  _sceneScriptState.regs[3] = 0;
737  _noStartupChat = false;
738 
740  while (_emc->isValid(&_sceneScriptState))
742 
743  if (_sceneScriptState.regs[3])
744  _noStartupChat = true;
745 }
746 
749  while (_emc->isValid(&_sceneScriptState))
751 }
752 
754  static const uint8 widthTable[] = { 1, 1, 1, 1, 1, 2, 4, 6, 8 };
755 
756  if ((_pathfinderFlag & 2) && x >= 320)
757  return false;
758  if ((_pathfinderFlag & 4) && y >= 188)
759  return false;
760  if ((_pathfinderFlag & 8) && x < 0)
761  return false;
762  if (y > 187)
763  return false;
764 
765  uint width = widthTable[getScale(x, y) >> 5];
766 
767  if (y < 0)
768  y = 0;
769  x -= width >> 1;
770  if (x < 0)
771  x = 0;
772  int x2 = x + width;
773  if (x2 > 320)
774  x2 = 320;
775 
776  for (; x < x2; ++x) {
777  if (y < _maskPageMinY || y > _maskPageMaxY)
778  return false;
779 
780  if (!_screen->getShapeFlag1(x, y))
781  return false;
782  }
783 
784  return true;
785 }
786 
787 } // End of namespace Kyra
int _malcolmShapeXOffset
Definition: kyra_mr.h:323
virtual void setScreenPalette(const Palette &pal)
Definition: screen.cpp:918
bool _unkSceneScreenFlag1
Definition: kyra_v2.h:361
int _malcolmShapeYOffset
Definition: kyra_mr.h:323
void enterNewSceneUnk1(int facing, int unk1, int unk2)
Definition: scene_mr.cpp:167
Character _mainCharacter
Definition: kyra_v2.h:330
unsigned short uint16
Definition: cdtypes.h:27
void stopSound(int channel)
Stop the playback of a sound in the given channel.
uint8 * _gamePlayBuffer
Definition: kyra_mr.h:192
uint8 * _paletteOverlay
Definition: kyra_mr.h:505
AnimObj * _animList
Definition: kyra_v2.h:131
unsigned int uint32
Definition: cdtypes.h:26
EMCState _sceneScriptState
Definition: kyra_v2.h:192
const uint8 * getCPagePtr(int pageNum) const
Definition: screen.cpp:572
#define ARRAYEND(x)
Compute a pointer to one past the last element of an array.
Definition: util.h:71
#define SEEK_CUR
Definition: gba_nds_fat.h:77
Screen_MR * _screen
Definition: kyra_mr.h:82
int updateCharPos(int *table, int force=0)
Definition: kyra_v2.cpp:234
#define assert(s)
Definition: portdefs.h:77
AnimObj * initAnimList(AnimObj *list, AnimObj *entry)
Definition: animator_v2.cpp:39
bool start(EMCState *script, int function)
Definition: script.cpp:155
void openTalkFile(int file)
Definition: kyra_mr.cpp:693
Common::SeekableReadStream * createReadStream(const Common::String &file)
Definition: resource.cpp:337
void initSceneScreen(int unk1)
Definition: scene_mr.cpp:553
uint8 * getShapePtr(int index) const
Definition: kyra_v2.cpp:191
bool _menuDirectlyToLoad
Definition: kyra_mr.h:98
EMCData _sceneScriptData
Definition: kyra_v2.h:191
SceneDesc * _sceneList
Definition: kyra_v2.h:174
virtual void setMouseCursor(int x, int y, const byte *shape)
Definition: screen.cpp:3059
int y
Definition: dialogs.cpp:409
void setShapePages(int page1, int page2, int minY=-1, int maxY=201)
Definition: screen.cpp:3052
unsigned char uint8
Definition: cdtypes.h:28
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
Definition: util.h:66
Sound * sound()
Definition: kyra_v1.h:199
int getShapeScaledWidth(const uint8 *shpFile, int scale)
Definition: screen_v2.cpp:215
void copyPalette(const int dst, const int src)
Definition: screen.cpp:3112
Palette & getPalette(int num)
Definition: screen.cpp:3107
uint16 _sceneExit1
Definition: kyra_v2.h:178
uint32 _sceneSpecialScriptsTimer[10]
Definition: kyra_v2.h:218
void copy(const Palette &source, int firstCol=0, int numCols=-1, int dstStart=-1)
Copy data from another palette.
Definition: screen.cpp:3914
int16 _lastMusicCommand
Definition: kyra_v1.h:360
bool _overwriteSceneFacing
Definition: kyra_v2.h:185
SceneAnim _sceneAnims[16]
Definition: kyra_v2.h:210
bool isValid(EMCState *script)
Definition: script.cpp:175
EMCInterpreter * _emc
Definition: kyra_v1.h:269
virtual void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip=false)
Definition: screen.cpp:3233
Simple class for handling both 2D position and size.
Definition: rect.h:37
AnimObj * _animObjects
Definition: kyra_v2.h:124
uint16 height
Definition: thumbnail.cpp:41
uint8 * _sceneStrings
Definition: kyra_mr.h:275
int resetGameFlag(int flag)
Definition: kyra_v1.cpp:522
uint8 * getData()
Gets raw access to the palette.
Definition: screen.h:437
int getOppositeFacingDirection(int dir)
Definition: scene_v1.cpp:252
static bool shouldQuit()
Return whether the ENGINE should quit respectively should return to the launcher. ...
Definition: engine.cpp:669
void animSetupPaletteEntry(AnimObj *anim)
Definition: animator_mr.cpp:70
Resource * _res
Definition: kyra_v1.h:264
ShapeMap _gameShapes
Definition: kyra_v2.h:256
virtual uint32 read(void *dataPtr, uint32 dataSize)=0
Read data from the stream.
virtual bool seek(int32 offset, int whence=SEEK_SET)=0
Sets the stream position indicator for the stream.
void moveCharacter(int facing, int x, int y)
Definition: kyra_v2.cpp:198
void updateScreen()
Definition: screen.cpp:324
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.
bool exists(const char *file, bool errorOutOnFail=false)
Definition: resource.cpp:308
void snd_playWanderScoreViaMap(int track, int force)
Definition: kyra_mr.cpp:405
int getLayer(int x, int y)
Definition: screen_mr.cpp:35
void fill(int firstCol, int numCols, uint8 value)
Fill the given indexes with the given component value.
Definition: screen.cpp:3908
int8 _sceneDatPalette[45]
Definition: kyra_mr.h:368
byte getShapeFlag1(int x, int y)
Definition: screen_mr.cpp:59
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
void showMessage(const char *string, uint8 c0, uint8 c1)
Definition: gui_mr.cpp:105
void resetSkipFlag(bool removeEvent=true)
Definition: kyra_mr.cpp:1366
uint8 * encodeShape(int x, int y, int w, int h, int flags)
Definition: screen.cpp:2697
void refreshAnimObjects(int force)
void showMouse()
Definition: screen.cpp:3034
uint16 _sceneExit4
Definition: kyra_v2.h:178
void setCommandLineRestoreTimer(int secs)
Definition: timer_mr.cpp:91
int _fadeOutMusicChannel
Definition: kyra_mr.h:113
Common::Array< const Opcode * > _opcodes
Definition: kyra_v1.h:327
void initSceneScript(int unk1)
Definition: scene_mr.cpp:345
virtual bool skipFlag() const
Definition: kyra_v1.cpp:490
void enterNewSceneUnk2(int unk1)
Definition: scene_mr.cpp:263
Constant for invalid item.
Definition: item.h:36
FORCEINLINE int16 readSint16LE()
Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it...
Definition: stream.h:411
unsigned int uint
Definition: scummsys.h:440
int getScale(int x, int y)
Definition: kyra_mr.cpp:1218
uint8 * _sceneShapes[20]
Definition: kyra_mr.h:333
Common::String filename
Definition: action.cpp:479
bool _specialSceneScriptState[10]
Definition: kyra_v2.h:215
int8 _sceneDatLayerTable[15]
Definition: kyra_mr.h:369
InventoryItem item
Definition: action.cpp:650
void playVQA(const char *name)
Definition: kyra_mr.cpp:364
ItemDefinition * _itemList
Definition: kyra_v2.h:296
void enterNewScene(uint16 scene, int facing, int unk1, int unk2, int unk3)
Definition: scene_mr.cpp:32
SoundDigital_MR * _soundDigital
Definition: kyra_mr.h:83
Common::Point getMousePos()
Definition: kyra_v1.cpp:220
uint16 width
Definition: thumbnail.cpp:41
int loadLanguageFile(const char *file, uint8 *&buffer)
Definition: kyra_mr.cpp:1234
This is the namespace of the Kyra engine.
Definition: chargen.cpp:37
void delay(uint32 time, bool update=false, bool isMainLoop=false)
Definition: kyra_v2.cpp:149
void hideInventory()
Definition: gui_mr.cpp:240
void copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest)
Definition: screen.cpp:1067
EMCState _sceneSpecialScripts[10]
Definition: kyra_v2.h:217
void malcolmSceneStartupChat()
Definition: text_mr.cpp:598
uint16 _sceneExit3
Definition: kyra_v2.h:178
uint16 _tickLength
Definition: kyra_v1.h:311
signed short int16
Definition: cdtypes.h:30
uint8 * _interfaceCommandLine
Definition: kyra_mr.h:228
void refreshAnimObjectsIfNeed()
static const uint8 _characterFrameTable[]
Definition: kyra_mr.h:388
void initSceneAnims(int unk1)
Definition: scene_mr.cpp:438
void setNextIdleAnimTimer()
Definition: timer_mr.cpp:97
void runSceneScript4(int unk1)
Definition: scene_mr.cpp:733
bool run(EMCState *script)
Definition: script.cpp:181
void fadeOutMusic(int ticks)
Definition: kyra_mr.cpp:433
bool load(const char *filename, EMCData *data, const Common::Array< const Opcode *> *opcodes)
Definition: script.cpp:98
uint16 _sceneExit2
Definition: kyra_v2.h:178
int getShapeScaledHeight(const uint8 *shpFile, int scale)
Definition: screen_v2.cpp:222
void unload(EMCData *data)
Definition: script.cpp:135
signed char * fill(signed char *first, signed char *last, Value val)
Definition: algorithm.h:83
int runSceneScript1(int x, int y)
Definition: scene_mr.cpp:701
uint16 _specialExitTable[25]
Definition: kyra_v2.h:182
uint16 _currentScene
Definition: kyra_v2.h:176
int trySceneChange(int *moveTable, int unk1, int unk2)
Definition: scene_mr.cpp:591
SceneShapeDesc _sceneShapeDescs[20]
Definition: kyra_mr.h:377
bool process
Definition: action.cpp:686
void fadeFromBlack(int delay=0x54, const UpdateFunctor *upFunc=0)
Definition: screen.cpp:781
bool isPlaying(int channel)
Checks if a given channel is playing a sound.
uint8 * _costPalBuffer
Definition: kyra_mr.h:504
void clearPage(int pageNum)
Definition: screen.cpp:584
Interface for a seekable & readable data stream.
Definition: stream.h:561
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src)
Definition: screen.cpp:1104
if(!yymsg) yymsg
bool lineIsPassable(int x, int y)
Definition: scene_mr.cpp:753
int16 y
The vertical part of the point.
Definition: rect.h:39
int16 x
The horizontal part of the point.
Definition: rect.h:38
int _scaleTable[15]
Definition: kyra_mr.h:382
static const byte palette[]
void updateCharacterAnim(int charId)
void init(EMCState *scriptState, const EMCData *data)
Definition: script.cpp:147
virtual void delayMillis(uint msecs)=0
Delay/sleep for the specified amount of milliseconds.
AnimObj * addToAnimListSorted(AnimObj *list, AnimObj *entry)
Definition: animator_v2.cpp:44
unsigned char byte
Definition: portdefs.h:57
void setMousePos(int x, int y)
Definition: kyra_v1.cpp:231
void updateCharPal(int unk1)
Definition: kyra_mr.cpp:834
int16 regs[30]
Definition: script.h:58
uint8 * generateOverlay(const Palette &pal, uint8 *buffer, int color, uint weight, int maxColor=-1)
Definition: screen_v2.cpp:39