30#include "common/scummsys.h"
31#include "common/rect.h"
32#include "common/memstream.h"
33#include "common/array.h"
53 kDMDoorStateOneFourth = 1,
55 kDMDoorStateThreeFourth = 3,
56 kDMDoorStateClosed = 4,
57 kDMDoorStateDestroyed = 5
62 int16 _parentRecordIndex;
96 kDMDoorOrnamentD3LCR = 0,
97 kDMDoorOrnamentD2LCR = 1,
98 kDMDoorOrnamentD1LCR = 2
104 kDMZoneMovementArrows = 9,
105 kDMZoneActionArea = 11,
106 kDMZoneSpellArea = 13,
107 kDMZoneMessageArea = 15,
108 kDMZoneSpellAreaSetMagicCaster = 221,
109 kDMZoneSpellAreaMagicCasterTab = 224,
110 kDMZoneViewportCeiling = 700,
111 kDMZoneViewportFloor = 701,
112 kDMZoneWallD3L2 = 702,
113 kDMZoneWallD3R2 = 703,
114 kDMZoneWallD3C = 704,
115 kDMZoneWallD3L = 705,
116 kDMZoneWallD3R = 706,
117 kDMZoneWallD2L2 = 707,
118 kDMZoneWallD2R2 = 708,
119 kDMZoneWallD2C = 709,
120 kDMZoneWallD2L = 710,
121 kDMZoneWallD2R = 711,
122 kDMZoneWallD1C = 712,
123 kDMZoneWallD1L = 713,
124 kDMZoneWallD1R = 714,
125 kDMZoneWallD0C = 715,
126 kDMZoneWallD0L = 716,
127 kDMZoneWallD0R = 717,
128 kDMZoneDoorFrameLeftD3L = 718,
129 kDMZoneDoorFrameRightD3L = 719,
130 kDMZoneDoorFrameLeftD3R = 720,
131 kDMZoneDoorFrameRightD3R = 721,
132 kDMZoneDoorFrameLeftD3C = 722,
133 kDMZoneDoorFrameRightD3C = 723,
134 kDMZoneDoorFrameLeftD2C = 724,
135 kDMZoneDoorFrameRightD2C = 725,
136 kDMZoneDoorFrameLeftD1C = 726,
137 kDMZoneDoorFrameRightD1C = 727,
138 kDMZoneDoorFrameD0C = 728,
139 kDMZoneDoorFrameTopD2L = 729,
140 kDMZoneDoorFrameTopD2C = 730,
141 kDMZoneDoorFrameTopD2R = 731,
142 kDMZoneDoorFrameTopD1L = 732,
143 kDMZoneDoorFrameTopD1C = 733,
144 kDMZoneDoorFrameTopD1R = 734,
145 kDMZonePortraitOnWall = 737,
146 kDMZoneStairsUpFrontD3L = 802,
147 kDMZoneStairsUpFrontD3C = 803,
148 kDMZoneStairsUpFrontD3R = 804,
149 kDMZoneStairsUpFrontD2L = 805,
150 kDMZoneStairsUpFrontD2C = 806,
151 kDMZoneStairsUpFrontD2R = 807,
152 kDMZoneStairsUpFrontD1L = 808,
153 kDMZoneStairsUpFrontD1C = 809,
154 kDMZoneStairsUpFrontD1R = 810,
155 kDMZoneStairsUpFrontD0L = 811,
156 kDMZoneStairsUpFrontD0R = 812,
157 kDMZoneStairsDownFrontD3L = 815,
158 kDMZoneStairsDownFrontD3C = 816,
159 kDMZoneStairsDownFrontD3R = 817,
160 kDMZoneStairsDownFrontD2L = 818,
161 kDMZoneStairsDownFrontD2C = 819,
162 kDMZoneStairsDownFrontD2R = 820,
163 kDMZoneStairsDownFrontD1L = 821,
164 kDMZoneStairsDownFrontD1C = 822,
165 kDMZoneStairsDownFrontD1R = 823,
166 kDMZoneStairsDownFrontD0L = 824,
167 kDMZoneStairsDownFrontD0R = 825,
168 kDMZoneStairsSideD2L = 826,
169 kDMZoneStairsSideD2R = 827,
170 kDMZoneStairsUpSideD1L = 828,
171 kDMZoneStairsUpSideD1R = 829,
172 kDMZoneStairsDownSideD1L = 830,
173 kDMZoneStairsDownSideD1R = 831,
174 kDMZoneStairsSideD0L = 832,
175 kDMZoneStairsSideD0R = 833,
176 kDMZoneFloorPitD3L = 852,
177 kDMZoneFloorPitD3C = 853,
178 kDMZoneFloorPitD3R = 854,
179 kDMZoneFloorPitD2L = 855,
180 kDMZoneFloorPitD2C = 856,
181 kDMZoneFloorPitD2R = 857,
182 kDMZoneFloorPitD1L = 858,
183 kDMZoneFloorPitD1C = 859,
184 kDMZoneFloorPitD1R = 860,
185 kDMZoneFloorPitD0L = 861,
186 kDMZoneFloorPitD0C = 862,
187 kDMZoneFloorPitD0R = 863,
188 kDMZoneCeilingPitD2L = 864,
189 kDMZoneCeilingPitD2C = 865,
190 kDMZoneCeilingPitD2R = 866,
191 kDMZoneCeilingPitD1L = 867,
192 kDMZoneCeilingPitD1C = 868,
193 kDMZoneCeilingPitD1R = 869,
194 kDMZoneCeilingPitD0L = 870,
195 kDMZoneCeilingPitD0C = 871,
196 kDMZoneCeilingPitD0R = 872,
197 kDMZoneDoorButton = 1950,
198 kDMZoneDoorD3L2 = 3700,
199 kDMZoneDoorD3R2 = 3710,
200 kDMZoneDoorD3L = 3720,
201 kDMZoneDoorD3C = 3730,
202 kDMZoneDoorD3R = 3740,
203 kDMZoneDoorD2L = 3750,
204 kDMZoneDoorD2C = 3760,
205 kDMZoneDoorD2R = 3770,
206 kDMZoneDoorD1L = 3780,
207 kDMZoneDoorD1C = 3790,
208 kDMZoneDoorD1R = 3800
211enum NegGraphicIndex {
212 kDMNegGraphicFloor = -1,
213 kDMNegGraphicCeiling = -2,
214 kDMNegGraphicWallD3L2 = -3,
215 kDMNegGraphicWallD3R2 = -4,
216 kDMNegGraphicWallD3C = -5,
217 kDMNegGraphicWallD3L = -6,
218 kDMNegGraphicWallD3R = -7,
219 kDMNegGraphicWallD2L2 = -8,
220 kDMNegGraphicWallD2R2 = -9,
221 kDMNegGraphicWallD2C = -10,
222 kDMNegGraphicWallD2L = -11,
223 kDMNegGraphicWallD2R = -12,
224 kDMNegGraphicWallD1C = -13,
225 kDMNegGraphicWallD1L = -14,
226 kDMNegGraphicWallD1R = -15,
227 kDMNegGraphicWallD0L = -16,
228 kDMNegGraphicWallD0R = -17
232 kDMDoorButtonD3R = 0,
233 kDMDoorButtonD3C = 1,
234 kDMDoorButtonD2C = 2,
240 kDMViewLaneCenter = 0,
246enum ExplosionAspectEnum {
247 kDMExplosionAspectFire = 0,
248 kDMExplosionAspectSpell = 1,
249 kDMExplosionAspectPoison = 2,
250 kDMExplosionAspectSmoke = 3
262 kDMViewWallD3LRight = 0,
263 kDMViewWallD3RLeft = 1,
264 kDMViewWallD3LFront = 2,
265 kDMViewWallD3CFront = 3,
266 kDMViewWallD3RFront = 4,
267 kDMViewWallD2LRight = 5,
268 kDMViewWallD2RLeft = 6,
269 kDMViewWallD2LFront = 7,
270 kDMViewWallD2CFront = 8,
271 kDMViewWallD2RFront = 9,
272 kDMViewWallD1LRight = 10,
273 kDMViewWallD1RLeft = 11,
274 kDMViewWallD1CFront = 12
278 kDMCellOrderNone = 0xFFFF,
279 kDMCellOrderAlcove = 0x0000,
280 kDMCellOrderBackLeft = 0x0001,
281 kDMCellOrderBackRight = 0x0002,
282 kDMCellOrderDoorPass1BackLeft = 0x0018,
283 kDMCellOrderBackLeftBackRight = 0x0021,
284 kDMCellOrderDoorPass1BackRight = 0x0028,
285 kDMCellOrderBackRightFrontRight = 0x0032,
286 kDMCellOrderDoorPass2FrontRight = 0x0039,
287 kDMCellOrderBackLeftFrontLeft = 0x0041,
288 kDMCellOrderDoorPass2FrontLeft = 0x0049,
289 kDMCellOrderDoorPass1BackRightBackLeft = 0x0128,
290 kDMCellOrderDoorPass1BackLeftBackRight = 0x0218,
291 kDMCellOrderBackLeftBackRightFrontRight = 0x0321,
292 kDMCellOrderBackRightFrontLeftFrontRight = 0x0342,
293 kDMCellOrderDoorPass2FrontLeftFrontRight = 0x0349,
294 kDMCellOrderBackRightBackLeftFrontLeft = 0x0412,
295 kDMCellOrderBackLeftFrontRightFrontLeft = 0x0431,
296 kDMCellOrderDoorPass2FrontRightFrontLeft = 0x0439,
297 kDMCellOrderBackLeftBackRightFrontLeftFrontRight = 0x3421,
298 kDMCellOrderBackRightBackLeftFrontRightFrontLeft = 0x4312
302 kDMDerivedBitmapViewport = 0,
303 kDMDerivedBitmapThievesEyeVisibleArea = 1,
304 kDMDerivedBitmapDamageToCreatureMedium = 2,
305 kDMDerivedBitmapDamageToCreatureSmall = 3,
306 kDMDerivedBitmapFirstWallOrnament = 4,
307 kDMDerivedBitmapFirstDoorOrnamentD3 = 68,
308 kDMDerivedBitmapFirstDoorOrnamentD2 = 69,
309 kDMDerivedBitmapFirstDoorButton = 102,
310 kDMDerivedBitmapFirstObject = 104,
311 kDMDerivedBitmapFirstProjectile = 282,
312 kDMDerivedBitmapFirstExplosion = 438,
313 kDMDerivedBitmapFirstCreature = 495
317 kDMViewSquareD4C = -3,
319 kDMViewSquareD4R = -1,
320 kDMViewSquareD3C = 0,
321 kDMViewSquareD3L = 1,
322 kDMViewSquareD3R = 2,
323 kDMViewSquareD2C = 3,
324 kDMViewSquareD2L = 4,
325 kDMViewSquareD2R = 5,
326 kDMViewSquareD1C = 6,
327 kDMViewSquareD1L = 7,
328 kDMViewSquareD1R = 8,
329 kDMViewSquareD0C = 9,
330 kDMViewSquareD0L = 10,
331 kDMViewSquareD0R = 11,
332 kDMViewSquareD3CExplosion = 3,
333 kDMViewSquareD3LExplosion = 4,
334 kDMViewSquareD1CExplosion = 9,
335 kDMViewSquareD0CExplosion = 12
339 kDMViewCellFronLeft = 0,
340 kDMViewCellFrontRight = 1,
341 kDMViewCellBackRight = 2,
342 kDMViewCellBackLeft = 3,
343 kDMViewCellAlcove = 4,
344 kDMViewCellDoorButtonOrWallOrn = 5
348 kDMColorNoTransparency = -1,
350 kDMColorDarkGary = 1,
351 kDMColorLightGray = 2,
352 kDMColorDarkBrown = 3,
354 kDMColorLightBrown = 5,
355 kDMColorDarkGreen = 6,
356 kDMColorLightGreen = 7,
361 kDMColorDarkestGray = 12,
362 kDMColorLightestGray = 13,
368 kDMGraphicIdxDialogBox = 0,
369 kDMGraphicIdxTitle = 1,
370 kDMGraphicIdxEntranceLeftDoor = 2,
371 kDMGraphicIdxEntranceRightDoor = 3,
372 kDMGraphicIdxEntrance = 4,
373 kDMGraphicIdxCredits = 5,
374 kDMGraphicIdxTheEnd = 6,
375 kDMGraphicIdxStatusBoxDeadChampion = 8,
376 kDMGraphicIdxMenuSpellAreaBackground = 9,
377 kDMGraphicIdxMenuActionArea = 10,
378 kDMGraphicIdxMenuSpellAreLines = 11,
379 kDMGraphicIdxMovementArrows = 13,
380 kDMGraphicIdxDamageToCreature = 14,
381 kDMGraphicIdxDamageToChampionSmall = 15,
382 kDMGraphicIdxDamageToChampionBig = 16,
383 kDMGraphicIdxInventory = 17,
384 kDMGraphicIdxArrowForChestContent = 18,
385 kDMGraphicIdxEyeForObjectDescription = 19,
386 kDMGraphicIdxPanelEmpty = 20,
387 kDMGraphicIdxPanelOpenScroll = 23,
388 kDMGraphicIdxPanelOpenChest = 25,
389 kDMGraphicIdxChampionPortraits = 26,
390 kDMGraphicIdxPanelRenameChampion = 27,
391 kDMGraphicIdxChampionIcons = 28,
392 kDMGraphicIdxObjectDescCircle = 29,
393 kDMGraphicIdxFoodLabel = 30,
394 kDMGraphicIdxWaterLabel = 31,
395 kDMGraphicIdxPoisionedLabel = 32,
396 kDMGraphicIdxSlotBoxNormal = 33,
397 kDMGraphicIdxSlotBoxWounded = 34,
398 kDMGraphicIdxSlotBoxActingHand = 35,
399 kDMGraphicIdxBorderPartyShield = 37,
400 kDMGraphicIdxBorderPartyFireshield = 38,
401 kDMGraphicIdxBorderPartySpellshield = 39,
402 kDMGraphicIdxPanelResurectReincarnate = 40,
403 kDMGraphicIdxHoleInWall = 41,
404 kDMGraphicIdxObjectIcons000To031 = 42,
405 kDMGraphicIdxObjectIcons032To063 = 43,
406 kDMGraphicIdxObjectIcons064To095 = 44,
407 kDMGraphicIdxObjectIcons096To127 = 45,
408 kDMGraphicIdxObjectIcons128To159 = 46,
409 kDMGraphicIdxObjectIcons160To191 = 47,
410 kDMGraphicIdxObjectIcons192To223 = 48,
411 kDMGraphicIdxFloorPitD3L = 49,
412 kDMGraphicIdxFloorPitD3C = 50,
413 kDMGraphicIdxFloorPitD2L = 51,
414 kDMGraphicIdxFloorPitD2C = 52,
415 kDMGraphicIdxFloorPitD1L = 53,
416 kDMGraphicIdxFloorPitD1C = 54,
417 kDMGraphicIdxFloorPitD0L = 55,
418 kDMGraphicIdxFloorPitD0C = 56,
419 kDMGraphicIdxFloorPitInvisibleD2L = 57,
420 kDMGraphicIdxFloorPitInvisibleD2C = 58,
421 kDMGraphicIdxFloorPitInvisibleD1L = 59,
422 kDMGraphicIdxFloorPitInvisibleD1C = 60,
423 kDMGraphicIdxFloorPitInvisibleD0L = 61,
424 kDMGraphicIdxFloorPitInvisibleD0C = 62,
425 kDMGraphicIdxCeilingPitD2L = 63,
426 kDMGraphicIdxCeilingPitD2C = 64,
427 kDMGraphicIdxCeilingPitD1L = 65,
428 kDMGraphicIdxCeilingPitD1C = 66,
429 kDMGraphicIdxCeilingPitD0L = 67,
430 kDMGraphicIdxCeilingPitD0C = 68,
431 kDMGraphicIdxFieldMaskD3R = 69,
432 kDMGraphicIdxFieldTeleporter = 73,
433 kDMGraphicIdxInscriptionFont = 120,
434 kDMGraphicIdxWallOrnChampMirror = 208,
435 kDMGraphicIdxFloorOrnD3LFootprints = 241,
436 kDMGraphicIdxDoorMaskDestroyed = 301,
437 kDMGraphicIdxFirstDoorButton = 315,
438 kDMGraphicIdxFirstProjectile = 316,
439 kDMGraphicIdxFirstExplosion = 348,
440 kDMGraphicIdxFirstExplosionPattern = 351,
441 kDMGraphicIdxFirstObject = 360,
442 kDMGraphicIdxFirstCreature = 446,
443 kDMGraphicIdxFont = 557,
444 kDMObjectNamesGraphicIndice = 556
447#define kDMMaskDoorInfoCreaturesCanSeeThrough 0x0001
448#define kDMMaskDoorInfoProjectilesCanPassThrough 0x0002
449#define kDMMaskDoorInfoAnimated 0x0004
450#define kDMMaskDoorFront 0x0008
453#define kMaskFieldAspectFlipMask 0x0080
454#define kMaskFieldAspectIndex 0x007F
455#define kMaskFieldAspectNoMask 255
457#define kDMCreatureMaskAdditional 0x0003
458#define kDMCreatureMaskFlipNonAttack 0x0004
459#define kDMCreatureMaskSide 0x0008
460#define kDMCreatureMaskBack 0x0010
461#define kDMCreatureMaskAttack 0x0020
462#define kDMCreatureMaskSpecialD2Front 0x0080
463#define kDMCreatureMaskSpecialD2FrontIsFlipped 0x0100
464#define kDMCreatureMaskFlipAttack 0x0200
465#define kDMCreatureMaskFlipDuringAttack 0x0400
467#define k2_FloorSetGraphicCount 2
468#define k13_WallSetGraphicCount 13
469#define k40_WallSetGraphicCountDOS 40
470#define k18_StairsGraphicCount 18
471#define k3_DoorSetGraphicsCount 3
472#define k1_DoorButtonCount 1
473#define k3_AlcoveOrnCount 3
474#define k1_FountainOrnCount 1
475#define k27_CreatureTypeCount 27
476#define k4_ExplosionAspectCount 4
477#define k14_ProjectileAspectCount 14
478#define k85_ObjAspectCount 85
480#define k0_HalfSizedViewCell_LeftColumn 0
481#define k1_HalfSizedViewCell_RightColumn 1
482#define k2_HalfSizedViewCell_BackRow 2
483#define k3_HalfSizedViewCell_CenterColumn 3
484#define k4_HalfSizedViewCell_FrontRow 4
487#define k0_ShiftSet_D0BackD1Front 0
488#define k1_ShiftSet_D1BackD2Front 1
489#define k2_ShiftSet_D2BackD3Front 2
491#define k9_MenuSpellAreaLinesDOS 9
492#define k75_FirstFloorSet 75
493#define k78_FirstFloorSetDOS 78
494#define k77_FirstWallSet 77
495#define k86_FirstWallSetDOS 86
496#define k90_FirstStairs 90
497#define k108_FirstStairsDOS 108
498#define k108_FirstDoorSet 108
499#define k246_FirstDoorSetDOS 246
500#define k120_InscriptionFont 120
501#define k258_InscriptionFontDOS 258
502#define k121_FirstWallOrn 121
503#define k259_FirstWallOrnDOS 259
504#define k247_FirstFloorOrn 247
505#define k385_FirstFloorOrnDOS 385
506#define k439_DoorMaskDestroyedDOS 439
507#define k303_FirstDoorOrn 303
508#define k441_FirstDoorOrnDOS 441
509#define k453_FirstDoorButtonDOS 453
510#define k454_FirstProjectileDOS 454
511#define k486_FirstExplosionDOS 486
512#define k489_FirstExplosionPatternDOS 489
513#define k498_FirstObjectDOS 498
514#define k584_FirstCreatureDOS 584
515#define k695_FontDOS 695
516#define k694_ObjectNamesDOS 694
517#define k730_DerivedBitmapMaximumCount 730
519#define k16_Scale_D3 16
520#define k20_Scale_D2 20
523#define k0x0001_ObjectFlipOnRightMask 0x0001
524#define k0x0010_ObjectAlcoveMask 0x0010
527#define k0x0010_ProjectileSideMask 0x0010
528#define k0x0100_ProjectileScaleWithKineticEnergyMask 0x0100
529#define k0x0003_ProjectileAspectTypeMask 0x0003
532#define k0_ProjectileAspectHasBackGraphicRotation 0
533#define k1_ProjectileAspectBackGraphic 1
534#define k2_ProjectileAspectHasRotation 2
535#define k3_ProjectileAspectHasNone 3
538#define k3_ProjectileAspectExplosionLightningBolt 3
539#define k10_ProjectileAspectExplosionFireBall 10
540#define k11_ProjectileAspectExplosionDefault 11
541#define k12_ProjectileAspectExplosionSlime 12
542#define k13_ProjectileAspectExplosionPoisonBoltCloud 13
544#define k0x0080_BlitDoNotUseMask 0x0080
545#define kScaleThreshold 32768
552 ExplosionAspect(uint16 byteWidth, uint16 height) :_byteWidth(byteWidth), _height(height) {}
561 Box(int16 x1, int16 x2, int16 y1, int16 y2) {
570 return (_rect.
left <= point.
x) && (point.
x <= _rect.
right) && (_rect.top <= point.
y) && (point.
y <= _rect.bottom);
573 bool isPointInside(int16 x, int16 y) {
580extern Box g2_BoxMovementArrows;
585 uint16 _srcByteWidth, _srcHeight;
589 _srcByteWidth = _srcHeight = 0;
593 Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
594 uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) :
595 _box(destFromX, destToX, destFromY, destToY),
596 _srcByteWidth(srcWidth), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {}
601 uint16 _nativeBitmapRelativeIndex;
602 uint16 _baseStartUnitIndex;
603 uint16 _transparentColor;
608 uint16 _bitplaneWordCount;
609 FieldAspect(uint16 native, uint16 base, uint16 transparent,
byte mask, uint16 byteWidth, uint16 height, uint16 xPos, uint16 bitplane);
615 uint16 _firstNativeBitmapRelativeIndex;
616 uint16 _firstDerivedBitmapIndex;
617 byte _byteWidthFront;
621 byte _byteWidthAttack;
624 byte _coordinateSet_TransparentColor;
625 byte _replacementColorSetIndices;
628 CreatureAspect(uint16 uint161, uint16 uint162,
byte byte0,
byte byte1,
byte byte2,
byte byte3,
byte byte4,
byte byte5,
byte byte6,
byte byte7)
629 : _firstNativeBitmapRelativeIndex(uint161), _firstDerivedBitmapIndex(uint162), _byteWidthFront(byte0),
630 _heightFront(byte1), _byteWidthSide(byte2), _heightSide(byte3), _byteWidthAttack(byte4),
631 _heightAttack(byte5), _coordinateSet_TransparentColor(byte6), _replacementColorSetIndices(byte7) {}
634 _firstNativeBitmapRelativeIndex(0), _firstDerivedBitmapIndex(0), _byteWidthFront(0),
635 _heightFront(0), _byteWidthSide(0), _heightSide(0), _byteWidthAttack(0),
636 _heightAttack(0), _coordinateSet_TransparentColor(0), _replacementColorSetIndices(0) {}
638 byte getCoordSet() {
return (_coordinateSet_TransparentColor >> 4) & 0xF; }
639 byte getTranspColour() {
return _coordinateSet_TransparentColor & 0xF; }
640 byte getReplColour10() {
return (_replacementColorSetIndices >> 4) & 0xF; }
641 byte getReplColour9() {
return _replacementColorSetIndices & 0xF; }
646 byte _firstNativeBitmapRelativeIndex;
647 byte _firstDerivedBitmapRelativeIndex;
652 ObjectAspect(
byte firstN,
byte firstD,
byte byteWidth,
byte h,
byte grap,
byte coord) :
653 _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD),
654 _byteWidth(byteWidth), _height(h), _graphicInfo(grap), _coordinateSet(coord) {}
655 ObjectAspect() : _firstNativeBitmapRelativeIndex(0), _firstDerivedBitmapRelativeIndex(0),
656 _byteWidth(0), _height(0), _graphicInfo(0), _coordinateSet(0) {}
661 byte _firstNativeBitmapRelativeIndex;
662 byte _firstDerivedBitmapRelativeIndex;
667 ProjectileAspect(
byte firstN,
byte firstD,
byte byteWidth,
byte h, uint16 grap) :
668 _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD),
669 _byteWidth(byteWidth), _height(h), _graphicInfo(grap) {}
672 _firstDerivedBitmapRelativeIndex(0), _byteWidth(0), _height(0), _graphicInfo(0) {}
678 byte _d2ReplacementColor;
679 byte _d3ReplacementColor;
681 CreatureReplColorSet(uint16 col1, uint16 col2, uint16 col3, uint16 col4, uint16 col5, uint16 col6,
byte d2Rep,
byte d3Rep) {
688 _d2ReplacementColor = d2Rep;
689 _d3ReplacementColor = d3Rep;
698#define k0_DoorButton 0
699#define k0_WallOrnInscription 0
700#define k15_FloorOrnFootprints 15
701#define k15_DoorOrnDestroyedMask 15
702#define k16_DoorOrnThivesEyeMask 16
704#define k0_viewportNotDungeonView 0
705#define k1_viewportDungeonView 1
706#define k2_viewportAsBeforeSleepOrFreezeGame 2
709#define k112_byteWidthViewport 112
710#define k136_heightViewport 136
712#define k160_byteWidthScreen 160
713#define k200_heightScreen 200
715#define k8_byteWidth 8
716#define k16_byteWidth 16
717#define k24_byteWidth 24
718#define k32_byteWidth 32
719#define k40_byteWidth 40
720#define k48_byteWidth 48
721#define k64_byteWidth 64
722#define k72_byteWidth 72
723#define k128_byteWidth 128
724#define k144_byteWidth 144
729 Frame _closedOrDestroyed;
731 Frame _leftHorizontal[3];
732 Frame _rightHorizontal[3];
738#define D00_RGB_BLACK 0x0000
739#define D01_RGB_DARK_BLUE 0x0004
740#define D02_RGB_LIGHT_BROWN 0x0842
741#define D03_RGB_PINK 0x086F
742#define D04_RGB_LIGHTER_BROWN 0x0A62
743#define D05_RGB_DARK_GOLD 0x0A82
744#define D06_RGB_GOLD 0x0CA2
745#define D07_RGB_RED 0x0F00
746#define D08_RGB_YELLOW 0x0FF4
747#define D09_RGB_WHITE 0x0FFF
748#define D10_MASK_RED_COMPONENT 0x0F00
749#define D10_MASK_RED_COMPONENT 0x0F00
750#define D11_MASK_GREEN_COMPONENT 0x00F0
751#define D12_MASK_BLUE_COMPONENT 0x000F
763 uint16 _grapItemCount;
764 uint32 *_bitmapCompressedByteCount;
765 uint32 *_bitmapDecompressedByteCount;
766 uint32 *_packedItemPos;
767 byte *_packedBitmaps;
771 byte *_palChangesProjectile[4];
776 byte *getCurrentVgaBuffer();
778 void unpackGraphics();
779 void loadFNT1intoBitmap(uint16 index,
byte *destBitmap);
781 void viewportSetPalette(uint16 *middleScreenPalette, uint16 *topAndBottomScreen);
782 void viewportBlitToScreen();
784 void drawBitmapDOS(
byte *srcBitmap, int16 zoneIndex,
bool flipHorizontal =
false, Color transparentColor = kDMColorFlesh, uint16 explicitWidth = 0, uint16 explicitHeight = 0);
785 void drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex,
Frame &frame, int16 zoneIndexDOS = -1);
786 void drawFloorPitOrStairsBitmap(uint16 nativeIndex,
Frame &frame, int16 zoneIndexDOS = -1);
787 void drawWallSetBitmap(
byte *bitmap,
Frame &f);
788 void drawWallSetBitmapWithoutTransparency(
byte *bitmap,
Frame &f);
791 const LayoutRecord *getLayoutRecord(int16 layoutRecordIndex);
792 byte *initBitmapStruct2(int16 graphicIndex,
Struct2 *outStruct);
793 int16 *getCoord(
byte *bitmap, int16 *outXYZ, int16 zoneIndex, int16 *inOutX, int16 *inOutY);
795 bool getZoneBox(int16 zoneIndex, int16 graphicIndex,
Box &outBox);
797 void drawWallSetBitmapDOS(int16 zoneIndex, int16 normalNegIndex, int16 oppositeNegIndex,
bool withoutTransparency =
false);
798 void loadLayoutData(uint16 graphicIndex);
800 struct DynLayoutRange {
801 DynLayoutRange *_nextRange;
806 DynLayoutRange *_dosLayoutData;
809 void drawSquareD3L(Direction dir, int16 posX, int16 posY);
810 void drawSquareD3R(Direction dir, int16 posX, int16 posY);
811 void drawSquareD3C(Direction dir, int16 posX, int16 posY);
812 void drawSquareD2L(Direction dir, int16 posX, int16 posY);
813 void drawSquareD2R(Direction dir, int16 posX, int16 posY);
814 void drawSquareD2C(Direction dir, int16 posX, int16 posY);
815 void drawSquareD1L(Direction dir, int16 posX, int16 posY);
816 void drawSquareD1R(Direction dir, int16 posX, int16 posY);
817 void drawSquareD1C(Direction dir, int16 posX, int16 posY);
818 void drawSquareD0L(Direction dir, int16 posX, int16 posY);
819 void drawSquareD0R(Direction dir, int16 posX, int16 posY);
820 void drawSquareD0C(Direction dir, int16 posX, int16 posY);
822 void applyCreatureReplColors(
int replacedColor,
int replacementColor);
824 bool isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex);
827 uint16 *_derivedBitmapByteCount;
828 byte **_derivedBitmaps;
830 int16 _stairsNativeBitmapIndexUpFrontD3L;
831 int16 _stairsNativeBitmapIndexUpFrontD3C;
832 int16 _stairsNativeBitmapIndexUpFrontD2L;
833 int16 _stairsNativeBitmapIndexUpFrontD2C;
834 int16 _stairsNativeBitmapIndexUpFrontD1L;
835 int16 _stairsNativeBitmapIndexUpFrontD1C;
836 int16 _stairsNativeBitmapIndexUpFrontD0CLeft;
837 int16 _stairsNativeBitmapIndexDownFrontD3L;
838 int16 _stairsNativeBitmapIndexDownFrontD3C;
839 int16 _stairsNativeBitmapIndexDownFrontD2L;
840 int16 _stairsNativeBitmapIndexDownFrontD2C;
841 int16 _stairsNativeBitmapIndexDownFrontD1L;
842 int16 _stairsNativeBitmapIndexDownFrontD1C;
843 int16 _stairsNativeBitmapIndexDownFrontD0CLeft;
844 int16 _stairsNativeBitmapIndexSideD2L;
845 int16 _stairsNativeBitmapIndexUpSideD1L;
846 int16 _stairsNativeBitmapIndexDownSideD1L;
847 int16 _stairsNativeBitmapIndexSideD0L;
850 byte *_bitmapCeiling;
851 byte *_bitmapWallSetD2L2;
852 byte *_bitmapWallSetD2R2;
853 byte *_bitmapWallSetD3L2;
854 byte *_bitmapWallSetD3R2;
855 byte *_bitmapWallSetD3LCR;
856 byte *_bitmapWallSetD2LCR;
857 byte *_bitmapWallSetD1L;
858 byte *_bitmapWallSetD1R;
859 byte *_bitmapWallSetD2L;
860 byte *_bitmapWallSetD2R;
861 byte *_bitmapWallSetD3L;
862 byte *_bitmapWallSetD3R;
864 byte *_bitmapWallSetD1LCR;
866 Box _boxThievesEyeViewPortVisibleArea;
867 byte _palChangesDoorButtonAndWallOrnD3[16];
868 byte _palChangesDoorButtonAndWallOrnD2[16];
870 byte *_bitmapWallSetWallD0L;
871 byte *_bitmapWallSetWallD0R;
872 byte *_bitmapWallSetDoorFrameTopD2LCR;
873 byte *_bitmapWallSetDoorFrameTopD1LCR;
874 byte *_bitmapWallSetDoorFrameLeftD3L;
875 byte *_bitmapWallSetDoorFrameLeftD3C;
876 byte *_bitmapWallSetDoorFrameLeftD2C;
877 byte *_bitmapWallSetDoorFrameLeftD1C;
878 byte *_bitmapWallSetDoorFrameRightD1C;
879 byte *_bitmapWallSetDoorFrameFront;
881 byte *_bitmapWallD3LCRFlipped;
882 byte *_bitmapWallD2LCRFlipped;
883 byte *_bitmapWallD1LCRFlipped;
884 byte *_bitmapWallD0LFlipped;
885 byte *_bitmapWallD0RFlipped;
886 byte *_bitmapWallD3LCRNative;
887 byte *_bitmapWallD2LCRNative;
888 byte *_bitmapWallD1LCRNative;
889 byte *_bitmapWallD0LNative;
890 byte *_bitmapWallD0RNative;
892 int16 _currentWallSet;
893 int16 _currentFloorSet;
895 bool _useFlippedWallAndFootprintsBitmap;
897 byte _wallOrnamentCoordSets[8][13][6];
898 uint16 _doorOrnCoordSets[4][3][6];
899 byte _doorButtonCoordSet[1];
900 uint16 _doorButtonCoordSets[1][4][6];
902 int16 _doorNativeBitmapIndexFrontD3LCR[2];
903 int16 _doorNativeBitmapIndexFrontD2LCR[2];
904 int16 _doorNativeBitmapIndexFrontD1LCR[2];
906 uint16 *_paletteFadeFrom;
907 uint16 _paletteFadeTemporary[16];
911 uint16 _screenHeight;
913 byte *_bitmapViewport;
917 bool _paletteSwitchingEnabled;
918 bool _refreshDungeonViewPaleteRequested;
919 int16 _dungeonViewPaletteIndex;
920 int16 _lastVgaViewportPaletteIndex = -1;
921 int16 _creditsPaletteIndex = 6;
922 int16 _entrancePaletteIndex = 7;
923 int16 _inventoryPaletteIndex = 8;
924 int16 _interfacePaletteIndex = 9;
925 int16 _blackPaletteIndex = 10;
926 int16 _bluePaletteIndex = 11;
927 int16 _titlePresentsPaletteIndex = 12;
928 int16 _titleDungeonPaletteIndex = 13;
929 int16 _titleMasterPaletteIndex = 14;
930 uint16 _blankBuffer[32];
931 byte _vgaPalette[32 * 3];
932 uint16 _paletteTopAndBottomScreen[16];
933 uint16 _paletteMiddleScreen[16];
938 void loadWallSet(WallSet set);
939 void loadFloorSet(FloorSet set);
941 void loadIntoBitmap(uint16 index,
byte *destBitmap);
942 void setUpScreens(uint16 width, uint16 height);
944 void initializeGraphicData();
945 void loadCurrentMapGraphics();
946 void allocateFlippedWallBitmaps();
947 void drawDoorBitmap(
Frame *frame);
948 void drawDoorFrameBitmapFlippedHorizontally(
byte *bitmap,
Frame *frame);
949 void drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton);
958 uint16 getGraphicIndex(uint16 index)
const;
960 void copyBitmapAndFlipHorizontal(
byte *srcBitmap,
byte *destBitmap, uint16 byteWidth, uint16 height);
961 void drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIndex);
962 void drawDoor(uint16 doorThingIndex, DoorState doorState, int16 *doorNativeBitmapIndices, int16 byteCount,
963 DoorOrnament doorOrnament,
DoorFrames *doorFrames, int16 zoneIndexDOS = -1);
964 void drawDoorOrnament(int16 doorOrnOdinal, DoorOrnament doorOrnament);
965 void drawCeilingPit(int16 nativeBitmapIndex,
Frame *frame, int16 mapX, int16 mapY,
bool flipHorizontal, int16 zoneIndexDOS = -1);
967 void blitToViewport(
byte *bitmap,
Box &box, int16 byteWidth, Color transparent, int16 height);
968 void blitToViewport(
byte *bitmap, int16 *box, int16 byteWidth, Color transparent, int16 height);
969 void blitToScreen(
byte *bitmap,
const Box *box, int16 byteWidth, Color transparent, int16 height);
976 void blitToBitmap(
byte *srcBitmap,
byte *destBitmap,
const Box &box, uint16 srcX, uint16 srcY, uint16 srcByteWidth,
977 uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight);
979 void blitBoxFilledWithMaskedBitmap(
byte *src,
byte *dest,
byte *mask,
byte *tmp,
Box &box, int16 lastUnitIndex,
980 int16 firstUnitIndex, int16 destByteWidth, int16 transparent,
981 int16 xPos, int16 yPos, int16 destHeight, int16 height2);
983 void blitToBitmapShrinkWithPalChange(
byte *srcBitmap,
byte *destBitmap,
984 int16 srcPixelWidth, int16 srcHight, int16 destPixelWidth, int16 destHeight,
byte *palChange);
985 void flipBitmapHorizontal(
byte *bitmap, uint16 byteWidth, uint16 height);
986 void flipBitmapVertical(
byte *bitmap, uint16 byteWidth, uint16 height);
987 byte *getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16 &returnByteWidth, int16 &returnHeight);
989 void fillBitmap(
byte *bitmap, Color color, uint16 byteWidth, uint16 height);
990 void fillScreen(Color color);
992 void fillScreenBox(
Box &box, Color color);
994 void fillBoxBitmap(
byte *destBitmap,
Box &box, Color color, int16 byteWidth, int16 height);
995 void drawDungeon(Direction dir, int16 posX, int16 posY);
996 void drawFloorAndCeiling();
998 void drawViewport(int16 palSwitchingRequestedState);
1000 byte *getNativeBitmapOrGraphic(uint16 index);
1002 uint32 getCompressedDataSize(uint16 index);
1005 int16 getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale);
1006 int16 getScaledDimension(int16 dimension, int16 scale);
1007 void drawObjectsCreaturesProjectilesExplosions(
Thing thingParam, Direction directionParam,
1008 int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
1009 CellOrder orderedViewCellOrdinals);
1010 uint16 getNormalizedByteWidth(uint16 byteWidth);
1011 uint16 getVerticalOffsetM23(uint16 val);
1012 uint16 getHorizontalOffsetM22(uint16 val);
1014 int16 _championPortraitOrdinal;
1015 int16 _currMapAlcoveOrnIndices[k3_AlcoveOrnCount];
1016 int16 _currMapFountainOrnIndices[k1_FountainOrnCount];
1020 byte *_currMapAllowedCreatureTypes;
1021 byte _currMapWallOrnIndices[16];
1022 byte _currMapFloorOrnIndices[16];
1023 byte _currMapDoorOrnIndices[18];
1025 int16 _currMapViAltarIndex;
1027 Thing _inscriptionThing;
1029 bool _drawFloorAndCeilingRequested;
1033 bool _useByteBoxCoordinates;
1034 bool _doNotDrawFluxcagesDuringEndgame;
1036 Frame _doorFrameLeftD1C;
1037 Frame _doorFrameRightD1C;
1039 Box _boxMovementArrows;
1040 byte _palChangeSmoke[16];
1041 byte _projectileScales[7];
1043 Frame _frameWallD3R2;
1044 Frame _frameWalls163[12];
1048 uint16 _palCredits[16];
1049 uint16 _palDungeonView[6][16];
1050 byte _palChangesCreatureD3[16];
1051 byte _palChangesCreatureD2[16];
1052 byte _palChangesNoChanges[16];
1053 byte _palChangesFloorOrnD3[16];
1054 byte _palChangesFloorOrnD2[16];
1056 bool isDerivedBitmapInCache(int16 derivedBitmapIndex);
1057 byte *getDerivedBitmap(int16 derivedBitmapIndex);
1058 void addDerivedBitmap(int16 derivedBitmapIndex);
1059 void releaseBlock(uint16 index);
1060 uint16 getDarkenedColor(uint16 RGBcolor);
1061 void startEndFadeToPalette(uint16 *P0849_pui_Palette);
1062 void buildPaletteChangeCopperList(uint16 *middleScreen, uint16 *topAndBottom);
1063 void setMultipleColorsInPalette(int16 paletteIndex);
1064 void shadeScreenBox(
Box *box, Color color);
1067 void initConstants();
1068 uint16 getBitmapByteCount(uint16 pixelWidth, uint16 height);
Definition: memstream.h:43
uint16 getPixelWidth(uint16 index)
Gives the width of an IMG0 type item.
uint16 getPixelHeight(uint16 index)
Gives the height of an IMG1 type item.
bool getBitmapDimensions(const byte *bitmap, uint16 &width, uint16 &height)
Looks up actual decompressed dimensions of a display bitmap buffer.
T right
Definition: rect.h:171
T left
Definition: rect.h:170