From: Drizzle Newsgroups: comp.os.msdos.djgpp Subject: Blit Sprite w/ out destroying background.. Date: Wed, 04 Mar 1998 21:25:56 -0600 Organization: AT&T WorldNet Services Lines: 204 Message-ID: <6dl5vh$9nc@bgtnsc03.worldnet.att.net> NNTP-Posting-Host: 12.66.101.245 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Using allegro I'm trying to make/use a Sprite_Under, And Erase_Sprite to display a sprite without having to redraw the background.. I've spent hours trying different source code from different sources trying to get them to work with DJGPP, and Allegro.. If anyone can help, please do.. The following code is just from an example program i'm making to try to get these working, sprite.h is just a header file for a spare datafile with a few rle sprites in it.. using allegro for graphics functions(draw sprite, set screen resolution).. Thanks in Advance.. #include #include #include #include #include "sprite.h" #define sprite_width 32 #define sprite_height 32 BITMAP *buffer; BITMAP *backdrop; DATAFILE *datafile=NULL; typedef struct sprite_type { int state; unsigned x, y; /* location */ unsigned x_vel, y_vel; /* velocity */ char width, height; /* dimensions */ char num_frames; /* number of frames */ char cur_frame; /* current frame */ char *background, **frame; } sprite, *sprite_ptr; /****************************************************************/ void Sprite_Erase(sprite_ptr sprite,unsigned char *buffer) { // replace the background that was behind the sprite // this function replaces the background that was saved from where a sprite // was going to be placed unsigned char *back_buffer; // background buffer for sprite int y, // current line being scanned width, // size of sprite height; // alias a pointer to sprite background for ease of access back_buffer = sprite->background; // alias width and height width = sprite->width; height = sprite->height; // compute offset in destination buffer buffer = buffer + (sprite->y << 8) + (sprite->y << 6) + sprite->x; for (y=0; ybackground; // alias width and height width = sprite->width; height = sprite->height; // compute offset of background in source buffer buffer = buffer + (sprite->y << 8) + (sprite->y << 6) + sprite->x; for (y=0; y