- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# sprites.c

Go to the documentation of this file.

    00001
    00006 //    /**
    00007 //      *@defgroup sprites sprites.c
    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 #ifndef _ALLEGRO5_
    00016 #define _ALLEGRO5_
    00017 #include <allegro5/allegro5.h>
    00018 #endif // _ALLEGRO5_
    00019
    00020 #ifndef _ALLEGRO5IMAGE_
    00021 #define _ALLEGRO5IMAGE_
    00022 #include <allegro5/allegro_image.h>
    00023 #endif // _ALLEGRO5IMAGE_
    00024
    00025 #ifndef _CHIPMUNK_
    00026 #define _CHIPMUNK_
    00027 #include "chipmunk.h"
    00028 #endif // _CHIPMUNK_
    00029
    00030 #ifndef _SPRITES_
    00031 #define _SPRITES_
    00032 #include "../include/sprites.h"
    00033 #endif // _SPRITES_
    00034
    00035 /*----------------------------------------------------------------------------------------------------------*/
    00036
    00037 // A pointer to the first sprite in the SPRITE structure linked list
    00038 static SPRITESPTR sfirstptr = NULL;
    00039
    00040 /*----------------------------------------------------------------------------------------------------------*/
    00041
    00042 // A pointer to the first base image in the SIMAGE structure linked list
    00043 static SIMAGEPTR bifirstptr = NULL;
    00044
    00045 /*----------------------------------------------------------------------------------------------------------*/
    00046
    00047 // Returns the first image in the base image list
    00048 SIMAGEPTR get_first_element_from_base_image_list(void)
    00049 {
    00050     return bifirstptr;
    00051 }
    00052
    00053 /*----------------------------------------------------------------------------------------------------------*/
    00054
    00055 // Sets the first image in the base image list
    00056 // Should never be used, only here for internal use
    00057 SIMAGEPTR set_first_element_in_base_image_list(SIMAGEPTR *newfirst)
    00058 {
    00059     bifirstptr = *newfirst;
    00060     return bifirstptr;
    00061 }
    00062
    00063 /*----------------------------------------------------------------------------------------------------------*/
    00064
    00065 // Creates a new base image list, which cannot be modified after created
    00066 // TODO: make sure the list cannot be modified after creation
    00067 SIMAGEPTR create_base_image_list(char* labels[], char *images[], int max)
    00068 {
    00069     SIMAGEPTR newptr, ifirstptr = NULL;
    00070     int i;
    00071
    00072     for(i = 0; i < max; i++)
    00073     {
    00074         if((newptr = create_new_base_image(labels[i], images[i])) == NULL) return NULL;
    00075         add_element_to_image_list(&ifirstptr, &newptr);
    00076     }
    00077     bifirstptr = ifirstptr;
    00078     return bifirstptr;
    00079 }
    00080
    00081 /*----------------------------------------------------------------------------------------------------------*/
    00082
    00083 // Creates a new base image to be added to the base image list
    00084 SIMAGEPTR create_new_base_image(char *label, char *file_name)
    00085 {
    00086     SIMAGEPTR newptr;
    00087     newptr = (SIMAGEPTR)malloc(sizeof(SIMAGE));
    00088     if(newptr == NULL) return NULL;
    00089     newptr->ilabel = label;
    00090     newptr->image = al_load_png(file_name);
    00091     newptr->width = al_get_bitmap_width(newptr->image);
    00092     newptr->height = al_get_bitmap_height(newptr->image);
    00093     newptr->nextimage = NULL;
    00094     newptr->previmage = NULL;
    00095     return newptr;
    00096 }
    00097
    00098 /*----------------------------------------------------------------------------------------------------------*/
    00099
    00100 // Adds an image to the base image list
    00101 SIMAGEPTR add_element_to_base_image_list(SIMAGEPTR *image)
    00102 {
    00103     return add_element_to_image_list(&bifirstptr, image);
    00104 }
    00105
    00106 /*----------------------------------------------------------------------------------------------------------*/
    00107
    00108 // Removes an image from the base image list
    00109 SIMAGEPTR remove_element_from_base_image_list(char *label)
    00110 {
    00111     SIMAGEPTR currentptr = NULL;
    00112     currentptr = remove_element_from_image_list(&bifirstptr, label);
    00113     if(currentptr == NULL) return NULL;
    00114     return bifirstptr;
    00115 }
    00116
    00117 /*----------------------------------------------------------------------------------------------------------*/
    00118
    00119 // Searches the base image list for the specified image with the corresponding label
    00120 SIMAGEPTR search_base_image_list_for_element(char *label)
    00121 {
    00122     return search_image_list_for_element(&bifirstptr, label);
    00123 }
    00124
    00125 /*----------------------------------------------------------------------------------------------------------*/
    00126
    00127 // Empties the list, used only before exiting the program
    00128 _Bool empty_base_image_list(SIMAGEPTR firstptr)
    00129 {
    00130     SIMAGEPTR currentptr = firstptr;
    00131     if(firstptr != bifirstptr) return false;
    00132     if(firstptr == NULL) return false;
    00133     if(firstptr->nextimage == firstptr && firstptr->previmage == firstptr)
    00134     {
    00135         free(firstptr);
    00136         firstptr = NULL;
    00137     }
    00138     else if(firstptr->nextimage == firstptr->previmage)
    00139     {
    00140         currentptr = currentptr->nextimage;
    00141         free(firstptr);
    00142         free(currentptr);
    00143         firstptr = NULL;
    00144     }
    00145     else
    00146     {
    00147         currentptr = currentptr->nextimage;
    00148         firstptr->previmage->nextimage = NULL;
    00149         currentptr->previmage = NULL;
    00150         al_destroy_bitmap(firstptr->image);
    00151         free(firstptr);
    00152         firstptr = currentptr;
    00153
    00154         while(currentptr != NULL)
    00155         {
    00156             currentptr = currentptr->nextimage;
    00157             al_destroy_bitmap(firstptr->image);
    00158             free(firstptr);
    00159             firstptr = currentptr;
    00160         }
    00161         firstptr = NULL;
    00162         bifirstptr = NULL;
    00163     }
    00164     return true;
    00165 }
    00166
    00167 /*----------------------------------------------------------------------------------------------------------*/
    00168
    00169 // Creates a new image list to be used with the SPRITE structure, images are grabbed (i.e. pointers)
    00170 // from the base image list, the base image list must not be empty
    00171 SIMAGEPTR create_new_image_list(char *labels[], int max)
    00172 {
    00173     SIMAGEPTR newptr, ifirstptr = NULL;
    00174     int i;
    00175     for(i = 0; i < max; i++)
    00176     {
    00177         if((newptr = create_new_image(labels[i])) == NULL) return NULL;
    00178         add_element_to_image_list(&ifirstptr, &newptr);
    00179     }
    00180     return ifirstptr;
    00181 }
    00182
    00183 /*----------------------------------------------------------------------------------------------------------*/
    00184
    00185 // A new image is created using a bitmap from the base image list
    00186 SIMAGEPTR create_new_image(char *label)
    00187 {
    00188     SIMAGEPTR newptr, currentptr;
    00189     newptr = (SIMAGEPTR)malloc(sizeof(SIMAGE));
    00190     if((currentptr = search_base_image_list_for_element(label)) == NULL) return NULL;
    00191     newptr->ilabel = currentptr->ilabel;
    00192     newptr->image = currentptr->image;
    00193     newptr->width = currentptr->width;
    00194     newptr->height = currentptr->height;
    00195     newptr->nextimage = NULL;
    00196     newptr->previmage = NULL;
    00197     return newptr;
    00198 }
    00199
    00200 /*----------------------------------------------------------------------------------------------------------*/
    00201
    00202 // Adds the specified SIMAGE struct to the specified image list
    00203 SIMAGEPTR add_element_to_image_list(SIMAGEPTR *ifirstptr, SIMAGEPTR *image)
    00204 {
    00205     SIMAGEPTR currentptr;
    00206     if(*ifirstptr != NULL)
    00207     {
    00208         currentptr = (*ifirstptr)->previmage;
    00209         currentptr->nextimage = *image;
    00210         (*image)->previmage = currentptr;
    00211         (*ifirstptr)->previmage = *image;
    00212         (*image)->nextimage = *ifirstptr;
    00213     }
    00214     else
    00215     {
    00216         *ifirstptr = *image;
    00217         (*image)->nextimage = *image;
    00218         (*image)->previmage = *image;
    00219     }
    00220     return *ifirstptr;
    00221 }
    00222
    00223 /*----------------------------------------------------------------------------------------------------------*/
    00224
    00225 // Removes the specified struct from the specified image list
    00226 SIMAGEPTR remove_element_from_image_list(SIMAGEPTR *ifirstptr, char *label)
    00227 {
    00228     SIMAGEPTR currentptr = *ifirstptr;
    00229     if(currentptr == NULL) return NULL;
    00230     if((currentptr = search_image_list_for_element(ifirstptr, label)) == NULL) return *ifirstptr;
    00231     currentptr->nextimage->previmage = currentptr->previmage;
    00232     currentptr->previmage->nextimage = currentptr->nextimage;
    00233     if(currentptr == *ifirstptr)
    00234         *ifirstptr = currentptr->nextimage;
    00235     free(currentptr);
    00236     return *ifirstptr;
    00237 }
    00238
    00239 /*----------------------------------------------------------------------------------------------------------*/
    00240
    00241 // Searches the specified list for the SIMAGE with the given label
    00242 SIMAGEPTR search_image_list_for_element(SIMAGEPTR *ifirstptr, char *label)
    00243 {
    00244     SIMAGEPTR currentptri = *ifirstptr;
    00245     if(currentptri == NULL) return NULL;
    00246     do
    00247     {
    00248         if(strcmp(currentptri->ilabel, label) == 0) break;
    00249         currentptri = currentptri->nextimage;
    00250     } while(currentptri != *ifirstptr);
    00251     if(strcmp(currentptri->ilabel, label) != 0) return NULL;
    00252     return currentptri;
    00253 }
    00254
    00255 /*----------------------------------------------------------------------------------------------------------*/
    00256
    00257 // Empties an image list
    00258 _Bool empty_image_list(SIMAGEPTR firstptr)
    00259 {
    00260     SIMAGEPTR currentptr = firstptr;
    00261     if(firstptr == NULL) return false;
    00262     if(firstptr->nextimage == firstptr && firstptr->previmage == firstptr)
    00263     {
    00264         free(firstptr);
    00265         firstptr = NULL;
    00266     }
    00267     else if(firstptr->nextimage == firstptr->previmage)
    00268     {
    00269         currentptr = currentptr->nextimage;
    00270         free(firstptr);
    00271         free(currentptr);
    00272         firstptr = NULL;
    00273     }
    00274     else
    00275     {
    00276         currentptr = currentptr->nextimage;
    00277         firstptr->previmage->nextimage = NULL;
    00278         currentptr->previmage = NULL;
    00279         free(firstptr);
    00280         firstptr = currentptr;
    00281
    00282         while(currentptr != NULL)
    00283         {
    00284             currentptr = currentptr->nextimage;
    00285             free(firstptr);
    00286             firstptr = currentptr;
    00287         }
    00288         firstptr = NULL;
    00289     }
    00290     return true;
    00291 }
    00292
    00293 /*----------------------------------------------------------------------------------------------------------*/
    00294
    00295 SDATAXPTR create_new_datax_list(char *labels[], char *types[], void *data[], int max)
    00296 {
    00297     SDATAXPTR newptr, dfirstptr = NULL;
    00298     int i;
    00299     for(i = 0; i < max; i++)
    00300     {
    00301         newptr = create_new_datax(labels[i], types[i], data[i]);
    00302         add_element_to_datax_list(&dfirstptr, &newptr);
    00303     }
    00304     return dfirstptr;
    00305 }
    00306
    00307 /*----------------------------------------------------------------------------------------------------------*/
    00308
    00309 SDATAXPTR create_new_datax(char *label, char *type, void *data)
    00310 {
    00311     SDATAXPTR newptr;
    00312     if((newptr = (SDATAXPTR)malloc(sizeof(SDATAX))) == NULL) return NULL;
    00313     newptr->dlabel = label;
    00314     newptr->dtype = type;
    00315     newptr->data = data;
    00316     return newptr;
    00317 }
    00318
    00319 /*----------------------------------------------------------------------------------------------------------*/
    00320
    00321 SDATAXPTR add_element_to_datax_list(SDATAXPTR *dfirstptr, SDATAXPTR *datax)
    00322 {
    00323     SDATAXPTR currentptr;
    00324     if(*dfirstptr != NULL)
    00325     {
    00326         currentptr = (*dfirstptr)->prevdata;
    00327         currentptr->nextdata = *datax;
    00328         (*datax)->prevdata = currentptr;
    00329         (*dfirstptr)->prevdata = *datax;
    00330         (*datax)->nextdata = *dfirstptr;
    00331     }
    00332     else
    00333     {
    00334         *dfirstptr = *datax;
    00335         (*datax)->nextdata = *datax;
    00336         (*datax)->prevdata = *datax;
    00337     }
    00338     return *dfirstptr;
    00339 }
    00340
    00341 /*----------------------------------------------------------------------------------------------------------*/
    00342
    00343 SDATAXPTR remove_element_from_datax_list(SDATAXPTR *dfirstptr, char *label)
    00344 {
    00345     SDATAXPTR currentptr = *dfirstptr;
    00346     if(currentptr == NULL) return NULL;
    00347     if((currentptr = search_datax_list_for_element(dfirstptr, label)) == NULL) return *dfirstptr;
    00348     currentptr->nextdata->prevdata = currentptr->prevdata;
    00349     currentptr->prevdata->nextdata = currentptr->nextdata;
    00350     if(currentptr == *dfirstptr)
    00351         *dfirstptr = currentptr->nextdata;
    00352     free(currentptr);
    00353     return *dfirstptr;
    00354 }
    00355
    00356 /*----------------------------------------------------------------------------------------------------------*/
    00357
    00358 SDATAXPTR search_datax_list_for_element(SDATAXPTR *dfirstptr, char *label)
    00359 {
    00360     SDATAXPTR currentptr = *dfirstptr;
    00361     if(currentptr == NULL) return NULL;
    00362     do
    00363     {
    00364         if(strcmp(currentptr->dlabel, label) == 0) break;
    00365         currentptr = currentptr->nextdata;
    00366     } while(currentptr != *dfirstptr);
    00367     if(strcmp(currentptr->dlabel, label) != 0) return NULL;
    00368     return currentptr;
    00369 }
    00370
    00371 /*----------------------------------------------------------------------------------------------------------*/
    00372
    00373 _Bool empty_datax_list(SDATAXPTR firstptr)
    00374 {
    00375     SDATAXPTR currentptr = firstptr;
    00376     if(firstptr == NULL) return false;
    00377     if(firstptr->nextdata == firstptr && firstptr->prevdata == firstptr)
    00378     {
    00379         free(firstptr);
    00380         firstptr = NULL;
    00381     }
    00382     else if(firstptr->nextdata == firstptr->prevdata)
    00383     {
    00384         currentptr = currentptr->nextdata;
    00385         free(firstptr);
    00386         free(currentptr);
    00387         firstptr = NULL;
    00388     }
    00389     else
    00390     {
    00391         currentptr = currentptr->nextdata;
    00392         firstptr->prevdata->nextdata = NULL;
    00393         currentptr->prevdata = NULL;
    00394         free(firstptr);
    00395         firstptr = currentptr;
    00396
    00397         while(currentptr != NULL)
    00398         {
    00399             currentptr = currentptr->nextdata;
    00400             free(firstptr);
    00401             firstptr = currentptr;
    00402         }
    00403         firstptr = NULL;
    00404     }
    00405     return true;
    00406 }
    00407
    00408 /*----------------------------------------------------------------------------------------------------------*/
    00409
    00410 SPRITESPTR get_first_element_from_sprite_list(void)
    00411 {
    00412     return sfirstptr;
    00413 }
    00414
    00415 /*----------------------------------------------------------------------------------------------------------*/
    00416
    00417 SPRITESPTR set_first_element_in_sprite_list(SPRITESPTR *newfirst)
    00418 {
    00419     sfirstptr = *newfirst;
    00420     return sfirstptr;
    00421 }
    00422
    00423 /*----------------------------------------------------------------------------------------------------------*/
    00424
    00425 SPRITESPTR create_new_sprite(char *label, char *imagelabels[], int num_images,
    00426                              char *datalabels[], char *datatypes[], void *data[],
    00427                              int num_data, char *currentimg, float x, float y,
    00428                              float dx, float dy, int anim_counter, ANIMATION animflags,
    00429                              _Bool add_to_list)
    00430 {
    00431     SPRITESPTR newptr;
    00432
    00433     if((newptr = (SPRITESPTR)malloc(sizeof(SPRITES))) == NULL) return NULL;
    00434     newptr->slabel = label;
    00435     newptr->ifirstptr = create_new_image_list(imagelabels, num_images);
    00436     newptr->dfirstptr = create_new_datax_list(datalabels, datatypes, data, num_data);
    00437     newptr->sdata.currentimg = (search_image_list_for_element(&(newptr->ifirstptr), currentimg));
    00438     newptr->sdata.x = x;
    00439     newptr->sdata.y = y;
    00440     newptr->sdata.dx = dx;
    00441     newptr->sdata.dy = dy;
    00442     newptr->sdata.anim_counter = anim_counter;
    00443     newptr->sdata.animflags = animflags;
    00444
    00445     if(add_to_list)
    00446         add_element_to_sprite_list(&newptr);
    00447     return newptr;
    00448 }
    00449
    00450 /*----------------------------------------------------------------------------------------------------------*/
    00451
    00452 SPRITESPTR add_element_to_sprite_list(SPRITESPTR *sprite)
    00453 {
    00454     SPRITESPTR currentptr;
    00455     if(sfirstptr == NULL)
    00456     {
    00457         sfirstptr = *sprite;
    00458         (*sprite)->nextsprite = *sprite;
    00459         (*sprite)->prevsprite = *sprite;
    00460     }
    00461     else
    00462     {
    00463         currentptr = sfirstptr->prevsprite;
    00464         currentptr->nextsprite = *sprite;
    00465         (*sprite)->prevsprite = currentptr;
    00466         sfirstptr->prevsprite = *sprite;
    00467         (*sprite)->nextsprite = sfirstptr;
    00468     }
    00469     return sfirstptr;
    00470 }
    00471
    00472 /*----------------------------------------------------------------------------------------------------------*/
    00473
    00474 SPRITESPTR remove_element_from_sprite_list(char *label)
    00475 {
    00476     SPRITESPTR currentptr;
    00477     currentptr = sfirstptr;
    00478     if(currentptr == NULL || sfirstptr == NULL) return NULL;
    00479     if((currentptr = search_sprite_list_for_element(label)) == NULL) return sfirstptr;
    00480     currentptr->nextsprite->prevsprite = currentptr->prevsprite;
    00481     currentptr->prevsprite->nextsprite = currentptr->nextsprite;
    00482     if(currentptr == sfirstptr)
    00483         sfirstptr = currentptr->nextsprite;
    00484     free(currentptr);
    00485     return sfirstptr;
    00486 }
    00487
    00488 /*----------------------------------------------------------------------------------------------------------*/
    00489
    00490 SPRITESPTR remove_element_from_sprite_list_ptr(SPRITESPTR sprite)
    00491 {
    00492     SPRITESPTR currentptr;
    00493     currentptr = sfirstptr;
    00494     if(currentptr == NULL || sfirstptr == NULL) return NULL;
    00495     if((currentptr = sprite) == NULL) return sfirstptr;
    00496     currentptr->nextsprite->prevsprite = currentptr->prevsprite;
    00497     currentptr->prevsprite->nextsprite = currentptr->nextsprite;
    00498     if(currentptr == sfirstptr)
    00499         sfirstptr = currentptr->nextsprite;
    00500     free(currentptr);
    00501     return sfirstptr;
    00502 }
    00503
    00504 /*----------------------------------------------------------------------------------------------------------*/
    00505
    00506 SPRITESPTR search_sprite_list_for_element(char *label)
    00507 {
    00508     SPRITESPTR currentptr = sfirstptr;
    00509     if(currentptr == NULL) return NULL;
    00510     do
    00511     {
    00512         if(strcmp(currentptr->slabel, label) == 0) break;
    00513         currentptr = currentptr->nextsprite;
    00514     } while(currentptr != sfirstptr);
    00515     if(strcmp(currentptr->slabel, label) != 0) return NULL;
    00516     return currentptr;
    00517 }
    00518
    00519 /*----------------------------------------------------------------------------------------------------------*/
    00520
    00521 _Bool empty_sprite_list(SPRITESPTR firstptr)
    00522 {
    00523     SPRITESPTR currentptr = firstptr;
    00524     if(firstptr == NULL) return false;
    00525     if(firstptr->nextsprite == firstptr && firstptr->prevsprite == firstptr)
    00526     {
    00527         free(firstptr);
    00528         firstptr = NULL;
    00529     }
    00530     else if(firstptr->nextsprite == firstptr->prevsprite)
    00531     {
    00532         currentptr = currentptr->nextsprite;
    00533         free(firstptr);
    00534         free(currentptr);
    00535         firstptr = NULL;
    00536     }
    00537     else
    00538     {
    00539         currentptr = currentptr->nextsprite;
    00540         firstptr->prevsprite->nextsprite = NULL;
    00541         currentptr->prevsprite = NULL;
    00542         empty_image_list(firstptr->ifirstptr);
    00543         empty_datax_list(firstptr->dfirstptr);
    00544         free(firstptr);
    00545         firstptr = currentptr;
    00546
    00547         while(currentptr != NULL)
    00548         {
    00549             currentptr = currentptr->nextsprite;
    00550             empty_image_list(firstptr->ifirstptr);
    00551             empty_datax_list(firstptr->dfirstptr);
    00552             free(firstptr);
    00553             firstptr = currentptr;
    00554         }
    00555         firstptr = NULL;
    00556     }
    00557      return true;
    00558 }
    00559
    00560 /*----------------------------------------------------------------------------------------------------------*/
    00561
    00562 SPRITESPTR set_anim_flags_on_sprite(SPRITESPTR sprite, ANIMATION nflags)
    00563 {
    00564     if((nflags & MLEFT))
    00565         sprite->sdata.animflags |= MLEFT;
    00566     if((nflags & MRIGHT))
    00567         sprite->sdata.animflags |= MRIGHT;
    00568     if((nflags & MUP))
    00569         sprite->sdata.animflags |= MUP;
    00570     if((nflags & MDOWN))
    00571         sprite->sdata.animflags |= MDOWN;
    00572     if((nflags & MATTACK))
    00573         sprite->sdata.animflags |= MATTACK;
    00574     if((nflags & MDAMAGED))
    00575         sprite->sdata.animflags |= MDAMAGED;
    00576     if((nflags & MRECOVER))
    00577         sprite->sdata.animflags |= MRECOVER;
    00578     if((nflags & MNONE))
    00579         sprite->sdata.animflags |= MNONE;
    00580     return sprite;
    00581 }
    00582
    00583 /*----------------------------------------------------------------------------------------------------------*/
    00584
    00585 SPRITESPTR remove_anim_flags_on_sprite(SPRITESPTR sprite, ANIMATION nflags)
    00586 {
    00587     if((nflags & MLEFT))
    00588         sprite->sdata.animflags &= ~MLEFT;
    00589     if((nflags & MRIGHT))
    00590         sprite->sdata.animflags &= ~MRIGHT;
    00591     if((nflags & MUP))
    00592         sprite->sdata.animflags &= ~MUP;
    00593     if((nflags & MDOWN))
    00594         sprite->sdata.animflags &= ~MDOWN;
    00595     if((nflags & MATTACK))
    00596         sprite->sdata.animflags &= ~MATTACK;
    00597     if((nflags & MDAMAGED))
    00598         sprite->sdata.animflags &= ~MDAMAGED;
    00599     if((nflags & MRECOVER))
    00600         sprite->sdata.animflags &= ~MRECOVER;
    00601     if((nflags & MNONE))
    00602         sprite->sdata.animflags &= ~MNONE;
    00603     return sprite;
    00604 }
    00605
    00606 /*----------------------------------------------------------------------------------------------------------*/
    00607
    00608 SPRITESPTR remove_anim_flags_on_sprite_list(SPRITESPTR firstptr, ANIMATION nflags)
    00609 {
    00610     SPRITESPTR currentptr = firstptr;
    00611     do
    00612     {
    00613         remove_anim_flags_on_sprite(currentptr, nflags);
    00614         currentptr = currentptr->nextsprite;
    00615     } while(currentptr != firstptr);
    00616     return firstptr;
    00617 }
    00618
    00619 /*----------------------------------------------------------------------------------------------------------*/
    00620
    00621 SPRITESPTR clear_anim_flags_on_sprite(SPRITESPTR sprite)
    00622 {
    00623     remove_anim_flags_on_sprite(sprite, MLEFT | MRIGHT | MATTACK | MUP | MDOWN | MDAMAGED | MRECOVER | MNONE);
    00624     set_anim_flags_on_sprite(sprite, MNONE);
    00625     return sprite;
    00626 }
    00627
    00628 /*----------------------------------------------------------------------------------------------------------*/
    00629
    00630 SPRITESPTR clear_anim_flags_on_sprite_list(SPRITESPTR firstptr)
    00631 {
    00632     SPRITESPTR currentptr = firstptr;
    00633     do
    00634     {
    00635         clear_anim_flags_on_sprite(currentptr);
    00636         set_anim_flags_on_sprite(currentptr, MNONE);
    00637         currentptr = currentptr->nextsprite;
    00638     } while(currentptr != firstptr);
    00639     return firstptr;
    00640 }
    00641
    00642 /*----------------------------------------------------------------------------------------------------------*/
    00643
    00644 //    /**
    00645 //      *@}
    00646 //      */