示例#1
0
unsigned int img_seek(IMAGE *image, unsigned int y, unsigned int z)
{
    if(img_badrow(image,y,z)) {
	i_errhdlr("img_seek: row number out of range\n");
	return EOF;
    }
    image->x = 0;
    image->y = y;
    image->z = z;
    if(ISVERBATIM(image->type)) {
	switch(image->dim) {
	    case 1:
		return img_optseek(image, 512);
	    case 2: 
		return img_optseek(image,512+(y*image->xsize)*BPP(image->type));
	    case 3: 
		return img_optseek(image,
		    512+(y*image->xsize+z*image->xsize*image->ysize)*
							BPP(image->type));
	    default:
		i_errhdlr("img_seek: weird dim\n");
		break;
	}
    } else if(ISRLE(image->type)) {
	switch(image->dim) {
	    case 1:
		return img_optseek(image, image->rowstart[0]);
	    case 2: 
		return img_optseek(image, image->rowstart[y]);
	    case 3: 
		return img_optseek(image, image->rowstart[y+z*image->ysize]);
	    default:
		i_errhdlr("img_seek: weird dim\n");
		break;
	}
    } else 
	i_errhdlr("img_seek: weird image type\n");
    return((unsigned int)-1);
}
示例#2
0
void DEM_Load( void )
{
	int		bmp_bpp = BPP(MainWindow.draw_mode2);
	int		anti_bpp = (MainWindow.draw_mode2==16)? BMP_HIGH: BMP_TRUE;

	DSP_LoadBmp( 0, bmp_bpp, "v00020.bmp" );

	DSP_LoadBmp( 10, BMP_256P, "smple0000.bmp" );
	DSP_LoadBmp( 11, BMP_256P, "smple0001.bmp" );
	DSP_LoadBmp( 12, BMP_256P, "smple0002.bmp" );
	DSP_LoadBmp( 13, BMP_256P, "smple0003.bmp" );

	FNT_LoadFont( 28, 0 );

	FrameFormat = 1;
}
示例#3
0
int putrow( IMAGE *image, IMushort *buffer, int y, int z )
{
    register IMushort 	*sptr;
    register unsigned char      *cptr;
    register unsigned int x;
    register IMulong min, max;
    register int cnt;

    if( !(image->flags & (_IORW|_IOWRT)) )
	return -1;
    if(image->dim<3)
	z = 0;
    if(image->dim<2)
	y = 0;
    if(ISVERBATIM(image->type)) {
	switch(BPP(image->type)) {
	    case 1:
		min = image->min;
		max = image->max;
		cptr = (unsigned char *)image->tmpbuf;
		sptr = buffer;
		for(x=image->xsize; x--;) {
		    *cptr = *sptr++;
		    if (*cptr > max) max = *cptr;
		    if (*cptr < min) min = *cptr;
		    cptr++;
		}
		image->min = min;
		image->max = max;
		img_seek(image,y,z);
		cnt = image->xsize;
		if (img_write(image,(char *)image->tmpbuf,cnt) != cnt)
		    return -1;
		else
		    return cnt;

	    case 2:
		min = image->min;
		max = image->max;
		sptr = buffer;
		for(x=image->xsize; x--;) {
		    if (*sptr > max) max = *sptr;
		    if (*sptr < min) min = *sptr;
		    sptr++;
		}
		image->min = min;
		image->max = max;
		img_seek(image,y,z);
		cnt = image->xsize<<1;
		if(image->dorev)
		    cvtshorts(buffer,cnt);
		if (img_write(image,(char *)buffer,cnt) != cnt) {
		    if(image->dorev)
			cvtshorts(buffer,cnt);
		    return -1;
		} else {
		    if(image->dorev)
			cvtshorts(buffer,cnt);
		    return image->xsize;
		}

	    default:
		i_errhdlr("putrow: wierd bpp\n");
	}
    } else if(ISRLE(image->type)) {
	switch(BPP(image->type)) {
	    case 1:
		min = image->min;
		max = image->max;
		sptr = buffer;
		for(x=image->xsize; x--;) {
		    if (*sptr > max) max = *sptr;
		    if (*sptr < min) min = *sptr;
		    sptr++;
		}
		image->min = min;
		image->max = max;
		cnt = img_rle_compact(buffer,2,image->tmpbuf,1,image->xsize);
		img_setrowsize(image,cnt,y,z);
		img_seek(image,y,z);
		if (img_write(image,(char *)image->tmpbuf,cnt) != cnt)
		    return -1;
		else
		    return image->xsize;
		break;

	    case 2:
		min = image->min;
		max = image->max;
		sptr = buffer;
		for(x=image->xsize; x--;) {
		    if (*sptr > max) max = *sptr;
		    if (*sptr < min) min = *sptr;
		    sptr++;
		}
		image->min = min;
		image->max = max;
		cnt = img_rle_compact(buffer,2,image->tmpbuf,2,image->xsize);
		cnt <<= 1;
		img_setrowsize(image,cnt,y,z);
		img_seek(image,y,z);
		if(image->dorev)
		    cvtshorts(image->tmpbuf,cnt);
		if (img_write(image,(char *)image->tmpbuf,cnt) != cnt) {
		    if(image->dorev)
			cvtshorts(image->tmpbuf,cnt);
		    return -1;
		} else {
		    if(image->dorev)
			cvtshorts(image->tmpbuf,cnt);
		    return image->xsize;
		}
		break;

	    default:
		i_errhdlr("putrow: wierd bpp\n");
	}
    } else
	i_errhdlr("putrow: wierd image type\n");
    return 0;
}
示例#4
0
int getrow( IMAGE *image, IMushort *buffer, int y, int z )
{
    register int i;
    register unsigned char *cptr;
    register IMushort *sptr;
    register int cnt;

    if( !(image->flags & (_IORW|_IOREAD)) )
	return -1;
    if(image->dim<3)
	z = 0;
    if(image->dim<2)
	y = 0;
    img_seek(image, y, z);
    if(ISVERBATIM(image->type)) {
	switch(BPP(image->type)) {
	    case 1:
		if (img_read(image,(char *)image->tmpbuf,image->xsize)
							    != image->xsize)
		    return -1;
		else {
		    cptr = (unsigned char *)image->tmpbuf;
		    sptr = buffer;
		    for(i=image->xsize; i--;)
			*sptr++ = *cptr++;
		}
		return image->xsize;
	    case 2:
		cnt = image->xsize<<1;
		if (img_read(image,(char *)buffer,cnt) != cnt)
		    return -1;
		else {
		    if(image->dorev)
			cvtshorts(buffer,cnt);
		    return image->xsize;
		}
	    default:
		i_errhdlr("getrow: wierd bpp\n");
		break;
	}
    } else if(ISRLE(image->type)) {
	switch(BPP(image->type)) {
	    case 1:
		if( (cnt = img_getrowsize(image)) == -1 )
		    return -1;
		if( img_read(image,(char *)image->tmpbuf,cnt) != cnt )
		    return -1;
		else {
		    img_rle_expand(image->tmpbuf,1,buffer,2);
		    return image->xsize;
		}
	    case 2:
		if( (cnt = img_getrowsize(image)) == -1 )
		    return -1;
		if( cnt != img_read(image,(char *)image->tmpbuf,cnt) )
		    return -1;
		else {
		    if(image->dorev)
			cvtshorts(image->tmpbuf,cnt);
		    img_rle_expand(image->tmpbuf,2,buffer,2);
		    return image->xsize;
		}
	    default:
		i_errhdlr("getrow: wierd bpp\n");
		break;
	}
    } else
	i_errhdlr("getrow: wierd image type\n");
    return 0;
}
示例#5
0
BOOL DEM_SystemMain(void )
{
	int		bmp_bpp = BPP(MainWindow.draw_mode2);
	BOOL	ret = TRUE;
	int		dc = (0x1000-DemoCounter[0])%96-16;
	int		r2 = STD_LimitLoop( GlobalCount2*4, 255 );

	int		r = timeGetTime();
	int		lr = STD_LimitLoop( r/8, 255 );
	int		x = r%DISP_X;
	int		y = r%DISP_Y;
	int		i=0,j=0;
	static int	flag = 0;
	char		*str = "<Aアクセント>が出せます。\n\\k<s6一次停止、<w30><s4スピード変更>とか>\\k表示中の演出挿入";
	static int	mh;
	int			Angle = 0;
	static		an=0;
	int			count = DemoCounter[1]*4;
	int			mx,my;
	MUS_GetMousePos( &mx, &my );

	MainWindow.draw_flag=1;

	Avg.frame=30;

	static int	wavw_cnt=0;
	AVG_GetGameKey();
	if(GameKey.click)
		wavw_cnt=0;
	
	if(GameKey.cansel)
		ChangeSetpCounter( 1, (DemoStep[1]+1)%2, 0 );
	
	if(KeyCond.trg.f1)
	{
	}
	if(KeyCond.trg.f2)
	{
	}
	if(KeyCond.trg.f3)
	{
	}
	if(KeyCond.trg.f4)
	{
	}

	r = SIN( timeGetTime()/10%256 )/2 ;

	switch( DemoStep[1] )
	{
		default:
		case 0:
			DSP_SetGraphPrim( 0, PRM_FLAT, POL_RECT, 0, ON );
			DSP_SetGraphPosRect( 0, 0,0,800,600 );
			DSP_SetGraphBright( 0, 255,128,50 );

			r = DemoCounter[0]*2%256;

			DSP_SetGraph( 1, 10 + (DemoCounter[0]*2/256+0)%4, 1, ON, CHK_NO );
			DSP_SetGraph( 2, 10 + (DemoCounter[0]*2/256+1)%4, 1, ON, CHK_NO );
			DSP_SetGraph( 3, 10 + (DemoCounter[0]*2/256+2)%4, 1, ON, CHK_NO );
			DSP_SetGraph( 4, 10 + (DemoCounter[0]*2/256+3)%4, 1, !!r, CHK_NO );

			DSP_SetGraphFade( 1, 64-r/8 );
			DSP_SetGraphPosPoly( 1, -r,    -r, 200-r*200/256, 150-r*150/256,
									-r, 600+r, 200-r*200/256, 150+300+r*150/256,
									0, 0, 400,   0, 0, 300, 400,     300 );

			DSP_SetGraphFade( 2, 128-r/4 );
			DSP_SetGraphPosPoly( 2, 200-r*200/256,     150-r*150/256, 200+400-r*400/256, 150,
									200-r*200/256, 300+150+r*150/256, 400+200-r*400/256, 150+300,
									0, 0, 400,   0, 0, 300, 400,     300 );

			DSP_SetGraphFade( 3, 64+r/4 );
			DSP_SetGraphPosPoly( 3, 400+200-r*400/256,     150, 800-r*200/256, 0+r*150/256,
									400+200-r*400/256, 300+150, 800-r*200/256, 600-r*150/256,
									0, 0, 400,   0, 0, 300, 400,     300 );

			DSP_SetGraphFade( 4, 32+r/8 );
			DSP_SetGraphPosPoly( 4, 800-r*200/256,     r*150/256, 800+256-r,    -256+r,
									800-r*200/256, 600-r*150/256, 800+256-r, 600+256-r,
									0, 0, 400,   0, 0, 300, 400,     300 );
			break;
		case 1:
			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_ResetGraph( 1);
			DSP_ResetGraph( 2);
			DSP_ResetGraph( 3);
			DSP_ResetGraph( 4);
			if(0)
			{
				long	xxx[36];
				long	yyy[36];
				long	xx[6];
				long	yy[6];

				if(wavw_cnt<256) wavw_cnt+=4;
				r = COS( wavw_cnt )*1536/4096;
				r = r/32;

				xxx[0*6+0] = r*3;	yyy[0*6+0] = r*3;
				xxx[0*6+1] = r*2;	yyy[0*6+1] = r*2;
				xxx[0*6+2] = r;		yyy[0*6+2] = r;
				xxx[0*6+3] = -r;	yyy[0*6+3] = r;
				xxx[0*6+4] = -r*2;	yyy[0*6+4] = r*2;
				xxx[0*6+5] = -r*3;	yyy[0*6+5] = r*3;

				xxx[1*6+0] = r*2;	yyy[1*6+0] = r*2;
				xxx[1*6+1] = r;		yyy[1*6+1] = r;
				xxx[1*6+2] = r/2;	yyy[1*6+2] = r/2;
				xxx[1*6+3] = -r/2;	yyy[1*6+3] = r/2;
				xxx[1*6+4] = -r;	yyy[1*6+4] = r;
				xxx[1*6+5] = -r*2;	yyy[1*6+5] = r*2;

				xxx[2*6+0] = r;		yyy[2*6+0] = r;
				xxx[2*6+1] = r/2;	yyy[2*6+1] = r/2;
				xxx[2*6+2] = -r;	yyy[2*6+2] = -r;
				xxx[2*6+3] = r;		yyy[2*6+3] = -r;
				xxx[2*6+4] = -r/2;	yyy[2*6+4] = r/2;
				xxx[2*6+5] = -r;	yyy[2*6+5] = r;

				xxx[3*6+0] = r;		yyy[3*6+0] = -r;
				xxx[3*6+1] = r/2;	yyy[3*6+1] = -r/2;
				xxx[3*6+2] = -r;	yyy[3*6+2] = r;
				xxx[3*6+3] = r;		yyy[3*6+3] = r;
				xxx[3*6+4] = -r/2;	yyy[3*6+4] = -r/2;
				xxx[3*6+5] = -r;	yyy[3*6+5] = -r;

				xxx[4*6+0] = r*2;	yyy[4*6+0] = -r*2;
				xxx[4*6+1] = r;		yyy[4*6+1] = -r;
				xxx[4*6+2] = r/2;	yyy[4*6+2] = -r/2;
				xxx[4*6+3] = -r/2;	yyy[4*6+3] = -r/2;
				xxx[4*6+4] = -r;	yyy[4*6+4] = -r;
				xxx[4*6+5] = -r*2;	yyy[4*6+5] = -r*2;

				xxx[5*6+0] = r*3;	yyy[5*6+0] = -r*3;
				xxx[5*6+1] = r*2;	yyy[5*6+1] = -r*2;
				xxx[5*6+2] = r*1;	yyy[5*6+2] = -r*1;
				xxx[5*6+3] = -r*1;	yyy[5*6+3] = -r*1;
				xxx[5*6+4] = -r*2;	yyy[5*6+4] = -r*2;
				xxx[5*6+5] = -r*3;	yyy[5*6+5] = -r*3;

				x=mx;
				y=my;
				xx[0] = -128;
				xx[1] = 128+x*1/5-128;
				xx[2] = 128+x*4/5-128;
				xx[3] = 128+x+(800-x)/5-128;
				xx[4] = 128+x+(800-x)*4/5-128;
				xx[5] = 800+256-128;

				yy[0] = -96;
				yy[1] = 96+y*1/5-96;
				yy[2] = 96+y*4/5-96;
				yy[3] = 96+y+(600-y)/5-96;
				yy[4] = 96+y+(600-y)*4/5-96;
				yy[5] = 600+192-96;

				for(i=0;i<5;i++)
				{
					for(j=0;j<5;j++)
					{
						DSP_SetGraph( i*5+j, 1, 0, ON, CHK_NO );
						DSP_SetGraphPosPoly( i*5+j,
							xx[j]+xxx[ i   *6+j],   yy[i  ]+yyy[ i   *6+j],   xx[j+1]+xxx[ i   *6+j+1], yy[i  ]+yyy[ i   *6+j+1],
							xx[j]+xxx[(i+1)*6+j],   yy[i+1]+yyy[(i+1)*6+j],   xx[j+1]+xxx[(i+1)*6+j+1], yy[i+1]+yyy[(i+1)*6+j+1],
							xx[j]+128, yy[i]+96,   xx[j+1]+128, yy[i]+96,   xx[j]+128, yy[i+1]+96,   xx[j+1]+128, yy[i+1]+96 );
					}
				}
			}
			break;
		case 2:
			for( i=0 ; i<RippleGno ; i++ )
				DSP_ResetGraph( i );

			SetRipple( (DrawCount)%256 );
			DRW_RenewRippleTable(1);

			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraphPos( 0, 0,0, 0,0, 800, 600 );
			DSP_SetGraphParam( 0, DRW_RP2( 255-LIM(r/10%512*4/3,0,255), r/20%256 ) );
			DSP_SetGraphFade( 0, 128-LIM(DrawCount%256-128,0,128) );
			break;
		case 3:
			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );
			DSP_SetGraphBSet2( 1, 2, 3, lr*lr/255 );
			break;
		case 4:
			DSP_SetTextStr( 0, "モザイクワイプ" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraphDisp( 1, OFF );
			DSP_SetGraphParam( 0, DRW_MOZ(count*2) );

			ChangeSetpCounter( 1, 5, 64 );
			break;
		case 5:
			DSP_SetGraph( 0, 1, 0, ON, CHK_NO );
			DSP_SetGraphDisp( 1, OFF );
			DSP_SetGraphParam( 0, DRW_MOZ(128-count*2) );

			ChangeSetpCounter( 1, 6, 64 );
			break;
		case 6:
			DSP_SetTextStr( 0, "モザイクフェード" );

			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );
			DSP_SetGraphParam( 0, DRW_BLD(count*4) );
			DSP_SetGraphParam( 1, DRW_MOZ(count*4) );

			ChangeSetpCounter( 1, 7, 64 );
			break;
		case 7:
			DSP_SetTextStr( 0, "パターンフェード1" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );
			DSP_SetGraphBSet( 1, 2, count*4 );

			ChangeSetpCounter( 1, 8, 64 );
			break;
		case 8:
			DSP_SetTextStr( 0, "パターンフェード2" );

			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );
			DSP_SetGraphBSet( 0, 3, count*4 );

			ChangeSetpCounter( 1, 9, 64 );
			break;
		case 9:
			DSP_SetTextStr( 0, "パターンフェード3" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );
			DSP_SetGraphBSet( 1, 4, count*4 );

			ChangeSetpCounter( 1, 10, 64 );
			break;
		case 10:
			DSP_SetTextStr( 0, "パターンフェード4(放射)" );
			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );
			DSP_SetGraphBSet( 0, 5, count*4 );
			ChangeSetpCounter( 1, 11, 64 );
			break;
		case 11:
			DSP_SetTextStr( 0, "パターンフェード5(文字)" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );
			DSP_SetGraphBSet( 1, 6, count*4 );
			ChangeSetpCounter( 1, 12, 64 );
			break;

		case 12:
			DSP_SetTextStr( 0, "スクロールワイプ(横)" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );

			r = count*count/64;
			x = 800*r/64;
			DSP_SetGraphMove( 0, x-800, 0 );
			DSP_SetGraphMove( 1, x, 0 );

			DSP_SetGraphParam( 0, DRW_BLD(32+r*2) );
			DSP_SetGraphParam( 1, DRW_BLD(32) );

			ChangeSetpCounter( 1, 13, 64 );
			break;

		case 13:
			DSP_SetTextStr( 0, "スクロールワイプ(縦)" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );

			r = count*count/64;
			y = -600*r/64;
			DSP_SetGraphMove( 0, 0, y );
			DSP_SetGraphPosRect( 1, 0, y+600, 800, 600 );

			DSP_SetGraphParam( 0, DRW_BLD(32) );
			DSP_SetGraphParam( 1, DRW_BLD(32+r*2) );

			ChangeSetpCounter( 1, 14, 64 );
			break;

		case 14:
			DSP_SetTextStr( 0, "ズームワイプ1" );

			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );

			r = 64-(64-count)*(64-count)/64;
			DSP_SetGraphZoom2( 1, 400, 300, r*4 );
			DSP_SetGraphParam( 0, DRW_BLD(r*4) );

			ChangeSetpCounter( 1, 15, 64 );
			break;
		case 15:
			DSP_SetTextStr( 0, "ズームワイプ2" );

			DSP_SetGraphDisp( 0, OFF );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );

			r = 64-count*count/64;
			DSP_SetGraphZoom2( 1, 400, 300, r*4 );
			DSP_SetGraphParam( 1, DRW_BLD(16+128-r*2) );

			ChangeSetpCounter( 1, 16, 64 );
			break;
		case 16:
			DSP_SetTextStr( 0, "ズームワイプ3" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );

			r = 64-count;
			r = r*r/64;
			DSP_SetGraphPos( 1, 0, 0, 0,0, 800, 600 );
			DSP_SetGraphZoom2( 1, 400, 300, r*4-256 );
			DSP_SetGraphParam( 1, DRW_BLD(r*4) );

			ChangeSetpCounter( 1, 17, 64 );
			break;
		case 17:
			DSP_SetTextStr( 0, "ズームワイプ4" );

			DSP_SetGraphDisp( 0, OFF );
			DSP_SetGraph( 1, 1, 1, ON, CHK_NO );

			r = 64-count;
			r = 64-r*r/64;
			DSP_SetGraphPos( 1, 0, 0, 0,0, 800, 600 );
			DSP_SetGraphZoom2( 1, 400, 300, r*4-256 );
			DSP_SetGraphParam( 1, DRW_BLD(r*2) );

			ChangeSetpCounter( 1, 18, 64 );
			break;
		case 18:
			DSP_SetTextStr( 0, "ノイズワイプ" );

			DSP_SetGraph( 0, 0, 1, ON, CHK_NO );
			DSP_SetGraph( 1, 1, 0, ON, CHK_NO );

			r = count*2;
			DSP_SetGraphParam( 0, DRW_NIS(r) );

			ChangeSetpCounter( 1, 19, 128 );
			break;
		case 19:
			DSP_SetTextStr( 0, "加算パターンホワイトフェード" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 5, 1, ON, CHK_NO );

			r = STD_LimitLoop( count, 64 )*4;
			DSP_SetGraphParam( 1, DRW_ADD );
			DSP_SetGraphFade( 1, r );

			ChangeSetpCounter( 1, 20, 128 );
			break;
		case 20:
			DSP_SetTextStr( 0, "減算パターンフェード" );

			DSP_SetGraph( 0, 0, 0, ON, CHK_NO );
			DSP_SetGraph( 1, 5, 1, ON, CHK_NO );

			r = STD_LimitLoop( count, 64 )*4;
			DSP_SetGraphParam( 1, DRW_SUB );
			DSP_SetGraphFade( 1, r );

			ChangeSetpCounter( 1, 0, 128 );
			break;
	}
	AVG_ControlWeather();
	return ret;
}