From: Jarda B. <edh...@us...> - 2004-10-16 14:26:52
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18352/plugins/Core Modified Files: Interface.cpp Font.h Font.cpp Log Message: Added Font::SetFirstChar() which can be used to remap numeric fonts to start from '0' instead of \000 Load First char for numeric fonts in pst from fonts.2da Changed GUIINV in pst to take advantage of it Index: Interface.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Interface.cpp,v retrieving revision 1.225 retrieving revision 1.226 diff -C2 -d -r1.225 -r1.226 *** Interface.cpp 16 Oct 2004 08:10:45 -0000 1.225 --- Interface.cpp 16 Oct 2004 14:26:43 -0000 1.226 *************** *** 432,435 **** --- 432,436 ---- char* ResRef = tab->QueryField( i, 0 ); int needpalette = atoi( tab->QueryField( i, 1 ) ); + int first_char = atoi( tab->QueryField( i, 2 ) ); DataStream* fstr = key->GetResource( ResRef, IE_BAM_CLASS_ID ); if (!anim->Open( fstr, true )) { *************** *** 449,452 **** --- 450,454 ---- video->FreePalette( pal ); } + fnt->SetFirstChar( first_char ); fonts.push_back( fnt ); } Index: Font.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Font.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Font.cpp 10 Oct 2004 17:27:41 -0000 1.37 --- Font.cpp 16 Oct 2004 14:26:43 -0000 1.38 *************** *** 50,53 **** --- 50,54 ---- lastX = 0; count = 0; + FirstChar = 0; void* pixels = malloc( w* h ); memset( xPos, 0, sizeof( xPos) ); *************** *** 448,451 **** --- 449,456 ---- continue; } + + if (string[pos] && string[pos] != ' ') + string[pos] -= FirstChar; + wx += size[( unsigned char ) string[pos] - 1].w;//chars[((unsigned char)string[pos])-1]->Width; if (( string[pos] == ' ' ) || ( string[pos] == '-' )) { *************** *** 462,463 **** --- 467,473 ---- return palette; } + + void Font::SetFirstChar( unsigned char first) + { + FirstChar = first; + } Index: Font.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Font.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Font.h 10 Oct 2004 17:27:41 -0000 1.18 --- Font.h 16 Oct 2004 14:26:43 -0000 1.19 *************** *** 62,65 **** --- 62,66 ---- Color* palette; Sprite2D* sprBuffer; + unsigned char FirstChar; public: Font(int w, int h, void* palette, bool cK, int index); *************** *** 85,88 **** --- 86,92 ---- public: void SetupString(char* string, unsigned int width); + // Sets ASCII code of the first character in the font + // (it allows remapping numeric fonts from \000 to '0') + void SetFirstChar(unsigned char first); }; |