Esempio n. 1
0
void main(void)
{   int Hdl;
    void *OldScreen;
    int dummy;
    long i;

/* d‚termine la base line A pour la position souris
*/
    linea_init();

/* charge l'image et la duplique en largeur
*/       
    Hdl=Fopen("MORETA.NEO",0); if (Hdl<0) { appl_exit(); Pterm0(); }
    Fseek(4L,Hdl,0);
    Fread(Hdl,32L,NewPalette);
    Fseek(128L,Hdl,0);
    for (i=0;i<200;i++) 
    {    LINE1 *p=(LINE1 *)&picbuf[0].line[i];
         Fread(Hdl,sizeof(LINE1),p);
         p[1]=p[0];
    }
    Fclose(Hdl);

/* Duplique l'image en hauteur 
*/  
    picbuf[1]=picbuf[0];
         
/* Installe la pallette et sauve l'ancienne
*/
    InsPalette(); 
    
/* Sauve l'adresse de l'‚cran courant
*/  
    OldScreen=GetScreenPtr();

/* Installe la routine de scrolling en VBL
*/
    InsVBL(Scrolling);
    
/* Boucle en attendant un Ctrl-C
*/
    while (1) if (Bconstat(2)<0 && (char)Bconin(2)==3) break;

/* Remet tout en ordre et sort de l…
*/  
    RmvVBL();
    SetScreenPtr(OldScreen);
    SetScroll(0);
    SetLineStride(0);
    RestPalette();
}
Esempio n. 2
0
void FireWorks::WriteFireWorks()
{
	int allEndedCount = 0;
	for( int i = 0; i < MAX_FIREWORKS; i++)
	{
		SFireWork &firework = s_fireWorks[i];
		if ( firework.Ended )
		{
			allEndedCount++;
		}
	}
	if ( allEndedCount == MAX_FIREWORKS )
	{
		return;
	}

	// 1ST PASS : SQUARES
	for ( int y = 0; y < SCR_HEIGHT-BLOCK_HEIGHT; y++ )
	{
		for ( int x = 0; x < SCR_WIDTH-BLOCK_WIDTH; x++ )
		{
			if ( IsFXDotASquare(x, y) )
			{
				DrawFXDot(x, y, PIXEL_BLACK);

				unsigned short ptr = (unsigned short(y)<<8) + (x/2);
				
				if ((x&1)==0)
				{
					fwrite(&ptr, sizeof(unsigned short), 1, frameBlockLeft );
					frameBlockLeftSize += 2;
				}
				else
				{
					fwrite(&ptr, sizeof(unsigned short), 1, frameBlockRight );
				}
			}
		}
	}

	// 2ND PASS : ISOLATED PIXELS
	for ( int y = 0; y < SCR_HEIGHT; y++ )
	{
		for ( int x = 0; x < SCR_WIDTH; x++ )
		{
			if ( getPixel(x, y) != PIXEL_BLACK )
			{
				unsigned short ptr = GetScreenPtr(y) + (x/2);
				
				if ( ((x&1)==0) && ( getPixel(x+1, y) != PIXEL_BLACK ) )
				{
					fwrite(&ptr, sizeof(unsigned short), 1, frameFull );
					x++;
				}
				else
				{
					if ((x&1)==0)
					{
						fwrite(&ptr, sizeof(unsigned short), 1, frameLeft );
					}
					else
					{
						fwrite(&ptr, sizeof(unsigned short), 1, frameRight );
					}
				}
			}
		}
	}

	unsigned short endFrame = 0;
	fwrite(&endFrame, sizeof(unsigned short), 1, frameBlockLeft );
	frameBlockLeftSize += 2;
	fwrite(&endFrame, sizeof(unsigned short), 1, frameBlockRight );
	fwrite(&endFrame, sizeof(unsigned short), 1, frameLeft );
	fwrite(&endFrame, sizeof(unsigned short), 1, frameRight );
	fwrite(&endFrame, sizeof(unsigned short), 1, frameFull );

	if ( frameBlockLeftSize >= 0x1700 )
	{
		fclose( frameBlockLeft );
		frameBlockLeft = fopen("FireWorks_FrameBlockLeft2.raw", "wb" );
		frameBlockLeftSize = 0;
	}
}