1 /************************************************************** 2 * _____ __ _____ * 3 * / _ \ | | ____ ___ ___ / | | * 4 * / /_\ \ | | _/ __ \ \ \/ / / | |_ * 5 * / | \| |__\ ___/ > < / ^ / * 6 * \____|__ /|____/ \___ >/__/\_ \ \____ | * 7 * \/ \/ \/ |__| * 8 * * 9 ************************************************************** 10 * (c) Free Lunch Design 2003 * 11 * Written by Johan Peitz * 12 * http://www.freelunchdesign.com * 13 ************************************************************** 14 * This source code is released under the The GNU * 15 * General Public License (GPL). Please refer to the * 16 * document license.txt in the source directory or * 17 * http://www.gnu.org for license information. * 18 **************************************************************/ 19 20 21 22 #ifndef _ACTOR_H_ 23 #define _ACTOR_H_ 24 25 #include "allegro.h" 26 #include "map.h" 27 28 // different modes that an actor can hold 29 // they are all exclusive 30 #define AC_NORM 1 31 #define AC_EAT 2 32 #define AC_FULL 3 33 #define AC_SPIT 4 34 #define AC_DEAD 5 35 #define AC_BALL 6 36 #define AC_FLAT 7 37 38 // different flags that show attributes 39 // of an actor 40 #define ACF_JUMPABLE 0x0001 41 #define ACF_FLATABLE 0x0002 42 #define ACF_HURTS 0x0004 43 #define ACF_SHOOTABLE 0x0008 44 #define ACF_BOUNCEABLE 0x0010 45 #define ACF_ROLLABLE 0x0020 46 #define ACF_ROLLABLE_BACK 0x0040 47 48 // no more than 64 actors can be on one map 49 #define MAX_ACTORS 64 50 51 // this is the actor struct 52 typedef struct { 53 int active; 54 int status; 55 int type; 56 57 int x, y, dy, dx; 58 59 int w, h; 60 int ox, oy; 61 int tx; 62 63 int direction; 64 int frames[16]; 65 int flat_frame; 66 int frame; 67 int num_frames; 68 int anim_counter; 69 int anim_max; 70 int hit_offset; 71 72 int counter; 73 74 unsigned int flags; 75 int mode; 76 int toggle; 77 int ymax; 78 int energy; 79 int is_hit; 80 int sound; 81 82 DATAFILE *data; 83 } Tactor; 84 85 86 // functions 87 Tactor *make_actor(Tactor *a, int x, int y, DATAFILE *data); 88 void draw_actor(BITMAP *bmp, Tactor *a, int x, int y); 89 void animate_actor(Tactor *a); 90 void update_actor_with_map(Tactor *a, Tmap *m); 91 void kill_actor(Tactor *a); 92 93 94 #endif