ScummVM API documentation
room.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 CHAMBER_ROOM_H
23 #define CHAMBER_ROOM_H
24 
25 namespace Chamber {
26 
27 #define SPOTFLG_1 0x01
28 #define SPOTFLG_2 0x02
29 #define SPOTFLG_8 0x08
30 #define SPOTFLG_10 0x10
31 #define SPOTFLG_20 0x20
32 #define SPOTFLG_40 0x40
33 #define SPOTFLG_80 0x80
34 
35 /*static room object*/
36 /*TODO: manipulated from script, do not change*/
37 #include "common/pack-start.h"
38 typedef struct spot_t {
39  byte sx;
40  byte ex;
41  byte sy;
42  byte ey;
43  byte flags;
44  byte hint;
45  uint16 command;
46 } spot_t;
47 #include "common/pack-end.h"
48 
49 #define PERSFLAGS 0xF0
50 #define PERSFLG_10 0x10
51 #define PERSFLG_20 0x20
52 #define PERSFLG_40 0x40
53 #define PERSFLG_80 0x80
54 
55 /*person*/
56 /*TODO: manipulated from script, do not change*/
57 #include "common/pack-start.h"
58 typedef struct pers_t {
59  byte area; /*location*/
60  byte flags; /*flags in bits 7..4 and room index in bits 3..0*/
61  byte name; /*name index*/
62  byte index; /*animations index (in lutins_table) in bits 7..3 , spot index in bits 2..0*/
63  byte item; /*inventory item index (1-based)*/
64 } pers_t;
65 #include "common/pack-end.h"
66 
67 #define ANIMFLG_USESPOT 0x80
68 
69 typedef struct animdesc_t {
70  byte index; /*flag in bit 7, animation index in bits 6..0*/
71  union {
72  struct {
73  byte x, y;
74  } coords;
75  uint16 desc;
76  } params;
77 } animdesc_t;
78 
79 typedef struct vortanims_t {
80  byte room;
81  animdesc_t field_1;
82  animdesc_t field_4;
83  animdesc_t field_7;
84  animdesc_t field_A;
85 } vortanims_t;
86 
87 typedef struct turkeyanims_t {
88  byte room;
89  animdesc_t field_1;
90  animdesc_t field_4;
92 
93 extern byte scratch_mem1[8010];
94 extern byte *scratch_mem2;
95 
96 extern rect_t room_bounds_rect;
97 
98 extern byte last_object_hint;
99 extern byte object_hint;
100 extern byte command_hint;
101 extern byte last_command_hint;
102 
103 extern uint16 next_protozorqs_ticks;
104 extern uint16 next_vorts_ticks;
105 extern uint16 next_vorts_cmd;
106 extern uint16 next_turkey_ticks;
107 extern uint16 next_turkey_cmd;
108 
109 #define MAX_SPRITES 16
110 
111 extern byte *sprites_list[MAX_SPRITES];
112 
113 #define MAX_DOORS 5
114 
115 extern byte *doors_list[MAX_DOORS];
116 
117 extern byte zone_palette;
118 
119 extern spot_t *zone_spots;
120 extern spot_t *zone_spots_end;
121 extern spot_t *zone_spots_cur;
122 
123 extern vortanims_t vortsanim_list[];
124 extern vortanims_t *vortanims_ptr;
125 
126 extern turkeyanims_t turkeyanim_list[];
127 extern turkeyanims_t *turkeyanims_ptr;
128 extern pers_t *aspirant_ptr;
129 extern spot_t *aspirant_spot;
130 extern spot_t *found_spot;
131 extern byte **spot_sprite;
132 
133 extern byte *lutin_mem;
134 
135 extern byte skip_zone_transition;
136 
137 extern byte in_de_profundis;
138 
139 extern byte zone_name;
140 extern byte room_hint_bar_width;
141 extern byte zone_spr_index;
142 extern byte zone_obj_count;
143 extern byte room_hint_bar_coords_x;
144 extern byte room_hint_bar_coords_y;
145 
146 extern uint16 drops_cleanup_time;
147 
148 extern const byte patrol_route[];
149 extern const byte *timed_seq_ptr;
150 
151 typedef struct thewalldoor_t {
152  byte height;
153  byte width;
154  uint16 pitch;
155  uint16 offs;
156  byte *pixels;
157 } thewalldoor_t;
158 
159 extern thewalldoor_t the_wall_doors[2];
160 
161 int16 isInRect(byte x, byte y, rect_t *rect);
162 int16 isCursorInRect(rect_t *rect);
163 void selectSpotCursor(void);
164 
165 void checkHotspots(byte m, byte v);
166 
167 void animateSpot(const animdesc_t *info);
168 byte *loadPuzzlToScratch(byte index);
169 
170 void drawObjectHint(void);
171 void showObjectHint(byte *target);
172 void drawCommandHint(void);
173 void showCommandHint(byte *target);
174 
175 void drawCharacterSprite(byte spridx, byte x, byte y, byte *target);
176 char drawZoneAniSprite(rect_t *rect, uint16 index, byte *target);
177 
178 void drawHintsAndCursor(byte *target);
179 
180 void drawTheWallDoors(void);
181 void mergeSpritesData(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h);
182 void mergeSpritesDataFlip(byte *target, uint16 pitch, byte *source, uint16 w, uint16 h);
183 
184 void refreshSpritesData(void);
185 void blitSpritesToBackBuffer(void);
186 byte *backupSpotImage(spot_t *spot, byte **spotback, byte *buffer);
187 void backupSpotsImages(void);
188 
189 void selectPalette(void);
190 void selectSpecificPalette(byte index);
191 
192 byte findSpotByFlags(byte mask, byte value);
193 byte selectPerson(byte offset);
194 
195 void findPerson(void);
196 
197 void beforeChangeZone(byte index);
198 void drawRoomItemsIndicator(void);
199 void drawRoomStaticObject(byte *aptr, byte *rx, byte *ry, byte *rw, byte *rh);
200 void drawRoomStatics(void);
201 void redrawRoomStatics(byte index, byte y_step);
202 void drawPersons(void);
203 void refreshZone(void);
204 void changeZone(byte index);
205 
206 void drawSpots(byte *target);
207 void animateSpots(byte *target);
208 
209 byte findInitialSpot(void);
210 void animRoomDoorOpen(byte index);
211 void animRoomDoorClose(byte index);
212 
213 uint16 getPuzzlSprite(byte index, byte x, byte y, uint16 *w, uint16 *h, uint16 *ofs);
214 
215 void bounceCurrentItem(byte flags, byte y);
216 
217 void backupScreenOfSpecialRoom(void);
218 void restoreScreenOfSpecialRoom(void);
219 
220 void theWallPhase3_DoorOpen1(void);
221 void theWallPhase0_DoorOpen2(void);
222 void theWallPhase1_DoorClose1(void);
223 void theWallPhase2_DoorClose2(void);
224 
225 void prepareAspirant(void);
226 void prepareVorts(void);
227 void prepareTurkey(void);
228 
229 void updateProtozorqs(void);
230 void checkGameTimeLimit(void);
231 void cleanupDroppedItems(void);
232 
233 void resetAllPersons(void);
234 
235 } // End of namespace Chamber
236 
237 #endif
Definition: common.h:38
Definition: room.h:38
Definition: room.h:79
Definition: room.h:69
Definition: anim.h:25
Definition: room.h:151
Definition: room.h:87
Definition: room.h:58