Adonthell  0.4
mapcharacter.h
Go to the documentation of this file.
1 /*
2  $Id: mapcharacter.h,v 1.59 2003/02/23 23:14:34 ksterker Exp $
3 
4  Copyright (C) 1999/2000/2001 Alexandre Courbot
5  Part of the Adonthell Project http://adonthell.linuxgames.com
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 
16 
17 /**
18  * @file mapcharacter.h
19  *
20  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
21  * @brief Declares the mapcharacter class.
22  */
23 
24 
25 
26 #ifndef MAPCHARACTER_H_
27 #define MAPCHARACTER_H_
28 
29 /**
30  * Where mapcharacter files resides.
31  *
32  */
33 #define MAPCHAR_DIR "gfx/mapcharacters/"
34 
35 #include "animation.h"
36 #include "character_base.h"
37 #include "path.h"
38 #include "text_bubble.h"
39 #include "event_list.h"
40 
41 class landmap;
42 class path;
43 
44 /**
45  * @name mapcharacter moves.
46  *
47  */
48 //@{
49 
50 /**
51  * Standing North.
52  *
53  */
54 #define STAND_NORTH 0
55 
56 /**
57  * Standing South.
58  *
59  */
60 #define STAND_SOUTH 1
61 
62 /**
63  * Standing West.
64  *
65  */
66 #define STAND_WEST 2
67 
68 /**
69  * Standing East.
70  *
71  */
72 #define STAND_EAST 3
73 
74 /**
75  * Walking North.
76  *
77  */
78 #define WALK_NORTH 4
79 
80 /**
81  * Walking South.
82  *
83  */
84 #define WALK_SOUTH 5
85 
86 /**
87  * Walking West.
88  *
89  */
90 #define WALK_WEST 6
91 
92 /**
93  * Walking East.
94  *
95  */
96 #define WALK_EAST 7
97 
98 /**
99  * Total number of moves.
100  *
101  */
102 #define NBR_MOVES 8
103 
104 /**
105  * No move.
106  *
107  */
108 #define NO_MOVE 65535
109 
110 //@}
111 
112 class mapview;
113 
114 
115 
116 /**
117  * Representation of characters on a landmap.
118  *
119  * Like mapobjects, mapcharacters are a set of animations (one for every movment)
120  * and a grid of mapsquare_walkables. This grid represents the map area the mapcharacter
121  * physically occupies, which means that a mapcharacter can occupies several tiles.
122  *
123  * During the execution of Python scripts, some mapcharacter-local variables are
124  * available:
125  * @li myself is a pointer to the character holding this mapcharacter (can of course
126  * serve as a mapcharacter pointer, as character inheritates from mapcharacter).
127  * @li mymap, if defined, points to the landmap the mapcharacter is on.
128  *
129  * These Python variables are available both for schedules and actions.
130  *
131  * In supplement, actions have an extra variable available:
132  * @li requester, which points to the mapcharacter that requested the action.
133  *
134  */
136 {
137 public:
138 
139  /**
140  * Default constructor.
141  *
142  */
143  mapcharacter ();
144 
145  /**
146  * Destructor.
147  *
148  */
149  ~mapcharacter ();
150 
151  /**
152  * Puts the mapcharacter back to it's post-constructor state.
153  *
154  */
155  void clear ();
156 
157  /**
158  * Returns the current file name of the mapcharacter.
159  *
160  *
161  * @return filename of the mapcharacter.
162  */
163  string filename () const
164  {
165  return filename_;
166  }
167 
168  /**
169  * @name State updating
170  *
171  */
172  //@{
173 
174  /**
175  * Updates the mapcharacter's state and launchs his schedule.
176  *
177  */
178  bool update ();
179 
180  //@}
181 
182 
183  /**
184  * @name Drawing methods
185  *
186  */
187  //@{
188 
189  void draw (s_int16 x, s_int16 y, const drawing_area * da_opt = NULL, surface * target = NULL) const;
190  void draw_bubble (s_int16 x, s_int16 y, const drawing_area * da_opt = NULL, surface * target = NULL) const;
191 
192  //@}
193 
194 
195  /**
196  * @name Loading/Saving methods
197  *
198  * @note You can't save mapcharacters with this class.
199  */
200  //@{
201 
202  /**
203  * Loads a mapcharacter from an opened file.
204  * @param file the opened file from which to load.
205  * @return 0 in case of success, error code otherwise.
206  *
207  */
208  s_int8 get (igzstream& file);
209 
210  /**
211  * Loads a mapcharacter from it's filename.
212  *
213  * @param fname the name of the file to load.
214  *
215  * @return 0 in case of success, error code otherwise.
216  */
217  s_int8 load (string fname);
218 
219  /** Saves an mapcharacter into an opened file, in %game format, with
220  * alpha and mask values.
221  * @warning as the mapcharacter which is saved comes from a %screen's depth
222  * surface, it will be slightly altered during the save.
223  * If you want a class capable of saving mapcharacters with full
224  * truecolor quality, use mapcharacter_edit instead.
225  * @param file opened file where to save into.
226  * @return
227  * @li 0 in case of success.
228  * @li -1 in case of error.
229  * @sa save ()
230  */
231  s_int8 put (ogzstream& file) const;
232 
233  /** Saves an mapcharacter into an file, in %game format, with
234  * alpha and mask values.
235  * @warning as the mapcharacter which is saved comes from a %screen's depth
236  * surface, it will be slightly altered during the save.
237  * If you want a class capable of saving mapcharacters with full
238  * truecolor quality, use mapcharacter_edit instead.
239  * @param fname file name where to save into.
240  * @return
241  * @li 0 in case of success.
242  * @li -1 in case of error.
243  * @sa put ()
244  */
245  s_int8 save (string fname) const;
246  //@}
247 
248 
249  /**
250  * @name State loading/saving methods
251  *
252  */
253  //@{
254 
255  /**
256  * Restore the mapcharacter's state from an opened file.
257  *
258  * @param file the opened file from which to load the state.
259  *
260  * @return 0 in case of success, error code otherwise.
261  */
262  s_int8 get_state (igzstream& file);
263 
264  /**
265  * Saves the mapcharacter's state into an opened file.
266  *
267  * @param file the opened file where to the state.
268  *
269  * @return 0 in case of success, error code otherwise.
270  */
271  s_int8 put_state (ogzstream& file) const;
272 
273  //@}
274 
275 
276 
277  /**
278  * @name Landmap assignment
279  *
280  */
281  //@{
282 
283  /**
284  * Puts the mapcharacter on a landmap.
285  * This methods can only be applied if the mapcharacter isn't on any landmap
286  * when it is called, otherwise nothing will occur.
287  *
288  * @warning Be aware that once this methods is called, the mapcharacter has NO
289  * position on the landmap. You MUST call jump_to () after this method to actually
290  * have placed the character on the map.
291  *
292  * @param m pointer to the landmap the mapcharacter should be on.
293  */
294  void set_map (landmap * m);
295 
296  /**
297  * Removes the mapcharacter from the landmap he was on (if any).
298  *
299  */
300  void remove_from_map ();
301 
302  /**
303  * Returns a pointer to the landmap the mapcharacter is on.
304  *
305  *
306  * @return pointer to the landmap the mapcharacter is on (NULL if none).
307  */
308  landmap * mymap () const
309  {
310  return refmap;
311  }
312 
313  //@}
314 
315  /**
316  * @name High-level control
317  *
318  * These methods provide a simple way to control the mapcharacter on the map he's on.
319  * They cover "normal" moves like walking or looking into a direction, plus tests to
320  * know whether a move is possible or not.
321  *
322  */
323  //@{
324 
325  /**
326  * Look to North.
327  *
328  */
329  void stand_north ();
330 
331  /**
332  * Look to South.
333  *
334  */
335  void stand_south ();
336 
337  /**
338  * Look to East.
339  *
340  */
341  void stand_east ();
342 
343  /**
344  * Look to West.
345  *
346  */
347  void stand_west ();
348 
349  /**
350  * Stand to the current direction.
351  *
352  * @note This method only serves to abord an expected waking movment.
353  *
354  */
355  void stand ();
356 
357  /**
358  * Walk to North (if possible).
359  *
360  * This method asks the mapcharacter to walk one square to North. If the
361  * movment isn't possible (non-walkable mapsquare or map limit), the
362  * character will stand_north () instead.
363  *
364  * @note Each time update () is called, the mapcharacter will continue advancing,
365  * until he reaches the next mapsquare.
366  *
367  */
368  bool go_north ();
369 
370  /**
371  * Walk to South (if possible).
372  *
373  * This method asks the mapcharacter to walk one square to South. If the
374  * movment isn't possible (non-walkable mapsquare or map limit), the
375  * character will stand_south () instead.
376  *
377  * @note Each time update () is called, the mapcharacter will continue advancing,
378  * until he reaches the next mapsquare.
379  *
380  */
381  bool go_south ();
382 
383  /**
384  * Walk to East (if possible).
385  *
386  * This method asks the mapcharacter to walk one square to East. If the
387  * movment isn't possible (non-walkable mapsquare or map limit), the
388  * character will stand_east () instead.
389  *
390  * @note Each time update () is called, the mapcharacter will continue advancing,
391  * until he reaches the next mapsquare.
392  *
393  */
394  bool go_east ();
395 
396  /**
397  * Walk to West (if possible).
398  *
399  * This method asks the mapcharacter to walk one square to West. If the
400  * movment isn't possible (non-walkable mapsquare or map limit), the
401  * character will stand_west () instead.
402  *
403  * @note Each time update () is called, the mapcharacter will continue advancing,
404  * until he reaches the next mapsquare.
405  *
406  */
407  bool go_west ();
408 
409  /**
410  * Returns whether it is possible or not to go to North from
411  * the current mapcharacter's position.
412  *
413  *
414  * @return \c true if it is possible to go to North, \c false otherwise.
415  */
416  bool can_go_north () const;
417 
418  /**
419  * Returns whether it is possible or not to go to South from
420  * the current mapcharacter's position.
421  *
422  *
423  * @return \c true if it is possible to go to South, \c false otherwise.
424  */
425  bool can_go_south () const;
426 
427  /**
428  * Returns whether it is possible or not to go to East from
429  * the current mapcharacter's position.
430  *
431  *
432  * @return \c true if it is possible to go to East, \c false otherwise.
433  */
434  bool can_go_east ()const;
435 
436  /**
437  * Returns whether it is possible or not to go to West from
438  * the current mapcharacter's position.
439  *
440  *
441  * @return \c true if it is possible to go to West, \c false otherwise.
442  */
443  bool can_go_west () const;
444 
445  /**
446  * Look at the opposite position of p.
447  *
448  * This method is usefull for dialogues, when we want two
449  * characters to face each other.
450  *
451  *
452  * @param p opposite position of the position to look at. Can be
453  * \c STAND_NORTH, \c STAND_SOUTH, \c STAND_EAST or \c STAND_WEST.
454  */
455  void look_invert (u_int16 p);
456 
457  /**
458  * Return a pointer to the mapcharacter that is right next to this
459  * mapcharacter, i.e the mapcharacter that is on the square this
460  * mapcharacter is looking at.
461  *
462  * If no mapcharacter is next to this one, NULL will be returned.
463  *
464  *
465  * @return pointer to the mapcharacter next to this mapcharacter.
466  */
467  mapcharacter *whosnext () const;
468 
469  void speak (const string & text);
470 
471  bool is_speaking ()
472  {
473  return (saying != NULL);
474  }
475 
476  text_bubble * get_bubble ()
477  {
478  return saying;
479  }
480  //@}
481 
482 
483  /**
484  * @name Low-level controls
485  *
486  * If you need to do non-conventionnal or special things (like
487  * teleport a character from a position to another), or need
488  * to override the walkable mechanism, use these methods.
489  *
490  * You are also provided with various informative methods.
491  *
492  */
493  //@{
494 
495  /**
496  * Sets the offset of the mapcharacter on it's current mapsquare.
497  *
498  * @param x X offset.
499  * @param y Y offset.
500  */
502  {
503  offx_ = x;
504  offy_ = y;
505  }
506 
507  /**
508  * Removes the mapcharacter from the place he was on the map.
509  *
510  */
511  void remove_from_pos ();
512 
513  /**
514  * Remove the mapcharacter from it's current place and put him to a new one.
515  *
516  * @param smap index of the submap to jump to.
517  * @param x X offset to to.
518  * @param y Y offset to to.
519  * @param pos Position to adopt once placed.
520  */
521  void jump_to (u_int16 smap, u_int16 x, u_int16 y, u_int16 pos = NO_MOVE);
522 
523  /**
524  * Returns the index of the submap where the mapcharacter is.
525  *
526  *
527  * @return the index of the submap where the mapcharacter is.
528  */
529  u_int16 submap () const
530  {
531  return submap_;
532  }
533 
534  /**
535  * Returns the X position of the mapcharacter.
536  *
537  *
538  * @return the X position of the mapcharacter on his map.
539  */
540  u_int16 posx () const
541  {
542  return posx_;
543  }
544 
545  /**
546  * Returns the Y position of the mapcharacter.
547  *
548  *
549  * @return the Y position of the mapcharacter on his map.
550  */
551  u_int16 posy () const
552  {
553  return posy_;
554  }
555 
556  /**
557  * Returns the X offset of the mapcharacter.
558  *
559  *
560  * @return the X offset of the mapcharacter on his map.
561  */
562  s_int8 offx () const
563  {
564  return offx_;
565  }
566 
567  /**
568  * Returns the Y offset of the mapcharacter.
569  *
570  *
571  * @return the Y offset of the mapcharacter on his map.
572  */
573  s_int8 offy () const
574  {
575  return offy_;
576  }
577 
578  /**
579  * Returns the current move of the mapcharacter.
580  *
581  *
582  * @return current mapcharacter's move (STAND_NORTH, WALK_SOUTH, etc...).
583  */
585  {
586  return current_move;
587  }
588 
589  bool set_goal (u_int16 x, u_int16 y, u_int16 dir = NO_MOVE);
590  void set_callback (PyObject *callback, PyObject *args = NULL);
591  bool follow_path ();
592  bool goal_reached ();
593  void stop_moving ();
594 
595  void time_callback (string delay, PyObject *cb, PyObject *args = NULL);
596  void time_callback_string (string delay, string cb, PyObject *args = NULL);
597  //@}
598 
599 
600  /**
601  * Schedule control.
602  *
603  */
604 
605  //@{
606 
607  /**
608  * Assign a schedule to the mapcharacter.
609  *
610  * The schedule's filename will be \e "scripts/schedules/mapcharacters/<file>.py".
611  *
612  * @param file name of the schedule to use.
613  * @param args Python tuple containing extra arguments passed to the class constructor.
614  *
615  * @warning the args tuple argument MUST ONLY contain strings or integers, as it will
616  * be saved with the mapcharacter state by python::put_tuple ().
617  *
618  */
619  void set_schedule (string file, PyObject * args = NULL);
620 
621  /**
622  * Returns the name of the mapcharacter's current schedule.
623  *
624  *
625  * @return name of the mapcharacter's current schedule.
626  */
627  string schedule_file () const
628  {
629  return schedule_file_;
630  }
631 
632  /**
633  * Returns whether the schedule is activated or not.
634  *
635  *
636  * @return \c true if the schedule is activated, \c false otherwise.
637  */
638  bool is_schedule_activated () const
639  {
640  return schedule_activated;
641  }
642 
643  /**
644  * Sets whether the schedule is active or not.
645  *
646  * @param a \c true if the schedule should be activated, \c false otherwise.
647  */
648  void set_schedule_active (bool a)
649  {
650  if (a && !schedule.has_attribute ("run")) return;
651  schedule_activated = a;
652  }
653 
654  /**
655  * Tell the character to do something. Will execute the given method
656  * of the current schedule with the given arguments.
657  *
658  * @param method The method of the schedule to call.
659  * @param args The arguments to pass to the method.
660  *
661  * @return \c true if the method has been called, \c false otherwise.
662  */
663  bool do_stuff (string method, PyObject *args = NULL);
664  //@}
665 
666 
667  /**
668  * Action control.
669  *
670  */
671 
672  //@{
673 
674  /**
675  * Assign a action to the mapcharacter.
676  *
677  * The action's filename will be \e "scripts/actions/<file>.py".
678  *
679  * @param file name of the action to use.
680  * @param args Python tuple containing extra arguments passed to the class constructor.
681  *
682  * @warning the args tuple argument MUST ONLY contain strings or integers, as it will
683  * be saved with the mapcharacter state by python::put_tuple ().
684  *
685  */
686  void set_action (string file, PyObject * args = NULL);
687 
688  /**
689  * Returns the name of the mapcharacter's current action.
690  *
691  *
692  * @return name of the mapcharacter's current action.
693  */
694  string action_file () const
695  {
696  return action_file_;
697  }
698 
699  /**
700  * Returns whether the action is activated or not.
701  *
702  *
703  * @return \c true if the action is activated, \c false otherwise.
704  */
705  bool is_action_activated () const
706  {
707  return action_activated;
708  }
709 
710  /**
711  * Sets whether the action is active or not.
712  *
713  * @param a \c true if the action should be activated, \c false otherwise.
714  */
715  void set_action_active (bool a)
716  {
717  action_activated = a;
718  }
719 
720  /**
721  * Run the mapcharacter's action, passing requester as the "requester" parameter
722  * for the action's Python script.
723  *
724  * @param requester pointer to the mapcharacter that requested the action, which
725  * is passed to the Python run () method.
726  */
727  void launch_action (mapcharacter * requester);
728 
729  //@}
730 
731 
732  /**
733  * Returns a pointer to an animation corresponding
734  * to a movment.
735  *
736  * @param nbr index of the animation to get.
737  *
738  * @return pointer to the \e nbr animation.
739  */
741  {
742  return anim[nbr];
743  }
744 
745 #ifndef SWIG
746  /**
747  * Mapcharacter copy (similar to copy ()).
748  *
749  * @attention Not available from Python. Use copy () from Python instead.
750  * @sa copy ()
751  */
753 #endif // SWIG
754 
755  /**
756  * Synonym of operator = to guarantee its access from Python.
757  *
758  * @sa operator =
759  */
760  void copy (const mapcharacter& src)
761  {
762  *this = src;
763  }
764 
765 private:
766  /**
767  * Forbid value passing.
768  *
769  */
770  mapcharacter (const mapcharacter & src);
771 
772  /**
773  * Makes the mapcharacter physically occupy an area.
774  *
775  * The given parameters are considered to be where
776  * the mapcharacter's base square will be.
777  *
778  * @param smap submap where to occupy.
779  * @param px X position where to occupy.
780  * @param py Y position where to occupy.
781  */
782  void occupy (u_int16 smap, u_int16 px, u_int16 py);
783 
784  /**
785  * Makes the mapcharacter physically leave an area previously occupied
786  * with occupy ().
787  *
788  * The given parameters are considered to be where
789  * the mapcharacter's base square were be.
790  *
791  * @param smap submap where to leave.
792  * @param px X position where to leave.
793  * @param py Y position where to leave.
794  */
795  void leave (u_int16 smap, u_int16 px, u_int16 py);
796 
797  void leave_position ();
798 
799  /**
800  * Sets the position of the mapcharacter on the map.
801  *
802  * This sets the mapcharacter's position to the parameters,
803  * and occupy () the corresponding region.
804  *
805  * @warning Don't forget to leave () the region when moving!
806  *
807  * @param smap index of the submap where the mapcharacter should be.
808  * @param x X position on the submap.
809  * @param y Y position on the submap.
810  */
811  void set_pos (u_int16 smap, u_int16 x, u_int16 y);
812 
813  /**
814  * Updates the movment of the mapcharacter.
815  *
816  */
817  void update_move ();
818 
819 
820  /**
821  * Path used for the mapcharacter to have realistic movments.
822  *
823  */
824  path mypath;
825 
826  /**
827  * Used to count the position on the path
828  *
829  */
830  u_int16 pathindex;
831 
832  u_int16 current_move;
833  u_int16 previous_move;
834  u_int16 submap_;
835  u_int16 posx_, posy_;
836  s_int8 offx_, offy_;
837  vector <animation *> anim;
838  landmap *refmap;
839 
840  py_object schedule;
841  py_object action;
842 
843  string filename_;
844 
845  text_bubble * saying;
846 
847  bool schedule_activated;
848  bool action_activated;
849  bool goal_reached_;
850 
851  PyObject * schedule_args;
852  PyObject * action_args;
853 
854  string schedule_file_;
855  string action_file_;
856 
857  py_callback *callback;
858 
859 #ifndef SWIG
860  friend class landmap;
861 #endif
862 };
863 
864 #endif
u_int16 submap() const
Returns the index of the submap where the mapcharacter is.
Definition: mapcharacter.h:529
Class to write data from a Gzip compressed file.
Definition: fileops.h:223
bool can_go_north() const
Returns whether it is possible or not to go to North from the current mapcharacter's position...
#define NO_MOVE
No move.
Definition: mapcharacter.h:108
Displays neat little text speech bubbles.
Definition: text_bubble.h:42
Class to read data from a Gzip compressed file.
Definition: fileops.h:131
u_int16 posx() const
Returns the X position of the mapcharacter.
Definition: mapcharacter.h:540
void set_schedule_active(bool a)
Sets whether the schedule is active or not.
Definition: mapcharacter.h:648
Declares the animationframe and animation classes.
~mapcharacter()
Destructor.
Definition: mapcharacter.cc:55
Python object class.
Definition: py_object.h:41
#define u_int16
16 bits long unsigned integer
Definition: types.h:32
animation * get_animation(u_int16 nbr)
Returns a pointer to an animation corresponding to a movment.
Definition: mapcharacter.h:740
Declares the character_base class.
Declares the text_bubble class.
Class where drawables can actually be drawn to.
Definition: surface.h:51
string action_file() const
Returns the name of the mapcharacter's current action.
Definition: mapcharacter.h:694
bool go_south()
Walk to South (if possible).
void look_invert(u_int16 p)
Look at the opposite position of p.
mapcharacter * whosnext() const
Return a pointer to the mapcharacter that is right next to this mapcharacter, i.e the mapcharacter th...
bool can_go_east() const
Returns whether it is possible or not to go to East from the current mapcharacter's position...
void stand_south()
Look to South.
void draw(s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Draw the object on the screen.
bool update()
Updates the mapcharacter's state and launchs his schedule.
void set_action_active(bool a)
Sets whether the action is active or not.
Definition: mapcharacter.h:715
void remove_from_map()
Removes the mapcharacter from the landmap he was on (if any).
bool is_action_activated() const
Returns whether the action is activated or not.
Definition: mapcharacter.h:705
Base character class containing attributes and dialog stuff.
void jump_to(u_int16 smap, u_int16 x, u_int16 y, u_int16 pos=NO_MOVE)
Remove the mapcharacter from it's current place and put him to a new one.
s_int8 put(ogzstream &file) const
Saves an mapcharacter into an opened file, in game format, with alpha and mask values.
mapcharacter()
Default constructor.
Definition: mapcharacter.cc:33
Allows you to display a landmap on a specified area of a surface.
Definition: mapview.h:44
u_int16 posy() const
Returns the Y position of the mapcharacter.
Definition: mapcharacter.h:551
bool can_go_south() const
Returns whether it is possible or not to go to South from the current mapcharacter's position...
void stand()
Stand to the current direction.
Implements "drawing zones" for drawing operations.
Definition: drawing_area.h:50
void stand_east()
Look to East.
bool can_go_west() const
Returns whether it is possible or not to go to West from the current mapcharacter's position...
string filename() const
Returns the current file name of the mapcharacter.
Definition: mapcharacter.h:163
s_int8 offx() const
Returns the X offset of the mapcharacter.
Definition: mapcharacter.h:562
void stand_west()
Look to West.
#define s_int16
16 bits long signed integer
Definition: types.h:41
s_int8 offy() const
Returns the Y offset of the mapcharacter.
Definition: mapcharacter.h:573
void clear()
Puts the mapcharacter back to it's post-constructor state.
Definition: mapcharacter.cc:63
A* pathfinding algorithm implementation class.
Definition: path.h:48
Declares the path class.
Map where the world takes place.
Definition: landmap.h:52
string schedule_file() const
Returns the name of the mapcharacter's current schedule.
Definition: mapcharacter.h:627
bool go_east()
Walk to East (if possible).
void set_map(landmap *m)
Puts the mapcharacter on a landmap.
void remove_from_pos()
Removes the mapcharacter from the place he was on the map.
Representation of characters on a landmap.
Definition: mapcharacter.h:135
mapcharacter & operator=(const mapcharacter &m)
Mapcharacter copy (similar to copy ()).
Area of mapsquare_walkables, for use with mapcharacter and mapobject classes.
Stores the C++ <-> Python callback binding.
Definition: py_callback.h:36
u_int16 currentmove() const
Returns the current move of the mapcharacter.
Definition: mapcharacter.h:584
s_int8 put_state(ogzstream &file) const
Saves the mapcharacter's state into an opened file.
bool is_schedule_activated() const
Returns whether the schedule is activated or not.
Definition: mapcharacter.h:638
bool go_west()
Walk to West (if possible).
bool go_north()
Walk to North (if possible).
Class that handles animated elements, their update and their playback.
Definition: animation.h:308
s_int8 load(string fname)
Loads a mapcharacter from it's filename.
bool do_stuff(string method, PyObject *args=NULL)
Tell the character to do something.
Base class for objects that want to register events.
Definition: event_list.h:52
Declares the event_list class.
void launch_action(mapcharacter *requester)
Run the mapcharacter's action, passing requester as the "requester" parameter for the action's Python...
#define s_int8
8 bits long signed integer
Definition: types.h:38
void stand_north()
Look to North.
void copy(const mapcharacter &src)
Synonym of operator = to guarantee its access from Python.
Definition: mapcharacter.h:760
void set_offset(s_int8 x, s_int8 y)
Sets the offset of the mapcharacter on it's current mapsquare.
Definition: mapcharacter.h:501
s_int8 get_state(igzstream &file)
Restore the mapcharacter's state from an opened file.
void set_schedule(string file, PyObject *args=NULL)
Schedule control.
landmap * mymap() const
Returns a pointer to the landmap the mapcharacter is on.
Definition: mapcharacter.h:308
void set_action(string file, PyObject *args=NULL)
Action control.
bool has_attribute(const std::string &name)
Tests whether the object contains a certain attribute (i.e.
Definition: py_object.cc:130
s_int8 save(string fname) const
Saves an mapcharacter into an file, in game format, with alpha and mask values.