--- deliantra/server/include/define.h 2006/12/14 22:45:40 1.15 +++ deliantra/server/include/define.h 2006/12/20 14:11:42 1.26 @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at crossfire@schmorp.de */ /* This file is best viewed with a window width of about 100 character */ @@ -114,195 +114,219 @@ /* type 0 will be undefined and shows a non valid type information */ -#define PLAYER 1 -#define TRANSPORT 2 /* see doc/Developers/objects */ -#define ROD 3 -#define TREASURE 4 -#define POTION 5 -#define FOOD 6 -#define POISON 7 -#define BOOK 8 -#define CLOCK 9 - -/*#define FBULLET 10 */ - -/*#define FBALL 11 */ -#define LIGHTNING 12 -#define ARROW 13 -#define BOW 14 -#define WEAPON 15 -#define ARMOUR 16 -#define PEDESTAL 17 -#define ALTAR 18 - -/*#define CONFUSION 19 */ -#define LOCKED_DOOR 20 -#define SPECIAL_KEY 21 -#define MAP 22 -#define DOOR 23 -#define KEY 24 - -/*#define MMISSILE 25 */ -#define TIMED_GATE 26 -#define TRIGGER 27 -#define GRIMREAPER 28 -#define MAGIC_EAR 29 -#define TRIGGER_BUTTON 30 -#define TRIGGER_ALTAR 31 -#define TRIGGER_PEDESTAL 32 -#define SHIELD 33 -#define HELMET 34 -#define HORN 35 -#define MONEY 36 -#define CLASS 37 /* object for applying character class modifications to someone */ -#define GRAVESTONE 38 -#define AMULET 39 -#define PLAYERMOVER 40 -#define TELEPORTER 41 -#define CREATOR 42 -#define SKILL 43 /* also see SKILL_TOOL (74) below */ -#define EXPERIENCE 44 /* This is basically obsolete now. It used to contain */ - /* experience for broad skill categories. This value */ - /* is now automatically converteed at load time. */ -#define EARTHWALL 45 -#define GOLEM 46 - -/*#define BOMB 47 */ -#define THROWN_OBJ 48 -#define BLINDNESS 49 -#define GOD 50 - -#define DETECTOR 51 /* peterm: detector is an object */ - /* which notices the presense of */ - /* another object and is triggered */ - /* like buttons. */ -#define TRIGGER_MARKER 52 /* inserts an invisible, weightless */ - /* force into a player with a specified string WHEN TRIGGERED. */ -#define DEAD_OBJECT 53 -#define DRINK 54 -#define MARKER 55 /* inserts an invisible, weightless */ - /* force into a player with a specified string. */ -#define HOLY_ALTAR 56 -#define PLAYER_CHANGER 57 -#define BATTLEGROUND 58 /* battleground, by Andreas Vogl */ - -#define PEACEMAKER 59 /* Object owned by a player which can convert */ - /* a monster into a peaceful being incapable of attack. */ -#define GEM 60 - - /*#define FIRECHEST 61*//* FIRECHEST folded into FIREWALL */ -#define FIREWALL 62 -#define ANVIL 63 -#define CHECK_INV 64 /* by b.t. thomas@nomad.astro.psu.edu */ -#define MOOD_FLOOR 65 /* by b.t. thomas@nomad.astro.psu.edu - * values of last_sp set how to change: - * 0 = furious, all monsters become aggressive - * 1 = angry, all but friendly become aggressive - * 2 = calm, all aggressive monsters calm down - * 3 = sleep, all monsters fall asleep - * 4 = charm, monsters become pets */ -#define EXIT 66 -#define ENCOUNTER 67 -#define SHOP_FLOOR 68 -#define SHOP_MAT 69 -#define RING 70 -#define FLOOR 71 /* this is a floor tile -> native layer 0 */ -#define FLESH 72 /* animal 'body parts' -b.t. */ -#define INORGANIC 73 /* metals and minerals */ -#define SKILL_TOOL 74 /* Allows the use of a skill */ -#define LIGHTER 75 - -/* The trap_part, wall, light_source, misc_object, monster, and spawn_generator - * types are not used in any archetypes, and should perhaps be removed. +#define PLAYER 1 +#define TRANSPORT 2 /* see pod/objects.pod */ +#define ROD 3 +#define TREASURE 4 +#define POTION 5 +#define FOOD 6 +#define POISON 7 +#define BOOK 8 +#define CLOCK 9 + +/*#define FBULLET 10 */ +/*#define FBALL 11 */ + +/*#define LIGHTNING 12 */ // elmex: implemented by type 102 subtype 4 +#define ARROW 13 +#define BOW 14 +#define WEAPON 15 +#define ARMOUR 16 +#define PEDESTAL 17 +#define ALTAR 18 + +/*#define CONFUSION 19 */ + +#define LOCKED_DOOR 20 +#define SPECIAL_KEY 21 +#define MAP 22 +#define DOOR 23 +#define KEY 24 + +/*#define MMISSILE 25 */ + +#define TIMED_GATE 26 +#define TRIGGER 27 +#define GRIMREAPER 28 +#define MAGIC_EAR 29 +#define TRIGGER_BUTTON 30 +#define TRIGGER_ALTAR 31 +#define TRIGGER_PEDESTAL 32 +#define SHIELD 33 +#define HELMET 34 +#define HORN 35 +#define MONEY 36 +#define CLASS 37 /* object for applying character class modifications to someone */ +#define GRAVESTONE 38 +#define AMULET 39 +#define PLAYERMOVER 40 +#define TELEPORTER 41 +#define CREATOR 42 +#define SKILL 43 /* also see SKILL_TOOL (74) below */ + +/*#define EXPERIENCE 44*//* This is basically obsolete now. It used to contain + * experience for broad skill categories. This value + * is now automatically converteed at load time. + */ + +#define EARTHWALL 45 +#define GOLEM 46 + +/*#define BOMB 47 */ +#define THROWN_OBJ 48 +#define BLINDNESS 49 +#define GOD 50 +#define DETECTOR 51 /* peterm: detector is an object + * which notices the presense of + * another object and is triggered + * like buttons. + */ +#define TRIGGER_MARKER 52 /* inserts an invisible, weightless + * force into a player with a specified string WHEN TRIGGERED. + */ +#define DEAD_OBJECT 53 +#define DRINK 54 +#define MARKER 55 /* inserts an invisible, weightless + * force into a player with a specified string. + */ +#define HOLY_ALTAR 56 +#define PLAYER_CHANGER 57 +#define BATTLEGROUND 58 /* battleground, by Andreas Vogl */ + +#define PEACEMAKER 59 /* Object owned by a player which can convert + * a monster into a peaceful being incapable of attack. + */ +#define GEM 60 + +/*#define FIRECHEST 61*/ /* FIRECHEST folded into FIREWALL */ + +#define FIREWALL 62 +#define ANVIL 63 +#define CHECK_INV 64 /* by b.t. thomas@nomad.astro.psu.edu */ +#define MOOD_FLOOR 65 /* by b.t. thomas@nomad.astro.psu.edu + * values of last_sp set how to change: + * 0 = furious, all monsters become aggressive + * 1 = angry, all but friendly become aggressive + * 2 = calm, all aggressive monsters calm down + * 3 = sleep, all monsters fall asleep + * 4 = charm, monsters become pets */ +#define EXIT 66 +#define ENCOUNTER 67 +#define SHOP_FLOOR 68 +#define SHOP_MAT 69 +#define RING 70 +#define FLOOR 71 /* this is a floor tile -> native layer 0 */ +#define FLESH 72 /* animal 'body parts' -b.t. */ +#define INORGANIC 73 /* metals and minerals */ +#define SKILL_TOOL 74 /* Allows the use of a skill */ +#define LIGHTER 75 + +/* random crossfire developer: The trap_part, wall, light_source, + * misc_object, monster, and spawn_generator + * types are not used in any archetypes, + * and should perhaps be removed. + * + * Wed Dec 20 13:35:24 CET 2006: + * elmex: haha, removed TRAP_PART, LIGHT_SOURCE, MONSTER and SPAWN_GENERATOR now. + * monsters are marked by FLAG_MONSTER and generator with FLAG_GENERATOR. + * renamed WALL to BUILDABLE_WALL. */ -#define TRAP_PART 76 /* Needed by set traps skill -b.t. */ -#define WALL 77 /* this is a wall. put it always in layer 1 if not set is_floor */ -#define LIGHT_SOURCE 78 /* torches, lamps, etc. */ -#define MISC_OBJECT 79 /* misc. objects are for objects without a function - in the engine. Like statues, clocks, chairs,... - If perhaps we create a function where we can sit - on chairs, we create a new type and remove all - chairs from here. */ -#define MONSTER 80 - /* yes, thats a real, living creature */ -#define SPAWN_GENERATOR 81 - /* a spawn point or monster generator object */ -#define LAMP 82 /* a lamp */ -#define DUPLICATOR 83 /* duplicator/multiplier object */ -#define TOOL 84 /* a tool for building objects */ -#define SPELLBOOK 85 -#define BUILDFAC 86 /* facilities for building objects */ -#define CLOAK 87 - -/*#define CONE 88 */ - - /*#define AURA 89 *//* aura spell object */ - -#define SPINNER 90 -#define GATE 91 -#define BUTTON 92 -#define CF_HANDLE 93 -#define HOLE 94 -#define TRAPDOOR 95 - -/*#define WORD_OF_RECALL 96 */ - -/*#define PARAIMAGE 97 */ -#define SIGN 98 -#define BOOTS 99 -#define GLOVES 100 -#define SPELL 101 -#define SPELL_EFFECT 102 -#define CONVERTER 103 -#define BRACERS 104 -#define POISONING 105 -#define SAVEBED 106 -#define POISONCLOUD 107 -#define FIREHOLES 108 -#define WAND 109 - -/*#define ABILITY 110*/ -#define SCROLL 111 -#define DIRECTOR 112 -#define GIRDLE 113 -#define FORCE 114 -#define POTION_EFFECT 115 /* a force, holding the effect of a potion */ -#define EVENT_CONNECTOR 116/* Lauwenmark: an invisible object holding a plugin event hook */ -#define CLOSE_CON 121 /* Eneq(@csd.uu.se): Id for close_container archetype. */ -#define CONTAINER 122 -#define ARMOUR_IMPROVER 123 -#define WEAPON_IMPROVER 124 +//#define TRAP_PART 76 /* Needed by set traps skill -b.t. */ + +#define BUILDABLE_WALL 77 /* this is a buildable wall */ + +//#define LIGHT_SOURCE 78 /* torches, lamps, etc. */ + +#define MISC_OBJECT 79 /* misc. objects are for objects without a function + in the engine. Like statues, clocks, chairs,... + If perhaps we create a function where we can sit + on chairs, we create a new type and remove all + chairs from here. */ +//#define MONSTER 80 /* yes, thats a real, living creature */ +//#define SPAWN_GENERATOR 81 /* a spawn point or monster generator object */ + +#define LAMP 82 /* a lamp */ +#define DUPLICATOR 83 /* duplicator/multiplier object */ +#define TOOL 84 /* a tool for building objects */ +#define SPELLBOOK 85 +#define BUILDFAC 86 /* facilities for building objects */ +#define CLOAK 87 + +/*#define CONE 88 */ +/*#define AURA 89 */ /* aura spell object */ + +#define SPINNER 90 +#define GATE 91 +#define BUTTON 92 +#define CF_HANDLE 93 +#define HOLE 94 +#define TRAPDOOR 95 + +/*#define WORD_OF_RECALL 96 */ +/*#define PARAIMAGE 97 */ + +#define SIGN 98 +#define BOOTS 99 +#define GLOVES 100 +#define SPELL 101 +#define SPELL_EFFECT 102 +#define CONVERTER 103 +#define BRACERS 104 +#define POISONING 105 +#define SAVEBED 106 + +// #define POISONCLOUD 107 +// #define FIREHOLES 108 + +#define WAND 109 + +/*#define ABILITY 110*/ +#define SCROLL 111 +#define DIRECTOR 112 +#define GIRDLE 113 +#define FORCE 114 +#define POTION_EFFECT 115 /* a force, holding the effect of a potion */ +#define EVENT_CONNECTOR 116 /* Lauwenmark: an invisible object holding a plugin event hook */ + +#define CLOSE_CON 121 /* Eneq(@csd.uu.se): Id for close_container archetype. */ +#define CONTAINER 122 +#define ARMOUR_IMPROVER 123 +#define WEAPON_IMPROVER 124 /* unused: 125 - 129 * type 125 was MONEY_CHANGER */ -#define SKILLSCROLL 130 /* can add a skill to player's inventory -bt. */ -#define DEEP_SWAMP 138 -#define IDENTIFY_ALTAR 139 - - /*#define CANCELLATION 141*//* not used with new spell code */ -#define MENU 150 /* Mark Wedel (mark@pyramid.com) Shop inventories */ - - /*#define BALL_LIGHTNING 151 *//* peterm: ball lightning and color spray */ - -/*#define SWARM_SPELL 153*/ -#define RUNE 154 -#define TRAP 155 - -#define POWER_CRYSTAL 156 -#define CORPSE 157 - -#define DISEASE 158 -#define SYMPTOM 159 -#define BUILDER 160 /* Generic item builder, see subtypes */ -#define MATERIAL 161/* Material for building */ - -/* #define GPS 162 Ground positionning system, moved to Python plugin */ -#define ITEM_TRANSFORMER 163/* Transforming one item with another */ -#define QUEST 164/* See below for subtypes */ -#define SAFE_GROUND 165 /* This is a safe ground, means that neither bombs, - potions, alchemy, or magic works here (elmex) */ + +#define SKILLSCROLL 130 /* can add a skill to player's inventory -bt. */ +#define DEEP_SWAMP 138 +#define IDENTIFY_ALTAR 139 + +/*#define CANCELLATION 141 */ /* not used with new spell code */ + +#define MENU 150 /* Mark Wedel (mark@pyramid.com) Shop inventories */ + +/*#define BALL_LIGHTNING 151 */ /* peterm: ball lightning and color spray */ +/*#define SWARM_SPELL 153*/ + +#define RUNE 154 +#define TRAP 155 + +#define POWER_CRYSTAL 156 +#define CORPSE 157 + +#define DISEASE 158 +#define SYMPTOM 159 +#define BUILDER 160 /* Generic item builder, see subtypes */ +#define MATERIAL 161 /* Material for building */ + +/* #define GPS 162 Ground positionning system, moved to Python plugin */ +#define ITEM_TRANSFORMER 163 /* Transforming one item with another */ + +/*#define QUEST 164 */ /* See below for subtypes */ + +#define SAFE_GROUND 165 /* This is a safe ground, means that neither bombs, + potions, alchemy, or magic works here (elmex) */ /* END TYPE DEFINE */ @@ -397,74 +421,15 @@ #define NROF_SOUNDS (23 + NROFREALSPELLS) /* Number of sounds */ -/* Flag structure now changed. - * Each flag is now a bit offset, starting at zero. The macros - * will update/read the appropriate flag element in the object - * structure. - * - * Hopefully, since these offsets are integer constants set at run time, - * the compiler will reduce the macros something as simple as the - * old system was. - * - * Flags now have FLAG as the prefix. This to be clearer, and also - * to make sure F_ names are not still being used anyplace. - * - * The macros below assume that the flag size for each element is 32 - * bits. IF it is smaller, bad things will happen. See structs.h - * for more info. - * - * All functions should use the macros below. In process of converting - * to the new system, I find several files that did not use the previous - * macros. - * - * If any FLAG's are or changed, make sure the flag_names structure in +/* + * If any FLAG's are added or changed, make sure the flag_names structure in * common/loader.l is updated. - * - * flags[0] is 0 to 31 - * flags[1] is 32 to 63 - * flags[2] is 64 to 95 - * flags[3] is 96 to 127 */ /* Basic routines to do above */ -#define SET_FLAG(xyz, p) \ - ((xyz)->flags[p/32] |= (1U << (p % 32))) -#define CLEAR_FLAG(xyz, p) \ - ((xyz)->flags[p/32] &= ~(1U << (p % 32))) -#define QUERY_FLAG(xyz, p) \ - ((xyz)->flags[p/32] & (1U << (p % 32))) -#define COMPARE_FLAGS(p,q) \ - ( \ - ((p)->flags[0] == (q)->flags[0]) && \ - ((p)->flags[1] == (q)->flags[1]) && \ - ((p)->flags[2] == (q)->flags[2]) && \ - ((p)->flags[3] == (q)->flags[3]) \ - ) - -/* convenience macros to determine what kind of things we are dealing with */ - -#define IS_WEAPON(op) \ - (op->type == ARROW || op->type == BOW || op->type == WEAPON) - -#define IS_ARMOR(op) \ - (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \ - op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \ - op->type == BRACERS || op->type == GIRDLE) - -#define IS_LIVE(op) \ - ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \ - (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \ - !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) - -#define IS_ARROW(op) \ - (op->type==ARROW || \ - (op->type==SPELL_EFFECT && \ - (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE))) - -/* This return TRUE if object has still randomitems which - * could be expanded. - */ -#define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) +#define SET_FLAG(obj, flag) (obj)->flags[flag] = 1 +#define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0 +#define QUERY_FLAG(obj, flag) (obj)->flags[flag] /* the flags */ @@ -495,7 +460,7 @@ #define FLAG_IS_THROWN 17 /* Object is designed to be thrown. */ #define FLAG_AUTO_APPLY 18 /* Will be applied when created */ -#define FLAG_TREASURE 19 /* Will generate treasure when applied */ + // not used anywhere in the code // #define FLAG_TREASURE 19 /* Will generate treasure when applied */ #define FLAG_PLAYER_SOLD 20 /* Object was sold to a shop by a player. */ #define FLAG_SEE_INVISIBLE 21 /* Will see invisible player */ #define FLAG_CAN_ROLL 22 /* Object can be rolled */