void ProcessPathList(char buffer[]) { FILE *pfp; char pathbuf[202]; ImageTable=new C_Hash; ImageTable->Setup(512); ImageTable->SetFlags(HSH_REMOVE); ProcessImageLine(buffer); pfp=fopen(PathFile,"r"); if(!pfp) { printf("Can't open path file (%s)\n",PathFile); return; } while(fgets(pathbuf,200,pfp) > 0) ProcessImageLine(pathbuf); fclose(pfp); SaveResource(OutputFile); if(ImageTable) { ImageTable->Cleanup(); delete ImageTable; ImageTable=NULL; } if(OriginalImage) { delete OriginalImage; OriginalImage=NULL; } if(InputSize) printf("Input (%1ld)... Output (%1ld) %%%1ld\n",InputSize,OutputSize,OutputSize*100/InputSize); InputSize=0; OutputSize=0; HeaderSize=0; DataSize=0; }
ASCFont::ASCFont( ASCString strFont ) : m_iCharacterCount ( 0 ) , m_pCharacters ( NULL ) , m_pFontTexture ( NULL ) , m_pVertDecl ( NULL ) { m_strID = strFont; ASCFileIO ioFile; if(ioFile.Open(m_strID, IO_IN)) { m_pCharacters = new SCharacter[m_kiMaxCharacters]; ASCString strLine; SINT32 iIsChar = 0; SINT32 iBitmap = 0; SINT32 i = 0; while(ioFile.GetNextLine(strLine)) { //note: every line we want will have a '=' in it therfore check for it first i = strLine.find( '=' ); if( i == -1 ) { continue; } ++i; //note: most of the lines we want will have "Char" so we check for it second iIsChar = strLine.find( "Char" ); if(iIsChar >= 0) { ASCString strTemp; strLine.substr(i, strTemp); strLine = strTemp; ProcessLetterLine(strLine, m_iCharacterCount); ++m_iCharacterCount; continue; } //note: only one line we want will have "Bitmap" so we check for it last iBitmap = strLine.find( "Bitmap" ); if(iBitmap >= 0) { ASCString strTemp; strLine.substr(i, strTemp); strLine = strTemp; ProcessImageLine(strLine); continue; } } } else { assert_now("Failed to open font file"); } m_uHighest = 0; for(UINT32 i = 0; i < m_iCharacterCount; ++i) { if(m_pCharacters[i].sRect.m_iHeight > m_uHighest) { m_uHighest = m_pCharacters[i].sRect.m_iHeight; } } m_pVertDecl = Ascension::Renderer().GetDefaultVertDecl(); m_pRenderBuffer = Ascension::Renderer().CreateVertexBuffer(10*6, m_pVertDecl->GetStride()); }
int PASCAL WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { FILE *ifp; char buffer[220]; if(!ParseCommandLine (lpCmdLine)) { printf("Make Resource - Version 1.0 - by Peter Ward\n\n"); printf("Usage: MAKERSC [path]<imagerc.irc> [path]<output>\n"); printf(" Sorry... ALL input MUST be in 16bit targa format\n"); return(0); } ifp=fopen(FileList,"r"); if(!ifp) { printf("Can't open imagerc.irc file (%s)\n",FileList); return(0); } TheTime=GetCurrentTime(); if(!UsePathList) { ImageTable=new C_Hash; ImageTable->Setup(512); ImageTable->SetFlags(HSH_REMOVE); while(fgets(buffer,200,ifp) > 0) ProcessImageLine(buffer); fclose(ifp); SaveResource(OutputFile); if(ImageTable) { ImageTable->Cleanup(); delete ImageTable; } if(OriginalImage) delete OriginalImage; if(InputSize) printf("Input (%1ld)... Output (%1ld) %%%1ld\n",InputSize,OutputSize,OutputSize*100/InputSize); } else { while(fgets(buffer,200,ifp) > 0) ProcessPathList(buffer); fclose(ifp); } if(ColorOrder) { ColorOrder->Cleanup(); delete ColorOrder; } if(IDOrder) { IDOrder->Cleanup(); delete IDOrder; } return(0); }