ScummVM
gui_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/gui/gui_mr.h"
24 #include "kyra/engine/kyra_mr.h"
25 #include "kyra/text/text_mr.h"
26 #include "kyra/resource/resource.h"
27 #include "kyra/engine/timer.h"
29 
30 #include "common/system.h"
31 
32 #include "graphics/scaler.h"
33 
34 namespace Kyra {
35 
37  _res->exists("BUTTONS.SHP", true);
38  uint8 *data = _res->fileData("BUTTONS.SHP", 0);
39  assert(data);
40  for (int i = 0; i <= 10; ++i)
41  addShapeToPool(data, 0x1C7+i, i);
42  delete[] data;
43 
47 
48  _gui->getScrollUpButton()->data0Callback = callback1;
49  _gui->getScrollUpButton()->data1Callback = callback2;
50  _gui->getScrollUpButton()->data2Callback = callback3;
51  _gui->getScrollDownButton()->data0Callback = callback1;
52  _gui->getScrollDownButton()->data1Callback = callback2;
53  _gui->getScrollDownButton()->data2Callback = callback3;
54 
55  _mainButtonData[0].data0Callback = callback1;
56  _mainButtonData[0].data1Callback = callback2;
57  _mainButtonData[0].data2Callback = callback3;
58 }
59 
61  const uint8 *shapePtr = 0;
62  if (button->index == 1)
63  shapePtr = getShapePtr(0x1CD);
64  else if (button->index == 22)
65  shapePtr = getShapePtr(0x1C7);
66  else if (button->index == 23)
67  shapePtr = getShapePtr(0x1CA);
68 
69  if (shapePtr)
70  _screen->drawShape(0, shapePtr, button->x, button->y, 0, 0, 0);
71 
72  return 0;
73 }
74 
76  const uint8 *shapePtr = 0;
77  if (button->index == 1)
78  shapePtr = getShapePtr(0x1CE);
79  else if (button->index == 22)
80  shapePtr = getShapePtr(0x1C9);
81  else if (button->index == 23)
82  shapePtr = getShapePtr(0x1CC);
83 
84  if (shapePtr)
85  _screen->drawShape(0, shapePtr, button->x, button->y, 0, 0, 0);
86 
87  return 0;
88 }
89 
91  const uint8 *shapePtr = 0;
92  if (button->index == 1)
93  shapePtr = getShapePtr(0x1CE);
94  else if (button->index == 22)
95  shapePtr = getShapePtr(0x1C8);
96  else if (button->index == 23)
97  shapePtr = getShapePtr(0x1CB);
98 
99  if (shapePtr)
100  _screen->drawShape(0, shapePtr, button->x, button->y, 0, 0, 0);
101 
102  return 0;
103 }
104 
105 void KyraEngine_MR::showMessage(const char *string, uint8 c0, uint8 c1) {
106  _shownMessage = string;
107 
109  _restoreCommandLine = false;
110 
111  if (string) {
112  int x = _text->getCenterStringX(string, 0, 320);
113  int pageBackUp = _screen->_curPage;
114  _screen->_curPage = 0;
115  _text->printText(string, x, _commandLineY, c0, c1, 0);
116  _screen->_curPage = pageBackUp;
119  }
120 }
121 
122 void KyraEngine_MR::showMessageFromCCode(int string, uint8 c0, int) {
123  showMessage((const char *)getTableEntry(_cCodeFile, string), c0, 0xF0);
124 }
125 
127  char buffer[100];
128  char *src = (char *)getTableEntry(_itemFile, item);
129 
130  while (*src != ' ')
131  ++src;
132  ++src;
133 
134  *src = toupper(*src);
135 
136  strcpy(buffer, src);
137  strcat(buffer, " ");
138  strcat(buffer, (const char *)getTableEntry(_cCodeFile, str));
139 
140  showMessage(buffer, c0, 0xF0);
141 }
142 
144  if (_restoreCommandLine) {
146  _restoreCommandLine = false;
147  }
148 }
149 
151  int y = _inventoryState ? 144 : 188;
152  _screen->copyBlockToPage(0, 0, y, 320, 12, _interfaceCommandLine);
153 }
154 
156  if (_inventoryState)
157  _commandLineY = 145;
158  else
159  _commandLineY = 189;
160 }
161 
163  if (!_screen->isMouseVisible())
164  return;
165  if (queryGameFlag(3))
166  return;
167 
168  _screen->copyBlockToPage(3, 0, 0, 320, 56, _interface);
170 
171  _inventoryState = true;
172  updateCLState();
173 
174  redrawInventory(30);
175  drawMalcolmsMoodPointer(-1, 30);
176  drawScore(30, 215, 191);
177 
178  if (queryGameFlag(0x97))
179  drawJestersStaff(1, 30);
180 
181  _screen->hideMouse();
182 
183  if (_itemInHand < 0) {
184  _mouseState = -1;
186  }
187 
188  _screen->copyRegion(0, 188, 0, 0, 320, 12, 0, 2, Screen::CR_NO_P_CHECK);
189 
190  if (_inventoryScrollSpeed == -1) {
191  uint32 endTime = _system->getMillis() + _tickLength * 15;
192  int times = 0;
193  while (_system->getMillis() < endTime) {
194  _screen->copyRegion(0, 188, 0, 0, 320, 12, 0, 2, Screen::CR_NO_P_CHECK);
195  _screen->copyRegion(0, 188, 0, 0, 320, 12, 0, 2, Screen::CR_NO_P_CHECK);
196  ++times;
197  }
198 
199  times = MAX(times, 1);
200 
201  int speed = 60 / times;
202  if (speed <= 1)
204  else if (speed >= 8)
206  else
207  _inventoryScrollSpeed = speed;
208  }
209 
210  int height = 12;
211  int y = 188;
212  int times = 0;
213  uint32 waitTill = _system->getMillis() + _tickLength;
214 
215  while (y > 144) {
216  _screen->copyRegion(0, 0, 0, y, 320, height, 2, 0, Screen::CR_NO_P_CHECK);
218 
219  ++times;
220  if (_inventoryScrollSpeed == 1 && times == 3) {
221  while (waitTill > _system->getMillis())
222  _system->delayMillis(10);
223  times = 0;
224  waitTill = _system->getMillis() + _tickLength;
225  }
226 
227  height += _inventoryScrollSpeed;
229  }
230 
231  _screen->copyRegion(0, 0, 0, 144, 320, 56, 2, 0, Screen::CR_NO_P_CHECK);
233 
234  initMainButtonList(false);
235 
236  restorePage3();
237  _screen->showMouse();
238 }
239 
241  if (queryGameFlag(3))
242  return;
243 
244  _inventoryState = false;
245  updateCLState();
246  initMainButtonList(true);
247 
248  _screen->copyBlockToPage(3, 0, 0, 320, 56, _interface);
249  _screen->hideMouse();
250 
251  restorePage3();
253  drawAnimObjects();
254  _screen->copyRegion(0, 144, 0, 0, 320, 56, 0, 2, Screen::CR_NO_P_CHECK);
255 
256  if (_inventoryScrollSpeed == -1) {
257  uint32 endTime = _system->getMillis() + _tickLength * 15;
258  int times = 0;
259  while (_system->getMillis() < endTime) {
260  _screen->copyRegion(0, 144, 0, 0, 320, 12, 0, 2, Screen::CR_NO_P_CHECK);
261  _screen->copyRegion(0, 144, 0, 0, 320, 12, 0, 2, Screen::CR_NO_P_CHECK);
262  ++times;
263  }
264 
265  times = MAX(times, 1);
266 
267  int speed = 60 / times;
268  if (speed <= 1)
270  else if (speed >= 8)
272  else
273  _inventoryScrollSpeed = speed;
274  }
275 
276  int y = 144;
277  int y2 = 144 + _inventoryScrollSpeed;
278  uint32 waitTill = _system->getMillis() + _tickLength;
279  int times = 0;
280 
281  while (y2 < 188) {
282  _screen->copyRegion(0, 0, 0, y2, 320, 56, 2, 0, Screen::CR_NO_P_CHECK);
285 
286  ++times;
287  if (_inventoryScrollSpeed == 1 && times == 3) {
288  while (waitTill > _system->getMillis())
289  _system->delayMillis(10);
290  times = 0;
291  waitTill = _system->getMillis() + _tickLength;
292  }
293 
295  y2 += _inventoryScrollSpeed;
296  }
297 
298  _screen->copyRegion(0, 0, 0, 188, 320, 56, 2, 0, Screen::CR_NO_P_CHECK);
299  _screen->copyRegion(0, y, 0, y, 320, 188-y, 2, 0, Screen::CR_NO_P_CHECK);
300  _screen->showMouse();
301 }
302 
304  static const int stringId[] = { 0x32, 0x37, 0x3C };
305 
306  if (queryGameFlag(0x219))
307  return;
308 
309  const char *string = (const char *)getTableEntry(_cCodeFile, stringId[_malcolmsMood]);
310 
312  _screen->_charWidth = -2;
313 
314  int width = _screen->getTextWidth(string);
315 
316  _screen->_charWidth = 0;
317  _screen->setFont(oldFont);
318 
319  int pageBackUp = _screen->_curPage;
320  const int x = 280 - (width / 2);
321  int y = 0;
322  if (_inventoryState) {
323  y = 189;
324  _screen->_curPage = 0;
325  } else {
326  y = 45;
327  _screen->_curPage = 2;
328  }
329 
330  _screen->drawShape(_screen->_curPage, getShapePtr(432), 244, 189, 0, 0);
331  _text->printText(string, x, y+1, 0xFF, 0xF0, 0x00);
332  _screen->_curPage = pageBackUp;
333 }
334 
336  static const uint8 stateTable[] = {
337  1, 6, 11
338  };
339 
340  if (frame == -1)
341  frame = stateTable[_malcolmsMood];
342  if (queryGameFlag(0x219))
343  frame = 13;
344 
345  if (page == 0) {
346  _invWsa->displayFrame(frame, 0, 0, 0, 0, 0, 0);
348  } else if (page == 30) {
349  _invWsa->displayFrame(frame, 2, 0, -144, 0, 0, 0);
350  }
351 
353 }
354 
356  int y = 155;
357  if (page == 30) {
358  page = 2;
359  y -= 144;
360  }
361 
362  int shape = (type != 0) ? 454 : 453;
363  _screen->drawShape(page, getShapePtr(shape), 217, y, 0, 0);
364 }
365 
366 void KyraEngine_MR::drawScore(int page, int x, int y) {
367  if (page == 30) {
368  page = 2;
369  y -= 144;
370  }
371 
372  int shape1 = _score / 100;
373  int shape2 = (_score - shape1*100) / 10;
374  int shape3 = _score % 10;
375 
376  _screen->drawShape(page, getShapePtr(shape1+433), x, y, 0, 0);
377  x += 8;
378  _screen->drawShape(page, getShapePtr(shape2+433), x, y, 0, 0);
379  x += 8;
380  _screen->drawShape(page, getShapePtr(shape3+433), x, y, 0, 0);
381 }
382 
383 void KyraEngine_MR::drawScoreCounting(int oldScore, int newScore, int drawOld, const int x) {
384  int y = 189;
385  if (_inventoryState)
386  y -= 44;
387 
388  int old100 = oldScore / 100;
389  int old010 = (oldScore - old100*100) / 10;
390  int old001 = oldScore % 10;
391 
392  int new100 = newScore / 100;
393  int new010 = (newScore - new100*100) / 10;
394  int new001 = newScore % 10;
395 
396  if (drawOld) {
397  _screen->drawShape(0, getShapePtr(old100+433), x + 0, y, 0, 0);
398  _screen->drawShape(0, getShapePtr(old010+433), x + 8, y, 0, 0);
399  _screen->drawShape(0, getShapePtr(old001+433), x + 16, y, 0, 0);
400  }
401 
402  if (old100 != new100)
403  _screen->drawShape(0, getShapePtr(old100+443), x + 0, y, 0, 0);
404 
405  if (old010 != new010)
406  _screen->drawShape(0, getShapePtr(old010+443), x + 8, y, 0, 0);
407 
408  _screen->drawShape(0, getShapePtr(old001+443), x + 16, y, 0, 0);
409 
411 
412  _screen->drawShape(0, getShapePtr(new100+433), x + 0, y, 0, 0);
413  _screen->drawShape(0, getShapePtr(new010+433), x + 8, y, 0, 0);
414  _screen->drawShape(0, getShapePtr(new001+433), x + 16, y, 0, 0);
415 }
416 
417 int KyraEngine_MR::getScoreX(const char *str) {
419  _screen->_charWidth = -2;
420 
421  int width = _screen->getTextWidth(str);
422  int x = 160 + (width / 2) - 32;
423 
424  _screen->setFont(oldFont);
425  _screen->_charWidth = 0;
426  return x;
427 }
428 
430  int yOffset = 0;
431 
432  if (page == 30) {
433  page = 2;
434  yOffset = -144;
435  }
436 
437  int pageBackUp = _screen->_curPage;
438  _screen->_curPage = page;
439 
440  for (int i = 0; i < 10; ++i) {
441  clearInventorySlot(i, page);
442  if (_mainCharacter.inventory[i] != kItemNone) {
443  _screen->drawShape(page, getShapePtr(_mainCharacter.inventory[i]+248), _inventoryX[i], _inventoryY[i] + yOffset, 0, 0);
445  }
446  }
447 
448  _screen->_curPage = pageBackUp;
449 
450  if (page == 0 || page == 1)
452 }
453 
454 void KyraEngine_MR::clearInventorySlot(int slot, int page) {
455  int yOffset = 0;
456  if (page == 30) {
457  page = 2;
458  yOffset = -144;
459  }
460 
461  _screen->drawShape(page, getShapePtr(slot+422), _inventoryX[slot], _inventoryY[slot] + yOffset, 0, 0);
462 }
463 
464 void KyraEngine_MR::drawInventorySlot(int page, Item item, int slot) {
465  int yOffset = 0;
466  if (page == 30) {
467  page = 2;
468  yOffset = -144;
469  }
470 
471  _screen->drawShape(page, getShapePtr(item+248), _inventoryX[slot], _inventoryY[slot] + yOffset, 0, 0);
472 }
473 
477  return 0;
478 
479  const int slot = button->index - 5;
480  const Item slotItem = _mainCharacter.inventory[slot];
481  if (_itemInHand == kItemNone) {
482  if (slotItem == kItemNone)
483  return 0;
484 
485  clearInventorySlot(slot, 0);
486  snd_playSoundEffect(0x0B, 0xC8);
487  setMouseCursor(slotItem);
488  updateItemCommand(slotItem, (_lang == 1) ? getItemCommandStringPickUp(slotItem) : 0, 0xFF);
489  _itemInHand = slotItem;
491  } else if (_itemInHand == 27) {
492  if (_chatText)
493  return 0;
495  } else {
496  if (slotItem >= 0) {
497  if (itemInventoryMagic(_itemInHand, slot))
498  return 0;
499 
500  snd_playSoundEffect(0x0B, 0xC8);
501 
502  clearInventorySlot(slot, 0);
503  drawInventorySlot(0, _itemInHand, slot);
504  setMouseCursor(slotItem);
505  updateItemCommand(slotItem, (_lang == 1) ? getItemCommandStringPickUp(slotItem) : 0, 0xFF);
507  _itemInHand = slotItem;
508  } else {
509  snd_playSoundEffect(0x0C, 0xC8);
510  drawInventorySlot(0, _itemInHand, slot);
515  }
516  }
517 
518  return 0;
519 }
520 
522  if (queryGameFlag(0x219)) {
523  snd_playSoundEffect(0x0D, 0xC8);
524  return 0;
525  }
526 
527  static const uint8 frameTable[] = { 1, 6, 11 };
528 
529  if (_mouseX >= 245 && _mouseX <= 267 && _mouseY >= 159 && _mouseY <= 198)
530  _malcolmsMood = 0;
531  else if (_mouseX >= 268 && _mouseX <= 289 && _mouseY >= 159 && _mouseY <= 198)
532  _malcolmsMood = 1;
533  else if (_mouseX >= 290 && _mouseX <= 312 && _mouseY >= 159 && _mouseY <= 198)
534  _malcolmsMood = 2;
535 
536  int direction = (_invWsaFrame > frameTable[_malcolmsMood]) ? -1 : 1;
537 
538  if (_invWsaFrame != frameTable[_malcolmsMood]) {
539  _screen->hideMouse();
540  setGameFlag(3);
541 
542  snd_playSoundEffect(0x2E, 0xC8);
543 
544  while (_invWsaFrame != frameTable[_malcolmsMood]) {
545  uint32 endTime = _system->getMillis() + 2 * _tickLength;
547 
550 
551  while (endTime > _system->getMillis()) {
552  update();
553  _system->delayMillis(10);
554  }
555  }
556 
557  resetGameFlag(3);
558  _screen->showMouse();
559 
561  updateDlgIndex();
562 
563  EMCData data;
564  EMCState state;
565  memset(&data, 0, sizeof(data));
566  memset(&state, 0, sizeof(state));
567 
568  _res->exists("_ACTOR.EMC", true);
569  _emc->load("_ACTOR.EMC", &data, &_opcodes);
570  _emc->init(&state, &data);
571  _emc->start(&state, 1);
572 
573  int vocHigh = _vocHigh;
574  _vocHigh = 200;
575  _useActorBuffer = true;
576 
577  while (_emc->isValid(&state))
578  _emc->run(&state);
579 
580  _useActorBuffer = false;
581  _vocHigh = vocHigh;
582  _emc->unload(&data);
583  }
584 
585  return 0;
586 }
587 
589  strcpy(_stringBuffer, (const char *)getTableEntry(_cCodeFile, 18));
590 
591  char *buffer = _stringBuffer;
592 
593  while (*buffer != '%')
594  ++buffer;
595 
596  buffer[0] = (_score / 100) + '0';
597  buffer[1] = ((_score % 100) / 10) + '0';
598  buffer[2] = (_score % 10) + '0';
599 
600  while (*buffer != '%')
601  ++buffer;
602 
603  buffer[0] = (_scoreMax / 100) + '0';
604  buffer[1] = ((_scoreMax % 100) / 10) + '0';
605  buffer[2] = (_scoreMax % 10) + '0';
606 
607  showMessage(_stringBuffer, 0xFF, 0xF0);
608  return 0;
609 }
610 
613  if (_itemInHand == 27) {
614  removeHandItem();
615  snd_playSoundEffect(0x0C, 0xC8);
616  drawJestersStaff(1, 0);
617  updateItemCommand(27, 2, 0xFF);
618  setGameFlag(0x97);
619  } else if (_itemInHand == kItemNone) {
620  if (queryGameFlag(0x97)) {
621  snd_playSoundEffect(0x0B, 0xC8);
622  setHandItem(27);
623  drawJestersStaff(0, 0);
624  updateItemCommand(27, 0, 0xFF);
625  resetGameFlag(0x97);
626  } else {
627  if (queryGameFlag(0x2F))
628  objectChat((const char *)getTableEntry(_cCodeFile, 20), 0, 204, 20);
629  else
630  objectChat((const char *)getTableEntry(_cCodeFile, 25), 0, 204, 25);
631  }
632  } else {
633  objectChat((const char *)getTableEntry(_cCodeFile, 30), 0, 204, 30);
634  }
635  return 0;
636 }
637 
639  if (!_screen->isMouseVisible() || queryGameFlag(4) || _mouseState != -1)
640  return;
641 
642  if (!loadLanguageFile("ALBUM.", _album.file))
643  error("Couldn't load ALBUM");
644 
645  if (!queryGameFlag(0x8B))
646  _album.wsa->open("ALBMGNTH.WSA", 1, 0);
647  _album.backUpRect = new uint8[3100];
649  _album.backUpPage = new uint8[64000];
652 
653  _screen->copyRegionToBuffer(0, 0, 0, 320, 200, _screenBuffer);
654  _screen->copyRegionToBuffer(4, 0, 0, 320, 200, _album.backUpPage);
655 
656  _screen->copyPalette(1, 0);
657  _screen->fadeToBlack(9);
658 
659  int itemInHand = _itemInHand;
660  removeHandItem();
661 
662  _screen->loadPalette("ALBUM.COL", _screen->getPalette(0));
663  loadAlbumPage();
665 
666  if (_album.leftPage.wsa->opened())
668 
669  if (_album.rightPage.wsa->opened())
671 
673  _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
676 
677  processAlbum();
678 
679  _screen->fadeToBlack(9);
680  _album.wsa->close();
681 
682  setHandItem(itemInHand);
683  updateMouse();
684 
685  restorePage3();
686  _screen->copyBlockToPage(0, 0, 0, 320, 200, _screenBuffer);
687  _screen->copyBlockToPage(4, 0, 0, 320, 200, _album.backUpPage);
688 
689  _screen->copyPalette(0, 1);
691 
692  delete[] _album.backUpRect;
693  _album.backUpRect = 0;
694  delete[] _album.backUpPage;
695  _album.backUpPage = 0;
696  delete[] _album.file;
697  _album.file = 0;
698 
699  _eventList.clear();
700 }
701 
704  int num = _album.curPage / 2;
705 
706  if (num == 0) {
707  filename = "ALBUM0.CPS";
708  } else if (num >= 1 && num <= 6) {
709  --num;
710  num %= 2;
711  filename = Common::String::format("ALBUM%d.CPS", num+1);
712  } else {
713  filename = "ALBUM3.CPS";
714  }
715 
716  _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 4, Screen::CR_NO_P_CHECK);
717  _screen->loadBitmap(filename.c_str(), 3, 3, 0);
718 }
719 
722 
726 
730 
731  if (_album.curPage) {
732  filename = Common::String::format("PAGE%x.WSA", _album.curPage);
733  _album.leftPage.wsa->open(filename.c_str(), 1, 0);
735  }
736 
737  if (_album.curPage != 14) {
738  filename = Common::String::format("PAGE%x.WSA", _album.curPage+1);
739  _album.rightPage.wsa->open(filename.c_str(), 1, 0);
741  }
742 }
743 
745  static const uint8 posY[] = {
746  0x41, 0x55, 0x55, 0x55, 0x55, 0x55, 0x5A, 0x5A,
747  0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x3C
748  };
749 
750  const int leftY = posY[_album.curPage];
751  const int rightY = posY[_album.curPage+1];
752 
753  for (int i = 0; i < 5; ++i) {
754  const char *str = (const char *)getTableEntry(_album.file, _album.curPage*5+i);
755  int y = i * 10 + leftY + 20;
756  printAlbumText(2, str, 20, y, 10);
757  }
758 
759  for (int i = 0; i < 5; ++i) {
760  const char *str = (const char *)getTableEntry(_album.file, (_album.curPage+1)*5+i);
761  int y = i * 10 + rightY + 20;
762  printAlbumText(2, str, 176, y, 10);
763  }
764 
765  albumBackUpRect();
766 }
767 
768 void KyraEngine_MR::printAlbumText(int page, const char *str, int x, int y, uint8 c0) {
769  int oldPage = _screen->_curPage;
770  _screen->_curPage = page;
771 
772  static const uint8 colorMap[] = { 0, 0x87, 0xA3, 0 };
773  _screen->setTextColor(colorMap, 0, 3);
774 
776  _screen->_charWidth = -2;
777 
778  _screen->printText(str, x, y, c0, 0);
779 
780  _screen->_charWidth = 0;
781  _screen->setFont(oldFont);
782  _screen->_curPage = oldPage;
783 }
784 
786  Button albumButtons[5];
787 
788  GUI_V2_BUTTON(albumButtons[0], 36, 0, 0, 1, 1, 1, 0x4487, 0, 130, 190, 10, 10, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
790  GUI_V2_BUTTON(albumButtons[1], 37, 0, 0, 1, 1, 1, 0x4487, 0, 177, 190, 10, 10, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
792  GUI_V2_BUTTON(albumButtons[2], 38, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 320, 8, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
794  GUI_V2_BUTTON(albumButtons[3], 39, 0, 0, 1, 1, 1, 0x4487, 0, 8, 8, 144, 180, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
796  GUI_V2_BUTTON(albumButtons[4], 40, 0, 0, 1, 1, 1, 0x4487, 0, 170, 8, 142, 180, 0xFF, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0);
798 
799  Button *buttonList = 0;
800  for (int i = 0; i < 5; ++i)
801  buttonList = _gui->addButtonToList(buttonList, &albumButtons[i]);
802 
804  albumNewPage();
805  _album.running = true;
806 
807  while (_album.running && !shouldQuit()) {
808  updateInput();
809  checkInput(buttonList);
810  removeInputTop();
811 
812  if (_album.curPage != _album.nextPage) {
813  int oldPage = _album.curPage;
815 
818 
819  loadAlbumPage();
821 
822  if (_album.leftPage.wsa->opened())
824 
825  if (_album.rightPage.wsa->opened())
827 
829 
830  snd_playSoundEffect(0x85, 0x80);
831  albumSwitchPages(oldPage, _album.nextPage, 4);
832 
834  albumNewPage();
835 
836  _eventList.clear();
837  }
838 
840  _system->delayMillis(10);
841  }
842 
845 }
846 
848  int page = _album.nextPage / 2;
849  if (!queryGameFlag(0x84+page)) {
850  albumAnim1();
851  delayWithTicks(8);
852 
853  int id = _album.curPage / 2 + 100;
854  albumChat((const char *)getTableEntry(_album.file, id), 205, id);
855 
856  if (id == 107) {
857  _screen->copyRegion(76, 100, 76, 100, 244, 100, 2, 0, Screen::CR_NO_P_CHECK);
858  albumChat((const char *)getTableEntry(_album.file, 108), 205, 108);
859  _screen->copyRegion(76, 100, 76, 100, 244, 100, 2, 0, Screen::CR_NO_P_CHECK);
860  albumChat((const char *)getTableEntry(_album.file, 109), 205, 109);
861  }
862 
863  delayWithTicks(5);
864  albumAnim2();
865 
866  setGameFlag(0x84+page);
867  _album.isPage14 = (_album.nextPage == 14);
868  }
869 }
870 
872  if (_album.nextPage == 14 && !_album.isPage14)
873  return;
874 
875  uint32 nextRun = 0;
876 
877  nextRun = _album.leftPage.timer + 5 * _tickLength;
878  if (nextRun < _system->getMillis() && _album.leftPage.wsa->opened()) {
880  _screen->copyRegion(40, 17, 40, 17, 87, 73, 2, 0, Screen::CR_NO_P_CHECK);
881 
884 
887  if (_album.nextPage == 14) {
888  _album.isPage14 = false;
889  _album.leftPage.timer += 100000 * _tickLength;
890  } else {
891  _album.leftPage.timer += 180 * _tickLength;
892  }
893  }
894  }
895 
896  nextRun = _album.rightPage.timer + 5 * _tickLength;
897  if (nextRun < _system->getMillis() && _album.rightPage.wsa->opened()) {
899  _screen->copyRegion(194, 20, 194, 20, 85, 69, 2, 0, Screen::CR_NO_P_CHECK);
900 
903 
907  }
908  }
909 
911 }
912 
914  for (int i = 6; i >= 3; --i) {
916  _album.wsa->displayFrame(i, 2, -100, 90, 0x4000, 0, 0);
917  albumUpdateRect();
918  delayWithTicks(1);
919  }
920 
922  _album.wsa->displayFrame(14, 2, -100, 90, 0x4000, 0, 0);
923  albumUpdateRect();
924  delayWithTicks(1);
925 }
926 
928  for (int i = 3; i <= 6; ++i) {
930  _album.wsa->displayFrame(i, 2, -100, 90, 0x4000, 0, 0);
931  albumUpdateRect();
932  delayWithTicks(1);
933  }
934 
936  _screen->copyRegion(0, 100, 0, 100, 320, 100, 2, 0, Screen::CR_NO_P_CHECK);
938 }
939 
941  _screen->copyRegionToBuffer(2, 0, 146, 62, 50, _album.backUpRect);
942 }
943 
945  _screen->copyBlockToPage(2, 0, 146, 62, 50, _album.backUpRect);
946 }
947 
949  _screen->copyRegion(0, 146, 0, 146, 62, 50, 2, 0, Screen::CR_NO_P_CHECK);
951 }
952 
953 void KyraEngine_MR::albumSwitchPages(int oldPage, int newPage, int srcPage) {
954  if (newPage > oldPage) {
955  _screen->wsaFrameAnimationStep(0xA0, 0x07, 0xA0, 0x07, 0x96, 0xBA, 0x64, 0xBA, srcPage, 0, 2);
956 
957  _screen->copyRegion(260, 7, 260, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
959  delayWithTicks(2);
960 
961  _screen->wsaFrameAnimationStep(0xA0, 0x07, 0xA0, 0x07, 0x96, 0xBA, 0x32, 0xBA, srcPage, 0, 2);
962 
963  _screen->copyRegion(210, 7, 210, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
965  delayWithTicks(2);
966 
967  _screen->copyRegion(160, 7, 160, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
969  delayWithTicks(2);
970 
971  _screen->wsaFrameAnimationStep(0x10, 0x07, 0x6E, 0x07, 0x96, 0xBA, 0x32, 0xBA, 2, 0, 2);
973  delayWithTicks(2);
974 
975  _screen->wsaFrameAnimationStep(0x10, 0x07, 0x3C, 0x07, 0x96, 0xBA, 0x64, 0xBA, 2, 0, 2);
977  delayWithTicks(2);
978 
979  _screen->copyRegion(10, 7, 10, 7, 150, 186, 2, 0, Screen::CR_NO_P_CHECK);
981  } else {
982  _screen->wsaFrameAnimationStep(0x0A, 0x07, 0x3C, 0x07, 0x96, 0xBA, 0x64, 0xBA, srcPage, 0, 2);
983 
984  _screen->copyRegion(10, 7, 10, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
986  delayWithTicks(2);
987 
988  _screen->wsaFrameAnimationStep(0x0A, 0x07, 0x6E, 0x07, 0x96, 0xBA, 0x32, 0xBA, srcPage, 0, 2);
989 
990  _screen->copyRegion(60, 7, 60, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
992  delayWithTicks(2);
993 
994  _screen->copyRegion(110, 7, 110, 7, 50, 186, 2, 0, Screen::CR_NO_P_CHECK);
996  delayWithTicks(2);
997 
998  _screen->wsaFrameAnimationStep(0xA0, 0x07, 0xA0, 0x07, 0x96, 0xBA, 0x32, 0xBA, 2, 0, 2);
1000  delayWithTicks(2);
1001 
1002  _screen->wsaFrameAnimationStep(0xA0, 0x07, 0xA0, 0x07, 0x96, 0xBA, 0x64, 0xBA, 2, 0, 2);
1003  _screen->updateScreen();
1004  delayWithTicks(2);
1005 
1006  _screen->copyRegion(160, 7, 160, 7, 150, 186, 2, 0, Screen::CR_NO_P_CHECK);
1007  _screen->updateScreen();
1008  }
1009 }
1010 
1012  _album.nextPage = _album.curPage + 2;
1013  if (_album.nextPage >= 16) {
1014  _album.nextPage -= 2;
1015  _album.running = false;
1016  }
1017  return 0;
1018 }
1019 
1021  _album.nextPage = _album.curPage - 2;
1022  if (_album.nextPage < 0) {
1023  _album.nextPage = 0;
1024  _album.running = false;
1025  }
1026  return 0;
1027 }
1028 
1030  _album.running = false;
1031  return 0;
1032 }
1033 
1034 #pragma mark -
1035 
1037 }
1038 
1040  uint8 screenPal[768];
1041  _screen->getRealPalette(0, screenPal);
1043 }
1044 
1046  if (!button)
1047  return;
1048 
1049  if (button->flags & 8) {
1050  button->flags &= ~8;
1051  processButton(button);
1052  }
1053 }
1054 
1056  if (!button)
1057  return;
1058 
1059  if (!(button->flags & 8)) {
1060  button->flags |= 8;
1061  processButton(button);
1062  }
1063 }
1064 
1065 const char *GUI_MR::getMenuTitle(const Menu &menu) {
1066  if (!menu.menuNameId)
1067  return 0;
1068 
1069  return (const char *)_vm->getTableEntry(_vm->_optionsFile, menu.menuNameId);
1070 }
1071 
1072 const char *GUI_MR::getMenuItemTitle(const MenuItem &menuItem) {
1073  if (!menuItem.itemId)
1074  return 0;
1075 
1076  return (const char *)_vm->getTableEntry(_vm->_optionsFile, menuItem.itemId);
1077 }
1078 
1079 const char *GUI_MR::getMenuItemLabel(const MenuItem &menuItem) {
1080  if (!menuItem.labelId)
1081  return 0;
1082 
1083  return (const char *)_vm->getTableEntry(_vm->_optionsFile, menuItem.labelId);
1084 }
1085 
1086 char *GUI_MR::getTableString(int id) {
1087  return (char *)_vm->getTableEntry(_vm->_optionsFile, id);
1088 }
1089 
1091  if (!_displayMenu)
1092  return 0;
1093 
1094  _screen->drawBox(button->x + 1, button->y + 1, button->x + button->width - 1, button->y + button->height - 1, 0xD0);
1095 
1096  return 0;
1097 }
1098 
1100  if (!_displayMenu)
1101  return 0;
1102 
1103  _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 0xD1, 0xCF);
1104 
1105  return 0;
1106 }
1108  _vm->_timer->resetNextRun();
1110  _isDeathMenu = false;
1111  if (!_loadedSave) {
1113  _vm->setHandItem(item);
1114  } else {
1117  _vm->_shownMessage = " ";
1118  _vm->_restoreCommandLine = false;
1119  }
1120  _buttonListChanged = true;
1121 }
1122 
1123 int GUI_MR::quitGame(Button *caller) {
1124  updateMenuButton(caller);
1125  if (choiceDialog(0x0F, 1)) {
1126  _displayMenu = false;
1127  _vm->_runFlag = false;
1128  _vm->fadeOutMusic(60);
1129  _screen->fadeToBlack(60);
1130  _screen->clearCurPage();
1131  }
1132 
1133  if (_vm->_runFlag) {
1136  }
1137 
1138  return 0;
1139 }
1140 
1143 
1145 
1146  if (!_vm->_inventoryState && button && !_vm->_menuDirectlyToLoad)
1147  return 0;
1148 
1149  _restartGame = false;
1150  _reloadTemporarySave = false;
1151 
1152  if (!_screen->isMouseVisible() && button && !_vm->_menuDirectlyToLoad)
1153  return 0;
1154 
1155  _vm->showMessage(0, 0xF0, 0xF0);
1156 
1157  if (_vm->_mouseState < -1) {
1158  _vm->_mouseState = -1;
1159  _screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
1160  return 0;
1161  }
1162 
1163  int oldHandItem = _vm->_itemInHand;
1164  _screen->setMouseCursor(0, 0, _vm->getShapePtr(0));
1165 
1166  _displayMenu = true;
1167  for (int i = 0; i < 4; ++i) {
1168  if (_vm->_musicSoundChannel != i)
1170  }
1171 
1172  for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) {
1176  }
1177 
1187 
1189 
1190  if (_vm->_menuDirectlyToLoad) {
1192 
1193  _loadedSave = false;
1194 
1196  loadMenu(0);
1198 
1199  if (_loadedSave) {
1200  if (_restartGame)
1202  } else {
1204  }
1205 
1206  resetState(-1);
1207  _vm->_menuDirectlyToLoad = false;
1208  return 0;
1209  }
1210 
1211  if (!button) {
1213  _isDeathMenu = true;
1214  } else {
1215  _isDeathMenu = false;
1216  }
1217 
1220  _madeSave = false;
1221  _loadedSave = false;
1223 
1224  if (_isDeathMenu) {
1225  while (!_screen->isMouseVisible())
1226  _screen->showMouse();
1227  }
1228 
1229  while (_displayMenu) {
1231  getInput();
1232  }
1233 
1234  if (_vm->_runFlag && !_loadedSave && !_madeSave) {
1235  restorePalette();
1237  }
1238 
1239  if (_vm->_runFlag)
1241 
1242  resetState(oldHandItem);
1243 
1245  _vm->_unkSceneScreenFlag1 = true;
1246  _vm->loadGameStateCheck(999);
1247  //_vm->_saveFileMan->removeSavefile(_vm->getSavegameFilename(999));
1248  _vm->_unkSceneScreenFlag1 = false;
1249  }
1250 
1251  return 0;
1252 }
1253 
1254 int GUI_MR::loadMenu(Button *caller) {
1256 
1257  if (!_vm->_menuDirectlyToLoad) {
1258  updateMenuButton(caller);
1261  }
1262 
1263  _savegameOffset = 0;
1266  _isLoadMenu = true;
1267  _noLoadProcess = false;
1268  _vm->_gameToLoad = -1;
1270 
1271  _screen->updateScreen();
1272  while (_isLoadMenu) {
1274  getInput();
1275  }
1276 
1277  if (_noLoadProcess) {
1278  if (!_vm->_menuDirectlyToLoad) {
1283  }
1284  } else if (_vm->_gameToLoad >= 0) {
1286  restorePalette();
1287  _vm->_menuDirectlyToLoad = false;
1289  if (_vm->_gameToLoad == 0) {
1290  _restartGame = true;
1291  _vm->runStartupScript(1, 1);
1292  }
1293  _displayMenu = false;
1294  _loadedSave = true;
1295  }
1296 
1297  return 0;
1298 }
1299 
1301  updateMenuButton(button);
1302 
1303  _vm->_gameToLoad = 999;
1306  _displayMenu = false;
1307  _loadedSave = true;
1308  return 0;
1309 }
1310 
1312  updateMenuButton(caller);
1315  bool textEnabled = _vm->textEnabled();
1316  int lang = _vm->_lang;
1317 
1320  _isOptionsMenu = true;
1321 
1322  while (_isOptionsMenu) {
1324  getInput();
1325  }
1326 
1329 
1330  if (textEnabled && !_vm->textEnabled() && !_vm->speechEnabled()) {
1331  _vm->_configVoice = 1;
1333  choiceDialog(0x1E, 0);
1334  }
1335 
1336  if (_vm->_lang != lang) {
1337  _reloadTemporarySave = true;
1338 
1339  Graphics::Surface thumb;
1340  createScreenThumbnail(thumb);
1341  _vm->saveGameStateIntern(999, "Autosave", &thumb);
1342  thumb.free();
1343 
1345 
1346  if (!_vm->loadLanguageFile("ITEMS.", _vm->_itemFile))
1347  error("Couldn't load ITEMS");
1348  if (!_vm->loadLanguageFile("SCORE.", _vm->_scoreFile))
1349  error("Couldn't load SCORE");
1350  if (!_vm->loadLanguageFile("C_CODE.", _vm->_cCodeFile))
1351  error("Couldn't load C_CODE");
1352  if (!_vm->loadLanguageFile("SCENES.", _vm->_scenesFile))
1353  error("Couldn't load SCENES");
1354  if (!_vm->loadLanguageFile("OPTIONS.", _vm->_optionsFile))
1355  error("Couldn't load OPTIONS");
1356  if (!_vm->loadLanguageFile("_ACTOR.", _vm->_actorFile))
1357  error("couldn't load _ACTOR");
1358  }
1359 
1360  _vm->writeSettings();
1361 
1364  return 0;
1365 }
1366 
1368  if (_vm->_configWalkspeed == 3)
1369  _gameOptions.item[0].itemId = 28;
1370  else
1371  _gameOptions.item[0].itemId = 27;
1372 
1373  if (_vm->textEnabled())
1374  _gameOptions.item[4].itemId = 18;
1375  else
1376  _gameOptions.item[4].itemId = 17;
1377 
1378  switch (_vm->_lang) {
1379  case 0:
1380  _gameOptions.item[1].itemId = 31;
1381  break;
1382 
1383  case 1:
1384  _gameOptions.item[1].itemId = 32;
1385  break;
1386 
1387  case 2:
1388  _gameOptions.item[1].itemId = 33;
1389  break;
1390 
1391  default:
1392  break;
1393  }
1394 
1395  if (_vm->_configStudio)
1396  _gameOptions.item[2].itemId = 18;
1397  else
1398  _gameOptions.item[2].itemId = 17;
1399 
1400  if (_vm->_configSkip)
1401  _gameOptions.item[3].itemId = 18;
1402  else
1403  _gameOptions.item[3].itemId = 17;
1404 }
1405 
1407  updateMenuButton(caller);
1408  if (!_vm->queryGameFlag(0x1B2)) {
1409  ++_vm->_lang;
1410  _vm->_lang %= 3;
1413  }
1414  return 0;
1415 }
1416 
1418  updateMenuButton(caller);
1419  _vm->_configStudio ^= 1;
1422  return 0;
1423 }
1424 
1426  updateMenuButton(caller);
1427  _vm->_configSkip ^= 1;
1430  return 0;
1431 }
1432 
1434  updateMenuButton(caller);
1435  _vm->_configHelium ^= 1;
1436  if (_vm->_configHelium)
1437  _audioOptions.item[3].itemId = 18;
1438  else
1439  _audioOptions.item[3].itemId = 17;
1441  return 0;
1442 }
1443 
1445  updateMenuButton(caller);
1446 
1449 
1450  if (_vm->_configHelium)
1451  _audioOptions.item[3].itemId = 18;
1452  else
1453  _audioOptions.item[3].itemId = 17;
1454 
1456 
1457  const int menuX = _audioOptions.x;
1458  const int menuY = _audioOptions.y;
1459 
1460  const int maxButton = 3; // 2 if voc is disabled
1461 
1462  for (int i = 0; i < maxButton; ++i) {
1463  int x = menuX + _sliderBarsPosition[i*2+0];
1464  int y = menuY + _sliderBarsPosition[i*2+1];
1465  _screen->drawShape(0, _vm->getShapePtr(0x1CF), x, y, 0, 0);
1466  drawSliderBar(i, _vm->getShapePtr(0x1D0));
1468  _sliderButtons[0][i].x = x;
1469  _sliderButtons[0][i].y = y;
1472  _sliderButtons[2][i].x = x + 10;
1473  _sliderButtons[2][i].y = y;
1476  _sliderButtons[1][i].x = x + 120;
1477  _sliderButtons[1][i].y = y;
1479  }
1480 
1481  _isOptionsMenu = true;
1483  bool speechEnabled = _vm->speechEnabled();
1484  while (_isOptionsMenu) {
1486  getInput();
1487  }
1488 
1491  if (speechEnabled && !_vm->textEnabled() && (!_vm->speechEnabled() || _vm->getVolume(KyraEngine_v1::kVolumeSpeech) == 2)) {
1492  _vm->_configVoice = 0;
1493  choiceDialog(0x1D, 0);
1494  }
1495 
1496  _vm->writeSettings();
1497 
1500  return 0;
1501 }
1502 
1504  int button = 0;
1505  if (caller->index >= 24 && caller->index <= 27)
1506  button = caller->index - 24;
1507  else if (caller->index >= 28 && caller->index <= 31)
1508  button = caller->index - 28;
1509  else
1510  button = caller->index - 32;
1511 
1512  assert(button >= 0 && button <= 3);
1513 
1514  const int oldVolume = _vm->getVolume(KyraEngine_v1::kVolumeEntry(button));
1515  int newVolume = oldVolume;
1516 
1517  if (caller->index >= 24 && caller->index <= 27)
1518  newVolume -= 10;
1519  else if (caller->index >= 28 && caller->index <= 31)
1520  newVolume += 10;
1521  else
1522  newVolume = _vm->_mouseX - caller->x - 7;
1523 
1524  newVolume = CLIP(newVolume, 2, 97);
1525 
1526  if (newVolume == oldVolume)
1527  return 0;
1528 
1529  int lastMusicCommand = -1;
1530  bool playSoundEffect = false;
1531 
1532  drawSliderBar(button, _vm->getShapePtr(0x1D1));
1533 
1534  if (button == 2) {
1535  if (_vm->textEnabled())
1536  _vm->_configVoice = 2;
1537  else
1538  _vm->_configVoice = 1;
1539  }
1540 
1541  _vm->setVolume(KyraEngine_v1::kVolumeEntry(button), newVolume);
1542 
1543  switch (button) {
1544  case 0:
1545  lastMusicCommand = _vm->_lastMusicCommand;
1546  break;
1547 
1548  case 1:
1549  playSoundEffect = true;
1550  break;
1551 
1552  case 2:
1555  _vm->playVoice(200, 943);
1556  break;
1557 
1558  default:
1559  return 0;
1560  }
1561 
1562  drawSliderBar(button, _vm->getShapePtr(0x1D0));
1563  if (playSoundEffect)
1564  _vm->snd_playSoundEffect(0x18, 0xC8);
1565  else if (lastMusicCommand >= 0)
1566  _vm->snd_playWanderScoreViaMap(lastMusicCommand, 0);
1567 
1568  _screen->updateScreen();
1569  return 0;
1570 }
1571 
1572 void GUI_MR::drawSliderBar(int slider, const uint8 *shape) {
1573  const int menuX = _audioOptions.x;
1574  const int menuY = _audioOptions.y;
1575  int x = menuX + _sliderBarsPosition[slider*2+0] + 10;
1576  int y = menuY + _sliderBarsPosition[slider*2+1];
1577 
1578  int position = _vm->getVolume(KyraEngine_v1::kVolumeEntry(slider));
1579 
1580  position = CLIP(position, 2, 97);
1581  _screen->drawShape(0, shape, x+position, y, 0, 0);
1582 }
1583 
1584 } // End of namespace Kyra
bool choiceDialog(int name, bool type)
Definition: gui_v2.cpp:841
void resetNextRun()
Definition: timer.cpp:139
void updateSaveFileList(Common::String targetName, bool excludeQuickSaves=false)
Definition: gui.cpp:49
bool _unkSceneScreenFlag1
Definition: kyra_v2.h:361
FontId setFont(FontId fontId)
Definition: screen.cpp:1395
int getTextWidth(const char *str)
Definition: screen.cpp:1416
Character _mainCharacter
Definition: kyra_v2.h:330
void stopSound(int channel)
Stop the playback of a sound in the given channel.
void processButton(Button *button)
Definition: gui_v2.cpp:56
int albumNextPage(Button *caller)
Definition: gui_mr.cpp:1011
void setMouseCursor(Item item)
Definition: items_mr.cpp:78
Simple string class for ScummVM.
Definition: str.h:49
uint32 _lastAutosave
Definition: kyra_v1.h:388
void albumUpdateAnims()
Definition: gui_mr.cpp:871
Button::Callback _redrawShadedButtonFunctor
Definition: gui_v1.h:116
static const int8 _albumWSAY[]
Definition: kyra_mr.h:557
void restoreCommandLine()
Definition: gui_mr.cpp:150
bool _buttonListChanged
Definition: gui_v2.h:119
unsigned int uint32
Definition: cdtypes.h:26
uint16 itemId
Definition: gui_v1.h:34
void playVoice(int high, int low)
Definition: kyra_mr.cpp:451
uint8 * _interface
Definition: kyra_mr.h:227
void backUpPage1(uint8 *buffer)
Definition: gui_v2.cpp:423
void makeCharFacingMouse()
Definition: kyra_mr.cpp:1200
uint8 numberOfItems
Definition: gui_v1.h:72
Screen_MR * _screen
Definition: kyra_mr.h:82
uint8 _configWalkspeed
Definition: kyra_v1.h:299
#define assert(s)
Definition: portdefs.h:77
void drawScoreCounting(int oldScore, int newScore, int drawOld, const int x)
Definition: gui_mr.cpp:383
bool isMouseVisible() const
Definition: screen.cpp:3048
bool start(EMCState *script, int function)
Definition: script.cpp:155
static const int _sliderBarsPosition[]
Definition: gui_v2.h:180
bool _displayMenu
Definition: gui_v1.h:109
void loadGameStateCheck(int slot)
Definition: saveload.cpp:264
Menu _saveMenu
Definition: gui_v2.h:139
void loadButtonShapes()
Definition: gui_mr.cpp:36
int16 x
Definition: gui_v1.h:58
uint8 * getShapePtr(int index) const
Definition: kyra_v2.cpp:191
int setGameFlag(int flag)
Definition: kyra_v1.cpp:511
bool _menuDirectlyToLoad
Definition: kyra_mr.h:98
int checkInput(Button *buttonList, bool mainLoop=false, int eventFlag=0x8000)
Definition: kyra_v1.cpp:239
bool itemInventoryMagic(Item handItem, int invSlot)
Definition: items_mr.cpp:460
uint8 * _actorFile
Definition: kyra_mr.h:273
Menu _savenameMenu
Definition: gui_v2.h:139
virtual void setMouseCursor(int x, int y, const byte *shape)
Definition: screen.cpp:3059
int y
Definition: dialogs.cpp:409
void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2)
Definition: text_mr.cpp:130
uint8 getVolume(kVolumeEntry vol)
Definition: kyra_v1.cpp:668
int callbackButton3(Button *button)
Definition: gui_mr.cpp:90
unsigned char uint8
Definition: cdtypes.h:28
int callbackButton2(Button *button)
Definition: gui_mr.cpp:75
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
Definition: util.h:66
void resetState(int item)
Definition: gui_mr.cpp:1107
uint16 height
Definition: gui.h:71
void clear()
Definition: list.h:193
void copyPalette(const int dst, const int src)
Definition: screen.cpp:3112
int open(const char *filename, int unk1, Palette *palette)
Definition: wsamovie.cpp:364
Palette & getPalette(int num)
Definition: screen.cpp:3107
virtual void fadePalette(const Palette &pal, int delay, const UpdateFunctor *upFunc=0)
Definition: screen.cpp:793
byte data2Val1
Definition: gui.h:56
struct Kyra::KyraEngine_MR::Album _album
static const int8 _albumWSAX[]
Definition: kyra_mr.h:556
int callbackButton1(Button *button)
Definition: gui_mr.cpp:60
Button::Callback _sliderHandlerFunctor
Definition: gui_v2.h:209
const char * getMenuTitle(const Menu &menu)
Definition: gui_mr.cpp:1065
int16 _lastMusicCommand
Definition: kyra_v1.h:360
Button _menuButtons[7]
Definition: gui_v2.h:136
uint8 * _optionsFile
Definition: kyra_mr.h:272
void initMainButtonList(bool disable)
Definition: staticres.cpp:1887
virtual void displayFrame(int frameNum, int pageNum, int x, int y, uint16 flags, const uint8 *table1, const uint8 *table2)
Definition: wsamovie.h:118
void clearInventorySlot(int slot, int page)
Definition: gui_mr.cpp:454
Callback buttonCallback
Definition: gui.h:89
void drawMalcolmsMoodText()
Definition: gui_mr.cpp:303
int toggleSkipSupport(Button *caller)
Definition: gui_mr.cpp:1425
virtual void restorePalette()
Definition: gui_v2.h:126
void restorePage1(const uint8 *buffer)
Definition: gui_v2.cpp:427
bool isValid(EMCState *script)
Definition: script.cpp:175
EMCInterpreter * _emc
Definition: kyra_v1.h:269
MenuItem item[7]
Definition: gui_v1.h:77
KyraEngine_MR * _vm
Definition: gui_mr.h:81
virtual void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip=false)
Definition: screen.cpp:3233
int _charWidth
Definition: screen.h:626
void setVolume(kVolumeEntry vol, uint8 value)
Definition: kyra_v1.cpp:645
uint16 height
Definition: thumbnail.cpp:41
void drawScore(int page, int x, int y)
Definition: gui_mr.cpp:366
const char * getMenuItemLabel(const MenuItem &menuItem)
Definition: gui_mr.cpp:1079
int resetGameFlag(int flag)
Definition: kyra_v1.cpp:522
int loadSecondChance(Button *button)
Definition: gui_mr.cpp:1300
#define BUTTON_FUNCTOR(type, x, y)
Definition: gui.h:37
int toggleHeliumMode(Button *caller)
Definition: gui_mr.cpp:1433
static bool shouldQuit()
Return whether the ENGINE should quit respectively should return to the launcher. ...
Definition: engine.cpp:669
int getMillis(bool skipRecord)
Definition: dsmain.cpp:2276
char * getTableString(int id)
Definition: gui_mr.cpp:1086
Button * getScrollDownButton()
Definition: gui_v2.h:144
void drawInventorySlot(int page, Item item, int slot)
Definition: gui_mr.cpp:464
bool _isOptionsMenu
Definition: gui_v2.h:166
int redrawShadedButtonCallback(Button *button)
Definition: gui_mr.cpp:1099
Resource * _res
Definition: kyra_v1.h:264
int albumPrevPage(Button *caller)
Definition: gui_mr.cpp:1020
#define GUI_V2_BUTTON(button, a, b, c, d, e, f, h, i, j, k, l, m, n, o, p, q, r, s, t)
Definition: gui_v2.h:30
int toggleStudioSFX(Button *caller)
Definition: gui_mr.cpp:1417
Menu _loadMenu
Definition: gui_v2.h:139
void updateScreen()
Definition: screen.cpp:324
virtual void delayWithTicks(int ticks)
Definition: kyra_v1.cpp:545
void printText(const char *str, int x, int y, uint8 color1, uint8 color2)
Definition: screen.cpp:1443
void wsaFrameAnimationStep(int x1, int y1, int x2, int y2, int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim)
Definition: screen_v2.cpp:280
void showInventory()
Definition: gui_mr.cpp:162
TimerManager * _timer
Definition: kyra_v1.h:268
OSystem * _system
Definition: engine.h:59
Button * _menuButtonList
Definition: gui_v1.h:108
int _inventoryScrollSpeed
Definition: kyra_mr.h:245
int queryGameFlag(int flag) const
Definition: kyra_v1.cpp:517
bool _isDeathMenu
Definition: gui_v2.h:162
bool _loadedSave
Definition: gui_v2.h:168
Button * addButtonToList(Button *list, Button *newButton)
Definition: gui_v2.cpp:50
void showMessageFromCCode(int string, uint8 c0, int)
Definition: gui_mr.cpp:122
bool _reloadTemporarySave
Definition: gui_v2.h:170
virtual uint32 getMillis(bool skipRecord=false)=0
Get the number of milliseconds since the program was started.
const char * c_str() const
Definition: str.h:208
Callback data0Callback
Definition: gui.h:64
virtual void getInput()
Definition: gui_v2.cpp:393
bool exists(const char *file, bool errorOutOnFail=false)
Definition: resource.cpp:308
void snd_playWanderScoreViaMap(int track, int force)
Definition: kyra_mr.cpp:405
void updateItemCommand(Item item, int str, uint8 c0)
Definition: gui_mr.cpp:126
int16 y
Definition: gui_v1.h:58
int redrawButtonCallback(Button *button)
Definition: gui_mr.cpp:1090
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
uint32 type
Definition: mididrv.cpp:60
void albumSwitchPages(int oldPage, int newPage, int srcPage)
Definition: gui_mr.cpp:953
const char * _shownMessage
Definition: kyra_mr.h:242
bool _restartGame
Definition: gui_v2.h:169
int optionsButton(Button *button)
Definition: gui_mr.cpp:1141
void setupSavegameNames(Menu &menu, int num)
Definition: gui_v2.cpp:431
void showMouse()
Definition: screen.cpp:3034
CruiseEngine * _vm
Definition: cruise.cpp:41
Menu _gameOptions
Definition: gui_v2.h:139
void runStartupScript(int script, int unk1)
Definition: kyra_mr.cpp:673
int buttonShowScore(Button *button)
Definition: gui_mr.cpp:588
void updateMenuButton(Button *button)
Definition: gui_v1.cpp:305
void setCommandLineRestoreTimer(int secs)
Definition: timer_mr.cpp:91
Menu _choiceMenu
Definition: gui_v2.h:139
void updateCommandLine()
Definition: gui_mr.cpp:143
int pause(lua_State *L)
uint16 index
Definition: gui.h:49
uint8 * _scoreFile
Definition: kyra_mr.h:268
Common::Array< const Opcode * > _opcodes
Definition: kyra_v1.h:327
void free()
Release the memory used by the pixels memory of this surface.
Definition: surface.cpp:79
Constant for invalid item.
Definition: item.h:36
int getItemCommandStringInv(uint16 item)
Definition: items_mr.cpp:530
int buttonMoodChange(Button *button)
Definition: gui_mr.cpp:521
uint8 * _scenesFile
Definition: kyra_mr.h:270
unsigned int uint
Definition: scummsys.h:440
int changeLanguage(Button *caller)
Definition: gui_mr.cpp:1406
byte data0Val1
Definition: gui.h:54
void updateCLState()
Definition: gui_mr.cpp:155
bool _isLoadMenu
Definition: gui_v2.h:161
GUI_MR(KyraEngine_MR *engine)
Definition: gui_mr.cpp:1036
Common::String filename
Definition: action.cpp:479
void redrawInventory(int page)
Definition: gui_mr.cpp:429
void updateButton(Button *button)
Definition: gui_v2.cpp:372
const char * getMenuItemTitle(const MenuItem &menuItem)
Definition: gui_mr.cpp:1072
bool _madeSave
Definition: gui_v2.h:167
virtual bool loadPalette(const char *filename, Palette &pal)
Definition: screen.cpp:3282
Menu _audioOptions
Definition: gui_v2.h:139
uint16 labelId
Definition: gui_v1.h:51
Button * _mainButtonData
Definition: kyra_mr.h:144
InventoryItem item
Definition: action.cpp:650
Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail)
Definition: saveload_mr.cpp:33
void loadAlbumPageWSA()
Definition: gui_mr.cpp:720
int direction(int x1, int y1, int x2, int y2, int inc_jo1, int inc_jo2)
Definition: perso.cpp:62
char * _stringBuffer
Definition: kyra_mr.h:521
SoundDigital_MR * _soundDigital
Definition: kyra_mr.h:83
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
int gameOptions(Button *button)
Definition: gui_mr.cpp:1311
int16 x
Definition: gui.h:70
void setTextColor(const uint8 *cmap, int a, int b)
Definition: screen.cpp:1339
An arbitrary graphics surface, which can be the target (or source) of blit operations, font rendering, etc.
Definition: surface.h:42
byte data1Val1
Definition: gui.h:55
Screen_MR * _screen
Definition: gui_mr.h:82
int16 Item
Definition: item.h:30
static bool createThumbnail(Graphics::Surface &out, Graphics::Surface &in)
void hideInventory()
Definition: gui_mr.cpp:240
void drawSliderBar(int slider, const uint8 *shape)
Definition: gui_mr.cpp:1572
const Common::String _targetName
Definition: engine.h:70
void copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest)
Definition: screen.cpp:1067
uint8 * fileData(const char *file, uint32 *size)
Definition: resource.cpp:293
int getItemCommandStringPickUp(uint16 item)
Definition: items_mr.cpp:524
void clearCurPage()
Definition: screen.cpp:599
void addShapeToPool(const uint8 *data, int realIndex, int shape)
Definition: kyra_v2.cpp:173
WSAMovie_v2 * _invWsa
Definition: kyra_mr.h:264
IMPLEMENT_FUNCTION_END switch(savepoint.action)
Definition: abbot.cpp:194
Callback data2Callback
Definition: gui.h:66
uint16 flags
Definition: gui.h:59
Common::List< Event > _eventList
Definition: kyra_v1.h:290
int sliderHandler(Button *caller)
Definition: gui_mr.cpp:1503
void setHandItem(Item item)
Definition: items_v2.cpp:84
int buttonJesterStaff(Button *button)
Definition: gui_mr.cpp:611
TextDisplayer_MR * _text
Definition: kyra_mr.h:657
void printAlbumPageText()
Definition: gui_mr.cpp:744
int _savegameOffset
Definition: gui_v2.h:172
uint16 _tickLength
Definition: kyra_v1.h:311
int quitGame(Button *button)
Definition: gui_mr.cpp:1123
uint8 * _interfaceCommandLine
Definition: kyra_mr.h:228
void flagButtonDisable(Button *button)
Definition: gui_mr.cpp:1055
static const uint8 _inventoryY[]
Definition: kyra_mr.h:259
void setNextIdleAnimTimer()
Definition: timer_mr.cpp:97
bool run(EMCState *script)
Definition: script.cpp:181
void NORETURN_PRE error(const char *s,...)
Definition: textconsole.cpp:67
void setupOptionsButtons()
Definition: gui_mr.cpp:1367
Button _sliderButtons[3][4]
Definition: gui_v2.h:153
virtual int frames()
Definition: wsamovie.h:72
void fadeOutMusic(int ticks)
Definition: kyra_mr.cpp:433
virtual void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2)
Definition: screen.cpp:1245
void createScreenThumbnail(Graphics::Surface &dst)
Definition: gui_mr.cpp:1039
bool load(const char *filename, EMCData *data, const Common::Array< const Opcode *> *opcodes)
Definition: script.cpp:98
void fadeToBlack(int delay=0x54, const UpdateFunctor *upFunc=0)
Definition: screen.cpp:785
static const uint8 _inventoryX[]
Definition: kyra_mr.h:258
Menu _mainMenu
Definition: gui_v2.h:139
void albumRestoreRect()
Definition: gui_mr.cpp:944
void renewHighlight(Menu &menu)
Definition: gui_v2.cpp:410
void albumUpdateRect()
Definition: gui_mr.cpp:948
void drawMalcolmsMoodPointer(int frame, int page)
Definition: gui_mr.cpp:335
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
uint8 frame
Definition: trainline.cpp:37
uint16 width
Definition: gui.h:71
void processHighlights(Menu &menu)
Definition: gui_v1.cpp:196
Button::Callback _redrawButtonFunctor
Definition: gui_v1.h:117
int16 y
Definition: gui.h:70
int audioOptions(Button *button)
Definition: gui_mr.cpp:1444
void loadAlbumPage()
Definition: gui_mr.cpp:702
uint8 * getTableEntry(uint8 *buffer, int id)
Definition: kyra_mr.cpp:1246
int getCenterStringX(const char *str, int x1, int x2)
Definition: text.cpp:46
Menu * _currentMenu
Definition: gui_v2.h:160
uint8 * _itemFile
Definition: kyra_mr.h:271
void albumBackUpRect()
Definition: gui_mr.cpp:940
virtual void getRealPalette(int num, uint8 *dst)
Definition: screen.cpp:900
void playSoundEffect(CORO_PARAM, uint32 nMusic, uint32 nFX, uint32 bNoLoop, uint32)
Definition: custom.cpp:2104
void updateAllMenuButtons()
Definition: gui_v1.cpp:300
const char * _chatText
Definition: kyra_v2.h:346
uint16 menuNameId
Definition: gui_v1.h:65
T CLIP(T v, T amin, T amax)
Definition: util.h:51
int buttonInventory(Button *button)
Definition: gui_mr.cpp:474
uint8 * _screenBuffer
Definition: kyra_v2.h:162
T MAX(T a, T b)
Definition: util.h:50
int albumClose(Button *caller)
Definition: gui_mr.cpp:1029
static String format(const char *fmt,...) GCC_PRINTF(1
Print formatted data into a String object.
Definition: str.cpp:634
bool _restoreCommandLine
Definition: kyra_mr.h:243
bool _noLoadProcess
Definition: gui_v2.h:183
virtual void initMenuLayout(Menu &menu)
Definition: gui_v1.cpp:58
int getScoreX(const char *str)
Definition: gui_mr.cpp:417
void copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src)
Definition: screen.cpp:1104
virtual bool opened()
Definition: wsamovie.h:37
uint8 * _cCodeFile
Definition: kyra_mr.h:269
virtual void close()
Definition: wsamovie.cpp:126
void drawBox(int x1, int y1, int x2, int y2, int color)
Definition: screen.cpp:1238
Callback data1Callback
Definition: gui.h:65
Menu _deathMenu
Definition: gui_v2.h:139
u8 state
Definition: ps2kbd.h:101
void albumChat(const char *str, int vocHigh, int vocLow)
Definition: text_mr.cpp:478
Button * getScrollUpButton()
Definition: gui_v2.h:143
void flagButtonEnable(Button *button)
Definition: gui_mr.cpp:1045
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.
void drawJestersStaff(int type, int page)
Definition: gui_mr.cpp:355
int loadMenu(Button *button)
Definition: gui_mr.cpp:1254
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
void printAlbumText(int page, const char *str, int x, int y, uint8 c0)
Definition: gui_mr.cpp:768
void initMenu(Menu &menu)
Definition: gui_v1.cpp:70