Exemplo n.º 1
0
int main()
{

    int x, y, h, w;
    int nfiles, smooth;//smooth no se usa todavia
    int factor, factor1;
    int intaux;
    bool rail;
    bool curves;
    float wroad;

    string s_aux;
    string file1, file2;

    ifstream f;


    cout << "***********************************************************\n";
    cout << "*     AUTO ROAD MAKER WITH 128x128 AND 256x256 SUPPORT    *\n";
    cout << "***********************************************************" << endl << endl << "By Com_GP ([email protected]) 06/12/2002" << endl << endl;
    cout << "SCRIPT DRIVEN, the script should be in the same folder and its\ncalled bmplist.txt\n";

    f.open("bmplist.txt");
    if(!f) {
        cout << "ERROR OPENING THE SCRIPT FILE" << endl;
        system("PAUSE");
    }
    else {

        getline( f, s_aux);
        nfiles = String2Int( s_aux );
        cout << endl << "NUMBER OF BMPs ---------> " << nfiles << endl;
        getline( f, s_aux);
        rail = String2Int( s_aux );
        cout << "RAIL EFFECT ------------> " << rail << endl;
        getline( f, s_aux);
        curves = String2Int( s_aux );
        cout << "CURVES EFFECT ----------> " << curves << endl << endl;
        getline( f, s_aux);
        intaux = String2Int( s_aux );
        wroad = (float(intaux)/100.0);
        cout << "PERCENTAGE EFFECT ------> " << intaux << endl << endl;



        rail = !rail;

        system("PAUSE");
        getline( f, file1);
        while( nfiles > 0 ) {
            getline( f, file2 );
            if( MakeTransition( file1, file2, factor, factor1, rail, curves, wroad ) == 0 )
                return 0;
            nfiles --;
        }

        f.close();
    }
    return 0;
}
Exemplo n.º 2
0
Arquivo: SCPI.c Projeto: Sasha7b9/Osci
//---------------------------------------------------------------------------------------------------------------------------------------------------
bool SCPI_FirstIsInt(uint8 *buffer, int *value, int min, int max)
{
    Word param;
    if (GetWord(buffer, &param, 0))
    {
#ifdef WIN32
        char n[10];
#else
        char n[param.numSymbols + 1];
#endif
        memcpy(n, param.address, param.numSymbols);
        n[param.numSymbols] = '\0';
        if (String2Int(n, value) && *value >= min && *value <= max)
        {
            return true;
        }
    }
    return false;
}
Exemplo n.º 3
0
uint16 ProtoJudgement(char * ProtoHeader,struct sip_packet *packet)
{
	uint16 i,result;
	uint16 j=0;
	uint16 k=0;
	char * temp;
	char * lProtoHeader=ProtoHeader;
	for(i=0;i<50;i++)
	{
		if(j==0)
			ibuffer[0]='\0';
		if((*(ProtoHeader+j)=='\r')&&(*(ProtoHeader+j+1)=='\n'))
		{
            ibuffer[j]='\0';
            temp=ibuffer;
			strcpy(packet->message.msg[k],temp);
            break;
		}
		if(*(ProtoHeader+j)==' '&&k<2)
		{
			ProtoHeader=ProtoHeader+j+1;
			ibuffer[j]='\0';
            temp=ibuffer;
			strcpy(packet->message.msg[k],temp);
			k++;
			j=0;
			continue;
		}

        ibuffer[j]= *(lProtoHeader+i);
		j++;
	}
    ibuffer[0]='\0';
	if(i!=50)
	{
		result=CompareSipLinerName(packet->message.msg[0]);
		if(result==SIPVERSION)
			String2Int(&result,packet->message.msg[1]);
	}
	else
		result=0;
	return result;
}
int main()
{

    static CRaster bmp, bmp_temp;
    int width_tile, minus_sep, total_cut, nhor, nver, acum1=0, acum2=0, nver_aux, nhor_aux, i,j,i_aux,j_aux;


    //TEMPORAL
    int x_aux = 0;
    int intnsig_aux;

    cout << "********************************\n";
    cout << "*  CUTTER WITH FALCON SUPPORT  *\n";
    cout << "********************************" << endl << endl << "By Com_GP ([email protected]) 06/12/2002" << endl << "SUPPORTS 128x128 AND 256x256 TILES WITH 2 PIXELS OF SEPARATION" << endl << endl;
    system("PAUSE");

    RGBQUAD *rgbq_aux;        //Points wherever the palette starts
//    char ** Raster_aux, ** Raster_main;        //Points wherever the image bytes start
//    char cc [256];
//    char string1 [12];
    string cc, string1;

    string s_aux;
    int nfiles;
    int menus = 0;

  ofstream pr;
  ifstream ifs;

  pr.open("texturebin.txt");
  if(!pr)
         cout << "ERROR GUARDANDO EN EL FICHERO" << endl;
  else
  {

  ifs.open("list8bpp.txt");
  if(!ifs)
      cout << "ERROR OPENING THE SCRIPT FILE" << endl;
  else{

  getline( ifs, s_aux);
  nfiles = String2Int( s_aux );
  cout << "NUMBER OF FILES = " << nfiles << endl;


while( nfiles > 0 )
{
  getline( ifs, cc );
  getline( ifs, string1 );

  getline( ifs, s_aux );
  menus = String2Int( s_aux );

  //Ask for the name of the bmp file
  printf ("The file opened is ------> ");
  cout << cc;
  printf ("\n\n");

  bmp.LoadBMP (cc.c_str());

        pr << "# Start Set X has X tiles, Terrain type 4" << endl << "SET 4" << endl;


            //The width of the tile
            cout << "The width and height (its a square) of the tile is ---> ";
            switch( menus )
            {
                 case 1:
                     cout << "128x128\n\n";
                     width_tile = 128;
                 break;
                 case 2:
                     cout << "256x256\n\n";
                     width_tile = 256;
                 break;
                 case 3:
                     cout << "512x512\n\n";
                     width_tile = 512;
                 break;
                 default:
                     cout << "ERROR, MUST BE BETWEEN 1 AND 2, CHECK THE list8bpp.txt FILE" << endl;
                     system("PAUSE");
                 break;
            }

            //Separation between tiles
            cout << "Separation between tiles = ";
            minus_sep = 2;
            cout << minus_sep << endl;



            //bmp_temp = bmp ASIGNACIONES DE TODOS LOS CAMPOS INCLUIDA LA PALETA
            bmp_temp.Width = width_tile;
            bmp_temp.Height = width_tile;
            bmp_temp.BPP = bmp.BPP;
            bmp_temp.Palette = bmp.Palette;
            bmp_temp.pbmi = bmp.pbmi;
            bmp_temp.pbmi->bmiHeader.biHeight = (width_tile);
            bmp_temp.pbmi->bmiHeader.biWidth = (width_tile);

            //new temp memory for the temp tile

            total_cut = width_tile + minus_sep;

            //HASTA AQUI BIEN 23/11/02 01:19
            bmp_temp.Raster = new char*[total_cut];
            for( i = 0; i <= total_cut; i++ )
		          bmp_temp.Raster[i] = new char[total_cut];

            //HASTA AQUI BIEN 23/11/02 01:23
            nver = (bmp.Width / total_cut);
//            nver = (bmp.Height /total_cut);

            cout << "Name of the FILE in which is gonna be saved";
            cout << string1;
            cout << endl;

            int temp_i = 0;
            cout << "CORRECTOR FOR INCLINATION = " << temp_i << endl;


            nver_aux = 0;
            nhor_aux = 0;
            while( nver > 0)
            {
                nhor = ( bmp.Height / total_cut );
                while( nhor > 0)
                {
                     acum1 = 0;
                     i_aux = 0;
                     for ( i = (total_cut*(acum1+nhor_aux)); i < (((acum1+nhor_aux)*total_cut)+(width_tile)); i++ )
                     {
                         acum2 = 0;
                         j_aux = 0;
                         for ( j = (total_cut*(acum2+nver_aux)); j < (((acum2+nver_aux)*total_cut)+(width_tile)); j++ )
                         {
                               bmp_temp.Raster[i_aux][j_aux] = bmp.Raster[i][j];//Aqui hay algun problema
                               j_aux++;
                         }

                         acum2++;
                         i_aux++;
                     }
                     acum1++;
                     nhor--;
                     nhor_aux++;



                     x_aux++;


/*****************
cout << "nver_aux = " << nver_aux << endl;
cout << "nhor_aux -1 = " << nver_aux - 1 << endl;
system("PAUSE");
*****************/
                   switch( nhor_aux - 1 )
                   {
                           case 0:
                               switch( nver_aux )
                               {
//[0,x]
                                   case 0:
                                       string1[7] = '0';
                                       cout << "TILE 0 ---> DONE" << endl;
                                   break;
                                   case 1:
                                       string1[7] = '1';
                                       cout << "TILE 1 ---> DONE" << endl;
                                   break;
                                   case 2:
                                       string1[7] = '2';
                                       cout << "TILE 2 ---> DONE" << endl;
                                   break;
                                   case 3:
                                       string1[7] = '3';
                                       cout << "TILE 3 ---> DONE" << endl;
                                   break;
                                   default:
                                   break;
                               }
                           break;
//[1,x]
                           case 1:
                               switch( nver_aux )
                               {
                                   case 0:
                                       string1[7] = '4';
                                       cout << "TILE 4 ---> DONE" << endl;
                                   break;
                                   case 1:
                                       string1[7] = '5';
                                       cout << "TILE 5 ---> DONE" << endl;
                                   break;
                                   case 2:
                                       string1[7] = '6';
                                       cout << "TILE 6 ---> DONE" << endl;
                                   break;
                                   case 3:
                                       string1[7] = '7';
                                       cout << "TILE 7 ---> DONE" << endl;
                                   break;
                                   default:
                                   break;
                               }
                           break;
//[2,x]
                           case 2:
                               switch( nver_aux )
                               {
                                   case 0:
                                       string1[7] = '8';
                                       cout << "TILE 8 ---> DONE" << endl;
                                   break;
                                   case 1:
                                       string1[7] = '9';
                                       cout << "TILE 9 ---> DONE" << endl;
                                   break;
                                   case 2:
                                       string1[7] = 'A';
                                       cout << "TILE A ---> DONE" << endl;
                                   break;
                                   case 3:
                                       string1[7] = 'B';
                                       cout << "TILE B ---> DONE" << endl;
                                   break;
                                   default:
                                   break;
                               }
                           break;

//[3,x]
                           case 3:
                               switch( nver_aux )
                               {
                                   case 0:
                                       string1[7] = 'C';
                                       cout << "TILE C ---> DONE" << endl;
                                   break;
                                   case 1:
                                       string1[7] = 'D';
                                       cout << "TILE D ---> DONE" << endl;
                                   break;
                                   case 2:
                                       string1[7] = 'E';
                                       cout << "TILE E ---> DONE" << endl;
                                   break;
                                   case 3:
                                       string1[7] = 'F';
                                       cout << "TILE F ---> DONE" << endl;
                                   break;
                                   default:
                                   break;
                               }
                           break;

                           default:
                           break;
                   }


                     cout << x_aux << endl;
                     //GUARDAR EN FICHERO
                     SaveBMP (string1.c_str(), bmp_temp, temp_i );

                     string1[9]='p';
                     string1[10]='c';
                     string1[11]='x';

                     switch( x_aux )
                               {
                                   case 1:
                                       string1[7] = '0';
                                   break;
                                   case 2:
                                       string1[7] = '1';
                                   break;
                                   case 3:
                                       string1[7] = '2';
                                   break;
                                   case 4:
                                       string1[7] = '3';
                                   break;
                                   case 5:
                                       string1[7] = '4';
                                   break;
                                   case 6:
                                       string1[7] = '5';
                                   break;
                                   case 7:
                                       string1[7] = '6';
                                   break;
                                   case 8:
                                       string1[7] = '7';
                                   break;
                                   case 9:
                                       string1[7] = '8';
                                   break;
                                   case 10:
                                       string1[7] = '9';
                                   break;
                                   case 11:
                                       string1[7] = 'A';
                                   break;
                                   case 12:
                                       string1[7] = 'B';
                                   break;
                                   case 13:
                                       string1[7] = 'C';
                                   break;
                                   case 14:
                                       string1[7] = 'D';
                                   break;
                                   case 15:
                                       string1[7] = 'E';
                                   break;
                                   case 16:
                                       string1[7] = 'F';
                                   break;



                                   default:
                                   break;
                               }


                     pr << string1 << " 0 0" <<  endl;
                     string1[9]='b';
                     string1[10]='m';
                     string1[11]='p';
            }

                nhor_aux = 0;
                nver--;
                nver_aux++;
            }
          cout << "Cutting of the set done, 13 files should be done" << endl;
          system("PAUSE");

          pr << "ENDSET" << endl << endl;

nfiles--;
}    //end while
    ifs.close();
    }
  pr.close();
  }
  cout << "A texturebin.txt should be done" << endl;
    return 0;
}
int main()
{

  static CRaster bmp, bmp_temp;
  int width_tile, minus_sep, total_cut, nhor, nver, acum1=0, acum2=0, nver_aux, nhor_aux, i,j,i_aux,j_aux;
  int nfiles_aux;

  int x_aux = 0;
  int intnsig_aux;
  string cc, string1, naming;

  cout << "********************************\n";
  cout << "*  CUTTER WITH FALCON SUPPORT  *\n";
  cout << "********************************" << endl << endl << "By Com_GP ([email protected]) DATE: " << "23/01/2003" << endl << "SUPPORTS 128x128, 256x256 AND 512x512 TILES WITH 2 PIXELS OF SEPARATION" << endl << endl;
//    system("PAUSE");

  RGBQUAD *rgbq_aux;        //Points wherever the palette starts

  string s_aux;
  int nfiles;
  int menus = 0;

  ofstream pr;
  ifstream ifs;

  pr.open("texturebin.txt");
  if(!pr)
         cout << "ERROR SAVING TEXTURE.BIN, NO MEMORY??" << endl;
  else
  {

  ifs.open("list8bpp.txt");
  if(!ifs)
      cout << "ERROR OPENING THE SCRIPT FILE" << endl;
  else{

  getline( ifs, s_aux);
  nfiles = String2Int( s_aux );
  cout << "NUMBER OF FILES = " << nfiles << endl;

 while( nfiles > 0 )
 {
  getline( ifs, cc );
  getline( ifs, string1 );

  getline( ifs, s_aux );
  menus = String2Int( s_aux );

  //**ESTO**
  getline( ifs, s_aux);
  nfiles_aux = String2Int( s_aux );

  //NAMING PROCEDURE
  getline( ifs, naming );

  //Ask for the name of the bmp file
  printf ("The file opened is ------> ");
  cout << cc;
  printf ("\n\n");

  if ( bmp.LoadBMP (cc.c_str()))
      return 0;

        pr << "# Start Set X has X tiles, Terrain type 4" << endl << "SET 4" << endl;


            //The width of the tile
            cout << "The width and height (its a square) of the tile is ---> ";
            switch( menus )
            {
                 case 1:
                     cout << "128x128\n\n";
                     width_tile = 128;
                 break;
                 case 2:
                     cout << "256x256\n\n";
                     width_tile = 256;
                 break;
                 case 3:
                     cout << "512x512\n\n";
                     width_tile = 512;
                 break;
                 default:
                     cout << "ERROR, MUST BE BETWEEN 1 AND 2, CHECK THE list8bpp.txt FILE" << endl;
                     system("PAUSE");
                 break;
            }

            //Separation between tiles
            cout << "Separation between tiles = ";
            minus_sep = 2;
            cout << minus_sep << endl;

            //bmp_temp = bmp ASIGNACIONES DE TODOS LOS CAMPOS INCLUIDA LA PALETA
            bmp_temp.Width = width_tile;
            bmp_temp.Height = width_tile;
            bmp_temp.BPP = bmp.BPP;
            bmp_temp.Palette = bmp.Palette;
            bmp_temp.pbmi = bmp.pbmi;
            bmp_temp.pbmi->bmiHeader.biHeight = (width_tile);
            bmp_temp.pbmi->bmiHeader.biWidth = (width_tile);

            total_cut = width_tile + minus_sep;

            //new temp memory for the temp tile
            bmp_temp.Raster = new char*[total_cut];
            for( i = 0; i <= total_cut; i++ )
		          bmp_temp.Raster[i] = new char[total_cut];

            nver = (bmp.Width / total_cut);

            cout << "Name of the FILE in which is gonna be saved -> ";
            cout << string1;
            cout << endl;

            int temp_i = 0;
            cout << "CORRECTOR FOR INCLINATION = " << temp_i << endl;


            nver_aux = 0;
            nhor_aux = 0;
            while( nver > 0)
            {
                nhor = ( bmp.Height / total_cut );
                while( nhor > 0)
                {
                     acum1 = 0;
                     i_aux = 0;
                     for ( i = (total_cut*(acum1+nhor_aux)); i < (((acum1+nhor_aux)*total_cut)+(width_tile)); i++ )
                     {
                         acum2 = 0;
                         j_aux = 0;
                         for ( j = (total_cut*(acum2+nver_aux)); j < (((acum2+nver_aux)*total_cut)+(width_tile)); j++ )
                         {
                               bmp_temp.Raster[i_aux][j_aux] = bmp.Raster[i][j];//Aqui hay algun problema
//                               cout <<"[" << i_aux << "][" << j_aux <<"]," <<"  [" << i << "][" << j <<"]" << endl;
                               j_aux++;
                         }
//                         system("PAUSE");
                         acum2++;
                         i_aux++;
                     }
                     acum1++;

                     nhor--;
                     nhor_aux++;



                     x_aux++;

                   switch( nhor_aux - 1 )
                   {
                           case 0:
                               switch( nver_aux )
                               {
                                   case 0:
                                       string1[7] = naming[0];
                                       cout << "TILE " << naming[0] << " ---> DONE" << endl;
                                   break;
                                   case 1:
                                       string1[7] = naming[2];
                                       cout << "TILE " << naming[2] << " ---> DONE" << endl;
                                   break;
                                   case 2:
                                       string1[7] = naming[4];
                                       cout << "TILE " << naming[4] << " ---> DONE" << endl;
                                   break;
                                   case 3:
                                       string1[7] = naming[6];
                                       cout << "TILE " << naming[6] << " ---> DONE" << endl;
                                   break;
                                   case 4:
                                       string1[7] = naming[8];
                                       cout << "TILE " << naming[8] << " ---> DONE" << endl;
                                   break;
                                   case 5:
                                       string1[7] = naming[10];
                                       cout << "TILE " << naming[10] << " ---> DONE" << endl;
                                   break;
                                   case 6:
                                       string1[7] = naming[12];
                                       cout << "TILE " << naming[12] << " ---> DONE" << endl;
                                   break;
                                   case 7:
                                       string1[7] = naming[14];
                                       cout << "TILE " << naming[14] << " ---> DONE" << endl;
                                   break;
                                   case 8:
                                       string1[7] = naming[16];
                                       cout << "TILE " << naming[16] << " ---> DONE" << endl;
                                   break;
                                   case 9:
                                       string1[7] = naming[18];
                                       cout << "TILE " << naming[18] << " ---> DONE" << endl;
                                   break;
                                   case 10:
                                       string1[7] = naming[20];
                                       cout << "TILE " << naming[20] << " ---> DONE" << endl;
                                   break;
                                   case 11:
                                       string1[7] = naming[22];
                                       cout << "TILE " << naming[22] << " ---> DONE" << endl;
                                   break;
                                   case 12:
                                       string1[7] = naming[24];
                                       cout << "TILE " << naming[24] << " ---> DONE" << endl;
                                   break;
                                   case 13:
                                       string1[7] = naming[26];
                                       cout << "TILE " << naming[26] << " ---> DONE" << endl;
                                   break;
                                   case 14:
                                       string1[7] = naming[28];
                                       cout << "TILE " << naming[28] << " ---> DONE" << endl;
                                   break;
                                   case 15:
                                       string1[7] = naming[30];
                                       cout << "TILE " << naming[30] << " ---> DONE" << endl;
                                   break;

                                   default:
                                   break;
                               }
                           break;

                           default:
                           break;
                   }

                   if(nfiles_aux>0){
                     nfiles_aux--;
                     //GUARDAR EN FICHERO
                     if( string1[7] != 'x' ){
                     SaveBMP (string1.c_str(), bmp_temp, temp_i );
                     string1[9]='p';
                     string1[10]='c';
                     string1[11]='x';
                     pr << string1 << " 0 0" <<  endl;
                     string1[9]='b';
                     string1[10]='m';
                     string1[11]='p';
                     }
                   }
            }

                nhor_aux = 0;
                nver--;
                nver_aux++;
            }
          cout << "Cutting of the set done, " << x_aux << " files should be done" << endl;
          system("PAUSE");

          pr << "ENDSET" << endl << endl;

 nfiles--;
 }
 //end while
 ifs.close();
 }
 pr.close();
 }
 cout << "A texturebin.txt should be done" << endl;
 return 0;
}
int main()
{
    bmpman BMP1, BMP2;
    string savename, string_1, string_2, s_aux;



    ifstream f;
    int nfiles, total, inic;
    int i, j, j_aux;

    cout << "*********************************************************************\n";
    cout << "*     AUTO AIRBASE MAKER WITH 128x128 (AND 256x256 not yet) SUPPORT *\n";
    cout << "*********************************************************************" << endl << endl << "By Com_GP ([email protected]) 06/12/2002" << endl << endl;
    cout << "SCRIPT DRIVEN, the script should be in the same folder and its\ncalled bmplist.txt\n";

    f.open("bmplist.txt");
    if(!f) {
        cout << "ERROR OPENING THE SCRIPT FILE" << endl;
        system("PAUSE");
    }
    else {

        getline( f, s_aux);
        nfiles = String2Int( s_aux );
        cout << endl << "NUMBER OF BMPs ---------> " << nfiles << endl;

        getline( f, string_1 );
        BMP1.LoadBMP(string_1.c_str());
        cout << endl << "WIDTH OF THE BMPs ---------> " << BMP1.GetWidth() << endl;

        getline( f, savename );

        total = (BMP1.GetWidth()+2)*nfiles;
        bmpman BMP24bppBIG((BMP1.GetWidth()+2)*nfiles, (BMP1.GetWidth()+2), 24);

        while( nfiles > 0 ) {
            getline( f, string_2 );

            BMP2.LoadBMP(string_2.c_str());

            //Same Width and Height
            if( BMP1.GetWidth() != BMP1.GetHeigth() ) {
                cout << "ERROR, THE FIRST BITMAP HEIGHT IS NOT THE SAME AS THE WIDTH" << endl;
                system("PAUSE");
                return 0;
            }

            //Same Width and Height
            if( BMP2.GetWidth() != BMP2.GetHeigth() ) {
                cout << "ERROR, THE SECOND BITMAP HEIGHT IS NOT THE SAME AS THE WIDTH" << endl;
                system("PAUSE");
                return 0;
            }

            //The bmp1 load right
            if( BMP1.GetWidth() == 0 ) {
                cout << "ERROR, THE FIRST BMP IS NOT RIGHT LOADED (probably wrong typing)" << endl;
                system("PAUSE");
                return 0;
            }

            //The bmp2 load right
            if( BMP2.GetWidth() == 0 ) {
                cout << "ERROR, THE SECOND BMP IS NOT RIGHT LOADED (probably wrong typing)" << endl;
                system("PAUSE");
                return 0;
            }

            //Same Width in the two tiles
            if( BMP1.GetWidth() != BMP2.GetWidth() ) {
                cout << "ERROR, THE TILES DONT HAVE THE SAME WIDTH OR HEIGHT" << endl;
                system("PAUSE");
                return 0;
            }

            bmpman BMP24bpp1(BMP1.GetWidth(), BMP1.GetWidth(), 24);
            Htile( BMP1, BMP2, BMP24bpp1 );

//   BMP24bpp1.LoadBMPHeader();
//   BMP24bpp1.SaveBMP(savename.c_str());
//****************

            inic = (total - (BMP1.GetWidth()+2)*nfiles);
            for( i = 0; i < BMP1.GetWidth(); i++ ) {
                j_aux = 0;
                for( j = inic; j < (inic+BMP1.GetWidth()); j++ ) {
//           cout << "i = " << i << " j = " << j << " j_aux = " << j_aux << endl;
                    BMP24bppBIG.EnterRGBdata( i, j, BMP24bpp1.GetRGBdata( i, j_aux ));
                    j_aux++;
                }
            }



//****************
            nfiles --;
        }
        BMP24bppBIG.LoadBMPHeader();
        BMP24bppBIG.SaveBMP(savename.c_str());
        f.close();
    }

    cout << "Name to save -->";
    cout << savename << endl;

    system("PAUSE");
    return 0;
}