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_ROOM_COCO "room%02d"
36 #define IDS_WTP_OBJ_DOS "obj.%02d"
37 #define IDS_WTP_OBJ_AMIGA "objects/object.%d"
38 #define IDS_WTP_OBJ_C64 "object%02d"
39 #define IDS_WTP_OBJ_APPLE "object%d.obj"
40 #define IDS_WTP_OBJ_COCO "obj%02d"
41 #define IDS_WTP_SND_DOS "snd.%02d"
42 #define IDS_WTP_SND_AMIGA "Sounds"
43 #define IDS_WTP_SND_C64 "sound.obj"
44 #define IDS_WTP_SND_APPLE "sound.obj"
45 
46 #define IDS_WTP_FILE_LOGO "logo"
47 #define IDS_WTP_FILE_TITLE "title"
48 #define IDS_WTP_FILE_SAVEGAME "savegame"
49 #define IDS_WTP_FILE_RND "rnd"
50 
51 #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."
52 
53 #define IDS_WTP_INTRO_0 " PRESENT"
54 #define IDS_WTP_INTRO_1 " TM designates trademark of\n Sierra On-Line, Inc.\n (c) 1985 Walt Disney Productions"
55 
56 #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."
57 #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)."
58 
59 #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."
60 #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!"
61 
62 #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 . . .\""
63 #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. . .\""
64 
65 #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."
66 #define IDS_WTP_WIND_1 "But don't worry. Everyone still has theobjects you returned to them.\n\n (Today must be Winds-day!)"
67 #define IDS_WTP_TIGGER "\"Hallooooo, there!!!! It's ME, Tigger! Let's BOUNCE!\""
68 #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."
69 
70 #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."
71 #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."
72 #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!"
73 
74 #define IDS_WTP_NSEW "North South East West"
75 #define IDS_WTP_TAKE "Take"
76 #define IDS_WTP_DROP "Drop"
77 #define IDS_WTP_CANT_GO "\nSorry, but you can't go that way."
78 #define IDS_WTP_CANT_TAKE "You can't take it. You can only carry one object at a time."
79 #define IDS_WTP_CANT_DROP "You can't drop it. Another object is already here."
80 #define IDS_WTP_WRONG_PLACE "\nOk, but it doesn't belong here."
81 #define IDS_WTP_OK "\nOk."
82 
83 #define IDS_WTP_INVENTORY_0 "You are carrying nothing."
84 #define IDS_WTP_INVENTORY_1 "Number of objects still missing: %d"
85 
86 // COMMODORE 64 version strings
87 
88 #define IDS_WTP_FILE_SAVEGAME_C64 "saved game"
89 #define IDS_WTP_DISK_ERROR_C64 "There is a problem with your disk drive.Please make sure your disk is in the drive correctly."
90 #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."
91 #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."
92 #define IDS_WTP_WRONG_PLACE_C64 "\nOk, but this is not the right place."
93 
94 // Amiga strings
95 
96 // original strings from the executable and edited versions for our four-line interface
97 #define IDS_WTP_AMIGA_HELP_0 "Use the mouse to select your choice from\nthe bottom of the screen or the menu.\n\nTo use the keyboard instead of the\nmouse, press the NUMBER or first LETTER\nof what you want."
98 #define IDS_WTP_AMIGA_HELP_1 "From the keyboard you can also press:\n 'l' to look at the scene you're in.\n 'o' to look at an object in the room.\n 'c' to see what you're carrying and\n how you're doing.\n CTRL-S to turn the sound on or off."
99 #define IDS_WTP_AMIGA_HELP_EDITED_0 "Use the mouse to select your choice fromthe bottom of the screen or the menu.\nTo use the keyboard instead of the\nmouse, press the NUMBER or first LETTER."
100 #define IDS_WTP_AMIGA_HELP_EDITED_1 "From the keyboard you can also press:\n <C> to see what you're carrying and\n how you're doing.\n <CTRL-S> to turn the sound on or off."
101 
102 // maximum values
103 
104 #define IDI_WTP_MAX_OBJ_MISSING 10
105 
106 #define IDI_WTP_MAX_ROOM 62
107 #define IDI_WTP_MAX_OBJ 40
108 #define IDI_WTP_MAX_SND 14
109 #define IDI_WTP_MAX_PIC 2
110 
111 #define IDI_WTP_MAX_ROOM_NORMAL 57
112 #define IDI_WTP_MAX_ROOM_TELEPORT 30
113 #define IDI_WTP_MAX_ROOM_OBJ 42
114 #define IDI_WTP_MAX_BLOCK 4
115 #define IDI_WTP_MAX_STR 6
116 #define IDI_WTP_MAX_OBJ_STR 4
117 #define IDI_WTP_MAX_OBJ_STR_END 2
118 #define IDI_WTP_MAX_FLAG 40
119 #define IDI_WTP_MAX_OPTION 3
120 #define IDI_WTP_MAX_DIR 4
121 #define IDI_WTP_MAX_MOVES_UNTIL_WIND 150
122 
123 #define IDI_WTP_TIMER_INTERVAL (10 * 60 * 1000) // 10 minutes on DOS
124 
125 // positions
126 
127 #define IDI_WTP_ROW_MENU 21
128 #define IDI_WTP_ROW_OPTION_1 21
129 #define IDI_WTP_ROW_OPTION_2 22
130 #define IDI_WTP_ROW_OPTION_3 23
131 #define IDI_WTP_ROW_OPTION_4 24
132 
133 #define IDI_WTP_COL_MENU 0
134 #define IDI_WTP_COL_OPTION 1
135 #define IDI_WTP_COL_NSEW 1
136 #define IDI_WTP_COL_NORTH 1
137 #define IDI_WTP_COL_SOUTH 8
138 #define IDI_WTP_COL_EAST 15
139 #define IDI_WTP_COL_WEST 21
140 #define IDI_WTP_COL_TAKE 29
141 #define IDI_WTP_COL_DROP 35
142 #define IDI_WTP_COL_PRESENT 17
143 
144 // data file offset modifiers
145 
146 #define IDI_WTP_OFS_ROOM 0x5400
147 #define IDI_WTP_OFS_OBJ 0x0800
148 
149 // picture
150 
151 #define IDI_WTP_PIC_WIDTH 140
152 #define IDI_WTP_PIC_HEIGHT 159
153 #define IDI_WTP_PIC_X0 10
154 #define IDI_WTP_PIC_Y0 0
155 #define IDI_WTP_PIC_FLAGS IDF_AGI_PIC_V2
156 
157 // selections
158 
159 enum {
160  IDI_WTP_SEL_HOME = -2,
161  IDI_WTP_SEL_BACK,
162  IDI_WTP_SEL_OPT_1,
163  IDI_WTP_SEL_OPT_2,
164  IDI_WTP_SEL_OPT_3,
165  IDI_WTP_SEL_NORTH,
166  IDI_WTP_SEL_SOUTH,
167  IDI_WTP_SEL_EAST,
168  IDI_WTP_SEL_WEST,
169  IDI_WTP_SEL_TAKE,
170  IDI_WTP_SEL_DROP,
171  IDI_WTP_SEL_REAL_OPT_1,
172  IDI_WTP_SEL_REAL_OPT_2,
173  IDI_WTP_SEL_REAL_OPT_3,
174  IDI_WTP_SEL_TIMER_EVENT
175 };
176 
177 #define IDI_WTP_SEL_LAST IDI_WTP_SEL_REAL_OPT_3
178 
179 // rooms
180 
181 enum {
182  IDI_WTP_ROOM_NONE = -1,
183  IDI_WTP_ROOM_NORTH,
184  IDI_WTP_ROOM_SOUTH,
185  IDI_WTP_ROOM_EAST,
186  IDI_WTP_ROOM_WEST
187 };
188 
189 #define IDI_WTP_ROOM_HIDE 0
190 
191 #define IDI_WTP_ROOM_PICNIC 2
192 #define IDI_WTP_ROOM_HOME 28
193 #define IDI_WTP_ROOM_PARTY 58
194 #define IDI_WTP_ROOM_MIST 59
195 #define IDI_WTP_ROOM_TIGGER 61
196 
197 // sound
198 
199 enum ENUM_WTP_SOUND {
200  IDI_WTP_SND_POOH_0 = 1,
201  IDI_WTP_SND_TIGGER,
202  IDI_WTP_SND_TAKE,
203  IDI_WTP_SND_DROP,
204  IDI_WTP_SND_DROP_OK,
205  IDI_WTP_SND_FANFARE,
206  IDI_WTP_SND_POOH_1,
207  IDI_WTP_SND_KEYHELP,
208  IDI_WTP_SND_POOH_2,
209  IDI_WTP_SND_WIND_0,
210  IDI_WTP_SND_WIND_1
211 };
212 
213 // script opcodes
214 
215 #define IDO_WTP_GOTO_ROOM 0x06
216 #define IDO_WTP_PRINT_MSG 0x08
217 #define IDO_WTP_PRINT_STR 0x0A
218 #define IDO_WTP_DROP_OBJ 0x0C
219 #define IDO_WTP_FLAG_CLEAR 0x0E
220 #define IDO_WTP_FLAG_SET 0x10
221 #define IDO_WTP_GAME_OVER 0x12
222 #define IDO_WTP_WALK_MIST 0x14
223 #define IDO_WTP_PLAY_SOUND 0x16
224 #define IDO_WTP_SAVE_GAME 0x18
225 #define IDO_WTP_LOAD_GAME 0x1A
226 #define IDO_WTP_OWL_HELP 0x1C
227 #define IDO_WTP_GOTO_RND 0x1E
228 
229 #define IDO_WTP_OPTION_0 0x15
230 #define IDO_WTP_OPTION_1 0x16
231 #define IDO_WTP_OPTION_2 0x17
232 
233 enum {
234  IDI_WTP_OBJ_DESC = 0,
235  IDI_WTP_OBJ_TAKE,
236  IDI_WTP_OBJ_DROP,
237  IDI_WTP_OBJ_HELP
238 };
239 
240 enum {
241  IDI_WTP_PAR_OK = 0,
242  IDI_WTP_PAR_GOTO,
243  IDI_WTP_PAR_BACK,
244  IDI_WTP_PAR_RELOAD
245 };
246 
247 // room file option block
248 
250  uint16 ofsOpt[IDI_WTP_MAX_BLOCK];
251 };
252 
253 // room file header
254 
255 struct WTP_ROOM_HDR {
256  uint8 roomNumber;
257  uint8 objId;
258  uint16 ofsPic;
259  uint16 fileLen;
260  uint16 reserved0;
261  int8 roomNew[IDI_WTP_MAX_DIR];
262  uint8 objX;
263  uint8 objY;
264  uint16 reserved1;
265  uint16 ofsDesc[IDI_WTP_MAX_BLOCK];
266  uint16 ofsBlock[IDI_WTP_MAX_BLOCK];
267  uint16 ofsStr[IDI_WTP_MAX_STR];
268  uint32 reserved2;
269  WTP_ROOM_BLOCK opt[IDI_WTP_MAX_BLOCK];
270 };
271 
272 // object file header
273 
274 struct WTP_OBJ_HDR {
275  uint16 fileLen;
276  uint16 objId;
277  uint16 ofsEndStr[IDI_WTP_MAX_OBJ_STR_END];
278  uint16 ofsStr[IDI_WTP_MAX_OBJ_STR];
279  uint16 ofsPic;
280 };
281 
282 // savegame
283 
285  uint8 fSound;
286  uint8 nMoves;
287  uint8 nObjMiss;
288  uint8 nObjRet;
289  uint8 iObjHave;
290  uint8 fGame[IDI_WTP_MAX_FLAG];
291  uint8 iUsedObj[IDI_WTP_MAX_OBJ_MISSING];
292  uint8 iObjRoom[IDI_WTP_MAX_ROOM_OBJ];
293 };
294 
295 class PreAgiEngine;
296 
297 class WinnieEngine : public PreAgiEngine {
298 public:
299  WinnieEngine(OSystem *syst, const AGIGameDescription *gameDesc);
300  ~WinnieEngine() override;
301 
302  void init();
303  Common::Error go() override;
304 
305  void debugCurRoom();
306 
307 private:
308  WTP_SAVE_GAME _gameStateWinnie;
309  int _room;
310  int _mist;
311  bool _doWind;
312  bool _tiggerOrMist;
313  bool _timerEnabled;
314  uint32 _timerStart;
315 
316  int _roomOffset;
317  int _objOffset;
318  bool _isBigEndian;
319  Common::Rect hotspotNorth, hotspotSouth, hotspotEast, hotspotWest;
320 
321  void randomize();
322  void intro();
323  void drawPic(const char *);
324  void gameLoop();
325 
326  void parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len);
327  void parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len);
328  uint32 readRoom(int, uint8 *, WTP_ROOM_HDR &);
329 
330  void drawRoomPic();
331  int parser(int, int, uint8 *);
332  int getObjInRoom(int);
333  void getMenuSel(char *, int *, int[]);
334  void keyHelp();
335  void clrMenuSel(int *, int[]);
336  void incMenuSel(int *, int[]);
337  void decMenuSel(int *, int[]);
338  void drawMenu(char *, int, int[]);
339  void printRoomStr(int, int);
340  void inventory();
341  void printObjStr(int, int);
342  uint32 readObj(int, uint8 *);
343  void takeObj(int);
344  bool dropObj(int);
345  bool isRightObj(int, int, int *);
346  void drawObjPic(int, int, int);
347  void getMenuMouseSel(int *, int[], int, int);
348  void setWinnieFlag(int);
349  void clearWinnieFlag(int);
350  void gameOver();
351  void saveGame();
352  void loadGame();
353  void dropObjRnd();
354  void setTakeDrop(int[]);
355  bool makeSel(int *, int[]);
356 
357  void wind();
358  void mist();
359  void tigger();
360  void startTimer();
361  void stopTimer();
362 
363  void showOwlHelp();
364  void showAmigaHelp();
365  bool playSound(ENUM_WTP_SOUND);
366 
367  void printStrWinnie(char *szMsg);
368 };
369 
370 } // End of namespace Agi
371 
372 #endif
Definition: error.h:84
Definition: rect.h:144
Definition: winnie.h:284
Definition: winnie.h:255
Definition: preagi.h:60
Definition: winnie.h:249
Definition: winnie.h:274
Definition: system.h:161
Definition: detection.h:29
Definition: agi.h:63
Definition: winnie.h:297