Example #1
0
int	waitb()
{
#if 0
	if(dis_indemo())
	{
		return(dis_waitb());
	}
	if(*shiftstatus&16) setborder(0);
	while(!(inp(0x3da)&8));
	while((inp(0x3da)&8));
	if(*shiftstatus&16) setborder(24);
	return(1);
#endif

	return adjust_framerate();
}
Example #2
0
void TERMWINDOWMEMBER cls(int whatToDo)
	{
#ifdef WINCIT
	scroll(conRows, conRows + 1, (uchar) cfg.attr);
	position(0, 0);
#else
	if (whatToDo == SCROLL_SAVE && cfg.scrollSize)
		{
		SaveToScrollBackBuffer(logiRow);
		}

	if (cfg.bios && !ScreenSaver.IsOn() && !StatusLine.IsFullScreen() &&
			!allWindows)
		{
		scroll_bios(conRows, 0, cfg.attr);
		}
	else
		{
		cls_fast(ScreenSaver.IsOn() ? 0 : cfg.attr);
		}

	setborder(cfg.battr);
	position(0, 0);

	if (allWindows && !oPhys)
		{
		RedrawAll();
		}
#endif
	}
Example #3
0
void	part2(void)
{
	int	a,x,y;
	if(count>=500) NEXTMODE;
	if(count>500-16)
	{
		a=(500-16)-count;
		fadepal(pal,pal2,a*16);
	}

	setborder(0);
	cmatrix_yxz(rx,ry,rz,matrix);
	csetmatrix(matrix,0,0,zp);
	setborder(1);
	points3[0]=0; crotprojlist(points3,gridpoints);
	setborder(250);
	do3dots(points3,vram);
	#if 0
	if(count==2)
	{
		FILE	*f1;
		f1=fopen("_grid1.tmp","wb");
		for(a=0;a<points3[0];a++) if(points3[2+a*8+4]<=3000)
		{
			x=points3[2+a*8+0];
			y=points3[2+a*8+1];
			putw(x,f1);
			putw(y,f1);
		}
		fclose(f1);
	}
	#endif
	#if 0
	for(a=0;a<1000;a++)
	{
		x=points3[2+a*8+0];
		y=points3[2+a*8+1];
		vram[x+y*320]++;
	}
	#endif
	if(count>1) 
	{ 
		rx+=9; ry+=10; rz+=11; 
		if(zp>2000) zp-=10;
	}
	setborder(255);
}
Example #4
0
void	part3(void)
{
	int	a,b,c,x,y;
	int	liy=80,lix=190;
	static	int ct2=0;
	long	lz,z;
	if(count>=800) NEXTMODE;
	if(dis_muscode(0xff)==0xff) NEXTMODE;

	ct2+=4;
	lix=sin1024[ct2&1023]/2+160;
	liy=sin1024[(ct2+256)&1023]/2+64;
	
	setborder(0);
	cglenzinit();
	cmatrix_yxz(rx,ry,rz,matrix);
	csetmatrix(matrix,0,0,zp);
	points2[0]=0; crotlist(points2,cubepoints);
	points3[0]=0; cprojlist((long *)points3,points2);
	points3[0]+=8;
	for(a=0;a<8*8;a+=8)
	{
		x=points3[2+a+0];
		y=points3[2+a+1];
		z=points3[2+a+4];
		z+=2000;
		lz=3000+2000;
		x=(long)(x-lix)*lz/(long)z+lix;
		y=(long)(y-liy)*lz/(long)z+liy;
		points3[8*8+2+a+0]=x;
		points3[8*8+2+a+1]=y;
		points3[8*8+2+a+4]=3000;
	}
	ceasymode(0);
	cclipeasypolylist(polylist,cubepolyss,(long *)points3);
	cglenzpolylist(polylist);
	ceasymode(1);
	cclipeasypolylist(polylist,cubepolys,(long *)points3);
	cglenzpolylist(polylist);
	cglenzdone();
	setborder(255);
	rx+=9; ry+=10; rz+=11; 
	if(count<20) fadepal(pal,pal2,count*16);
}
Example #5
0
void	doit(void)
{
	int	frame=0,halt=0,storea=0,ysb=0;
	int	a,b,c,y,ysz,ysza,xsc,spd=10,la,y1,y2;
	while(!dis_exit() && frame<700)
	{
		if(*shiftstatus&16) setborder(0);
		c=waitb();
		if(*shiftstatus&16) setborder(127);
		frame+=c;
		if(frame>511) c=400;
		else 
		{
			y1=framey1[frame]/16;
			y2=framey2[frame]/16;
		}
		xsc=(400-(y2-y1))/8;
		for(y=0;y<400;y++)
		{
			if(y<y1 || y>=y2)
			{
				linezoom(vram+y*80,NULL,0);
			}
			else 
			{
				b=(long)(y-y1)*400L/(long)(y2-y1);
				a=184+(sin1024[b*32/25]*xsc+32)/64;
				a&=~1;
				if(lasty[y]!=b || lasts[y]!=a)
				{
					linezoom(vram+y*80,row[b],a);
					lasty[y]=b;
					lasts[y]=a;
				}
			}
		}
	}
}
Example #6
0
Window*
constraintwin(Rectangle r) {
	Window *w;

	w = createwindow(&scr.root, r, 0, InputOnly, nil, 0);
	if(0) {
		Window *w2;

		w2 = createwindow(&scr.root, r, 0, InputOutput, nil, 0);
		selectinput(w2, ExposureMask);
		w->aux = w2;

		setborder(w2, 1, &def.focuscolor.border);
		sethandler(w2, &chandler);
		mapwin(w2);
		raisewin(w2);
	}
	mapwin(w);
	return w;
}
Example #7
0
ncursesWindow::ncursesWindow(int height, int length, int ypos, int xpos) : m_height(height), m_length(length), m_ypos(ypos), m_xpos(xpos)
{
    
    m_window = newwin(height, length, ypos, xpos);
    m_border = _SharedPtr<winBorder>(new winBorder);
    setborder('|', '|', '=', '=', '+', '+', '+', '+');
    
    
    init_pair(1, COLOR_GREEN, COLOR_BLACK); // A default Background Color
    setBGColor(COLOR_BLACK);
    setFGColor(COLOR_GREEN);
    setNormalColor(1);
    
    init_pair(2, COLOR_BLUE, COLOR_BLACK); // A default Background Color
    setCursorColor(2);
    
    init_pair(3, COLOR_RED, COLOR_BLACK); // A default Background Color
    setSelectedColor(3);
    
    init_pair(4, COLOR_RED, COLOR_BLACK); // A default Background Color
    setBorderColor(4);
    
}
Example #8
0
void setscreen(void)
	{
#ifndef WINCIT
	int mode;
	union REGS REG;
	static uchar heightmode = 0;
	static uchar scanlines = 0;
	char mono = 0;
	char far *CrtHite = (char far *) 0x00400085L;

	if (!cfg.restore_mode)
		{
		heightmode = 0;
		scanlines = 0;
		}

	if (gmode() == 7)
		{
		mono = TRUE;
		}

	if (!heightmode)
		{
		if (*CrtHite == 8)
			{
			heightmode = 0x012;
			}
		else if (*CrtHite == 14)
			{
			heightmode = 0x011;
			}
		else if (*CrtHite == 16)
			{
			heightmode = 0x014;
			}
		}

	if (scanlines)
		{
		REG.h.ah = 0x12;			// Video function:
		REG.h.bl = 0x30;			// Set scan lines
		REG.h.al = scanlines;		// Num scan lines
		int86(0x10, &REG, &REG);
		}

	if (heightmode && conMode != -1)	// make sure heightmode is set
		{
		// conMode 1000 --> EGA 43 line, or VGA 50 line

		REG.h.ah = 0x00;
		REG.h.al = (uchar) ((conMode >= 1000) ? 3 : conMode);
		int86(0x10, &REG, &REG);

		// Set to character set 18, (EGA 43 line, or VGA 50 line)
		if (conMode == 1000)
			{
			REG.h.ah = 0x11;
			REG.h.al = 18;
			REG.h.bl = 0x00;
			int86(0x10, &REG, &REG);
			}
		else
			{
			REG.h.ah = 0x11;
			REG.h.al = heightmode;
			REG.h.bl = 0x00;
			int86(0x10, &REG, &REG);
			}
		}

	if (!scanlines)
		{
		getScreenSize(&conCols, &conRows);

		if (!mono)
			{
			if (conRows == 24)
				{
				if (*CrtHite == 14) scanlines = 1;	// Old char set
				if (*CrtHite == 16) scanlines = 2;	// Vga char set
				}

			if (conRows == 42) scanlines = 1;
			if (conRows == 49) scanlines = 2;
			}
		else
			{
			if (conRows == 24) scanlines = 1;
			if (conRows == 27) scanlines = 2;		// herc only
			if (conRows == 42) scanlines = 1;
			}
		}

	mode = gmode();
	conMode = (mode == 3 && conMode >= 1000) ? conMode : mode;

	if (mode == 7)
		{
		physScreen = (char far *) 0xB0000000L;		// mono
		logiScreen = saveBuffer ? saveBuffer : physScreen;
		}
	else
		{
		physScreen = (char far *) 0xB8000000L;		// cga
		logiScreen = saveBuffer ? saveBuffer : physScreen;
		setborder(cfg.battr);
		}

	dgLogiScreen = logiScreen;

	getScreenSize(&conCols, &conRows);

	scrollpos = conRows - StatusLine.Height();

	if (cfg.bios)
		{
		charattr = bioschar;
		stringattr = biosstring;
		}
	else
		{
		charattr = directchar;
		stringattr = directstring;
		}

	OC.ansiattr = cfg.attr;
#endif
	}
Example #9
0
main()
{
	int	a,b,c,x,y,rx,ry,rz,n=8,p1,p2;
	printf("Starting");
	testasm();
	outp(0x3c8,0);
	for(a=0;a<256;a++)
	{
		int	r=0,g=0,b=0;
		if(a&4) r+=30; 
		if(a&8) g+=30; 
		if(a&16) b+=30; 
		if(a&32) { r+=30; g+=30; }
		if(a&64) { g+=30; b+=30; }
		if(a&128) { b+=30; r+=30; }
		outp(0x3c9,r);
		outp(0x3c9,g);
		outp(0x3c9,b);
	}
	while(!kbhit())
	{
		initnewgroup();
		rz+=5; ry+=7; rz+=6;
		rx%=3600; ry%=3600; rz%=3600;
		cmatrix_yxz(rx,ry,rz,matrix);
		csetmatrix(matrix,0,0,4000);
		points2[0]=0; crotlist(points2,points);
		//cclipedges(edges2,edges,points2);
		points3[0]=0; cprojlist(points3,points2);
		cpolylist(polylist,polys,edges,points3);
		asm();
		cdrawpolylist(polylist);
		//cdrawpolylist(testlist);
		setborder(40);
		drawnewgroup();
		setborder(10);
		#if 0
		n=edges[0];
		for(a=2,b=0;b<n;b++)
		{
			p1=edges[a++];
			p2=edges[a++];
			a+=2;
			testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
		}
		#endif
	}
	_asm mov ax,3
	_asm int 10h
	for(a=0;a<100;)
	{
		b=polylist[a++];
		c=polylist[a++];
		if(!b) break;
		printf("s:%i c:%i v:",b,c);
		for(x=0;x<b;x++)
		{
			printf("%i,%i ",polylist[a+0],polylist[a+1]);
			a+=2;
		}
		printf("\n");
	}
	printf("points2: %Fp\n",points2);
}
Example #10
0
main()
{
	int	a,b,c,x,y,rx,ry,rz,n=8,p1,p2,r,g,zpos=7000;
	testasm();
	//initnewgroup();
	outp(0x3c8,0);
	for(a=0;a<64;a++)
	{
		r=g=b=0;
		c=a&31;
		r=16+c;
		g=c*2;
		b=c;
		if(a&0x20) r+=20; g+=20; b+=20;
		/*
		if(a&0x01) { r+=40; }
		if(a&0x02) { g+=40; r+=40; b+=40; }
		if(a&0x04) { r+=0; }
		if(a&0x08) { g+=10; r+=10; b+=10; }
		if(a&0x10) { b+=40; }
		if(a&0x20) { g+=40; r+=40; b+=40; }
		if(a&0x40) { b+=0; }
		if(a&0x80) { g+=10; r+=10; b+=10; }
		r=r*4/6;
		g=g*4/6;
		b=b*4/6;
		*/
		if(r>63) r=63;
		if(g>63) g=63;
		if(b>63) b=63;
		r=g=b=0;
		outp(0x3c9,r);
		outp(0x3c9,g);
		outp(0x3c9,b);
	}
	for(a=0;a<256;a++) vram[a]=a;
	lightshift=8;
	rx=ry=rz=0;
	for(;;)
	{
		if(kbhit())
		{
			a=getch();
			if(a==27) break;
			if(a=='l') lightshift=2;
			if(a=='+') zpos+=200;
			if(a=='-') zpos-=200;
			if(a=='<') lightshift--;
			if(a=='>') lightshift++;
			if(a=='t') asmtestmode=1;
			if(a=='c') { if(zpos==3200) { lightshift=8; zpos=7000; } else { zpos=3200; lightshift=11; } }
			if(a=='8') ry-=16;
			if(a=='2') ry+=16;
			if(a=='4') rz-=16;
			if(a=='6') rz+=16;
		}
		asm();
		setborder(1);
		//rx+=16; ry+=9; rz+=7;
		rx+=32; ry+=8;
		rx%=3600; ry%=3600; rz%=3600;
		//if(rz==0) printf(".");
		/*
		a=0;
		while(polylist[a])
		{
			a+=polylist[a]*2+2;
		}
		polylist[a++]=4;
		polylist[a++]=19;
		polylist[a++]=160-60; polylist[a++]=100-40;
		polylist[a++]=160+60; polylist[a++]=100-40;
		polylist[a++]=160+60; polylist[a++]=100+40;
		polylist[a++]=160-60; polylist[a++]=100+40;
		polylist[a++]=0;
		*/
		cglenzinit();

		cmatrix_yxz(rx,ry,rz,matrix);
		csetmatrix(matrix,0,0,zpos);
		points2[0]=0; crotlist(points2,points);
		//cclipedges(edges2,edges,points2);
		points3[0]=0; cprojlist((long *)points3,points2);
		//cpolylist(polylist,polys,edges,points3);
		ceasypolylist(polylist,epolys,points3);

		cglenzpolylist(polylist);
/*
		cmatrix_yxz(rx,-450,900+ry,matrix);
		csetmatrix(matrix,0,0,zpos);
		points2[0]=0; crotlist(points2,points);
		//cclipedges(edges2,edges,points2);
		points3[0]=0; cprojlist((long *)points3,points2);
		//cpolylist(polylist,polys,edges,points3);
		ceasypolylist(polylist,epolys1,points3);

		cglenzpolylist(polylist);

		cmatrix_yxz(-rx,-450,900+ry,matrix);
		csetmatrix(matrix,0,0,zpos);
		points2[0]=0; crotlist(points2,points);
		//cclipedges(edges2,edges,points2);
		points3[0]=0; cprojlist((long *)points3,points2);
		//cpolylist(polylist,polys,edges,points3);
		ceasypolylist(polylist,epolys2,points3);

		cglenzpolylist(polylist);
*/

		cmatrix_yxz(-rx,-ry,-rz,matrix);
		csetmatrix(matrix,0,0,zpos);
		points2[0]=0; crotlist(points2,pointsb);
		//cclipedges(edges2,edges,points2);
		points3[0]=0; cprojlist((long *)points3,points2);
		//cpolylist(polylist,polys,edges,points3);
		ceasypolylist(polylist,epolysb,points3);
		
		cglenzpolylist(polylist);

//		//cmatrix_yxz(rx*2,-ry,rz*2,matrix);
//		//csetmatrix(matrix,0,0,zpos);
//		//points2[0]=0; crotlist(points2,cubepoints);
//		//points3[0]=0; cprojlist((long *)points3,points2);
//		//ceasypolylist(polylist,cubeepolys,points3);
		
		cglenzdone();
		//cdrawpolylist(polylist);
		//cdrawpolylist(testlist);
		//setborder(3);
		//drawnewgroup();
		#if 0
		n=edges[0];
		for(a=2,b=0;b<n;b++)
		{
			p1=edges[a++];
			p2=edges[a++];
			a+=2;
			testline(points3[p1*6+2],points3[p1*6+3],points3[p2*6+2],points3[p2*6+3],63);
		}
		#endif
	}
	_asm mov ax,3
	_asm int 10h
	#if 0
	for(a=0;a<100;)
	{
		b=polylist[a++];
		c=polylist[a++];
		if(!b) break;
		printf("s:%i c:%i v:",b,c);
		for(x=0;x<b;x++)
		{
			printf("%i,%i ",polylist[a+0],polylist[a+1]);
			a+=2;
		}
		printf("\n");
	}
	printf("points2: %Fp\n",points2);
	#endif
	printf("%i,%i,%i  Z:%i LS:%i \n",rx,ry,rz,zpos,lightshift);
}
Example #11
0
main(int argc,char *argv[])
{
	int	endcnt=0;
	FILE	*f1;
	unsigned u;
	int	a,b,c,d,e,x,y,x2,y2,y1;
	dis_partstart();
	{
		_asm mov ax,13h
		_asm int 10h
	}
	waitb();
	memset(vram0,15,64000);
	while(dis_muscode(1)!=1 && !dis_exit());
	waitb();
	waitb();
	waitb();
	waitb();
	for(x=319;x>=0;x--)
	{
		vram0[x+100*320]=0;
		if(!(x&15)) waitb();
	}
	y1=100; a=100*64; b=0;
	while(y1<200)
	{
		b+=16;
		a+=b;
		y2=a/64;
		if(y2>200) y2=200;
		for(y=y1;y<y2;y++)
		{
			memset(vram0+y*320,0,320);
		}
		y1=y2;
		waitb();
	}
	for(a=0;a<70 && !dis_exit();a++) dis_waitb();
	
	memset(defpal,0,768);
	loadpal(defpal,768);
	outp(0x3c0,0x11+0x20);
	outp(0x3c0,255);
	memset(vram0+0*320,255,35*320);
	memset(vram0+35*320,254,1*320);
	memset(vram0+36*320,0,128*320);
	memset(vram0+164*320,254,1*320);
	memset(vram0+165*320,255,35*320);
	defpal[0*3+0]=0;
	defpal[0*3+1]=0;
	defpal[0*3+2]=20;
	defpal[254*3+0]=45;
	defpal[254*3+1]=45;
	defpal[254*3+2]=45;
	defpal[255*3+0]=0;
	defpal[255*3+1]=0;
	defpal[255*3+2]=0;
	loadpal(defpal,768);
	for(a=0;a<200;a++) rows[a]=a*320;
	background=halloc(16384L,4L);
	memset(background,0,64000);
	dotspnt=dots1;
	if(argc==2) 
	{
		switch(*argv[1])
		{
		case '1' : dotspnt=dots4; break;
		case '2' : mode=5; break;
		case '3' : mode=6; break;
		}
		for(a=0;a<256;a++) vram0[a]=vram0[a+320]=a;
		border=1;
	}
	x=y=c=0;
	
	for(a=0;a<256;a++) vram0[a]=vram0[a+320]=255;
	border=0;
	
	while(!dis_exit() && mode!=-1)
	{
		count++;
		setborder(255);
		waitb();
		if(mode==4 && count>0) loadpal(pal,768);
		if(mode==5 && count>500-17) loadpal(pal,768-6);
		if(mode==6 && count>0 && count<20) loadpal(pal,768-6);
		setborder(0);
		if(mode<4) dodots(background,vram);
		else if(mode==4) dodots2(background,vram);
		switch(mode)
		{
		case 0:
			if(count>32) 
			{ 
				NEXTMODE; 
			}
			break;
		case 1:
			if(!count) 
			{
				x=0;
				part1init();
			}
			else part1();
			break;
		case 2:
			{ 
				NEXTMODE;
				if(dotspnt==dots1) { mode=1; dotspnt=dots2; }
				else if(dotspnt==dots2) { mode=1; dotspnt=dots3; }
				else if(dotspnt==dots3) { mode=1; dotspnt=dots4; }
				else for(a=0;a<2048;a++) adddot(0,0,0,0,0);
			}
			break;
		case 3:
			if(count>40) NEXTMODE;
			break;
		case 4:
			if(count>400) 
			{ 
				NEXTMODE; 
			}
			if(!count)
			{
				pal1colp=1;
				memset(background,0,64000);
				for(dotsp=a=0;a<2048;a++)
				{
					dotsp+=4;
					switch(dotspnt[dotsp])
					{
					case 1 :
					case 2 :
					case 3 : doit2(dotspnt[dotsp+2],dotspnt[dotsp+3],254); break;
					default : dotsp=0; break;
					}
				}
				for(a=3;a<32*3;a+=3) 
				{
					pal[a+0]=0;
					pal[a+1]=0;
					pal[a+2]=20;
				}
			}
			a=252-pal1colp;
			d=a+66; if(d>254) d=254;
			c=63;
			for(;a<d;a++,c-=4)
			{
				if(c<0) c=0;
				b=c*c/64;
				pal[a*3+0]=b;
				pal[a*3+1]=b;
				pal[a*3+2]=b<20?20:b;
			}
			a=(254-65);
			pal[a*3+0]=63;
			pal[a*3+1]=63;
			pal[a*3+2]=63;
			pal[1*3+0]=63;
			pal[1*3+1]=63;
			pal[1*3+2]=63;
			pal1colp++;
			if(count>100) 
			{
				for(a=0;a<2048;a++) adddot(0,0,0,0,0);
				NEXTMODE;
			}
			break;
		case 5:
			if(!count) 
			{
				for(u=0;u<128*320;u++)
				{
					if(vram[u]==254-65) vram[u]=1;
					else vram[u]=0;
				}
				part2init();
			}
			else part2();
			break;
		case 6:
			if(!count) 
			{
				part3init();
			}
			else part3();
			break;
		case 7:
			NEXTMODE;
			if(count>100)
			{ 
				NEXTMODE; 
			}
			break;
		default : 
			mode=-1;
			break;
		}
	}
	if(!dis_indemo())
	{
		_asm mov ax,3h
		_asm int 10h
	}