(String str)
| 229 | * screen for a few moments ============== |
| 230 | */ |
| 231 | static void CenterPrint(String str) { |
| 232 | //char *s; |
| 233 | int s; |
| 234 | StringBuffer line = new StringBuffer(64); |
| 235 | int i, j, l; |
| 236 | |
| 237 | //strncpy (scr_centerstring, str, sizeof(scr_centerstring)-1); |
| 238 | scr_centerstring = str; |
| 239 | scr_centertime_off = scr_centertime.value; |
| 240 | scr_centertime_start = ClientGlobals.cl.time; |
| 241 | |
| 242 | // count the number of lines for centering |
| 243 | scr_center_lines = 1; |
| 244 | s = 0; |
| 245 | while (s < str.length()) { |
| 246 | if (str.charAt(s) == '\n') |
| 247 | scr_center_lines++; |
| 248 | s++; |
| 249 | } |
| 250 | |
| 251 | // echo it to the console |
| 252 | Com.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); |
| 253 | |
| 254 | s = 0; |
| 255 | |
| 256 | if (str.length() != 0) { |
| 257 | do { |
| 258 | // scan the width of the line |
| 259 | |
| 260 | for (l = 0; l < 40 && (l + s) < str.length(); l++) |
| 261 | if (str.charAt(s + l) == '\n' || str.charAt(s + l) == 0) |
| 262 | break; |
| 263 | for (i = 0; i < (40 - l) / 2; i++) |
| 264 | line.append(' '); |
| 265 | |
| 266 | for (j = 0; j < l; j++) { |
| 267 | line.append(str.charAt(s + j)); |
| 268 | } |
| 269 | |
| 270 | line.append('\n'); |
| 271 | |
| 272 | Com.Printf(line.toString()); |
| 273 | |
| 274 | while (s < str.length() && str.charAt(s) != '\n') |
| 275 | s++; |
| 276 | |
| 277 | if (s == str.length()) |
| 278 | break; |
| 279 | s++; // skip the \n |
| 280 | } while (true); |
| 281 | } |
| 282 | Com.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); |
| 283 | Console.ClearNotify(); |
| 284 | } |
| 285 | |
| 286 | private static void DrawCenterString() { |
| 287 | String cs = scr_centerstring + "\0"; |
no test coverage detected