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,2009,2010 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 | */ |
|
|
25 | |
24 | #ifndef PLAYER_H_ |
26 | #ifndef PLAYER_H_ |
25 | #define PLAYER_H_ |
27 | #define PLAYER_H_ |
26 | |
28 | |
27 | //+GPL |
29 | //+GPL |
28 | |
30 | |
… | |
… | |
130 | bool ACC (RW, dirty); // set if player is dirty (not reliable yet!) |
132 | bool ACC (RW, dirty); // set if player is dirty (not reliable yet!) |
131 | |
133 | |
132 | float ACC (RW, weapon_sp); /* Penalties to speed when fighting w speed >ws/10 */ |
134 | 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 |
135 | float ACC (RW, weapon_sp_left); // same as speed_left, but for attacks |
134 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
136 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
135 | object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ |
137 | 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 */ |
138 | object_ptr ACC (RW, last_used); /* Pointer to object last picked or applied */ |
137 | |
139 | |
138 | object_ptr ACC (RW, combat_ob); // which weapon/bow/skill to use for direct attacks |
140 | 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 |
141 | 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 |
142 | object_ptr ACC (RW, golem); // the currently controlled golem |
… | |
… | |
154 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
156 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
155 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
157 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
156 | |
158 | |
157 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
159 | object_ptr ACC (RW, killer); /* Who last tried to kill this player (this object is usually destroyed) */ |
158 | |
160 | |
159 | float speed_left_save; // spee doptimisation, see process_players[12] |
161 | float speed_left_save; // speed optimisation, see process_players[12] |
160 | char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ /* should go */ |
162 | 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 */ |
163 | char ACC (RW, password)[256]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ |
162 | |
164 | |
163 | partylist *ACC (RW, party); /* Party this player is part of */ |
165 | 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 */ |
166 | partylist *ACC (RW, party_to_join); /* used when player wants to join a party */ |
165 | /* but we will have to get password first */ |
167 | /* but we will have to get password first */ |
166 | /* so we have to remember which party to */ |
168 | /* so we have to remember which party to */ |
… | |
… | |
189 | { |
191 | { |
190 | if (delayed_update) |
192 | if (delayed_update) |
191 | ob->update_stats (); |
193 | ob->update_stats (); |
192 | } |
194 | } |
193 | |
195 | |
|
|
196 | #if 0 |
|
|
197 | enum { |
|
|
198 | SA_SPELLS = 1<<0, |
|
|
199 | SA_EXP = 1<<1, |
|
|
200 | }; |
|
|
201 | |
|
|
202 | uint8 ACxC (RW, stat_update_flags); |
|
|
203 | |
|
|
204 | void need_stat_update (int flags) |
|
|
205 | { |
|
|
206 | stat_update_flags |= flags; |
|
|
207 | } |
|
|
208 | #endif |
|
|
209 | |
194 | // return the los value for the given coordinate |
210 | // return the los value for the given coordinate |
195 | MTH sint8 blocked_los (int dx, int dy) const |
211 | MTH sint8 blocked_los (int dx, int dy) const |
196 | { |
212 | { |
197 | dx += LOS_X0; |
213 | dx += LOS_X0; |
198 | dy += LOS_Y0; |
214 | dy += LOS_Y0; |
… | |
… | |
229 | |
245 | |
230 | void do_destroy (); |
246 | void do_destroy (); |
231 | void gather_callbacks (AV *&callbacks, event_type event) const; |
247 | void gather_callbacks (AV *&callbacks, event_type event) const; |
232 | |
248 | |
233 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
249 | MTH dynbuf_text *expand_cfpod (const_utf8_string cfpod) const; |
|
|
250 | static dynbuf_text *expand_cfpod (int hintmode, int gender, const_utf8_string cfpod); |
234 | |
251 | |
235 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
252 | MTH void touch () { dirty = true; } // need to touch when logged out and changed |
236 | |
253 | |
237 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
254 | MTH void play_sound (faceidx sound, int dx = 0, int dy = 0) const |
238 | { |
255 | { |
… | |
… | |
272 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
289 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
273 | |
290 | |
274 | // a prominent box that signifies some error such as a failed |
291 | // a prominent box that signifies some error such as a failed |
275 | // improvement potion. should not be long. |
292 | // improvement potion. should not be long. |
276 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
293 | MTH void failmsg (const_utf8_string msg, int color = NDI_RED); |
|
|
294 | void failmsgf (const_utf8_string format, ...); // always NDI_RED |
277 | |
295 | |
278 | MTH void update_spells () const |
296 | MTH void update_spells () const |
279 | { |
297 | { |
280 | if (ns) |
298 | if (ns) |
281 | ns->update_spells = true; |
299 | ns->update_spells = true; |
… | |
… | |
301 | if ((var)->ob->map == (mapp)) |
319 | if ((var)->ob->map == (mapp)) |
302 | |
320 | |
303 | inline void |
321 | inline void |
304 | object::statusmsg (const_utf8_string msg, int color) |
322 | object::statusmsg (const_utf8_string msg, int color) |
305 | { |
323 | { |
306 | if (expect_true (contr)) contr->statusmsg (msg, color); |
324 | if (ecb_expect_true (contr)) contr->statusmsg (msg, color); |
307 | } |
325 | } |
308 | |
326 | |
309 | inline void |
327 | inline void |
310 | object::failmsg (const_utf8_string msg, int color) |
328 | object::failmsg (const_utf8_string msg, int color) |
311 | { |
329 | { |
312 | if (expect_true (contr)) contr->failmsg (msg, color); |
330 | if (ecb_expect_true (contr)) contr->failmsg (msg, color); |
313 | } |
331 | } |
314 | |
332 | |
315 | #endif |
333 | #endif |
316 | |
334 | |