ScummVM API documentation
troll.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGI_PREAGI_TROLL_H
23 #define AGI_PREAGI_TROLL_H
24 
25 namespace Agi {
26 
27 // strings
28 
29 #define IDS_TRO_DISK "ERROR ERROR !"
30 #define IDS_TRO_PATH_PIC "%s"
31 
32 #define IDS_TRO_PRESSANYKEY "PRESS ANY KEY TO CONTINUE:"
33 
34 #define IDS_TRO_INTRO_0 "SIERRA ON-LINE INC."
35 #define IDS_TRO_INTRO_1 "Presents :"
36 #define IDS_TRO_INTRO_2 "Copyright 1984 Sierra On-Line Inc."
37 #define IDS_TRO_INTRO_3 " Press any key to continue. "
38 #define IDS_TRO_INTRO_4 "HAVE YOU PLAYED THIS GAME BEFORE ?"
39 #define IDS_TRO_INTRO_5 "PRESS <Y> OR <N>"
40 
41 #define IDS_TRO_TUTORIAL_0 " First press the <space bar>.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n *3. SEE a SURPRISE, and then more."
42 #define IDS_TRO_TUTORIAL_1 " Press <return> to make your choice.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n 3. SEE a SURPRISE, and then more."
43 //#define IDS_TRO_TUTORIAL_0 "First press the <space bar>."
44 //#define IDS_TRO_TUTORIAL_1 "1. Turn the screen GREEN."
45 //#define IDS_TRO_TUTORIAL_2 "2. Turn the screen BLACK."
46 //#define IDS_TRO_TUTORIAL_3 "3. SEE a SURPRISE, and then more."
47 //#define IDS_TRO_TUTORIAL_4 "Press <return> to make your choice."
48 #define IDS_TRO_TUTORIAL_5 "Would you like more practice ?"
49 #define IDS_TRO_TUTORIAL_6 "Press <Y> for yes, <N> for no."
50 #define IDS_TRO_TUTORIAL_7 "The evil TROLL has hidden all the"
51 #define IDS_TRO_TUTORIAL_8 "Treasures of MARK, the Dwarf King."
52 #define IDS_TRO_TUTORIAL_9 "Help KING MARK find his Treasures."
53 #define IDS_TRO_TUTORIAL_10 "You can't take a Treasure if the TROLL"
54 #define IDS_TRO_TUTORIAL_11 "is in the same picture as the Treasure."
55 #define IDS_TRO_TUTORIAL_12 "To make the TROLL go away you have to"
56 #define IDS_TRO_TUTORIAL_13 "make the picture change."
57 #define IDS_TRO_TUTORIAL_14 "During the game see the Treasures you"
58 #define IDS_TRO_TUTORIAL_15 "have already found by pressing <F>."
59 #define IDS_TRO_TUTORIAL_16 "During the game you can turn the sound"
60 #define IDS_TRO_TUTORIAL_17 "on or off by pressing the <S> key "
61 #define IDS_TRO_TUTORIAL_18 "while holding down the <Ctrl> key."
62 #define IDS_TRO_TUTORIAL_19 "The TROLL has hidden these Treasures:"
63 
64 #define IDS_TRO_CREDITS_0 "Prepare to enter the world of . . ."
65 #define IDS_TRO_CREDITS_1 "TROLL'S TALE (tm)"
66 #define IDS_TRO_CREDITS_2 "------------"
67 #define IDS_TRO_CREDITS_3 "Written by MIKE MACCHESNEY"
68 #define IDS_TRO_CREDITS_4 "Conversion by PETER OLIPHANT"
69 #define IDS_TRO_CREDITS_5 "Graphic Art by DOUG MACNEILL"
70 #define IDS_TRO_CREDITS_6 "Original Version by AL LOWE"
71 
72 #define IDS_TRO_TREASURE_0 "TREASURES FOUND"
73 #define IDS_TRO_TREASURE_1 "---------------"
74 #define IDS_TRO_TREASURE_2 "NONE"
75 #define IDS_TRO_TREASURE_3 "THERE ARE STILL %d TREASURES TO FIND"
76 #define IDS_TRO_TREASURE_4 "%d TREASURES TO FIND"
77 #define IDS_TRO_TREASURE_5 "%d TREASURE TO FIND"
78 #define IDS_TRO_TREASURE_6 "YOU HAVE FOUND ALL OF THE TREASURES!!"
79 #define IDS_TRO_TREASURE_7 "THERE'S ONLY ONE MORE TREASURE TO FIND."
80 #define IDS_TRO_TREASURE_8 "GREAT!! YOU HAVE FOUND EVERY TREASURE."
81 #define IDS_TRO_TREASURE_9 "TAKE THE TREASURES TO THE GUARD."
82 
83 #define IDS_TRO_GAMEOVER_0 "You took %d moves to complete TROLL'S"
84 #define IDS_TRO_GAMEOVER_1 "TALE. Do you think you can do better?"
85 
86 // picture
87 
88 #define IDI_TRO_PICNUM 47
89 
90 #define IDI_TRO_PIC_WIDTH 160
91 #define IDI_TRO_PIC_HEIGHT 168
92 #define IDI_TRO_PIC_X0 0
93 #define IDI_TRO_PIC_Y0 0
94 #define IDI_TRO_PIC_FLAGS IDF_AGI_PIC_V15
95 
96 // max values
97 
98 #define IDI_TRO_MAX_TREASURE 16
99 #define IDI_TRO_MAX_OPTION 3
100 
101 #define IDI_TRO_SEL_OPTION_1 0
102 #define IDI_TRO_SEL_OPTION_2 1
103 #define IDI_TRO_SEL_OPTION_3 2
104 
105 #define IDI_TRO_MAX_ROW_PIC 21
106 
107 #define IDI_TRO_NUM_ROOMDESCS 65
108 #define IDI_TRO_NUM_OPTIONS 129
109 #define IDI_TRO_NUM_NUMROOMS 43
110 
111 #define IDI_TRO_NUM_USERMSGS 34
112 
113 #define IDI_TRO_NUM_LOCDESCS 59
114 
115 #define IDI_TRO_NUM_NONTROLL 9
116 
117 // offsets
118 
119 #define IDA_TRO_BINNAME "troll.img"
120 
121 #define IDO_TRO_DATA_START 0x3A40
122 #define IDO_TRO_PIC_START 0x3EF5
123 #define IDO_TRO_LOCMESSAGES 0x1F7C
124 #define IDO_TRO_USERMESSAGES 0x34A4
125 #define IDO_TRO_ROOMDESCS 0x0082
126 #define IDO_TRO_OPTIONS 0x0364
127 #define IDO_TRO_PICSTARTIDX 0x02CD
128 #define IDO_TRO_ROOMPICDELTAS 0x030C
129 #define IDO_TRO_ALLTREASURES 0x3B24
130 #define IDO_TRO_ITEMS 0x34E8
131 #define IDO_TRO_FRAMEPIC 0x3EC2
132 #define IDO_TRO_ROOMCONNECTS 0x02FA
133 #define IDO_TRO_NONTROLLROOMS 0x3CF9
134 
135 enum OptionType {
136  OT_GO,
137  OT_GET,
138  OT_DO,
139  OT_FLASHLIGHT
140 };
141 
142 struct RoomDesc {
143  int options[3];
144  OptionType optionTypes[3];
145  int roomDescIndex[3];
146 };
147 
148 struct UserMsg {
149  int num;
150  char msg[3][40];
151 };
152 
153 struct Item {
154  byte bg;
155  byte fg;
156  char name[16];
157 };
158 
159 class TrollEngine : public PreAgiEngine {
160 public:
161  TrollEngine(OSystem *syst, const AGIGameDescription *gameDesc);
162  ~TrollEngine() override;
163 
164  Common::Error go() override;
165 
166 private:
167  int _roomPicture;
168  int _treasuresLeft;
169  int _currentRoom;
170  int _moves;
171 
172  bool _isTrollAway;
173 
174  int _inventory[IDI_TRO_MAX_TREASURE];
175 
176  bool _soundOn;
177 
178  byte *_gameData;
179 
180  void init();
181  void intro();
182  void drawPic(int iPic, bool f3IsCont, bool clear, bool troll = false);
183  void drawTroll();
184  void gameLoop();
185  void gameOver();
186  void tutorial();
187  void credits();
188 
189  void inventory();
190  void pickupTreasure(int treasureId);
191 
192  int drawRoom(char *menu);
193  void printUserMessage(int msgId);
194 
195  void pressAnyKey(int col = 4);
196  void waitAnyKeyIntro();
197 
198  void playTune(int tune, int len);
199 
200  bool getMenuSel(const char *, int *, int);
201 
202  void drawMenu(const char *szMenu, int iSel);
203 
204  void fillOffsets();
205 
206  // These are come from game data
207  int _pictureOffsets[IDI_TRO_PICNUM];
208  int _roomPicStartIdx[IDI_TRO_NUM_NUMROOMS];
209  int _roomPicDeltas[IDI_TRO_NUM_NUMROOMS];
210  int _roomStates[IDI_TRO_NUM_NUMROOMS];
211  UserMsg _userMessages[IDI_TRO_NUM_USERMSGS];
212  int _locMessagesIdx[IDI_TRO_NUM_LOCDESCS];
213  RoomDesc _roomDescs[IDI_TRO_NUM_ROOMDESCS];
214  int _options[IDI_TRO_NUM_OPTIONS];
215  Item _items[IDI_TRO_MAX_TREASURE];
216  int _roomConnects[IDI_TRO_NUM_OPTIONS];
217  int _nonTrollRooms[IDO_TRO_NONTROLLROOMS];
218 
219  int _tunes[6];
220 };
221 
222 } // End of namespace Agi
223 
224 #endif
Definition: troll.h:148
Definition: error.h:84
Definition: troll.h:142
Definition: preagi.h:53
Definition: system.h:161
Definition: troll.h:159
Definition: detection.h:29
Definition: agi.h:63
Definition: troll.h:153