Adonthell
0.4
|
Objects that can be placed on a landmap. More...
#include <mapobject.h>
Public Member Functions | |
mapobject () | |
Default constructor. More... | |
~mapobject () | |
Destructor. More... | |
void | clear () |
Resets the mapobject to its post-constructor state. More... | |
mapobject & | operator= (const mapobject &mo) |
Mapobject copy (similar to copy ()). More... | |
void | copy (const mapobject &src) |
Synonym of operator = to guarantee its access from Python. More... | |
State updating. | |
bool | update () |
Updates the mapobject's state. More... | |
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. More... | |
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. More... | |
Loading/saving methods. | |
| |
s_int8 | get (igzstream &file) |
Loads a mapobject from an opened file. More... | |
s_int8 | load (string fname) |
Loads a mapobject from it's filename. More... | |
s_int8 | put (ogzstream &file) const |
Saves an mapobject into an opened file, in game format, with alpha and mask values. More... | |
s_int8 | save (string fname) const |
Saves an mapobject into an file, in game format, with alpha and mask values. More... | |
Individual animations manipulation. | |
u_int16 | nbr_of_animations () const |
Returns the number of animations of this mapobject. More... | |
animation * | get_animation (u_int16 nbr) |
Returns a pointer to one of the mapobject's animations. More... | |
s_int8 | insert_animation (animation *an, u_int16 pos) |
Inserts an animation at a given position of the animations array. More... | |
s_int8 | delete_animation (u_int16 pos) |
Removes an animation at a given position. More... | |
![]() | |
mapsquare_walkable_area () | |
Default constructor. More... | |
~mapsquare_walkable_area () | |
Destructor. More... | |
void | clear () |
Totally clears the area. More... | |
s_int8 | get (igzstream &file) |
Loads an area from an opened file. More... | |
s_int8 | put (ogzstream &file) const |
Saves an area into an opened file. More... | |
mapsquare_walkable_area & | operator= (const mapsquare_walkable_area &mo) |
Area copy (similar to copy ()). More... | |
void | copy (const mapsquare_walkable_area &src) |
Synonym of operator = to guarantee its access from Python. More... | |
u_int16 | area_length () const |
Returns the length of the area. More... | |
u_int16 | area_height () const |
Returns the height of the area. More... | |
mapsquare_walkable * | get_square (u_int16 x, u_int16 y) const |
Returns a pointer to a desired square. More... | |
void | resize_area (u_int16 nl, u_int16 nh) |
Resize the area. More... | |
u_int16 | base_x () const |
Returns the X offset of the base square of this object. More... | |
u_int16 | base_y () const |
Returns the Y offset of the base square of this object. More... | |
void | set_base (u_int16 nx, u_int16 ny) |
Sets the base square of this object. More... | |
![]() | |
drawable () | |
Default constructor. More... | |
virtual | ~drawable () |
Destructor. More... | |
u_int16 | length () const |
Returns the length of the drawable. More... | |
u_int16 | height () const |
Returns the height of the drawable. More... | |
virtual bool | input_update () |
Virtual input update function, provided for objects which doesn't need one. More... | |
Additional Inherited Members | |
![]() | |
void | set_length (u_int16 l) |
Sets the length of the drawable. More... | |
void | set_height (u_int16 h) |
Sets the height of the drawable. More... | |
Objects that can be placed on a landmap.
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 | ( | ) |
Default constructor.
Definition at line 33 of file mapobject.cc.
mapobject::~mapobject | ( | ) |
Destructor.
Definition at line 38 of file mapobject.cc.
void mapobject::clear | ( | ) |
Resets the mapobject to its post-constructor state.
Definition at line 43 of file mapobject.cc.
|
virtual |
Updates the mapobject's state.
Reimplemented from drawable.
Definition at line 53 of file mapobject.cc.
|
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.
Loads a mapobject from an opened file.
file | the opened file from which to load. |
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.
Saves an mapobject into an opened file, in game format, with alpha and mask values.
file | opened file where to save into. |
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.
|
inline |
Returns the number of animations of this mapobject.
Definition at line 177 of file mapobject.h.
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.
Inserts an animation at a given position of the animations array.
The mapobject will be responsible for freeing the inserted animation.
an | pointer to the animation to add. |
pos | index where to add the animation. |
Definition at line 155 of file mapobject.cc.
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.
|
inline |
Synonym of operator = to guarantee its access from Python.
Definition at line 235 of file mapobject.h.