… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * 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, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /* placing treasure in maps, where appropriate. */ |
25 | /* placing treasure in maps, where appropriate. */ |
… | |
… | |
52 | |
53 | |
53 | static object * |
54 | static object * |
54 | gen_key (const shstr &keycode) |
55 | gen_key (const shstr &keycode) |
55 | { |
56 | { |
56 | /* get a key and set its keycode */ |
57 | /* get a key and set its keycode */ |
57 | object *key = archetype::get (shstr_key2); |
58 | object *key = archetype::get (shstr_key_random_map); |
58 | |
|
|
59 | key->slaying = keycode; |
59 | key->slaying = keycode; |
60 | key->stats.food = 100; |
|
|
61 | key->speed_left = -1.f; |
|
|
62 | key->flag [FLAG_IS_USED_UP] = true; |
|
|
63 | key->set_speed (1.f / 300.f); |
|
|
64 | |
|
|
65 | return key; |
60 | return key; |
66 | } |
61 | } |
67 | |
62 | |
68 | /* places keys in the map, preferably in something alive. |
63 | /* places keys in the map, preferably in something alive. |
69 | keycode is the key's code, |
64 | keycode is the key's code, |
… | |
… | |
675 | } |
670 | } |
676 | |
671 | |
677 | void |
672 | void |
678 | remove_monsters (int x, int y, maptile *map) |
673 | remove_monsters (int x, int y, maptile *map) |
679 | { |
674 | { |
680 | object *tmp; |
|
|
681 | |
|
|
682 | for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) |
675 | for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) |
683 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
|
|
684 | { |
676 | { |
685 | if (tmp->head) |
677 | object *next = tmp->above; |
686 | tmp = tmp->head; |
678 | |
687 | tmp->remove (); |
679 | if (tmp->flag [FLAG_ALIVE]) |
688 | tmp->destroy (); |
680 | tmp->head_ ()->destroy (); |
689 | tmp = GET_MAP_OB (map, x, y); |
681 | |
690 | if (tmp == NULL) |
682 | tmp = next; |
691 | break; |
|
|
692 | }; |
683 | } |
693 | } |
684 | } |
694 | |
685 | |
695 | /* surrounds the point x,y by doors, so as to enclose something, like |
686 | /* surrounds the point x,y by doors, so as to enclose something, like |
696 | a chest. It only goes as far as the 8 squares surrounding, and |
687 | a chest. It only goes as far as the 8 squares surrounding, and |
697 | it'll remove any monsters it finds.*/ |
688 | it'll remove any monsters it finds.*/ |
… | |
… | |
826 | |
817 | |
827 | /* lock the doors and hide the keys. */ |
818 | /* lock the doors and hide the keys. */ |
828 | |
819 | |
829 | if (opts & DOORED) |
820 | if (opts & DOORED) |
830 | { |
821 | { |
831 | for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) |
822 | for (i = 0, door = doorlist[0]; doorlist[i]; i++) |
832 | { |
823 | { |
833 | object *new_door = get_archetype ("locked_door1"); |
824 | object *new_door = get_archetype (shstr_locked_door1); |
834 | |
825 | |
835 | door = doorlist[i]; |
826 | door = doorlist[i]; |
836 | new_door->face = door->face; |
827 | new_door->face = door->face; |
837 | new_door->x = door->x; |
828 | new_door->x = door->x; |
838 | new_door->y = door->y; |
829 | new_door->y = door->y; |
839 | door->remove (); |
|
|
840 | door->destroy (); |
830 | door->destroy (); |
841 | doorlist[i] = new_door; |
831 | doorlist[i] = new_door; |
842 | insert_ob_in_map (new_door, map, NULL, 0); |
832 | insert_ob_in_map (new_door, map, NULL, 0); |
843 | new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); |
833 | new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); |
844 | keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); |
834 | keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); |
… | |
… | |
861 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
851 | retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); |
862 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
852 | retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); |
863 | |
853 | |
864 | door->face = wallface->face; |
854 | door->face = wallface->face; |
865 | |
855 | |
866 | if (!QUERY_FLAG (wallface, FLAG_REMOVED)) |
|
|
867 | wallface->remove (); |
|
|
868 | |
|
|
869 | wallface->destroy (); |
856 | wallface->destroy (); |
870 | } |
857 | } |
871 | } |
858 | } |
872 | } |
859 | } |
873 | } |
860 | } |