home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
- #include <stdlib.h>
- #include <dos.h>
- #include "ar256h.cpp"
- #include "ar256def.h"
- #include "ar256ex.h"
-
- // this file has the functions that glide the monster tiles about.
- extern int SLIDE;
-
- drawjustland(char,char,char,char);
- spritepath(int,int,int,int,unsigned char *);
- drawjustframe(int,int,unsigned char *);
-
-
-
-
- drawjustland(char tilex,char tiley,char centrex,char centrey)
- {
- if(!SLIDE)return(0);
- int i,nx,ny,px,py;char mtile; //nx,ny are toplefts pix
-
- nx=((signed char)tilex-centrex+7)*32;ny=((signed char)tiley-centrey+7)*32;
-
- if((tilex>=width)||(tiley>=height)||(tilex<0)||(tiley<0))//if off map dont draw. You'd think it'd wrap and be always false but it DOESNT.
- {
- setfillstyle(1,0xd3);
- bar(nx,ny,nx+31,ny+31);
- return(1);
- }
- setfillstyle(1,2);
-
- bar(nx,ny,nx+31,ny+31);
-
- if(sq[tilex][tiley].land)
- {
-
-
- if(sq[tilex][tiley].land>9)
- {
- for (i=0;i<0x400;++i) //draw ballz
- {
- px=nx+(i % 32);py=ny+(i / 32);
- if (ball[sq[tilex][tiley].land-10][i] != 0xff) putpixel(px,py,ball[sq[tilex][tiley].land-10][i]);
- if (ball[sq[tilex][tiley].land-10][i] == 247) putpixel(px,py,247+sq[tilex][tiley].whose);
- }
-
- }
-
- else
- {
- for (i=0;i<0x400;++i) //draw trees craters etc etc
- {
- px=nx+(i % 32);py=ny+(i / 32);
- if (terrt[sq[tilex][tiley].land-1][i] != 0xff) putpixel(px,py,terrt[sq[tilex][tiley].land-1][i]);
- }
- }
-
- }
-
- return(0);
-
- }
-
-
- spritepath(int ax,int ay,int bx, int by, unsigned char *thistile)
-
- {
- if(!SLIDE)return(0);
- void *background=malloc(0x440);//64 extra bytes in case.
- signed int xdiff,ydiff;
- float xstep,ystep,x,y;
- int i;
- x=ax;y=ay;
- xdiff=bx-ax;
- ydiff=by-ay;
- xstep=(float)xdiff/16;
- ystep=(float)ydiff/16;
-
- getimage(x,y,x+32,y+32,background);
-
-
- for(i=0;i<16;++i)
- {
-
-
- drawjustframe(x,y,thistile);
- if((x<16)||(x>464)||(y<16)||(y>464))continue;// I dont see why it should ever go off the map bu just in case...
- delay(17);
- putimage(x,y,background,0);
- getimage(x+xstep,y+ystep,x+xstep+32,y+ystep+32,background);
- x+=xstep;y+=ystep;
- }
-
- free(background);
- }
-
- drawjustframe(int x, int y, unsigned char *thistile)
- {
- int i,px,py;
-
- if(!(curpla%2)) //flip if even player.
- {
-
- for(i=0;i<0x400;++i)
- {
- px=x+(i%32);py=y+(i/32);
- if(thistile[i]<254)putpixel(px,py,thistile[i]);
- if(thistile[i]==254)putpixel(px,py,pcol[curpla]);
- }
- }
- else
- {
- for(i=0;i<0x400;++i)
- {
- px=x+32-(i%32);py=y+(i/32);
- if(thistile[i]<254)putpixel(px,py,thistile[i]);
- if(thistile[i]==254)putpixel(px,py,pcol[curpla]);
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-