mobs.h

00001 /*
00002 Copyright Remco Bras and Michael de Lang 2007,2008.
00003 This file is part of RPGE.
00004 
00005 RPGE is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 RPGE is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>
00017 */
00018 #ifndef MOBS_H
00019 #define MOBS_H
00020 #include <SDL/SDL.h>
00021 #include <stdlib.h>
00022 #include <libguile.h>
00023 #include "sequence.h"
00024 #include "constants.h"
00025 #include "event.h"
00026 
00027 typedef struct
00028 {
00029   int x;
00030   int y;
00031   int grid;
00032   float xpixelalignment; /*Unused as of right about now, but intended for usage in 'offsetting' sprites from the center of their assigned tile*/
00033   float ypixelalignment; 
00034   int imgindex;
00035   unsigned int animation;
00036   unsigned int frame;
00037   unsigned int targetframe;
00038   char animlooping; /*Low-hanging optimization fruit here*/
00039   char resetonnext;
00040   int initialtimetonextframe;
00041   int timetonextframe;
00042   int xmoverate;
00043   int xmoveamount;
00044   int ymoverate;
00045   int ymoveamount;
00046   SCM userdata;
00047   sequence move_descriptors;
00048   eventstack events; /*For events limited to this mob only*/
00049 } mob;
00050 
00051 typedef struct
00052 {
00053   int tilex, tiley, frames;
00054 }  move_descriptor;
00055 
00056 extern sequence mobs;
00057 
00058 void mobs_init(void);
00059 mob create_mob_using_sprite (unsigned int, unsigned int,unsigned grid, char *);
00060 int push_mob_on_array (mob);
00061 void remove_mob(int);
00062 void mob_set_animation_by_index(int ind, unsigned int animation, unsigned int startframe, unsigned int targetframe, unsigned int framesperframe, char looping);
00063 void animate_mobs();
00064 void move_mobs();
00065 void mob_move_all_by_index(int ind, int xtiles, int ytiles, int frames);
00066 void mob_add_movement_by_index(int ind, int xtiles, int ytiles, int frames);
00067 void mob_stop_animation_by_index(int ind);
00068 void set_mob_frame_by_index(int ind,unsigned int animation,unsigned int framenum);
00069 void set_mob_userdata_by_index(int ind, SCM newdata);
00070 char set_mob_position_by_index(int ind, int x, int y, int g);
00071 mob* get_mob_by_index(int ind);
00072 void stop_mob_movement_by_index(int ind);
00073 
00074 /*Self-dependent include*/
00075 #include "tile.h"
00076 #endif
 All Classes

Generated on Tue Feb 15 21:31:40 2011 by  doxygen 1.6.1