31 #include "dm/sounds.h" 32 #include "dm/timeline.h" 41 kDMCreatureTypeGiantScorpion = 0,
42 kDMCreatureTypeSwampSlime = 1,
43 kDMCreatureTypeGiggler = 2,
44 kDMCreatureTypeWizardEye = 3,
45 kDMCreatureTypePainRat = 4,
46 kDMCreatureTypeRuster = 5,
47 kDMCreatureTypeScreamer = 6,
48 kDMCreatureTypeRockpile = 7,
49 kDMCreatureTypeGhostRive = 8,
50 kDMCreatureTypeStoneGolem = 9,
51 kDMCreatureTypeMummy = 10,
52 kDMCreatureTypeBlackFlame = 11,
53 kDMCreatureTypeSkeleton = 12,
54 kDMCreatureTypeCouatl = 13,
55 kDMCreatureTypeVexirk = 14,
56 kDMCreatureTypeMagentaWorm = 15,
57 kDMCreatureTypeAntman = 16,
58 kDMCreatureTypeGiantWasp = 17,
59 kDMCreatureTypeAnimatedArmour = 18,
60 kDMCreatureTypeMaterializerZytaz = 19,
61 kDMCreatureTypeWaterElemental = 20,
62 kDMCreatureTypeOitu = 21,
63 kDMCreatureTypeDemon = 22,
64 kDMCreatureTypeLordChaos = 23,
65 kDMCreatureTypeRedDragon = 24,
66 kDMCreatureTypeLordOrder = 25,
67 kDMCreatureTypeGreyLord = 26
71 kDMCreatureSizeQuarter = 0,
72 kDMCreatureSizeHalf = 1,
73 kDMCreatureSizeFull = 2
77 kDMBehaviorWander = 0,
78 kDMBehaviorUnknown2 = 2,
79 kDMBehaviorUnknown3 = 3,
80 kDMBehaviorUnknown4 = 4,
82 kDMBehaviorAttack = 6,
83 kDMBehaviorApproach = 7
86 #define kDMImmuneToFear 15 // @ C15_IMMUNE_TO_FEAR 87 #define kDMMovementTicksImmobile 255 // @ C255_IMMOBILE 88 #define kDMWholeCreatureGroup -1 // @ CM1_WHOLE_CREATURE_GROUP 89 #define kDMCreatureTypeSingleCenteredCreature 255 // @ C255_SINGLE_CENTERED_CREATURE 92 kDMCreatureMaskSize = 0x0003,
93 kDMCreatureMaskSideAttack = 0x0004,
94 kDMCreatureMaskPreferBackRow = 0x0008,
95 kDMCreatureMaskAttackAnyChamp = 0x0010,
96 kDMCreatureMaskLevitation = 0x0020,
97 kDMCreatureMaskNonMaterial = 0x0040,
98 kDMCreatureMaskDropFixedPoss = 0x0200,
99 kDMCreatureMaskKeepThrownSharpWeapon = 0x0400,
100 kDMCreatureMaskSeeInvisible = 0x0800,
101 kDMCreatureMaskNightVision = 0x1000,
102 kDMCreatureMaskArchenemy = 0x2000,
103 kDMCreatureMaskMagicMap = 0x4000
107 kDMAspectMaskActiveGroupFlipBitmap = 0x0040,
108 kDMAspectMaskActiveGroupIsAttacking = 0x0080
113 int16 _groupThingIndex;
114 Direction _directions;
117 byte _delayFleeingFromTarget;
136 explicit Group(uint16 *rawDat) : _nextThing(rawDat[0]), _slot(rawDat[1]), _cells(rawDat[3]), _flags(rawDat[8]) {
137 _type = (CreatureType)rawDat[2];
138 _health[0] = rawDat[4];
139 _health[1] = rawDat[5];
140 _health[2] = rawDat[6];
141 _health[3] = rawDat[7];
144 uint16 &getActiveGroupIndex() {
return _cells; }
146 uint16 getBehaviour() {
return _flags & 0xF; }
147 uint16 setBehaviour(uint16 val) { _flags = (_flags & ~0xF) | (val & 0xF);
return (val & 0xF); }
148 uint16 getCount() {
return (_flags >> 5) & 0x3; }
149 void setCount(uint16 val) { _flags = (_flags & ~(0x3 << 5)) | ((val & 0x3) << 5); }
150 Direction getDir() {
return (Direction)((_flags >> 8) & 0x3); }
151 void setDir(uint16 val) { _flags = (_flags & ~(0x3 << 8)) | ((val & 0x3) << 8); }
152 uint16 getDoNotDiscard() {
return (_flags >> 10) & 0x1; }
153 void setDoNotDiscard(
bool val) { _flags = (_flags & ~(1 << 10)) | ((val & 1) << 10); }
158 byte _dropMovingCreatureFixedPossessionsCell[4];
159 uint16 _dropMovingCreatureFixedPossCellCount;
160 uint16 _fluxCageCount;
162 int16 _currentGroupMapX;
163 int16 _currentGroupMapY;
164 Thing _currGroupThing;
165 int16 _groupMovementTestedDirections[4];
166 uint16 _currGroupDistanceToParty;
167 int16 _currGroupPrimaryDirToParty;
168 int16 _currGroupSecondaryDirToParty;
170 Thing _groupMovementBlockedByGroupThing;
171 bool _groupMovementBlockedByDoor;
172 bool _groupMovementBlockedByParty;
173 bool _groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter;
174 int32 twoHalfSquareSizedCreaturesGroupLastDirectionSetTime;
175 uint16 toggleFlag(uint16 &val, uint16 mask);
176 int32 setTime(int32 &map_time, int32 time);
179 uint16 _maxActiveGroupCount;
181 uint16 _currActiveGroupCount;
185 void initActiveGroups();
186 uint16 getGroupCells(
Group *group, int16 mapIndex);
187 uint16 getGroupDirections(
Group *group, int16 mapIndex);
188 int16 getCreatureOrdinalInCell(
Group *group, uint16 cell);
189 uint16 getCreatureValue(uint16 groupVal, uint16 creatureIndex);
190 void dropGroupPossessions(int16 mapX, int16 mapY,
Thing groupThing, SoundMode mode);
191 void dropCreatureFixedPossessions(CreatureType creatureType, int16 mapX, int16 mapY, uint16 cell,
192 SoundMode soundMode);
193 int16 getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY,
194 int16 destMapX, int16 destMapY);
195 bool isDestVisibleFromSource(uint16 dir, int16 srcMapX, int16 srcMapY, int16 destMapX,
197 bool groupIsDoorDestoryedByAttack(uint16 mapX, uint16 mapY, int16 attack,
198 bool magicAttack, int16 ticks);
199 Thing groupGetThing(int16 mapX, int16 mapY);
200 int16 groupGetDamageCreatureOutcome(
Group *group, uint16 creatureIndex,
201 int16 mapX, int16 mapY, int16 damage,
bool notMoving);
202 void groupDelete(int16 mapX, int16 mapY);
203 void groupDeleteEvents(int16 mapX, int16 mapY);
204 uint16 getGroupValueUpdatedWithCreatureValue(uint16 groupVal, uint16 creatureIndex, uint16 creatureVal);
205 int16 getDamageAllCreaturesOutcome(
Group *group, int16 mapX, int16 mapY, int16 attack,
bool notMoving);
206 int16 groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType, int16 poisonAttack);
207 void processEvents29to41(int16 eventMapX, int16 eventMapY, TimelineEventType eventType, uint16 ticks);
208 bool isMovementPossible(
CreatureInfo *creatureInfo, int16 mapX, int16 mapY,
209 uint16 dir,
bool allowMovementOverImaginaryPitsAndFakeWalls);
210 int16 getDistanceBetweenSquares(int16 srcMapX, int16 srcMapY, int16 destMapX,
213 int16 groupGetDistanceToVisibleParty(
Group *group, int16 creatureIndex, int16 mapX, int16 mapY);
214 int16 getDistanceBetweenUnblockedSquares(int16 srcMapX, int16 srcMapY,
215 int16 destMapX, int16 destMapY,
bool (
GroupMan::*isBlocked)(uint16, uint16));
216 bool isViewPartyBlocked(uint16 mapX, uint16 mapY);
217 int32 getCreatureAspectUpdateTime(
ActiveGroup *activeGroup, int16 creatureIndex,
219 void setGroupDirection(
ActiveGroup *activeGroup, int16 dir, int16 creatureIndex,
bool twoHalfSquareSizedCreatures);
221 int16 getSmelledPartyPrimaryDirOrdinal(
CreatureInfo *creatureInfo, int16 mapY, int16 mapX);
222 bool isSmellPartyBlocked(uint16 mapX, uint16 mapY);
223 int16 getFirstPossibleMovementDirOrdinal(
CreatureInfo *info, int16 mapX, int16 mapY,
224 bool allowMovementOverImaginaryPitsAndFakeWalls);
225 void setDirGroup(
ActiveGroup *activeGroup, int16 dir, int16 creatureIndex,
227 void stopAttacking(
ActiveGroup *group, int16 mapX, int16 mapY);
228 bool isArchenemyDoubleMovementPossible(
CreatureInfo *info, int16 mapX, int16 mapY, uint16 dir);
229 bool isCreatureAttacking(
Group *group, int16 mapX, int16 mapY, uint16 creatureIndex);
230 void setOrderedCellsToAttack(
signed char *orderedCellsToAttack, int16 targetMapX,
231 int16 targetMapY, int16 attackerMapX, int16 attackerMapY, uint16 cellSource);
232 void stealFromChampion(
Group *group, uint16 championIndex);
233 int16 getChampionDamage(
Group *group, uint16 champIndex);
234 void dropMovingCreatureFixedPossession(
Thing thing, int16 mapX, int16 mapY);
235 void startWandering(int16 mapX, int16 mapY);
236 void addActiveGroup(
Thing thing, int16 mapX, int16 mapY);
237 void removeActiveGroup(uint16 activeGroupIndex);
238 void removeAllActiveGroups();
239 void addAllActiveGroups();
240 Thing groupGetGenerated(CreatureType creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY);
241 bool isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY);
242 int16 getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 paryY,
244 int16 getMeleeActionDamage(
Champion *champ, int16 champIndex,
Group *group, int16 creatureIndex,
245 int16 mapX, int16 mapY, uint16 actionHitProbability, uint16 actionDamageFactor, int16 skillIndex);
246 void fluxCageAction(int16 mapX, int16 mapY);
247 uint16 isLordChaosOnSquare(int16 mapX, int16 mapY);
248 bool isFluxcageOnSquare(int16 mapX, int16 mapY);
249 void fuseAction(uint16 mapX, uint16 mapY);
Definition: savefile.h:54
Definition: dungeonman.h:304
Definition: timeline.h:100
Definition: champion.h:35
Definition: champion.h:398