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 (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * 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 |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * 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 |
9 | * 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 |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * 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 Affero GNU General Public License |
18 | * 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 |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
20 | * <http://www.gnu.org/licenses/>. |
21 | * |
21 | * |
22 | * 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> |
23 | */ |
23 | */ |
|
|
24 | |
24 | #ifndef PLAYER_H_ |
25 | #ifndef PLAYER_H_ |
25 | #define PLAYER_H_ |
26 | #define PLAYER_H_ |
26 | |
27 | |
27 | //+GPL |
28 | //+GPL |
28 | |
29 | |
… | |
… | |
130 | bool ACC (RW, dirty); // set if player is dirty (not reliable yet!) |
131 | bool ACC (RW, dirty); // set if player is dirty (not reliable yet!) |
131 | |
132 | |
132 | float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */ |
133 | float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */ |
133 | float ACC (RW, weapon_sp_left); // same as speed_left, but for attacks |
134 | float ACC (RW, weapon_sp_left); // same as speed_left, but for attacks |
134 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
135 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
135 | object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ |
136 | object_ptr last_skill_ob[CS_NUM_SKILLS]; /* the exp object */ |
136 | object_ptr ACC (RW, last_used); /* Pointer to object last picked or applied */ |
137 | object_ptr ACC (RW, last_used); /* Pointer to object last picked or applied */ |
137 | |
138 | |
138 | object_ptr ACC (RW, combat_ob); // which weapon/bow/skill to use for direct attacks |
139 | object_ptr ACC (RW, combat_ob); // which weapon/bow/skill to use for direct attacks |
139 | object_ptr ACC (RW, ranged_ob); // which skill/item/spell to use for ranged attacks |
140 | object_ptr ACC (RW, ranged_ob); // which skill/item/spell to use for ranged attacks |
140 | object_ptr ACC (RW, golem); // the currently controlled golem |
141 | object_ptr ACC (RW, golem); // the currently controlled golem |
… | |
… | |
154 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
155 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
155 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
156 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
156 | |
157 | |
157 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
158 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
158 | |
159 | |
159 | float speed_left_save; // spee doptimisation, see process_players[12] |
160 | float speed_left_save; // speed optimisation, see process_players[12] |
160 | char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */ |
161 | char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */ |
161 | char ACC (RW, password)[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ |
162 | char ACC (RW, password)[256]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ |
162 | |
163 | |
163 | partylist *ACC (RW, party); /* Party this player is part of */ |
164 | partylist *ACC (RW, party); /* Party this player is part of */ |
164 | partylist *ACC (RW, party_to_join); /* used when player wants to join a party */ |
165 | partylist *ACC (RW, party_to_join); /* used when player wants to join a party */ |
165 | /* but we will have to get password first */ |
166 | /* but we will have to get password first */ |
166 | /* so we have to remember which party to */ |
167 | /* so we have to remember which party to */ |
… | |
… | |
189 | { |
190 | { |
190 | if (delayed_update) |
191 | if (delayed_update) |
191 | ob->update_stats (); |
192 | ob->update_stats (); |
192 | } |
193 | } |
193 | |
194 | |
|
|
195 | #if 0 |
|
|
196 | enum { |
|
|
197 | SA_SPELLS = 1<<0, |
|
|
198 | SA_EXP = 1<<1, |
|
|
199 | }; |
|
|
200 | |
|
|
201 | uint8 ACxC (RW, stat_update_flags); |
|
|
202 | |
|
|
203 | void need_stat_update (int flags) |
|
|
204 | { |
|
|
205 | stat_update_flags |= flags; |
|
|
206 | } |
|
|
207 | #endif |
|
|
208 | |
194 | // return the los value for the given coordinate |
209 | // return the los value for the given coordinate |
195 | MTH sint8 blocked_los (int dx, int dy) const |
210 | MTH sint8 blocked_los (int dx, int dy) const |
196 | { |
211 | { |
197 | dx += LOS_X0; |
212 | dx += LOS_X0; |
198 | dy += LOS_Y0; |
213 | dy += LOS_Y0; |
… | |
… | |
229 | |
244 | |
230 | void do_destroy (); |
245 | void do_destroy (); |
231 | void gather_callbacks (AV *&callbacks, event_type event) const; |
246 | void gather_callbacks (AV *&callbacks, event_type event) const; |
232 | |
247 | |
233 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
248 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
|
|
249 | static dynbuf_text *expand_cfpod (int hintmode, int gender, const_utf8_string cfpod); |
234 | |
250 | |
235 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
251 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
236 | |
252 | |
237 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
253 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
238 | { |
254 | { |
… | |
… | |
272 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
288 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
273 | |
289 | |
274 | // a prominent box that signifies some error such as a failed |
290 | // a prominent box that signifies some error such as a failed |
275 | // improvement potion. should not be long. |
291 | // improvement potion. should not be long. |
276 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
292 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
|
|
293 | void failmsgf (const_utf8_string format, ...); // always NDI_RED |
277 | |
294 | |
278 | MTH void update_spells () const |
295 | MTH void update_spells () const |
279 | { |
296 | { |
280 | if (ns) |
297 | if (ns) |
281 | ns->update_spells = true; |
298 | ns->update_spells = true; |