1 | /* |
1 | /* |
2 | * static char *rcsid_define_h = |
2 | * static char *rcsid_define_h = |
3 | * "$Id: define.h,v 1.6 2006/08/15 18:12:20 elmex Exp $"; |
3 | * "$Id: define.h,v 1.9 2006/09/11 12:08:01 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
161 | #define PLAYERMOVER 40 |
161 | #define PLAYERMOVER 40 |
162 | #define TELEPORTER 41 |
162 | #define TELEPORTER 41 |
163 | #define CREATOR 42 |
163 | #define CREATOR 42 |
164 | #define SKILL 43 /* also see SKILL_TOOL (74) below */ |
164 | #define SKILL 43 /* also see SKILL_TOOL (74) below */ |
165 | #define EXPERIENCE 44 /* This is basically obsolete now. It used to contain */ |
165 | #define EXPERIENCE 44 /* This is basically obsolete now. It used to contain */ |
166 | /* experience for broad skill categories. This value */ |
166 | /* experience for broad skill categories. This value */ |
167 | /* is now automatically converteed at load time. */ |
167 | /* is now automatically converteed at load time. */ |
168 | #define EARTHWALL 45 |
168 | #define EARTHWALL 45 |
169 | #define GOLEM 46 |
169 | #define GOLEM 46 |
170 | /*#define BOMB 47 */ |
170 | /*#define BOMB 47 */ |
171 | #define THROWN_OBJ 48 |
171 | #define THROWN_OBJ 48 |
172 | #define BLINDNESS 49 |
172 | #define BLINDNESS 49 |
173 | #define GOD 50 |
173 | #define GOD 50 |
174 | |
174 | |
175 | #define DETECTOR 51 /* peterm: detector is an object */ |
175 | #define DETECTOR 51 /* peterm: detector is an object */ |
176 | /* which notices the presense of */ |
176 | /* which notices the presense of */ |
177 | /* another object and is triggered */ |
177 | /* another object and is triggered */ |
178 | /* like buttons. */ |
178 | /* like buttons. */ |
179 | #define TRIGGER_MARKER 52 /* inserts an invisible, weightless */ |
179 | #define TRIGGER_MARKER 52 /* inserts an invisible, weightless */ |
180 | /* force into a player with a specified string WHEN TRIGGERED. */ |
180 | /* force into a player with a specified string WHEN TRIGGERED. */ |
181 | #define DEAD_OBJECT 53 |
181 | #define DEAD_OBJECT 53 |
182 | #define DRINK 54 |
182 | #define DRINK 54 |
183 | #define MARKER 55 /* inserts an invisible, weightless */ |
183 | #define MARKER 55 /* inserts an invisible, weightless */ |
184 | /* force into a player with a specified string. */ |
184 | /* force into a player with a specified string. */ |
185 | #define HOLY_ALTAR 56 |
185 | #define HOLY_ALTAR 56 |
186 | #define PLAYER_CHANGER 57 |
186 | #define PLAYER_CHANGER 57 |
187 | #define BATTLEGROUND 58 /* battleground, by Andreas Vogl */ |
187 | #define BATTLEGROUND 58 /* battleground, by Andreas Vogl */ |
188 | |
188 | |
189 | #define PEACEMAKER 59 /* Object owned by a player which can convert */ |
189 | #define PEACEMAKER 59 /* Object owned by a player which can convert */ |
190 | /* a monster into a peaceful being incapable of attack. */ |
190 | /* a monster into a peaceful being incapable of attack. */ |
191 | #define GEM 60 |
191 | #define GEM 60 |
192 | /*#define FIRECHEST 61*/ /* FIRECHEST folded into FIREWALL */ |
192 | /*#define FIRECHEST 61*/ /* FIRECHEST folded into FIREWALL */ |
193 | #define FIREWALL 62 |
193 | #define FIREWALL 62 |
194 | #define ANVIL 63 |
194 | #define ANVIL 63 |
195 | #define CHECK_INV 64 /* by b.t. thomas@nomad.astro.psu.edu */ |
195 | #define CHECK_INV 64 /* by b.t. thomas@nomad.astro.psu.edu */ |
196 | #define MOOD_FLOOR 65 /* by b.t. thomas@nomad.astro.psu.edu |
196 | #define MOOD_FLOOR 65 /* by b.t. thomas@nomad.astro.psu.edu |
197 | * values of last_sp set how to change: |
197 | * values of last_sp set how to change: |
198 | * 0 = furious, all monsters become aggressive |
198 | * 0 = furious, all monsters become aggressive |
199 | * 1 = angry, all but friendly become aggressive |
199 | * 1 = angry, all but friendly become aggressive |
200 | * 2 = calm, all aggressive monsters calm down |
200 | * 2 = calm, all aggressive monsters calm down |
201 | * 3 = sleep, all monsters fall asleep |
201 | * 3 = sleep, all monsters fall asleep |
202 | * 4 = charm, monsters become pets */ |
202 | * 4 = charm, monsters become pets */ |
203 | #define EXIT 66 |
203 | #define EXIT 66 |
204 | #define ENCOUNTER 67 |
204 | #define ENCOUNTER 67 |
205 | #define SHOP_FLOOR 68 |
205 | #define SHOP_FLOOR 68 |
206 | #define SHOP_MAT 69 |
206 | #define SHOP_MAT 69 |
207 | #define RING 70 |
207 | #define RING 70 |
… | |
… | |
291 | #define QUEST 164 /* See below for subtypes */ |
291 | #define QUEST 164 /* See below for subtypes */ |
292 | #define SAFE_GROUND 165 /* This is a safe ground, means that neither bombs, |
292 | #define SAFE_GROUND 165 /* This is a safe ground, means that neither bombs, |
293 | potions, alchemy, or magic works here (elmex) */ |
293 | potions, alchemy, or magic works here (elmex) */ |
294 | /* END TYPE DEFINE */ |
294 | /* END TYPE DEFINE */ |
295 | |
295 | |
|
|
296 | #define NUM_SUBTYPES 64 // maximum supported subtype number + 1, can be increased to 256 |
|
|
297 | |
296 | /* Subtypes for BUILDER */ |
298 | /* Subtypes for BUILDER */ |
297 | #define ST_BD_BUILD 1 /* Builds an item */ |
299 | #define ST_BD_BUILD 1 /* Builds an item */ |
298 | #define ST_BD_REMOVE 2 /* Removes an item */ |
300 | #define ST_BD_REMOVE 2 /* Removes an item */ |
299 | |
301 | |
300 | /* Subtypes for MATERIAL */ |
302 | /* Subtypes for MATERIAL */ |
301 | #define ST_MAT_FLOOR 1 /* Floor */ |
303 | #define ST_MAT_FLOOR 1 /* Floor */ |
302 | #define ST_MAT_WALL 2 /* Wall */ |
304 | #define ST_MAT_WALL 2 /* Wall */ |
303 | #define ST_MAT_ITEM 3 /* All other items, including doors & such */ |
305 | #define ST_MAT_ITEM 3 /* All other items, including doors & such */ |
304 | |
|
|
305 | /* Subtypes for QUEST */ |
|
|
306 | #define QUEST_IN_PROGRESS 1 |
|
|
307 | #define QUEST_DONE_QUEST 2 |
|
|
308 | #define QUEST_DONE_TASK 3 |
|
|
309 | #define QUEST_START_QUEST 4 |
|
|
310 | #define QUEST_END_QUEST 5 |
|
|
311 | #define QUEST_START_TASK 6 |
|
|
312 | #define QUEST_END_TASK 7 |
|
|
313 | #define QUEST_OVERRIDE 8 |
|
|
314 | #define QUEST_ON_ACTIVATE 9 |
|
|
315 | |
306 | |
316 | /* definitions for weapontypes */ |
307 | /* definitions for weapontypes */ |
317 | |
308 | |
318 | #define WEAP_HIT 0 /* the basic */ |
309 | #define WEAP_HIT 0 /* the basic */ |
319 | #define WEAP_SLASH 1 /* slash */ |
310 | #define WEAP_SLASH 1 /* slash */ |
… | |
… | |
419 | * flags[2] is 64 to 95 |
410 | * flags[2] is 64 to 95 |
420 | * flags[3] is 96 to 127 |
411 | * flags[3] is 96 to 127 |
421 | */ |
412 | */ |
422 | /* Basic routines to do above */ |
413 | /* Basic routines to do above */ |
423 | #define SET_FLAG(xyz, p) \ |
414 | #define SET_FLAG(xyz, p) \ |
424 | ((xyz)->flags[p/32] |= (1U << (p % 32))) |
415 | ((xyz)->flags[p/32] |= (1U << (p % 32))) |
425 | #define CLEAR_FLAG(xyz, p) \ |
416 | #define CLEAR_FLAG(xyz, p) \ |
426 | ((xyz)->flags[p/32] &= ~(1U << (p % 32))) |
417 | ((xyz)->flags[p/32] &= ~(1U << (p % 32))) |
427 | #define QUERY_FLAG(xyz, p) \ |
418 | #define QUERY_FLAG(xyz, p) \ |
428 | ((xyz)->flags[p/32] & (1U << (p % 32))) |
419 | ((xyz)->flags[p/32] & (1U << (p % 32))) |
429 | #define COMPARE_FLAGS(p,q) \ |
420 | #define COMPARE_FLAGS(p,q) \ |
430 | ( \ |
421 | ( \ |
431 | ((p)->flags[0] == (q)->flags[0]) && \ |
422 | ((p)->flags[0] == (q)->flags[0]) && \ |
432 | ((p)->flags[1] == (q)->flags[1]) && \ |
423 | ((p)->flags[1] == (q)->flags[1]) && \ |
433 | ((p)->flags[2] == (q)->flags[2]) && \ |
424 | ((p)->flags[2] == (q)->flags[2]) && \ |
434 | ((p)->flags[3] == (q)->flags[3]) \ |
425 | ((p)->flags[3] == (q)->flags[3]) \ |
435 | ) |
426 | ) |
436 | /* convenience macros to determine what kind of things we are dealing with */ |
427 | /* convenience macros to determine what kind of things we are dealing with */ |
437 | |
428 | |
438 | #define IS_WEAPON(op) \ |
429 | #define IS_WEAPON(op) \ |
439 | (op->type == ARROW || op->type == BOW || op->type == WEAPON) |
430 | (op->type == ARROW || op->type == BOW || op->type == WEAPON) |
440 | |
431 | |
441 | #define IS_ARMOR(op) \ |
432 | #define IS_ARMOR(op) \ |
442 | (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \ |
433 | (op->type == ARMOUR || op->type == SHIELD || op->type == HELMET || \ |
443 | op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \ |
434 | op->type == CLOAK || op->type == BOOTS || op->type == GLOVES || \ |
444 | op->type == BRACERS || op->type == GIRDLE) |
435 | op->type == BRACERS || op->type == GIRDLE) |
445 | |
436 | |
446 | #define IS_LIVE(op) \ |
437 | #define IS_LIVE(op) \ |
447 | ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \ |
438 | ((op->type == PLAYER || QUERY_FLAG(op, FLAG_MONSTER) || \ |
448 | (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \ |
439 | (QUERY_FLAG(op, FLAG_ALIVE) && !QUERY_FLAG(op, FLAG_GENERATOR) && \ |
449 | !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) |
440 | !op->type == DOOR)) && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) |
450 | |
441 | |
451 | #define IS_ARROW(op) \ |
442 | #define IS_ARROW(op) \ |
452 | (op->type==ARROW || \ |
443 | (op->type==ARROW || \ |
453 | (op->type==SPELL_EFFECT && \ |
444 | (op->type==SPELL_EFFECT && \ |
454 | (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE))) |
445 | (op->subtype == SP_BULLET || op->subtype == SP_MAGIC_MISSILE))) |
455 | |
446 | |
456 | /* This return TRUE if object has still randomitems which |
447 | /* This return TRUE if object has still randomitems which |
457 | * could be expanded. |
448 | * could be expanded. |
458 | */ |
449 | */ |
459 | #define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) |
450 | #define HAS_RANDOM_ITEMS(op) (op->randomitems && (!QUERY_FLAG(op,FLAG_IS_A_TEMPLATE))) |
… | |
… | |
509 | #define FLAG_NO_MAGIC 41 /* Spells (some) can't pass this object */ |
500 | #define FLAG_NO_MAGIC 41 /* Spells (some) can't pass this object */ |
510 | #define FLAG_NO_FIX_PLAYER 42 /* fix_player() won't be called */ |
501 | #define FLAG_NO_FIX_PLAYER 42 /* fix_player() won't be called */ |
511 | #define FLAG_IS_LIGHTABLE 43 /* object can be lit */ |
502 | #define FLAG_IS_LIGHTABLE 43 /* object can be lit */ |
512 | #define FLAG_TEAR_DOWN 44 /* at->faces[hp*animations/maxhp] at hit */ |
503 | #define FLAG_TEAR_DOWN 44 /* at->faces[hp*animations/maxhp] at hit */ |
513 | #define FLAG_RUN_AWAY 45 /* Object runs away from nearest player \ |
504 | #define FLAG_RUN_AWAY 45 /* Object runs away from nearest player \ |
514 | but can still attack at a distance */ |
505 | but can still attack at a distance */ |
515 | /*#define FLAG_PASS_THRU 46*/ /* Objects with can_pass_thru can pass \ |
506 | /*#define FLAG_PASS_THRU 46*/ /* Objects with can_pass_thru can pass \ |
516 | thru this object as if it wasn't there */ |
507 | thru this object as if it wasn't there */ |
517 | /*#define FLAG_CAN_PASS_THRU 47*/ /* Can pass thru... */ |
508 | /*#define FLAG_CAN_PASS_THRU 47*/ /* Can pass thru... */ |
518 | |
509 | |
519 | #define FLAG_PICK_UP 48 /* Can pick up */ |
510 | #define FLAG_PICK_UP 48 /* Can pick up */ |
520 | #define FLAG_UNIQUE 49 /* Item is really unique (UNIQUE_ITEMS) */ |
511 | #define FLAG_UNIQUE 49 /* Item is really unique (UNIQUE_ITEMS) */ |
521 | #define FLAG_NO_DROP 50 /* Object can't be dropped */ |
512 | #define FLAG_NO_DROP 50 /* Object can't be dropped */ |
… | |
… | |
572 | /*#define FLAG_DUST 95 *//* item is a 'powder', effects throwing */ |
563 | /*#define FLAG_DUST 95 *//* item is a 'powder', effects throwing */ |
573 | |
564 | |
574 | /* Start of values in flags[3] */ |
565 | /* Start of values in flags[3] */ |
575 | #define FLAG_NO_STEAL 96 /* Item can't be stolen */ |
566 | #define FLAG_NO_STEAL 96 /* Item can't be stolen */ |
576 | #define FLAG_ONE_HIT 97 /* Monster can only hit once before going |
567 | #define FLAG_ONE_HIT 97 /* Monster can only hit once before going |
577 | * away (replaces ghosthit) |
568 | * away (replaces ghosthit) |
578 | */ |
569 | */ |
579 | #define FLAG_CLIENT_SENT 98 /* THIS IS A DEBUG FLAG ONLY. We use it to |
570 | #define FLAG_CLIENT_SENT 98 /* THIS IS A DEBUG FLAG ONLY. We use it to |
580 | * detect cases were the server is trying |
571 | * detect cases were the server is trying |
581 | * to send an upditem when we have not |
572 | * to send an upditem when we have not |
582 | * actually sent the item. |
573 | * actually sent the item. |
583 | */ |
574 | */ |
584 | |
575 | |
585 | #define FLAG_BERSERK 99 /* monster will attack closest living |
576 | #define FLAG_BERSERK 99 /* monster will attack closest living |
586 | object */ |
577 | object */ |
587 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
578 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
588 | #define FLAG_NO_ATTACK 101 /* monster don't attack */ |
579 | #define FLAG_NO_ATTACK 101 /* monster don't attack */ |
589 | #define FLAG_NO_DAMAGE 102 /* monster can't be damaged */ |
580 | #define FLAG_NO_DAMAGE 102 /* monster can't be damaged */ |
590 | #define FLAG_OBJ_ORIGINAL 103 /* NEVER SET THIS. Item was loaded by |
581 | #define FLAG_OBJ_ORIGINAL 103 /* NEVER SET THIS. Item was loaded by |
591 | * load_original_map() */ |
582 | * load_original_map() */ |
592 | #define FLAG_OBJ_SAVE_ON_OVL 104 /* this object should be saved on |
583 | #define FLAG_OBJ_SAVE_ON_OVL 104 /* this object should be saved on |
593 | * the overlay, and is not subject to |
584 | * the overlay, and is not subject to |
594 | * decay. */ |
585 | * decay. */ |
595 | #define FLAG_ACTIVATE_ON_PUSH 105 /* connected object is activated when 'pushed' */ |
586 | #define FLAG_ACTIVATE_ON_PUSH 105 /* connected object is activated when 'pushed' */ |
596 | #define FLAG_ACTIVATE_ON_RELEASE 106 /* connected object is activated when 'released' */ |
587 | #define FLAG_ACTIVATE_ON_RELEASE 106 /* connected object is activated when 'released' */ |
597 | #define FLAG_IS_WATER 107 |
588 | #define FLAG_IS_WATER 107 |
598 | #define FLAG_CONTENT_ON_GEN 108 |
589 | #define FLAG_CONTENT_ON_GEN 108 |
599 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated*/ |
590 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated*/ |
… | |
… | |
699 | #define EXIT_ALT_X(xyz) (xyz)->stats.maxhp |
690 | #define EXIT_ALT_X(xyz) (xyz)->stats.maxhp |
700 | #define EXIT_ALT_Y(xyz) (xyz)->stats.maxsp |
691 | #define EXIT_ALT_Y(xyz) (xyz)->stats.maxsp |
701 | |
692 | |
702 | /* for use by the lighting code */ |
693 | /* for use by the lighting code */ |
703 | #define MAX_LIGHT_RADII 4 /* max radii for 'light' object, really |
694 | #define MAX_LIGHT_RADII 4 /* max radii for 'light' object, really |
704 | * large values allow objects that can |
695 | * large values allow objects that can |
705 | * slow down the game */ |
696 | * slow down the game */ |
706 | #define MAX_DARKNESS 5 /* maximum map darkness, there is no |
697 | #define MAX_DARKNESS 5 /* maximum map darkness, there is no |
707 | * practical reason to exceed this */ |
698 | * practical reason to exceed this */ |
708 | #define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII? \ |
699 | #define BRIGHTNESS(xyz) (xyz)->glow_radius>MAX_LIGHT_RADII? \ |
709 | MAX_LIGHT_RADII:(xyz)->glow_radius; |
700 | MAX_LIGHT_RADII:(xyz)->glow_radius; |
710 | |
701 | |
711 | #define F_BUY 0 |
702 | #define F_BUY 0 |
712 | #define F_SELL 1 |
703 | #define F_SELL 1 |
713 | #define F_TRUE 2 /* True value of item, unadjusted */ |
704 | #define F_TRUE 2 /* True value of item, unadjusted */ |
714 | #define F_NO_BARGAIN 4 /* combine with F_BUY or F_SELL to disable bargaining calc */ |
705 | #define F_NO_BARGAIN 4 /* combine with F_BUY or F_SELL to disable bargaining calc */ |
… | |
… | |
919 | |
910 | |
920 | /* Optional flags, for bitwise or with a basic flag */ |
911 | /* Optional flags, for bitwise or with a basic flag */ |
921 | AP_NO_MERGE = 16, |
912 | AP_NO_MERGE = 16, |
922 | AP_IGNORE_CURSE = 32, |
913 | AP_IGNORE_CURSE = 32, |
923 | AP_PRINT = 64 /* Print what to do, don't actually do it */ |
914 | AP_PRINT = 64 /* Print what to do, don't actually do it */ |
924 | /* Note this is supported in all the functions */ |
915 | /* Note this is supported in all the functions */ |
925 | |
916 | |
926 | }; |
917 | }; |
927 | |
918 | |
928 | /* Bitmask values for 'can_apply_object()' return values. |
919 | /* Bitmask values for 'can_apply_object()' return values. |
929 | * the CAN_APPLY_ prefix is to just note what function the |
920 | * the CAN_APPLY_ prefix is to just note what function the |