2016-08-26 20:36:31 +00:00
/* ScummVM - Graphic Adventure Engine
2021-12-26 17:47:58 +00:00
*
* ScummVM is the legal property of its developers , whose names
* are too numerous to list here . Please refer to the COPYRIGHT
* file distributed with this source distribution .
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*
*/
2016-08-26 20:36:31 +00:00
/*
2021-12-26 17:47:58 +00:00
* Based on the Reverse Engineering work of Christophe Fontanel ,
* maintainer of the Dungeon Master Encyclopaedia ( http : //dmweb.free.fr/)
*/
2016-08-26 20:36:31 +00:00
2016-09-03 08:47:16 +00:00
# ifndef DM_DUNGEONMAN_H
# define DM_DUNGEONMAN_H
2016-05-03 15:55:04 +00:00
2016-09-03 08:38:43 +00:00
# include "dm/dm.h"
# include "dm/gfx.h"
2016-05-03 15:55:04 +00:00
namespace DM {
2016-06-28 16:04:32 +00:00
/* Object info */
2016-09-11 19:22:22 +00:00
enum ObjectInfoIndexConst {
kDMObjectInfoIndexFirstScroll = 0 , // @ C000_OBJECT_INFO_INDEX_FIRST_SCROLL
kDMObjectInfoIndexFirstContainer = 1 , // @ C001_OBJECT_INFO_INDEX_FIRST_CONTAINER
kDMObjectInfoIndexFirstPotion = 2 , // @ C002_OBJECT_INFO_INDEX_FIRST_POTION
kDMObjectInfoIndexFirstWeapon = 23 , // @ C023_OBJECT_INFO_INDEX_FIRST_WEAPON
kDMObjectInfoIndexFirstArmour = 69 , // @ C069_OBJECT_INFO_INDEX_FIRST_ARMOUR
kDMObjectInfoIndexFirstJunk = 127 // @ C127_OBJECT_INFO_INDEX_FIRST_JUNK
} ;
2016-06-28 16:04:32 +00:00
2016-09-11 19:22:22 +00:00
# define kDMMapXNotOnASquare -1 // @ CM1_MAPX_NOT_ON_A_SQUARE
2016-08-26 20:40:13 +00:00
2016-06-23 21:54:37 +00:00
enum ElementType {
2016-09-11 19:22:22 +00:00
kDMElementTypeChampion = - 2 , // @ CM2_ELEMENT_CHAMPION /* Values -2 and -1 are only used as projectile impact types */
kDMElementTypeCreature = - 1 , // @ CM1_ELEMENT_CREATURE
kDMElementTypeWall = 0 , // @ C00_ELEMENT_WALL /* Values 0-6 are used as square types and projectile impact types. Values 0-2 and 5-6 are also used for square aspect */
kDMElementTypeCorridor = 1 , // @ C01_ELEMENT_CORRIDOR
kDMElementTypePit = 2 , // @ C02_ELEMENT_PIT
kDMElementTypeStairs = 3 , // @ C03_ELEMENT_STAIRS
kDMElementTypeDoor = 4 , // @ C04_ELEMENT_DOOR
kDMElementTypeTeleporter = 5 , // @ C05_ELEMENT_TELEPORTER
kDMElementTypeFakeWall = 6 , // @ C06_ELEMENT_FAKEWALL
kDMElementTypeDoorSide = 16 , // @ C16_ELEMENT_DOOR_SIDE /* Values 16-19 are only used for square aspect */
kDMElementTypeDoorFront = 17 , // @ C17_ELEMENT_DOOR_FRONT
kDMElementTypeStairsSide = 18 , // @ C18_ELEMENT_STAIRS_SIDE
2016-09-11 21:22:06 +00:00
kDMElementTypeStairsFront = 19 // @ C19_ELEMENT_STAIRS_FRONT
2016-06-23 21:54:37 +00:00
} ;
2016-06-18 22:26:01 +00:00
enum ObjectAllowedSlot {
2016-09-11 19:22:22 +00:00
kDMMaskMouth = 0x0001 , // @ MASK0x0001_MOUTH
kDMMaskHead = 0x0002 , // @ MASK0x0002_HEAD
kDMMaskNeck = 0x0004 , // @ MASK0x0004_NECK
2016-09-11 21:06:29 +00:00
kDMMaskTorso = 0x0008 , // @ MASK0x0008_TORSO
kDMMaskLegs = 0x0010 , // @ MASK0x0010_LEGS
kDMMaskFeet = 0x0020 , // @ MASK0x0020_FEET
kDMMaskQuiverLine1 = 0x0040 , // @ MASK0x0040_QUIVER_LINE1
kDMMaskQuiverLine2 = 0x0080 , // @ MASK0x0080_QUIVER_LINE2
kDMMaskPouchPassAndThroughDoors = 0x0100 , // @ MASK0x0100_POUCH_PASS_AND_THROUGH_DOORS
kDMMaskHands = 0x0200 , // @ MASK0x0200_HANDS
kDMMaskContainer = 0x0400 , // @ MASK0x0400_CONTAINER
2016-09-11 22:03:48 +00:00
kDMMaskFootprints = 0x8000 , // @ MASK0x8000_FOOTPRINTS
kDMMaskRandomDrop = 0x8000 // @ MASK0x8000_RANDOM_DROP
2016-06-18 22:26:01 +00:00
} ;
2016-09-11 21:06:29 +00:00
enum ArmourAttribute {
kDMArmourAttributeShield = 0x0080 , // @ MASK0x0080_IS_A_SHIELD
kDMArmourAttributeSharpDefense = 0x0007 // @ MASK0x0007_SHARP_DEFENSE
} ;
enum WeaponClass {
kDMWeaponClassNone = - 1 ,
/* Class 0: SWING weapons */
2016-09-11 21:22:06 +00:00
kDMWeaponClassSwingWeapon = 0 , // @ C000_CLASS_SWING_WEAPON
2016-09-11 21:06:29 +00:00
/* Class 1 to 15: THROW weapons */
2016-09-11 21:22:06 +00:00
kDMWeaponClassDaggerAndAxes = 2 , // @ C002_CLASS_DAGGER_AND_AXES
2016-09-11 21:06:29 +00:00
kDMWeaponClassBowAmmunition = 10 , // @ C010_CLASS_BOW_AMMUNITION
kDMWeaponClassSlingAmmunition = 11 , // @ C011_CLASS_SLING_AMMUNITION
kDMWeaponClassPoisinDart = 12 , // @ C012_CLASS_POISON_DART
/* Class 16 to 111: SHOOT weapons */
2016-09-11 21:22:06 +00:00
kDMWeaponClassFirstBow = 16 , // @ C016_CLASS_FIRST_BOW
2016-09-11 21:06:29 +00:00
kDMWeaponClassLastBow = 31 , // @ C031_CLASS_LAST_BOW
kDMWeaponClassFirstSling = 32 , // @ C032_CLASS_FIRST_SLING
kDMWeaponClassLastSling = 47 , // @ C047_CLASS_LAST_SLING
/* Class 112 to 255: Magic and special weapons */
kDMWeaponClassFirstMagicWeapon = 112 // @ C112_CLASS_FIRST_MAGIC_WEAPON
} ;
enum TextType {
/* Used for text on walls */
2016-09-11 21:22:06 +00:00
kDMTextTypeInscription = 0 , // @ C0_TEXT_TYPE_INSCRIPTION
2016-09-11 21:06:29 +00:00
/* Used for messages displayed when the party walks on a square */
2016-09-11 21:22:06 +00:00
kDMTextTypeMessage = 1 , // @ C1_TEXT_TYPE_MESSAGE
2016-09-11 21:06:29 +00:00
/* Used for text on scrolls and champion information */
2016-09-11 21:22:06 +00:00
kDMTextTypeScroll = 2 // @ C2_TEXT_TYPE_SCROLL
2016-09-11 21:06:29 +00:00
} ;
enum SquareAspect {
kDMSquareAspectElement = 0 , // @ C0_ELEMENT
2016-09-11 21:22:06 +00:00
kDMSquareAspectFirstGroupOrObject = 1 , // @ C1_FIRST_GROUP_OR_OBJECT
kDMSquareAspectRightWallOrnOrd = 2 , // @ C2_RIGHT_WALL_ORNAMENT_ORDINAL
kDMSquareFrontWallOrnOrd = 3 , // @ C3_FRONT_WALL_ORNAMENT_ORDINAL
kDMSquareAspectLeftWallOrnOrd = 4 , // @ C4_LEFT_WALL_ORNAMENT_ORDINAL
kDMSquareAspectPitInvisible = 2 , // @ C2_PIT_INVISIBLE
kDMSquareAspectTeleporterVisible = 2 , // @ C2_TELEPORTER_VISIBLE
kDMSquareAspectStairsUp = 2 , // @ C2_STAIRS_UP
kDMSquareAspectDoorState = 2 , // @ C2_DOOR_STATE
kDMSquareAspectDoorThingIndex = 3 , // @ C3_DOOR_THING_INDEX
2016-09-11 21:22:36 +00:00
kDMSquareAspectFloorOrn = 4 // @ C4_FLOOR_ORNAMENT_ORDINAL
2016-09-11 21:06:29 +00:00
} ;
2016-09-11 22:03:48 +00:00
# define kDMImmuneToFire 15 // @ C15_IMMUNE_TO_FIRE
# define kDMImmuneToPoison 15 // @ C15_IMMUNE_TO_POISON
2016-09-11 21:06:29 +00:00
enum TeleporterScope {
2016-09-11 22:03:48 +00:00
kDMTeleporterScopeCreatures = 1 , // @ MASK0x0001_SCOPE_CREATURES
kDMTeleporterScopeObjectsOrParty = 2 // @ MASK0x0002_SCOPE_OBJECTS_OR_PARTY
2016-09-11 21:06:29 +00:00
} ;
enum SensorType {
2016-09-11 22:03:48 +00:00
kDMSensorDisabled = 0 , // @ C000_SENSOR_DISABLED /* Never triggered, may be used for a floor or wall ornament */
kDMSensorFloorTheronPartyCreatureObj = 1 , // @ C001_SENSOR_FLOOR_THERON_PARTY_CREATURE_OBJECT /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorTheronPartyCreature = 2 , // @ C002_SENSOR_FLOOR_THERON_PARTY_CREATURE /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorParty = 3 , // @ C003_SENSOR_FLOOR_PARTY /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorObj = 4 , // @ C004_SENSOR_FLOOR_OBJECT /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorPartyOnStairs = 5 , // @ C005_SENSOR_FLOOR_PARTY_ON_STAIRS /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorGroupGenerator = 6 , // @ C006_SENSOR_FLOOR_GROUP_GENERATOR /* Triggered by event F0245_TIMELINE_ProcessEvent5_Square_Corridor */
kDMSensorFloorCreature = 7 , // @ C007_SENSOR_FLOOR_CREATURE /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorPartyPossession = 8 , // @ C008_SENSOR_FLOOR_PARTY_POSSESSION /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorFloorVersionChecker = 9 , // @ C009_SENSOR_FLOOR_VERSION_CHECKER /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
kDMSensorWallOrnClick = 1 , // @ C001_SENSOR_WALL_ORNAMENT_CLICK /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallOrnClickWithAnyObj = 2 , // @ C002_SENSOR_WALL_ORNAMENT_CLICK_WITH_ANY_OBJECT /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallOrnClickWithSpecObj = 3 , // @ C003_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallOrnClickWithSpecObjRemoved = 4 , // @ C004_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallAndOrGate = 5 , // @ C005_SENSOR_WALL_AND_OR_GATE /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallCountdown = 6 , // @ C006_SENSOR_WALL_COUNTDOWN /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallSingleProjLauncherNewObj = 7 , // @ C007_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_NEW_OBJECT /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallSingleProjLauncherExplosion = 8 , // @ C008_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_EXPLOSION /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallDoubleProjLauncherNewObj = 9 , // @ C009_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_NEW_OBJECT /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallDoubleProjLauncherExplosion = 10 , // @ C010_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_EXPLOSION /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallOrnClickWithSpecObjRemovedRotateSensors = 11 , // @ C011_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED_ROTATE_SENSORS /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallObjGeneratorRotateSensors = 12 , // @ C012_SENSOR_WALL_OBJECT_GENERATOR_ROTATE_SENSORS /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallSingleObjStorageRotateSensors = 13 , // @ C013_SENSOR_WALL_SINGLE_OBJECT_STORAGE_ROTATE_SENSORS /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallSingleProjLauncherSquareObj = 14 , // @ C014_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_SQUARE_OBJECT /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallDoubleProjLauncherSquareObj = 15 , // @ C015_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_SQUARE_OBJECT /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallObjExchanger = 16 , // @ C016_SENSOR_WALL_OBJECT_EXCHANGER /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallOrnClickWithSpecObjRemovedSensor = 17 , // @ C017_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED_REMOVE_SENSOR /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
kDMSensorWallEndGame = 18 , // @ C018_SENSOR_WALL_END_GAME /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
kDMSensorWallChampionPortrait = 127 // @ C127_SENSOR_WALL_CHAMPION_PORTRAIT /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
2016-09-11 21:06:29 +00:00
} ;
enum WeaponType {
2016-09-11 22:03:48 +00:00
kDMWeaponTorch = 2 , // @ C02_WEAPON_TORCH
kDMWeaponDagger = 8 , // @ C08_WEAPON_DAGGER
kDMWeaponFalchion = 9 , // @ C09_WEAPON_FALCHION
kDMWeaponSword = 10 , // @ C10_WEAPON_SWORD
kDMWeaponClub = 23 , // @ C23_WEAPON_CLUB
kDMWeaponStoneClub = 24 , // @ C24_WEAPON_STONE_CLUB
kDMWeaponArrow = 27 , // @ C27_WEAPON_ARROW
kDMWeaponSlayer = 28 , // @ C28_WEAPON_SLAYER
kDMWeaponRock = 30 , // @ C30_WEAPON_ROCK
kDMWeaponPoisonDart = 31 , // @ C31_WEAPON_POISON_DART
kDMWeaponThrowingStar = 32 // @ C32_WEAPON_THROWING_STAR
2016-09-11 21:06:29 +00:00
} ;
enum ArmourType {
2016-09-11 22:03:48 +00:00
kDMArmourWoodenShield = 30 , // @ C30_ARMOUR_WOODEN_SHIELD
kDMArmourArmet = 38 , // @ C38_ARMOUR_ARMET
kDMArmourTorsoPlate = 39 , // @ C39_ARMOUR_TORSO_PLATE
kDMArmourLegPlate = 40 , // @ C40_ARMOUR_LEG_PLATE
kDMArmourFootPlate = 41 // @ C41_ARMOUR_FOOT_PLATE
2016-09-11 21:06:29 +00:00
} ;
enum PotionType {
2016-09-12 20:20:31 +00:00
kDMPotionTypeVen = 3 , // @ C03_POTION_VEN_POTION,
kDMPotionTypeRos = 6 , // @ C06_POTION_ROS_POTION,
kDMPotionTypeKu = 7 , // @ C07_POTION_KU_POTION,
kDMPotionTypeDane = 8 , // @ C08_POTION_DANE_POTION,
kDMPotionTypeNeta = 9 , // @ C09_POTION_NETA_POTION,
kDMPotionTypeAntivenin = 10 , // @ C10_POTION_ANTIVENIN,
kDMPotionTypeMon = 11 , // @ C11_POTION_MON_POTION,
kDMPotionTypeYa = 12 , // @ C12_POTION_YA_POTION,
kDMPotionTypeEe = 13 , // @ C13_POTION_EE_POTION,
kDMPotionTypeVi = 14 , // @ C14_POTION_VI_POTION,
kDMPotionTypeWaterFlask = 15 , // @ C15_POTION_WATER_FLASK,
kDMPotionTypeFulBomb = 19 , // @ C19_POTION_FUL_BOMB,
kDMPotionTypeEmptyFlask = 20 // @ C20_POTION_EMPTY_FLASK,
2016-09-11 21:06:29 +00:00
} ;
enum JunkType {
2016-09-12 20:20:31 +00:00
kDMJunkTypeWaterskin = 1 , // @ C01_JUNK_WATERSKIN,
kDMJunkTypeBones = 5 , // @ C05_JUNK_BONES,
kDMJunkTypeBoulder = 25 , // @ C25_JUNK_BOULDER,
kDMJunkTypeScreamerSlice = 33 , // @ C33_JUNK_SCREAMER_SLICE,
kDMJunkTypeWormRound = 34 , // @ C34_JUNK_WORM_ROUND,
kDMJunkTypeDrumstickShank = 35 , // @ C35_JUNK_DRUMSTICK_SHANK,
kDMJunkTypeDragonSteak = 36 , // @ C36_JUNK_DRAGON_STEAK,
kDMJunkTypeMagicalBoxBlue = 42 , // @ C42_JUNK_MAGICAL_BOX_BLUE,
kDMJunkTypeMagicalBoxGreen = 43 , // @ C43_JUNK_MAGICAL_BOX_GREEN,
kDMJunkTypeZokathra = 51 // @ C51_JUNK_ZOKATHRA,
2016-09-11 21:06:29 +00:00
} ;
2016-09-12 20:46:38 +00:00
enum ExplosionType {
kDMExplosionTypeFireball = 0 , // @ C000_EXPLOSION_FIREBALL
kDMExplosionTypeSlime = 1 , // @ C001_EXPLOSION_SLIME
kDMExplosionTypeLightningBolt = 2 , // @ C002_EXPLOSION_LIGHTNING_BOLT
kDMExplosionTypeHarmNonMaterial = 3 , // @ C003_EXPLOSION_HARM_NON_MATERIAL
kDMExplosionTypeOpenDoor = 4 , // @ C004_EXPLOSION_OPEN_DOOR
kDMExplosionTypePoisonBolt = 6 , // @ C006_EXPLOSION_POISON_BOLT
kDMExplosionTypePoisonCloud = 7 , // @ C007_EXPLOSION_POISON_CLOUD
kDMExplosionTypeSmoke = 40 , // @ C040_EXPLOSION_SMOKE
kDMExplosionTypeFluxcage = 50 , // @ C050_EXPLOSION_FLUXCAGE
kDMExplosionTypeRebirthStep1 = 100 , // @ C100_EXPLOSION_REBIRTH_STEP1
kDMExplosionTypeRebirthStep2 = 101 // @ C101_EXPLOSION_REBIRTH_STEP2
} ;
2016-09-11 21:06:29 +00:00
enum SquareMask {
2016-09-13 05:46:38 +00:00
kDMSquareMaskWallWestRandOrnament = 0x1 , // @ MASK0x0001_WALL_WEST_RANDOM_ORNAMENT_ALLOWED
kDMSquareMaslWallSouthRandOrnament = 0x2 , // @ MASK0x0002_WALL_SOUTH_RANDOM_ORNAMENT_ALLOWED
kDMSquareMaskWallEastRandOrnament = 0x4 , // @ MASK0x0004_WALL_EAST_RANDOM_ORNAMENT_ALLOWED
kDMSquareMaskWallNorthRandOrnament = 0x8 , // @ MASK0x0008_WALL_NORTH_RANDOM_ORNAMENT_ALLOWED
kDMSquareMaskCorridorRandOrnament = 0x8 , // @ MASK0x0008_CORRIDOR_RANDOM_ORNAMENT_ALLOWED
kDMSquareMaskPitImaginary = 0x1 , // @ MASK0x0001_PIT_IMAGINARY
kDMSquareMaskPitInvisible = 0x4 , // @ MASK0x0004_PIT_INVISIBLE
kDMSquareMaskPitOpen = 0x8 , // @ MASK0x0008_PIT_OPEN
kDMSquareMaskStairsUp = 0x4 , // @ MASK0x0004_STAIRS_UP
kDMSquareMaskStairsNorthSouth = 0x8 , // @ MASK0x0008_STAIRS_NORTH_SOUTH_ORIENTATION
kDMSquareMaskDoorNorthSouth = 0x8 , // @ MASK0x0008_DOOR_NORTH_SOUTH_ORIENTATION
kDMSquareMaskTeleporterVisible = 0x4 , // @ MASK0x0004_TELEPORTER_VISIBLE
kDMSquareMaskTeleporterOpen = 0x8 , // @ MASK0x0008_TELEPORTER_OPEN
kDMSquareMaskFakeWallImaginary = 0x1 , // @ MASK0x0001_FAKEWALL_IMAGINARY
kDMSquareMaskFakeWallOpen = 0x4 , // @ MASK0x0004_FAKEWALL_OPEN
kDMSquareMaskFakeWallRandOrnamentOrFootprintsAllowed = 0x8 , // @ MASK0x0008_FAKEWALL_RANDOM_ORNAMENT_OR_FOOTPRINTS_ALLOWED
kDMSquareMaskThingListPresent = 0x10 // @ MASK0x0010_THING_LIST_PRESENT
2016-09-11 21:06:29 +00:00
} ;
2016-09-13 05:46:38 +00:00
# define kDMMaskChampionBones 0x8000 // @ MASK0x8000_CHAMPION_BONES
# define kDMMaskThingType 0x7FFF // @ MASK0x7FFF_THING_TYPE
2016-09-11 21:06:29 +00:00
2016-09-11 19:22:22 +00:00
class ObjectInfoIndex {
2016-06-18 22:26:01 +00:00
public :
int16 _type ;
uint16 _objectAspectIndex ;
uint16 _actionSetIndex ;
uint16 _allowedSlots ;
2016-09-11 19:22:22 +00:00
ObjectInfoIndex ( int16 type , uint16 objectAspectIndex , uint16 actionSetIndex , uint16 allowedSlots )
2016-06-18 22:26:01 +00:00
: _type ( type ) , _objectAspectIndex ( objectAspectIndex ) , _actionSetIndex ( actionSetIndex ) , _allowedSlots ( allowedSlots ) { }
2016-09-11 19:22:22 +00:00
ObjectInfoIndex ( ) : _type ( 0 ) , _objectAspectIndex ( 0 ) , _actionSetIndex ( 0 ) , _allowedSlots ( 0 ) { }
2016-06-18 22:26:01 +00:00
bool getAllowedSlot ( ObjectAllowedSlot slot ) { return _allowedSlots & slot ; }
2016-08-26 20:07:38 +00:00
uint16 getAllowedSlots ( ) { return _allowedSlots ; }
2016-06-18 22:26:01 +00:00
void setAllowedSlot ( ObjectAllowedSlot slot , bool val ) {
if ( val ) {
_allowedSlots | = slot ;
} else {
_allowedSlots & = ~ slot ;
}
}
} ; // @ OBJECT_INFO
2016-06-18 10:53:52 +00:00
class ArmourInfo {
public :
uint16 _weight ;
uint16 _defense ;
uint16 _attributes ;
2016-08-20 08:36:28 +00:00
2016-06-18 10:58:34 +00:00
ArmourInfo ( uint16 weight , uint16 defense , uint16 attributes )
: _weight ( weight ) , _defense ( defense ) , _attributes ( attributes ) { }
2016-08-20 08:36:28 +00:00
ArmourInfo ( ) : _weight ( 0 ) , _defense ( 0 ) , _attributes ( 0 ) { }
2016-06-18 10:53:52 +00:00
uint16 getAttribute ( ArmourAttribute attribute ) { return _attributes & attribute ; }
void setAttribute ( ArmourAttribute attribute ) { _attributes | = attribute ; }
} ; // @ ARMOUR_INFO
2016-05-07 18:53:35 +00:00
2016-06-18 10:37:30 +00:00
class WeaponInfo {
public :
2016-06-28 16:04:32 +00:00
uint16 _weight ;
uint16 _class ;
uint16 _strength ;
uint16 _kineticEnergy ;
2016-06-18 10:44:41 +00:00
private :
uint16 _attributes ; /* Bits 15-13 Unreferenced */
public :
2016-06-28 16:04:32 +00:00
WeaponInfo ( uint16 weight , uint16 wClass , uint16 strength , uint16 kineticEnergy , uint16 attributes )
: _weight ( weight ) , _class ( wClass ) , _strength ( strength ) , _kineticEnergy ( kineticEnergy ) , _attributes ( attributes ) { }
2016-08-20 08:36:28 +00:00
WeaponInfo ( ) : _weight ( 0 ) , _class ( 0 ) , _strength ( 0 ) , _kineticEnergy ( 0 ) , _attributes ( 0 ) { }
2016-06-18 10:37:30 +00:00
2016-06-28 16:04:32 +00:00
uint16 getShootAttack ( ) { return _attributes & 0xFF ; } // @ M65_SHOOT_ATTACK
uint16 getProjectileAspectOrdinal ( ) { return ( _attributes > > 8 ) & 0x1F ; } // @ M66_PROJECTILE_ASPECT_ORDINAL
2016-06-18 10:37:30 +00:00
} ; // @ WEAPON_INFO
2016-07-02 15:46:05 +00:00
class CreatureInfo {
public :
2016-06-18 15:48:48 +00:00
byte _creatureAspectIndex ;
byte _attackSoundOrdinal ;
uint16 _attributes ; /* Bits 15-14 Unreferenced */
uint16 _graphicInfo ; /* Bits 11 and 6 Unreferenced */
byte _movementTicks ; /* Value 255 means the creature cannot move */
byte _attackTicks ; /* Minimum ticks between attacks */
byte _defense ;
byte _baseHealth ;
byte _attack ;
byte _poisonAttack ;
byte _dexterity ;
uint16 _ranges ; /* Bits 7-4 Unreferenced */
uint16 _properties ;
uint16 _resistances ; /* Bits 15-12 and 3-0 Unreferenced */
uint16 _animationTicks ; /* Bits 15-12 Unreferenced */
uint16 _woundProbabilities ; /* Contains 4 probabilities to wound a champion's Head (Bits 15-12), Legs (Bits 11-8), Torso (Bits 7-4) and Feet (Bits 3-0) */
byte _attackType ;
2016-07-06 22:46:51 +00:00
2016-08-23 21:47:09 +00:00
uint16 getFearResistance ( ) { return ( _properties > > 4 ) & 0xF ; }
uint16 getExperience ( ) { return ( _properties > > 8 ) & 0xF ; }
uint16 getWariness ( ) { return ( _properties > > 12 ) & 0xF ; }
uint16 getFireResistance ( ) { return ( _resistances > > 4 ) & 0xF ; }
uint16 getPoisonResistance ( ) { return ( _resistances > > 8 ) & 0xF ; }
static uint16 getHeight ( uint16 attrib ) { return ( attrib > > 7 ) & 0x3 ; }
uint16 getSightRange ( ) { return ( _ranges ) & 0xF ; }
uint16 getSmellRange ( ) { return ( _ranges > > 8 ) & 0xF ; }
uint16 getAttackRange ( ) { return ( _ranges > > 12 ) & 0xF ; }
2016-05-15 13:53:00 +00:00
} ; // @ CREATURE_INFO
class Door {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Door ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
bool isMeleeDestructible ( ) { return ( _attributes > > 8 ) & 1 ; }
bool isMagicDestructible ( ) { return ( _attributes > > 7 ) & 1 ; }
bool hasButton ( ) { return ( _attributes > > 6 ) & 1 ; }
bool opensVertically ( ) { return ( _attributes > > 5 ) & 1 ; }
byte getOrnOrdinal ( ) { return ( _attributes > > 1 ) & 0xF ; }
byte getType ( ) { return _attributes & 1 ; }
2016-05-15 13:53:00 +00:00
} ; // @ DOOR
class Teleporter {
2016-08-26 20:18:01 +00:00
Thing _nextThing ;
uint16 _attributes ;
uint16 _destMapIndex ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Teleporter ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) , _destMapIndex ( rawDat [ 2 ] ) { }
2016-08-26 20:18:01 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-07-06 22:46:51 +00:00
bool isAudible ( ) { return ( _attributes > > 15 ) & 1 ; }
2016-08-26 20:18:01 +00:00
TeleporterScope getScope ( ) { return ( TeleporterScope ) ( ( _attributes > > 13 ) & 1 ) ; }
2016-07-06 22:46:51 +00:00
bool getAbsoluteRotation ( ) { return ( _attributes > > 12 ) & 1 ; }
2016-07-25 12:35:26 +00:00
Direction getRotation ( ) { return ( Direction ) ( ( _attributes > > 10 ) & 1 ) ; }
2016-07-06 22:46:51 +00:00
byte getTargetMapY ( ) { return ( _attributes > > 5 ) & 0xF ; }
byte getTargetMapX ( ) { return _attributes & 0xF ; }
uint16 getTargetMapIndex ( ) { return _destMapIndex > > 8 ; }
2016-05-15 13:53:00 +00:00
} ; // @ TELEPORTER
class TextString {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _textDataRef ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit TextString ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _textDataRef ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
uint16 getWordOffset ( ) { return _textDataRef > > 3 ; }
bool isVisible ( ) { return _textDataRef & 1 ; }
2016-07-11 15:06:24 +00:00
void setVisible ( bool visible ) { _textDataRef = ( _textDataRef & ~ 1 ) | ( visible ? 1 : 0 ) ; }
2016-05-15 13:53:00 +00:00
} ; // @ TEXTSTRING
class Sensor {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _datAndType ;
2016-07-11 15:06:24 +00:00
uint16 _attributes ; // A
uint16 _action ; // B
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Sensor ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _datAndType ( rawDat [ 1 ] ) , _attributes ( rawDat [ 2 ] ) , _action ( rawDat [ 3 ] ) { }
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-06-23 15:11:53 +00:00
void setNextThing ( Thing thing ) { _nextThing = thing ; }
2016-06-18 15:48:48 +00:00
SensorType getType ( ) { return ( SensorType ) ( _datAndType & 0x7F ) ; } // @ M39_TYPE
2016-07-14 17:44:58 +00:00
uint16 getData ( ) { return ( _datAndType > > 7 ) & 0x1FF ; } // @ M40_DATA
2016-07-11 15:06:24 +00:00
static uint16 getDataMask1 ( uint16 data ) { return ( data > > 7 ) & 0xF ; } // @ M42_MASK1
static uint16 getDataMask2 ( uint16 data ) { return ( data > > 11 ) & 0xF ; } // @ M43_MASK2
2016-07-27 16:17:56 +00:00
void setData ( uint16 dat ) { _datAndType = dat ; } // @ M41_SET_DATA
2016-06-18 15:48:48 +00:00
void setTypeDisabled ( ) { _datAndType & = 0xFF80 ; } // @ M44_SET_TYPE_DISABLED
2016-07-06 22:46:51 +00:00
2016-08-24 06:03:55 +00:00
bool getAttrOnlyOnce ( ) { return ( _attributes > > 2 ) & 1 ; }
uint16 getAttrEffectA ( ) { return ( _attributes > > 3 ) & 0x3 ; }
bool getAttrRevertEffectA ( ) { return ( _attributes > > 5 ) & 0x1 ; }
bool getAttrAudibleA ( ) { return ( _attributes > > 6 ) & 0x1 ; }
uint16 getAttrValue ( ) { return ( _attributes > > 7 ) & 0xF ; }
bool getAttrLocalEffect ( ) { return ( _attributes > > 11 ) & 1 ; }
uint16 getAttrOrnOrdinal ( ) { return _attributes > > 12 ; }
uint16 getActionTargetMapY ( ) { return ( _action > > 11 ) ; }
uint16 getActionTargetMapX ( ) { return ( _action > > 6 ) & 0x1F ; }
2016-09-12 19:56:49 +00:00
Cell getActionTargetCell ( ) { return ( Cell ) ( ( _action > > 4 ) & 3 ) ; }
2016-08-24 06:03:55 +00:00
uint16 getActionHealthMultiplier ( ) { return ( ( _action > > 4 ) & 0xF ) ; } // @ M45_HEALTH_MULTIPLIER
uint16 getActionTicks ( ) { return ( ( _action > > 4 ) > > 4 ) & 0xFFF ; } // @ M46_TICKS
uint16 getActionKineticEnergy ( ) { return ( ( _action > > 4 ) & 0xFF ) ; } // @ M47_KINETIC_ENERGY
uint16 getActionStepEnergy ( ) { return ( ( _action > > 4 ) > > 8 ) & 0xFF ; } // @ M48_STEP_ENERGY
uint16 getActionLocalEffect ( ) { return ( _action > > 4 ) ; } // @ M49_LOCAL_EFFECT
2016-06-23 15:11:53 +00:00
2016-07-12 06:08:57 +00:00
void setDatAndTypeWithOr ( uint16 val ) { _datAndType | = val ; }
2016-06-23 15:11:53 +00:00
2016-05-15 13:53:00 +00:00
} ; // @ SENSOR
class Weapon {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _desc ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Weapon ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _desc ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
WeaponType getType ( ) { return ( WeaponType ) ( _desc & 0x7F ) ; }
2016-07-06 22:46:51 +00:00
void setType ( uint16 val ) { _desc = ( _desc & ~ 0x7F ) | ( val & 0x7F ) ; }
2016-06-18 23:28:28 +00:00
bool isLit ( ) { return ( _desc > > 15 ) & 1 ; }
2016-06-28 22:23:40 +00:00
void setLit ( bool val ) {
if ( val )
_desc | = ( 1 < < 15 ) ;
else
_desc & = ( ~ ( 1 < < 15 ) ) ;
}
2016-06-18 23:28:28 +00:00
uint16 getChargeCount ( ) { return ( _desc > > 10 ) & 0xF ; }
2016-08-26 20:50:01 +00:00
uint16 setChargeCount ( uint16 val ) { _desc = ( _desc & ~ ( 0xF < < 10 ) ) | ( ( val & 0xF ) < < 10 ) ; return ( val & 0xF ) ; }
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-07-13 13:01:00 +00:00
void setNextThing ( Thing val ) { _nextThing = val ; }
2016-06-28 16:04:32 +00:00
uint16 getCursed ( ) { return ( _desc > > 8 ) & 1 ; }
2016-07-06 22:46:51 +00:00
void setCursed ( uint16 val ) { _desc = ( _desc & ~ ( 1 < < 8 ) ) | ( ( val & 1 ) < < 8 ) ; }
2016-06-28 16:04:32 +00:00
uint16 getPoisoned ( ) { return ( _desc > > 9 ) & 1 ; }
uint16 getBroken ( ) { return ( _desc > > 14 ) & 1 ; }
2016-07-06 22:46:51 +00:00
uint16 getDoNotDiscard ( ) { return ( _desc > > 7 ) & 1 ; }
2016-08-26 20:50:01 +00:00
void setDoNotDiscard ( uint16 val ) { _desc = ( _desc & ~ ( 1 < < 7 ) ) | ( ( val & 1 ) < < 7 ) ; }
2016-05-15 13:53:00 +00:00
} ; // @ WEAPON
class Armour {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Armour ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
ArmourType getType ( ) { return ( ArmourType ) ( _attributes & 0x7F ) ; }
Thing getNextThing ( ) { return _nextThing ; }
2016-06-28 16:04:32 +00:00
uint16 getCursed ( ) { return ( _attributes > > 8 ) & 1 ; }
uint16 getBroken ( ) { return ( _attributes > > 13 ) & 1 ; }
2016-07-06 22:46:51 +00:00
uint16 getDoNotDiscard ( ) { return ( _attributes > > 7 ) & 1 ; }
2016-07-13 13:01:00 +00:00
uint16 getChargeCount ( ) { return ( _attributes > > 9 ) & 0xF ; }
void setChargeCount ( uint16 val ) { _attributes = ( _attributes & ~ ( 0xF < < 9 ) ) | ( ( val & 0xF ) < < 9 ) ; }
2016-05-15 13:53:00 +00:00
} ; // @ ARMOUR
class Scroll {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Scroll ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
void set ( Thing next , uint16 attribs ) {
2016-06-18 15:48:48 +00:00
_nextThing = next ;
_attributes = attribs ;
2016-05-15 13:53:00 +00:00
}
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-06-18 23:28:28 +00:00
uint16 getClosed ( ) { return ( _attributes > > 10 ) & 0x3F ; } // ??? dunno why, the original bitfield is 6 bits long
2016-06-28 22:23:40 +00:00
void setClosed ( bool val ) {
if ( val )
_attributes | = ( 1 < < 10 ) ;
else
_attributes & = ( ~ ( 0x3F < < 10 ) ) ;
}
2016-06-27 22:30:32 +00:00
uint16 getTextStringThingIndex ( ) { return _attributes & 0x3FF ; }
2016-05-15 13:53:00 +00:00
} ; // @ SCROLL
class Potion {
2016-07-06 22:46:51 +00:00
public :
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-06-22 05:47:41 +00:00
explicit Potion ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
PotionType getType ( ) { return ( PotionType ) ( ( _attributes > > 8 ) & 0x7F ) ; }
2016-06-23 21:54:37 +00:00
void setType ( PotionType val ) { _attributes = ( _attributes & ~ ( 0x7F < < 8 ) ) | ( ( val & 0x7F ) < < 8 ) ; }
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-06-28 16:04:32 +00:00
uint16 getPower ( ) { return _attributes & 0xFF ; }
2016-07-12 12:38:52 +00:00
void setPower ( uint16 val ) { _attributes = ( _attributes & ~ 0xFF ) | ( val & 0xFF ) ; }
2016-07-06 22:46:51 +00:00
uint16 getDoNotDiscard ( ) { return ( _attributes > > 15 ) & 1 ; }
2016-05-15 13:53:00 +00:00
} ; // @ POTION
class Container {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
2016-08-26 20:40:13 +00:00
Thing _slot ;
2016-06-18 15:48:48 +00:00
uint16 _type ;
2016-05-15 13:53:00 +00:00
public :
2016-08-26 20:40:13 +00:00
explicit Container ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _slot ( rawDat [ 1 ] ) , _type ( rawDat [ 2 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 21:05:45 +00:00
uint16 getType ( ) { return ( _type > > 1 ) & 0x3 ; }
2016-08-26 20:40:13 +00:00
Thing & getSlot ( ) { return _slot ; }
Thing & getNextThing ( ) { return _nextThing ; }
2016-05-15 13:53:00 +00:00
} ; // @ CONTAINER
class Junk {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Junk ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
JunkType getType ( ) { return ( JunkType ) ( _attributes & 0x7F ) ; }
2016-07-06 22:46:51 +00:00
void setType ( uint16 val ) { _attributes = ( _attributes & ~ 0x7F ) | ( val & 0x7F ) ; }
2016-06-18 15:48:48 +00:00
uint16 getChargeCount ( ) { return ( _attributes > > 14 ) & 0x3 ; }
2016-06-23 21:54:37 +00:00
void setChargeCount ( uint16 val ) { _attributes = ( _attributes & ~ ( 0x3 < < 14 ) ) | ( ( val & 0x3 ) < < 14 ) ; }
2016-07-06 22:46:51 +00:00
uint16 getDoNotDiscard ( ) { return ( _attributes > > 7 ) & 1 ; }
2016-07-13 17:51:14 +00:00
void setDoNotDiscard ( uint16 val ) { _attributes = ( _attributes & ~ ( 1 < < 7 ) ) | ( ( val & 1 ) < < 7 ) ; }
2016-06-18 13:01:25 +00:00
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-07-12 06:44:15 +00:00
void setNextThing ( Thing thing ) { _nextThing = thing ; }
2016-05-15 13:53:00 +00:00
} ; // @ JUNK
class Projectile {
2016-07-01 11:15:41 +00:00
public :
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
2016-07-06 22:46:51 +00:00
Thing _slot ;
uint16 _kineticEnergy ;
uint16 _attack ;
uint16 _eventIndex ;
explicit Projectile ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _slot ( rawDat [ 1 ] ) , _kineticEnergy ( rawDat [ 2 ] ) ,
_attack ( rawDat [ 3 ] ) , _eventIndex ( rawDat [ 4 ] ) { }
2016-05-15 13:53:00 +00:00
} ; // @ PROJECTILE
class Explosion {
2016-06-18 15:48:48 +00:00
Thing _nextThing ;
uint16 _attributes ;
2016-05-15 13:53:00 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Explosion ( uint16 * rawDat ) : _nextThing ( rawDat [ 0 ] ) , _attributes ( rawDat [ 1 ] ) { }
2016-05-15 13:53:00 +00:00
2016-06-18 15:48:48 +00:00
Thing getNextThing ( ) { return _nextThing ; }
2016-07-11 12:33:25 +00:00
Thing setNextThing ( Thing val ) { return _nextThing = val ; }
2016-07-01 11:15:41 +00:00
uint16 getType ( ) { return _attributes & 0x7F ; }
2016-07-06 22:46:51 +00:00
uint16 setType ( uint16 val ) { _attributes = ( _attributes & ~ 0x7F ) | ( val & 0x7F ) ; return ( val & 0x7F ) ; }
2016-07-01 11:15:41 +00:00
uint16 getAttack ( ) { return ( _attributes > > 8 ) & 0xFF ; }
2016-07-06 22:46:51 +00:00
void setAttack ( uint16 val ) { _attributes = ( _attributes & ~ ( 0xFF < < 8 ) ) | ( ( val & 0xFF ) < < 8 ) ; }
uint16 getCentered ( ) { return ( _attributes > > 7 ) & 0x1 ; }
void setCentered ( uint16 val ) { _attributes = ( _attributes & ~ ( 1 < < 7 ) ) | ( ( val & 1 ) < < 7 ) ; }
2016-05-15 13:53:00 +00:00
} ; // @ EXPLOSION
2016-05-13 14:13:19 +00:00
class Square {
2016-06-18 15:48:48 +00:00
byte _data ;
2016-05-13 14:13:19 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit Square ( byte dat = 0 ) : _data ( dat ) { }
2016-09-13 05:46:38 +00:00
explicit Square ( ElementType type ) { setType ( type ) ; }
2016-08-26 20:50:13 +00:00
explicit Square ( byte element , byte mask ) : _data ( ( element < < 5 ) | mask ) { }
2016-06-18 15:48:48 +00:00
Square & set ( byte dat ) { this - > _data = dat ; return * this ; }
Square & set ( SquareMask mask ) { _data | = mask ; return * this ; }
byte get ( SquareMask mask ) { return _data & mask ; }
byte getDoorState ( ) { return _data & 0x7 ; } // @ M36_DOOR_STATE
2016-06-21 22:00:03 +00:00
void setDoorState ( byte state ) { _data = ( ( _data & ~ 0x7 ) | state ) ; } // @ M37_SET_DOOR_STATE
2016-09-13 05:46:38 +00:00
ElementType getType ( ) { return ( ElementType ) ( _data > > 5 ) ; } // @ M34_SQUARE_TYPE
void setType ( ElementType type ) { _data = ( _data & 0x1F ) | type < < 5 ; }
2016-06-18 15:48:48 +00:00
byte toByte ( ) { return _data ; } // I don't like 'em casts
2016-07-02 11:47:19 +00:00
} ; // wrapper for bytes which are used as squares
2016-05-07 20:48:19 +00:00
2016-05-15 13:53:00 +00:00
struct DungeonFileHeader {
2016-06-18 15:48:48 +00:00
uint16 _ornamentRandomSeed ;
2016-07-25 22:18:31 +00:00
uint16 _rawMapDataSize ;
2016-06-18 15:48:48 +00:00
uint8 _mapCount ;
uint16 _textDataWordCount ;
2016-07-25 22:18:31 +00:00
uint16 _partyStartLocation ;
2016-06-18 15:48:48 +00:00
uint16 _squareFirstThingCount ; // @ SquareFirstThingCount
uint16 _thingCounts [ 16 ] ; // @ ThingCount[16]
2016-05-07 18:53:35 +00:00
} ; // @ DUNGEON_HEADER
2016-05-15 13:53:00 +00:00
struct Map {
2016-06-18 15:48:48 +00:00
uint32 _rawDunDataOffset ;
uint8 _offsetMapX , _offsetMapY ;
2016-05-12 21:19:36 +00:00
2016-06-18 15:48:48 +00:00
uint8 _level ; // only used in DMII
uint8 _width , _height ; // !!! THESRE ARE INCLUSIVE BOUNDARIES
2016-05-12 21:19:36 +00:00
// orn short for Ornament
2016-06-18 15:48:48 +00:00
uint8 _wallOrnCount ; /* May be used in a Sensor on a Wall or closed Fake Wall square */
uint8 _randWallOrnCount ; /* Used only on some Wall squares and some closed Fake Wall squares */
uint8 _floorOrnCount ; /* May be used in a Sensor on a Pit, open Fake Wall, Corridor or Teleporter square */
uint8 _randFloorOrnCount ; /* Used only on some Corridor squares and some open Fake Wall squares */
uint8 _doorOrnCount ;
uint8 _creatureTypeCount ;
uint8 _difficulty ;
FloorSet _floorSet ;
WallSet _wallSet ;
uint8 _doorSet0 , _doorSet1 ;
2016-05-12 21:19:36 +00:00
} ; // @ MAP
2016-05-07 18:53:35 +00:00
2016-07-04 15:14:32 +00:00
class DoorInfo {
public :
byte _attributes ;
byte _defense ;
2016-07-06 22:46:51 +00:00
DoorInfo ( byte b1 , byte b2 ) : _attributes ( b1 ) , _defense ( b2 ) { }
2016-08-26 20:50:01 +00:00
DoorInfo ( ) { resetToZero ( ) ; }
void resetToZero ( ) { _attributes = _defense = 0 ; }
2016-07-04 15:14:32 +00:00
} ; // @ DOOR_INFO
2016-07-06 22:46:51 +00:00
class Group ;
2016-05-07 18:53:35 +00:00
2016-05-03 15:55:04 +00:00
class DungeonMan {
DMEngine * _vm ;
2016-05-07 18:53:35 +00:00
2016-05-03 15:55:04 +00:00
DungeonMan ( const DungeonMan & other ) ; // no implementation on purpose
void operator = ( const DungeonMan & rhs ) ; // no implementation on purpose
2016-05-07 18:53:35 +00:00
2016-08-24 06:03:55 +00:00
Square getRelSquare ( Direction dir , int16 stepsForward , int16 stepsRight , int16 posX , int16 posY ) ; // @ F0152_DUNGEON_GetRelativeSquare
2016-05-07 18:53:35 +00:00
2016-08-24 06:03:55 +00:00
void decompressDungeonFile ( ) ; // @ F0455_FLOPPY_DecompressDungeon
2016-05-13 14:13:19 +00:00
2016-08-24 06:03:55 +00:00
int16 getSquareFirstThingIndex ( int16 mapX , int16 mapY ) ; // @ F0160_DUNGEON_GetSquareFirstThingIndex
2016-05-15 13:53:00 +00:00
2016-08-24 06:03:55 +00:00
int16 getRandomOrnOrdinal ( bool allowed , int16 count , int16 mapX , int16 mapY , int16 modulo ) ; // @ F0170_DUNGEON_GetRandomOrnamentOrdinal
void setSquareAspectOrnOrdinals ( uint16 * aspectArray , bool leftAllowed , bool frontAllowed , bool rightAllowed , int16 dir ,
2016-07-11 15:06:24 +00:00
int16 mapX , int16 mapY , bool isFakeWall ) ; // @ F0171_DUNGEON_SetSquareAspectRandomWallOrnamentOrdinals
2016-05-15 13:53:00 +00:00
2016-05-03 15:55:04 +00:00
public :
2016-06-22 05:47:41 +00:00
explicit DungeonMan ( DMEngine * dmEngine ) ;
2016-05-03 15:55:04 +00:00
~ DungeonMan ( ) ;
2016-06-18 23:28:28 +00:00
2016-08-24 06:03:55 +00:00
Square getSquare ( int16 mapX , int16 mapY ) ; // @ F0151_DUNGEON_GetSquare
void setCurrentMap ( uint16 mapIndex ) ; // @ F0173_DUNGEON_SetCurrentMap
Thing getSquareFirstThing ( int16 mapX , int16 mapY ) ; // @ F0161_DUNGEON_GetSquareFirstThing
Thing getNextThing ( Thing thing ) ; // @ F0159_DUNGEON_GetNextThing(THING P0280_T_Thing)
uint16 * getThingData ( Thing thing ) ; // @ F0156_DUNGEON_GetThingData
uint16 * getSquareFirstThingData ( int16 mapX , int16 mapY ) ; // @ F0157_DUNGEON_GetSquareFirstThingData
2016-06-18 23:28:28 +00:00
2016-05-07 18:53:35 +00:00
// TODO: this does stuff other than load the file!
2016-08-24 06:03:55 +00:00
void loadDungeonFile ( Common : : InSaveFile * file ) ; // @ F0434_STARTEND_IsLoadDungeonSuccessful_CPSC
void setCurrentMapAndPartyMap ( uint16 mapIndex ) ; // @ F0174_DUNGEON_SetCurrentMapAndPartyMap
2016-05-15 13:53:00 +00:00
2016-08-24 06:03:55 +00:00
bool isWallOrnAnAlcove ( int16 wallOrnIndex ) ; // @ F0149_DUNGEON_IsWallOrnamentAnAlcove
void mapCoordsAfterRelMovement ( Direction dir , int16 stepsForward , int16 stepsRight , int16 & posX , int16 & posY ) ; // @ F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement
2016-09-13 05:46:38 +00:00
ElementType getRelSquareType ( Direction dir , int16 stepsForward , int16 stepsRight , int16 posX , int16 posY ) {
2016-08-24 06:03:55 +00:00
return Square ( getRelSquare ( dir , stepsForward , stepsRight , posX , posY ) ) . getType ( ) ;
2016-05-13 14:13:19 +00:00
} // @ F0153_DUNGEON_GetRelativeSquareType
2016-08-24 06:03:55 +00:00
void setSquareAspect ( uint16 * aspectArray , Direction dir , int16 mapX , int16 mapY ) ; // @ F0172_DUNGEON_SetSquareAspect
2022-09-24 14:17:59 +00:00
void decodeText ( char * destString , size_t maxSize , Thing thing , TextType type ) ; // F0168_DUNGEON_DecodeText
2016-08-24 06:03:55 +00:00
Thing getUnusedThing ( uint16 thingType ) ; // @ F0166_DUNGEON_GetUnusedThing
uint16 getObjectWeight ( Thing thing ) ; // @ F0140_DUNGEON_GetObjectWeight
int16 getObjectInfoIndex ( Thing thing ) ; // @ F0141_DUNGEON_GetObjectInfoIndex
void linkThingToList ( Thing thingToLink , Thing thingInList , int16 mapX , int16 mapY ) ; // @ F0163_DUNGEON_LinkThingToList
WeaponInfo * getWeaponInfo ( Thing thing ) ; // @ F0158_DUNGEON_GetWeaponInfo
int16 getProjectileAspect ( Thing thing ) ; // @ F0142_DUNGEON_GetProjectileAspect
int16 getLocationAfterLevelChange ( int16 mapIndex , int16 levelDelta , int16 * mapX , int16 * mapY ) ; // @ F0154_DUNGEON_GetLocationAfterLevelChange
Thing getSquareFirstObject ( int16 mapX , int16 mapY ) ; // @ F0162_DUNGEON_GetSquareFirstObject
uint16 getArmourDefense ( ArmourInfo * armourInfo , bool useSharpDefense ) ; // @ F0143_DUNGEON_GetArmourDefense
Thing getDiscardThing ( uint16 thingType ) ; // @ F0165_DUNGEON_GetDiscardedThing
uint16 getCreatureAttributes ( Thing thing ) ; // @ F0144_DUNGEON_GetCreatureAttributes
void setGroupCells ( Group * group , uint16 cells , uint16 mapIndex ) ; // @ F0146_DUNGEON_SetGroupCells
void setGroupDirections ( Group * group , int16 dir , uint16 mapIndex ) ; // @ F0148_DUNGEON_SetGroupDirections
bool isCreatureAllowedOnMap ( Thing thing , uint16 mapIndex ) ; // @ F0139_DUNGEON_IsCreatureAllowedOnMap
void unlinkThingFromList ( Thing thingToUnlink , Thing thingInList , int16 mapX , int16 mapY ) ; // @ F0164_DUNGEON_UnlinkThingFromList
int16 getStairsExitDirection ( int16 mapX , int16 mapY ) ; // @ F0155_DUNGEON_GetStairsExitDirection
Thing getObjForProjectileLaucherOrObjGen ( uint16 iconIndex ) ; // @ F0167_DUNGEON_GetObjectForProjectileLauncherOrObjectGenerator
int16 getRandomOrnamentIndex ( uint16 val1 , uint16 val2 , int16 modulo ) ; // @ F0169_DUNGEON_GetRandomOrnamentIndex
2016-06-18 13:01:25 +00:00
2016-06-03 21:47:04 +00:00
uint32 _rawDunFileDataSize ; // @ probably NONE
byte * _rawDunFileData ; // @ ???
2016-08-24 06:03:55 +00:00
DungeonFileHeader _dungeonFileHeader ; // @ G0278_ps_DungeonHeader
uint16 * _dungeonMapsFirstColumnIndex ; // @ G0281_pui_DungeonMapsFirstColumnIndex
uint16 _dungeonColumCount ; // @ G0282_ui_DungeonColumnCount
uint16 * _dungeonColumnsCumulativeSquareThingCount ; // @ G0280_pui_DungeonColumnsCumulativeSquareThingCount
Thing * _squareFirstThings ; // @ G0283_pT_SquareFirstThings
uint16 * _dungeonTextData ; // @ G0260_pui_DungeonTextData
uint16 * _thingData [ 16 ] ; // @ G0284_apuc_ThingData
byte * * * _dungeonMapData ; // @ G0279_pppuc_DungeonMapData
Direction _partyDir ; // @ G0308_i_PartyDirection
int16 _partyMapX ; // @ G0306_i_PartyMapX
int16 _partyMapY ; // @ G0307_i_PartyMapY
uint8 _partyMapIndex ; // @ G0309_i_PartyMapIndex
int16 _currMapIndex ; // @ G0272_i_CurrentMapIndex
byte * * _currMapData ; // @ G0271_ppuc_CurrentMapData
Map * _currMap ; // @ G0269_ps_CurrentMap
uint16 _currMapWidth ; // @ G0273_i_CurrentMapWidth
uint16 _currMapHeight ; // @ G0274_i_CurrentMapHeight
uint16 * _currMapColCumulativeSquareFirstThingCount ; // @G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount
Map * _dungeonMaps ; // @ G0277_ps_DungeonMaps
byte * _dungeonRawMapData ; // @ G0276_puc_DungeonRawMapData
int16 _currMapInscriptionWallOrnIndex ; // @ G0265_i_CurrentMapInscriptionWallOrnamentIndex
Box _dungeonViewClickableBoxes [ 6 ] ; // G0291_aauc_DungeonViewClickableBoxes
bool _isFacingAlcove ; // @ G0286_B_FacingAlcove
bool _isFacingViAltar ; // @ G0287_B_FacingViAltar
bool _isFacingFountain ; // @ G0288_B_FacingFountain
2016-09-11 21:22:06 +00:00
ElementType _squareAheadElement ; // @ G0285_i_SquareAheadElement
2016-08-24 06:03:55 +00:00
Thing _pileTopObject [ 5 ] ; // @ G0292_aT_PileTopObject
DoorInfo _currMapDoorInfo [ 2 ] ; // @ G0275_as_CurrentMapDoorInfo
2016-09-11 21:22:06 +00:00
2016-09-11 19:22:22 +00:00
ObjectInfoIndex _objectInfos [ 180 ] ; // @ G0237_as_Graphic559_ObjectInfo
2016-08-27 21:10:13 +00:00
ArmourInfo _armourInfos [ 58 ] ; // @ G0239_as_Graphic559_ArmourInfo
WeaponInfo _weaponInfos [ 46 ] ; // @ G0238_as_Graphic559_WeaponInfo
CreatureInfo _creatureInfos [ k27_CreatureTypeCount ] ; // @ G0243_as_Graphic559_CreatureInfo
byte _thingDataWordCount [ 16 ] ; // @ G0235_auc_Graphic559_ThingDataByteCount
2016-08-19 22:37:28 +00:00
2016-08-27 21:10:13 +00:00
void setupConstants ( ) ;
2016-05-03 15:55:04 +00:00
} ;
2016-06-18 15:51:22 +00:00
}
2016-05-15 13:53:00 +00:00
2016-05-03 15:55:04 +00:00
# endif