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
25namespace 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
135enum OptionType {
136 OT_GO,
137 OT_GET,
138 OT_DO,
139 OT_FLASHLIGHT
140};
141
142struct RoomDesc {
143 int options[3];
144 OptionType optionTypes[3];
145 int roomDescIndex[3];
146};
147
148struct UserMsg {
149 int num;
150 char msg[3][40];
151};
152
153struct Item {
154 byte bg;
155 byte fg;
156 char name[16];
157};
158
159class PictureMgr_Troll;
160
161class TrollEngine : public PreAgiEngine {
162public:
163 TrollEngine(OSystem *syst, const AGIGameDescription *gameDesc);
164 ~TrollEngine() override;
165
166 Common::Error go() override;
167
168private:
169 PictureMgr_Troll *_picture;
170
171 int _roomPicture;
172 int _treasuresLeft;
173 int _currentRoom;
174 int _moves;
175
176 bool _isTrollAway;
177
178 int _inventory[IDI_TRO_MAX_TREASURE];
179
180 bool _soundOn;
181
182 byte *_gameData;
183
184 void init();
185 void intro();
186 void drawPic(int iPic, bool f3IsCont, bool clear, bool troll = false);
187 void drawTroll();
188 void gameLoop();
189 void gameOver();
190 void tutorial();
191 void credits();
192
193 void inventory();
194 void pickupTreasure(int treasureId);
195
196 int drawRoom(char *menu);
197 void printUserMessage(int msgId);
198
199 void pressAnyKey(int col = 4);
200 void waitAnyKeyIntro();
201
202 void playTune(int tune, int len);
203
204 bool getMenuSel(const char *, int *, int);
205
206 void drawMenu(const char *szMenu, int iSel);
207
208 void fillOffsets();
209
210 // These are come from game data
211 int _pictureOffsets[IDI_TRO_PICNUM];
212 int _roomPicStartIdx[IDI_TRO_NUM_NUMROOMS];
213 int _roomPicDeltas[IDI_TRO_NUM_NUMROOMS];
214 int _roomStates[IDI_TRO_NUM_NUMROOMS];
215 UserMsg _userMessages[IDI_TRO_NUM_USERMSGS];
216 int _locMessagesIdx[IDI_TRO_NUM_LOCDESCS];
217 RoomDesc _roomDescs[IDI_TRO_NUM_ROOMDESCS];
218 int _options[IDI_TRO_NUM_OPTIONS];
219 Item _items[IDI_TRO_MAX_TREASURE];
220 int _roomConnects[IDI_TRO_NUM_OPTIONS];
221 int _nonTrollRooms[IDI_TRO_NUM_NONTROLL];
222
223 int _tunes[6];
224};
225
226} // End of namespace Agi
227
228#endif
Definition: picture_troll.h:27
Definition: preagi.h:59
Definition: troll.h:161
Definition: error.h:81
Definition: system.h:166
Definition: agi.h:64
Definition: detection.h:29
Definition: troll.h:153
Definition: troll.h:142
Definition: troll.h:148