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