1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// Intro sequence scene procedures
#include "saga/saga.h"
#include "saga/gfx.h"
#include "saga/animation.h"
#include "saga/events.h"
#include "saga/font.h"
#include "saga/itedata.h"
#include "saga/sndres.h"
#include "saga/palanim.h"
#include "saga/music.h"
#include "saga/scene.h"
#include "saga/resource.h"
namespace Saga {
#define INTRO_FRAMETIME 90
#define INTRO_CAPTION_Y 170
#define INTRO_DE_CAPTION_Y 160
#define INTRO_IT_CAPTION_Y 160
#define INTRO_VOICE_PAD 50
#define INTRO_VOICE_LETTERLEN 90
#define DISSOLVE_DURATION 3000
#define LOGO_DISSOLVE_DURATION 1000
// Intro scenes
#define RID_ITE_INTRO_ANIM_SCENE 1538
#define RID_ITE_CAVE_SCENE_1 1542
#define RID_ITE_CAVE_SCENE_2 1545
#define RID_ITE_CAVE_SCENE_3 1548
#define RID_ITE_CAVE_SCENE_4 1551
#define RID_ITE_VALLEY_SCENE 1556
#define RID_ITE_TREEHOUSE_SCENE 1560
#define RID_ITE_FAIREPATH_SCENE 1564
#define RID_ITE_FAIRETENT_SCENE 1567
// Intro scenes - DOS demo
#define RID_ITE_INTRO_ANIM_SCENE_DOS_DEMO 298
#define RID_ITE_CAVE_SCENE_DOS_DEMO 302
#define RID_ITE_VALLEY_SCENE_DOS_DEMO 310
// ITE intro music
#define MUSIC_INTRO 9
#define MUSIC_TITLE_THEME 10
LoadSceneParams ITE_IntroList[] = {
{RID_ITE_INTRO_ANIM_SCENE, kLoadByResourceId, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_CAVE_SCENE_1, kLoadByResourceId, Scene::SC_ITEIntroCave1Proc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_CAVE_SCENE_2, kLoadByResourceId, Scene::SC_ITEIntroCave2Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_CAVE_SCENE_3, kLoadByResourceId, Scene::SC_ITEIntroCave3Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_CAVE_SCENE_4, kLoadByResourceId, Scene::SC_ITEIntroCave4Proc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_VALLEY_SCENE, kLoadByResourceId, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_TREEHOUSE_SCENE, kLoadByResourceId, Scene::SC_ITEIntroTreeHouseProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_FAIREPATH_SCENE, kLoadByResourceId, Scene::SC_ITEIntroFairePathProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_FAIRETENT_SCENE, kLoadByResourceId, Scene::SC_ITEIntroFaireTentProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
};
LoadSceneParams ITE_DOS_Demo_IntroList[] = {
{RID_ITE_INTRO_ANIM_SCENE_DOS_DEMO, kLoadByResourceId, Scene::SC_ITEIntroAnimProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_CAVE_SCENE_DOS_DEMO, kLoadByResourceId, Scene::SC_ITEIntroCaveDemoProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
{RID_ITE_VALLEY_SCENE_DOS_DEMO, kLoadByResourceId, Scene::SC_ITEIntroValleyProc, false, kTransitionFade, 0, NO_CHAPTER_CHANGE},
};
int Scene::ITEStartProc() {
LoadSceneParams firstScene;
LoadSceneParams tempScene;
bool dosDemo = (_vm->getFeatures() & GF_ITE_DOS_DEMO);
int scenesCount = (!dosDemo) ? ARRAYSIZE(ITE_IntroList) : ARRAYSIZE(ITE_DOS_Demo_IntroList);
for (int i = 0; i < scenesCount; i++) {
tempScene = (!dosDemo) ? ITE_IntroList[i] : ITE_DOS_Demo_IntroList[i];
tempScene.sceneDescriptor = _vm->_resource->convertResourceId(tempScene.sceneDescriptor);
_vm->_scene->queueScene(tempScene);
}
firstScene.loadFlag = kLoadBySceneNumber;
firstScene.sceneDescriptor = _vm->getStartSceneNumber();
firstScene.sceneSkipTarget = true;
firstScene.sceneProc = NULL;
firstScene.transitionType = kTransitionFade;
firstScene.actorsEntrance = 0;
firstScene.chapter = -1;
_vm->_scene->queueScene(firstScene);
return SUCCESS;
}
EventColumns *Scene::queueIntroDialogue(EventColumns *eventColumns, int n_dialogues, const IntroDialogue dialogue[]) {
TextListEntry textEntry;
TextListEntry *entry;
Event event;
int voiceLength;
int i;
// Queue narrator dialogue list
textEntry.knownColor = kKnownColorSubtitleTextColor;
textEntry.effectKnownColor = kKnownColorTransparent;
textEntry.useRect = true;
textEntry.rect.left = 0;
textEntry.rect.right = _vm->getDisplayInfo().width;
if (_vm->getLanguage() == Common::DE_DEU) {
textEntry.rect.top = INTRO_DE_CAPTION_Y;
} else if (_vm->getLanguage() == Common::IT_ITA) {
textEntry.rect.top = INTRO_IT_CAPTION_Y;
} else {
textEntry.rect.top = INTRO_CAPTION_Y;
}
textEntry.rect.bottom = _vm->getDisplayInfo().height;
textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);
for (i = 0; i < n_dialogues; i++) {
textEntry.text = dialogue[i].i_str;
entry = _vm->_scene->_textList.addEntry(textEntry);
if (_vm->_subtitlesEnabled) {
// Display text
event.type = kEvTOneshot;
event.code = kTextEvent;
event.op = kEventDisplay;
event.data = entry;
event.time = (i == 0) ? 0 : INTRO_VOICE_PAD;
eventColumns = _vm->_events->chain(eventColumns, event);
}
if (_vm->_voicesEnabled) {
// Play voice
event.type = kEvTOneshot;
event.code = kVoiceEvent;
event.op = kEventPlay;
event.param = dialogue[i].i_voice_rn;
event.time = 0;
_vm->_events->chain(eventColumns, event);
}
voiceLength = _vm->_sndRes->getVoiceLength(dialogue[i].i_voice_rn);
if (voiceLength < 0) {
// Set a default length if no speech file is present
voiceLength = strlen(dialogue[i].i_str) * INTRO_VOICE_LETTERLEN;
}
// Remove text
event.type = kEvTOneshot;
event.code = kTextEvent;
event.op = kEventRemove;
event.data = entry;
event.time = voiceLength;
_vm->_events->chain(eventColumns, event);
}
return eventColumns;
}
// Queue a page of credits text. The original interpreter did word-wrapping
// automatically. We currently don't.
EventColumns *Scene::queueCredits(int delta_time, int duration, int n_credits, const IntroCredit credits[]) {
int game;
Common::Language lang;
bool hasWyrmkeepCredits = (Common::File::exists("credit3n.dlt") || // PC
Common::File::exists("credit3m.dlt")); // Mac
// The assumption here is that all WyrmKeep versions have the same
// credits, regardless of which operating system they're for.
lang = _vm->getLanguage();
if (hasWyrmkeepCredits)
game = kITECreditsWyrmKeep;
else if (_vm->getPlatform() == Common::kPlatformMacintosh)
game = kITECreditsMac;
else if (_vm->getFeatures() & GF_EXTRA_ITE_CREDITS)
game = kITECreditsPCCD;
else
game = kITECreditsPC;
int line_spacing = 0;
int paragraph_spacing;
KnownFont font = kKnownFontSmall;
int i;
int n_paragraphs = 0;
int credits_height = 0;
for (i = 0; i < n_credits; i++) {
if (credits[i].lang != lang && credits[i].lang != Common::UNK_LANG) {
continue;
}
if (!(credits[i].game & game)) {
continue;
}
switch (credits[i].type) {
case kITECreditsHeader:
font = kKnownFontSmall;
line_spacing = 4;
n_paragraphs++;
break;
case kITECreditsText:
font = kKnownFontMedium;
line_spacing = 2;
break;
default:
error("Unknown credit type");
}
credits_height += (_vm->_font->getHeight(font) + line_spacing);
}
paragraph_spacing = (200 - credits_height) / (n_paragraphs + 3);
credits_height += (n_paragraphs * paragraph_spacing);
int y = paragraph_spacing;
TextListEntry textEntry;
TextListEntry *entry;
Event event;
EventColumns *eventColumns = NULL;
textEntry.knownColor = kKnownColorSubtitleTextColor;
textEntry.effectKnownColor = kKnownColorTransparent;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);
textEntry.point.x = 160;
for (i = 0; i < n_credits; i++) {
if (credits[i].lang != lang && credits[i].lang != Common::UNK_LANG) {
continue;
}
if (!(credits[i].game & game)) {
continue;
}
switch (credits[i].type) {
case kITECreditsHeader:
font = kKnownFontSmall;
line_spacing = 4;
y += paragraph_spacing;
break;
case kITECreditsText:
font = kKnownFontMedium;
line_spacing = 2;
break;
default:
break;
}
textEntry.text = credits[i].string;
textEntry.font = font;
textEntry.point.y = y;
entry = _vm->_scene->_textList.addEntry(textEntry);
// Display text
event.type = kEvTOneshot;
event.code = kTextEvent;
event.op = kEventDisplay;
event.data = entry;
event.time = delta_time;
eventColumns = _vm->_events->queue(event);
// Remove text
event.type = kEvTOneshot;
event.code = kTextEvent;
event.op = kEventRemove;
event.data = entry;
event.time = duration;
_vm->_events->chain(eventColumns, event);
y += (_vm->_font->getHeight(font) + line_spacing);
}
return eventColumns;
}
int Scene::SC_ITEIntroAnimProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroAnimProc(param);
}
// Handles the introductory Dreamer's Guild / NWC logo animation scene.
int Scene::ITEIntroAnimProc(int param) {
Event event;
EventColumns *eventColumns;
bool isMac = _vm->getPlatform() == Common::kPlatformMacintosh;
bool isMultiCD = _vm->getPlatform() == Common::kPlatformUnknown;
bool hasWyrmkeepCredits = (Common::File::exists("credit3n.dlt") || // PC
Common::File::exists("credit3m.dlt")); // Mac
bool isDemo = Common::File::exists("scriptsd.rsc");
switch (param) {
case SCENE_BEGIN:{
// Background for intro scene is the first frame of the
// intro animation; display it and set the palette
event.type = kEvTOneshot;
event.code = kBgEvent;
event.op = kEventDisplay;
event.param = kEvPSetPalette;
event.time = 0;
eventColumns = _vm->_events->queue(event);
debug(3, "Intro animation procedure started.");
debug(3, "Linking animation resources...");
_vm->_anim->setFrameTime(0, INTRO_FRAMETIME);
// Link this scene's animation resources for continuous
// playback
int lastAnim;
if (hasWyrmkeepCredits || isMultiCD || isDemo)
lastAnim = isMac ? 3 : 2;
else
lastAnim = isMac ? 4 : 5;
for (int i = 0; i < lastAnim; i++)
_vm->_anim->link(i, i+1);
_vm->_anim->setFlag(lastAnim, ANIM_FLAG_ENDSCENE);
debug(3, "Beginning animation playback.");
// Begin the animation
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventPlay;
event.param = 0;
event.time = 0;
_vm->_events->chain(eventColumns, event);
// Queue intro music playback
_vm->_events->chainMusic(eventColumns, MUSIC_INTRO, true);
}
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::ITEIntroCaveCommonProc(int param, int caveScene) {
Event event;
EventColumns *eventColumns = NULL;
const IntroDialogue *dialogue;
int lang = 0;
if (_vm->getLanguage() == Common::DE_DEU)
lang = 1;
else if (_vm->getLanguage() == Common::IT_ITA)
lang = 2;
int n_dialogues = 0;
switch (caveScene) {
case 1:
n_dialogues = ARRAYSIZE(introDialogueCave1[lang]);
dialogue = introDialogueCave1[lang];
break;
case 2:
n_dialogues = ARRAYSIZE(introDialogueCave2[lang]);
dialogue = introDialogueCave2[lang];
break;
case 3:
n_dialogues = ARRAYSIZE(introDialogueCave3[lang]);
dialogue = introDialogueCave3[lang];
break;
case 4:
n_dialogues = ARRAYSIZE(introDialogueCave4[lang]);
dialogue = introDialogueCave4[lang];
break;
default:
error("Invalid cave scene");
}
switch (param) {
case SCENE_BEGIN:
if (caveScene > 1) {
// Start 'dissolve' transition to new scene background
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolve;
event.time = 0;
event.duration = DISSOLVE_DURATION;
eventColumns = _vm->_events->queue(event);
}
// Begin palette cycling animation for candles
event.type = kEvTOneshot;
event.code = kPalAnimEvent;
event.op = kEventCycleStart;
event.time = 0;
eventColumns = _vm->_events->chain(eventColumns, event);
// Queue narrator dialogue list
queueIntroDialogue(eventColumns, n_dialogues, dialogue);
// End scene after last dialogue over
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = INTRO_VOICE_PAD;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::ITEIntroCaveDemoProc(int param) {
Event event;
EventColumns *eventColumns = NULL;
switch (param) {
case SCENE_BEGIN:
// Begin palette cycling animation for candles
event.type = kEvTOneshot;
event.code = kPalAnimEvent;
event.op = kEventCycleStart;
event.time = 0;
eventColumns = _vm->_events->chain(eventColumns, event);
// Queue narrator dialogue list
for (int i = 0; i < 11; i++) {
// Play voice
event.type = kEvTOneshot;
event.code = kVoiceEvent;
event.op = kEventPlay;
event.param = i;
event.time = _vm->_sndRes->getVoiceLength(i);
_vm->_events->chain(eventColumns, event);
}
// End scene after last dialogue over
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = INTRO_VOICE_PAD;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::SC_ITEIntroCaveDemoProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroCaveDemoProc(param);
}
// Handles first introductory cave painting scene
int Scene::SC_ITEIntroCave1Proc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroCaveCommonProc(param, 1);
}
// Handles second introductory cave painting scene
int Scene::SC_ITEIntroCave2Proc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroCaveCommonProc(param, 2);
}
// Handles third introductory cave painting scene
int Scene::SC_ITEIntroCave3Proc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroCaveCommonProc(param, 3);
}
// Handles fourth introductory cave painting scene
int Scene::SC_ITEIntroCave4Proc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroCaveCommonProc(param, 4);
}
int Scene::SC_ITEIntroValleyProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroValleyProc(param);
}
// Handles intro title scene (valley overlook)
int Scene::ITEIntroValleyProc(int param) {
Event event;
EventColumns *eventColumns;
int n_credits = ARRAYSIZE(creditsValley);
switch (param) {
case SCENE_BEGIN:
// Begin title screen background animation
_vm->_anim->setCycles(0, -1);
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventPlay;
event.param = 0;
event.time = 0;
eventColumns = _vm->_events->queue(event);
// Begin ITE title theme music
_vm->_music->stop();
_vm->_events->chainMusic(eventColumns, MUSIC_TITLE_THEME);
// Pause animation before logo
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventStop;
event.param = 0;
event.time = 3000;
_vm->_events->chain(eventColumns, event);
// Display logo
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolveBGMask;
event.time = 0;
event.duration = LOGO_DISSOLVE_DURATION;
_vm->_events->chain(eventColumns, event);
// Remove logo
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolve;
event.time = 3000;
event.duration = LOGO_DISSOLVE_DURATION;
_vm->_events->chain(eventColumns, event);
// Unpause animation before logo
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventPlay;
event.time = 0;
event.param = 0;
_vm->_events->chain(eventColumns, event);
// Queue game credits list
eventColumns = queueCredits(9000, CREDIT_DURATION1, n_credits, creditsValley);
// End scene after credit display
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = 1000;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::SC_ITEIntroTreeHouseProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroTreeHouseProc(param);
}
// Handles second intro credit screen (treehouse view)
int Scene::ITEIntroTreeHouseProc(int param) {
Event event;
EventColumns *eventColumns;
int n_credits1 = ARRAYSIZE(creditsTreeHouse1);
int n_credits2 = ARRAYSIZE(creditsTreeHouse2);
switch (param) {
case SCENE_BEGIN:
// Start 'dissolve' transition to new scene background
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolve;
event.time = 0;
event.duration = DISSOLVE_DURATION;
eventColumns = _vm->_events->queue(event);
if (_vm->_anim->hasAnimation(0)) {
// Begin title screen background animation
_vm->_anim->setFrameTime(0, 100);
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventPlay;
event.param = 0;
event.time = 0;
_vm->_events->chain(eventColumns, event);
}
// Queue game credits list
queueCredits(DISSOLVE_DURATION + 2000, CREDIT_DURATION1, n_credits1, creditsTreeHouse1);
eventColumns = queueCredits(DISSOLVE_DURATION + 7000, CREDIT_DURATION1, n_credits2, creditsTreeHouse2);
// End scene after credit display
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = 1000;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::SC_ITEIntroFairePathProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroFairePathProc(param);
}
// Handles third intro credit screen (path to puzzle tent)
int Scene::ITEIntroFairePathProc(int param) {
Event event;
EventColumns *eventColumns;
int n_credits1 = ARRAYSIZE(creditsFairePath1);
int n_credits2 = ARRAYSIZE(creditsFairePath2);
switch (param) {
case SCENE_BEGIN:
// Start 'dissolve' transition to new scene background
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolve;
event.time = 0;
event.duration = DISSOLVE_DURATION;
eventColumns = _vm->_events->queue(event);
// Begin title screen background animation
_vm->_anim->setCycles(0, -1);
event.type = kEvTOneshot;
event.code = kAnimEvent;
event.op = kEventPlay;
event.param = 0;
event.time = 0;
_vm->_events->chain(eventColumns, event);
// Queue game credits list
queueCredits(DISSOLVE_DURATION + 2000, CREDIT_DURATION1, n_credits1, creditsFairePath1);
eventColumns = queueCredits(DISSOLVE_DURATION + 7000, CREDIT_DURATION1, n_credits2, creditsFairePath2);
// End scene after credit display
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = 1000;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
int Scene::SC_ITEIntroFaireTentProc(int param, void *refCon) {
return ((Scene *)refCon)->ITEIntroFaireTentProc(param);
}
// Handles fourth intro credit screen (treehouse view)
int Scene::ITEIntroFaireTentProc(int param) {
Event event;
EventColumns *eventColumns;
switch (param) {
case SCENE_BEGIN:
// Start 'dissolve' transition to new scene background
event.type = kEvTContinuous;
event.code = kTransitionEvent;
event.op = kEventDissolve;
event.time = 0;
event.duration = DISSOLVE_DURATION;
eventColumns = _vm->_events->queue(event);
// End scene after momentary pause
event.type = kEvTOneshot;
event.code = kSceneEvent;
event.op = kEventEnd;
event.time = 5000;
_vm->_events->chain(eventColumns, event);
break;
case SCENE_END:
break;
default:
warning("Illegal scene procedure parameter");
break;
}
return 0;
}
} // End of namespace Saga
|