home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume18
/
xmpb
/
part07
/
do_stars.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-12
|
2KB
|
81 lines
/* do_stars.c - *** */
#if !defined(lint)
static char sccs_id[] = "@(#)do_stars.c 1.9 93/04/22 XMPB";
#endif
#include "player.h"
do_stars(w)
winptr w;
{
int i;
for(i=0;i<STARSPERPLANE;i++)
{
w->stars1[i].lx = w->stars1[i].x;
w->stars1[i].ly = w->stars1[i].y;
w->stars2[i].lx = w->stars2[i].x;
w->stars2[i].ly = w->stars2[i].y;
w->stars1[i].x -= w->xv/49152;
w->stars1[i].y += w->yv/49152;
w->stars1[i].x = (w->stars1[i].x+PLAYW)%PLAYW;
w->stars1[i].y = (w->stars1[i].y+PLAYH)%PLAYH;
w->stars2[i].x -= w->xv/32768;
w->stars2[i].y += w->yv/32768;
w->stars2[i].x = (w->stars2[i].x+PLAYW)%PLAYW;
w->stars2[i].y = (w->stars2[i].y+PLAYH)%PLAYH;
}
}
draw_stars(w)
winptr w;
{
int i;
for(i=0;i<STARSPERPLANE;i++)
{
XCopyPlane(w->theDisplay,(w->stars1[i].pm->spm),w->back_buffer,w->bbgc,0,0,w->stars1[i].pm->w,w->stars1[i].pm->h,w->stars1[i].x+OFFSET,w->stars1[i].y+OFFSET,1);
XCopyPlane(w->theDisplay,(w->stars2[i].pm->spm),w->back_buffer,w->bbgc,0,0,w->stars2[i].pm->w,w->stars2[i].pm->h,w->stars2[i].x+OFFSET,w->stars2[i].y+OFFSET,1);
/*
XDrawPoint(w->theDisplay,w->back_buffer,w->bbgc,w->stars1[i].x,w->stars1[i].y);
XDrawPoint(w->theDisplay,w->back_buffer,w->bbgc,w->stars2[i].x,w->stars2[i].y);
*/
XFlush(w->theDisplay);
}
}
draw_last_stars(w)
winptr w;
{
int i;
for(i=0;i<STARSPERPLANE;i++)
{
XCopyPlane(w->theDisplay,(w->stars1[i].pm->spm),w->theWindow,w->theGC,0,0,w->stars1[i].pm->w,w->stars1[i].pm->h,w->stars1[i].lx,w->stars1[i].ly,1);
XCopyPlane(w->theDisplay,(w->stars2[i].pm->spm),w->theWindow,w->theGC,0,0,w->stars2[i].pm->w,w->stars2[i].pm->h,w->stars2[i].lx,w->stars2[i].ly,1);
}
}
init_stars(w)
winptr w;
{
int i;
int c;
for(i=0;i<STARSPERPLANE;i++)
{
w->stars1[i].x = rand()%PLAYW;
w->stars1[i].y = rand()%PLAYH;
c = rand()%5;
c /=2;
w->stars1[i].pm = &(w->spm[c]);
w->stars2[i].x = rand()%PLAYW;
w->stars2[i].y = rand()%PLAYH;
c = rand()%5;
c /=2;
w->stars2[i].pm = &(w->spm[c]);
}
}