1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game for X-windows |
3 | |
3 | * |
|
|
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | Copyright (C) 2003-2005 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2003-2005 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | |
7 | * |
7 | This program is free software; you can redistribute it and/or modify |
8 | * This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | * the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. |
11 | * (at your option) any later version. |
11 | |
12 | * |
12 | This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
16 | |
17 | * |
17 | You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
19 | * along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
21 | * |
21 | The authors can be reached via e-mail at crossfire@schmorp.de |
22 | * The authors can be reached via e-mail at crossfire@schmorp.de |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /* This file is best viewed with a window width of about 100 character */ |
25 | /* This file is best viewed with a window width of about 100 character */ |
25 | |
26 | |
26 | /* This file is really too large. With all the .h files |
27 | /* This file is really too large. With all the .h files |
27 | * around, this file should be better split between them - things |
28 | * around, this file should be better split between them - things |
… | |
… | |
421 | * If any FLAG's are added or changed, make sure the flag_names structure in |
422 | * If any FLAG's are added or changed, make sure the flag_names structure in |
422 | * common/loader.l is updated. |
423 | * common/loader.l is updated. |
423 | */ |
424 | */ |
424 | |
425 | |
425 | /* Basic routines to do above */ |
426 | /* Basic routines to do above */ |
426 | #define SET_FLAG(obj, flag) (obj)->flags[flag] = 1 |
427 | #define SET_FLAG(obj, flg) (obj)->flag [flg] = 1 |
427 | #define CLEAR_FLAG(obj, flag) (obj)->flags[flag] = 0 |
428 | #define CLEAR_FLAG(obj, flg) (obj)->flag [flg] = 0 |
428 | #define QUERY_FLAG(obj, flag) (obj)->flags[flag] |
429 | #define QUERY_FLAG(obj, flg) (obj)->flag [flg] |
429 | |
430 | |
430 | /* the flags */ |
431 | /* the flags */ |
431 | |
432 | |
432 | #define FLAG_ALIVE 0 /* Object can fight (or be fought) */ |
433 | #define FLAG_ALIVE 0 /* Object can fight (or be fought) */ |
433 | #define FLAG_WIZ 1 /* Object has special privilegies */ |
434 | #define FLAG_WIZ 1 /* Object has special privilegies */ |
… | |
… | |
580 | object */ |
581 | object */ |
581 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
582 | #define FLAG_NEUTRAL 100 /* monster is from type neutral */ |
582 | #define FLAG_NO_ATTACK 101 /* monster don't attack */ |
583 | #define FLAG_NO_ATTACK 101 /* monster don't attack */ |
583 | #define FLAG_NO_DAMAGE 102 /* monster can't be damaged */ |
584 | #define FLAG_NO_DAMAGE 102 /* monster can't be damaged */ |
584 | #define FLAG_OBJ_ORIGINAL 103 /* NEVER SET THIS. Item was loaded by |
585 | #define FLAG_OBJ_ORIGINAL 103 /* NEVER SET THIS. Item was loaded by |
585 | * load_original_map() */ |
586 | * load_original_map() */ |
586 | #define FLAG_OBJ_SAVE_ON_OVL 104 /* this object should be saved on |
587 | #define FLAG_OBJ_SAVE_ON_OVL 104 /* this object should be saved on |
587 | * the overlay, and is not subject to |
588 | * the overlay, and is not subject to |
588 | * decay. */ |
589 | * decay. */ |
589 | #define FLAG_ACTIVATE_ON_PUSH 105 /* connected object is activated when 'pushed' */ |
590 | #define FLAG_ACTIVATE_ON_PUSH 105 /* connected object is activated when 'pushed' */ |
590 | #define FLAG_ACTIVATE_ON_RELEASE 106 /* connected object is activated when 'released' */ |
591 | #define FLAG_ACTIVATE_ON_RELEASE 106 /* connected object is activated when 'released' */ |
591 | #define FLAG_IS_WATER 107 |
592 | #define FLAG_IS_WATER 107 |
592 | #define FLAG_CONTENT_ON_GEN 108 |
593 | #define FLAG_CONTENT_ON_GEN 108 |
593 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated */ |
594 | #define FLAG_IS_A_TEMPLATE 109 /* Object has no ingame life until instanciated */ |
594 | #define FLAG_IS_BUILDABLE 110 /* Can build on item */ |
595 | #define FLAG_IS_BUILDABLE 110 /* Can build on item */ |
595 | #define FLAG_AFK 111 /* Player is AFK */ |
596 | #define FLAG_DESTROY_ON_DEATH 111 /* Object will be destroyed when env dies */ |
|
|
597 | #define FLAG_NO_SAVE 112 // item doesn't get saved with map |
|
|
598 | |
596 | #define NUM_FLAGS 111 /* Should always be equal to the last |
599 | #define NUM_FLAGS 113 /* Should always be equal to the last |
597 | * defined flag. If you change this, |
600 | * defined flag + 1. If you change this, |
598 | * make sure you update the flag_links |
601 | * make sure you update the flag_links |
599 | * in common/loader.l |
602 | * in common/loader.l |
600 | */ |
603 | */ |
601 | |
604 | |
602 | /* Values can go up to 127 before the size of the flags array in the |
605 | /* Values can go up to 127 before the size of the flags array in the |
603 | * object structure needs to be enlarged. |
606 | * object structure needs to be enlarged. |
604 | * So there are 18 available flags slots |
607 | * So there are 18 available flags slots |
605 | */ |
608 | */ |
… | |
… | |
657 | * Add check - if type is 0, don't stop anything from moving |
660 | * Add check - if type is 0, don't stop anything from moving |
658 | * onto it. |
661 | * onto it. |
659 | * |
662 | * |
660 | */ |
663 | */ |
661 | #define OB_TYPE_MOVE_BLOCK(ob1, type) \ |
664 | #define OB_TYPE_MOVE_BLOCK(ob1, type) \ |
662 | ( (type != 0) && (ob1->move_type & type) == ob1->move_type) |
665 | ((type) && (ob1->move_type & type) == ob1->move_type) |
663 | |
666 | |
664 | |
667 | |
665 | #define SET_GENERATE_TYPE(xyz,va) (xyz)->stats.sp=(va) |
668 | #define SET_GENERATE_TYPE(xyz,va) (xyz)->stats.sp=(va) |
666 | #define GENERATE_TYPE(xyz) ((xyz)->stats.sp) |
669 | #define GENERATE_TYPE(xyz) ((xyz)->stats.sp) |
667 | #define GENERATE_SPEED(xyz) ((xyz)->stats.maxsp) /* if(!RANDOM()%<speed>) */ |
670 | #define GENERATE_SPEED(xyz) ((xyz)->stats.maxsp) /* if(!RANDOM()%<speed>) */ |
… | |
… | |
809 | /* changing directions */ |
812 | /* changing directions */ |
810 | /* this is VERTICAL movement */ |
813 | /* this is VERTICAL movement */ |
811 | #define LO4 15 /* bitmasks for upper and lower 4 bits from 8 bit fields */ |
814 | #define LO4 15 /* bitmasks for upper and lower 4 bits from 8 bit fields */ |
812 | #define HI4 240 |
815 | #define HI4 240 |
813 | |
816 | |
814 | /* |
|
|
815 | * Use of the state-variable in player objects: |
|
|
816 | */ |
|
|
817 | |
|
|
818 | #define ST_PLAYING 0 |
|
|
819 | #define ST_PLAY_AGAIN 1 |
|
|
820 | #define ST_ROLL_STAT 2 |
|
|
821 | #define ST_CHANGE_CLASS 3 |
|
|
822 | #define ST_CONFIRM_QUIT 4 |
|
|
823 | #define ST_CONFIGURE 5 |
|
|
824 | #define ST_GET_NAME 6 |
|
|
825 | #define ST_GET_PASSWORD 7 |
|
|
826 | #define ST_CONFIRM_PASSWORD 8 |
|
|
827 | #define ST_GET_PARTY_PASSWORD 10 |
|
|
828 | |
|
|
829 | #define BLANK_FACE_NAME "blank.111" |
817 | #define BLANK_FACE_NAME "blank.x11" |
830 | #define EMPTY_FACE_NAME "empty.111" |
818 | #define EMPTY_FACE_NAME "empty.x11" |
831 | #define DARK_FACE1_NAME "dark1.111" |
819 | #define DARK_FACE1_NAME "dark1.x11" |
832 | #define DARK_FACE2_NAME "dark2.111" |
820 | #define DARK_FACE2_NAME "dark2.x11" |
833 | #define DARK_FACE3_NAME "dark3.111" |
821 | #define DARK_FACE3_NAME "dark3.x11" |
834 | #define SMOOTH_FACE_NAME "default_smoothed.111" |
822 | #define SMOOTH_FACE_NAME "default_smoothed.111" |
835 | |
823 | |
836 | /* |
824 | /* |
837 | * Defines for the luck/random functions to make things more readable |
825 | * Defines for the luck/random functions to make things more readable |
838 | */ |
826 | */ |
… | |
… | |
977 | #define CAN_APPLY_UNAPPLY 0x10 |
965 | #define CAN_APPLY_UNAPPLY 0x10 |
978 | #define CAN_APPLY_UNAPPLY_MULT 0x20 |
966 | #define CAN_APPLY_UNAPPLY_MULT 0x20 |
979 | #define CAN_APPLY_UNAPPLY_CHOICE 0x40 |
967 | #define CAN_APPLY_UNAPPLY_CHOICE 0x40 |
980 | |
968 | |
981 | /* Cut off point of when an object is put on the active list or not */ |
969 | /* Cut off point of when an object is put on the active list or not */ |
982 | #define MIN_ACTIVE_SPEED 0.00001 |
970 | #define MIN_ACTIVE_SPEED 1e-5 |
983 | |
971 | |
984 | /* |
972 | /* |
985 | * random() is much better than rand(). If you have random(), use it instead. |
973 | * random() is much better than rand(). If you have random(), use it instead. |
986 | * You shouldn't need to change any of this |
974 | * You shouldn't need to change any of this |
987 | * |
975 | * |