Mercurial > mm7
comparison GUI/GUIWindow.cpp @ 2532:9ec6b8be16fe
Mobile light
author | Ritor1 |
---|---|
date | Mon, 19 Jan 2015 22:39:03 +0600 |
parents | dbaf6fc71525 |
children | a902abdfc7f2 |
comparison
equal
deleted
inserted
replaced
2531:f6de3e15d4a5 | 2532:9ec6b8be16fe |
---|---|
1070 } | 1070 } |
1071 // 5C6DB4: using guessed type int ui_current_text_color; | 1071 // 5C6DB4: using guessed type int ui_current_text_color; |
1072 | 1072 |
1073 //----- (0044CE08) -------------------------------------------------------- | 1073 //----- (0044CE08) -------------------------------------------------------- |
1074 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor ) | 1074 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor ) |
1075 { | 1075 { |
1076 int v14; // edx@9 | 1076 int v14; // edx@9 |
1077 int v18; // edi@32 | |
1078 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 | 1077 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 |
1079 size_t v30; // [sp+2Ch] [bp-Ch]@4 | 1078 size_t v30; // [sp+2Ch] [bp-Ch]@4 |
1080 | 1079 |
1081 int left_margin = 0; | 1080 int left_margin = 0; |
1082 if ( !Str ) | 1081 if ( !Str ) |
1085 return; | 1084 return; |
1086 } | 1085 } |
1087 if (!strcmp(Str, "null")) | 1086 if (!strcmp(Str, "null")) |
1088 return; | 1087 return; |
1089 | 1088 |
1090 v30 = strlen(Str); | 1089 v30 = strlen(Str); |
1091 //int v11 = 0; | 1090 if ( !uX ) |
1092 if ( !uX ) | 1091 uX = 12; |
1093 uX = 12; | 1092 |
1094 | 1093 const char *string_begin = Str; |
1095 const char *string_begin = Str; | 1094 if ( max_text_height == 0 ) |
1096 if ( max_text_height != 0 ) | 1095 string_begin = FitTextInAWindow(Str, font, this, uX, 0); |
1097 string_begin = FitTextInAWindow(Str, font, this, uX, 0); | 1096 auto string_end = string_begin; |
1098 auto string_end = string_begin; | 1097 auto string_base = string_begin; |
1099 auto string_base = string_begin; | 1098 |
1100 | 1099 int out_x = uX + uFrameX; |
1101 int out_x = uX + uFrameX; | 1100 int out_y = uY + uFrameY; |
1102 int out_y = uY + uFrameY; | 1101 v14 = 0; |
1103 v14 = 0; | 1102 |
1104 | 1103 if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height) |
1105 if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height) | 1104 return; |
1106 return; | 1105 |
1107 | 1106 if ( (signed int)v30 > 0 ) |
1108 if ( (signed int)v30 > 0 ) | 1107 { |
1109 { | 1108 do |
1110 do | 1109 { |
1110 unsigned char c = string_base[v14]; | |
1111 if ( c >= font->cFirstChar && c <= font->cLastChar | |
1112 || c == '\f' | |
1113 || c == '\r' | |
1114 || c == '\t' | |
1115 || c == '\n' ) | |
1116 { | |
1117 switch ( c ) | |
1111 { | 1118 { |
1112 unsigned char c = string_base[v14]; | 1119 case '\t': |
1113 if ( c >= font->cFirstChar && c <= font->cLastChar | 1120 strncpy(Dest, &string_base[v14 + 1], 3); |
1114 || c == '\f' | 1121 Dest[3] = 0; |
1115 || c == '\r' | 1122 v14 += 3; |
1116 || c == '\t' | 1123 left_margin = atoi(Dest); |
1117 || c == '\n' ) | 1124 out_x = uX + uFrameX + left_margin; |
1118 { | 1125 break; |
1119 switch ( c ) | 1126 case '\n': |
1127 uY = uY + LOBYTE(font->uFontHeight) - 3; | |
1128 out_y = uY + uFrameY; | |
1129 out_x = uX + uFrameX + left_margin; | |
1130 if ( max_text_height != 0 ) | |
1120 { | 1131 { |
1121 case '\t': | 1132 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) |
1122 strncpy(Dest, &string_base[v14 + 1], 3); | 1133 return; |
1123 Dest[3] = 0; | 1134 } |
1124 v14 += 3; | 1135 break; |
1125 left_margin = atoi(Dest); | 1136 case '\f': |
1126 out_x = uX + uFrameX + left_margin; | 1137 strncpy(Dest, &string_base[v14 + 1], 5); |
1127 break; | 1138 Dest[5] = 0; |
1128 case '\n': | 1139 uFontColor = atoi(Dest); |
1129 uY = uY + LOBYTE(font->uFontHeight) - 3; | 1140 v14 += 5; |
1130 out_y = uY + uFrameY; | 1141 break; |
1131 out_x = uX + uFrameX + left_margin; | 1142 case '\r': |
1132 if ( max_text_height != 0 ) | 1143 strncpy(Dest, &string_base[v14 + 1], 3); |
1133 { | 1144 Dest[3] = 0; |
1134 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) | 1145 v14 += 3; |
1135 return; | 1146 left_margin = atoi(Dest); |
1136 } | 1147 out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - left_margin; |
1137 break; | 1148 out_y = uY + uFrameY; |
1138 case '\f': | 1149 if ( max_text_height != 0 ) |
1139 strncpy(Dest, &string_base[v14 + 1], 5); | 1150 { |
1140 Dest[5] = 0; | 1151 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) |
1141 uFontColor = atoi(Dest); | 1152 return; |
1142 v14 += 5; | 1153 break; |
1143 break; | 1154 } |
1144 case '\r': | 1155 break; |
1145 strncpy(Dest, &string_base[v14 + 1], 3); | 1156 |
1146 Dest[3] = 0; | 1157 default: |
1147 v14 += 3; | 1158 if (c == '\"' && string_base[v14 + 1] == '\"') |
1148 v18 = atoi(Dest); | 1159 ++v14; |
1149 out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - v18; | |
1150 out_y = uY + uFrameY; | |
1151 if ( max_text_height != 0 ) | |
1152 { | |
1153 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height ) | |
1154 return; | |
1155 break; | |
1156 } | |
1157 break; | |
1158 | |
1159 default: | |
1160 if (c == '\"' && string_base[v14 + 1] == '\"') | |
1161 ++v14; | |
1162 | 1160 |
1163 c = (unsigned __int8)string_base[v14]; | 1161 c = (unsigned __int8)string_base[v14]; |
1164 if ( v14 > 0 ) | 1162 if ( v14 > 0 ) |
1165 out_x += font->pMetrics[c].uLeftSpacing; | 1163 out_x += font->pMetrics[c].uLeftSpacing; |
1166 | 1164 |
1167 unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]]; | 1165 unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]]; |
1168 if ( uFontColor ) | 1166 if ( uFontColor ) |
1169 pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), | 1167 pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), |
1170 font->pFontPalettes[0], uFontColor, uFontShadowColor); | 1168 font->pFontPalettes[0], uFontColor, uFontShadowColor); |
1171 else | 1169 else |
1172 pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), | 1170 pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight), |
1173 font->pFontPalettes[0], present_time_transparency); | 1171 font->pFontPalettes[0], present_time_transparency); |
1174 | 1172 |
1175 out_x += font->pMetrics[c].uWidth; | 1173 out_x += font->pMetrics[c].uWidth; |
1176 if ( (signed int)v14 < (signed int)v30 ) | 1174 if ( (signed int)v14 < (signed int)v30 ) |
1177 out_x += font->pMetrics[c].uRightSpacing; | 1175 out_x += font->pMetrics[c].uRightSpacing; |
1178 break; | 1176 break; |
1179 } | |
1180 } | 1177 } |
1181 } | 1178 } |
1182 while ( (signed int)++v14 < (signed int)v30 ); | 1179 } |
1183 } | 1180 while ( (signed int)++v14 < (signed int)v30 ); |
1184 } | 1181 } |
1185 | 1182 } |
1186 | 1183 |
1187 //----- (0044CB4F) -------------------------------------------------------- | 1184 //----- (0044CB4F) -------------------------------------------------------- |
1188 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text ) | 1185 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text ) |
1189 { | 1186 { |
1190 int pLineWidth; // ebx@1 | 1187 int pLineWidth; // ebx@1 |