ScummVM
sequences_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/resource/resource.h"
25 
26 namespace Kyra {
27 
30  return;
31 
32  _badConscienceShown = true;
34  if (_currentChapter == 2)
36  else if (_currentChapter == 3)
38  else if (_currentChapter == 4 && _rnd.getRandomNumberRng(1, 100) <= 25)
40  else if (_currentChapter == 5 && _rnd.getRandomNumberRng(1, 100) <= 25)
42 
43  if (_characterShapeFile == 9)
45 
47 
50 
51  int anim = _badConscienceAnim + (_badConsciencePosition ? 0 : 8);
52  TalkObject &talkObject = _talkObjectList[1];
53 
55  talkObject.x = 290;
56  else
57  talkObject.x = 30;
58  talkObject.y = 30;
59 
60  static const char *const animFilenames[] = {
61  "GUNFL00.WSA", "GUNFL01.WSA", "GUNFL02.WSA", "GUNFL03.WSA", "GUNFL04.WSA", "GUNFL05.WSA", "GUNFL06.WSA", "GUNFL07.WSA",
62  "GUNFR00.WSA", "GUNFR01.WSA", "GUNFR02.WSA", "GUNFR03.WSA", "GUNFR04.WSA", "GUNFR05.WSA", "GUNFR06.WSA", "GUNFR07.WSA"
63  };
64 
65  setupSceneAnimObject(0x0E, 9, 0, 187, -1, -1, -1, -1, 0, 0, 0, -1, animFilenames[anim]);
66  for (uint i = 0; i <= _badConscienceFrameTable[_badConscienceAnim]; ++i) {
67  if (i == 8)
68  snd_playSoundEffect(0x1B, 0xC8);
69  updateSceneAnim(0x0E, i);
70  delay(3*_tickLength, true);
71  }
72 
74  return;
75 
76  if (_mainCharacter.y1 == -1 || (_mainCharacter.x1 != -1 && _mainCharacter.animFrame == 87) || _mainCharacter.animFrame == 87) {
78  } else {
81  else
84  }
85 
88 }
89 
92  return;
93 
94  _badConscienceShown = false;
96  if (frame == 15)
97  snd_playSoundEffect(0x31, 0xC8);
98  updateSceneAnim(0x0E, frame);
99  delay(1*_tickLength, true);
100  }
101 
102  updateSceneAnim(0x0E, -1);
103  update();
104  removeSceneAnimObject(0x0E, 1);
106 }
107 
110  return;
111 
112  _goodConscienceShown = true;
114  _goodConscienceAnim %= 5;
115 
118 
121 
122  int anim = _goodConscienceAnim + (_goodConsciencePosition ? 0 : 5);
123  TalkObject &talkObject = _talkObjectList[87];
124 
126  talkObject.x = 290;
127  else
128  talkObject.x = 30;
129  talkObject.y = 30;
130 
131  static const char *const animFilenames[] = {
132  "STUFL00.WSA", "STUFL02.WSA", "STUFL04.WSA", "STUFL03.WSA", "STUFL01.WSA",
133  "STUFR00.WSA", "STUFR02.WSA", "STUFR04.WSA", "STUFR03.WSA", "STUFR01.WSA"
134  };
135 
136  setupSceneAnimObject(0x0F, 9, 0, 187, -1, -1, -1, -1, 0, 0, 0, -1, animFilenames[anim]);
137  for (uint i = 0; i <= _goodConscienceFrameTable[_goodConscienceAnim]; ++i) {
138  if (i == 10)
139  snd_playSoundEffect(0x7F, 0xC8);
140  updateSceneAnim(0x0F, i);
141  delay(2*_tickLength, true);
142  }
143 
145  return;
146 
147  if (_mainCharacter.y1 == -1 || (_mainCharacter.x1 != -1 && _mainCharacter.animFrame == 87) || _mainCharacter.animFrame == 87) {
149  } else {
152  else
155  }
156 
159 }
160 
163  return;
164 
165  _goodConscienceShown = false;
167  if (frame == 17)
168  snd_playSoundEffect(0x31, 0xC8);
169  updateSceneAnim(0x0F, frame);
170  delay(1*_tickLength, true);
171  }
172 
173  updateSceneAnim(0x0F, -1);
174  update();
175  removeSceneAnimObject(0x0F, 1);
177 }
178 
180  if (_chatText)
181  return;
182  _screen->hideMouse();
183 
184  if (_inventoryState)
185  hideInventory();
186  removeHandItem();
187 
188  objectChat((const char *)getTableEntry(_cCodeFile, 35), 0, 204, 35);
189  objectChat((const char *)getTableEntry(_cCodeFile, 40), 0, 204, 40);
190 
191  setGameFlag(0xD1);
192 
193  snd_playSoundEffect(0x2A, 0xC8);
194 
195  setGameFlag(0x171);
196 
197  switch (_characterShapeFile-1) {
198  case 0:
199  runAnimationScript("EELS01.EMC", 0, 0, 1, 1);
200  break;
201 
202  case 1:
203  runAnimationScript("EELS02.EMC", 0, 0, 1, 1);
204  break;
205 
206  case 2:
207  runAnimationScript("EELS03.EMC", 0, 0, 1, 1);
208  break;
209 
210  case 3:
211  runAnimationScript("EELS04.EMC", 0, 0, 1, 1);
212  break;
213 
214  default:
215  resetGameFlag(0x171);
216  runAnimationScript("EELS00.EMC", 0, 0, 1, 1);
217  }
218 
219  changeChapter(2, 29, 0, 4);
220  _screen->showMouse();
221 }
222 
224  const int lastEntry = MIN(_animShapeLastEntry, 41);
225  for (int i = 0; i < lastEntry; ++i)
226  _gameShapes[9+i] = _screen->getPtrToShape(filedata, i);
227  return lastEntry;
228 }
229 
231  for (int i = 0; i < count; ++i)
232  _gameShapes[9+i] = 0;
233  delete[] filedata;
235 }
236 
237 } // End of namespace Kyra
static const uint8 _goodConscienceFrameTable[]
Definition: kyra_mr.h:488
bool _badConsciencePosition
Definition: kyra_mr.h:477
Character _mainCharacter
Definition: kyra_v2.h:330
int count
Definition: voc.cpp:116
bool _goodConsciencePosition
Definition: kyra_mr.h:486
Screen_MR * _screen
Definition: kyra_mr.h:82
int setGameFlag(int flag)
Definition: kyra_v1.cpp:511
unsigned char uint8
Definition: cdtypes.h:28
bool _goodConscienceShown
Definition: kyra_mr.h:484
void runAnimationScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload)
bool _badConscienceShown
Definition: kyra_mr.h:475
int resetGameFlag(int flag)
Definition: kyra_v1.cpp:522
void changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing)
Definition: kyra_mr.cpp:1342
ShapeMap _gameShapes
Definition: kyra_v2.h:256
void hideMouse()
Definition: screen.cpp:3029
int initAnimationShapes(uint8 *filedata)
T MIN(T a, T b)
Definition: util.h:49
uint getRandomNumberRng(uint min, uint max)
Generates a random unsigned integer in the interval [min, max].
Definition: random.cpp:58
void showMouse()
Definition: screen.cpp:3034
unsigned int uint
Definition: scummsys.h:440
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)
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 updateSceneAnim(int anim, int newFrame)
uint16 _tickLength
Definition: kyra_v1.h:311
void refreshAnimObjectsIfNeed()
static const uint8 _characterFrameTable[]
Definition: kyra_mr.h:388
void setNextIdleAnimTimer()
Definition: timer_mr.cpp:97
uint8 * getPtrToShape(uint8 *shpFile, int shape)
Definition: screen_v2.cpp:204
uint8 frame
Definition: trainline.cpp:37
uint8 * getTableEntry(uint8 *buffer, int id)
Definition: kyra_mr.cpp:1246
const char * _chatText
Definition: kyra_v2.h:346
void uninitAnimationShapes(int count, uint8 *filedata)
uint8 * _cCodeFile
Definition: kyra_mr.h:269
void removeSceneAnimObject(int anim, int refresh)
Common::RandomSource _rnd
Definition: kyra_v1.h:205
void updateCharacterAnim(int charId)
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
TalkObject * _talkObjectList
Definition: kyra_mr.h:412
static const uint8 _badConscienceFrameTable[]
Definition: kyra_mr.h:479