Logo Search packages:      
Sourcecode: adonthell version File versions  Download package

mapcharacter Class Reference

#include <mapcharacter.h>

Inheritance diagram for mapcharacter:

mapsquare_walkable_area character_base event_list drawable storage character

List of all members.

Detailed Description

Representation of characters on a landmap.

Like mapobjects, mapcharacters are a set of animations (one for every movment) and a grid of mapsquare_walkables. This grid represents the map area the mapcharacter physically occupies, which means that a mapcharacter can occupies several tiles.

During the execution of Python scripts, some mapcharacter-local variables are available:

These Python variables are available both for schedules and actions.

In supplement, actions have an extra variable available:

Definition at line 135 of file mapcharacter.h.

Public Types

typedef hash_map< string,
s_int32 >::iterator 

Public Member Functions

iterator begin ()
void clear ()
void copy (const mapsquare_walkable_area &src)
void copy (const mapcharacter &src)
iterator end ()
string filename () const
animationget_animation (u_int16 nbr)
u_int32 get_color () const
string get_dialogue () const
string get_id ()
string get_name () const
string get_portrait () const
s_int32 get_val (string key)
u_int16 height () const
virtual bool input_update ()
u_int16 length () const
 mapcharacter ()
pair< string, s_int32 > next ()
mapcharacteroperator= (const mapcharacter &m)
s_int32 & operator[] (string key)
void put_state (ogzstream &out)
void set_color (int c)
void set_dialogue (string dialogue)
void set_name (string newname)
void set_portrait (string fname)
void set_val (string key, s_int32 value)
u_int32 size () const
 ~mapcharacter ()
string action_file () const
bool is_action_activated () const
void launch_action (mapcharacter *requester)
void set_action (string file, PyObject *args=NULL)
void set_action_active (bool a)
List Operations
void add_event (event *ev)
eventget_event (const string &id)
void remove_event (event *ev)
Area settings.
u_int16 area_height () const
u_int16 area_length () const
mapsquare_walkableget_square (u_int16 x, u_int16 y) const
void resize_area (u_int16 nl, u_int16 nh)
Base square settings.
u_int16 base_x () const
u_int16 base_y () const
void set_base (u_int16 nx, u_int16 ny)
High-level control
These methods provide a simple way to control the mapcharacter on the map he's on. They cover "normal" moves like walking or looking into a direction, plus tests to know whether a move is possible or not.

bool can_go_east () const
bool can_go_north () const
bool can_go_south () const
bool can_go_west () const
text_bubbleget_bubble ()
bool go_east ()
bool go_north ()
bool go_south ()
bool go_west ()
bool is_speaking ()
void look_invert (u_int16 p)
void speak (const string &text)
void stand ()
void stand_east ()
void stand_north ()
void stand_south ()
void stand_west ()
mapcharacterwhosnext () const
Low-level controls
If you need to do non-conventionnal or special things (like teleport a character from a position to another), or need to override the walkable mechanism, use these methods.

You are also provided with various informative methods.

u_int16 currentmove () const
bool follow_path ()
bool goal_reached ()
void jump_to (u_int16 smap, u_int16 x, u_int16 y, u_int16 pos=NO_MOVE)
s_int8 offx () const
s_int8 offy () const
u_int16 posx () const
u_int16 posy () const
void remove_from_pos ()
void set_callback (PyObject *callback, PyObject *args=NULL)
bool set_goal (u_int16 x, u_int16 y, u_int16 dir=NO_MOVE)
void set_offset (s_int8 x, s_int8 y)
void stop_moving ()
u_int16 submap () const
void time_callback (string delay, PyObject *cb, PyObject *args=NULL)
void time_callback_string (string delay, string cb, PyObject *args=NULL)
bool do_stuff (string method, PyObject *args=NULL)
bool is_schedule_activated () const
string schedule_file () const
void set_schedule (string file, PyObject *args=NULL)
void set_schedule_active (bool a)
Drawing methods
void draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
void draw_bubble (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const
Loading/Saving methods
You can't save mapcharacters with this class.

s_int8 get (igzstream &file)
s_int8 load (string fname)
s_int8 put (ogzstream &file) const
s_int8 save (string fname) const
State loading/saving methods
s_int8 get_state (igzstream &file)
s_int8 put_state (ogzstream &file) const
Pausing / Resuming execution
bool is_paused () const
void pause ()
void resume ()
Landmap assignment
landmapmymap () const
void remove_from_map ()
void set_map (landmap *m)
State updating
bool update ()

Static Public Member Functions

static void register_event (u_int8 type, new_event e)

Protected Member Functions

void set_height (u_int16 h)
void set_length (u_int16 l)

Protected Attributes

std::vector< event * > Events

Private Member Functions

void leave (u_int16 smap, u_int16 px, u_int16 py)
void leave_position ()
 mapcharacter (const mapcharacter &src)
void occupy (u_int16 smap, u_int16 px, u_int16 py)
void set_pos (u_int16 smap, u_int16 x, u_int16 y)
void update_move ()

Private Attributes

py_object action
bool action_activated
PyObject * action_args
string action_file_
vector< animation * > anim
u_int16 current_move
string filename_
bool goal_reached_
path mypath
s_int8 offx_
s_int8 offy_
u_int16 pathindex
u_int16 posx_
u_int16 posy_
u_int16 previous_move
py_object schedule
bool schedule_activated
PyObject * schedule_args
string schedule_file_
u_int16 submap_


class landmap

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index