1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
12 | * option) any later version. |
12 | * |
13 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * GNU General Public License for more details. |
17 | * |
18 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
21 | * <http://www.gnu.org/licenses/>. |
21 | * |
22 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
24 | */ |
24 | |
25 | |
25 | #ifndef LIBPROTO_H_ |
26 | #ifndef LIBPROTO_H_ |
26 | #define LIBPROTO_H_ |
27 | #define LIBPROTO_H_ |
27 | |
|
|
28 | void load_materials (); |
|
|
29 | |
28 | |
30 | /* anim.c */ |
29 | /* anim.c */ |
31 | void free_all_anim (); |
30 | void free_all_anim (); |
32 | void init_anim (); |
31 | void init_anim (); |
33 | int find_animation (const char *name); |
|
|
34 | void animate_object (object *op, int dir); |
32 | void animate_object (object *op, int dir); |
35 | /* arch.c */ |
33 | /* arch.c */ |
36 | archetype *find_archetype_by_object_name (const char *name); |
34 | archetype *find_archetype_by_object_name (const char *name); |
37 | archetype *find_archetype_by_object_type_name (int type, const char *name); |
35 | archetype *find_archetype_by_object_type_name (int type, const char *name); |
38 | object *get_archetype_by_skill_name (const char *skill, int type); |
36 | object *get_archetype_by_skill_name (const char *skill, int type); |
… | |
… | |
45 | void dump_arch (archetype *at); |
43 | void dump_arch (archetype *at); |
46 | void dump_all_archetypes (); |
44 | void dump_all_archetypes (); |
47 | void free_all_archs (); |
45 | void free_all_archs (); |
48 | void check_generators (); |
46 | void check_generators (); |
49 | bool load_archetype_file (const char *filename); |
47 | bool load_archetype_file (const char *filename); |
50 | object *get_archetype (const char *name); |
|
|
51 | unsigned long hasharch (const char *str, int tablesize); |
48 | unsigned long hasharch (const char *str, int tablesize); |
52 | object *clone_arch (int type); |
49 | object *clone_arch (int type); |
53 | object *object_create_arch (archetype *at); |
50 | object *object_create_arch (archetype *at); |
54 | /* button.c */ |
51 | /* button.c */ |
55 | void push_button (object *op, object *originator); |
52 | void push_button (object *op, object *originator); |
… | |
… | |
63 | void do_mood_floor (object *op, object *source = 0); |
60 | void do_mood_floor (object *op, object *source = 0); |
64 | object *check_inv_recursive (object *op, const object *trig); |
61 | object *check_inv_recursive (object *op, const object *trig); |
65 | void check_inv (object *op, object *trig); |
62 | void check_inv (object *op, object *trig); |
66 | void verify_button_links (const maptile *map); |
63 | void verify_button_links (const maptile *map); |
67 | /* exp.c */ |
64 | /* exp.c */ |
|
|
65 | int exp_to_level (sint64 exp); |
|
|
66 | sint64 level_to_min_exp (int level); |
68 | int new_exp (const object *ob); |
67 | int new_exp (const object *ob); |
69 | void init_experience (); |
68 | void _reload_exp_table (); |
70 | void dump_experience (); |
|
|
71 | /* friend.c */ |
69 | /* friend.c */ |
72 | void add_friendly_object (object *op); |
70 | void add_friendly_object (object *op); |
73 | void remove_friendly_object (object *op); |
71 | void remove_friendly_object (object *op); |
74 | void dump_friendly_objects (); |
72 | void dump_friendly_objects (); |
75 | void clean_friendly_list (); |
73 | void clean_friendly_list (); |
76 | /* glue.c */ |
|
|
77 | void fatal (int err); |
|
|
78 | /* holy.c */ |
74 | /* holy.c */ |
79 | void init_gods (); |
75 | void init_gods (); |
80 | godlink *get_rand_god (); |
76 | godlink *get_rand_god (); |
81 | object *pntr_to_god_obj (godlink *godlnk); |
77 | object *pntr_to_god_obj (godlink *godlnk); |
82 | void dump_gods (); |
78 | void dump_gods (); |
… | |
… | |
103 | int get_power_from_ench (int ench); |
99 | int get_power_from_ench (int ench); |
104 | int calc_item_power (const object *op, int flag); |
100 | int calc_item_power (const object *op, int flag); |
105 | const typedata *get_typedata (int itemtype); |
101 | const typedata *get_typedata (int itemtype); |
106 | const typedata *get_typedata_by_name (const char *name); |
102 | const typedata *get_typedata_by_name (const char *name); |
107 | const char *describe_resistance (const object *op, int newline); |
103 | const char *describe_resistance (const object *op, int newline); |
108 | const char *get_levelnumber (int i); |
104 | const char *ordinal (int i); |
109 | const char *describe_item (const object *op, object *owner); |
105 | const char *describe_item (const object *op, object *owner); |
110 | int is_magical (const object *op); |
106 | int is_magical (const object *op); |
111 | int need_identify (const object *op); |
|
|
112 | void identify (object *op); |
107 | void identify (object *op); |
113 | void examine (object *op, object *tmp); |
108 | void examine (object *op, object *tmp); |
114 | /* links.c */ |
109 | /* links.c */ |
115 | objectlink *get_objectlink (); |
110 | objectlink *get_objectlink (); |
116 | oblinkpt *get_objectlinkpt (); |
111 | oblinkpt *get_objectlinkpt (); |
… | |
… | |
118 | void free_objectlinkpt (oblinkpt *obp); |
113 | void free_objectlinkpt (oblinkpt *obp); |
119 | /* living.c */ |
114 | /* living.c */ |
120 | void change_attr_value (living *stats, int attr, sint8 value); |
115 | void change_attr_value (living *stats, int attr, sint8 value); |
121 | void check_stat_bounds (living *stats); |
116 | void check_stat_bounds (living *stats); |
122 | int change_abil (object *op, object *tmp); |
117 | int change_abil (object *op, object *tmp); |
123 | int allowed_class (const object *op); |
|
|
124 | void set_dragon_name (object *pl, const object *abil, const object *skin); |
118 | void set_dragon_name (object *pl, const object *abil, const object *skin); |
125 | object *give_skill_by_name (object *op, const char *skill_name); |
119 | object *give_skill_by_name (object *op, const char *skill_name); |
126 | void player_lvl_adj (object *who, object *op); |
120 | void player_lvl_adj (object *who, object *op); |
127 | sint64 level_exp (int level, double expmul); |
121 | sint64 level_exp (int level, double expmul); |
128 | void calc_perm_exp (object *op); |
122 | void calc_perm_exp (object *op); |
129 | sint64 check_exp_adjust (const object *op, sint64 exp); |
123 | sint64 check_exp_adjust (const object *op, sint64 exp); |
130 | void change_exp (object *op, sint64 exp, const char *skill_name, int flag); |
124 | void change_exp (object *op, sint64 exp, shstr_tmp skill_name, int flag); |
131 | void apply_death_exp_penalty (object *op); |
125 | void apply_death_exp_penalty (object *op); |
132 | int did_make_save (const object *op, int level, int bonus); |
126 | int did_make_save (const object *op, int level, int bonus); |
133 | /* los.c */ |
127 | /* los.c */ |
134 | void init_block (); |
128 | void init_block (); |
135 | void update_all_map_los (maptile *map); |
129 | void update_all_map_los (maptile *map); |
… | |
… | |
141 | int blocked_link (object *ob, maptile *m, int sx, int sy); |
135 | int blocked_link (object *ob, maptile *m, int sx, int sy); |
142 | /* object.c */ |
136 | /* object.c */ |
143 | char *dump_object (object *op); |
137 | char *dump_object (object *op); |
144 | void dump_me (object *op, char *outstr); |
138 | void dump_me (object *op, char *outstr); |
145 | object *find_object (tag_t i); |
139 | object *find_object (tag_t i); |
|
|
140 | object *find_object_uuid (UUID i); |
146 | object *find_object_name (const char *str); |
141 | object *find_object_name (const char *str); |
147 | void free_all_object_data (); |
142 | void free_all_object_data (); |
148 | void update_turn_face (object *op); |
143 | void update_turn_face (object *op); |
149 | void update_object (object *op, int action); |
144 | void update_object (object *op, int action); |
150 | object *merge_ob (object *op, object *top); |
145 | object *merge_ob (object *op, object *top); |
151 | object *insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y); |
146 | object *insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y); |
152 | object *insert_ob_in_map (object *op, maptile *m, object *originator, int flag); |
147 | object *insert_ob_in_map (object *op, maptile *m, object *originator, int flag); |
153 | void replace_insert_ob_in_map (shstr_tmp archname, object *op); |
148 | void replace_insert_ob_in_map (shstr_tmp archname, object *op); |
154 | object *insert_ob_in_ob (object *op, object *where); |
149 | object *insert_ob_in_ob (object *op, object *where); |
155 | int check_move_on (object *op, object *originator); |
150 | int check_move_on (object *op, object *originator, int flags = 0); |
156 | object *present_arch (const archetype *at, maptile *m, int x, int y); |
151 | object *present_arch (const archetype *at, maptile *m, int x, int y); |
157 | object *present (unsigned char type, maptile *m, int x, int y); |
152 | object *present (unsigned char type, maptile *m, int x, int y); |
158 | object *present_in_ob (unsigned char type, const object *op); |
153 | object *present_in_ob (unsigned char type, const object *op); |
159 | object *present_in_ob_by_name (int type, const char *str, const object *op); |
154 | object *present_in_ob_by_name (int type, const char *str, const object *op); |
160 | object *present_arch_in_ob (const archetype *at, const object *op); |
155 | object *present_arch_in_ob (const archetype *at, const object *op); |
… | |
… | |
171 | int can_pick (const object *who, const object *item); |
166 | int can_pick (const object *who, const object *item); |
172 | object *find_obj_by_type_subtype (const object *who, int type, int subtype); |
167 | object *find_obj_by_type_subtype (const object *who, int type, int subtype); |
173 | /* path.c */ |
168 | /* path.c */ |
174 | char *path_combine (const char *src, const char *dst); |
169 | char *path_combine (const char *src, const char *dst); |
175 | char *path_combine_and_normalize (const char *src, const char *dst); |
170 | char *path_combine_and_normalize (const char *src, const char *dst); |
176 | /* porting.c */ |
|
|
177 | void remove_directory (const char *path); |
|
|
178 | char *ltostr10 (signed long n); |
|
|
179 | char *doubletostr10 (double v); |
|
|
180 | FILE *open_and_uncompress (const char *name, int flag, int *compressed); |
|
|
181 | void close_and_delete (FILE *fp, int compressed); |
|
|
182 | void make_path_to_file (char *filename); |
|
|
183 | /* player.c */ |
171 | /* player.c */ |
184 | void free_player (player *pl); |
172 | void free_player (player *pl); |
185 | int atnr_is_dragon_enabled (int attacknr); |
173 | int atnr_is_dragon_enabled (int attacknr); |
186 | int is_dragon_pl (const object *op); |
|
|
187 | /* quest.c */ |
174 | /* quest.c */ |
188 | int quest_is_quest_marker (const object *marker, int task); |
175 | int quest_is_quest_marker (const object *marker, int task); |
189 | int quest_is_in_progress (const object *marker, int task); |
176 | int quest_is_in_progress (const object *marker, int task); |
190 | int quest_is_completed (const object *marker, int task); |
177 | int quest_is_completed (const object *marker, int task); |
191 | const char *quest_get_name (const object *marker); |
178 | const char *quest_get_name (const object *marker); |
… | |
… | |
235 | void add_abilities (object *op, object *change); |
222 | void add_abilities (object *op, object *change); |
236 | void give_artifact_abilities (object *op, object *artifct); |
223 | void give_artifact_abilities (object *op, object *artifct); |
237 | void generate_artifact (object *op, int difficulty); |
224 | void generate_artifact (object *op, int difficulty); |
238 | void fix_flesh_item (object *item, object *donor); |
225 | void fix_flesh_item (object *item, object *donor); |
239 | /* utils.c */ |
226 | /* utils.c */ |
240 | int random_roll (int min, int max, const object *op, int goodbad); |
227 | int random_roll (int min, int max, const object *op, bool prefer_high); |
241 | sint64 random_roll64 (sint64 min, sint64 max, const object *op, int goodbad); |
228 | sint64 random_roll64 (sint64 min, sint64 max, const object *op, bool prefer_high); |
242 | int die_roll (int num, int size, const object *op, int goodbad); |
229 | int die_roll (int num, int size, const object *op, bool prefer_high); |
243 | materialtype_t *name_to_material (const shstr_cmp name); |
|
|
244 | void transmute_materialname (object *op, const object *change); |
230 | void transmute_materialname (object *op, const object *change); |
245 | void set_materialname (object *op, int difficulty, materialtype_t *nmt); |
|
|
246 | void strip_media_tag (char *message); |
|
|
247 | void strip_endline (char *buf); |
231 | void strip_endline (char *buf); |
248 | void replace (const char *src, const char *key, const char *replacement, char *result, size_t resultsize); |
232 | void replace (const char *src, const char *key, const char *replacement, char *result, size_t resultsize); |
249 | /* loader.c */ |
233 | /* loader.c */ |
250 | int set_variable (object *op, char *buf); |
234 | int set_variable (object *op, char *buf); |
251 | void init_vars (); |
235 | void init_vars (); |
252 | char *get_ob_diff (object *op, object *op2); |
236 | char *get_ob_diff (object *op, object *op2); |
|
|
237 | bool load_resource_file_ (const char *filename); |
253 | /* map.c */ |
238 | /* map.c */ |
254 | maptile *find_style (const char *dirname, const char *stylename, int difficulty); |
239 | maptile *find_style (const char *dirname, const char *stylename, int difficulty, bool recurse = false); |
255 | object *pick_random_object (maptile *style); |
240 | object *pick_random_object (maptile *style); |
256 | |
241 | |
257 | /* former funcpoint.h */ |
242 | /* former funcpoint.h */ |
258 | /* |
243 | /* |
259 | * These function-pointers are defined in common/glue.c |
244 | * These function-pointers are defined in common/glue.c |