ScummVM API documentation
winnie.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_WINNIE_H
23 #define AGI_PREAGI_WINNIE_H
24 
25 namespace Agi {
26 
27 #define WTP_SAVEGAME_VERSION 1
28 #define IDI_XOR_KEY 0x80
29 
30 // strings
31 #define IDS_WTP_ROOM_DOS "rooms/rm.%02d"
32 #define IDS_WTP_ROOM_AMIGA "rooms/room.%d"
33 #define IDS_WTP_ROOM_C64 "room%02d"
34 #define IDS_WTP_ROOM_APPLE "room%d.obj"
35 #define IDS_WTP_OBJ_DOS "obj.%02d"
36 #define IDS_WTP_OBJ_AMIGA "objects/object.%d"
37 #define IDS_WTP_OBJ_C64 "object%02d"
38 #define IDS_WTP_OBJ_APPLE "object%d.obj"
39 #define IDS_WTP_SND_DOS "snd.%02d"
40 #define IDS_WTP_SND_AMIGA "Sounds"
41 #define IDS_WTP_SND_C64 "sound.obj"
42 #define IDS_WTP_SND_APPLE "sound.obj"
43 
44 #define IDS_WTP_FILE_LOGO "logo"
45 #define IDS_WTP_FILE_TITLE "title"
46 #define IDS_WTP_FILE_SAVEGAME "savegame"
47 #define IDS_WTP_FILE_RND "rnd"
48 
49 #define IDS_WTP_DISK_ERROR "There is a problem with your disk drive.Please make sure your Winnie-the-Pooh disk is in the drive correctly."
50 
51 #define IDS_WTP_INTRO_0 " PRESENT"
52 #define IDS_WTP_INTRO_1 " TM designates trademark of\n Sierra On-Line, Inc.\n (c) 1985 Walt Disney Productions"
53 
54 #define IDS_WTP_HELP_0 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. Press the <Backspace> key to see what you just finished reading."
55 #define IDS_WTP_HELP_1 "Press <C> to see what you are carrying. <Ctrl-S> turns the sound off and on. <ESC> takes you to the playroom (in caseyou get lost or want to save the game)."
56 
57 #define IDS_WTP_GAME_OVER_0 "Congratulations!! You did it! You returned everything that was lost. Now,Christopher Robin invites you to a Hero party."
58 #define IDS_WTP_GAME_OVER_1 "The good news is: YOU are the Hero!! The bad news is: you have to find the party by yourself. Good luck!"
59 
60 #define IDS_WTP_OWL_0 "\"For example, that object you are carrying now is interesting. I know I've seen it before. Hmmm. Let me think about this . . .\""
61 #define IDS_WTP_OWL_1 "\"You know, this object here beside me isfamiliar. I'm sure I could give you some sort of clue about it. Let me see. . .\""
62 
63 #define IDS_WTP_WIND_0 "Oh, no! The Blustery Wind begins to howl. It has returned, and mixed up all the objects in the Wood."
64 #define IDS_WTP_WIND_1 "But don't worry. Everyone still has theobjects you returned to them.\n\n (Today must be Winds-day!)"
65 #define IDS_WTP_TIGGER "\"Hallooooo, there!!!! It's ME, Tigger! Let's BOUNCE!\""
66 #define IDS_WTP_MIST "Oh, look out! The mysterious mist is coming in. It gets so thick that you can't see through it. Just keep walkingand it will soon clear up."
67 
68 #define IDS_WTP_SONG_0 "Winnie-the-Pooh, Winnie-the-Pooh, Tubby little cubby all stuffed with fluff, He's Winnie-the-Pooh, Winnie-the-Pooh, Willy, nilly, silly, old bear."
69 #define IDS_WTP_SONG_1 "Deep in the Hundred Acre Wood, Where Christopher Robin plays, You will find the enchanted neighborhoodof Christopher's childhood days."
70 #define IDS_WTP_SONG_2 "A donkey named Eeyore is his friend, and Kanga and little Roo. There's Rabbit and Piglet and there's Owl But most of all Winnie-the-Pooh!"
71 
72 #define IDS_WTP_NSEW "North South East West"
73 #define IDS_WTP_TAKE "Take"
74 #define IDS_WTP_DROP "Drop"
75 #define IDS_WTP_CANT_GO "\nSorry, but you can't go that way."
76 #define IDS_WTP_CANT_TAKE "You can't take it. You can only carry one object at a time."
77 #define IDS_WTP_CANT_DROP "You can't drop it. Another object is already here."
78 #define IDS_WTP_WRONG_PLACE "\nOk, but it doesn't belong here."
79 #define IDS_WTP_OK "\nOk."
80 
81 #define IDS_WTP_INVENTORY_0 "You are carrying nothing."
82 #define IDS_WTP_INVENTORY_1 "Number of objects still missing: %d"
83 
84 // COMMODORE 64 version strings
85 
86 #define IDS_WTP_FILE_SAVEGAME_C64 "saved game"
87 #define IDS_WTP_DISK_ERROR_C64 "There is a problem with your disk drive.Please make sure your disk is in the drive correctly."
88 #define IDS_WTP_HELP_0_C64 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. <F1> brings back what you have already read."
89 #define IDS_WTP_HELP_1_C64 "<F3> takes you back to the playroom (if you get lost, or want to save the game).<F5> turns the sound off and on. <F7> shows what you're carrying."
90 #define IDS_WTP_WRONG_PLACE_C64 "\nOk, but this is not the right place."
91 
92 // maximum values
93 
94 #define IDI_WTP_MAX_OBJ_MISSING 10
95 
96 #define IDI_WTP_MAX_ROOM 62
97 #define IDI_WTP_MAX_OBJ 40
98 #define IDI_WTP_MAX_SND 14
99 #define IDI_WTP_MAX_PIC 2
100 
101 #define IDI_WTP_MAX_ROOM_NORMAL 57
102 #define IDI_WTP_MAX_ROOM_TELEPORT 30
103 #define IDI_WTP_MAX_ROOM_OBJ 42
104 #define IDI_WTP_MAX_BLOCK 4
105 #define IDI_WTP_MAX_STR 6
106 #define IDI_WTP_MAX_OBJ_STR 4
107 #define IDI_WTP_MAX_OBJ_STR_END 2
108 #define IDI_WTP_MAX_FLAG 40
109 #define IDI_WTP_MAX_OPTION 3
110 #define IDI_WTP_MAX_DIR 4
111 #define IDI_WTP_MAX_MOVES_UNTIL_WIND 150
112 
113 // positions
114 
115 #define IDI_WTP_ROW_MENU 21
116 #define IDI_WTP_ROW_OPTION_1 21
117 #define IDI_WTP_ROW_OPTION_2 22
118 #define IDI_WTP_ROW_OPTION_3 23
119 #define IDI_WTP_ROW_OPTION_4 24
120 
121 #define IDI_WTP_COL_MENU 0
122 #define IDI_WTP_COL_OPTION 1
123 #define IDI_WTP_COL_NSEW 1
124 #define IDI_WTP_COL_NORTH 1
125 #define IDI_WTP_COL_SOUTH 8
126 #define IDI_WTP_COL_EAST 15
127 #define IDI_WTP_COL_WEST 21
128 #define IDI_WTP_COL_TAKE 29
129 #define IDI_WTP_COL_DROP 35
130 #define IDI_WTP_COL_PRESENT 17
131 
132 // data file offset modifiers
133 
134 #define IDI_WTP_OFS_ROOM 0x5400
135 #define IDI_WTP_OFS_OBJ 0x0800
136 
137 // picture
138 
139 #define IDI_WTP_PIC_WIDTH 140
140 #define IDI_WTP_PIC_HEIGHT 159
141 #define IDI_WTP_PIC_X0 10
142 #define IDI_WTP_PIC_Y0 0
143 #define IDI_WTP_PIC_FLAGS IDF_AGI_PIC_V2
144 
145 // selections
146 
147 enum {
148  IDI_WTP_SEL_HOME = -2,
149  IDI_WTP_SEL_BACK,
150  IDI_WTP_SEL_OPT_1,
151  IDI_WTP_SEL_OPT_2,
152  IDI_WTP_SEL_OPT_3,
153  IDI_WTP_SEL_NORTH,
154  IDI_WTP_SEL_SOUTH,
155  IDI_WTP_SEL_EAST,
156  IDI_WTP_SEL_WEST,
157  IDI_WTP_SEL_TAKE,
158  IDI_WTP_SEL_DROP,
159  IDI_WTP_SEL_REAL_OPT_1,
160  IDI_WTP_SEL_REAL_OPT_2,
161  IDI_WTP_SEL_REAL_OPT_3
162 };
163 
164 #define IDI_WTP_SEL_LAST IDI_WTP_SEL_REAL_OPT_3
165 
166 // rooms
167 
168 enum {
169  IDI_WTP_ROOM_NONE = -1,
170  IDI_WTP_ROOM_NORTH,
171  IDI_WTP_ROOM_SOUTH,
172  IDI_WTP_ROOM_EAST,
173  IDI_WTP_ROOM_WEST
174 };
175 
176 #define IDI_WTP_ROOM_HIDE 0
177 
178 #define IDI_WTP_ROOM_PICNIC 2
179 #define IDI_WTP_ROOM_HOME 28
180 #define IDI_WTP_ROOM_PARTY 58
181 #define IDI_WTP_ROOM_MIST 59
182 #define IDI_WTP_ROOM_TIGGER 61
183 
184 // sound
185 
186 enum ENUM_WTP_SOUND {
187  IDI_WTP_SND_POOH_0 = 1,
188  IDI_WTP_SND_TIGGER,
189  IDI_WTP_SND_TAKE,
190  IDI_WTP_SND_DROP,
191  IDI_WTP_SND_DROP_OK,
192  IDI_WTP_SND_FANFARE,
193  IDI_WTP_SND_POOH_1,
194  IDI_WTP_SND_KEYHELP,
195  IDI_WTP_SND_POOH_2,
196  IDI_WTP_SND_WIND_0,
197  IDI_WTP_SND_WIND_1
198 };
199 
200 // script opcodes
201 
202 #define IDO_WTP_GOTO_ROOM 0x06
203 #define IDO_WTP_PRINT_MSG 0x08
204 #define IDO_WTP_PRINT_STR 0x0A
205 #define IDO_WTP_DROP_OBJ 0x0C
206 #define IDO_WTP_FLAG_CLEAR 0x0E
207 #define IDO_WTP_FLAG_SET 0x10
208 #define IDO_WTP_GAME_OVER 0x12
209 #define IDO_WTP_WALK_MIST 0x14
210 #define IDO_WTP_PLAY_SOUND 0x16
211 #define IDO_WTP_SAVE_GAME 0x18
212 #define IDO_WTP_LOAD_GAME 0x1A
213 #define IDO_WTP_OWL_HELP 0x1C
214 #define IDO_WTP_GOTO_RND 0x1E
215 
216 #define IDO_WTP_OPTION_0 0x15
217 #define IDO_WTP_OPTION_1 0x16
218 #define IDO_WTP_OPTION_2 0x17
219 
220 enum {
221  IDI_WTP_OBJ_DESC = 0,
222  IDI_WTP_OBJ_TAKE,
223  IDI_WTP_OBJ_DROP,
224  IDI_WTP_OBJ_HELP
225 };
226 
227 enum {
228  IDI_WTP_PAR_OK = 0,
229  IDI_WTP_PAR_GOTO,
230  IDI_WTP_PAR_BACK
231 };
232 
233 // room file option block
234 
236  uint16 ofsOpt[IDI_WTP_MAX_BLOCK];
237 };
238 
239 // room file header
240 
241 struct WTP_ROOM_HDR {
242  uint8 roomNumber;
243  uint8 objId;
244  uint16 ofsPic;
245  uint16 fileLen;
246  uint16 reserved0;
247  int8 roomNew[IDI_WTP_MAX_DIR];
248  uint8 objX;
249  uint8 objY;
250  uint16 reserved1;
251  uint16 ofsDesc[IDI_WTP_MAX_BLOCK];
252  uint16 ofsBlock[IDI_WTP_MAX_BLOCK];
253  uint16 ofsStr[IDI_WTP_MAX_STR];
254  uint32 reserved2;
255  WTP_ROOM_BLOCK opt[IDI_WTP_MAX_BLOCK];
256 };
257 
258 // object file header
259 
260 struct WTP_OBJ_HDR {
261  uint16 fileLen;
262  uint16 objId;
263  uint16 ofsEndStr[IDI_WTP_MAX_OBJ_STR_END];
264  uint16 ofsStr[IDI_WTP_MAX_OBJ_STR];
265  uint16 ofsPic;
266 };
267 
268 // savegame
269 
271  uint8 fSound;
272  uint8 nMoves;
273  uint8 nObjMiss;
274  uint8 nObjRet;
275  uint8 iObjHave;
276  uint8 fGame[IDI_WTP_MAX_FLAG];
277  uint8 iUsedObj[IDI_WTP_MAX_OBJ_MISSING];
278  uint8 iObjRoom[IDI_WTP_MAX_ROOM_OBJ];
279 };
280 
281 class PreAgiEngine;
282 
283 class WinnieEngine : public PreAgiEngine {
284 public:
285  WinnieEngine(OSystem *syst, const AGIGameDescription *gameDesc);
286  ~WinnieEngine() override;
287 
288  void init();
289  Common::Error go() override;
290 
291  void debugCurRoom();
292 
293 private:
294  WTP_SAVE_GAME _gameStateWinnie;
295  int _room;
296  int _mist;
297  bool _doWind;
298  bool _winnieEvent;
299  int _tiggerMist;
300 
301  int _roomOffset;
302  int _objOffset;
303  bool _isBigEndian;
304  Common::Rect hotspotNorth, hotspotSouth, hotspotEast, hotspotWest;
305 
306  void randomize();
307  void intro();
308  void drawPic(const char *);
309  void gameLoop();
310 
311  void parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len);
312  void parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len);
313  uint32 readRoom(int, uint8 *, WTP_ROOM_HDR &);
314 
315  void drawRoomPic();
316  int parser(int, int, uint8 *);
317  int getObjInRoom(int);
318  bool getSelOkBack();
319  void getMenuSel(char *, int *, int[]);
320  void keyHelp();
321  void clrMenuSel(int *, int[]);
322  void incMenuSel(int *, int[]);
323  void decMenuSel(int *, int[]);
324  void drawMenu(char *, int, int[]);
325  void printRoomStr(int, int);
326  void inventory();
327  void printObjStr(int, int);
328  uint32 readObj(int, uint8 *);
329  void takeObj(int);
330  void dropObj(int);
331  bool isRightObj(int, int, int *);
332  void drawObjPic(int, int, int);
333  void getMenuMouseSel(int *, int[], int, int);
334  void setWinnieFlag(int);
335  void clearWinnieFlag(int);
336  void gameOver();
337  void saveGame();
338  void loadGame();
339  void dropObjRnd();
340  void setTakeDrop(int[]);
341  void makeSel(int *, int[]);
342 
343  void wind();
344  void mist();
345  void tigger();
346 
347  void showOwlHelp();
348  bool playSound(ENUM_WTP_SOUND);
349 
350  void printStrWinnie(char *szMsg);
351 };
352 
353 } // End of namespace Agi
354 
355 #endif
Definition: error.h:84
Definition: rect.h:144
Definition: winnie.h:270
Definition: winnie.h:241
Definition: preagi.h:53
Definition: winnie.h:235
Definition: winnie.h:260
Definition: system.h:161
Definition: detection.h:29
Definition: agi.h:63
Definition: winnie.h:283