void TextArea::CalcRowCount() { int tr; int w = Width; if (Flags&IE_GUI_TEXTAREA_SPEAKER) { const char *portrait = NULL; Actor *actor = NULL; GameControl *gc = core->GetGameControl(); if (gc) { actor = gc->GetTarget(); } if (actor) { portrait = actor->GetPortrait(1); } if (portrait) { RefreshSprite(portrait); } if (AnimPicture) { w-=AnimPicture->Width; } } rows = 0; if (lines.size() != 0) { for (size_t i = 0; i < lines.size(); i++) { // rows++; tr = 0; int len = ( int ) strlen( lines[i] ); char* tmp = (char *) malloc( len + 1 ); memcpy( tmp, lines[i], len + 1 ); ftext->SetupString( tmp, w ); for (int p = 0; p <= len; p++) { if (( ( unsigned char ) tmp[p] ) == '[') { p++; //char tag[256]; int k = 0; for (k = 0; k < 256; k++) { if (tmp[p] == ']') { //tag[k] = 0; break; } p++; //tag[k] = tmp[p++]; } continue; } if (tmp[p] == 0) { // if (p != len) // rows++; tr++; } } lrows[i] = tr; rows += tr; free( tmp ); } } if (lines.size()) { if (CurLine>=lines.size()) { CurLine=lines.size()-1; } w = strlen(lines[CurLine]); if (CurPos>w) { CurPos = w; } } else { CurLine=0; CurPos=0; } if (!sb) { return; } ScrollBar* bar = ( ScrollBar* ) sb; tr = rows - Height/ftext->size[1].h + 1; if (tr<0) { tr = 0; } bar->SetMax( (ieWord) tr ); }