Exemplo n.º 1
0
ozrotatepointz(Vector_t *v, int rot)
{
    static long x, y;
	x = v->x;
	y = v->y;
    v->x = div256(x * icos(rot) - y * isin(rot));
    v->y = div256(x * isin(rot) + y * icos(rot));
}
Exemplo n.º 2
0
ozrotatepointy(Vector_t *_v, int rot)
{
    static long x, z;
    register Vector_t *v=_v;
	x = v->x;
	z = v->z;
    v->x = div16384(x * icos(rot) - z * isin(rot));
    v->z = div16384(x * isin(rot) + z * icos(rot));
}
Exemplo n.º 3
0
void polygon(int cx, int cy, int corners, int r, int sa)
{

int i,k;

	k=sa;
	plot(cx+icos(k)*r/256,cy+isin(k)*r/256);

	for (i=0;i++<corners;k=(k+360/corners)%360)
		drawto(cx+icos(k)*r/256,cy+isin(k)*r/256);

	drawto(cx+icos(sa)*r/256,cy+isin(sa)*r/256);
}
Exemplo n.º 4
0
void
Glx::Sphere::checkNeedObj(void)
{
  if( itsGlyphID == -1 ){
    if( needsVertexList )
      genVertList();
    itsGlyphID = glGenLists(1);
    if( itsGlyphID == 0 ){
      itsGlyphID = -1;
      return;
    }
    glNewList(itsGlyphID, GL_COMPILE);
    icos(itsComplexity);
    glEndList();
  }
  if( itsWireGlyphID == -1 ){
    itsWireGlyphID = glGenLists(1);
    if( itsWireGlyphID == 0 ){
      itsWireGlyphID = -1;
      return;
    }
    glNewList(itsWireGlyphID, GL_COMPILE);
    wireSphere(20,0);
    glEndList();
  }
}
Exemplo n.º 5
0
void PlayerShot2(int x, int y, int speed, int angle)
{
    manage->New.Data.hitAtt = MPShot;
    manage->New.Data.hitMask = MEnemy;

    manage->New.Data.X = x;
    manage->New.Data.Y = y;
    manage->New.Data.Attack = 1;
    manage->New.Data.Speed = speed;
    manage->New.Data.Angle = angle;
    manage->New.Data.EnemyAtt = NullDel;
    manage->New.Data.Width = 12;
    manage->New.Data.Height = 16;

    manage->New.Data.Cnt[0] = x << 8;
    manage->New.Data.Cnt[1] = y << 8;
    manage->New.Data.Cnt[2] = icos(angle);
    manage->New.Data.Cnt[3] = isin(angle);

    manage->New.Data.Cnt[4] = 0;

    manage->New.Grp.image = PShot2Image;

    NewObj(MPShot,PlayerShotAct1,PlayerShotHit1,DrawImage);
}
Exemplo n.º 6
0
/* enemy shot */
void ShotToAngle(int x, int y, int angle, int speed)
{
    int i;

    if (manage->EnemyNum >= manage->EnemyMax)
        return;

    if (speed <= 0)
      speed = 1;
    
    for (i=1; i<manage->EnemyMax; i++)
    {
        if (manage->enemy[i]->Data.used == False)
	{
	    manage->EnemyShot.Data.X = x;
	    manage->EnemyShot.Data.Y = y;
	    manage->EnemyShot.Data.Angle = angle;
	    manage->EnemyShot.Data.Speed = speed;
	    manage->EnemyShot.Data.Cnt[0] = x << 8;
	    manage->EnemyShot.Data.Cnt[1] = y << 8;
	    manage->EnemyShot.Data.Cnt[2] = icos(angle);
	    manage->EnemyShot.Data.Cnt[3] = isin(angle);

	    manage->enemy[i]->Data    = manage->EnemyShot.Data;
	    manage->enemy[i]->Grp     = manage->EnemyShot.Grp;
            manage->enemy[i]->Action  = EnemyShotAct;
            manage->enemy[i]->Realize = DrawImage;
            manage->enemy[i]->Hit     = NullDelHit;

	    manage->EnemyNum++;
	    return;
	}
    }
}
Exemplo n.º 7
0
int RingToAngle(int x, int y, int angle, int speed)
{
  if (speed <= 0)
    speed = 1;
  
    manage->New.Data.hitAtt = MEnemy;
    manage->New.Data.hitMask = MPlayer | MPShot;

    manage->New.Data.X = x;
    manage->New.Data.Y = y;
    manage->New.Data.HP = 1;
    manage->New.Data.Point = 0;
    manage->New.Data.Angle = angle;
    manage->New.Data.Speed = speed;
    manage->New.Data.Cnt[0] = x << 8;
    manage->New.Data.Cnt[1] = y << 8;
    manage->New.Data.Cnt[2] = icos(angle);
    manage->New.Data.Cnt[3] = isin(angle);
    manage->New.Data.Cnt[4] = 0;
    manage->New.Data.EnemyAtt = NullDel;
    manage->New.Data.Width = 28;
    manage->New.Data.Height = 28;

    manage->New.Grp.image = ERingImage;

    return NewObj(MEnemy,EnemyShotAct,DeleteHit,DrawImage);
}
Exemplo n.º 8
0
void
Glx::Sphere::setComplexity(int c)
{
  itsComplexity = c;
  glNewList(itsGlyphID, GL_COMPILE);
  icos(itsComplexity);
  glEndList();
}
Exemplo n.º 9
0
void
pamd_text(tuple**       const tuples, 
          int           const cols, 
          int           const rows, 
          int           const depth, 
          sample        const maxval, 
          pamd_point    const pos,
          int           const height, 
          int           const angle, 
          const char *  const sArg, 
          pamd_drawproc       drawProc,
          const void *  const clientdata) {
/*----------------------------------------------------------------------------
   Draw the zero-terminated string 'sArg', with its baseline starting at point
   'pos', inclined by 'angle' degrees to the X axis, with letters 'height'
   tuples high (descenders will extend below the baseline).  We pass the
   supplied drawproc and clientdata to pamd_linep, which performs the actual
   drawing.

   There may be multiple lines of text.  The baseline of the topmost line
   starts at 'pos'.
-----------------------------------------------------------------------------*/
    const struct ppmd_font * const fontP = ppmd_get_font();

    long rotsin, rotcos;
    pamd_point p;
    const char * s;

    pamd_validatePoint(pos);

    p = makePoint(0, 0);
    rotsin = isin(-angle);
    rotcos = icos(-angle);

    for (s = &sArg[0]; *s; ) {
        unsigned char const ch = *s++;

        if (ch >= fontP->header.firstCodePoint &&
            ch < fontP->header.firstCodePoint + fontP->header.characterCount) {

            const struct ppmd_glyph * const glyphP =
                &fontP->glyphTable[ch - fontP->header.firstCodePoint];

            unsigned int cursorAdvance;

            pamd_validatePoint(p); 

            drawGlyph(glyphP, p, tuples, cols, rows, depth, maxval,
                      height, pos, rotcos, rotsin,
                      drawProc, clientdata, &cursorAdvance);
            p.x += cursorAdvance;
        } else if (ch == '\n') {
            /* Move to the left edge of the next line down */
            p.y += Scalef + Descend;
            p.x = 0;
        }
    }
}
Exemplo n.º 10
0
void initdots(struct dots *d, int x0, int y0, int rx, int ry, int i0, int j0)
{
	int i;

	for(i=0; i<256; i++) {
		d->x[i] = x0 + icos(i, rx);
		d->y[i] = y0 + isin(i, ry);
	}
	d->i = (i0 & 0xff);
	d->j = (j0 & 0xff);
}
Exemplo n.º 11
0
void draw_marchingborder() 
{
    for(int i = -1, f = 0; i < 256; i+=8, f++) {
        int16_t x = 128 + isin(i);
        int16_t y = 128 + icos(i);
        if (i == -1 || ((f + textangle/4) % 2 == 0)) {
            trazador.MoveTo(x, y);
        }
        else {
            trazador.LineTo(x,y);
        }
    }
}
Exemplo n.º 12
0
void draw_spiral() 
{
    for(int i = -1; i < 256; i+=8) {
        int16_t x = isin(a);
        int16_t y = icos(a);
        x = 128 + (x * scale)/128;
        y = 128 + (y * scale)/128;
        if (i == -1) {
            trazador.MoveTo(x, y);
        }
        else {
            trazador.LineTo(x,y);
        }
        scale+=4;
        a+=8;
    }
}
Exemplo n.º 13
0
main(int argc,char *argv[])
{
	int	timer=30000;
	int	dropper,repeat;
	int	frame=0;
	int	rota=-1*64;
	int	fb=0;
	int	rot=0,rots=0;
	int	a,b,c,d,i,j,mode;
	int	grav,gravd;
	int	f=0;
	dis_partstart();
	dotnum=512;
	for(a=0;a<dotnum;a++)  dottaul[a]=a;
	for(a=0;a<500;a++)
	{
		b=rand()%dotnum;
		c=rand()%dotnum;
		d=dottaul[b];
		dottaul[b]=dottaul[c];
		dottaul[c]=d;
	}
	{
		dropper=22000;
		for(a=0;a<dotnum;a++)
		{
			dot[a].x=0;
			dot[a].y=2560-dropper;
			dot[a].z=0;
			dot[a].yadd=0;
		}
		mode=7;
		grav=3;
		gravd=13;
		gravitybottom=8105;
		i=-1;
	}
	for(a=0;a<500;a++)
	{ // scramble
		b=rand()%dotnum;
		c=rand()%dotnum;
		d=dot[b].x; dot[b].x=dot[c].x; dot[c].x=d;
		d=dot[b].y; dot[b].y=dot[c].y; dot[c].y=d;
		d=dot[b].z; dot[b].z=dot[c].z; dot[c].z=d;
	}
	for(a=0;a<200;a++) rows[a]=a*320;
	_asm mov ax,13h
	_asm int 10h
	outp(0x3c8,0);
	for(a=0;a<16;a++) for(b=0;b<4;b++)
	{
		c=100+a*9;
		outp(0x3c9,cols[b*3+0]);
		outp(0x3c9,cols[b*3+1]*c/256);
		outp(0x3c9,cols[b*3+2]*c/256);
	}
	outp(0x3c8,255);
	outp(0x3c9,31);
	outp(0x3c9,0);
	outp(0x3c9,15);
	outp(0x3c8,64);
	for(a=0;a<100;a++)
	{
		c=64-256/(a+4);
		c=c*c/64;
		outp(0x3c9,c/4);
		outp(0x3c9,c/4);
		outp(0x3c9,c/4);
	}
	outp(0x3c7,0);
	for(a=0;a<768;a++) pal[a]=inp(0x3c9);
	outp(0x3c8,0);
	for(a=0;a<768;a++) outp(0x3c9,0);
	for(a=0;a<100;a++)
	{
		memset(vram+(100+a)*320,a+64,320);
	}
	for(a=0;a<128;a++)
	{
		c=a-(43+20)/2;
		c=c*3/4;
		c+=8;
		if(c<0) c=0; else if(c>15) c=15;
		c=15-c;
		depthtable1[a]=0x202+0x04040404*c;
		depthtable2[a]=0x02030302+0x04040404*c;
		depthtable3[a]=0x202+0x04040404*c;
		//depthtable4[a]=0x02020302+0x04040404*c;
	}
	bgpic=halloc(64000L,1L);
	memcpy(bgpic,vram,64000);
	a=0;
	for(b=64;b>=0;b--)
	{	
		for(c=0;c<768;c++)
		{
			a=pal[c]-b;
			if(a<0) a=0;
			pal2[c]=a;
		}
		dis_waitb();
		dis_waitb();
		outp(0x3c8,0);
		for(c=0;c<768;c++) outp(0x3c9,pal2[c]);
	}
	
	while(!dis_exit() && frame<2450)
	{
		//setborder(0);
		repeat=dis_waitb();
		if(frame>2300) setpalette(pal2);
		//setborder(1);
		if(dis_indemo())
		{
			a=dis_musplus();
			if(a>-4 && a<0) break;
		}
		while(repeat--)
		{
			frame++;
			if(frame==500) f=0;
			i=dottaul[j];
			j++; j%=dotnum;
			if(frame<500)
			{
				dot[i].x=isin(f*11)*40;
				dot[i].y=icos(f*13)*10-dropper;
				dot[i].z=isin(f*17)*40;
				dot[i].yadd=0;
			}
			else if(frame<900)
			{
				dot[i].x=icos(f*15)*55;
				dot[i].y=dropper;
				dot[i].z=isin(f*15)*55;
				dot[i].yadd=-260;
			}
			else if(frame<1700)
			{	
				a=sin1024[frame&1023]/8;
				dot[i].x=icos(f*66)*a;
				dot[i].y=8000;
				dot[i].z=isin(f*66)*a;
				dot[i].yadd=-300;
			}
			else if(frame<2360)
			{
				/*
				a=rand()/128+32;
				dot[i].y=8000-a*80;
				b=rand()&1023;
				a+=rand()&31;
				dot[i].x=sin1024[b]*a/3+(a-50)*7;
				dot[i].z=sin1024[(b+256)&1023]*a/3+(a-40)*7;
				dot[i].yadd=300;
				if(frame>1640 && !(frame&31) && grav>-2) grav--;
				*/
				dot[i].x=rand()-16384;
				dot[i].y=8000-rand()/2;
				dot[i].z=rand()-16384;
				dot[i].yadd=0;
				if(frame>1900 && !(frame&31) && grav>0) grav--;
			}
			else if(frame<2400)
			{
				a=frame-2360;
				for(b=0;b<768;b+=3)
				{
					c=pal[b+0]+a*3;
					if(c>63) c=63;
					pal2[b+0]=c;
					c=pal[b+1]+a*3;
					if(c>63) c=63;
					pal2[b+1]=c;
					c=pal[b+2]+a*4;
					if(c>63) c=63;
					pal2[b+2]=c;
				}
			}
			else if(frame<2440)
			{
				a=frame-2400;
				for(b=0;b<768;b+=3)
				{
					c=63-a*2;
					if(c<0) c=0;
					pal2[b+0]=c;
					pal2[b+1]=c;
					pal2[b+2]=c;
				}
			}
			if(dropper>4000) dropper-=100;
			rotcos=icos(rot)*64; rotsin=isin(rot)*64;
			rots+=2;
			if(frame>1900) 
			{
				rot+=rota/64;
				rota--;
			}
			else rot=isin(rots);
			f++;
			gravity=grav;
			gravityd=gravd;
		}
		drawdots();
	}
	if(!dis_indemo())
	{
		_asm mov ax,3h
		_asm int 10h
	}
Exemplo n.º 14
0
static void act_rot_offset(register Short_xyz *point,
			        register SHORT *op,
					SHORT scale)
{
register SHORT theta;
register SHORT s,c;
SHORT x,y,z;

theta =  op[3];
if (theta)
	{
	s = isin(theta);
	c = icos(theta);


	x = point->x;
	y = point->y;

	point->x = itmult(x,c) + itmult(y,s);
	point->y = itmult(y,c) + itmult(x,-s);
	}
theta =  op[4];
if (theta)
	{
	s = isin(theta);
	c = icos(theta);

	y = point->y;
	z = point->z;

	point->y = itmult(y,c) + itmult(z,s);
	point->z = itmult(z,c) + itmult(y,-s);
	}
theta =  op[5];
if (theta)
	{
	theta = itmult(theta, scale);
	s = isin(theta);
	c = icos(theta);

	x = point->x;
	y = point->y;

	point->x = itmult(x,c) + itmult(y,s);
	point->y = itmult(y,c) + itmult(x,-s);
	}
theta =  -op[4];
if (theta)
	{
	s = isin(theta);
	c = icos(theta);

	y = point->y;
	z = point->z;

	point->y = itmult(y,c) + itmult(z,s);
	point->z = itmult(z,c) + itmult(y,-s);
	}
theta =  -op[3];
if (theta)
	{
	s = isin(theta);
	c = icos(theta);


	x = point->x;
	y = point->y;

	point->x = itmult(x,c) + itmult(y,s);
	point->y = itmult(y,c) + itmult(x,-s);
	}
}
Exemplo n.º 15
0
main()
{
#ifdef DETAILED
	sz=getmaxy()/2-5;
	long_sz=sz-18;
	short_sz=sz/2;
#else
	sz=getmaxy()/2-1;
	long_sz=sz-2;
	short_sz=sz/2;
#endif	
	cx=getmaxx()/2;
	cy=getmaxy()/2;
	
	printf("%cTime set..\n\n  Hours: ",12);
	gets(hr);
	k=atoi(hr);
	printf("\n  Minutes: ");
	scanf("%s",hr);
	j=atoi(hr);

	k=k*5+(j/12);
	if (k<15)
		k=k+45;
	else
		k-=15;

	if (j<15)
		j=j+45;
	else
		j-=15;
	
	clg();

	circle(cx,cy,cy,1);
#ifdef DETAILED
	circle(cx,cy,cy-3,1);
	circle(cx,cy,3,1);
#endif
	for (i=0;i<60;i++) {
		x=icos(i*6)*sz/256;
		y=isin(i*6)*sz/256;
		
		plot (cx+x,cy+y);
	
	}

#ifdef DETAILED
	for (i=0;i<12;i++) {
		x=isin(i*30)*(sz-8)/256;
		y=icos(i*30)*(sz-8)/256;
		putsprite(spr_or, cx+x-5, cy-y-3, roman_nums + i*16 + 7*(i>8));
	}
#endif

	x=-1;

	i=0;
	
	tm=clock();
	
	while (getk()!=' ') {
		tm=clock();
		if (i++ == 59) i=0;
		if (i == 45) {
			if (x != -1) {
				// min
				undraw(cx-1,cy+1,cx+x_min,cy+y_min);
				undraw(cx+1,cy-1,cx+x_min,cy+y_min);
				undraw(cx+1,cy+1,cx+x_min,cy+y_min);
				undraw(cx-1,cy-1,cx+x_min,cy+y_min);
			}
			if (j++ == 59) {
				j=0;
			}
			if (j == 45) {
				if (x != -1) {
					undraw(cx,cy,cx+x_hr,cy+y_hr);
					undraw(cx-1,cy+1,cx+x_hr-1,cy+y_hr+1);
					undraw(cx+1,cy-1,cx+x_hr+1,cy+y_hr-1);
					undraw(cx+1,cy+1,cx+x_hr+1,cy+y_hr+1);
					undraw(cx-1,cy-1,cx+x_hr-1,cy+y_hr-1);
				}
				if (k++ == 59) k=0;
			}
		}

		if (x != -1) {
			//sec
			undraw(cx,cy,cx+x,cy+y);
		}
		x=icos(i*6)*long_sz/256;
		y=isin(i*6)*long_sz/256;

		x_min=icos(j*6)*long_sz/256;
		y_min=isin(j*6)*long_sz/256;

		x_hr=icos(k*6)*short_sz/256;
		y_hr=isin(k*6)*short_sz/256;

		// sec
		draw(cx,cy,cx+x,cy+y);

		// min
		draw(cx-1,cy+1,cx+x_min,cy+y_min);
		draw(cx+1,cy-1,cx+x_min,cy+y_min);
		draw(cx+1,cy+1,cx+x_min,cy+y_min);
		draw(cx-1,cy-1,cx+x_min,cy+y_min);

		// hr
		draw(cx,cy,cx+x_hr,cy+y_hr);
		draw(cx-1,cy+1,cx+x_hr-1,cy+y_hr+1);
		draw(cx+1,cy-1,cx+x_hr+1,cy+y_hr-1);
		draw(cx+1,cy+1,cx+x_hr+1,cy+y_hr+1);
		draw(cx-1,cy-1,cx+x_hr-1,cy+y_hr-1);

		circle(cx,cy,3,1);
#ifdef DETAILED
		circle(cx,cy,5,1);
#endif

		while ((clock() < (tm+CLOCKS_PER_SEC))&&(clock() > CLOCKS_PER_SEC)) {}
		tm=clock();
	
	}

}
Exemplo n.º 16
0
float Wind::itan(long x) {
	return isin(x) / icos(x);
}