Rev 6023 | Rev 6097 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6023 | Rev 6026 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | inc ecx |
22 | inc ecx |
23 | .more: |
23 | .more: |
24 | dec ecx |
24 | dec ecx |
25 | jz .end_of_line |
25 | jz .end_of_line |
26 | lodsb ; get one character of the string |
26 | lodsb ; get one character of the string |
- | 27 | test al, 0x80 |
|
- | 28 | jnz .multiball! |
|
27 | test al, al ; end of string? |
29 | test al, al ; end of string? |
28 | jz .almost_done |
30 | jz .almost_done |
29 | cmp al, ' ' ; it's a space! remember its position |
31 | cmp al, ' ' ; it's a space! remember its position |
30 | je .space |
32 | je .space |
31 | cmp al, 13 ; we already inserted a newline once, make it a space again |
33 | cmp al, 13 ; we already inserted a newline once, make it a space again |
Line 50... | Line 52... | ||
50 | dec esi |
52 | dec esi |
51 | .done: |
53 | .done: |
Line 52... | Line 54... | ||
52 | 54 | ||
Line -... | Line 55... | ||
- | 55 | ret |
|
- | 56 | ||
- | 57 | .multiball!: |
|
- | 58 | add esi, 4 |
|
- | 59 | and al, 11111000b |
|
- | 60 | cmp al, 11110000b |
|
- | 61 | je .more |
|
- | 62 | dec esi |
|
- | 63 | and al, 11110000b |
|
- | 64 | cmp al, 11100000b |
|
- | 65 | je .more |
|
- | 66 | dec esi |
|
- | 67 | jmp .more |
|
- | 68 | ||
53 | ret |
69 | |
54 | 70 | ||
55 | ;---------------------------------- |
71 | ;---------------------------------- |
56 | ; scan untill next line is reached |
72 | ; scan untill next line is reached |
57 | ; |
73 | ; |
Line 243... | Line 259... | ||
243 | pop [edi + window.text_print] |
259 | pop [edi + window.text_print] |
244 | jmp .draw_text |
260 | jmp .draw_text |
245 | .no_offset: |
261 | .no_offset: |
246 | xor ebx, ebx |
262 | xor ebx, ebx |
247 | .draw_text: |
263 | .draw_text: |
- | 264 | ||
248 | ; Prepare to actually draw some text |
265 | ; Prepare to actually draw some text |
249 | mov eax, [textbox_height] ; max number of lines to draw |
- | |
250 | add ebx, TEXT_X shl 16 + TEXT_Y |
266 | add ebx, TEXT_X shl 16 + TEXT_Y ; text coordinates |
251 | mov ecx, [colors.work_text] ; default text color |
267 | mov ecx, [colors.work_text] ; default text color |
- | 268 | or ecx, 0x30000000 |
|
252 | mov edx, [edi + window.text_print] |
269 | mov edx, [edi + window.text_print] ; start of text to print |
- | 270 | ||
- | 271 | ; Scan backwards on line for color escape codes |
|
- | 272 | mov esi, edx |
|
- | 273 | push edx |
|
- | 274 | std |
|
- | 275 | @@: |
|
- | 276 | lodsb |
|
- | 277 | cmp al, 0 ; end of text |
|
- | 278 | je @f |
|
- | 279 | cmp al, 10 ; hard newline |
|
- | 280 | je @f |
|
- | 281 | cmp al, 3 ; mIRC escape code |
|
- | 282 | jne @b |
|
- | 283 | ||
- | 284 | cld |
|
- | 285 | lea edx, [esi+2] |
|
- | 286 | call dec_to_esi |
|
- | 287 | jz @f |
|
- | 288 | mov ecx, [irc_colors + 4*esi] |
|
- | 289 | or ecx, 0x30000000 ; UTF-8 text |
|
- | 290 | ||
- | 291 | cmp byte[edx], ',' ; background color? |
|
- | 292 | jne @f |
|
- | 293 | inc edx |
|
- | 294 | call dec_to_esi |
|
- | 295 | jz @f |
|
- | 296 | mov edi, [irc_colors + 4*esi] |
|
- | 297 | or ecx, 0x40000000 ; enable background color |
|
- | 298 | @@: |
|
- | 299 | cld |
|
- | 300 | ||
- | 301 | pop edx |
|
- | 302 | mov eax, [textbox_height] ; max number of lines to draw |
|
253 | .drawloop: |
303 | .drawloop: |
254 | cmp byte[edx], 0 |
304 | cmp byte[edx], 0 |
255 | je .end_of_text |
305 | je .end_of_text |
Line 256... | Line 306... | ||
256 | 306 | ||
Line 264... | Line 314... | ||
264 | imul bx, FONT_WIDTH |
314 | imul bx, FONT_WIDTH |
265 | mov edx, [colors.work] |
315 | mov edx, [colors.work] |
266 | mcall 13 ; draw rectangle |
316 | mcall 13 ; draw rectangle |
267 | popa |
317 | popa |
Line 268... | Line 318... | ||
268 | 318 | ||
269 | mov esi, edx |
319 | push eax |
270 | add esi, [textbox_width] |
320 | mov esi, [textbox_width] |
271 | .line: |
321 | .line: |
272 | cmp byte[edx], 0 |
322 | cmp byte[edx], 0 |
273 | je .end_of_text |
- | |
274 | 323 | je .end_of_text |
|
275 | cmp byte[edx], 13 |
324 | cmp byte[edx], 13 |
276 | je .newline_soft |
- | |
277 | 325 | je .newline_soft |
|
278 | cmp byte[edx], 10 |
326 | cmp byte[edx], 10 |
Line 279... | Line 327... | ||
279 | je .newline_hard |
327 | je .newline_hard |
280 | 328 | ||
281 | push esi eax |
329 | push esi |
282 | cmp byte[edx], 3 ; escape code for mIRC colors |
330 | cmp byte[edx], 3 ; escape code for mIRC colors |
283 | jne .no_colors |
331 | jne .no_colors |
284 | inc edx |
332 | inc edx |
285 | call dec_to_esi |
333 | call dec_to_esi |
- | 334 | jz .no_colors |
|
Line 286... | Line 335... | ||
286 | jz .no_colors |
335 | mov ecx, [irc_colors + 4*esi] |
287 | mov ecx, [irc_colors + 4*esi] |
336 | or ecx, 0x30000000 |
288 | 337 | ||
289 | cmp byte[edx], ',' ; background color? |
338 | cmp byte[edx], ',' ; background color? |
Line 295... | Line 344... | ||
295 | or ecx, 0x40000000 |
344 | or ecx, 0x40000000 |
296 | .no_colors: |
345 | .no_colors: |
Line 297... | Line 346... | ||
297 | 346 | ||
298 | mov esi, 1 |
347 | mov esi, 1 |
- | 348 | mcall 4 ; draw text |
|
- | 349 | ||
- | 350 | mov esi, 1 |
|
- | 351 | mov al, byte[edx] |
|
- | 352 | test al, 10000000b |
|
- | 353 | jz @f |
|
- | 354 | mov esi, 4 |
|
- | 355 | and al, 11111000b |
|
- | 356 | cmp al, 11110000b |
|
- | 357 | je @f |
|
- | 358 | dec esi |
|
- | 359 | and al, 11110000b |
|
- | 360 | cmp al, 11100000b |
|
- | 361 | je @f |
|
- | 362 | dec esi |
|
- | 363 | @@: |
|
299 | mcall 4 ; draw text |
364 | |
300 | add ebx, FONT_WIDTH shl 16 |
365 | add ebx, FONT_WIDTH shl 16 |
301 | inc edx |
366 | add edx, esi |
302 | pop eax esi |
367 | pop esi |
303 | cmp edx, esi |
368 | dec esi |
304 | jb .line |
369 | jnz .line |
Line 305... | Line 370... | ||
305 | jmp .line_full |
370 | jmp .line_full |
306 | 371 | ||
- | 372 | .newline_hard: |
|
307 | .newline_hard: |
373 | mov ecx, [colors.work_text] |
308 | mov ecx, [colors.work_text] |
374 | or ecx, 0x30000000 |
309 | .newline_soft: |
375 | .newline_soft: |
310 | inc edx |
376 | inc edx |
311 | .line_full: |
377 | .line_full: |
- | 378 | and ebx, 0x0000ffff |
|
312 | and ebx, 0x0000ffff |
379 | add ebx, TEXT_X shl 16 + FONT_HEIGHT |
313 | add ebx, TEXT_X shl 16 + FONT_HEIGHT |
380 | pop eax |
314 | dec eax |
381 | dec eax |
Line 315... | Line 382... | ||
315 | jnz .drawloop |
382 | jnz .drawloop |