1 /*
2  *
3  *  Iter Vehemens ad Necem (IVAN)
4  *  Copyright (C) Timo Kiviluoto
5  *  Released under the GNU General
6  *  Public License
7  *
8  *  See LICENSING which should be included
9  *  along with this file for more details
10  *
11  */
12 
13 #ifndef __IVANDEF_H__
14 #define __IVANDEF_H__
15 
16 /*
17  * Global defines for the project IVAN.
18  * This file is created to decrease the need of including headers in
19  * other headers just for the sake of some silly macros, because it
20  * decreases compilation efficiency and may cause cross-including
21  *
22  * List of macros that should be gathered here:
23  * 1. all numeric defines used in multiple .cpp or .h files
24  *    except those #defined in balance.h and confdef.h
25  * 2. all inline functions used in multiple .cpp or .h files
26  *    and independent enough (do not require other headers)
27  * 3. class construction macros used in multiple .h files
28  */
29 
30 #include "v2.h"
31 
32 class item;
33 class material;
34 class character;
35 
36 typedef const item citem;
37 typedef const material cmaterial;
38 typedef const character ccharacter;
39 
40 struct databasebase
41 {
42   int Config;
43   ulong CommonFlags;
44   ulong NameFlags;
45 };
46 
47 template <class type, class base, class prototype>
48 class sysbase : public base
49 {
50  public:
51   typedef sysbase<type, base, prototype> mybase;
52   static type* Spawn(int Config = 0, int SpecialFlags = 0)
53   {
54     type* T = new type;
55     T->Initialize(Config, SpecialFlags);
56     return T;
57   }
Clone(const type * T)58   static type* Clone(const type* T) { return new type(*T); }
FindProtoType()59   virtual const prototype* FindProtoType() const { return &ProtoType; }
60   static const prototype ProtoType;
61 };
62 
63 template <class type, class base, class prototype>
64 class simplesysbase : public base
65 {
66  public:
67   typedef simplesysbase<type, base, prototype> mybase;
Spawn()68   static type* Spawn() { return new type; }
GetProtoType()69   virtual const prototype* GetProtoType() const { return &ProtoType; }
70   static const prototype ProtoType;
71 };
72 
73 #define SYSTEM_SPECIALIZATIONS(name)\
74 name##prototype** name##_ProtoData;\
75 valuemap name##_CodeNameMap;\
76 int name##_ProtoSize;\
77 \
78 template<> name##prototype**& protocontainer<name>::GetProtoData()\
79 { return name##_ProtoData; }\
80 template<> valuemap& protocontainer<name>::GetCodeNameMap()\
81 { return name##_CodeNameMap; }\
82 template<> int& protocontainer<name>::GetSizeRef()\
83 { return name##_ProtoSize; }
84 
85 #define EXTENDED_SYSTEM_SPECIALIZATIONS(name)\
86 SYSTEM_SPECIALIZATIONS(name)\
87 databasecreator<name>::databasemembermap name##_DataBaseMemberMap;\
88 template<> databasecreator<name>::databasemembermap&\
89 databasecreator<name>::GetDataBaseMemberMap()\
90 { return name##_DataBaseMemberMap; }\
91 const name##prototype name::ProtoType
92 
93 #define DATA_BASE_VALUE(type, data) type Get##data() const { return DataBase->data; }
94 #define DATA_BASE_VALUE_WITH_PARAMETER(type, data, param) type Get##data(param) const { return DataBase->data; }
95 #define DATA_BASE_TRUTH(data) truth data() const { return DataBase->data; }
96 #define DATA_BASE_TRUTH_WITH_PARAMETER(data, param) truth data(param) const { return DataBase->data; }
97 
98 #define HAS_HIT 0
99 #define HAS_BLOCKED 1
100 #define HAS_DODGED 2
101 #define HAS_DIED 3
102 #define DID_NO_DAMAGE 4
103 #define HAS_FAILED 5
104 
105 #define OVER_FED_LEVEL 175000
106 #define BLOATED_LEVEL 150000
107 #define SATIATED_LEVEL 100000
108 #define NOT_HUNGER_LEVEL 30000
109 #define HUNGER_LEVEL 20000
110 #define VERY_HUNGER_LEVEL 10000
111 
112 #define OVER_LOADED 0
113 #define STRESSED 1
114 #define BURDENED 2
115 #define UNBURDENED 3
116 
117 #define STARVING 0
118 #define VERY_HUNGRY 1
119 #define HUNGRY 2
120 #define NOT_HUNGRY 3
121 #define SATIATED 4
122 #define BLOATED 5
123 #define OVER_FED 6
124 
125 #define STATES 32
126 
127 #define POLYMORPHED (1 << 0)
128 #define HASTE (1 << 1)
129 #define SLOW (1 << 2)
130 #define POLYMORPH_CONTROL (1 << 3)
131 #define LIFE_SAVED (1 << 4)
132 #define LYCANTHROPY (1 << 5)
133 #define INVISIBLE (1 << 6)
134 #define INFRA_VISION (1 << 7)
135 #define ESP (1 << 8)
136 #define POISONED (1 << 9)
137 #define TELEPORT (1 << 10)
138 #define POLYMORPH (1 << 11)
139 #define TELEPORT_CONTROL (1 << 12)
140 #define PANIC (1 << 13)
141 #define CONFUSED (1 << 14)
142 #define PARASITE_TAPE_WORM (1 << 15)
143 #define SEARCHING (1 << 16)
144 #define GAS_IMMUNITY (1 << 17)
145 #define LEVITATION (1 << 18)
146 #define LEPROSY (1 << 19)
147 #define HICCUPS (1 << 20)
148 #define ETHEREAL_MOVING (1 << 21)
149 #define VAMPIRISM (1 << 22)
150 #define SWIMMING (1 << 23)
151 #define DETECTING (1 << 24)
152 #define POLYMORPH_LOCK (1 << 25)
153 #define REGENERATION (1 << 26)
154 #define DISEASE_IMMUNITY (1 << 27)
155 #define TELEPORT_LOCK (1 << 28)
156 #define FEARLESS (1 << 29)
157 #define FASTING (1 << 30)
158 #define PARASITE_MIND_WORM (1 << 31)
159 
160 
161 #define TORSO 1
162 #define HEAD 2
163 #define RIGHT_ARM 4
164 #define LEFT_ARM 8
165 #define ARMS 12
166 #define GROIN 16
167 #define RIGHT_LEG 32
168 #define LEFT_LEG 64
169 #define LEGS 96
170 #define OTHER 128
171 #define ALL 255
172 
173 #define PHYSICAL_DAMAGE 1
174 #define SOUND 2
175 #define ACID 4
176 #define FIRE 8
177 #define ELECTRICITY 16
178 #define ENERGY 32
179 #define POISON 64
180 #define DRAIN 128
181 #define MUSTARD_GAS_DAMAGE 256
182 #define PSI 512
183 #define THROW 32768
184 
185 #define UNDEFINED 0
186 #define MALE 1
187 #define FEMALE 2
188 #define TRANSSEXUAL 3
189 
190 #define ALL_BODYPART_FLAGS 0x7F
191 
192 /* The maximum bodyparts a character can have */
193 
194 #define MAX_BODYPARTS 7
195 #define HUMANOID_BODYPARTS 7
196 
197 #define TORSO_INDEX 0
198 #define HEAD_INDEX 1
199 #define RIGHT_ARM_INDEX 2
200 #define LEFT_ARM_INDEX 3
201 #define GROIN_INDEX 4
202 #define RIGHT_LEG_INDEX 5
203 #define LEFT_LEG_INDEX 6
204 
205 #define NONE_INDEX MAX_BODYPARTS
206 
207 #define DIRECTION_COMMAND_KEYS 8
208 #define EXTENDED_DIRECTION_COMMAND_KEYS 9
209 #define NORTHWEST 0
210 #define NORTH 1
211 #define NORTHEAST 2
212 #define WEST 3
213 #define EAST 4
214 #define SOUTHWEST 5
215 #define SOUTH 6
216 #define SOUTHEAST 7
217 #define YOURSELF 8
218 #define RANDOM_DIR 9
219 
220 #ifndef LIGHT_BORDER
221 #define LIGHT_BORDER 80
222 #endif
223 
224 #define ALPP 0
225 #define ALP 1
226 #define AL 2
227 #define ALM 3
228 #define ANP 4
229 #define AN 5
230 #define ANM 6
231 #define ACP 7
232 #define AC 8
233 #define ACM 9
234 #define ACMM 10
235 
236 #define UNARTICLED 0
237 #define PLURAL 1
238 #define ARTICLE_BIT 2
239 #define DEFINITE 2
240 #define INDEFINE_BIT 4
241 #define INDEFINITE 6
242 #define STRIPPED 8
243 
244 #define TRANSPARENT_COLOR 0xF81F // pink
245 
246 #define RAW_TYPES 7
247 
248 #define GR_GLTERRAIN 0
249 #define GR_OLTERRAIN 1
250 #define GR_ITEM 2
251 #define GR_CHARACTER 3
252 #define GR_HUMANOID 4
253 #define GR_EFFECT 5
254 #define GR_CURSOR 6
255 
256 #define GRAPHIC_TYPES 4
257 
258 #define GR_WTERRAIN 0
259 #define GR_FOW 1
260 #define GR_SYMBOL 2
261 #define GR_SMILEY 3
262 
263 /* SpecialFlags for graphics system. No one knows what "ST_" means... */
264 
265 #define ST_NORMAL 0
266 #define ST_RIGHT_ARM 8
267 #define ST_LEFT_ARM 16
268 #define ST_GROIN 24
269 #define ST_RIGHT_LEG 32
270 #define ST_LEFT_LEG 40
271 #define ST_OTHER_BODYPART 48
272 #define ST_WIELDED 56
273 #define ST_CLOAK 64
274 #define ST_LIGHTNING 128
275 #define ST_DISALLOW_R_COLORS 256
276 #define ST_FLAME_1 512
277 #define ST_FLAME_2 1024
278 #define ST_FLAME_3 2048
279 #define ST_FLAME_4 4096
280 #define ST_FLAMES (ST_FLAME_1|ST_FLAME_2|ST_FLAME_3|ST_FLAME_4)
281 #define ST_FLAME_SHIFT 9
282 
283 #define WOBBLE 1
284 #define WOBBLE_HORIZONTALLY_BIT 2
285 #define WOBBLE_VERTICALLY WOBBLE
286 #define WOBBLE_HORIZONTALLY (WOBBLE|WOBBLE_HORIZONTALLY_BIT)
287 #define WOBBLE_SPEED_SHIFT 2
288 #define WOBBLE_SPEED_RANGE (3 << WOBBLE_SPEED_SHIFT)
289 #define WOBBLE_FREQ_SHIFT 4
290 #define WOBBLE_FREQ_RANGE (3 << WOBBLE_FREQ_SHIFT)
291 
292 cv2 SILHOUETTE_SIZE(48, 64); // it is TILE_SIZE*3,TILE_SIZE*4 tho..
293 
294 #define ITEM_CATEGORIES 18
295 
296 #define ANY_CATEGORY 0x7FFFFFFF
297 #define HELMET (1 << 0)
298 #define AMULET (1 << 1)
299 #define CLOAK (1 << 2)
300 #define BODY_ARMOR (1 << 3)
301 #define WEAPON (1 << 4)
302 #define SHIELD (1 << 5)
303 #define RING (1 << 6)
304 #define GAUNTLET (1 << 7)
305 #define BELT (1 << 8)
306 #define BOOT (1 << 9)
307 #define FOOD (1 << 10)
308 #define POTION (1 << 11)
309 #define SCROLL (1 << 12)
310 #define BOOK (1 << 13)
311 #define WAND (1 << 14)
312 #define TOOL (1 << 15)
313 #define VALUABLE (1 << 16)
314 #define MISC (1 << 17)
315 
316 #define GOOD 1
317 #define NEUTRAL 2
318 #define EVIL 3
319 
320 /* ConsumeTypes */
321 
322 #define CT_FRUIT (1 << 0)
323 #define CT_MEAT (1 << 1)
324 #define CT_METAL (1 << 2)
325 #define CT_MINERAL (1 << 3)
326 #define CT_LIQUID (1 << 4)
327 #define CT_BONE (1 << 5)
328 #define CT_PROCESSED (1 << 6)
329 #define CT_MISC_PLANT (1 << 7)
330 #define CT_MISC_ANIMAL (1 << 8)
331 #define CT_PLASTIC (1 << 9)
332 #define CT_GAS (1 << 10)
333 #define CT_MAGIC (1 << 11)
334 
335 /* Possible square positions for item. The first four are used for items
336    on walls */
337 
338 #define LEFT 0
339 #define DOWN 1
340 #define UP 2
341 #define RIGHT 3
342 #define CENTER 4 // item on ground
343 
344 #define HOSTILE 1
345 #define UNCARING 2
346 #define FRIEND 4
347 
348 #define MARTIAL_SKILL_CATEGORIES 3
349 #define WEAPON_SKILL_CATEGORIES 12
350 
351 #define UNARMED 0
352 #define KICK 1
353 #define BITE 2
354 #define UNCATEGORIZED 3
355 #define SMALL_SWORDS 4
356 #define LARGE_SWORDS 5
357 #define BLUNT_WEAPONS 6
358 #define AXES 7
359 #define POLE_ARMS 8
360 #define WHIPS 9
361 #define SHIELDS 10
362 #define CRAFTING 11
363 
364 #define LOCKED 1
365 
366 #define EFFECT_NOTHING 0
367 #define EFFECT_POISON 1
368 #define EFFECT_DARKNESS 2
369 #define EFFECT_OMMEL_URINE 3
370 #define EFFECT_PEPSI 4
371 #define EFFECT_KOBOLD_FLESH 5
372 #define EFFECT_HEAL 6
373 #define EFFECT_LYCANTHROPY 7
374 #define EFFECT_SCHOOL_FOOD 8
375 #define EFFECT_ANTIDOTE 9
376 #define EFFECT_CONFUSE 10
377 #define EFFECT_POLYMORPH 11
378 #define EFFECT_ESP 12
379 #define EFFECT_SKUNK_SMELL 13
380 #define EFFECT_MAGIC_MUSHROOM 14
381 #define EFFECT_TRAIN_PERCEPTION 15
382 #define EFFECT_HOLY_BANANA 16
383 #define EFFECT_EVIL_WONDER_STAFF_VAPOUR 17
384 #define EFFECT_GOOD_WONDER_STAFF_VAPOUR 18
385 #define EFFECT_PEA_SOUP 19
386 #define EFFECT_BLACK_UNICORN_FLESH 20
387 #define EFFECT_GRAY_UNICORN_FLESH 21
388 #define EFFECT_WHITE_UNICORN_FLESH 22
389 #define EFFECT_TELEPORT_CONTROL 23
390 #define EFFECT_MUSHROOM 24
391 #define EFFECT_OMMEL_CERUMEN 25
392 #define EFFECT_OMMEL_SWEAT 26
393 #define EFFECT_OMMEL_TEARS 27
394 #define EFFECT_OMMEL_SNOT 28
395 #define EFFECT_OMMEL_BONE 29
396 #define EFFECT_MUSTARD_GAS 30
397 #define EFFECT_MUSTARD_GAS_LIQUID 31
398 #define EFFECT_VAMPIRISM 32
399 #define EFFECT_PANACEA 33
400 #define EFFECT_OMMEL_BLOOD 34
401 #define EFFECT_PANIC 35
402 #define EFFECT_TRAIN_WISDOM 36
403 #define EFFECT_REGENERATION 37
404 #define EFFECT_TELEPORTATION 38
405 #define EFFECT_LAUGH 39
406 #define EFFECT_POLYJUICE 40
407 #define EFFECT_PUKE 41
408 #define EFFECT_SICKNESS 42
409 #define EFFECT_PHASE 43
410 #define EFFECT_ACID_GAS 44
411 #define EFFECT_FIRE_GAS 45
412 
413 /* CEM = Consume End Message */
414 
415 #define CEM_NOTHING 0
416 #define CEM_SCHOOL_FOOD 1
417 #define CEM_BONE 2
418 #define CEM_FROG_FLESH 3
419 #define CEM_OMMEL 4
420 #define CEM_PEPSI 5
421 #define CEM_KOBOLD_FLESH 6
422 #define CEM_HEALING_LIQUID 7
423 #define CEM_ANTIDOTE 8
424 #define CEM_ESP 9
425 #define CEM_HOLY_BANANA 10
426 #define CEM_PEA_SOUP 11
427 #define CEM_BLACK_UNICORN_FLESH 12
428 #define CEM_GRAY_UNICORN_FLESH 13
429 #define CEM_WHITE_UNICORN_FLESH 14
430 #define CEM_OMMEL_BONE 15
431 #define CEM_COCA_COLA 16
432 #define CEM_LIQUID_HORROR 17
433 
434 /* HM = Hit Message */
435 
436 #define HM_NOTHING 0
437 #define HM_SCHOOL_FOOD 1
438 #define HM_FROG_FLESH 2
439 #define HM_OMMEL 3
440 #define HM_PEPSI 4
441 #define HM_KOBOLD_FLESH 5
442 #define HM_HEALING_LIQUID 6
443 #define HM_ANTIDOTE 7
444 #define HM_CONFUSE 8
445 #define HM_HOLY_BANANA 9
446 
447 #define UNARMED_ATTACK 0
448 #define WEAPON_ATTACK 1
449 #define KICK_ATTACK 2
450 #define BITE_ATTACK 3
451 #define THROW_ATTACK 4
452 
453 #define USE_ARMS 1
454 #define USE_LEGS 2
455 #define USE_HEAD 4
456 
457 #define ATTRIBUTES 11
458 #define BASE_ATTRIBUTES 7
459 
460 #define ENDURANCE 0
461 #define PERCEPTION 1
462 #define INTELLIGENCE 2
463 #define WISDOM 3
464 #define WILL_POWER 4
465 #define CHARISMA 5
466 #define MANA 6
467 
468 #define ARM_STRENGTH 7
469 #define LEG_STRENGTH 8
470 #define DEXTERITY 9
471 #define AGILITY 10
472 
473 #define F_ENDURANCE (1 << ENDURANCE)
474 #define F_PERCEPTION (1 << PERCEPTION)
475 #define F_INTELLIGENCE (1 << INTELLIGENCE)
476 #define F_WISDOM (1 << WISDOM)
477 #define F_WILL_POWER (1 << WILL_POWER)
478 #define F_CHARISMA (1 << CHARISMA)
479 #define F_MANA (1 << MANA)
480 
481 #define F_ARM_STRENGTH (1 << ARM_STRENGTH)
482 #define F_LEG_STRENGTH (1 << LEG_STRENGTH)
483 #define F_DEXTERITY (1 << DEXTERITY)
484 #define F_AGILITY (1 << AGILITY)
485 
486 #define NO 0
487 #define YES 1
488 #define REQUIRES_ANSWER -1
489 
490 #define DIR_ERROR 0xFF
491 
492 #define MAX_EQUIPMENT_SLOTS 13
493 
494 #define HELMET_INDEX 0
495 #define AMULET_INDEX 1
496 #define CLOAK_INDEX 2
497 #define BODY_ARMOR_INDEX 3
498 #define BELT_INDEX 4
499 #define RIGHT_WIELDED_INDEX 5
500 #define LEFT_WIELDED_INDEX 6
501 #define RIGHT_RING_INDEX 7
502 #define LEFT_RING_INDEX 8
503 #define RIGHT_GAUNTLET_INDEX 9
504 #define LEFT_GAUNTLET_INDEX 10
505 #define RIGHT_BOOT_INDEX 11
506 #define LEFT_BOOT_INDEX 12
507 
508 #define WORLD_MAP 255
509 
510 #define DEFAULT_TEAM 0xFF
511 
512 /* Hard-coded teams */
513 
514 #define PLAYER_TEAM 0
515 #define MONSTER_TEAM 1
516 #define ATTNAM_TEAM 2
517 #define SUMO_TEAM 3
518 #define ANGEL_TEAM 4
519 #define GUILD_TEAM 5
520 #define IVAN_TEAM 6
521 #define NEW_ATTNAM_TEAM 7
522 #define COLONIST_TEAM 8
523 #define TOURIST_GUIDE_TEAM 9
524 #define TOURIST_TEAM 10
525 #define BETRAYED_TEAM 11
526 #define XINROCH_TOMB_ENTRY_TEAM 12
527 #define XINROCH_TOMB_NECRO_TEAM 13
528 #define XINROCH_TOMB_KAMIKAZE_DWARF_TEAM 14
529 #define PRISONER_TEAM 15
530 #define TERRA_TEAM 16
531 #define ASLONA_TEAM 17
532 #define REBEL_TEAM 18
533 
534 #define NO_TEAM 0xFFFF
535 
536 #define LOAD 1
537 #define NO_PIC_UPDATE 2
538 #define NO_EQUIPMENT_PIC_UPDATE (NO_PIC_UPDATE << 1)
539 #define NO_MATERIALS 8
540 #define NO_EQUIPMENT 16
541 #define NO_SIGNALS 32
542 #define NO_SEVERED_LIMBS 64
543 
544 #define NOT_WALKABLE 1
545 #define HAS_CHARACTER 2
546 #define IN_ROOM 4
547 #define NOT_IN_ROOM 8
548 #define ATTACHABLE (16|NOT_IN_ROOM) /* overrides IN_ROOM */
549 #define HAS_NO_OTERRAIN 32
550 
551 #define DEFAULT_ATTACHED_AREA 0xFE
552 #define DEFAULT_ATTACHED_ENTRY 0xFE
553 #define NO_ENTRY 0
554 
555 #define RANDOM 0
556 #define ELPURI_CAVE 1
557 #define ATTNAM 2
558 #define NEW_ATTNAM 3
559 #define UNDER_WATER_TUNNEL 4
560 #define EMPTY_AREA 5
561 #define XINROCH_TOMB 6
562 #define BLACK_MARKET 7
563 #define ASLONA_CASTLE 8
564 #define REBEL_CAMP 9
565 #define GOBLIN_FORT 10
566 #define FUNGAL_CAVE 11
567 #define PYRAMID 12
568 #define MONDEDR 13
569 #define IRINOX 14
570 #define DARK_FOREST 15
571 
572 #define UNDER_WATER_TUNNEL_EXIT 0x80
573 
574 #define VESANA_LEVEL 2
575 #define CRYSTAL_LEVEL 3
576 #define SPIDER_LEVEL 4
577 
578 #define ENNER_BEAST_LEVEL 4
579 #define ZOMBIE_LEVEL 5
580 #define IVAN_LEVEL 7
581 #define DARK_LEVEL 8
582 #define OREE_LAIR 12
583 
584 #define DUAL_ENNER_BEAST_LEVEL 5
585 #define NECRO_CHAMBER_LEVEL 6
586 
587 #define FUSANGA_LEVEL 3
588 
589 #define KING_LEVEL 5
590 
591 /* stack::DrawContents flags */
592 
593 #define NO_SELECT 1           // only show items
594 #define NO_MULTI_SELECT 2     // select only one item
595 #define NO_SPECIAL_INFO 4     // show only name and amount
596 #define REMEMBER_SELECTED 8   // if DrawContents will be called multiple times,
597                               // remember the selected item
598 #define NONE_AS_CHOICE 16     // "none" is a choice, for instance when wielding
599 #define SELECT_PAIR 32        // if NO_MULTI_SELECT is on, selects a pair if
600                               // appropriate
601 
602 #define RECTANGLE 1
603 #define ROUND_CORNERS 2
604 #define MAZE_ROOM 3
605 
606 /* Gods, 0 == none */
607 
608 #define GODS 15
609 
610 #define VALPURUS 1
611 #define LEGIFER 2
612 #define ATAVUS 3
613 #define DULCIS 4
614 #define SEGES 5
615 #define SOPHOS 6
616 #define TERRA 7
617 #define SILVA 7
618 #define LORICATUS 8
619 #define MELLIS 9
620 #define CLEPTIA 10
621 #define NEFAS 11
622 #define SCABIES 12
623 #define INFUSCOR 13
624 #define CRUENTUS 14
625 #define MORTIFER 15
626 #define ATHEIST 16
627 
628 #define MAX_PRICE 2147483647L
629 
630 #define PERMANENT 0xFFFF
631 
632 #define MISSED 0
633 #define HIT 1
634 #define CATCHED 2
635 
636 #define BEAM_EFFECTS 17
637 
638 #define BEAM_POLYMORPH 0
639 #define BEAM_STRIKE 1
640 #define BEAM_FIRE_BALL 2
641 #define BEAM_TELEPORT 3
642 #define BEAM_HASTE 4
643 #define BEAM_SLOW 5
644 #define BEAM_RESURRECT 6
645 #define BEAM_INVISIBILITY 7
646 #define BEAM_DUPLICATE 8
647 #define BEAM_LIGHTNING 9
648 #define BEAM_DOOR_CREATION 10
649 #define BEAM_ACID_RAIN 11
650 #define BEAM_NECROMANCY 12
651 #define BEAM_WEBBING 13
652 #define BEAM_ALCHEMY 14
653 #define BEAM_SOFTEN_MATERIAL 15
654 #define BEAM_WALL_CREATION 16
655 
656 #define BEAM_STYLES 3
657 
658 #define PARTICLE_BEAM 0
659 #define LIGHTNING_BEAM 1
660 #define SHIELD_BEAM 2
661 
662 #define RANDOM_COLOR 0x10000
663 
664 /* Entry indices, not actual config defines */
665 
666 #define STAIRS_UP 100
667 #define STAIRS_DOWN 200
668 #define FOUNTAIN 0xFFFF
669 
670 #define NO_LIMIT 0xFFFF
671 
672 #define ALL_ITEMS 0xFFFF
673 
674 /* StateData flags */
675 
676 #define NO_FLAGS 0
677 #define SECRET 1
678 #define DUR_TEMPORARY 2
679 #define DUR_PERMANENT 4
680 #define DUR_FLAGS (2|4)
681 #define SRC_FOUNTAIN 8
682 #define SRC_MUSHROOM 16
683 #define SRC_MAGIC_MUSHROOM 32
684 #define SRC_CONFUSE_READ 64
685 #define SRC_EVIL 128
686 #define SRC_GOOD 256
687 #define SRC_FLAGS (8|16|32|64|128|256)
688 #define RANDOMIZABLE (DUR_FLAGS|SRC_FLAGS)
689 
690 #define MAP_HIDDEN 0
691 #define SHOW_MAP_IN_TRUE_LIGHT 1
692 #define SHOW_MAP_IN_UNIFORM_LIGHT 2
693 
694 #define DIM_LUMINANCE 0x6E6E6E
695 
696 #define BROKEN 128
697 #define WINDOW 1024
698 
699 /* item flags */
700 
701 #define CANNIBALIZED 4
702 #define SQUARE_POSITION_BITS (16|32|64)
703 #define SQUARE_POSITION_SHIFT 4
704 
705 /* bodypart flags */
706 
707 #define UNIQUE 128
708 #define BADLY_HURT 256
709 #define STUCK 512
710 #define BODYPART_SPARKLE_SHIFT 9
711 
712 #define NO_BROKEN 1
713 #define IGNORE_BROKEN_PRICE 2
714 
715 #define MAX_SQUARES_UNDER 16
716 #define MAX_NEIGHBOUR_SQUARES 20
717 
718 #define N_LOCK_ID 1024
719 #define S_LOCK_ID 16384
720 #define LOCK_DELTA 1024
721 
722 #define LOCK_BITS 0xFC00
723 
724 #define BROKEN_LOCK 32768
725 
726 /* Normal lock types, which can be randomized */
727 
728 #define ROUND_LOCK (N_LOCK_ID + LOCK_DELTA * 1)
729 #define SQUARE_LOCK (N_LOCK_ID + LOCK_DELTA * 2)
730 #define TRIANGULAR_LOCK (N_LOCK_ID + LOCK_DELTA * 3)
731 
732 /* Special lock types, which must be generated in the script */
733 
734 #define HEXAGONAL_LOCK (S_LOCK_ID + LOCK_DELTA * 1)
735 #define OCTAGONAL_LOCK (S_LOCK_ID + LOCK_DELTA * 2)
736 #define HEART_SHAPED_LOCK (S_LOCK_ID + LOCK_DELTA * 3)
737 
738 #define DESERT 1
739 #define JUNGLE 2
740 #define STEPPE 3
741 #define LEAFY_FOREST 4
742 #define EVERGREEN_FOREST 5
743 #define TUNDRA 6
744 #define GLACIER 7
745 
746 #define HUGE_WORLD 0
747 #define LARGE_WORLD 1
748 #define MEDIUM_WORLD 2
749 #define SMALL_WORLD 3
750 #define TINY_WORLD 4
751 #define ONE_SCREEN_WORLD 5
752 #define FOUR_SCREEN_WORLD 6
753 
754 #define NO_MOVE 0
755 #define WALK 1
756 #define SWIM 2
757 #define FLY 4
758 #define ETHEREAL 8
759 #define ANY_MOVE 15
760 
761 #define KEY_UP_INDEX 1
762 #define KEY_LEFT_INDEX 3
763 #define KEY_RIGHT_INDEX 4
764 #define KEY_DOWN_INDEX 6
765 
766 #define NO_ACTION 0
767 #define SUCCESS 1
768 #define BLOCKED 2
769 
770 #define STACK_SLOT 1
771 #define CHARACTER_SLOT 2
772 #define GEAR_SLOT 3
773 
774 #define NOT_RUSTED 0
775 #define SLIGHTLY_RUSTED 1
776 #define RUSTED 2
777 #define VERY_RUSTED 3
778 
779 #define NOT_BURNT 0
780 #define SLIGHTLY_BURNT 1
781 #define MODERATELY_BURNT 2
782 #define HEAVILY_BURNT 3
783 
784 #define HUMAN_BODY_ARMOR_PIXELS 68
785 
786 #define ARMOR_OUTLINE_PRIORITY ((7 << 4) + 7)
787 #define CLOAK_PRIORITY ((8 << 4) + 7)
788 
789 #define BODY_ARMOR_PARTS 6
790 
791 #define SUMO_ROOM_POS v2(25, 35)
792 #define SUMO_ARENA_POS v2(19, 12)
793 
794 #define MAX_RAIN_DROPS 32
795 
796 #define WON 0
797 #define LOST 1
798 #define DISQUALIFIED 2
799 
800 #define EMITTER_IDENTIFIER_BITS 0xFFFF
801 #define EMITTER_SQUARE_PART_BITS 0xF000000
802 #define EMITTER_SHADOW_BITS 0xF0000000
803 #define EMITTER_SQUARE_PART_SHIFT 24
804 #define EMITTER_SHADOW_SHIFT 28
805 
806 #define RE_SUN_EMITATED 0x200000
807 #define ID_X_COORDINATE 0x400000
808 #define ID_BEGIN 0x800000
809 
810 #define FORCE_ADD 0x400000
811 #define SECONDARY_SUN_LIGHT 0x800000
812 
813 /* square & lsquare flags */
814 
815 #define ALLOW_EMITATION_CONTINUE 1
816 #define FREEZED 2 /* also a stack flag */
817 #define INSIDE 4
818 #define NEW_DRAW_REQUEST 8
819 #define STRONG_BIT 16
820 #define STRONG_NEW_DRAW_REQUEST (NEW_DRAW_REQUEST|STRONG_BIT)
821 #define DESCRIPTION_CHANGE 32
822 #define MEMORIZED_UPDATE_REQUEST 128
823 #define IN_SQUARE_STACK 256
824 #define CHECK_SUN_LIGHT_NEEDED 512
825 #define IS_TRANSPARENT 1024
826 #define PERFECTLY_QUADRI_HANDLED 2048
827 
828 /* Slows down protosystem::BalancedCreateItem() but makes it produce more
829    accurate results */
830 
831 #define BALANCED_CREATE_ITEM_ITERATIONS 100
832 
833 #define CONFIG_TABLE_SIZE 256
834 
835 #define SPARKLE_POS_X_ERROR 128
836 
837 #define SKIN_COLOR 1
838 #define CAP_COLOR 2
839 #define HAIR_COLOR 4
840 #define EYE_COLOR 8
841 #define TORSO_MAIN_COLOR 16
842 #define BELT_COLOR 32
843 #define BOOT_COLOR 64
844 #define TORSO_SPECIAL_COLOR 128
845 #define ARM_MAIN_COLOR 256
846 #define GAUNTLET_COLOR 512
847 #define ARM_SPECIAL_COLOR 1024
848 #define LEG_MAIN_COLOR 2048
849 #define LEG_SPECIAL_COLOR 4096
850 #define CLOTH_COLOR (CAP_COLOR\
851                     |TORSO_MAIN_COLOR\
852                     |ARM_MAIN_COLOR\
853                     |GAUNTLET_COLOR\
854                     |LEG_MAIN_COLOR)
855 
856 /* contentscript<character> flags */
857 
858 #define IS_LEADER 1
859 #define IS_MASTER 2
860 
861 /* stack flags */
862 
863 /* If set, all items are always considered visible, so CanBeSeenBy calls
864    become unneeded */
865 
866 #define HIDDEN 1
867 
868 /* All costly updates (like emitation's) are avoided if this is set.
869    Allows much faster removing and adding items, but make sure the stack is
870    returned to the original state (excluding item order) before switching
871    this off. Note: also an lsquare flag */
872 
873 #define FREEZED 2
874 
875 /* End stack Flags */
876 
877 #define SUN_BEAM_DIRECTIONS 48
878 
879 /* Square part flags */
880 
881 #define SP_TOP_LEFT 1
882 #define SP_TOP_RIGHT 2
883 #define SP_BOTTOM_LEFT 4
884 #define SP_BOTTOM_RIGHT 8
885 #define SP_TOP (SP_TOP_LEFT|SP_TOP_RIGHT)
886 #define SP_LEFT (SP_TOP_LEFT|SP_BOTTOM_LEFT)
887 #define SP_RIGHT (SP_TOP_RIGHT|SP_BOTTOM_RIGHT)
888 #define SP_BOTTOM (SP_BOTTOM_LEFT|SP_BOTTOM_RIGHT)
889 
890 #define CONDITION_COLORS 5
891 
892 #define NATURAL_MATERIAL_FORM 0x7FFF
893 
894 #define EXP_DIVISOR 2e-8
895 #define EXP_MULTIPLIER 5e+7
896 #define MIN_EXP 5e+7
897 #define MAX_EXP 5e+10
898 
899 #define HAS_BEEN_GENERATED 1
900 #define HAS_BEEN_SEEN 2
901 
902 #define DEPENDS_ON_ATTRIBUTES 0xFFFF
903 
904 /* Tiredness states */
905 
906 #define FAINTING 0
907 #define EXHAUSTED 1
908 #define UNTIRED 2
909 
910 #define DEFAULT_GENERATION_DANGER 0.05
911 #define ANGEL_GENERATION_DANGER 0.10
912 
913 /* Duplication flags */
914 
915 #define MIRROR_IMAGE 1
916 #define IGNORE_PROHIBITIONS 2
917 #define CHANGE_TEAM 4
918 #define LE_BASE_SHIFT 3
919 #define LE_BASE_RANGE 0x7FFF
920 #define LE_RAND_SHIFT 18
921 #define LE_RAND_RANGE 0x3FFF
922 
923 /* action flags */
924 
925 #define IN_DND_MODE 1
926 #define TERMINATING 2
927 
928 /* fluid flags */
929 
930 #define HAS_BODY_ARMOR_PICTURES 1
931 #define FLUID_INSIDE 2
932 
933 #define COMMAND_FLAGS 4
934 #define ALL_COMMAND_FLAGS (1|2|4|8)
935 
936 #define FOLLOW_LEADER 1
937 #define FLEE_FROM_ENEMIES 2
938 #define DONT_CHANGE_EQUIPMENT 4
939 #define DONT_CONSUME_ANYTHING_VALUABLE 8
940 
941 #define CHAT_MENU_ENTRIES 5
942 #define ALL_MANAGEMENT_FLAGS (1|2|4|8|16)
943 
944 #define CHANGE_EQUIPMENT 1
945 #define TAKE_ITEMS 2
946 #define GIVE_ITEMS 4
947 #define ISSUE_COMMANDS 8
948 #define CHAT_IDLY 16
949 
950 #define NO_PARAMETERS 0xFF
951 
952 #define CURSOR_TYPES 4
953 
954 #define DARK_CURSOR 0
955 #define RED_CURSOR 1
956 #define BLUE_CURSOR 2
957 #define YELLOW_CURSOR 3
958 #define CURSOR_FLASH 0x2000
959 #define CURSOR_TARGET 0x4000
960 #define CURSOR_BIG 0x8000
961 #define CURSOR_FLAGS (CURSOR_BIG|CURSOR_FLASH|CURSOR_TARGET)
962 
963 #define GRAY_FRACTAL 0
964 #define RED_FRACTAL 1
965 #define GREEN_FRACTAL 2
966 #define BLUE_FRACTAL 3
967 #define YELLOW_FRACTAL 4
968 
969 #define DAMAGE_TYPES 3
970 
971 #define BLUNT 1
972 #define SLASH 2
973 #define PIERCE 4
974 
975 #define SILHOUETTE_TYPES 2
976 
977 #define SILHOUETTE_NORMAL 0
978 #define SILHOUETTE_INTER_LACED 1
979 
980 #define WARNED 1
981 #define HAS_CAUSED_PANIC 2
982 
983 /* MaxHP calculation flags */
984 
985 #define MAY_CHANGE_HPS 1
986 #define CHECK_USABILITY 2
987 
988 #define ITEM_TRAP 0x8000
989 #define FLUID_TRAP 0x10000
990 
991 /* Death flags */
992 
993 #define FORCE_MSG 1
994 #define FORCE_DEATH 2
995 #define DISALLOW_CORPSE 4
996 #define DISALLOW_MSG 8
997 #define IGNORE_UNCONSCIOUSNESS 16
998 #define IGNORE_TRAPS 32
999 #define FORBID_REINCARNATION 64
1000 
1001 /* character flags */
1002 
1003 #define C_PLAYER 4
1004 #define C_INITIALIZING 8
1005 #define C_POLYMORPHED 16
1006 #define C_IN_NO_MSG_MODE 32
1007 #define C_PICTURE_UPDATES_FORBIDDEN 64
1008 
1009 /*************************/
1010 /* Common DataBase flags */
1011 /*************************/
1012 
1013 /* CommonFlags */
1014 #define IS_ABSTRACT 1
1015 #define HAS_SECONDARY_MATERIAL 2
1016 #define CREATE_DIVINE_CONFIGURATIONS 4
1017 #define CAN_BE_WISHED 8
1018 #define CAN_BE_DESTROYED 16
1019 #define IS_VALUABLE 32
1020 #define CAN_BE_MIRRORED 64
1021 #define CAN_BE_DETECTED 128
1022 
1023 /* NameFlags */
1024 #define USE_AN 1
1025 #define USE_ADJECTIVE_AN 2
1026 #define NO_ARTICLE 4 // for instance "Petrus's wive number 4"
1027 #define FORCE_THE 8
1028 #define SHOW_MATERIAL 16 // only works for terrains
1029 
1030 /****************************/
1031 /* Character DataBase flags */
1032 /****************************/
1033 
1034 /* CommonFlags */
1035 /* NameFlags */
1036 
1037 /* BodyFlags */
1038 #define HAS_HEAD
1039 #define HAS_EYES
1040 #define HAS_A_LEG
1041 #define SPILLS_BLOOD
1042 #define SWEATS
1043 #define USES_NUTRITION
1044 #define ALWAYS_USE_MATERIAL_ATTRIBUTES
1045 #define IS_ENORMOUS
1046 #define IS_EXTRA_FRAGILE
1047 #define IS_PLANT
1048 #define IS_ROOTED
1049 
1050 /* AbilityFlags */
1051 #define CAN_USE_EQUIPMENT
1052 #define CAN_KICK
1053 #define CAN_TALK
1054 #define CAN_READ
1055 #define CAN_OPEN
1056 #define CAN_ZAP
1057 #define CAN_THROW
1058 #define CAN_APPLY
1059 #define CAN_HEAR
1060 
1061 /* CopyrightFlags */
1062 #define IS_UNIQUE
1063 #define CAN_BE_GENERATED
1064 #define CAN_BE_NAMED
1065 
1066 /* EffectFlags; */
1067 #define BODY_PARTS_DISAPPEAR_WHEN_SEVERED
1068 #define DESTROYS_WALLS
1069 #define BITE_CAPTURES_BODY_PART
1070 
1071 /* ImmunityFlags */
1072 #define IMMUNITY_POLYMORPH
1073 #define IMMUNITY_CHARM
1074 #define IMMUNITY_CLONING
1075 #define IMMUNITY_CONFUSE
1076 #define IMMUNITY_LEPROSY
1077 #define IMMUNITY_ITEM_TELEPORT
1078 #define IMMUNITY_STICKINESS
1079 #define IMMUNITY_CHOKING
1080 #define IMMUNITY_UNCONSCIOUSNESS
1081 
1082 /* MiscFlags */
1083 #define CREATE_GOLEM_MATERIAL_CONFIGURATIONS 2
1084 #define IGNORE_DANGER 4
1085 #define AUTOMATICALLY_SEEN 8
1086 #define WILL_CARRY_ITEMS 16
1087 #define IS_EXTRA_COWARD 32
1088 
1089 /***********************/
1090 /* Item DataBase flags */
1091 /***********************/
1092 
1093 /* CommonFlags */
1094 /* NameFlags */
1095 /* AttributeAffectFlags */
1096 
1097 /* GenerationFlags*/
1098 #define CREATE_LOCK_CONFIGURATIONS 2
1099 #define CAN_BE_AUTO_INITIALIZED 4 // used only in WMode
1100 #define CAN_BE_GENERATED_IN_CONTAINER 8
1101 #define CAN_BE_SPAWNED_BY_POLYMORPH 16
1102 
1103 /* InteractionFlags */
1104 #define MATERIAL_CAN_BE_CHANGED
1105 #define CAN_BE_POLYMORPHED
1106 #define CAN_BE_CLONED
1107 #define CAN_BE_ENCHANTED
1108 #define CAN_BE_BROKEN
1109 #define AFFECTS_CARRYING_CAPACITY
1110 
1111 /* CategoryFlags */
1112 #define IS_QUEST_ITEM
1113 #define CAN_BE_USED_BY_SMITH
1114 #define IS_KAMIKAZE_WEAPON
1115 #define IS_TWO_HANDED
1116 #define IS_GOOD_WITH_PLANTS
1117 
1118 /* MiscFlags */
1119 #define HANDLE_IN_PAIRS
1120 #define PRICE_IS_PROPORTIONAL_TO_ENCHANTMENT
1121 #define FLEXIBILITY_IS_ESSENTIAL
1122 #define HAS_NORMAL_PICTURE_DIRECTION
1123 #define CAN_BE_PILED
1124 #define CAN_BE_PICKED_UP
1125 #define ALLOW_EQUIP
1126 
1127 /**************************/
1128 /* Terrain DataBase flags */
1129 /**************************/
1130 
1131 /* CommonFlags */
1132 /* NameFlags */
1133 
1134 /* OLTerrainFlags */
1135 #define CREATE_LOCK_CONFIGURATIONS 2
1136 #define CREATE_WINDOW_CONFIGURATIONS 4
1137 #define IS_UP_LINK
1138 #define IS_WALL
1139 #define USE_BORDER_TILES
1140 #define IS_ALWAYS_TRANSPARENT
1141 #define SHOW_THINGS_UNDER
1142 #define IS_SAFE_TO_CREATE_DOOR
1143 
1144 /***************************/
1145 /* Material DataBase flags */
1146 /***************************/
1147 
1148 /* CommonFlags */
1149 /* NameFlags (only USE_AN) */
1150 
1151 /* CategoryFlags */
1152 #define IS_METAL 1
1153 #define IS_BLOOD 2
1154 #define CAN_BE_TAILORED 4
1155 #define IS_SPARKLING 8
1156 #define IS_SCARY 16
1157 #define IS_GOLEM_MATERIAL 32
1158 #define IS_BEVERAGE 64
1159 
1160 /* BodyFlags */
1161 #define IS_ALIVE 1
1162 #define IS_WARM 2
1163 #define CAN_HAVE_PARASITE 4
1164 #define USE_MATERIAL_ATTRIBUTES 8
1165 #define CAN_REGENERATE 16
1166 #define IS_WARM_BLOODED 32
1167 
1168 /* InteractionFlags */
1169 #define CAN_BURN 1
1170 #define CAN_EXPLODE 2
1171 #define CAN_DISSOLVE 4
1172 #define AFFECT_INSIDE 8
1173 #define EFFECT_IS_GOOD 16
1174 #define IS_AFFECTED_BY_MUSTARD_GAS 32
1175 #define RISES_FROM_ASHES 64
1176 
1177 /*************************/
1178 /* End of DataBase flags */
1179 /*************************/
1180 
1181 #define TILE_SIZE 16
1182 cv2 TILE_V2(TILE_SIZE, TILE_SIZE);
1183 
1184 #define SQUARE_INDEX_MASK 0xFFFF
1185 #define ALLOW_ANIMATE 0x10000
1186 #define ALLOW_ALPHA 0x20000
1187 
1188 #define TALENTS 5
1189 
1190 /* 0 reserved for no talent */
1191 #define TALENT_STRONG 1
1192 #define TALENT_FAST_N_ACCURATE 2
1193 #define TALENT_HEALTHY 3
1194 #define TALENT_CLEVER 4
1195 
1196 #define BORDER_PARTNER_ANIMATED (16 << 24)
1197 
1198 /* room flags */
1199 
1200 #define NO_MONSTER_GENERATION 1
1201 
1202 #define NO_TAMING -1
1203 
1204 #define SADIST_HIT 1
1205 
1206 #define EQUIPMENT_DATAS 13
1207 
1208 #define SPECIAL_CONFIGURATION_GENERATION_LEVELS 2
1209 
1210 #endif
1211