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 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 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 PLAYER_H_ |
26 | #ifndef PLAYER_H_ |
26 | #define PLAYER_H_ |
27 | #define PLAYER_H_ |
… | |
… | |
131 | 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!) |
132 | |
133 | |
133 | 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 */ |
134 | 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 |
135 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
136 | living ACC (RO, orig_stats); /* Permanent real stats of player */ |
136 | object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ |
137 | object_ptr last_skill_ob[CS_NUM_SKILLS]; /* the exp object */ |
137 | 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 */ |
138 | |
139 | |
139 | 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 |
140 | 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 |
141 | object_ptr ACC (RW, golem); // the currently controlled golem |
142 | object_ptr ACC (RW, golem); // the currently controlled golem |
… | |
… | |
155 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
156 | sint8 ACC (RW, levsp[11]); /* Same for sp */ |
156 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
157 | sint8 ACC (RW, levgrace[11]); /* And same for grace */ |
157 | |
158 | |
158 | 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) */ |
159 | |
160 | |
160 | float speed_left_save; // spee doptimisation, see process_players[12] |
161 | float speed_left_save; // speed optimisation, see process_players[12] |
161 | 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 */ |
162 | 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 */ |
163 | |
164 | |
164 | partylist *ACC (RW, party); /* Party this player is part of */ |
165 | partylist *ACC (RW, party); /* Party this player is part of */ |
165 | 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 */ |
166 | /* but we will have to get password first */ |
167 | /* but we will have to get password first */ |
167 | /* so we have to remember which party to */ |
168 | /* so we have to remember which party to */ |
… | |
… | |
190 | { |
191 | { |
191 | if (delayed_update) |
192 | if (delayed_update) |
192 | ob->update_stats (); |
193 | ob->update_stats (); |
193 | } |
194 | } |
194 | |
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 | |
195 | // return the los value for the given coordinate |
210 | // return the los value for the given coordinate |
196 | MTH sint8 blocked_los (int dx, int dy) const |
211 | MTH sint8 blocked_los (int dx, int dy) const |
197 | { |
212 | { |
198 | dx += LOS_X0; |
213 | dx += LOS_X0; |
199 | dy += LOS_Y0; |
214 | dy += LOS_Y0; |
… | |
… | |
230 | |
245 | |
231 | void do_destroy (); |
246 | void do_destroy (); |
232 | void gather_callbacks (AV *&callbacks, event_type event) const; |
247 | void gather_callbacks (AV *&callbacks, event_type event) const; |
233 | |
248 | |
234 | 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); |
235 | |
251 | |
236 | 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 |
237 | |
253 | |
238 | 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 |
239 | { |
255 | { |
… | |
… | |
273 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
289 | MTH void statusmsg (const_utf8_string msg, int color = NDI_BLACK); |
274 | |
290 | |
275 | // a prominent box that signifies some error such as a failed |
291 | // a prominent box that signifies some error such as a failed |
276 | // improvement potion. should not be long. |
292 | // improvement potion. should not be long. |
277 | 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 |
278 | |
295 | |
279 | MTH void update_spells () const |
296 | MTH void update_spells () const |
280 | { |
297 | { |
281 | if (ns) |
298 | if (ns) |
282 | ns->update_spells = true; |
299 | ns->update_spells = true; |
… | |
… | |
302 | if ((var)->ob->map == (mapp)) |
319 | if ((var)->ob->map == (mapp)) |
303 | |
320 | |
304 | inline void |
321 | inline void |
305 | object::statusmsg (const_utf8_string msg, int color) |
322 | object::statusmsg (const_utf8_string msg, int color) |
306 | { |
323 | { |
307 | if (expect_true (contr)) contr->statusmsg (msg, color); |
324 | if (ecb_expect_true (contr)) contr->statusmsg (msg, color); |
308 | } |
325 | } |
309 | |
326 | |
310 | inline void |
327 | inline void |
311 | object::failmsg (const_utf8_string msg, int color) |
328 | object::failmsg (const_utf8_string msg, int color) |
312 | { |
329 | { |
313 | if (expect_true (contr)) contr->failmsg (msg, color); |
330 | if (ecb_expect_true (contr)) contr->failmsg (msg, color); |
314 | } |
331 | } |
315 | |
332 | |
316 | #endif |
333 | #endif |
317 | |
334 | |