00001 00006 // /** 00007 // *@defgroup spritesh sprites.h 00008 // *Manages the base image linked list and the sprite linked list, provides function to create new sprites 00009 // *and add them to sprite list as well as removing sprites from the list 00010 // *@{ 00011 // */ 00012 00013 /*----------------------------------------------------------------------------------------------------------*/ 00014 00015 typedef enum animation { 00016 MLEFT = 0x1, 00017 MRIGHT = 0x2, 00018 MUP = 0x4, 00019 MDOWN = 0x8, 00020 MATTACK = 0x10, 00021 MDAMAGED = 0x20, 00022 MRECOVER = 0x40, 00023 MNONE = 0x80 00024 } ANIMATION; 00025 00026 /*----------------------------------------------------------------------------------------------------------*/ 00027 00028 typedef struct sprite_images { 00029 char *ilabel; 00030 ALLEGRO_BITMAP *image; 00031 float width; 00032 float height; 00033 struct sprite_images *nextimage; 00034 struct sprite_images *previmage; 00035 } SIMAGE, *SIMAGEPTR; 00036 00037 /*----------------------------------------------------------------------------------------------------------*/ 00038 00039 typedef struct sprite_data_aux { 00040 char *dlabel; 00041 char *dtype; 00042 void *data; 00043 struct sprite_data_aux *nextdata; 00044 struct sprite_data_aux *prevdata; 00045 } SDATAX, *SDATAXPTR; 00046 00047 /*----------------------------------------------------------------------------------------------------------*/ 00048 00049 typedef struct sprite_data_core { 00050 SIMAGEPTR currentimg; 00051 float x; 00052 float y; 00053 float dx; 00054 float dy; 00055 int anim_counter; 00056 ANIMATION animflags; 00057 } SDATAC, *SDATACPTR; 00058 00059 /*----------------------------------------------------------------------------------------------------------*/ 00060 00061 typedef struct sprites { 00062 char *slabel; 00063 SIMAGEPTR ifirstptr; 00064 SDATAXPTR dfirstptr; 00065 SDATAC sdata; 00066 struct cpShape *shape; 00067 struct sprites *nextsprite; 00068 struct sprites *prevsprite; 00069 } SPRITES, *SPRITESPTR; 00070 00071 /*----------------------------------------------------------------------------------------------------------*/ 00072 00073 SPRITESPTR get_first_element_from_sprite_list(void); 00074 00075 /*----------------------------------------------------------------------------------------------------------*/ 00076 00077 SPRITESPTR set_first_element_in_sprite_list(SPRITESPTR *newfirst); 00078 00079 /*----------------------------------------------------------------------------------------------------------*/ 00080 00081 SPRITESPTR create_new_sprite(char *label, char *imagelabels[], int num_images, 00082 char *datalabels[], char *datatypes[], void *data[], 00083 int num_data, char *currentimg, float x, float y, 00084 float dx, float dy, int anim_counter, ANIMATION animflags, 00085 _Bool add_to_list); 00086 00087 /*----------------------------------------------------------------------------------------------------------*/ 00088 00089 SPRITESPTR add_element_to_sprite_list(SPRITESPTR *sprite); 00090 00091 /*----------------------------------------------------------------------------------------------------------*/ 00092 00093 SPRITESPTR remove_element_from_sprite_list(char *label); 00094 00095 /*----------------------------------------------------------------------------------------------------------*/ 00096 00097 SPRITESPTR remove_element_from_sprite_list_ptr(SPRITESPTR sprite); 00098 00099 /*----------------------------------------------------------------------------------------------------------*/ 00100 00101 SPRITESPTR search_sprite_list_for_element(char *label); 00102 00103 /*----------------------------------------------------------------------------------------------------------*/ 00104 00105 _Bool empty_sprite_list(SPRITESPTR firstptr); 00106 00107 /*----------------------------------------------------------------------------------------------------------*/ 00108 00109 SPRITESPTR set_anim_flags_on_sprite(SPRITESPTR sprite, ANIMATION nflags); 00110 00111 /*----------------------------------------------------------------------------------------------------------*/ 00112 00113 SPRITESPTR remove_anim_flags_on_sprite(SPRITESPTR sprite, ANIMATION nflags); 00114 00115 /*----------------------------------------------------------------------------------------------------------*/ 00116 00117 SPRITESPTR clear_anim_flags_on_sprite(SPRITESPTR sprite); 00118 00119 /*----------------------------------------------------------------------------------------------------------*/ 00120 00121 SPRITESPTR clear_anim_flags_on_sprite_list(SPRITESPTR firstptr); 00122 00123 /*----------------------------------------------------------------------------------------------------------*/ 00124 00125 SPRITESPTR remove_anim_flags_on_sprite_list(SPRITESPTR firstptr, ANIMATION nflags); 00126 00127 /*----------------------------------------------------------------------------------------------------------*/ 00128 00129 SIMAGEPTR get_first_element_from_base_image_list(void); 00130 00131 /*----------------------------------------------------------------------------------------------------------*/ 00132 00133 SIMAGEPTR set_first_element_in_base_image_list(SIMAGEPTR *newfirst); 00134 00135 /*----------------------------------------------------------------------------------------------------------*/ 00136 00137 SIMAGEPTR create_base_image_list(char* labels[], char *images[], int max); 00138 00139 /*----------------------------------------------------------------------------------------------------------*/ 00140 00141 SIMAGEPTR create_new_base_image(char *label, char *file_name); 00142 00143 /*----------------------------------------------------------------------------------------------------------*/ 00144 00145 SIMAGEPTR add_element_to_base_image_list(SIMAGEPTR *image); 00146 00147 /*----------------------------------------------------------------------------------------------------------*/ 00148 00149 SIMAGEPTR remove_element_from_base_image_list(char *label); 00150 00151 /*----------------------------------------------------------------------------------------------------------*/ 00152 00153 SIMAGEPTR search_base_image_list_for_element(char *label); 00154 00155 /*----------------------------------------------------------------------------------------------------------*/ 00156 00157 _Bool empty_base_image_list(SIMAGEPTR firstptr); 00158 00159 /*----------------------------------------------------------------------------------------------------------*/ 00160 00161 SIMAGEPTR create_new_image_list(char *labels[], int max); 00162 00163 /*----------------------------------------------------------------------------------------------------------*/ 00164 00165 SIMAGEPTR create_new_image(char *label); 00166 00167 /*----------------------------------------------------------------------------------------------------------*/ 00168 00169 SIMAGEPTR add_element_to_image_list(SIMAGEPTR *ifirstptr, SIMAGEPTR *image); 00170 00171 /*----------------------------------------------------------------------------------------------------------*/ 00172 00173 SIMAGEPTR remove_element_from_image_list(SIMAGEPTR *ifirstptr, char *label); 00174 00175 /*----------------------------------------------------------------------------------------------------------*/ 00176 00177 SIMAGEPTR search_image_list_for_element(SIMAGEPTR *ifirstptr, char *label); 00178 00179 /*----------------------------------------------------------------------------------------------------------*/ 00180 00181 _Bool empty_image_list(SIMAGEPTR firstptr); 00182 00183 /*----------------------------------------------------------------------------------------------------------*/ 00184 00185 SDATAXPTR create_new_datax_list(char *labels[], char *types[], void *data[], int max); 00186 00187 /*----------------------------------------------------------------------------------------------------------*/ 00188 00189 SDATAXPTR create_new_datax(char *label, char *type, void *data); 00190 00191 /*----------------------------------------------------------------------------------------------------------*/ 00192 00193 SDATAXPTR add_element_to_datax_list(SDATAXPTR *dfirstptr, SDATAXPTR *datax); 00194 00195 /*----------------------------------------------------------------------------------------------------------*/ 00196 00197 SDATAXPTR remove_element_from_datax_list(SDATAXPTR *dfirstptr, char *label); 00198 00199 /*----------------------------------------------------------------------------------------------------------*/ 00200 00201 SDATAXPTR search_datax_list_for_element(SDATAXPTR *dfirstptr, char *label); 00202 00203 /*----------------------------------------------------------------------------------------------------------*/ 00204 00205 _Bool empty_datax_list(SDATAXPTR firstptr); 00206 00207 /*----------------------------------------------------------------------------------------------------------*/ 00208 00209 // /** 00210 // *@} 00211 // */