#speed
#pragma option stub=c:\c--\4gsq.exe
#pragma option dos4gw
#use80486
#pragma option d32
#compilerversion 0.237
int real_time;

#include "random.h--"
#include "system.h--"
#include "video.h--"
#include "goraud.h--"
#include "font.h--"
#include "greets.h--"
#include "voxels.h--"

char tpic[SIZESCR];
dword pic=#tpic;

void main ()
{
unsigned int i,p;
	setmode (0x13);
	initvideo();
	randomize(0);
	ES=DS;
	memset(buf,64000,0);
	memset(pic,64000,0);
	set_gradient_palette(1,16,  63,63,63,  63,63,1);
	set_gradient_palette(17,63,  63,63,1,  1,1,1);
	set_gradient_palette(64,219,  10,10,10,  63,10,10);
	set_gradient_palette(220,255,  0,0,0,  50,50,63);
	set_rgb(255,63,63,63);
	initvoxels();
//starts
	p=buf;
	buf=pic;
	FOR (i=0;i<1024;i++) putpixel(random(320),random(200),random(43)+219);
	buf=p;
	i=get_packed_time();
	do{
		real_time = get_packed_time();
		IF(EAX-i>150){
			i=real_time;
			poll_msg();
		}
		RStars();
		Goraud();
		voxels();
		greets();
		copy_to_screen();
	}while(kbHit()!=ESC_KEY);
	setmode (3);
}

int starline=0;

void RStars()
{
	ES=DS;
	EDI=buf;
	ECX=x320[199-starline]>>2;
	ESI=x320[starline]+pic;
	$rep $movsd
	ECX=x320[starline]>>2;
	ESI=pic;
	$rep $movsd
	starline++;
	IF(starline==200)starline=0;
}
