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
24
25 #ifdef ENABLE_AGOS2
26
27 #include "common/config-manager.h"
28
29 #include "agos/intern.h"
30 #include "agos/agos.h"
31 #include "agos/animation.h"
32
33 namespace AGOS {
34
AGOSEngine_Feeble(OSystem * system,const AGOSGameDescription * gd)35 AGOSEngine_Feeble::AGOSEngine_Feeble(OSystem *system, const AGOSGameDescription *gd)
36 : AGOSEngine_Simon2(system, gd) {
37
38 _interactiveVideo = 0;
39 _moviePlayer = 0;
40 _vgaCurSpritePriority = 0;
41 _mouseToggle = false;
42 _opcodesFeeble = nullptr;
43 }
44
~AGOSEngine_Feeble()45 AGOSEngine_Feeble::~AGOSEngine_Feeble() {
46 delete _moviePlayer;
47 }
48
49 static const GameSpecificSettings feeblefiles_settings = {
50 "game22", // base_filename
51 "save.999", // restore_filename
52 "tbllist", // tbl_filename
53 "", // effects_filename
54 "VOICES", // speech_filename
55 };
56
setupGame()57 void AGOSEngine_Feeble::setupGame() {
58 gss = &feeblefiles_settings;
59 _numVideoOpcodes = 85;
60 _vgaMemSize = 7500000;
61 _itemMemSize = 20000;
62 _tableMemSize = 200000;
63 _frameCount = 1;
64 _vgaBaseDelay = 5;
65 _vgaPeriod = 50;
66 _numBitArray1 = 16;
67 _numBitArray2 = 16;
68 _numBitArray3 = 16;
69 _numItemStore = 10;
70 _numTextBoxes = 40;
71 _numVars = 255;
72
73 _numSpeech = 10000;
74 _numZone = 450;
75
76 AGOSEngine::setupGame();
77 }
78
runSubroutine101()79 void AGOSEngine_Feeble::runSubroutine101() {
80 if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformMacintosh) &&
81 getGameType() == GType_FF) {
82 playVideo("epic.dxa");
83 }
84
85 AGOSEngine::runSubroutine101();
86 }
87
playVideo(const char * filename,bool lastSceneUsed)88 void AGOSEngine_Feeble::playVideo(const char *filename, bool lastSceneUsed) {
89 if (shouldQuit())
90 return;
91
92 if (lastSceneUsed)
93 setBitFlag(41, true);
94
95 _moviePlayer = makeMoviePlayer(this, filename);
96 assert(_moviePlayer);
97
98 _moviePlayer->load();
99 _moviePlayer->play();
100
101 delete _moviePlayer;
102 _moviePlayer = NULL;
103
104 if (lastSceneUsed)
105 setBitFlag(41, false);
106 }
107
stopInteractiveVideo()108 void AGOSEngine_Feeble::stopInteractiveVideo() {
109 if (_interactiveVideo) {
110 _interactiveVideo = 0;
111 _moviePlayer->stopVideo();
112 delete _moviePlayer;
113 _moviePlayer = NULL;
114 }
115 }
116
AGOSEngine_FeebleDemo(OSystem * system,const AGOSGameDescription * gd)117 AGOSEngine_FeebleDemo::AGOSEngine_FeebleDemo(OSystem *system, const AGOSGameDescription *gd)
118 : AGOSEngine_Feeble(system, gd) {
119
120 _filmMenuUsed = 0;
121 }
122
go()123 Common::Error AGOSEngine_FeebleDemo::go() {
124 // Main menu
125 defineBox( 1, 80, 75, 81, 117, kBFBoxDead, 0, NULL);
126 defineBox( 2, 267, 21, 105, 97, kBFBoxDead, 0, NULL);
127 defineBox( 3, 456, 89, 125, 103, kBFBoxDead, 0, NULL);
128 defineBox( 4, 151, 225, 345, 41, kBFBoxDead, 0, NULL);
129 defineBox( 5, 169, 319, 109, 113, kBFBoxDead, 0, NULL);
130 defineBox( 6, 404, 308, 62, 117, kBFBoxDead, 0, NULL);
131
132 // Film menu
133 defineBox(11, 28, 81, 123, 93, kBFBoxDead, 0, NULL);
134 defineBox(12, 182, 81, 123, 93, kBFBoxDead, 0, NULL);
135 defineBox(13, 335, 81, 123, 93, kBFBoxDead, 0, NULL);
136 defineBox(14, 488, 81, 123, 93, kBFBoxDead, 0, NULL);
137 defineBox(15, 28, 201, 123, 93, kBFBoxDead, 0, NULL);
138 defineBox(16, 182, 201, 123, 93, kBFBoxDead, 0, NULL);
139 defineBox(17, 335, 201, 123, 93, kBFBoxDead, 0, NULL);
140 defineBox(18, 488, 201, 123, 93, kBFBoxDead, 0, NULL);
141 defineBox(19, 255, 357, 135, 45, kBFBoxDead, 0, NULL);
142
143 // Exit Menu
144 defineBox(21, 548, 421, 42, 21, kBFBoxDead, 0, NULL);
145
146 // Text Window used by Feeble Files Data section
147 if (_language ==Common::DE_DEU) {
148 _textWindow = openWindow(322, 457, 196, 15, 1, 0, 255);
149 } else {
150 _textWindow = openWindow(444, 452, 196, 15, 1, 0, 255);
151 }
152
153 playVideo("winasoft.smk");
154 playVideo("fbigtalk.smk");
155
156 while (!shouldQuit())
157 mainMenu();
158
159 return Common::kNoError;
160 }
161
exitMenu()162 void AGOSEngine_FeebleDemo::exitMenu() {
163 for (int i = 1; i <= 20; i++)
164 disableBox(i);
165
166 enableBox(21);
167
168 playVideo("fhypno.smk");
169 playVideo("fbye1.smk", true);
170
171 HitArea *ha;
172 do {
173 _lastHitArea = NULL;
174 _lastHitArea3 = NULL;
175
176 while (!shouldQuit() && _lastHitArea3 == 0) {
177 delay(1);
178 }
179
180 ha = _lastHitArea;
181 } while (!shouldQuit() && !(ha != NULL && ha->id == 21));
182
183 playVideo("fbye2.smk");
184 quitGame();
185 delay(0);
186 }
187
filmMenu()188 void AGOSEngine_FeebleDemo::filmMenu() {
189 for (int i = 1; i <= 6; i++)
190 disableBox(i);
191
192 for (int i = 11; i <= 19; i++)
193 enableBox(i);
194
195 if (!_filmMenuUsed) {
196 playVideo("fclipsin.smk", true);
197 } else {
198 playVideo("fclipin2.smk", true);
199 }
200
201 _filmMenuUsed = true;
202
203 HitArea *ha;
204 while (!shouldQuit()) {
205 _lastHitArea = NULL;
206 _lastHitArea3 = NULL;
207
208 while (!shouldQuit() && _lastHitArea3 == 0) {
209 handleWobble();
210 delay(1);
211 }
212
213 ha = _lastHitArea;
214
215 if (ha == NULL)
216 continue;
217
218 stopInteractiveVideo();
219
220 if (ha->id == 11) {
221 playVideo("fgo1.smk");
222 playVideo("maze.smk");
223 } else if (ha->id == 12) {
224 playVideo("fgo2.smk");
225 playVideo("radioin.smk");
226 } else if (ha->id == 13) {
227 playVideo("fgo3.smk");
228 playVideo("pad.smk");
229 } else if (ha->id == 14) {
230 playVideo("fgo4.smk");
231 playVideo("bridge.smk");
232 } else if (ha->id == 15) {
233 playVideo("fgo5.smk");
234 playVideo("pilldie.smk");
235 } else if (ha->id == 16) {
236 playVideo("fgo6.smk");
237 playVideo("bikebust.smk");
238 } else if (ha->id == 17) {
239 playVideo("fgo7.smk");
240 playVideo("statue.smk");
241 } else if (ha->id == 18) {
242 playVideo("fgo8.smk");
243 playVideo("junkout.smk");
244 } else if (ha->id == 19) {
245 playVideo("fgo9.smk");
246 break;
247 }
248
249 playVideo("fclipin2.smk", true);
250 }
251 }
252
handleText()253 void AGOSEngine_FeebleDemo::handleText() {
254 if (_lastClickRem == _currentBox)
255 return;
256
257 if (_currentBox && (_currentBox->id >= 1 && _currentBox->id <= 6)) {
258 // TODO: Add the subtitles for menu options
259 }
260
261 _lastClickRem = _currentBox;
262 }
263
handleWobble()264 void AGOSEngine_FeebleDemo::handleWobble() {
265 if (_lastClickRem == _currentBox)
266 return;
267
268 stopInteractiveVideo();
269
270 if (_currentBox && (_currentBox->id >= 11 && _currentBox->id <= 19)) {
271 char filename[15];
272 sprintf(filename, "wobble%d.smk", _currentBox->id - 10);
273
274 startInteractiveVideo(filename);
275 }
276
277 _lastClickRem = _currentBox;
278 }
279
mainMenu()280 void AGOSEngine_FeebleDemo::mainMenu() {
281 for (int i = 1; i <= 6; i++)
282 enableBox(i);
283
284 for (int i = 11; i <= 19; i++)
285 disableBox(i);
286
287 playVideo("mmfadein.smk", true);
288
289 startInteractiveVideo("mainmenu.smk");
290
291 HitArea *ha = 0;
292 do {
293 _lastHitArea = NULL;
294 _lastHitArea3 = NULL;
295
296 while (_lastHitArea3 == 0) {
297 if (shouldQuit())
298 return;
299 handleText();
300 delay(1);
301 }
302
303 ha = _lastHitArea;
304 } while (ha == NULL || !(ha->id >= 1 && ha->id <= 6));
305
306 if (shouldQuit())
307 return;
308
309 stopInteractiveVideo();
310
311 if (ha->id == 1) {
312 // Feeble Files Data
313 playVideo("ffade5.smk");
314 playVideo("ftext0.smk");
315 playVideo("ftext1.smk", true);
316 waitForSpace();
317 playVideo("ftext2.smk", true);
318 waitForSpace();
319 playVideo("ftext3.smk", true);
320 waitForSpace();
321 playVideo("ftext4.smk", true);
322 waitForSpace();
323 playVideo("ftext5.smk", true);
324 waitForSpace();
325 } else if (ha->id == 2) {
326 // Opening Sequence
327 playVideo("ffade1.smk");
328 playVideo("musosp1.smk");
329 playVideo("newcred.smk");
330 playVideo("fasall.smk");
331 playVideo("mus5p2.smk");
332 playVideo("coach.smk");
333 playVideo("outmin.smk");
334 } else if (ha->id == 3) {
335 // Technical Information
336 playVideo("ffade3.smk");
337 playVideo("idfx4a.smk");
338 playVideo("idfx4b.smk");
339 playVideo("idfx4c.smk");
340 playVideo("idfx4d.smk");
341 playVideo("idfx4e.smk");
342 playVideo("idfx4f.smk");
343 playVideo("idfx4g.smk");
344 } else if (ha->id == 4) {
345 // About AdventureSoft
346 playVideo("ffade2.smk");
347 playVideo("fscene3b.smk");
348 playVideo("fscene3a.smk");
349 playVideo("fscene3c.smk");
350 playVideo("fscene3g.smk");
351 } else if (ha->id == 5) {
352 // Video Clips
353 playVideo("ffade4.smk");
354 filmMenu();
355 } else if (ha->id == 6) {
356 // Exit InfoDisk
357 playVideo("ffade6.smk");
358 exitMenu();
359 }
360 }
361
startInteractiveVideo(const char * filename)362 void AGOSEngine_FeebleDemo::startInteractiveVideo(const char *filename) {
363 setBitFlag(40, true);
364 _interactiveVideo = MoviePlayer::TYPE_LOOPING;
365 _moviePlayer = makeMoviePlayer(this, filename);
366 assert(_moviePlayer);
367 _moviePlayer->load();
368 _moviePlayer->play();
369 setBitFlag(40, false);
370 }
371
waitForSpace()372 void AGOSEngine_FeebleDemo::waitForSpace() {
373 const char *message;
374
375 if (_language == Common::DE_DEU) {
376 message = "Dr\x81""cken Sie die <Leertaste>, um fortzufahren...";
377 } else {
378 message = "Press <SPACE> to continue...";
379 }
380
381 windowPutChar(_textWindow, 12);
382 for (; *message; message++)
383 windowPutChar(_textWindow, *message);
384
385 mouseOff();
386 do {
387 delay(1);
388 } while (!shouldQuit() && (_keyPressed.keycode != Common::KEYCODE_SPACE));
389 _keyPressed.reset();
390 mouseOn();
391 }
392
393 } // End of namespace AGOS
394
395 #endif // ENABLE_AGOS2
396