1 | |
|
|
2 | /* |
1 | /* |
3 | CrossFire, A Multiplayer game for X-windows |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
4 | |
3 | * |
5 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
6 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
7 | Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
8 | |
7 | * |
9 | This program is free software; you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
10 | 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 |
11 | the Free Software Foundation; either version 2 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
12 | (at your option) any later version. |
11 | * option) any later version. |
13 | |
12 | * |
14 | 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, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
18 | |
17 | * |
19 | 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 |
20 | along with this program; if not, write to the Free Software |
19 | * and the GNU General Public License along with this program. If not, see |
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * <http://www.gnu.org/licenses/>. |
22 | |
21 | * |
23 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
24 | */ |
23 | */ |
25 | |
24 | |
26 | #define LO_NEWFILE 2 |
25 | #define LO_NEWFILE 2 |
27 | |
26 | |
28 | /* the main routine for making a standalone version. */ |
27 | /* the main routine for making a standalone version. */ |
29 | |
28 | |
… | |
… | |
46 | if (argc < 3) |
45 | if (argc < 3) |
47 | { |
46 | { |
48 | printf ("\nUsage: %s inputfile outputfile\n", argv[0]); |
47 | printf ("\nUsage: %s inputfile outputfile\n", argv[0]); |
49 | exit (0); |
48 | exit (0); |
50 | } |
49 | } |
|
|
50 | |
51 | strcpy (InFileName, argv[1]); |
51 | strcpy (InFileName, argv[1]); |
52 | strcpy (OutFileName, argv[2]); |
52 | strcpy (OutFileName, argv[2]); |
53 | |
53 | |
54 | init_globals (); |
54 | init_globals (); |
55 | init_library (); |
55 | init_library (); |
… | |
… | |
79 | { |
79 | { |
80 | } /* doesn't need to do anything */ |
80 | } /* doesn't need to do anything */ |
81 | |
81 | |
82 | #include <global.h> |
82 | #include <global.h> |
83 | |
83 | |
84 | |
|
|
85 | /* some plagarized code from apply.c--I needed just these two functions |
84 | /* some plagarized code from apply.c--I needed just these two functions |
86 | without all the rest of the junk, so.... */ |
85 | without all the rest of the junk, so.... */ |
87 | int |
86 | int |
88 | auto_apply (object *op) |
87 | auto_apply (object *op) |
89 | { |
88 | { |
… | |
… | |
96 | if (!op->has_random_items ()) |
95 | if (!op->has_random_items ()) |
97 | return 0; |
96 | return 0; |
98 | do |
97 | do |
99 | { |
98 | { |
100 | i = 10; /* let's give it 10 tries */ |
99 | i = 10; /* let's give it 10 tries */ |
|
|
100 | |
101 | while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i); |
101 | while (!(tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) |
|
|
102 | && --i) |
|
|
103 | ; |
|
|
104 | |
102 | if (tmp == NULL) |
105 | if (tmp == NULL) |
103 | return 0; |
106 | return 0; |
|
|
107 | |
104 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
108 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
105 | { |
109 | { |
106 | tmp->destroy (); |
110 | tmp->destroy (); |
107 | tmp = NULL; |
111 | tmp = NULL; |
108 | } |
112 | } |
… | |
… | |
119 | case TREASURE: |
123 | case TREASURE: |
120 | if (op->has_random_items ()) |
124 | if (op->has_random_items ()) |
121 | while ((op->stats.hp--) > 0) |
125 | while ((op->stats.hp--) > 0) |
122 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
126 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
123 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
127 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
124 | op->remove (); |
128 | |
125 | op->destroy (); |
129 | op->destroy (); |
126 | break; |
130 | break; |
127 | } |
131 | } |
128 | |
132 | |
129 | return tmp ? 1 : 0; |
133 | return tmp ? 1 : 0; |
… | |
… | |
132 | /* fix_auto_apply goes through the entire map (only the first time |
136 | /* fix_auto_apply goes through the entire map (only the first time |
133 | * when an original map is loaded) and performs special actions for |
137 | * when an original map is loaded) and performs special actions for |
134 | * certain objects (most initialization of chests and creation of |
138 | * certain objects (most initialization of chests and creation of |
135 | * treasures and stuff). Calls auto_apply if appropriate. |
139 | * treasures and stuff). Calls auto_apply if appropriate. |
136 | */ |
140 | */ |
137 | |
|
|
138 | void |
141 | void |
139 | fix_auto_apply (maptile *m) |
142 | fix_auto_apply (maptile *m) |
140 | { |
143 | { |
141 | object *tmp, *above = NULL; |
144 | object *tmp, *above = NULL; |
142 | int x, y; |
145 | int x, y; |
… | |
… | |
169 | } |
172 | } |
170 | for (x = 0; x < m->width; x++) |
173 | for (x = 0; x < m->width; x++) |
171 | for (y = 0; y < m->height; y++) |
174 | for (y = 0; y < m->height; y++) |
172 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
175 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
173 | if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) |
176 | if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) |
174 | check_trigger (tmp, tmp->above); |
177 | check_trigger (tmp, tmp->above, tmp->above); |
175 | } |
178 | } |
176 | |
179 | |
177 | /** |
180 | /** |
178 | * Those are dummy functions defined to resolve all symboles. |
181 | * Those are dummy functions defined to resolve all symboles. |
179 | * Added as part of glue cleaning. |
182 | * Added as part of glue cleaning. |
… | |
… | |
275 | |
278 | |
276 | void |
279 | void |
277 | trap_adjust (object *ob, int x) |
280 | trap_adjust (object *ob, int x) |
278 | { |
281 | { |
279 | } |
282 | } |
|
|
283 | |