ScummVM API documentation
gfx.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  * Based on the Reverse Engineering work of Christophe Fontanel,
24  * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/)
25  */
26 
27 #ifndef DM_GFX_H
28 #define DM_GFX_H
29 
30 #include "common/scummsys.h"
31 #include "common/rect.h"
32 #include "common/memstream.h"
33 #include "common/array.h"
34 
35 #include "dm/dm.h"
36 
37 namespace DM {
38 
39 enum ViewFloor {
40  kDMViewFloorD3L = 0, // @ C0_VIEW_FLOOR_D3L
41  kDMViewFloorD3C = 1, // @ C1_VIEW_FLOOR_D3C
42  kDMViewFloorD3R = 2, // @ C2_VIEW_FLOOR_D3R
43  kDMViewFloorD2L = 3, // @ C3_VIEW_FLOOR_D2L
44  kDMViewFloorD2C = 4, // @ C4_VIEW_FLOOR_D2C
45  kDMViewFloorD2R = 5, // @ C5_VIEW_FLOOR_D2R
46  kDMViewFloorD1L = 6, // @ C6_VIEW_FLOOR_D1L
47  kDMViewFloorD1C = 7, // @ C7_VIEW_FLOOR_D1C
48  kDMViewFloorD1R = 8 // @ C8_VIEW_FLOOR_D1R
49 };
50 
51 enum DoorState {
52  kDMDoorStateOpen = 0, // @ C0_DOOR_STATE_OPEN
53  kDMDoorStateOneFourth = 1, // @ C1_DOOR_STATE_CLOSED_ONE_FOURTH
54  kDMDoorStateHalf = 2, // @ k2_DoorStateAspect_CLOSED_HALF
55  kDMDoorStateThreeFourth = 3, // @ C3_DOOR_STATE_CLOSED_THREE_FOURTH
56  kDMDoorStateClosed = 4, // @ C4_DOOR_STATE_CLOSED
57  kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED
58 };
59 
60 enum DoorOrnament {
61  kDMDoorOrnamentD3LCR = 0, // @ C0_VIEW_DOOR_ORNAMENT_D3LCR
62  kDMDoorOrnamentD2LCR = 1, // @ C1_VIEW_DOOR_ORNAMENT_D2LCR
63  kDMDoorOrnamentD1LCR = 2 // @ C2_VIEW_DOOR_ORNAMENT_D1LCR
64 };
65 
66 enum DoorButton {
67  kDMDoorButtonD3R = 0, // @ C0_VIEW_DOOR_BUTTON_D3R
68  kDMDoorButtonD3C = 1, // @ C1_VIEW_DOOR_BUTTON_D3C
69  kDMDoorButtonD2C = 2, // @ C2_VIEW_DOOR_BUTTON_D2C
70  kDMDoorButtonD1C = 3 // @ C3_VIEW_DOOR_BUTTON_D1C
71 };
72 
73 /* View lanes */
74 enum ViewLane {
75  kDMViewLaneCenter = 0, // @ C0_VIEW_LANE_CENTER
76  kDMViewLaneLeft = 1, // @ C1_VIEW_LANE_LEFT
77  kDMViewLaneRight = 2 // @ C2_VIEW_LANE_RIGHT
78 };
79 
80 /* Explosion aspects */
81 enum ExplosionAspectEnum {
82  kDMExplosionAspectFire = 0, // @ C0_EXPLOSION_ASPECT_FIRE
83  kDMExplosionAspectSpell = 1, // @ C1_EXPLOSION_ASPECT_SPELL
84  kDMExplosionAspectPoison = 2, // @ C2_EXPLOSION_ASPECT_POISON
85  kDMExplosionAspectSmoke = 3 // @ C3_EXPLOSION_ASPECT_SMOKE
86 };
87 
88 enum WallSet {
89  kDMWallSetStone = 0 // @ C0_WALL_SET_STONE
90 };
91 
92 enum FloorSet {
93  kDMFloorSetStone = 0 // @ C0_FLOOR_SET_STONE
94 };
95 
96 enum ViewWall {
97  kDMViewWallD3LRight = 0, // @ C00_VIEW_WALL_D3L_RIGHT
98  kDMViewWallD3RLeft = 1, // @ C01_VIEW_WALL_D3R_LEFT
99  kDMViewWallD3LFront = 2, // @ C02_VIEW_WALL_D3L_FRONT
100  kDMViewWallD3CFront = 3, // @ C03_VIEW_WALL_D3C_FRONT
101  kDMViewWallD3RFront = 4, // @ C04_VIEW_WALL_D3R_FRONT
102  kDMViewWallD2LRight = 5, // @ C05_VIEW_WALL_D2L_RIGHT
103  kDMViewWallD2RLeft = 6, // @ C06_VIEW_WALL_D2R_LEFT
104  kDMViewWallD2LFront = 7, // @ C07_VIEW_WALL_D2L_FRONT
105  kDMViewWallD2CFront = 8, // @ C08_VIEW_WALL_D2C_FRONT
106  kDMViewWallD2RFront = 9, // @ C09_VIEW_WALL_D2R_FRONT
107  kDMViewWallD1LRight = 10, // @ C10_VIEW_WALL_D1L_RIGHT
108  kDMViewWallD1RLeft = 11, // @ C11_VIEW_WALL_D1R_LEFT
109  kDMViewWallD1CFront = 12 // @ C12_VIEW_WALL_D1C_FRONT
110 };
111 
112 enum CellOrder {
113  kDMCellOrderNone = 0xFFFF,
114  kDMCellOrderAlcove = 0x0000, // @ C0000_CELL_ORDER_ALCOVE
115  kDMCellOrderBackLeft = 0x0001, // @ C0001_CELL_ORDER_BACKLEFT
116  kDMCellOrderBackRight = 0x0002, // @ C0002_CELL_ORDER_BACKRIGHT
117  kDMCellOrderDoorPass1BackLeft = 0x0018, // @ C0018_CELL_ORDER_DOORPASS1_BACKLEFT
118  kDMCellOrderBackLeftBackRight = 0x0021, // @ C0021_CELL_ORDER_BACKLEFT_BACKRIGHT
119  kDMCellOrderDoorPass1BackRight = 0x0028, // @ C0028_CELL_ORDER_DOORPASS1_BACKRIGHT
120  kDMCellOrderBackRightFrontRight = 0x0032, // @ C0032_CELL_ORDER_BACKRIGHT_FRONTRIGHT
121  kDMCellOrderDoorPass2FrontRight = 0x0039, // @ C0039_CELL_ORDER_DOORPASS2_FRONTRIGHT
122  kDMCellOrderBackLeftFrontLeft = 0x0041, // @ C0041_CELL_ORDER_BACKLEFT_FRONTLEFT
123  kDMCellOrderDoorPass2FrontLeft = 0x0049, // @ C0049_CELL_ORDER_DOORPASS2_FRONTLEFT
124  kDMCellOrderDoorPass1BackRightBackLeft = 0x0128, // @ C0128_CELL_ORDER_DOORPASS1_BACKRIGHT_BACKLEFT
125  kDMCellOrderDoorPass1BackLeftBackRight = 0x0218, // @ C0218_CELL_ORDER_DOORPASS1_BACKLEFT_BACKRIGHT
126  kDMCellOrderBackLeftBackRightFrontRight = 0x0321, // @ C0321_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTRIGHT
127  kDMCellOrderBackRightFrontLeftFrontRight = 0x0342, // @ C0342_CELL_ORDER_BACKRIGHT_FRONTLEFT_FRONTRIGHT
128  kDMCellOrderDoorPass2FrontLeftFrontRight = 0x0349, // @ C0349_CELL_ORDER_DOORPASS2_FRONTLEFT_FRONTRIGHT
129  kDMCellOrderBackRightBackLeftFrontLeft = 0x0412, // @ C0412_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTLEFT
130  kDMCellOrderBackLeftFrontRightFrontLeft = 0x0431, // @ C0431_CELL_ORDER_BACKLEFT_FRONTRIGHT_FRONTLEFT
131  kDMCellOrderDoorPass2FrontRightFrontLeft = 0x0439, // @ C0439_CELL_ORDER_DOORPASS2_FRONTRIGHT_FRONTLEFT
132  kDMCellOrderBackLeftBackRightFrontLeftFrontRight = 0x3421, // @ C3421_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTLEFT_FRONTRIGHT
133  kDMCellOrderBackRightBackLeftFrontRightFrontLeft = 0x4312 // @ C4312_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTRIGHT_FRONTLEFT
134 };
135 
136 enum DerivedBitmap {
137  kDMDerivedBitmapViewport = 0, // @ C000_DERIVED_BITMAP_VIEWPORT
138  kDMDerivedBitmapThievesEyeVisibleArea = 1, // @ C001_DERIVED_BITMAP_THIEVES_EYE_VISIBLE_AREA
139  kDMDerivedBitmapDamageToCreatureMedium = 2, // @ C002_DERIVED_BITMAP_DAMAGE_TO_CREATURE_MEDIUM
140  kDMDerivedBitmapDamageToCreatureSmall = 3, // @ C003_DERIVED_BITMAP_DAMAGE_TO_CREATURE_SMALL
141  kDMDerivedBitmapFirstWallOrnament = 4, // @ C004_DERIVED_BITMAP_FIRST_WALL_ORNAMENT
142  kDMDerivedBitmapFirstDoorOrnamentD3 = 68, // @ C068_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D3
143  kDMDerivedBitmapFirstDoorOrnamentD2 = 69, // @ C069_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D2
144  kDMDerivedBitmapFirstDoorButton = 102, // @ C102_DERIVED_BITMAP_FIRST_DOOR_BUTTON
145  kDMDerivedBitmapFirstObject = 104, // @ C104_DERIVED_BITMAP_FIRST_OBJECT
146  kDMDerivedBitmapFirstProjectile = 282, // @ C282_DERIVED_BITMAP_FIRST_PROJECTILE
147  kDMDerivedBitmapFirstExplosion = 438, // @ C438_DERIVED_BITMAP_FIRST_EXPLOSION
148  kDMDerivedBitmapFirstCreature = 495 // @ C495_DERIVED_BITMAP_FIRST_CREATURE
149 };
150 
151 enum ViewSquare {
152  kDMViewSquareD4C = -3, // @ CM3_VIEW_SQUARE_D4C
153  kViewSquareD4L = -2, // @ CM2_VIEW_SQUARE_D4L
154  kDMViewSquareD4R = -1, // @ CM1_VIEW_SQUARE_D4R
155  kDMViewSquareD3C = 0, // @ C00_VIEW_SQUARE_D3C
156  kDMViewSquareD3L = 1, // @ C01_VIEW_SQUARE_D3L
157  kDMViewSquareD3R = 2, // @ C02_VIEW_SQUARE_D3R
158  kDMViewSquareD2C = 3, // @ C03_VIEW_SQUARE_D2C
159  kDMViewSquareD2L = 4, // @ C04_VIEW_SQUARE_D2L
160  kDMViewSquareD2R = 5, // @ C05_VIEW_SQUARE_D2R
161  kDMViewSquareD1C = 6, // @ C06_VIEW_SQUARE_D1C
162  kDMViewSquareD1L = 7, // @ C07_VIEW_SQUARE_D1L
163  kDMViewSquareD1R = 8, // @ C08_VIEW_SQUARE_D1R
164  kDMViewSquareD0C = 9, // @ C09_VIEW_SQUARE_D0C
165  kDMViewSquareD0L = 10, // @ C10_VIEW_SQUARE_D0L
166  kDMViewSquareD0R = 11, // @ C11_VIEW_SQUARE_D0R
167  kDMViewSquareD3CExplosion = 3, // @ C03_VIEW_SQUARE_D3C_EXPLOSION
168  kDMViewSquareD3LExplosion = 4, // @ C04_VIEW_SQUARE_D3L_EXPLOSION
169  kDMViewSquareD1CExplosion = 9, // @ C09_VIEW_SQUARE_D1C_EXPLOSION
170  kDMViewSquareD0CExplosion = 12 // @ C12_VIEW_SQUARE_D0C_EXPLOSION
171 };
172 
173 enum ViewCell {
174  kDMViewCellFronLeft = 0, // @ C00_VIEW_CELL_FRONT_LEFT
175  kDMViewCellFrontRight = 1, // @ C01_VIEW_CELL_FRONT_RIGHT
176  kDMViewCellBackRight = 2, // @ C02_VIEW_CELL_BACK_RIGHT
177  kDMViewCellBackLeft = 3, // @ C03_VIEW_CELL_BACK_LEFT
178  kDMViewCellAlcove = 4, // @ C04_VIEW_CELL_ALCOVE
179  kDMViewCellDoorButtonOrWallOrn = 5 // @ C05_VIEW_CELL_DOOR_BUTTON_OR_WALL_ORNAMENT
180 };
181 
182 enum Color {
183  kDMColorNoTransparency = -1,
184  kDMColorBlack = 0,
185  kDMColorDarkGary = 1,
186  kDMColorLightGray = 2,
187  kDMColorDarkBrown = 3,
188  kDMColorCyan = 4,
189  kDMColorLightBrown = 5,
190  kDMColorDarkGreen = 6,
191  kDMColorLightGreen = 7,
192  kDMColorRed = 8,
193  kDMColorGold = 9,
194  kDMColorFlesh = 10,
195  kDMColorYellow = 11,
196  kDMColorDarkestGray = 12,
197  kDMColorLightestGray = 13,
198  kDMColorBlue = 14,
199  kDMColorWhite = 15
200 };
201 
202 enum GraphicIndice {
203  kDMGraphicIdxDialogBox = 0, // @ C000_GRAPHIC_DIALOG_BOX
204  kDMGraphicIdxTitle = 1, // @ C001_GRAPHIC_TITLE
205  kDMGraphicIdxEntranceLeftDoor = 2, // @ C002_GRAPHIC_ENTRANCE_LEFT_DOOR
206  kDMGraphicIdxEntranceRightDoor = 3, // @ C003_GRAPHIC_ENTRANCE_RIGHT_DOOR
207  kDMGraphicIdxEntrance = 4, // @ C004_GRAPHIC_ENTRANCE
208  kDMGraphicIdxCredits = 5, // @ C005_GRAPHIC_CREDITS
209  kDMGraphicIdxTheEnd = 6, // @ C006_GRAPHIC_THE_END
210  kDMGraphicIdxStatusBoxDeadChampion = 8, // @ C008_GRAPHIC_STATUS_BOX_DEAD_CHAMPION
211  kDMGraphicIdxMenuSpellAreaBackground = 9, // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND
212  kDMGraphicIdxMenuActionArea = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA
213  kDMGraphicIdxMenuSpellAreLines = 11, // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES
214  kDMGraphicIdxMovementArrows = 13, // @ C013_GRAPHIC_MOVEMENT_ARROWS
215  kDMGraphicIdxDamageToCreature = 14, // @ C014_GRAPHIC_DAMAGE_TO_CREATURE
216  kDMGraphicIdxDamageToChampionSmall = 15, // @ C015_GRAPHIC_DAMAGE_TO_CHAMPION_SMALL
217  kDMGraphicIdxDamageToChampionBig = 16, // @ C016_GRAPHIC_DAMAGE_TO_CHAMPION_BIG
218  kDMGraphicIdxInventory = 17, // @ C017_GRAPHIC_INVENTORY
219  kDMGraphicIdxArrowForChestContent = 18, // @ C018_GRAPHIC_ARROW_FOR_CHEST_CONTENT
220  kDMGraphicIdxEyeForObjectDescription = 19, // @ C019_GRAPHIC_EYE_FOR_OBJECT_DESCRIPTION
221  kDMGraphicIdxPanelEmpty = 20, // @ C020_GRAPHIC_PANEL_EMPTY
222  kDMGraphicIdxPanelOpenScroll = 23, // @ C023_GRAPHIC_PANEL_OPEN_SCROLL
223  kDMGraphicIdxPanelOpenChest = 25, // @ C025_GRAPHIC_PANEL_OPEN_CHEST
224  kDMGraphicIdxChampionPortraits = 26, // @ C026_GRAPHIC_CHAMPION_PORTRAITS
225  kDMGraphicIdxPanelRenameChampion = 27, // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION
226  kDMGraphicIdxChampionIcons = 28, // @ C028_GRAPHIC_CHAMPION_ICONS
227  kDMGraphicIdxObjectDescCircle = 29, // @ C029_GRAPHIC_OBJECT_DESCRIPTION_CIRCLE
228  kDMGraphicIdxFoodLabel = 30, // @ C030_GRAPHIC_FOOD_LABEL
229  kDMGraphicIdxWaterLabel = 31, // @ C031_GRAPHIC_WATER_LABEL
230  kDMGraphicIdxPoisionedLabel = 32, // @ C032_GRAPHIC_POISONED_LABEL
231  kDMGraphicIdxSlotBoxNormal = 33, // @ C033_GRAPHIC_SLOT_BOX_NORMAL
232  kDMGraphicIdxSlotBoxWounded = 34, // @ C034_GRAPHIC_SLOT_BOX_WOUNDED
233  kDMGraphicIdxSlotBoxActingHand = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND
234  kDMGraphicIdxBorderPartyShield = 37, // @ C037_GRAPHIC_BORDER_PARTY_SHIELD
235  kDMGraphicIdxBorderPartyFireshield = 38, // @ C038_GRAPHIC_BORDER_PARTY_FIRESHIELD
236  kDMGraphicIdxBorderPartySpellshield = 39, // @ C039_GRAPHIC_BORDER_PARTY_SPELLSHIELD
237  kDMGraphicIdxPanelResurectReincarnate = 40, // @ C040_GRAPHIC_PANEL_RESURRECT_REINCARNATE
238  kDMGraphicIdxHoleInWall = 41, // @ C041_GRAPHIC_HOLE_IN_WALL
239  kDMGraphicIdxObjectIcons000To031 = 42, // @ C042_GRAPHIC_OBJECT_ICONS_000_TO_031
240  kDMGraphicIdxObjectIcons032To063 = 43, // @ C043_GRAPHIC_OBJECT_ICONS_032_TO_063
241  kDMGraphicIdxObjectIcons064To095 = 44, // @ C044_GRAPHIC_OBJECT_ICONS_064_TO_095
242  kDMGraphicIdxObjectIcons096To127 = 45, // @ C045_GRAPHIC_OBJECT_ICONS_096_TO_127
243  kDMGraphicIdxObjectIcons128To159 = 46, // @ C046_GRAPHIC_OBJECT_ICONS_128_TO_159
244  kDMGraphicIdxObjectIcons160To191 = 47, // @ C047_GRAPHIC_OBJECT_ICONS_160_TO_191
245  kDMGraphicIdxObjectIcons192To223 = 48, // @ C048_GRAPHIC_OBJECT_ICONS_192_TO_223
246  kDMGraphicIdxFloorPitD3L = 49, // @ C049_GRAPHIC_FLOOR_PIT_D3L
247  kDMGraphicIdxFloorPitD3C = 50, // @ C050_GRAPHIC_FLOOR_PIT_D3C
248  kDMGraphicIdxFloorPitD2L = 51, // @ C051_GRAPHIC_FLOOR_PIT_D2L
249  kDMGraphicIdxFloorPitD2C = 52, // @ C052_GRAPHIC_FLOOR_PIT_D2C
250  kDMGraphicIdxFloorPitD1L = 53, // @ C053_GRAPHIC_FLOOR_PIT_D1L
251  kDMGraphicIdxFloorPitD1C = 54, // @ C054_GRAPHIC_FLOOR_PIT_D1C
252  kDMGraphicIdxFloorPitD0L = 55, // @ C055_GRAPHIC_FLOOR_PIT_D0L
253  kDMGraphicIdxFloorPitD0C = 56, // @ C056_GRAPHIC_FLOOR_PIT_D0C
254  kDMGraphicIdxFloorPitInvisibleD2L = 57, // @ C057_GRAPHIC_FLOOR_PIT_INVISIBLE_D2L
255  kDMGraphicIdxFloorPitInvisibleD2C = 58, // @ C058_GRAPHIC_FLOOR_PIT_INVISIBLE_D2C
256  kDMGraphicIdxFloorPitInvisibleD1L = 59, // @ C059_GRAPHIC_FLOOR_PIT_INVISIBLE_D1L
257  kDMGraphicIdxFloorPitInvisibleD1C = 60, // @ C060_GRAPHIC_FLOOR_PIT_INVISIBLE_D1C
258  kDMGraphicIdxFloorPitInvisibleD0L = 61, // @ C061_GRAPHIC_FLOOR_PIT_INVISIBLE_D0L
259  kDMGraphicIdxFloorPitInvisibleD0C = 62, // @ C062_GRAPHIC_FLOOR_PIT_INVISIBLE_D0C
260  kDMGraphicIdxCeilingPitD2L = 63, // @ C063_GRAPHIC_CEILING_PIT_D2L
261  kDMGraphicIdxCeilingPitD2C = 64, // @ C064_GRAPHIC_CEILING_PIT_D2C
262  kDMGraphicIdxCeilingPitD1L = 65, // @ C065_GRAPHIC_CEILING_PIT_D1L
263  kDMGraphicIdxCeilingPitD1C = 66, // @ C066_GRAPHIC_CEILING_PIT_D1C
264  kDMGraphicIdxCeilingPitD0L = 67, // @ C067_GRAPHIC_CEILING_PIT_D0L
265  kDMGraphicIdxCeilingPitD0C = 68, // @ C068_GRAPHIC_CEILING_PIT_D0C
266  kDMGraphicIdxFieldMaskD3R = 69, // @ C069_GRAPHIC_FIELD_MASK_D3R
267  kDMGraphicIdxFieldTeleporter = 73, // @ C073_GRAPHIC_FIELD_TELEPORTER
268  kDMGraphicIdxInscriptionFont = 120, // @ C120_GRAPHIC_INSCRIPTION_FONT
269  kDMGraphicIdxWallOrnChampMirror = 208, // @ C208_GRAPHIC_WALL_ORNAMENT_43_CHAMPION_MIRROR
270  kDMGraphicIdxFloorOrnD3LFootprints = 241, // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS
271  kDMGraphicIdxDoorMaskDestroyed = 301, // @ C301_GRAPHIC_DOOR_MASK_DESTROYED
272  kDMGraphicIdxFirstDoorButton = 315, // @ C315_GRAPHIC_FIRST_DOOR_BUTTON
273  kDMGraphicIdxFirstProjectile = 316, // @ C316_GRAPHIC_FIRST_PROJECTILE
274  kDMGraphicIdxFirstExplosion = 348, // @ C348_GRAPHIC_FIRST_EXPLOSION
275  kDMGraphicIdxFirstExplosionPattern = 351, // @ C351_GRAPHIC_FIRST_EXPLOSION_PATTERN
276  kDMGraphicIdxFirstObject = 360, // @ C360_GRAPHIC_FIRST_OBJECT
277  kDMGraphicIdxFirstCreature = 446, // @ C446_GRAPHIC_FIRST_CREATURE
278  kDMGraphicIdxFont = 557 // @ C557_GRAPHIC_FONT
279 };
280 
281 #define kDMMaskDoorInfoCreaturesCanSeeThrough 0x0001 // @ MASK0x0001_CREATURES_CAN_SEE_THROUGH
282 #define kDMMaskDoorInfoProjectilesCanPassThrough 0x0002 // @ MASK0x0002_PROJECTILES_CAN_PASS_THROUGH
283 #define kDMMaskDoorInfoAnimated 0x0004 // @ MASK0x0004_ANIMATED
284 #define kDMMaskDoorFront 0x0008 // @ MASK0x0008_DOOR_FRONT
285 
286 /* Field Aspect Mask */
287 #define kMaskFieldAspectFlipMask 0x0080 // @ MASK0x0080_FLIP_MASK
288 #define kMaskFieldAspectIndex 0x007F // @ MASK0x007F_MASK_INDEX
289 #define kMaskFieldAspectNoMask 255 // @ C255_NO_MASK
290 
291 #define kDMCreatureMaskAdditional 0x0003 // @ MASK0x0003_ADDITIONAL
292 #define kDMCreatureMaskFlipNonAttack 0x0004 // @ MASK0x0004_FLIP_NON_ATTACK
293 #define kDMCreatureMaskSide 0x0008 // @ MASK0x0008_SIDE
294 #define kDMCreatureMaskBack 0x0010 // @ MASK0x0010_BACK
295 #define kDMCreatureMaskAttack 0x0020 // @ MASK0x0020_ATTACK
296 #define kDMCreatureMaskSpecialD2Front 0x0080 // @ MASK0x0080_SPECIAL_D2_FRONT
297 #define kDMCreatureMaskSpecialD2FrontIsFlipped 0x0100 // @ MASK0x0100_SPECIAL_D2_FRONT_IS_FLIPPED_FRONT
298 #define kDMCreatureMaskFlipAttack 0x0200 // @ MASK0x0200_FLIP_ATTACK
299 #define kDMCreatureMaskFlipDuringAttack 0x0400 // @ MASK0x0400_FLIP_DURING_ATTACK
300 
301 #define k2_FloorSetGraphicCount 2 // @ C002_FLOOR_SET_GRAPHIC_COUNT
302 #define k13_WallSetGraphicCount 13 // @ C013_WALL_SET_GRAPHIC_COUNT
303 #define k18_StairsGraphicCount 18 // @ C018_STAIRS_GRAPHIC_COUNT
304 #define k3_DoorSetGraphicsCount 3 // @ C003_DOOR_SET_GRAPHIC_COUNT
305 #define k1_DoorButtonCount 1 // @ C001_DOOR_BUTTON_COUNT
306 #define k3_AlcoveOrnCount 3 // @ C003_ALCOVE_ORNAMENT_COUNT
307 #define k1_FountainOrnCount 1 // @ C001_FOUNTAIN_ORNAMENT_COUNT
308 #define k27_CreatureTypeCount 27 // @ C027_CREATURE_TYPE_COUNT
309 #define k4_ExplosionAspectCount 4 // @ C004_EXPLOSION_ASPECT_COUNT
310 #define k14_ProjectileAspectCount 14 // @ C014_PROJECTILE_ASPECT_COUNT
311 #define k85_ObjAspectCount 85 // @ C085_OBJECT_ASPECT_COUNT
312 
313 #define k0_HalfSizedViewCell_LeftColumn 0 // @ C00_VIEW_CELL_LEFT_COLUMN
314 #define k1_HalfSizedViewCell_RightColumn 1 // @ C01_VIEW_CELL_RIGHT_COLUMN
315 #define k2_HalfSizedViewCell_BackRow 2 // @ C02_VIEW_CELL_BACK_ROW
316 #define k3_HalfSizedViewCell_CenterColumn 3 // @ C03_VIEW_CELL_CENTER_COLUMN
317 #define k4_HalfSizedViewCell_FrontRow 4 // @ C04_VIEW_CELL_FRONT_ROW
318 
319 /* Shift sets */
320 #define k0_ShiftSet_D0BackD1Front 0 // @ C0_SHIFT_SET_D0_BACK_OR_D1_FRONT
321 #define k1_ShiftSet_D1BackD2Front 1 // @ C1_SHIFT_SET_D1_BACK_OR_D2_FRONT
322 #define k2_ShiftSet_D2BackD3Front 2 // @ C2_SHIFT_SET_D2_BACK_OR_D3_FRONT
323 
324 #define k75_FirstFloorSet 75 // @ C075_GRAPHIC_FIRST_FLOOR_SET
325 #define k77_FirstWallSet 77 // @ C077_GRAPHIC_FIRST_WALL_SET
326 #define k90_FirstStairs 90 // @ C090_GRAPHIC_FIRST_STAIRS
327 #define k108_FirstDoorSet 108 // @ C108_GRAPHIC_FIRST_DOOR_SET
328 #define k120_InscriptionFont 120 // @ C120_GRAPHIC_INSCRIPTION_FONT
329 #define k121_FirstWallOrn 121 // @ C121_GRAPHIC_FIRST_WALL_ORNAMENT
330 #define k247_FirstFloorOrn 247 // @ C247_GRAPHIC_FIRST_FLOOR_ORNAMENT
331 #define k303_FirstDoorOrn 303 // @ C303_GRAPHIC_FIRST_DOOR_ORNAMENT
332 #define k730_DerivedBitmapMaximumCount 730 // @ C730_DERIVED_BITMAP_MAXIMUM_COUNT
333 
334 #define k16_Scale_D3 16 // @ C16_SCALE_D3
335 #define k20_Scale_D2 20 // @ C20_SCALE_D2
336 
337 /* Object aspect GraphicInfo */
338 #define k0x0001_ObjectFlipOnRightMask 0x0001 // @ MASK0x0001_FLIP_ON_RIGHT
339 #define k0x0010_ObjectAlcoveMask 0x0010 // @ MASK0x0010_ALCOVE
340 
341 /* Projectile aspect GraphicInfo */
342 #define k0x0010_ProjectileSideMask 0x0010 // @ MASK0x0010_SIDE
343 #define k0x0100_ProjectileScaleWithKineticEnergyMask 0x0100 // @ MASK0x0100_SCALE_WITH_KINETIC_ENERGY
344 #define k0x0003_ProjectileAspectTypeMask 0x0003 // @ MASK0x0003_ASPECT_TYPE
345 
346 /* Projectile aspect type */
347 #define k0_ProjectileAspectHasBackGraphicRotation 0 // @ C0_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_ROTATION
348 #define k1_ProjectileAspectBackGraphic 1 // @ C1_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_NO_ROTATION
349 #define k2_ProjectileAspectHasRotation 2 // @ C2_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_ROTATION
350 #define k3_ProjectileAspectHasNone 3 // @ C3_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_NO_ROTATION
351 
352 /* Projectile aspects */
353 #define k3_ProjectileAspectExplosionLightningBolt 3 // @ C03_PROJECTILE_ASPECT_EXPLOSION_LIGHTNING_BOLT
354 #define k10_ProjectileAspectExplosionFireBall 10 // @ C10_PROJECTILE_ASPECT_EXPLOSION_FIREBALL
355 #define k11_ProjectileAspectExplosionDefault 11 // @ C11_PROJECTILE_ASPECT_EXPLOSION_DEFAULT
356 #define k12_ProjectileAspectExplosionSlime 12 // @ C12_PROJECTILE_ASPECT_EXPLOSION_SLIME
357 #define k13_ProjectileAspectExplosionPoisonBoltCloud 13 // @ C13_PROJECTILE_ASPECT_EXPLOSION_POISON_BOLT_POISON_CLOUD
358 
359 #define k0x0080_BlitDoNotUseMask 0x0080 // @ MASK0x0080_DO_NOT_USE_MASK
360 #define kScaleThreshold 32768
361 
363 public:
364  uint16 _byteWidth;
365  uint16 _height;
366 
367  ExplosionAspect(uint16 byteWidth, uint16 height) :_byteWidth(byteWidth), _height(height) {}
368  ExplosionAspect() : _byteWidth(0), _height(0) {}
369 }; // @ EXPLOSION_ASPECT
370 
371 // in all cases, where a function takes a Box, it expects it to contain inclusive boundaries
372 class Box {
373 public:
374  Common::Rect _rect;
375 
376  Box(int16 x1, int16 x2, int16 y1, int16 y2) {
377  // +1 because Rect.constains is not inclusive for right and bottom, at the opposite of the isPointInside
378  _rect = Common::Rect(x1, y1, x2, y2);
379  }
380 
381  Box() = default;
382 
383  bool isPointInside(Common::Point point) {
384  // not using Common::Rect::contains() because we need both boundaries to be included
385  return (_rect.left <= point.x) && (point.x <= _rect.right) && (_rect.top <= point.y) && (point.y <= _rect.bottom);
386  }
387 
388  bool isPointInside(int16 x, int16 y) {
389  return isPointInside(Common::Point(x, y));
390  }
391 
392  void setToZero() { _rect = Common::Rect(0, 0, 0, 0); }
393 }; // @ BOX_BYTE, BOX_WORD
394 
395 extern Box g2_BoxMovementArrows; // @ G0002_s_Graphic562_Box_MovementArrows
396 
397 class Frame {
398 public:
399  Box _box;
400  uint16 _srcByteWidth, _srcHeight;
401  uint16 _srcX, _srcY;
402 
403  Frame(){
404  _srcByteWidth = _srcHeight = 0;
405  _srcX = _srcY = 0;
406  }
407 
408  Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
409  uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) :
410  _box(destFromX, destToX, destFromY, destToY),
411  _srcByteWidth(srcWidth), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {}
412 };
413 
414 class FieldAspect {
415 public:
416  uint16 _nativeBitmapRelativeIndex;
417  uint16 _baseStartUnitIndex; /* Index of the unit (16 pixels = 8 bytes) in bitmap where blit will start from. A random value of 0 or 1 is added to this base index */
418  uint16 _transparentColor; /* Bit 7: Do not use mask if set, Bits 6-0: Transparent color index. 0xFF = no transparency */
419  byte _mask; /* Bit 7: Flip, Bits 6-0: Mask index. 0xFF = no mask */
420  uint16 _byteWidth;
421  uint16 _height;
422  uint16 _xPos;
423  uint16 _bitplaneWordCount;
424  FieldAspect(uint16 native, uint16 base, uint16 transparent, byte mask, uint16 byteWidth, uint16 height, uint16 xPos, uint16 bitplane);
425  FieldAspect();
426 }; // @ FIELD_ASPECT
427 
429 public:
430  uint16 _firstNativeBitmapRelativeIndex;
431  uint16 _firstDerivedBitmapIndex;
432  byte _byteWidthFront;
433  byte _heightFront;
434  byte _byteWidthSide;
435  byte _heightSide;
436  byte _byteWidthAttack;
437  byte _heightAttack;
438 private:
439  byte _coordinateSet_TransparentColor;
440  byte _replacementColorSetIndices;
441 public:
442 
443  CreatureAspect(uint16 uint161, uint16 uint162, byte byte0, byte byte1, byte byte2, byte byte3, byte byte4, byte byte5, byte byte6, byte byte7)
444  : _firstNativeBitmapRelativeIndex(uint161), _firstDerivedBitmapIndex(uint162), _byteWidthFront(byte0),
445  _heightFront(byte1), _byteWidthSide(byte2), _heightSide(byte3), _byteWidthAttack(byte4),
446  _heightAttack(byte5), _coordinateSet_TransparentColor(byte6), _replacementColorSetIndices(byte7) {}
447 
448  CreatureAspect() :
449  _firstNativeBitmapRelativeIndex(0), _firstDerivedBitmapIndex(0), _byteWidthFront(0),
450  _heightFront(0), _byteWidthSide(0), _heightSide(0), _byteWidthAttack(0),
451  _heightAttack(0), _coordinateSet_TransparentColor(0), _replacementColorSetIndices(0) {}
452 
453  byte getCoordSet() { return (_coordinateSet_TransparentColor >> 4) & 0xF; } // @ M71_COORDINATE_SET
454  byte getTranspColour() { return _coordinateSet_TransparentColor & 0xF; } // @ M72_TRANSPARENT_COLOR
455  byte getReplColour10() { return (_replacementColorSetIndices >> 4) & 0xF; } // @ M74_COLOR_10_REPLACEMENT_COLOR_SET
456  byte getReplColour9() { return _replacementColorSetIndices & 0xF; } // @ M73_COLOR_09_REPLACEMENT_COLOR_SET
457 }; // @ CREATURE_ASPECT
458 
460 public:
461  byte _firstNativeBitmapRelativeIndex;
462  byte _firstDerivedBitmapRelativeIndex;
463  byte _byteWidth;
464  byte _height;
465  byte _graphicInfo; /* Bits 7-5 and 3-1 Unreferenced */
466  byte _coordinateSet;
467  ObjectAspect(byte firstN, byte firstD, byte byteWidth, byte h, byte grap, byte coord) :
468  _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD),
469  _byteWidth(byteWidth), _height(h), _graphicInfo(grap), _coordinateSet(coord) {}
470  ObjectAspect() : _firstNativeBitmapRelativeIndex(0), _firstDerivedBitmapRelativeIndex(0),
471  _byteWidth(0), _height(0), _graphicInfo(0), _coordinateSet(0) {}
472 }; // @ OBJECT_ASPECT
473 
475 public:
476  byte _firstNativeBitmapRelativeIndex;
477  byte _firstDerivedBitmapRelativeIndex;
478  byte _byteWidth;
479  byte _height;
480  uint16 _graphicInfo; /* Bits 15-9, 7-5 and 3-2 Unreferenced */
481 
482  ProjectileAspect(byte firstN, byte firstD, byte byteWidth, byte h, uint16 grap) :
483  _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD),
484  _byteWidth(byteWidth), _height(h), _graphicInfo(grap) {}
485 
486  ProjectileAspect() : _firstNativeBitmapRelativeIndex(0),
487  _firstDerivedBitmapRelativeIndex(0), _byteWidth(0), _height(0), _graphicInfo(0) {}
488 }; // @ PROJECTIL_ASPECT
489 
491 public:
492  uint16 _RGBColor[6];
493  byte _d2ReplacementColor;
494  byte _d3ReplacementColor;
495 
496  CreatureReplColorSet(uint16 col1, uint16 col2, uint16 col3, uint16 col4, uint16 col5, uint16 col6, byte d2Rep, byte d3Rep) {
497  _RGBColor[0] = col1;
498  _RGBColor[1] = col2;
499  _RGBColor[2] = col3;
500  _RGBColor[3] = col4;
501  _RGBColor[4] = col5;
502  _RGBColor[5] = col6;
503  _d2ReplacementColor = d2Rep;
504  _d3ReplacementColor = d3Rep;
505  }
506 }; // @ CREATURE_REPLACEMENT_COLOR_SET
507 
508 struct OrnamentInfo {
509  int16 nativeIndice;
510  int16 coordinateSet;
511 };
512 
513 #define k0_DoorButton 0 // @ C0_DOOR_BUTTON
514 #define k0_WallOrnInscription 0 // @ C0_WALL_ORNAMENT_INSCRIPTION
515 #define k15_FloorOrnFootprints 15 // @ C15_FLOOR_ORNAMENT_FOOTPRINTS
516 #define k15_DoorOrnDestroyedMask 15 // @ C15_DOOR_ORNAMENT_DESTROYED_MASK
517 #define k16_DoorOrnThivesEyeMask 16 // @ C16_DOOR_ORNAMENT_THIEVES_EYE_MASK
518 
519 #define k0_viewportNotDungeonView 0 // @ C0_VIEWPORT_NOT_DUNGEON_VIEW
520 #define k1_viewportDungeonView 1 // @ C1_VIEWPORT_DUNGEON_VIEW
521 #define k2_viewportAsBeforeSleepOrFreezeGame 2 // @ C2_VIEWPORT_AS_BEFORE_SLEEP_OR_FREEZE_GAME
522 
523 
524 #define k112_byteWidthViewport 112 // @ C112_BYTE_WIDTH_VIEWPORT
525 #define k136_heightViewport 136 // @ C136_HEIGHT_VIEWPORT
526 
527 #define k160_byteWidthScreen 160 // @ C160_BYTE_WIDTH_SCREEN
528 #define k200_heightScreen 200 // @ C200_HEIGHT_SCREEN
529 
530 #define k8_byteWidth 8 // @ C008_BYTE_WIDTH
531 #define k16_byteWidth 16 // @ C016_BYTE_WIDTH
532 #define k24_byteWidth 24 // @ C024_BYTE_WIDTH
533 #define k32_byteWidth 32 // @ C032_BYTE_WIDTH
534 #define k40_byteWidth 40 // @ C040_BYTE_WIDTH
535 #define k48_byteWidth 48 // @ C048_BYTE_WIDTH
536 #define k64_byteWidth 64 // @ C064_BYTE_WIDTH
537 #define k72_byteWidth 72 // @ C072_BYTE_WIDTH
538 #define k128_byteWidth 128 // @ C128_BYTE_WIDTH
539 #define k144_byteWidth 144 // @ C144_BYTE_WIDTH
540 
541 
542 class DoorFrames {
543 public:
544  Frame _closedOrDestroyed;
545  Frame _vertical[3];
546  Frame _leftHorizontal[3];
547  Frame _rightHorizontal[3];
548  DoorFrames(Frame f1, Frame f2_1, Frame f2_2, Frame f2_3,
549  Frame f3_1, Frame f3_2, Frame f3_3,
550  Frame f4_1, Frame f4_2, Frame f4_3);
551 }; // @ DOOR_FRAMES
552 
553 #define D00_RGB_BLACK 0x0000
554 #define D01_RGB_DARK_BLUE 0x0004
555 #define D02_RGB_LIGHT_BROWN 0x0842
556 #define D03_RGB_PINK 0x086F
557 #define D04_RGB_LIGHTER_BROWN 0x0A62
558 #define D05_RGB_DARK_GOLD 0x0A82
559 #define D06_RGB_GOLD 0x0CA2
560 #define D07_RGB_RED 0x0F00
561 #define D08_RGB_YELLOW 0x0FF4
562 #define D09_RGB_WHITE 0x0FFF
563 #define D10_MASK_RED_COMPONENT 0x0F00
564 #define D10_MASK_RED_COMPONENT 0x0F00
565 #define D11_MASK_GREEN_COMPONENT 0x00F0
566 #define D12_MASK_BLUE_COMPONENT 0x000F
567 
568 class DisplayMan {
569  friend class DM::TextMan;
570 
571  DMEngine *_vm;
572 
573  uint16 _grapItemCount; // @ G0632_ui_GraphicCount
574  uint32 *_bitmapCompressedByteCount;
575  uint32 *_bitmapDecompressedByteCount;
576  uint32 *_packedItemPos;
577  byte *_packedBitmaps;
578  byte **_bitmaps;
579  DoorFrames *_doorFrameD1C;
580  // pointers are not owned by these fields
581  byte *_palChangesProjectile[4]; // @G0075_apuc_PaletteChanges_Projectile
582 
583  DisplayMan(const DisplayMan &other); // no implementation on purpose
584  void operator=(const DisplayMan &rhs); // no implementation on purpose
585 
586  byte *getCurrentVgaBuffer();
587  // the original function has two position parameters, but they are always set to zero
588  void unpackGraphics();
589  void loadFNT1intoBitmap(uint16 index, byte *destBitmap);
590 
591  void viewportSetPalette(uint16 *middleScreenPalette, uint16 *topAndBottomScreen); // @ F0565_VIEWPORT_SetPalette
592  void viewportBlitToScreen(); // @ F0566_VIEWPORT_BlitToScreen
593 
594  void drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &frame); // @ F0105_DUNGEONVIEW_DrawFloorPitOrStairsBitmapFlippedHorizontally
595  void drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &frame); // @ F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap
596  void drawWallSetBitmap(byte *bitmap, Frame &f); // @ F0100_DUNGEONVIEW_DrawWallSetBitmap
597  void drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f); // @ F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency
598  void drawSquareD3L(Direction dir, int16 posX, int16 posY); // @ F0116_DUNGEONVIEW_DrawSquareD3L
599  void drawSquareD3R(Direction dir, int16 posX, int16 posY); // @ F0117_DUNGEONVIEW_DrawSquareD3R
600  void drawSquareD3C(Direction dir, int16 posX, int16 posY); // @ F0118_DUNGEONVIEW_DrawSquareD3C_CPSF
601  void drawSquareD2L(Direction dir, int16 posX, int16 posY); // @ F0119_DUNGEONVIEW_DrawSquareD2L
602  void drawSquareD2R(Direction dir, int16 posX, int16 posY); // @ F0120_DUNGEONVIEW_DrawSquareD2R_CPSF
603  void drawSquareD2C(Direction dir, int16 posX, int16 posY); // @ F0121_DUNGEONVIEW_DrawSquareD2C
604  void drawSquareD1L(Direction dir, int16 posX, int16 posY); // @ F0122_DUNGEONVIEW_DrawSquareD1L
605  void drawSquareD1R(Direction dir, int16 posX, int16 posY); // @ F0123_DUNGEONVIEW_DrawSquareD1R
606  void drawSquareD1C(Direction dir, int16 posX, int16 posY); // @ F0124_DUNGEONVIEW_DrawSquareD1C
607  void drawSquareD0L(Direction dir, int16 posX, int16 posY); // @ F0125_DUNGEONVIEW_DrawSquareD0L
608  void drawSquareD0R(Direction dir, int16 posX, int16 posY); // @ F0126_DUNGEONVIEW_DrawSquareD0R
609  void drawSquareD0C(Direction dir, int16 posX, int16 posY); // @ F0127_DUNGEONVIEW_DrawSquareD0C
610 
611  void applyCreatureReplColors(int replacedColor, int replacementColor); // @ F0093_DUNGEONVIEW_ApplyCreatureReplacementColors
612 
613  bool isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex); // @ F0107_DUNGEONVIEW_IsDrawnWallOrnamentAnAlcove_CPSF
614 
615  uint16 *_derivedBitmapByteCount; // @ G0639_pui_DerivedBitmapByteCount
616  byte **_derivedBitmaps; // @ G0638_pui_DerivedBitmapBlockIndices
617 
618  int16 _stairsNativeBitmapIndexUpFrontD3L; // @ G0675_i_StairsNativeBitmapIndex_Up_Front_D3L
619  int16 _stairsNativeBitmapIndexUpFrontD3C; // @ G0676_i_StairsNativeBitmapIndex_Up_Front_D3C
620  int16 _stairsNativeBitmapIndexUpFrontD2L; // @ G0677_i_StairsNativeBitmapIndex_Up_Front_D2L
621  int16 _stairsNativeBitmapIndexUpFrontD2C; // @ G0678_i_StairsNativeBitmapIndex_Up_Front_D2C
622  int16 _stairsNativeBitmapIndexUpFrontD1L; // @ G0679_i_StairsNativeBitmapIndex_Up_Front_D1L
623  int16 _stairsNativeBitmapIndexUpFrontD1C; // @ G0680_i_StairsNativeBitmapIndex_Up_Front_D1C
624  int16 _stairsNativeBitmapIndexUpFrontD0CLeft; // @ G0681_i_StairsNativeBitmapIndex_Up_Front_D0C_Left
625  int16 _stairsNativeBitmapIndexDownFrontD3L; // @ G0682_i_StairsNativeBitmapIndex_Down_Front_D3L
626  int16 _stairsNativeBitmapIndexDownFrontD3C; // @ G0683_i_StairsNativeBitmapIndex_Down_Front_D3C
627  int16 _stairsNativeBitmapIndexDownFrontD2L; // @ G0684_i_StairsNativeBitmapIndex_Down_Front_D2L
628  int16 _stairsNativeBitmapIndexDownFrontD2C; // @ G0685_i_StairsNativeBitmapIndex_Down_Front_D2C
629  int16 _stairsNativeBitmapIndexDownFrontD1L; // @ G0686_i_StairsNativeBitmapIndex_Down_Front_D1L
630  int16 _stairsNativeBitmapIndexDownFrontD1C; // @ G0687_i_StairsNativeBitmapIndex_Down_Front_D1C
631  int16 _stairsNativeBitmapIndexDownFrontD0CLeft; // @ G0688_i_StairsNativeBitmapIndex_Down_Front_D0C_Left
632  int16 _stairsNativeBitmapIndexSideD2L; // @ G0689_i_StairsNativeBitmapIndex_Side_D2L
633  int16 _stairsNativeBitmapIndexUpSideD1L; // @ G0690_i_StairsNativeBitmapIndex_Up_Side_D1L
634  int16 _stairsNativeBitmapIndexDownSideD1L; // @ G0691_i_StairsNativeBitmapIndex_Down_Side_D1L
635  int16 _stairsNativeBitmapIndexSideD0L; // @ G0692_i_StairsNativeBitmapIndex_Side_D0L
636 
637  byte *_bitmapFloor; // @ G0084_puc_Bitmap_Floor
638  byte *_bitmapCeiling; // @ G0085_puc_Bitmap_Ceiling
639  byte *_bitmapWallSetD3L2; // @ G0697_puc_Bitmap_WallSet_Wall_D3L2
640  byte *_bitmapWallSetD3R2; // @ G0696_puc_Bitmap_WallSet_Wall_D3R2
641  byte *_bitmapWallSetD3LCR; // @ G0698_puc_Bitmap_WallSet_Wall_D3LCR
642  byte *_bitmapWallSetD2LCR; // @ G0699_puc_Bitmap_WallSet_Wall_D2LCR
643 public:
644  byte *_bitmapWallSetD1LCR; // @ G0700_puc_Bitmap_WallSet_Wall_D1LCR
645 private:
646  Box _boxThievesEyeViewPortVisibleArea; // @ G0106_s_Graphic558_Box_ThievesEye_ViewportVisibleArea
647  byte _palChangesDoorButtonAndWallOrnD3[16]; // @ G0198_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D3
648  byte _palChangesDoorButtonAndWallOrnD2[16]; // @ G0199_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D2
649 
650  byte *_bitmapWallSetWallD0L; // @ G0701_puc_Bitmap_WallSet_Wall_D0L
651  byte *_bitmapWallSetWallD0R; // @ G0702_puc_Bitmap_WallSet_Wall_D0R
652  byte *_bitmapWallSetDoorFrameTopD2LCR; // @ G0703_puc_Bitmap_WallSet_DoorFrameTop_D2LCR
653  byte *_bitmapWallSetDoorFrameTopD1LCR; // @ G0704_puc_Bitmap_WallSet_DoorFrameTop_D1LCR
654  byte *_bitmapWallSetDoorFrameLeftD3L; // @ G0705_puc_Bitmap_WallSet_DoorFrameLeft_D3L
655  byte *_bitmapWallSetDoorFrameLeftD3C; // @ G0706_puc_Bitmap_WallSet_DoorFrameLeft_D3C
656  byte *_bitmapWallSetDoorFrameLeftD2C; // @ G0707_puc_Bitmap_WallSet_DoorFrameLeft_D2C
657  byte *_bitmapWallSetDoorFrameLeftD1C; // @ G0708_puc_Bitmap_WallSet_DoorFrameLeft_D1C
658  byte *_bitmapWallSetDoorFrameRightD1C; // @ G0710_puc_Bitmap_WallSet_DoorFrameRight_D1C
659  byte *_bitmapWallSetDoorFrameFront; // @ G0709_puc_Bitmap_WallSet_DoorFrameFront
660 
661  byte *_bitmapWallD3LCRFlipped; // @ G0090_puc_Bitmap_WallD3LCR_Flipped;
662  byte *_bitmapWallD2LCRFlipped; // @ G0091_puc_Bitmap_WallD2LCR_Flipped;
663  byte *_bitmapWallD1LCRFlipped; // @ G0092_puc_Bitmap_WallD1LCR_Flipped;
664  byte *_bitmapWallD0LFlipped; // @ G0093_puc_Bitmap_WallD0L_Flipped;
665  byte *_bitmapWallD0RFlipped; // @ G0094_puc_Bitmap_WallD0R_Flipped;
666  byte *_bitmapWallD3LCRNative; // @ G0095_puc_Bitmap_WallD3LCR_Native;
667  byte *_bitmapWallD2LCRNative; // @ G0096_puc_Bitmap_WallD2LCR_Native;
668  byte *_bitmapWallD1LCRNative; // @ G0097_puc_Bitmap_WallD1LCR_Native;
669  byte *_bitmapWallD0LNative; // @ G0098_puc_Bitmap_WallD0L_Native;
670  byte *_bitmapWallD0RNative; // @ G0099_puc_Bitmap_WallD0R_Native;
671 
672  int16 _currentWallSet; // @ G0231_i_CurrentWallSet
673  int16 _currentFloorSet;// @ G0230_i_CurrentFloorSet
674 
675  bool _useFlippedWallAndFootprintsBitmap; // @ G0076_B_UseFlippedWallAndFootprintsBitmaps
676 
677  byte _wallOrnamentCoordSets[8][13][6]; // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets
678  uint16 _doorOrnCoordSets[4][3][6]; // @ G0207_aaauc_Graphic558_DoorOrnamentCoordinateSet
679  byte _doorButtonCoordSet[1]; // @ G0197_auc_Graphic558_DoorButtonCoordinateSet
680  uint16 _doorButtonCoordSets[1][4][6]; // @ G0208_aaauc_Graphic558_DoorButtonCoordinate
681 
682  int16 _doorNativeBitmapIndexFrontD3LCR[2]; // @ G0693_ai_DoorNativeBitmapIndex_Front_D3LCR
683  int16 _doorNativeBitmapIndexFrontD2LCR[2]; // @ G0694_ai_DoorNativeBitmapIndex_Front_D2LCR
684  int16 _doorNativeBitmapIndexFrontD1LCR[2]; // @ G0695_ai_DoorNativeBitmapIndex_Front_D1LCR
685 
686  uint16 *_paletteFadeFrom; // @ K0017_pui_Palette_FadeFrom
687  uint16 _paletteFadeTemporary[16]; // @ K0016_aui_Palette_FadeTemporary
688 public:
689 
690  uint16 _screenWidth;
691  uint16 _screenHeight;
692  byte *_bitmapScreen; // @ G0348_pl_Bitmap_Screen
693  byte *_bitmapViewport; // @ G0296_puc_Bitmap_Viewport
694 
695  // some methods use this for a stratchpad, don't make assumptions about content between function calls
696  byte *_tmpBitmap; // @ G0074_puc_Bitmap_Temporary
697  bool _paletteSwitchingEnabled; // @ G0322_B_PaletteSwitchingEnabled
698  bool _refreshDungeonViewPaleteRequested; // @ G0342_B_RefreshDungeonViewPaletteRequested
699  int16 _dungeonViewPaletteIndex; // @ G0304_i_DungeonViewPaletteIndex
700  uint16 _blankBuffer[32]; // @G0345_aui_BlankBuffer
701  uint16 _paletteTopAndBottomScreen[16]; // @ G0347_aui_Palette_TopAndBottomScreen
702  uint16 _paletteMiddleScreen[16]; // @ G0346_aui_Palette_MiddleScreen
703 
704  explicit DisplayMan(DMEngine *dmEngine);
705  ~DisplayMan();
706 
707  void loadWallSet(WallSet set); // @ F0095_DUNGEONVIEW_LoadWallSet
708  void loadFloorSet(FloorSet set); // @ F0094_DUNGEONVIEW_LoadFloorSet
709 
710  void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
711  void setUpScreens(uint16 width, uint16 height);
712  void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader
713  void initializeGraphicData(); // @ F0460_START_InitializeGraphicData
714  void loadCurrentMapGraphics(); // @ F0096_DUNGEONVIEW_LoadCurrentMapGraphics_CPSDF
715  void allocateFlippedWallBitmaps(); // @ F0461_START_AllocateFlippedWallBitmaps
716  void drawDoorBitmap(Frame *frame);// @ F0102_DUNGEONVIEW_DrawDoorBitmap
717  void drawDoorFrameBitmapFlippedHorizontally(byte *bitmap, Frame *frame); // @ F0103_DUNGEONVIEW_DrawDoorFrameBitmapFlippedHorizontally
718  void drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton); // @ F0110_DUNGEONVIEW_DrawDoorButton
719 
721  uint16 getPixelWidth(uint16 index);
723  uint16 getPixelHeight(uint16 index);
724 
725  void copyBitmapAndFlipHorizontal(byte *srcBitmap, byte *destBitmap, uint16 byteWidth, uint16 height); // @ F0099_DUNGEONVIEW_CopyBitmapAndFlipHorizontal
726  void drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIndex); // @ F0108_DUNGEONVIEW_DrawFloorOrnament
727  void drawDoor(uint16 doorThingIndex, DoorState doorState, int16 *doorNativeBitmapIndices, int16 byteCount,
728  DoorOrnament doorOrnament, DoorFrames *doorFrames); // @ F0111_DUNGEONVIEW_DrawDoor
729  void drawDoorOrnament(int16 doorOrnOdinal, DoorOrnament doorOrnament); // @ F0109_DUNGEONVIEW_DrawDoorOrnament
730  void drawCeilingPit(int16 nativeBitmapIndex, Frame *frame, int16 mapX, int16 mapY, bool flipHorizontal); // @ F0112_DUNGEONVIEW_DrawCeilingPit
731 
732  void blitToViewport(byte *bitmap, Box &box, int16 byteWidth, Color transparent, int16 height); // @ F0020_MAIN_BlitToViewport
733  void blitToViewport(byte *bitmap, int16 *box, int16 byteWidth, Color transparent, int16 height); // @ F0020_MAIN_BlitToViewport
734  void blitToScreen(byte *bitmap, const Box *box, int16 byteWidth, Color transparent, int16 height); // @ F0021_MAIN_BlitToScreen
735 
736 
737  /* srcHeight and destHeight are not necessary for blitting, only error checking, thus they are defaulted for existing code which
738  does not pass anything, newly imported calls do pass srcHeght and srcWidth, so this is a convenience change so the parameters
739  match the original exactly, if need arises for heights then we'll have to retrospectively add them in old function calls*/
740  /* Expects inclusive boundaries in box */
741  void blitToBitmap(byte *srcBitmap, byte *destBitmap, const Box &box, uint16 srcX, uint16 srcY, uint16 srcByteWidth,
742  uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight); // @ F0132_VIDEO_Blit
743  /* Expects inclusive boundaries in box */
744  void blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex,
745  int16 firstUnitIndex, int16 destByteWidth, Color transparent,
746  int16 xPos, int16 yPos, int16 destHeight, int16 height2); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
747  // this function takes pixel widths
748  void blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap,
749  int16 srcPixelWidth, int16 srcHight, int16 destPixelWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges
750  void flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height); // @ F0130_VIDEO_FlipHorizontal
751  void flipBitmapVertical(byte *bitmap, uint16 byteWidth, uint16 height);
752  byte *getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16 &returnByteWidth, int16 &returnHeight); // @ F0114_DUNGEONVIEW_GetExplosionBitmap
753 
754  void fillBitmap(byte *bitmap, Color color, uint16 byteWidth, uint16 height); // @ F0134_VIDEO_FillBitmap
755  void fillScreen(Color color);
756  /* Expects inclusive boundaries in box */
757  void fillScreenBox(Box &box, Color color); // @ D24_FillScreenBox, F0550_VIDEO_FillScreenBox
758  /* Expects inclusive boundaries in box */
759  void fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height); // @ F0135_VIDEO_FillBox
760  void drawDungeon(Direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF
761  void drawFloorAndCeiling(); // @ F0098_DUNGEONVIEW_DrawFloorAndCeiling
762  void updateScreen();
763  void drawViewport(int16 palSwitchingRequestedState); // @ F0097_DUNGEONVIEW_DrawViewport
764 
765  byte *getNativeBitmapOrGraphic(uint16 index); // @ F0489_MEMORY_GetNativeBitmapOrGraphic
766  Common::MemoryReadStream getCompressedData(uint16 index);
767  uint32 getCompressedDataSize(uint16 index);
768  void drawField(FieldAspect *fieldAspect, Box &box); // @ F0113_DUNGEONVIEW_DrawField
769 
770  int16 getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale); // @ F0459_START_GetScaledBitmapByteCount
771  int16 getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION
772  void drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Direction directionParam,
773  int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
774  CellOrder orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
775  uint16 getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH
776  uint16 getVerticalOffsetM23(uint16 val); // @ M23_VERTICAL_OFFSET
777  uint16 getHorizontalOffsetM22(uint16 val); // @ M22_HORIZONTAL_OFFSET
778 
779  int16 _championPortraitOrdinal; // @ G0289_i_DungeonView_ChampionPortraitOrdinal
780  int16 _currMapAlcoveOrnIndices[k3_AlcoveOrnCount]; // @ G0267_ai_CurrentMapAlcoveOrnamentIndices
781  int16 _currMapFountainOrnIndices[k1_FountainOrnCount]; // @ G0268_ai_CurrentMapFountainOrnamentIndices
782  OrnamentInfo _currMapWallOrnInfo[16]; // @ G0101_aai_CurrentMapWallOrnamentsInfo
783  OrnamentInfo _currMapFloorOrnInfo[16]; // @ G0102_aai_CurrentMapFloorOrnamentsInfo
784  OrnamentInfo _currMapDoorOrnInfo[17]; // @ G0103_aai_CurrentMapDoorOrnamentsInfo
785  byte *_currMapAllowedCreatureTypes; // @ G0264_puc_CurrentMapAllowedCreatureTypes
786  byte _currMapWallOrnIndices[16]; // @ G0261_auc_CurrentMapWallOrnamentIndices
787  byte _currMapFloorOrnIndices[16]; // @ G0262_auc_CurrentMapFloorOrnamentIndices
788  byte _currMapDoorOrnIndices[18]; // @ G0263_auc_CurrentMapDoorOrnamentIndices
789 
790  int16 _currMapViAltarIndex; // @ G0266_i_CurrentMapViAltarWallOrnamentIndex
791 
792  Thing _inscriptionThing; // @ G0290_T_DungeonView_InscriptionThing
793 
794  bool _drawFloorAndCeilingRequested; // @ G0297_B_DrawFloorAndCeilingRequested
795 
796  // This tells blitting functions whether to assume a BYTE_BOX or a WORD_BOX has been passed to them,
797  // I only use WORD_BOX, so this will probably deem useless
798  bool _useByteBoxCoordinates; // @ G0578_B_UseByteBoxCoordinates
799  bool _doNotDrawFluxcagesDuringEndgame; // @ G0077_B_DoNotDrawFluxcagesDuringEndgame
800 
801  Frame _doorFrameLeftD1C; // @ G0170_s_Graphic558_Frame_DoorFrameLeft_D1C
802  Frame _doorFrameRightD1C; // @ G0171_s_Graphic558_Frame_DoorFrameRight_D1C
803  FieldAspect _fieldAspects188[12];
804  Box _boxMovementArrows;
805  byte _palChangeSmoke[16];
806  byte _projectileScales[7];
807  ExplosionAspect _explosionAspects[k4_ExplosionAspectCount];
808  Frame _frameWallD3R2;
809  Frame _frameWalls163[12];
810  CreatureAspect _creatureAspects219[k27_CreatureTypeCount];
811  ObjectAspect _objectAspects209[k85_ObjAspectCount]; // @ G0209_as_Graphic558_ObjectAspects
812  ProjectileAspect _projectileAspect[k14_ProjectileAspectCount]; // @ G0210_as_Graphic558_ProjectileAspects
813  uint16 _palCredits[16]; // @ G0019_aui_Graphic562_Palette_Credits
814  uint16 _palDungeonView[6][16]; // @ G0021_aaui_Graphic562_Palette_DungeonView
815  byte _palChangesCreatureD3[16]; // @ G0221_auc_Graphic558_PaletteChanges_Creature_D3
816  byte _palChangesCreatureD2[16]; // @ G0222_auc_Graphic558_PaletteChanges_Creature_D2
817  byte _palChangesNoChanges[16]; // @ G0017_auc_Graphic562_PaletteChanges_NoChanges
818  byte _palChangesFloorOrnD3[16]; // @ G0213_auc_Graphic558_PaletteChanges_FloorOrnament_D3
819  byte _palChangesFloorOrnD2[16]; // @ G0214_auc_Graphic558_PaletteChanges_FloorOrnament_D2
820 
821  bool isDerivedBitmapInCache(int16 derivedBitmapIndex); // @ F0491_CACHE_IsDerivedBitmapInCache
822  byte *getDerivedBitmap(int16 derivedBitmapIndex); // @ F0492_CACHE_GetDerivedBitmap
823  void addDerivedBitmap(int16 derivedBitmapIndex); // @ F0493_CACHE_AddDerivedBitmap
824  void releaseBlock(uint16 index); // @ F0480_CACHE_ReleaseBlock
825  uint16 getDarkenedColor(uint16 RGBcolor);
826  void startEndFadeToPalette(uint16 *P0849_pui_Palette); // @ F0436_STARTEND_FadeToPalette
827  void buildPaletteChangeCopperList(uint16 *middleScreen, uint16 *topAndBottom); // @ F0508_AMIGA_BuildPaletteChangeCopperList
828  void shadeScreenBox(Box *box, Color color) { warning("STUB METHOD: shadeScreenBox"); } // @ F0136_VIDEO_ShadeScreenBox
829 
830 private:
831  void initConstants();
832  uint16 getBitmapByteCount(uint16 pixelWidth, uint16 height); // @ M75_BITMAP_BYTE_COUNT
833 };
834 
835 }
836 
837 #endif
Definition: dm.h:117
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
int16 right
Definition: rect.h:146
Definition: gfx.h:362
Definition: rect.h:144
Definition: gfx.h:397
Definition: gfx.h:568
Definition: gfx.h:428
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: gfx.h:474
Definition: gfx.h:372
Definition: rect.h:45
Definition: gfx.h:508
int16 left
Definition: rect.h:145
Definition: gfx.h:542
Definition: text.h:42
Definition: champion.h:35
Definition: memstream.h:43
int16 x
Definition: rect.h:46
int16 y
Definition: rect.h:47
Definition: dm.h:155
Definition: gfx.h:414
Definition: gfx.h:459
Definition: gfx.h:490