ScummVM API documentation
game.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 /*
23  * This code is based on original Hugo Trilogy source code
24  *
25  * Copyright (c) 1989-1995 David P. Gray
26  *
27  */
28 
29 #ifndef HUGO_GAME_H
30 #define HUGO_GAME_H
31 
32 #include "common/keyboard.h"
33 
34 namespace Common {
35 class WriteStream;
36 class SeekableReadStream;
37 }
38 
39 namespace Hugo {
40 
41 // Game specific equates
42 #define TAKE_TEXT "Picked up the %s ok."
43 
44 enum {LOOK_NAME = 1, TAKE_NAME}; // Index of name used in showing takeables and in confirming take
45 
46 // Definitions of 'generic' commands: Max # depends on size of gencmd in
47 // the Object record since each requires 1 bit. Currently up to 16
48 enum {LOOK = 1, TAKE = 2, DROP = 4, LOOK_S = 8};
49 
50 enum TEXTCOLORS {
51  _TBLACK, _TBLUE, _TGREEN, _TCYAN,
52  _TRED, _TMAGENTA, _TBROWN, _TWHITE,
53  _TGRAY, _TLIGHTBLUE, _TLIGHTGREEN, _TLIGHTCYAN,
54  _TLIGHTRED, _TLIGHTMAGENTA, _TLIGHTYELLOW, _TBRIGHTWHITE
55 };
56 
57 enum Uif {U_FONT5, U_FONT6, U_FONT8, UIF_IMAGES, NUM_UIF_ITEMS};
58 static const int kFirstFont = U_FONT5;
59 
63 enum Cycle {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleForward, kCycleBackward};
64 
68 enum {SEQ_RIGHT, SEQ_LEFT, SEQ_DOWN, SEQ_UP};
69 
70 enum Font {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS};
71 
75 enum Path {
76  kPathUser, // User has control of object via cursor keys
77  kPathAuto, // Computer has control, controlled by action lists
78  kPathQuiet, // Computer has control and no commands allowed
79  kPathChase, // Computer has control, object is chasing hero
80  kPathChase2, // Same as CHASE, except keeps cycling when stationary
81  kPathWander, // Computer has control, object is wandering randomly
82  kPathWander2 // Same as WANDER, except keeps cycling when stationary
83 };
84 
85 struct hugoBoot { // Common HUGO boot file
86  char _checksum; // Checksum for boot structure (not exit text)
87  char _registered; // TRUE if registered version, else FALSE
88  char _pbswitch[8]; // Playback switch string
89  char _distrib[32]; // Distributor branding string
90  uint16 _exitLen; // Length of exit text (next in file)
91 } PACKED_STRUCT;
92 
96 typedef byte *ImagePtr; // ptr to an object image (sprite)
97 typedef byte *SoundPtr; // ptr to sound (or music) data
98 
102 struct Maze {
103  bool _enabledFl; // TRUE when maze processing enabled
104  byte _size; // Size of (square) maze matrix
105  int _x1, _y1, _x2, _y2; // maze hotspot bounding box
106  int _x3, _x4; // north, south x entry coordinates
107  byte _firstScreenIndex; // index of first screen in maze
108 };
109 
114 struct Seq { // Linked list of images
115  byte *_imagePtr; // ptr to image
116  uint16 _bytesPerLine8; // bytes per line (8bits)
117  uint16 _lines; // lines
118  uint16 _x1, _x2, _y1, _y2; // Offsets from x,y: data bounding box
119  Seq *_nextSeqPtr; // ptr to next record
120 };
121 
125 struct SeqList {
126  uint16 _imageNbr; // Number of images in sequence
127  Seq *_seqPtr; // Ptr to sequence structure
128 };
129 
130 #include "common/pack-start.h" // START STRUCT PACKING
131 struct SoundHdr { // Sound file lookup entry
132  uint16 _size; // Size of sound data in bytes
133  uint32 _offset; // Offset of sound data in file
134 } PACKED_STRUCT;
135 #include "common/pack-end.h" // END STRUCT PACKING
136 
137 static const int kMaxSeqNumb = 4; // Number of sequences of images in object
138 
142 struct Object {
143  uint16 _nounIndex; // String identifying object
144  uint16 _dataIndex; // String describing the object
145  uint16 *_stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions
146  Path _pathType; // Describe path object follows
147  int _vxPath, _vyPath; // Delta velocities (e.g. for CHASE)
148  uint16 _actIndex; // Action list to do on collision with hero
149  byte _seqNumb; // Number of sequences in list
150  Seq *_currImagePtr; // Sequence image currently in use
151  SeqList _seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths
152  Cycle _cycling; // Whether cycling, forward or backward
153  byte _cycleNumb; // No. of times to cycle
154  byte _frameInterval; // Interval (in ticks) between frames
155  byte _frameTimer; // Decrementing timer for above
156  int8 _radius; // Defines sphere of influence by hero
157  byte _screenIndex; // Screen in which object resides
158  int _x, _y; // Current coordinates of object
159  int _oldx, _oldy; // Previous coordinates of object
160  int8 _vx, _vy; // Velocity
161  byte _objValue; // Value of object
162  int _genericCmd; // Bit mask of 'generic' commands for object
163  uint16 _cmdIndex; // ptr to list of cmd structures for verbs
164  bool _carriedFl; // TRUE if object being carried
165  byte _state; // state referenced in cmd list
166  bool _verbOnlyFl; // TRUE if verb-only cmds allowed e.g. sit,look
167  byte _priority; // Whether object fore, background or floating
168  int16 _viewx, _viewy; // Position to view object from (or 0 or -1)
169  int16 _direction; // Direction to view object from
170  byte _curSeqNum; // Save which seq number currently in use
171  byte _curImageNum; // Save which image of sequence currently in use
172  int8 _oldvx; // Previous vx (used in wandering)
173  int8 _oldvy; // Previous vy
174 };
175 } // End of namespace Hugo
176 
177 #endif
Definition: console.h:27
byte * ImagePtr
Definition: game.h:96
Cycle
Definition: game.h:63
Path
Definition: game.h:75
Definition: algorithm.h:29
Definition: game.h:125
Definition: game.h:85
Definition: game.h:131
Definition: game.h:102
Definition: game.h:114
Definition: game.h:142