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
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
|
/* 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.
*
* $URL$
* $Id$
*
*/
#ifndef PARALLACTION_H
#define PARALLACTION_H
#include "common/str.h"
#include "common/stack.h"
#include "common/array.h"
#include "common/savefile.h"
#include "engines/engine.h"
#include "parallaction/defs.h"
#include "parallaction/inventory.h"
#include "parallaction/parser.h"
#include "parallaction/objects.h"
#include "parallaction/disk.h"
#include "parallaction/walk.h"
extern OSystem *g_system;
namespace Parallaction {
enum {
kDebugDisk = 1 << 0,
kDebugWalk = 1 << 1,
kDebugParser = 1 << 2,
kDebugDialogue = 1 << 3,
kDebugGraphics = 1 << 4,
kDebugExec = 1 << 5,
kDebugInput = 1 << 6,
kDebugAudio = 1 << 7,
kDebugMenu = 1 << 8,
kDebugInventory = 1 << 9
};
enum {
GF_DEMO = 1 << 0,
GF_LANG_EN = 1 << 1,
GF_LANG_FR = 1 << 2,
GF_LANG_DE = 1 << 3,
GF_LANG_IT = 1 << 4,
GF_LANG_MULT = 1 << 5
};
// high values mean high priority
enum {
kPriority0 = 0,
kPriority1 = 1,
kPriority2 = 2,
kPriority3 = 3,
kPriority4 = 4,
kPriority5 = 5,
kPriority6 = 6,
kPriority7 = 7,
kPriority8 = 8,
kPriority9 = 9,
kPriority10 = 10,
kPriority11 = 11,
kPriority12 = 12,
kPriority13 = 13,
kPriority14 = 14,
kPriority15 = 15,
kPriority16 = 16,
kPriority17 = 17,
kPriority18 = 18,
kPriority19 = 19,
kPriority20 = 20,
kPriority21 = 21
};
enum {
kMouseNone = 0,
kMouseLeftUp = 1,
kMouseLeftDown = 2,
kMouseRightUp = 3,
kMouseRightDown = 4
};
enum EngineFlags {
kEngineQuit = (1 << 0),
kEnginePauseJobs = (1 << 1),
kEngineInventory = (1 << 2),
kEngineWalking = (1 << 3),
kEngineChangeLocation = (1 << 4),
kEngineBlockInput = (1 << 5),
kEngineDragging = (1 << 6),
kEngineTransformedDonna = (1 << 7),
// BRA specific
kEngineReturn = (1 << 10)
};
enum {
kEvNone = 0,
kEvEnterZone = 1,
kEvExitZone = 2,
kEvAction = 3,
kEvOpenInventory = 4,
kEvCloseInventory = 5,
kEvHoverInventory = 6,
kEvWalk = 7,
kEvQuitGame = 1000,
kEvSaveGame = 2000,
kEvLoadGame = 4000
};
enum {
kCursorArrow = -1
};
enum ParallactionGameType {
GType_Nippon = 1,
GType_BRA
};
struct PARALLACTIONGameDescription;
extern uint16 _mouseButtons;
extern char _password[8];
extern uint16 _score;
extern uint16 _language;
extern uint32 _engineFlags;
#define MAX_FORWARDS 50
extern char _slideText[][MAX_TOKEN_LEN];
extern uint16 _introSarcData3; // sarcophagus stuff to be saved
extern uint16 _introSarcData2; // sarcophagus stuff to be saved
extern char _saveData1[];
extern uint32 _commandFlags;
extern const char *_dinoName;
extern const char *_donnaName;
extern const char *_doughName;
extern const char *_drkiName;
extern const char *_minidinoName;
extern const char *_minidonnaName;
extern const char *_minidoughName;
extern const char *_minidrkiName;
void waitUntilLeftClick();
class Debugger;
class Gfx;
class SoundMan;
struct Location {
Common::Point _startPosition;
uint16 _startFrame;
char _name[100];
CommandList _aCommands;
CommandList _commands;
char *_comment;
char *_endComment;
// NS specific
WalkNodeList _walkNodes;
// BRA specific
CommandList _escapeCommands;
};
struct Character {
Parallaction *_vm;
Animation _ani;
Frames *_head;
Frames *_talk;
Frames *_objs;
PathBuilder _builder;
WalkNodeList *_walkPath;
Character(Parallaction *vm);
void getFoot(Common::Point &foot);
void setFoot(const Common::Point &foot);
void scheduleWalk(int16 x, int16 y);
void free();
protected:
const char *_prefix;
const char *_suffix;
bool _dummy;
char _name[30];
char _baseName[30];
char _fullName[30];
static const char _prefixMini[];
static const char _suffixTras[];
static const char _empty[];
public:
void setName(const char *name);
const char *getName() const;
const char *getBaseName() const;
const char *getFullName() const;
bool dummy() const;
};
class Opcode {
public:
virtual void operator()() const = 0;
virtual ~Opcode() { }
};
template <class T>
class OpcodeImpl : public Opcode {
typedef void (T::*Fn)();
T* _instance;
Fn _fn;
public:
OpcodeImpl(T* instance, const Fn &fn) : _instance(instance), _fn(fn) { }
void operator()() const {
(_instance->*_fn)();
}
};
typedef Common::Array<const Opcode*> OpcodeSet;
#define DECLARE_UNQUALIFIED_ZONE_PARSER(sig) void locZoneParse_##sig()
#define DECLARE_UNQUALIFIED_ANIM_PARSER(sig) void locAnimParse_##sig()
#define DECLARE_UNQUALIFIED_COMMAND_PARSER(sig) void cmdParse_##sig()
#define DECLARE_UNQUALIFIED_LOCATION_PARSER(sig) void locParse_##sig()
#define DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(sig) void instParse_##sig()
#define DECLARE_UNQUALIFIED_COMMAND_OPCODE(op) void cmdOp_##op()
#define DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(op) void instOp_##op()
#define NUM_LOCATIONS 120
class Parallaction : public Engine {
friend class Debugger;
public:
Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gameDesc);
~Parallaction();
int init();
virtual bool loadGame() = 0;
virtual bool saveGame() = 0;
uint16 readInput();
void updateInput();
void waitTime(uint32 t);
enum {
kInputModeGame = 0,
kInputModeComment = 1
};
int _inputMode;
void updateGameInput();
void updateCommentInput();
uint _lookup;
Common::Stack<OpcodeSet*> _opcodes;
Common::Stack<Table*> _statements;
OpcodeSet *_currentOpcodes;
Table *_currentStatements;
void pushParserTables(OpcodeSet *opcodes, Table* statements);
void popParserTables();
void parseStatement();
OpcodeSet _commandOpcodes;
struct {
Command *cmd;
Zone *z;
} _cmdRunCtxt;
OpcodeSet _instructionOpcodes;
struct {
Animation *anim;
Program *program;
InstructionList::iterator inst;
uint16 modCounter;
bool suspend;
} _instRunCtxt;
void showCursor(bool visible);
void pauseJobs();
void resumeJobs();
void finalizeWalk(WalkNodeList *list);
int16 selectWalkFrame(const Common::Point& pos, const WalkNode* from);
void clipMove(Common::Point& pos, const WalkNode* from);
Zone *findZone(const char *name);
Zone *hitZone(uint32 type, uint16 x, uint16 y);
uint16 runZone(Zone*);
void freeZones();
void runDialogue(SpeakData*);
void runCommands(CommandList& list, Zone *z = NULL);
Animation *findAnimation(const char *name);
void freeAnimations();
void setBackground(const char *background, const char *mask, const char *path);
void freeBackground();
Table *_globalTable;
Table *_objectsNames;
Table *_zoneTypeNames;
Table *_zoneFlagNames;
Table *_callableNames;
Table *_localFlagNames;
public:
int getGameType() const;
uint32 getFeatures() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
private:
const PARALLACTIONGameDescription *_gameDescription;
public:
// info
int32 _screenWidth;
int32 _screenHeight;
int32 _screenSize;
PathBuffer *_pathBuffer;
SoundMan *_soundMan;
Gfx* _gfx;
Disk* _disk;
Character _char;
uint32 _localFlags[NUM_LOCATIONS];
char _locationNames[NUM_LOCATIONS][32];
int16 _currentLocationIndex;
uint16 _numLocations;
Location _location;
InventoryItem _activeItem;
Common::Point _mousePos;
void getCursorPos(Common::Point& p) {
p = _mousePos;
}
Zone *_activeZone;
ZoneList _zones;
AnimationList _animations;
ProgramList _programs;
Font *_labelFont;
Font *_menuFont;
Font *_introFont;
Font *_dialogueFont;
Common::RandomSource _rnd;
protected: // data
Debugger *_debugger;
struct InputData {
uint16 _event;
Common::Point _mousePos;
int16 _inventoryIndex;
Zone* _zone;
Label* _label;
};
bool _mouseHidden;
// input-only
InputData _input;
bool _actionAfterWalk; // actived when the character needs to move before taking an action
// these two could/should be merged as they carry on the same duty in two member functions,
// respectively processInput and translateInput
int16 _procCurrentHoverItem;
int16 _transCurrentHoverItem;
uint32 _baseTime;
char _characterName1[50]; // only used in changeCharacter
Common::String _saveFileName;
bool _hasLocationSound;
char _locationSound[50];
Zone *_hoverZone;
protected: // members
bool detectGame(void);
void initGlobals();
void runGame();
void updateView();
uint32 getElapsedTime();
void resetTimer();
InputData *translateInput();
bool translateGameInput();
bool translateInventoryInput();
void processInput(InputData*);
void scheduleLocationSwitch(const char *location);
void doLocationEnterTransition();
virtual void changeLocation(char *location) = 0;
virtual void changeCharacter(const char *name) = 0;
virtual void runPendingZones() = 0;
void allocateLocationSlot(const char *name);
void finalizeLocationParsing();
void freeLocation();
void showLocationComment(const char *text, bool end);
void displayComment(ExamineData *data);
uint16 checkDoor();
void freeCharacter();
int16 pickupItem(Zone *z);
public:
virtual void callFunction(uint index, void* parm) { }
virtual void setArrowCursor() = 0;
virtual void setInventoryCursor(int pos) = 0;
virtual void parseLocation(const char* name) = 0;
void updateDoor(Zone *z);
virtual void runScripts() = 0;
virtual void walk() = 0;
virtual void drawAnimations() = 0;
void beep();
public:
const char **_zoneFlagNamesRes;
const char **_zoneTypeNamesRes;
const char **_commandsNamesRes;
const char **_callableNamesRes;
const char **_instructionNamesRes;
void highlightInventoryItem(ItemPosition pos, byte color);
int16 getHoverInventoryItem(int16 x, int16 y);
int addInventoryItem(ItemName item);
int addInventoryItem(ItemName item, uint32 value);
void dropItem(uint16 v);
bool isItemInInventory(int32 v);
const InventoryItem* getInventoryItem(int16 pos);
int16 getInventoryItemIndex(int16 pos);
void initInventory();
void destroyInventory();
void cleanInventory(bool keepVerbs = true);
void openInventory();
void closeInventory();
Inventory *_inventory;
InventoryRenderer *_inventoryRenderer;
};
class LocationName {
Common::String _slide;
Common::String _character;
Common::String _location;
bool _hasCharacter;
bool _hasSlide;
char *_buf;
public:
LocationName();
~LocationName();
void bind(const char*);
const char *location() const {
return _location.c_str();
}
bool hasCharacter() const {
return _hasCharacter;
}
const char *character() const {
return _character.c_str();
}
bool hasSlide() const {
return _hasSlide;
}
const char *slide() const {
return _slide.c_str();
}
const char *c_str() const {
return _buf;
}
};
class Parallaction_ns : public Parallaction {
public:
Parallaction_ns(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction(syst, gameDesc) { }
~Parallaction_ns();
int init();
int go();
public:
typedef void (Parallaction_ns::*Callable)(void*);
virtual void callFunction(uint index, void* parm);
void setMousePointer(uint32 value);
bool loadGame();
bool saveGame();
private:
void initFonts();
void freeFonts();
void renameOldSavefiles();
Common::String genSaveFileName(uint slot, bool oldStyle = false);
Common::InSaveFile *getInSaveFile(uint slot);
Common::OutSaveFile *getOutSaveFile(uint slot);
bool allPartsComplete();
void setPartComplete(const Character& character);
private:
void changeLocation(char *location);
void changeCharacter(const char *name);
void runPendingZones();
void cleanupGame();
void setArrowCursor();
void setInventoryCursor(int pos);
void doLoadGame(uint16 slot);
void doSaveGame(uint16 slot, const char* name);
int buildSaveFileList(Common::StringList& l);
int selectSaveFile(uint16 arg_0, const char* caption, const char* button);
void initResources();
void initCursors();
static byte _mouseArrow[256];
Frames *_mouseComposedArrow;
static const Callable _dosCallables[25];
static const Callable _amigaCallables[25];
// common callables
void _c_play_boogie(void*);
void _c_startIntro(void*);
void _c_endIntro(void*);
void _c_moveSheet(void*);
void _c_sketch(void*);
void _c_shade(void*);
void _c_score(void*);
void _c_fade(void*);
void _c_moveSarc(void*);
void _c_contaFoglie(void*);
void _c_zeroFoglie(void*);
void _c_trasformata(void*);
void _c_offMouse(void*);
void _c_onMouse(void*);
void _c_setMask(void*);
void _c_endComment(void*);
void _c_frankenstein(void*);
void _c_finito(void*);
void _c_ridux(void*);
void _c_testResult(void*);
// dos specific callables
void _c_null(void*);
// amiga specific callables
void _c_projector(void*);
void _c_HBOff(void*);
void _c_offSound(void*);
void _c_startMusic(void*);
void _c_closeMusic(void*);
void _c_HBOn(void*);
const Callable *_callables;
protected:
void runScripts();
void walk();
void drawAnimations();
// location parser
OpcodeSet _locationParsers;
OpcodeSet _locationZoneParsers;
OpcodeSet _locationAnimParsers;
OpcodeSet _commandParsers;
Table *_commandsNames;
Table *_locationStmt;
Table *_locationZoneStmt;
Table *_locationAnimStmt;
struct LocationParserContext {
bool end;
const char *filename;
Script *script;
Zone *z;
Animation *a;
int nextToken;
CommandList *list;
bool endcommands;
Command *cmd;
// BRA specific
int numZones;
char *bgName;
char *maskName;
char *pathName;
} _locParseCtxt;
void warning_unexpected();
DECLARE_UNQUALIFIED_LOCATION_PARSER(endlocation);
DECLARE_UNQUALIFIED_LOCATION_PARSER(location);
DECLARE_UNQUALIFIED_LOCATION_PARSER(disk);
DECLARE_UNQUALIFIED_LOCATION_PARSER(nodes);
DECLARE_UNQUALIFIED_LOCATION_PARSER(zone);
DECLARE_UNQUALIFIED_LOCATION_PARSER(animation);
DECLARE_UNQUALIFIED_LOCATION_PARSER(localflags);
DECLARE_UNQUALIFIED_LOCATION_PARSER(commands);
DECLARE_UNQUALIFIED_LOCATION_PARSER(acommands);
DECLARE_UNQUALIFIED_LOCATION_PARSER(flags);
DECLARE_UNQUALIFIED_LOCATION_PARSER(comment);
DECLARE_UNQUALIFIED_LOCATION_PARSER(endcomment);
DECLARE_UNQUALIFIED_LOCATION_PARSER(sound);
DECLARE_UNQUALIFIED_LOCATION_PARSER(music);
DECLARE_UNQUALIFIED_ZONE_PARSER(limits);
DECLARE_UNQUALIFIED_ZONE_PARSER(moveto);
DECLARE_UNQUALIFIED_ZONE_PARSER(type);
DECLARE_UNQUALIFIED_ZONE_PARSER(commands);
DECLARE_UNQUALIFIED_ZONE_PARSER(label);
DECLARE_UNQUALIFIED_ZONE_PARSER(flags);
DECLARE_UNQUALIFIED_ZONE_PARSER(endzone);
DECLARE_UNQUALIFIED_ZONE_PARSER(null);
DECLARE_UNQUALIFIED_ANIM_PARSER(script);
DECLARE_UNQUALIFIED_ANIM_PARSER(commands);
DECLARE_UNQUALIFIED_ANIM_PARSER(type);
DECLARE_UNQUALIFIED_ANIM_PARSER(label);
DECLARE_UNQUALIFIED_ANIM_PARSER(flags);
DECLARE_UNQUALIFIED_ANIM_PARSER(file);
DECLARE_UNQUALIFIED_ANIM_PARSER(position);
DECLARE_UNQUALIFIED_ANIM_PARSER(moveto);
DECLARE_UNQUALIFIED_ANIM_PARSER(endanimation);
DECLARE_UNQUALIFIED_COMMAND_PARSER(flags);
DECLARE_UNQUALIFIED_COMMAND_PARSER(animation);
DECLARE_UNQUALIFIED_COMMAND_PARSER(zone);
DECLARE_UNQUALIFIED_COMMAND_PARSER(location);
DECLARE_UNQUALIFIED_COMMAND_PARSER(drop);
DECLARE_UNQUALIFIED_COMMAND_PARSER(call);
DECLARE_UNQUALIFIED_COMMAND_PARSER(simple);
DECLARE_UNQUALIFIED_COMMAND_PARSER(move);
DECLARE_UNQUALIFIED_COMMAND_PARSER(endcommands);
virtual void parseGetData(Script &script, Zone *z);
virtual void parseExamineData(Script &script, Zone *z);
virtual void parseDoorData(Script &script, Zone *z);
virtual void parseMergeData(Script &script, Zone *z);
virtual void parseHearData(Script &script, Zone *z);
virtual void parseSpeakData(Script &script, Zone *z);
void parseLocation(const char *filename);
char *parseComment(Script &script);
char *parseDialogueString(Script &script);
Dialogue *parseDialogue(Script &script);
void resolveDialogueForwards(Dialogue *dialogue, uint numQuestions, Table &forwards);
Answer *parseAnswer(Script &script);
Question *parseQuestion(Script &script);
void parseZone(Script &script, ZoneList &list, char *name);
void parseZoneTypeBlock(Script &script, Zone *z);
void parseWalkNodes(Script& script, WalkNodeList &list);
Animation *parseAnimation(Script &script, AnimationList &list, char *name);
void parseCommands(Script &script, CommandList&);
void parseCommandFlags();
void saveCommandForward(const char *name, Command* cmd);
void resolveCommandForwards();
void createCommand(uint id);
void addCommand();
void initOpcodes();
void initParsers();
struct CommandForwardReference {
char name[20];
Command* cmd;
} _forwardedCommands[MAX_FORWARDS];
uint _numForwardedCommands;
// program parser
OpcodeSet _instructionParsers;
Table *_instructionNames;
struct {
bool end;
Animation *a;
Instruction *inst;
LocalVariable *locals;
Program *program;
// BRA specific
Instruction *openIf;
} _instParseCtxt;
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(defLocal);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(animation);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(loop);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(x);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(y);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(z);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(f);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(inc);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(set);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(move);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(put);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(call);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(sound);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(null);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(endscript);
void parseInstruction(Program *program);
void loadProgram(Animation *a, const char *filename);
void parseLValue(ScriptVar &var, const char *str);
virtual void parseRValue(ScriptVar &var, const char *str);
void wrapLocalVar(LocalVariable *local);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(invalid);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(set);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(clear);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(speak);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(get);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(toggle);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(quit);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(invalid);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endloop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(null);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(call);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(sound);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
void selectStartLocation();
void guiStart();
int guiSelectCharacter();
void guiSplash();
int guiNewGame();
uint16 guiChooseLanguage();
uint16 guiSelectGame();
int guiGetSelectedBlock(const Common::Point &p);
void switchBackground(const char* background, const char* mask);
void showSlide(const char *name);
};
#define NUM_ZONES 100
class Parallaction_br : public Parallaction_ns {
typedef Parallaction_ns Super;
public:
Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction_ns(syst, gameDesc) { }
~Parallaction_br();
int init();
int go();
public:
typedef void (Parallaction_br::*Callable)(void*);
virtual void callFunction(uint index, void* parm);
public:
Table *_countersNames;
Table *_audioCommandsNames;
const char **_audioCommandsNamesRes;
int _part;
int _progress;
int _zeta0;
int _zeta1;
int _zeta2;
int16 _lipSyncVal;
uint _subtitleLipSync;
int _subtitleY;
int _subtitle[2];
Zone *_activeZone2;
int32 _counters[32];
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
private:
void initResources();
void initFonts();
void freeFonts();
void initOpcodes();
void initParsers();
void setArrowCursor();
void setInventoryCursor(int pos);
void changeLocation(char *location);
void changeCharacter(const char *name);
void runPendingZones();
void initPart();
void freePart();
void startPart();
void setMousePointer(int16 index);
void initCursors();
Frames *_dinoCursor;
Frames *_dougCursor;
Frames *_donnaCursor;
Frames *_mouseArrow;
static const char *_partNames[];
void guiStart();
int guiShowMenu();
void guiSplash(const char *name);
Frames* guiRenderMenuItem(const char *text);
static const Callable _dosCallables[6];
void _c_blufade(void*);
void _c_resetpalette(void*);
void _c_ferrcycle(void*);
void _c_lipsinc(void*);
void _c_albcycle(void*);
void _c_password(void*);
const Callable *_callables;
DECLARE_UNQUALIFIED_LOCATION_PARSER(location);
DECLARE_UNQUALIFIED_LOCATION_PARSER(zone);
DECLARE_UNQUALIFIED_LOCATION_PARSER(animation);
DECLARE_UNQUALIFIED_LOCATION_PARSER(localflags);
DECLARE_UNQUALIFIED_LOCATION_PARSER(flags);
DECLARE_UNQUALIFIED_LOCATION_PARSER(comment);
DECLARE_UNQUALIFIED_LOCATION_PARSER(endcomment);
DECLARE_UNQUALIFIED_LOCATION_PARSER(sound);
DECLARE_UNQUALIFIED_LOCATION_PARSER(music);
DECLARE_UNQUALIFIED_LOCATION_PARSER(redundant);
DECLARE_UNQUALIFIED_LOCATION_PARSER(ifchar);
DECLARE_UNQUALIFIED_LOCATION_PARSER(character);
DECLARE_UNQUALIFIED_LOCATION_PARSER(mask);
DECLARE_UNQUALIFIED_LOCATION_PARSER(path);
DECLARE_UNQUALIFIED_LOCATION_PARSER(escape);
DECLARE_UNQUALIFIED_LOCATION_PARSER(zeta);
DECLARE_UNQUALIFIED_LOCATION_PARSER(null);
DECLARE_UNQUALIFIED_COMMAND_PARSER(ifchar);
DECLARE_UNQUALIFIED_COMMAND_PARSER(endif);
DECLARE_UNQUALIFIED_COMMAND_PARSER(location);
DECLARE_UNQUALIFIED_COMMAND_PARSER(toggle);
DECLARE_UNQUALIFIED_COMMAND_PARSER(string);
DECLARE_UNQUALIFIED_COMMAND_PARSER(math);
DECLARE_UNQUALIFIED_COMMAND_PARSER(test);
DECLARE_UNQUALIFIED_COMMAND_PARSER(music);
DECLARE_UNQUALIFIED_COMMAND_PARSER(zeta);
DECLARE_UNQUALIFIED_COMMAND_PARSER(swap);
DECLARE_UNQUALIFIED_COMMAND_PARSER(give);
DECLARE_UNQUALIFIED_COMMAND_PARSER(text);
DECLARE_UNQUALIFIED_COMMAND_PARSER(unary);
void parseLocation(const char* name);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(zone);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(color);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(mask);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(print);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(text);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(if_op);
DECLARE_UNQUALIFIED_INSTRUCTION_PARSER(endif);
virtual void parseRValue(ScriptVar &var, const char *str);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(location);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(open);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(close);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(on);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(off);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(call);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(drop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(move);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(start);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(stop);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(character);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(followme);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(onmouse);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(offmouse);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(add);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(leave);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(inc);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(dec);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifeq);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(iflt);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ifgt);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(let);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(music);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(fix);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(unfix);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(zeta);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(scroll);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(swap);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(give);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(text);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(part);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(testsfx);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(ret);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(onsave);
DECLARE_UNQUALIFIED_COMMAND_OPCODE(offsave);
DECLARE_UNQUALIFIED_ZONE_PARSER(limits);
DECLARE_UNQUALIFIED_ZONE_PARSER(moveto);
DECLARE_UNQUALIFIED_ZONE_PARSER(type);
DECLARE_UNQUALIFIED_ANIM_PARSER(file);
DECLARE_UNQUALIFIED_ANIM_PARSER(position);
DECLARE_UNQUALIFIED_ANIM_PARSER(moveto);
DECLARE_UNQUALIFIED_ANIM_PARSER(endanimation);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(on);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(off);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(loop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(inc);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(dec);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(set);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(put);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(wait);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(start);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(process);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(color);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mask);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(print);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(text);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(mul);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(div);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifeq);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(iflt);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(ifgt);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endif);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(stop);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
void setupSubtitles(char *s, char *s2, int y);
void clearSubtitles();
#if 0
void jobWaitRemoveLabelJob(void *parm, Job *job);
void jobPauseSfx(void *parm, Job *job);
void jobStopFollower(void *parm, Job *job);
void jobScroll(void *parm, Job *job);
#endif
};
// FIXME: remove global
extern Parallaction *_vm;
} // namespace Parallaction
#endif
|