6 extern unsigned char far* dbuffer;
8 //copy 16x16 tile to dest, loop unrolled 4 times
9 void putile(unsigned char far* dest, unsigned char far* source);
31 int tilecreate(tile *ntile, int frames) {
35 ntile->numimages = frames;
38 for(i=0; i<frames; i++) {
39 ntile->images[i] = (unsigned char far*)_fmalloc(256);
47 void tileclose(tile *dtile) {
48 int i; // loop counter
50 for(i=0; i<dtile->numimages; i++)
51 _ffree(dtile->images[i]);
54 void tileload (tile * in) {
55 unsigned char far* dest;
56 unsigned char far* source;
57 int x_loc = 0, y_loc = 0; //frame coordinates in dbuffer
58 int i,j; //loop counters
60 for(i=0; i < in->numimages; i++) {
66 source = dbuffer + ((y_loc * 320) + x_loc);
68 for(j=0; j < 16; j++) {
69 _fmemcpy(dest,source,16);
77 writetile(tile *out, unsigned char far* dest) {
78 unsigned char far* source;
80 dest += ((out->y_loc << 8) + (out->y_loc << 6) + out->x_loc);
81 source = out->images[out->curimage];
88 int writetile_xclip(tile *out, unsigned char far* dest) {
89 int dx; //clipped starting x location
90 int dwidth; //clipped width of sprite
93 unsigned char far * source = out->images[out->curimage];
97 if(out->x_loc > -16) {
99 // preclip = - out->x_loc;
100 source -= out->x_loc;
101 dwidth = 16 + out->x_loc;
104 return 0; //tile not visible
106 else if(out->x_loc > 303) {
107 if(out->x_loc < 320) {
113 return 0; //tile not visible
122 dest= dest + (out->y_loc << 8) + (out->y_loc << 6) + dx; //find first pixel in dest
124 for(i = 0; i < 16; i++) {
125 _fmemcpy(dest,source,dwidth);
131 // x_dim_clip = dwidth;
136 /* not sure if this is working
137 ***********************************************************
138 sprite::writetile_prexclip(unsigned char far* dest) {
139 int dwidth = x_dim_clip;
140 unsigned char far * source = images[curimage];
143 dest= dest + (y_loc << 8) + (y_loc << 6) + x_clip; //find first pixel in dest
144 source += preclip; //set source at first visible pixel
146 for(i = 0; i < 16; i++) {
147 _fmemcpy(dest,source,dwidth);
152 ***************************************************************/