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 "lastexpress/entities/rebecca.h"
24
25 #include "lastexpress/game/entities.h"
26 #include "lastexpress/game/inventory.h"
27 #include "lastexpress/game/logic.h"
28 #include "lastexpress/game/object.h"
29 #include "lastexpress/game/savepoint.h"
30 #include "lastexpress/game/scenes.h"
31 #include "lastexpress/game/state.h"
32
33 #include "lastexpress/sound/queue.h"
34
35 #include "lastexpress/lastexpress.h"
36
37 namespace LastExpress {
38
Rebecca(LastExpressEngine * engine)39 Rebecca::Rebecca(LastExpressEngine *engine) : Entity(engine, kEntityRebecca) {
40 ADD_CALLBACK_FUNCTION(Rebecca, reset);
41 ADD_CALLBACK_FUNCTION_I(Rebecca, updateFromTime);
42 ADD_CALLBACK_FUNCTION_S(Rebecca, playSound);
43 ADD_CALLBACK_FUNCTION_S(Rebecca, playSound16);
44 ADD_CALLBACK_FUNCTION_SIIS(Rebecca, callSavepoint);
45 ADD_CALLBACK_FUNCTION_S(Rebecca, draw);
46 ADD_CALLBACK_FUNCTION_SI(Rebecca, enterExitCompartment);
47 ADD_CALLBACK_FUNCTION_SI(Rebecca, enterExitCompartment2);
48 ADD_CALLBACK_FUNCTION_SI(Rebecca, enterExitCompartment3);
49 ADD_CALLBACK_FUNCTION(Rebecca, callbackActionOnDirection);
50 ADD_CALLBACK_FUNCTION(Rebecca, callbackActionRestaurantOrSalon);
51 ADD_CALLBACK_FUNCTION_II(Rebecca, updateEntity);
52 ADD_CALLBACK_FUNCTION_SII(Rebecca, updatePosition);
53 ADD_CALLBACK_FUNCTION_SSI(Rebecca, draw2);
54 ADD_CALLBACK_FUNCTION(Rebecca, function15);
55 ADD_CALLBACK_FUNCTION_I(Rebecca, function16);
56 ADD_CALLBACK_FUNCTION_I(Rebecca, function17);
57 ADD_CALLBACK_FUNCTION(Rebecca, function18);
58 ADD_CALLBACK_FUNCTION(Rebecca, function19);
59 ADD_CALLBACK_FUNCTION_I(Rebecca, function20);
60 ADD_CALLBACK_FUNCTION(Rebecca, chapter1);
61 ADD_CALLBACK_FUNCTION(Rebecca, chapter1Handler);
62 ADD_CALLBACK_FUNCTION(Rebecca, function23);
63 ADD_CALLBACK_FUNCTION(Rebecca, function24);
64 ADD_CALLBACK_FUNCTION(Rebecca, function25);
65 ADD_CALLBACK_FUNCTION(Rebecca, function26);
66 ADD_CALLBACK_FUNCTION(Rebecca, function27);
67 ADD_CALLBACK_FUNCTION(Rebecca, chapter2);
68 ADD_CALLBACK_FUNCTION(Rebecca, chapter2Handler);
69 ADD_CALLBACK_FUNCTION(Rebecca, function30);
70 ADD_CALLBACK_FUNCTION(Rebecca, function31);
71 ADD_CALLBACK_FUNCTION(Rebecca, chapter3);
72 ADD_CALLBACK_FUNCTION(Rebecca, chapter3Handler);
73 ADD_CALLBACK_FUNCTION(Rebecca, function34);
74 ADD_CALLBACK_FUNCTION(Rebecca, function35);
75 ADD_CALLBACK_FUNCTION(Rebecca, function36);
76 ADD_CALLBACK_FUNCTION(Rebecca, function37);
77 ADD_CALLBACK_FUNCTION(Rebecca, function38);
78 ADD_CALLBACK_FUNCTION(Rebecca, function39);
79 ADD_CALLBACK_FUNCTION(Rebecca, function40);
80 ADD_CALLBACK_FUNCTION(Rebecca, function41);
81 ADD_CALLBACK_FUNCTION(Rebecca, chapter4);
82 ADD_CALLBACK_FUNCTION(Rebecca, chapter4Handler);
83 ADD_CALLBACK_FUNCTION(Rebecca, function44);
84 ADD_CALLBACK_FUNCTION(Rebecca, function45);
85 ADD_CALLBACK_FUNCTION(Rebecca, chapter5);
86 ADD_CALLBACK_FUNCTION(Rebecca, chapter5Handler);
87 ADD_CALLBACK_FUNCTION(Rebecca, function48);
88 ADD_NULL_FUNCTION();
89 }
90
91 //////////////////////////////////////////////////////////////////////////
92 IMPLEMENT_FUNCTION(1, Rebecca, reset)
93 Entity::reset(savepoint);
94 IMPLEMENT_FUNCTION_END
95
96 //////////////////////////////////////////////////////////////////////////
97 IMPLEMENT_FUNCTION_I(2, Rebecca, updateFromTime, uint32)
98 Entity::updateFromTime(savepoint);
99 IMPLEMENT_FUNCTION_END
100
101 //////////////////////////////////////////////////////////////////////////
102 IMPLEMENT_FUNCTION_S(3, Rebecca, playSound)
103 Entity::playSound(savepoint);
104 IMPLEMENT_FUNCTION_END
105
106 //////////////////////////////////////////////////////////////////////////
107 IMPLEMENT_FUNCTION_S(4, Rebecca, playSound16)
108 Entity::playSound(savepoint, false, getSound()->getSoundFlag(kEntityCoudert));
109 IMPLEMENT_FUNCTION_END
110
111 //////////////////////////////////////////////////////////////////////////
112 IMPLEMENT_FUNCTION_SIIS(5, Rebecca, callSavepoint, EntityIndex, ActionIndex)
113 Entity::callSavepoint(savepoint);
114 IMPLEMENT_FUNCTION_END
115
116 //////////////////////////////////////////////////////////////////////////
117 IMPLEMENT_FUNCTION_S(6, Rebecca, draw)
118 Entity::draw(savepoint);
119 IMPLEMENT_FUNCTION_END
120
121 //////////////////////////////////////////////////////////////////////////
122 IMPLEMENT_FUNCTION_SI(7, Rebecca, enterExitCompartment, ObjectIndex)
123 Entity::enterExitCompartment(savepoint);
124 IMPLEMENT_FUNCTION_END
125
126 //////////////////////////////////////////////////////////////////////////
127 IMPLEMENT_FUNCTION_SI(8, Rebecca, enterExitCompartment2, ObjectIndex)
128 Entity::enterExitCompartment(savepoint, kPosition_4840, kPosition_4455, kCarRedSleeping, kObjectCompartmentE, true);
129 IMPLEMENT_FUNCTION_END
130
131 //////////////////////////////////////////////////////////////////////////
132 IMPLEMENT_FUNCTION_SI(9, Rebecca, enterExitCompartment3, ObjectIndex)
133 if (savepoint.action == kAction4) {
134 getEntities()->exitCompartment(_entityIndex, (ObjectIndex)params->param4);
135 callbackAction();
136 return;
137 }
138 Entity::enterExitCompartment(savepoint);
139 IMPLEMENT_FUNCTION_END
140
141 //////////////////////////////////////////////////////////////////////////
142 IMPLEMENT_FUNCTION(10, Rebecca, callbackActionOnDirection)
143 Entity::callbackActionOnDirection(savepoint);
144 IMPLEMENT_FUNCTION_END
145
146 //////////////////////////////////////////////////////////////////////////
147 IMPLEMENT_FUNCTION(11, Rebecca, callbackActionRestaurantOrSalon)
148 Entity::callbackActionRestaurantOrSalon(savepoint);
149 IMPLEMENT_FUNCTION_END
150
151 //////////////////////////////////////////////////////////////////////////
152 IMPLEMENT_FUNCTION_II(12, Rebecca, updateEntity, CarIndex, EntityPosition)
153 Entity::updateEntity(savepoint, true);
154 IMPLEMENT_FUNCTION_END
155
156 //////////////////////////////////////////////////////////////////////////
157 IMPLEMENT_FUNCTION_SII(13, Rebecca, updatePosition, CarIndex, Position)
158 Entity::updatePosition(savepoint);
159 IMPLEMENT_FUNCTION_END
160
161 //////////////////////////////////////////////////////////////////////////
162 IMPLEMENT_FUNCTION_SSI(14, Rebecca, draw2, EntityIndex)
163 Entity::draw2(savepoint);
164 IMPLEMENT_FUNCTION_END
165
166 //////////////////////////////////////////////////////////////////////////
167 IMPLEMENT_FUNCTION(15, Rebecca, function15)
168 switch (savepoint.action) {
169 default:
170 break;
171
172 case kActionDefault:
173 if (getEntities()->isOutsideAnnaWindow())
174 getScenes()->loadSceneFromPosition(kCarRedSleeping, 49);
175
176 setCallback(1);
177 setup_enterExitCompartment2("624Ae", kObjectCompartmentE);
178 break;
179
180 case kActionCallback:
181 if (getCallback() == 1) {
182 getObjects()->update(kObjectOutsideBetweenCompartments, kEntityPlayer, kObjectLocationNone, kCursorKeepValue, kCursorKeepValue);
183 getData()->location = kLocationInsideCompartment;
184 getEntities()->clearSequences(kEntityRebecca);
185
186 callbackAction();
187 }
188 break;
189 }
190 IMPLEMENT_FUNCTION_END
191
192 //////////////////////////////////////////////////////////////////////////
193 IMPLEMENT_FUNCTION_I(16, Rebecca, function16, bool)
194 switch (savepoint.action) {
195 default:
196 break;
197
198 case kActionNone:
199 if (!params->param2) {
200 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)) {
201 if (!getEntities()->hasValidFrame(kEntitySophie)) {
202 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
203
204 setCallback(3);
205 setup_callbackActionRestaurantOrSalon();
206 }
207 }
208 }
209 break;
210
211 case kActionDefault:
212 setCallback(1);
213 setup_enterExitCompartment(params->param1 ? "624Be" : "623Ee", kObjectCompartmentE);
214 break;
215
216 case kActionCallback:
217 switch (getCallback()) {
218 default:
219 break;
220
221 case 1:
222 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
223 getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
224 getData()->location = kLocationOutsideCompartment;
225 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction125242096);
226
227 setCallback(2);
228 setup_updateEntity(kCarRestaurant, kPosition_850);
229 break;
230
231 case 2:
232 getEntities()->clearSequences(kEntityRebecca);
233 break;
234
235 case 3:
236 getData()->entityPosition = kPosition_1540;
237 getData()->location = kLocationOutsideCompartment;
238
239 setCallback(4);
240 setup_draw("810US");
241 break;
242
243 case 4:
244 getEntities()->drawSequenceRight(kEntityRebecca, "012B");
245 if (getEntities()->isInSalon(kEntityPlayer))
246 getEntities()->updateFrame(kEntityRebecca);
247
248 setCallback(5);
249 setup_callbackActionOnDirection();
250 break;
251
252 case 5:
253 getEntities()->drawSequenceLeft(kEntityRebecca, "012A");
254 if (getProgress().chapter == kChapter3)
255 getSound()->playSound(kEntityRebecca, "REB3000");
256
257 getSavePoints()->push(kEntityRebecca, kEntityPascale, kAction269479296);
258
259 params->param2 = 1;
260 break;
261 }
262 break;
263
264 case kAction157370960:
265 getSavePoints()->push(kEntityRebecca, kEntityTables3, kAction136455232);
266 getData()->location = kLocationInsideCompartment;
267
268 callbackAction();
269 break;
270 }
271 IMPLEMENT_FUNCTION_END
272
273 //////////////////////////////////////////////////////////////////////////
274 IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool)
275 switch (savepoint.action) {
276 default:
277 break;
278
279 case kActionNone:
280 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)
281 && !getEntities()->hasValidFrame(kEntitySophie)) {
282 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
283
284 setCallback(3);
285 setup_updateFromTime(0);
286 }
287 break;
288
289 case kActionDefault:
290 setCallback(1);
291 setup_enterExitCompartment("624Be", kObjectCompartmentE);
292 break;
293
294 case kActionCallback:
295 switch (getCallback()) {
296 default:
297 break;
298
299 case 1:
300 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
301 getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
302
303 getData()->location = kLocationOutsideCompartment;
304
305 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction125242096);
306
307 setCallback(2);
308 setup_updateEntity(kCarRestaurant, kPosition_850);
309 break;
310
311 case 2:
312 getEntities()->clearSequences(kEntityRebecca);
313 break;
314
315 case 3:
316 setCallback(4);
317 setup_callbackActionRestaurantOrSalon();
318 break;
319
320 case 4:
321 getData()->entityPosition = kPosition_1540;
322 getData()->location = kLocationOutsideCompartment;
323
324 if (getProgress().chapter == kChapter3)
325 getSound()->playSound(kEntityRebecca, "Reb3005", kSoundVolumeEntityDefault, 75);
326
327 if (params->param1) {
328 setCallback(5);
329 setup_updatePosition("118A", kCarRestaurant, 52);
330 } else {
331 getEntities()->updatePositionEnter(kEntityRebecca, kCarRestaurant, 57);
332
333 setCallback(6);
334 setup_draw2("107A1", "107A2", kEntitySophie);
335 }
336 break;
337
338 case 5:
339 getData()->location = kLocationInsideCompartment;
340
341 callbackAction();
342 break;
343
344 case 6:
345 getEntities()->updatePositionExit(kEntityRebecca, kCarRestaurant, 57);
346 getEntities()->clearSequences(kEntitySophie);
347
348 getData()->location = kLocationInsideCompartment;
349
350 callbackAction();
351 break;
352 }
353 break;
354 }
355 IMPLEMENT_FUNCTION_END
356
357 //////////////////////////////////////////////////////////////////////////
358 IMPLEMENT_FUNCTION(18, Rebecca, function18)
359 switch (savepoint.action) {
360 default:
361 break;
362
363 case kActionNone:
364 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)
365 || getEntities()->checkDistanceFromPosition(kEntitySophie, kPosition_4840, 500)) {
366 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
367 getEntities()->exitCompartment(kEntityRebecca, kObjectCompartmentE, true);
368
369 setCallback(3);
370 setup_function15();
371 }
372 break;
373
374 case kActionDefault:
375 getData()->car = kCarRedSleeping;
376 getData()->entityPosition = kPosition_9270;
377 getData()->location = kLocationOutsideCompartment;
378 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction136654208);
379
380 setCallback(1);
381 setup_updateEntity(kCarRedSleeping, kPosition_4840);
382 break;
383
384 case kActionCallback:
385 switch (getCallback()) {
386 default:
387 break;
388
389 case 1:
390 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)
391 || getEntities()->checkDistanceFromPosition(kEntitySophie, kPosition_4840, 500)) {
392 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
393
394 setCallback(2);
395 setup_function15();
396 } else {
397 getEntities()->drawSequenceLeft(kEntityRebecca, "623Ge");
398 getEntities()->enterCompartment(kEntityRebecca, kObjectCompartmentE, true);
399 }
400 break;
401
402 case 2:
403 case 3:
404 callbackAction();
405 break;
406 }
407 break;
408 }
409 IMPLEMENT_FUNCTION_END
410
411 //////////////////////////////////////////////////////////////////////////
412 IMPLEMENT_FUNCTION(19, Rebecca, function19)
413 switch (savepoint.action) {
414 default:
415 break;
416
417 case kActionNone:
418 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)
419 || getEntities()->checkDistanceFromPosition(kEntitySophie, kPosition_4840, 500)) {
420 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
421 getEntities()->exitCompartment(kEntityRebecca, kObjectCompartmentE, true);
422
423 setCallback(6);
424 setup_function15();
425 }
426 break;
427
428 case kActionDefault:
429 setCallback(1);
430 setup_callbackActionRestaurantOrSalon();
431 break;
432
433 case kActionCallback:
434 switch (getCallback()) {
435 default:
436 break;
437
438 case 1:
439 getData()->location = kLocationOutsideCompartment;
440
441 setCallback(2);
442 setup_callSavepoint("012H", kEntityTables3, kActionDrawTablesWithChairs, "010M");
443 break;
444
445 case 2:
446 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction337548856);
447 getEntities()->drawSequenceRight(kEntityRebecca, "810DS");
448 if (getEntities()->isInRestaurant(kEntityPlayer))
449 getEntities()->updateFrame(kEntityRebecca);
450
451 setCallback(3);
452 setup_callbackActionOnDirection();
453 break;
454
455 case 3:
456 getData()->car = kCarRedSleeping;
457 getData()->entityPosition = kPosition_9270;
458 getData()->location = kLocationOutsideCompartment;
459 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction136654208);
460
461 setCallback(4);
462 setup_updateEntity(kCarRedSleeping, kPosition_4840);
463 break;
464
465 case 4:
466 if (getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntitySophie, 750)
467 || getEntities()->checkDistanceFromPosition(kEntitySophie, kPosition_4840, 500)) {
468 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
469
470 setCallback(5);
471 setup_function15();
472 } else {
473 getEntities()->drawSequenceLeft(kEntityRebecca, "623Ge");
474 getEntities()->enterCompartment(kEntityRebecca, kObjectCompartmentE, true);
475 }
476 break;
477
478 case 5:
479 case 6:
480 callbackAction();
481 break;
482 }
483 break;
484 }
485 IMPLEMENT_FUNCTION_END
486
487 //////////////////////////////////////////////////////////////////////////
488 IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue)
489 switch (savepoint.action) {
490 default:
491 break;
492
493 case kActionNone:
494 if (params->param1 < getState()->time && !params->param5) {
495 params->param5 = 1;
496
497 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
498 getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
499
500 callbackAction();
501 break;
502 }
503
504 if (!params->param2) {
505 params->param6 = 0;
506 } else {
507 if (Entity::updateParameter(params->param6, getState()->timeTicks, 75)) {
508 params->param2 = 0;
509 params->param3 = 1;
510 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
511 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
512
513 params->param6 = 0;
514 }
515 }
516
517 if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) {
518 if (params->param7 != kTimeInvalid && getState()->time > kTime1174500) {
519 if (getState()->time <= kTime1183500) {
520 if (!getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntityPlayer, 2000) || getSoundQueue()->isBuffered("CON1210") || !params->param7)
521 params->param7 = (uint)(getState()->time);
522
523 if (params->param7 >= getState()->time)
524 goto label_callback;
525 }
526
527 params->param7 = kTimeInvalid;
528 ENTITY_PARAM(0, 3) = 1;
529
530 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
531 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
532
533 setCallback(1);
534 setup_playSound("REB1205");
535 break;
536 }
537 goto label_callback;
538 }
539
540 if (getProgress().chapter == kChapter3 && !ENTITY_PARAM(0, 4) && params->param8 != kTimeInvalid && getState()->time > kTime2097000) {
541 if (getState()->time <= kTime2106000) {
542 if (!getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntityPlayer, 1000) || !params->param8)
543 params->param8 = (uint)getState()->time;
544
545 if (params->param8 >= getState()->time)
546 goto label_callback;
547 }
548
549 params->param8 = kTimeInvalid;
550 ENTITY_PARAM(0, 4) = 1;
551
552 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
553 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
554
555 setCallback(2);
556 setup_playSound("REB3010");
557 break;
558 }
559
560 label_callback:
561 if (ENTITY_PARAM(0, 2) && getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntityPlayer, 1000)) {
562 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
563 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
564
565 setCallback(3);
566 setup_playSound("REB1040");
567 }
568 break;
569
570 case kActionKnock:
571 case kActionOpenDoor:
572 if (params->param2) {
573 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
574 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
575 if (savepoint.param.intValue == kObject52) {
576 setCallback(8);
577 setup_playSound(getSound()->justAMinuteCath());
578 } else if (getInventory()->hasItem(kItemPassengerList)) {
579 if (rnd(2)) {
580 setCallback(9);
581 setup_playSound(getSound()->wrongDoorCath());
582 } else {
583 setCallback(10);
584 setup_playSound(params->param4 ? "CAT1509" : (rnd(2) ? "CAT1508" : "CAT1508A"));
585 }
586 } else {
587 setCallback(11);
588 setup_playSound(getSound()->wrongDoorCath());
589 }
590 } else {
591 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
592 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
593 setCallback(savepoint.action == kActionKnock ? 4 : 5);
594 setup_playSound(savepoint.action == kActionKnock ? "LIB012" : "LIB013");
595 }
596 break;
597
598 case kActionDefault:
599 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
600 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
601
602 break;
603
604 case kActionDrawScene:
605 if (params->param3 || params->param2) {
606 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
607 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
608
609 params->param2 = 0;
610 params->param3 = 0;
611 }
612 break;
613
614 case kActionCallback:
615 switch (getCallback()) {
616 default:
617 break;
618
619 case 1:
620 case 2:
621 case 3:
622 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
623 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
624
625 if (getCallback() != 2)
626 ENTITY_PARAM(0, 2) = 0;
627
628 if (getCallback() != 3)
629 goto label_callback;
630 break;
631
632 case 4:
633 case 5:
634 if (rnd(2)) {
635 setCallback(6);
636 setup_playSound("REB1039");
637 } else {
638 setCallback(7);
639 setup_playSound(rnd(2) ? "SOP1039" : "SOP1039A");
640 }
641 break;
642
643 case 6:
644 case 7:
645 params->param4 = (getCallback() == 6 ? 0 : 1);
646 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorTalk, kCursorNormal);
647 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorTalk, kCursorNormal);
648 params->param2 = 1;
649 break;
650
651 case 8:
652 case 9:
653 case 10:
654 case 11:
655 params->param2 = 0;
656 params->param3 = 1;
657 break;
658
659 case 12:
660 setCallback(13);
661 setup_playSound16("JAC1012B");
662 break;
663
664 case 13:
665 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
666 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
667 break;
668 }
669 break;
670
671 case kAction254915200:
672 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
673 getObjects()->update(kObject52, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
674
675 setCallback(12);
676 setup_playSound("REB1039A");
677 break;
678 }
679 IMPLEMENT_FUNCTION_END
680
681 //////////////////////////////////////////////////////////////////////////
682 IMPLEMENT_FUNCTION(21, Rebecca, chapter1)
683 switch (savepoint.action) {
684 default:
685 break;
686
687 case kActionNone:
688 Entity::timeCheck(kTimeChapter1, params->param1, WRAP_SETUP_FUNCTION(Rebecca, setup_chapter1Handler));
689 break;
690
691 case kActionDefault:
692 getSavePoints()->addData(kEntityRebecca, kAction224253538, 0);
693
694 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
695 getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
696 getObjects()->update(kObjectOutsideBetweenCompartments, kEntityPlayer, kObjectLocationNone, kCursorKeepValue, kCursorKeepValue);
697
698 getObjects()->updateModel(kObject110, kObjectModel1);
699
700 getData()->entityPosition = kPosition_2830;
701 getData()->location = kLocationInsideCompartment;
702 getData()->car = kCarRestaurant;
703
704 ENTITY_PARAM(0, 2) = 1;
705 break;
706 }
707 IMPLEMENT_FUNCTION_END
708
709 //////////////////////////////////////////////////////////////////////////
710 IMPLEMENT_FUNCTION(22, Rebecca, chapter1Handler)
711 switch (savepoint.action) {
712 default:
713 break;
714
715 case kActionNone:
716 if (Entity::timeCheckCallback(kTime1084500, params->param3, 1, "REB1015", WRAP_SETUP_FUNCTION_S(Rebecca, setup_playSound)))
717 break;
718
719 if (params->param4 == kTimeInvalid)
720 goto label_callback_4;
721
722 if (getState()->time > kTime1080000)
723 goto label_playConversation;
724
725 if (!getEntities()->isInSalon(kEntityPlayer) || !params->param4)
726 params->param4 = (uint)(getState()->time + 150);
727
728 if (params->param4 >= getState()->time) {
729 label_callback_4:
730 if (params->param1) {
731 if (Entity::updateParameterCheck(params->param5, getState()->time, 900)) {
732 if (getEntities()->isInSalon(kEntityPlayer)) {
733 setCallback(5);
734 setup_playSound("REB1013");
735 break;
736 }
737 }
738 }
739
740 label_callback_5:
741 if (params->param2) {
742 if (!Entity::updateParameter(params->param6, getState()->timeTicks, 90))
743 break;
744
745 getScenes()->loadSceneFromPosition(kCarRestaurant, 55);
746 } else {
747 params->param6 = 0;
748 }
749 } else {
750 label_playConversation:
751 params->param4 = kTimeInvalid;
752
753 if (getEntities()->isInSalon(kEntityPlayer))
754 getProgress().field_B8 = 1;
755
756 setCallback(4);
757 setup_playSound("REB1012");
758 }
759 break;
760
761 case kActionDefault:
762 getEntities()->drawSequenceLeft(kEntityRebecca, "107B");
763 break;
764
765 case kActionDrawScene:
766 params->param2 = (getEntities()->isPlayerPosition(kCarRestaurant, 57) ? 1 : 0);
767 break;
768
769 case kActionCallback:
770 switch (getCallback()) {
771 default:
772 break;
773
774 case 1:
775 setCallback(2);
776 setup_updatePosition("107C", kCarRestaurant, 57);
777 break;
778
779 case 2:
780 setCallback(3);
781 setup_function18();
782 break;
783
784 case 3:
785 setup_function23();
786 break;
787
788 case 4:
789 params->param1 = 1;
790 goto label_callback_4;
791
792 case 5:
793 getProgress().field_B4 = 1;
794 params->param1 = 0;
795 goto label_callback_5;
796 }
797 break;
798 }
799 IMPLEMENT_FUNCTION_END
800
801 //////////////////////////////////////////////////////////////////////////
802 IMPLEMENT_FUNCTION(23, Rebecca, function23)
803 switch (savepoint.action) {
804 default:
805 break;
806
807 case kActionNone:
808 if (getState()->time > kTime1111500 && !params->param2) {
809 params->param2 = 1;
810 setCallback(3);
811 setup_enterExitCompartment("623De", kObjectCompartmentE);
812
813 break;
814 }
815 break;
816
817 case kActionDefault:
818 setCallback(1);
819 setup_updateFromTime(900);
820 break;
821
822 case kActionCallback:
823 switch (getCallback()) {
824 default:
825 break;
826
827 case 1:
828 setCallback(2);
829 setup_enterExitCompartment("623Ce", kObjectCompartmentE);
830 break;
831
832 case 2:
833 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocation2, kCursorNormal, kCursorNormal);
834 getEntities()->drawSequenceLeft(kEntityRebecca, "504");
835 break;
836
837 case 3:
838 case 6:
839 getEntities()->clearSequences(kEntityRebecca);
840 getData()->entityPosition = kPosition_4840;
841 getData()->location = kLocationInsideCompartment;
842
843 setCallback((byte)(getCallback() + 1));
844 setup_function20(kTime1120500);
845 break;
846
847 case 4:
848 case 5:
849 if (ENTITY_PARAM(0, 1)) {
850 setup_function24();
851 } else {
852 setCallback(5);
853 setup_function20((TimeValue)(getState()->time + 900));
854 }
855 break;
856
857 case 7:
858 case 8:
859 if (ENTITY_PARAM(0, 1)) {
860 setup_function24();
861 } else {
862 setCallback(8);
863 setup_function20((TimeValue)(getState()->time + 900));
864 }
865 break;
866 }
867 break;
868
869 case kAction285528346:
870 setCallback(6);
871 setup_enterExitCompartment("623De", kObjectCompartmentE);
872 break;
873 }
874 IMPLEMENT_FUNCTION_END
875
876 //////////////////////////////////////////////////////////////////////////
877 IMPLEMENT_FUNCTION(24, Rebecca, function24)
878 switch (savepoint.action) {
879 default:
880 break;
881
882 case kActionNone:
883 Entity::timeCheckSavepoint(kTime1134000, params->param2, kEntityRebecca, kEntityWaiter1, kAction223712416);
884
885 if (!params->param1)
886 break;
887
888 if (Entity::timeCheckCallback(kTime1165500, params->param3, 6, WRAP_SETUP_FUNCTION(Rebecca, setup_function19)))
889 break;
890
891 if (params->param4 != kTimeInvalid) {
892 if (getState()->time <= kTime1161000) {
893 if (!getEntities()->isInRestaurant(kEntityPlayer) || !params->param4)
894 params->param4 = (uint)getState()->time + 150;
895
896 if (params->param4 >= getState()->time)
897 break;
898 }
899
900 params->param4 = kTimeInvalid;
901
902 setCallback(7);
903 setup_playSound("REB1200A");
904 }
905 break;
906
907 case kActionDefault:
908 setCallback(1);
909 setup_function16(true);
910 break;
911
912 case kActionCallback:
913 switch (getCallback()) {
914 default:
915 break;
916
917 case 1:
918 getEntities()->drawSequenceLeft(kEntityRebecca, "012D");
919
920 setCallback(2);
921 setup_playSound("REB1199");
922 break;
923
924 case 2:
925 if (getEntities()->isInRestaurant(kEntityPlayer)) {
926 setCallback(3);
927 setup_playSound("REB1199A");
928 break;
929 }
930 // fall through
931
932 case 3:
933 if (getCallback() == 3)
934 getProgress().field_BC = 1;
935
936 if (getEntities()->isInRestaurant(kEntityAnna)) {
937 setCallback(4);
938 setup_playSound("REB1199B");
939 break;
940 }
941 // fall through
942
943 case 4:
944 setCallback(5);
945 setup_playSound("REB1199C");
946 break;
947
948 case 6:
949 setup_function25();
950 break;
951
952 case 8:
953 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction136702400);
954 getEntities()->drawSequenceLeft(kEntityRebecca, "012G");
955 params->param1 = 1;
956 break;
957 }
958 break;
959
960 case kAction123712592:
961 getEntities()->drawSequenceLeft(kEntityWaiter1, "BLANK");
962 getEntities()->drawSequenceLeft(kEntityRebecca, "012E");
963
964 setCallback(8);
965 setup_playSound("REB1200");
966 break;
967 }
968 IMPLEMENT_FUNCTION_END
969
970 //////////////////////////////////////////////////////////////////////////
971 IMPLEMENT_FUNCTION(25, Rebecca, function25)
972 switch (savepoint.action) {
973 default:
974 break;
975
976 case kActionDefault:
977 setCallback(1);
978 setup_function20(kTime1184400);
979 break;
980
981 case kActionCallback:
982 switch (getCallback()) {
983 default:
984 break;
985
986 case 1:
987 setCallback(2);
988 setup_function17(true);
989 break;
990
991 case 2:
992 setup_function26();
993 break;
994 }
995 break;
996 }
997 IMPLEMENT_FUNCTION_END
998
999 //////////////////////////////////////////////////////////////////////////
1000 IMPLEMENT_FUNCTION(26, Rebecca, function26)
1001 switch (savepoint.action) {
1002 default:
1003 break;
1004
1005 case kActionNone:
1006 if (getState()->time > kTime1224000 && !params->param2) {
1007 params->param2 = 1;
1008 setCallback(1);
1009 setup_updatePosition("118H", kCarRestaurant, 52);
1010 break;
1011 }
1012
1013 if (params->param1) {
1014 if (!Entity::updateParameter(params->param3, getState()->timeTicks, 90))
1015 break;
1016
1017 getScenes()->loadSceneFromPosition(kCarRestaurant, 51);
1018 }
1019 break;
1020
1021 case kActionDefault:
1022 getEntities()->drawSequenceLeft(kEntityRebecca, "118D");
1023 break;
1024
1025 case kActionDrawScene:
1026 params->param1 = getEntities()->isPlayerPosition(kCarRestaurant, 52);
1027 params->param3 = 0;
1028 break;
1029
1030 case kActionCallback:
1031 switch (getCallback()) {
1032 default:
1033 break;
1034
1035 case 1:
1036 setCallback(2);
1037 setup_function18();
1038 break;
1039
1040 case 2:
1041 setup_function27();
1042 break;
1043 }
1044 break;
1045 }
1046 IMPLEMENT_FUNCTION_END
1047
1048 //////////////////////////////////////////////////////////////////////////
1049 IMPLEMENT_FUNCTION(27, Rebecca, function27)
1050 if (savepoint.action == kActionDefault) {
1051 getData()->entityPosition = kPosition_4840;
1052 getData()->location = kLocationInsideCompartment;
1053 getData()->car = kCarRedSleeping;
1054
1055 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1056 getObjects()->update(kObject52, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1057
1058 getEntities()->clearSequences(kEntityRebecca);
1059 }
1060 IMPLEMENT_FUNCTION_END
1061
1062 //////////////////////////////////////////////////////////////////////////
1063 IMPLEMENT_FUNCTION(28, Rebecca, chapter2)
1064 switch (savepoint.action) {
1065 default:
1066 break;
1067
1068 case kActionNone:
1069 setup_chapter2Handler();
1070 break;
1071
1072 case kActionDefault:
1073 getEntities()->clearSequences(kEntityRebecca);
1074
1075 getData()->entityPosition = kPosition_4840;
1076 getData()->location = kLocationInsideCompartment;
1077 getData()->car = kCarRedSleeping;
1078 getData()->clothes = kClothesDefault;
1079 getData()->inventoryItem = kItemNone;
1080
1081 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1082 getObjects()->update(kObject52, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1083
1084 getObjects()->updateModel(kObject110, kObjectModel2);
1085
1086 ENTITY_PARAM(0, 2) = 1;
1087 break;
1088 }
1089 IMPLEMENT_FUNCTION_END
1090
1091 //////////////////////////////////////////////////////////////////////////
1092 IMPLEMENT_FUNCTION(29, Rebecca, chapter2Handler)
1093 switch (savepoint.action) {
1094 default:
1095 break;
1096
1097 case kActionDefault:
1098 setCallback(1);
1099 setup_function20(kTime1764000);
1100 break;
1101
1102 case kActionCallback:
1103 switch (getCallback()) {
1104 default:
1105 break;
1106
1107 case 1:
1108 setCallback(2);
1109 setup_function17(false);
1110 break;
1111
1112 case 2:
1113 setup_function30();
1114 break;
1115 }
1116 break;
1117 }
1118 IMPLEMENT_FUNCTION_END
1119
1120 //////////////////////////////////////////////////////////////////////////
1121 IMPLEMENT_FUNCTION(30, Rebecca, function30)
1122 switch (savepoint.action) {
1123 default:
1124 break;
1125
1126 case kActionNone:
1127 if (!params->param1 && params->param4 != kTimeInvalid) {
1128
1129 if (getState()->time <= kTimeEnd)
1130 if (!getEntities()->isInSalon(kEntityPlayer) || !params->param4)
1131 params->param4 = (uint)getState()->time + 450;
1132
1133 if (params->param4 < getState()->time || getState()->time > kTimeEnd) {
1134 params->param4 = kTimeInvalid;
1135
1136 getSound()->playSound(kEntityRebecca, "Reb2001");
1137 getProgress().field_B0 = 1;
1138 params->param2 = 1;
1139 }
1140 }
1141
1142 if (params->param3 && !params->param2 && params->param5 != kTimeInvalid) {
1143
1144 if (getState()->time <= kTime10881000) {
1145 if (!getEntities()->isInSalon(kEntityPlayer) || !params->param5)
1146 params->param5 = (uint)getState()->time + 450;
1147
1148 if (params->param5 >= getState()->time)
1149 break;
1150 }
1151
1152 params->param5 = kTimeInvalid;
1153
1154 getSavePoints()->push(kEntityRebecca, kEntityAugust, kAction169358379);
1155 }
1156 break;
1157
1158 case kActionEndSound:
1159 params->param2 = 0;
1160 break;
1161
1162 case kActionDefault:
1163 getEntities()->drawSequenceLeft(kEntityRebecca, "107B");
1164 break;
1165
1166 case kActionCallback:
1167 if (getCallback() == 1)
1168 setup_function31();
1169 break;
1170
1171 case kAction125496184:
1172 setCallback(1);
1173 setup_function18();
1174 break;
1175
1176 case kAction155465152:
1177 getEntities()->drawSequenceLeft(kEntityRebecca, "BLANK");
1178 break;
1179
1180 case kAction155980128:
1181 params->param1 = 1;
1182 params->param3 = 1;
1183 break;
1184 }
1185 IMPLEMENT_FUNCTION_END
1186
1187 //////////////////////////////////////////////////////////////////////////
1188 IMPLEMENT_FUNCTION(31, Rebecca, function31)
1189 switch (savepoint.action) {
1190 default:
1191 break;
1192
1193 case kActionDefault:
1194 setCallback(1);
1195 setup_updateFromTime(900);
1196 break;
1197
1198 case kActionCallback:
1199 switch (getCallback()) {
1200 default:
1201 break;
1202
1203 case 1:
1204 setCallback(2);
1205 setup_enterExitCompartment("623CE", kObjectCompartmentE);
1206 break;
1207
1208 case 2:
1209 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocation2, kCursorNormal, kCursorNormal);
1210 getEntities()->drawSequenceLeft(kEntityRebecca, "504");
1211 break;
1212 }
1213 break;
1214 }
1215 IMPLEMENT_FUNCTION_END
1216
1217 //////////////////////////////////////////////////////////////////////////
1218 IMPLEMENT_FUNCTION(32, Rebecca, chapter3)
1219 switch (savepoint.action) {
1220 default:
1221 break;
1222
1223 case kActionNone:
1224 setup_chapter3Handler();
1225 break;
1226
1227 case kActionDefault:
1228 getEntities()->clearSequences(kEntityRebecca);
1229
1230 getData()->entityPosition = kPosition_4840;
1231 getData()->location = kLocationInsideCompartment;
1232 getData()->car = kCarRedSleeping;
1233 getData()->clothes = kClothesDefault;
1234 getData()->inventoryItem = kItemNone;
1235 break;
1236 }
1237 IMPLEMENT_FUNCTION_END
1238
1239 //////////////////////////////////////////////////////////////////////////
1240 IMPLEMENT_FUNCTION(33, Rebecca, chapter3Handler)
1241 switch (savepoint.action) {
1242 default:
1243 break;
1244
1245 case kActionDefault:
1246 setCallback(1);
1247 setup_function20(kTime2016000);
1248 break;
1249
1250 case kActionCallback:
1251 if (getCallback() == 1)
1252 setup_function34();
1253 break;
1254 }
1255 IMPLEMENT_FUNCTION_END
1256
1257 //////////////////////////////////////////////////////////////////////////
1258 IMPLEMENT_FUNCTION(34, Rebecca, function34)
1259 switch (savepoint.action) {
1260 default:
1261 break;
1262
1263 case kActionNone:
1264 if (params->param2 != kTimeInvalid) {
1265 if (getState()->time <= kTime1386000) {
1266 if (!getEntities()->isInRestaurant(kEntityPlayer) || !params->param2)
1267 params->param2 = (uint)getState()->time;
1268
1269 if (params->param2 >= getState()->time) {
1270 if (params->param1) {
1271 Entity::timeCheckCallback(kTime2052000, params->param3, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
1272 }
1273 break;
1274 }
1275 }
1276
1277 params->param2 = kTimeInvalid;
1278
1279 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction223712416);
1280 }
1281
1282 if (params->param1) {
1283 Entity::timeCheckCallback(kTime2052000, params->param3, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
1284 }
1285 break;
1286
1287 case kActionEndSound:
1288 setCallback(5);
1289 setup_playSound("Reb3004");
1290 break;
1291
1292 case kActionDefault:
1293 getData()->location = kLocationOutsideCompartment;
1294
1295 setCallback(1);
1296 setup_function16(true);
1297 break;
1298
1299 case kActionCallback:
1300 switch (getCallback()) {
1301 default:
1302 break;
1303
1304 case 1:
1305 getEntities()->drawSequenceLeft(kEntityRebecca, "012D");
1306 getData()->location = kLocationInsideCompartment;
1307
1308 setCallback(2);
1309 setup_playSound("Reb3002");
1310 break;
1311
1312 case 3:
1313 setup_function35();
1314 break;
1315
1316 case 4:
1317 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction136702400);
1318 getEntities()->drawSequenceLeft(kEntityRebecca, "012G");
1319 params->param1 = 1;
1320 break;
1321 }
1322 break;
1323
1324 case kAction123712592:
1325 getEntities()->drawSequenceLeft(kEntityWaiter1, "BLANK");
1326 getSound()->playSound(kEntityRebecca, "Reb3003");
1327
1328 setCallback(4);
1329 setup_draw("012E");
1330 break;
1331 }
1332 IMPLEMENT_FUNCTION_END
1333
1334 //////////////////////////////////////////////////////////////////////////
1335 IMPLEMENT_FUNCTION(35, Rebecca, function35)
1336 switch (savepoint.action) {
1337 default:
1338 break;
1339
1340 case kActionDefault:
1341 setCallback(1);
1342 setup_function20(kTime2070000);
1343 break;
1344
1345 case kActionCallback:
1346 if (getCallback() == 1)
1347 setup_function36();
1348 break;
1349 }
1350 IMPLEMENT_FUNCTION_END
1351
1352 //////////////////////////////////////////////////////////////////////////
1353 IMPLEMENT_FUNCTION(36, Rebecca, function36)
1354 switch (savepoint.action) {
1355 default:
1356 break;
1357
1358 case kActionNone:
1359 if (!params->param2)
1360 params->param2 = (uint)getState()->time + 1800;
1361
1362 if (params->param4 != kTimeInvalid && params->param2 < getState()->time) {
1363
1364 if (getState()->time <= kTime2083500) {
1365 if (!getEntities()->isInSalon(kEntityPlayer) || !params->param4)
1366 params->param4 = (uint)getState()->time + 300;
1367 }
1368
1369 if (params->param4 < getState()->time || getState()->time > kTime2083500) {
1370 params->param4 = kTimeInvalid;
1371 getSound()->playSound(kEntityRebecca, "Reb3007");
1372
1373 setCallback(2);
1374 setup_updatePosition("118E", kCarRestaurant, 52);
1375 break;
1376 }
1377 }
1378
1379 // TODO rewrite using proper if/else blocks instead of goto
1380 label_callback_2:
1381 if (!params->param1)
1382 goto label_callback_3;
1383
1384 if (!params->param3)
1385 params->param3 = (uint)getState()->time + 9000;
1386
1387 if (params->param5 == kTimeInvalid || params->param3 >= getState()->time)
1388 goto label_callback_3;
1389
1390 if (getState()->time <= kTime2092500) {
1391 if (!getEntities()->isInSalon(kEntityPlayer) || !params->param5)
1392 params->param5 = (uint)getState()->time + 300;
1393
1394 if (params->param5 >= getState()->time) {
1395 label_callback_3:
1396 if (getState()->time > kTime2097000 && !params->param6) {
1397 params->param6 = 1;
1398 getData()->inventoryItem = kItemNone;
1399
1400 setCallback(4);
1401 setup_updatePosition("118H", kCarRestaurant, 52);
1402 }
1403 break;
1404 }
1405 }
1406
1407 params->param5 = kTimeInvalid;
1408
1409 getData()->inventoryItem = kItemNone;
1410 getSound()->playSound(kEntityRebecca, "Reb3008", kSoundVolumeEntityDefault, 60);
1411 getEntities()->updatePositionEnter(kEntityRebecca, kCarRestaurant, 52);
1412
1413 setCallback(3);
1414 setup_draw2("118G1", "118G2", kEntitySophie);
1415 break;
1416
1417 case kAction1:
1418 getData()->inventoryItem = kItemNone;
1419
1420 setCallback(6);
1421 setup_playSound("SOP3008");
1422 break;
1423
1424 case kActionDefault:
1425 setCallback(1);
1426 setup_function17(true);
1427 break;
1428
1429 case kActionCallback:
1430 switch (getCallback()) {
1431 default:
1432 break;
1433
1434 case 1:
1435 getEntities()->drawSequenceLeft(kEntityRebecca, "118D");
1436 break;
1437
1438 case 2:
1439 params->param1 = 1;
1440 getData()->inventoryItem = kItemInvalid;
1441 getEntities()->drawSequenceLeft(kEntityRebecca, "118F");
1442 goto label_callback_2;
1443
1444 case 3:
1445 getEntities()->clearSequences(kEntitySophie);
1446 getEntities()->updatePositionExit(kEntityRebecca, kCarRestaurant, 52);
1447 getEntities()->drawSequenceLeft(kEntityRebecca, "118D");
1448 goto label_callback_3;
1449
1450 case 4:
1451 setCallback(5);
1452 setup_function18();
1453 break;
1454
1455 case 5:
1456 setup_function37();
1457 break;
1458 }
1459 break;
1460 }
1461 IMPLEMENT_FUNCTION_END
1462
1463 //////////////////////////////////////////////////////////////////////////
1464 IMPLEMENT_FUNCTION(37, Rebecca, function37)
1465 switch (savepoint.action) {
1466 default:
1467 break;
1468
1469 case kActionDefault:
1470 setCallback(1);
1471 setup_function20(kTime2110500);
1472 break;
1473
1474 case kActionCallback:
1475 if (getCallback() == 1)
1476 setup_function38();
1477 break;
1478 }
1479 IMPLEMENT_FUNCTION_END
1480
1481 //////////////////////////////////////////////////////////////////////////
1482 IMPLEMENT_FUNCTION(38, Rebecca, function38)
1483 switch (savepoint.action) {
1484 default:
1485 break;
1486
1487 case kActionDefault:
1488 getData()->location = kLocationOutsideCompartment;
1489
1490 setCallback(1);
1491 setup_enterExitCompartment3("624Be", kObjectCompartmentE);
1492 break;
1493
1494 case kActionCallback:
1495 switch (getCallback()) {
1496 default:
1497 break;
1498
1499 case 1:
1500 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
1501 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction259921280);
1502
1503 setCallback(2);
1504 setup_updateEntity(kCarKronos, kPosition_9270);
1505 break;
1506
1507 case 2:
1508 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
1509 setup_function39();
1510 break;
1511 }
1512 break;
1513 }
1514 IMPLEMENT_FUNCTION_END
1515
1516 //////////////////////////////////////////////////////////////////////////
1517 IMPLEMENT_FUNCTION(39, Rebecca, function39)
1518 switch (savepoint.action) {
1519 default:
1520 break;
1521
1522 case kActionDefault:
1523 getEntities()->clearSequences(kEntityRebecca);
1524
1525 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
1526 getObjects()->update(kObject52, kEntityPlayer, kObjectLocationNone, kCursorHandKnock, kCursorHand);
1527
1528 getData()->entityPosition = kPosition_6000;
1529 getData()->location = kLocationInsideCompartment;
1530 getData()->car = kCarKronos;
1531 break;
1532
1533 case kAction191668032:
1534 setup_function40();
1535 break;
1536 }
1537 IMPLEMENT_FUNCTION_END
1538
1539 //////////////////////////////////////////////////////////////////////////
1540 IMPLEMENT_FUNCTION(40, Rebecca, function40)
1541 switch (savepoint.action) {
1542 default:
1543 break;
1544
1545 case kActionDefault:
1546 getData()->entityPosition = kPosition_9270;
1547 setCallback(1);
1548 setup_updateEntity(kCarGreenSleeping, kPosition_2740);
1549 break;
1550
1551 case kActionCallback:
1552 switch (getCallback()) {
1553 default:
1554 break;
1555
1556 case 1:
1557 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction292775040);
1558 setCallback(2);
1559 setup_updateEntity(kCarRedSleeping, kPosition_2740);
1560 break;
1561
1562 case 2:
1563 getSavePoints()->push(kEntityRebecca, kEntityAnna, kAction191668032);
1564 setCallback(3);
1565 setup_updateEntity(kCarRedSleeping, kPosition_4840);
1566 break;
1567
1568 case 3:
1569 getSavePoints()->push(kEntityRebecca, kEntitySophie, kAction123668192);
1570 setCallback(4);
1571 setup_function15();
1572 break;
1573
1574 case 4:
1575 setup_function41();
1576 break;
1577 }
1578 break;
1579 }
1580 IMPLEMENT_FUNCTION_END
1581
1582 //////////////////////////////////////////////////////////////////////////
1583 IMPLEMENT_FUNCTION(41, Rebecca, function41)
1584 if (savepoint.action == kActionDefault) {
1585 ENTITY_PARAM(0, 2) = 1;
1586
1587 setCallback(1);
1588 setup_function20(kTimeEnd);
1589 }
1590 IMPLEMENT_FUNCTION_END
1591
1592 //////////////////////////////////////////////////////////////////////////
1593 IMPLEMENT_FUNCTION(42, Rebecca, chapter4)
1594 switch (savepoint.action) {
1595 default:
1596 break;
1597
1598 case kActionNone:
1599 setup_chapter4Handler();
1600 break;
1601
1602 case kActionDefault:
1603 getEntities()->clearSequences(kEntityRebecca);
1604
1605 getData()->entityPosition = kPosition_4840;
1606 getData()->location = kLocationInsideCompartment;
1607 getData()->car = kCarRedSleeping;
1608 getData()->clothes = kClothesDefault;
1609 getData()->inventoryItem = kItemNone;
1610
1611 getObjects()->updateModel(kObject110, kObjectModel3);
1612
1613 ENTITY_PARAM(0, 1) = 0;
1614 ENTITY_PARAM(0, 2) = 1;
1615 break;
1616 }
1617 IMPLEMENT_FUNCTION_END
1618
1619 //////////////////////////////////////////////////////////////////////////
1620 IMPLEMENT_FUNCTION(43, Rebecca, chapter4Handler)
1621 switch (savepoint.action) {
1622 default:
1623 break;
1624
1625 case kActionDefault:
1626 setCallback(1);
1627 setup_function20(kTime2385000);
1628 break;
1629
1630 case kActionCallback:
1631 if (getCallback() == 1 || getCallback() == 2) {
1632 if (ENTITY_PARAM(0, 1)) {
1633 setup_function44();
1634 } else {
1635 setCallback(2);
1636 setup_function20((TimeValue)(getState()->time + 900));
1637 }
1638 }
1639 break;
1640 }
1641 IMPLEMENT_FUNCTION_END
1642
1643 //////////////////////////////////////////////////////////////////////////
1644 IMPLEMENT_FUNCTION(44, Rebecca, function44)
1645 switch (savepoint.action) {
1646 default:
1647 break;
1648
1649 case kActionNone:
1650 if (params->param3 != kTimeInvalid) {
1651 if (getState()->time <= kTime2412000) {
1652 if (!getEntities()->isInRestaurant(kEntityPlayer) || !params->param3)
1653 params->param3 = (uint)getState()->time;
1654
1655 if (params->param3 >= getState()->time)
1656 goto label_next;
1657 }
1658
1659 params->param3 = kTimeInvalid;
1660
1661 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction223712416);
1662 }
1663
1664 label_next:
1665 if (params->param1 && params->param4 != kTimeInvalid) {
1666 if (getState()->time <= kTime2430000) {
1667 if (!getEntities()->isInRestaurant(kEntityPlayer) || !params->param4)
1668 params->param4 = (uint)getState()->time + 150;
1669
1670 if (params->param4 >= getState()->time)
1671 goto label_callback_2;
1672 }
1673
1674 params->param4 = kTimeInvalid;
1675
1676 setCallback(2);
1677 setup_playSound("Reb4004");
1678 break;
1679 }
1680
1681 label_callback_2:
1682 if (params->param2)
1683 Entity::timeCheckCallback(kTime2443500, params->param5, 3, WRAP_SETUP_FUNCTION(Rebecca, setup_function19));
1684 break;
1685
1686 case kActionEndSound:
1687 if (getEntities()->isInRestaurant(kEntityPlayer)) {
1688 setCallback(5);
1689 setup_playSound("Reb4004");
1690 break;
1691 }
1692
1693 params->param1 = 1;
1694 break;
1695
1696 case kActionDefault:
1697 getData()->location = kLocationOutsideCompartment;
1698
1699 setCallback(1);
1700 setup_function16(true);
1701 break;
1702
1703 case kActionCallback:
1704 switch (getCallback()) {
1705 default:
1706 break;
1707
1708 case 1:
1709 getEntities()->drawSequenceLeft(kEntityRebecca, "012D");
1710 getData()->location = kLocationInsideCompartment;
1711 break;
1712
1713 case 2:
1714 goto label_callback_2;
1715
1716 case 3:
1717 setup_function45();
1718 break;
1719
1720 case 4:
1721 getSavePoints()->push(kEntityRebecca, kEntityWaiter1, kAction136702400);
1722 getEntities()->drawSequenceLeft(kEntityRebecca, "012G");
1723 params->param2 = 1;
1724 break;
1725 }
1726 break;
1727
1728 case kAction123712592:
1729 getEntities()->drawSequenceLeft(kEntityWaiter1, "BLANK");
1730 getSound()->playSound(kEntityRebecca, "Reb4003");
1731
1732 setCallback(4);
1733 setup_draw("012E");
1734 break;
1735 }
1736 IMPLEMENT_FUNCTION_END
1737
1738 //////////////////////////////////////////////////////////////////////////
1739 IMPLEMENT_FUNCTION(45, Rebecca, function45)
1740 switch (savepoint.action) {
1741 default:
1742 break;
1743
1744 case kActionDefault:
1745 getData()->entityPosition = kPosition_4840;
1746 getData()->location = kLocationInsideCompartment;
1747 getData()->car = kCarRedSleeping;
1748
1749 getObjects()->update(kObjectCompartmentE, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1750 getObjects()->update(kObject52, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand);
1751
1752 getEntities()->clearSequences(kEntityRebecca);
1753 break;
1754
1755 case kActionCallback:
1756 if (getCallback() == 1)
1757 params->param1 = 1;
1758 break;
1759
1760 case kAction205034665:
1761 if (!params->param1 && getState()->time < kTime2511000) {
1762 setCallback(1);
1763 setup_playSound("Reb6969");
1764 }
1765 break;
1766 }
1767 IMPLEMENT_FUNCTION_END
1768
1769 //////////////////////////////////////////////////////////////////////////
1770 IMPLEMENT_FUNCTION(46, Rebecca, chapter5)
1771 switch (savepoint.action) {
1772 default:
1773 break;
1774
1775 case kActionNone:
1776 setup_chapter5Handler();
1777 break;
1778
1779 case kActionDefault:
1780 getEntities()->clearSequences(kEntityRebecca);
1781
1782 getData()->entityPosition = kPosition_3969;
1783 getData()->location = kLocationInsideCompartment;
1784 getData()->car = kCarRestaurant;
1785 getData()->inventoryItem = kItemNone;
1786
1787 getObjects()->updateModel(kObject110, kObjectModel4);
1788 break;
1789 }
1790 IMPLEMENT_FUNCTION_END
1791
1792 //////////////////////////////////////////////////////////////////////////
1793 IMPLEMENT_FUNCTION(47, Rebecca, chapter5Handler)
1794 if (savepoint.action == kActionProceedChapter5)
1795 setup_function48();
1796 IMPLEMENT_FUNCTION_END
1797
1798 //////////////////////////////////////////////////////////////////////////
1799 IMPLEMENT_FUNCTION(48, Rebecca, function48)
1800 switch (savepoint.action) {
1801 default:
1802 break;
1803
1804 case kActionNone:
1805 if (params->param1) {
1806 if (!Entity::updateParameter(params->param3, getState()->timeTicks, 75))
1807 break;
1808
1809 params->param1 = 0;
1810 params->param2 = 1;
1811 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
1812 }
1813
1814 params->param3 = 0;
1815 break;
1816
1817 case kActionKnock:
1818 case kActionOpenDoor:
1819 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorNormal, kCursorNormal);
1820
1821 if (params->param1) {
1822 params->param2 = 1;
1823
1824 setCallback(2);
1825 setup_playSound(getSound()->justCheckingCath());
1826 } else {
1827 setCallback(savepoint.action == kActionKnock ? 3 : 4);
1828 setup_playSound(savepoint.action == kActionKnock ? "LIB012" : "LIB013");
1829 }
1830 break;
1831
1832 case kActionDefault:
1833 getData()->car = kCarRedSleeping;
1834
1835 setCallback(1);
1836 setup_enterExitCompartment("624AE", kObjectCompartmentE);
1837 break;
1838
1839 case kActionDrawScene:
1840 if (params->param1 || params->param2) {
1841 params->param1 = 0;
1842 params->param2 = 0;
1843
1844 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
1845 }
1846 break;
1847
1848 case kActionCallback:
1849 switch (getCallback()) {
1850 default:
1851 break;
1852
1853 case 1:
1854 getEntities()->clearSequences(kEntityRebecca);
1855 getData()->location = kLocationInsideCompartment;
1856 getData()->entityPosition = kPosition_4840;
1857 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
1858 break;
1859
1860 case 3:
1861 case 4:
1862 setCallback(5);
1863 setup_playSound("Reb5001");
1864 break;
1865
1866 case 5:
1867 params->param1 = 1;
1868 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorTalk, kCursorNormal);
1869 break;
1870 }
1871 break;
1872
1873 case kAction135800432:
1874 setup_nullfunction();
1875 break;
1876
1877 case kAction155604840:
1878 getObjects()->update(kObjectCompartmentE, kEntityRebecca, kObjectLocation1, kCursorHandKnock, kCursorHand);
1879 break;
1880 }
1881 IMPLEMENT_FUNCTION_END
1882
1883 //////////////////////////////////////////////////////////////////////////
1884 IMPLEMENT_NULL_FUNCTION(49, Rebecca)
1885
1886 } // End of namespace LastExpress
1887