#include <mapobject.h>
Public Member Functions | |
mapobject () | |
Default constructor. | |
~mapobject () | |
Destructor. | |
void | clear () |
Resets the mapobject to its post-constructor state. | |
mapobject & | operator= (const mapobject &mo) |
Mapobject copy (similar to copy ()). | |
void | copy (const mapobject &src) |
Synonym of operator = to guarantee its access from Python. | |
State updating. | |
bool | update () |
Updates the mapobject's state. | |
Drawing methods. | |
void | draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const |
Draw the object on the screen. | |
void | draw_from_base (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const |
Similar to draw (), but assume the x and y parameters are where the base square should appear. | |
Loading/saving methods. | |
s_int8 | get (igzstream &file) |
Loads a mapobject from an opened file. | |
s_int8 | load (string fname) |
Loads a mapobject from it's filename. | |
s_int8 | put (ogzstream &file) const |
Saves an mapobject into an opened file, in game format, with alpha and mask values. | |
s_int8 | save (string fname) const |
Saves an mapobject into an file, in game format, with alpha and mask values. | |
Individual animations manipulation. | |
u_int16 | nbr_of_animations () const |
Returns the number of animations of this mapobject. | |
animation * | get_animation (u_int16 nbr) |
Returns a pointer to one of the mapobject's animations. | |
s_int8 | insert_animation (animation *an, u_int16 pos) |
Inserts an animation at a given position of the animations array. | |
s_int8 | delete_animation (u_int16 pos) |
Removes an animation at a given position. |
A mapobject is basically a set of animations. Each animation can be freely placed on a resizeable grid which represents the actual land where the object will be placed. This grid also has information about the walkability of it's squares, which will be repercuted on the landmap as soon as the object is placed.
Definition at line 46 of file mapobject.h.
mapobject::mapobject | ( | ) |
mapobject::~mapobject | ( | ) |
void mapobject::clear | ( | ) |
Resets the mapobject to its post-constructor state.
Reimplemented from mapsquare_walkable_area.
Definition at line 43 of file mapobject.cc.
bool mapobject::update | ( | ) | [virtual] |
Updates the mapobject's state.
Reimplemented from drawable.
Definition at line 53 of file mapobject.cc.
void mapobject::draw | ( | s_int16 | x, | |
s_int16 | y, | |||
const drawing_area * | da_opt = NULL , |
|||
surface * | target = NULL | |||
) | const [virtual] |
Draw the object on the screen.
x | X position where to draw. | |
y | Y position where to draw. | |
da_opt | optional drawing_area to use during the drawing operation. | |
target | pointer to the surface where to draw the drawable. If NULL, draw on the screen. |
Implements mapsquare_walkable_area.
Definition at line 63 of file mapobject.cc.
void mapobject::draw_from_base | ( | s_int16 | x, | |
s_int16 | y, | |||
const drawing_area * | da_opt = NULL , |
|||
surface * | target = NULL | |||
) | const |
Similar to draw (), but assume the x and y parameters are where the base square should appear.
x | X position where to draw. | |
y | Y position where to draw. | |
da_opt | optional drawing_area to use during the drawing operation. | |
target | pointer to the surface where to draw the drawable. If NULL, draw on the screen. |
Definition at line 71 of file mapobject.cc.
s_int8 mapobject::get | ( | igzstream & | file | ) |
Loads a mapobject from an opened file.
file | the opened file from which to load. |
Reimplemented from mapsquare_walkable_area.
Definition at line 78 of file mapobject.cc.
s_int8 mapobject::load | ( | string | fname | ) |
Loads a mapobject from it's filename.
fname | the name of the file to load. |
Definition at line 103 of file mapobject.cc.
s_int8 mapobject::put | ( | ogzstream & | file | ) | const |
Saves an mapobject into an opened file, in game format, with alpha and mask values.
file | opened file where to save into. |
Reimplemented from mapsquare_walkable_area.
Definition at line 120 of file mapobject.cc.
s_int8 mapobject::save | ( | string | fname | ) | const |
Saves an mapobject into an file, in game format, with alpha and mask values.
fname | file name where to save into. |
Definition at line 138 of file mapobject.cc.
u_int16 mapobject::nbr_of_animations | ( | ) | const [inline] |
Returns the number of animations of this mapobject.
Definition at line 177 of file mapobject.h.
animation* mapobject::get_animation | ( | u_int16 | nbr | ) | [inline] |
Returns a pointer to one of the mapobject's animations.
nbr | index of the animation to get. |
Definition at line 189 of file mapobject.h.
s_int8 mapobject::insert_animation | ( | animation * | an, | |
u_int16 | pos | |||
) |
Inserts an animation at a given position of the animations array.
The mapobject will be responsible for freeing the inserted animation.
Definition at line 155 of file mapobject.cc.
s_int8 mapobject::delete_animation | ( | u_int16 | pos | ) |
Removes an animation at a given position.
The animation itself will also be deleted ().
pos | The index of the animation to remove. |
Definition at line 168 of file mapobject.cc.
Mapobject copy (similar to copy ()).
Definition at line 181 of file mapobject.cc.
void mapobject::copy | ( | const mapobject & | src | ) | [inline] |
Synonym of operator = to guarantee its access from Python.
Definition at line 235 of file mapobject.h.