equal
deleted
inserted
replaced
50 InputStr: TChatLine; |
50 InputStr: TChatLine; |
51 InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char |
51 InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char |
52 ChatReady: boolean; |
52 ChatReady: boolean; |
53 showAll: boolean; |
53 showAll: boolean; |
54 |
54 |
55 const colors: array[#1..#6] of TSDL_Color = ( |
55 const colors: array[#0..#6] of TSDL_Color = ( |
|
56 (r:$FF; g:$FF; b:$FF; unused:$FF), // unused, feel free to take it for anything |
56 (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White] |
57 (r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White] |
57 (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple] |
58 (r:$FF; g:$00; b:$FF; unused:$FF), // action message [Purple] |
58 (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime] |
59 (r:$90; g:$FF; b:$90; unused:$FF), // join/leave message [Lime] |
59 (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow] |
60 (r:$FF; g:$FF; b:$A0; unused:$FF), // team message [Light Yellow] |
60 (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red] |
61 (r:$FF; g:$00; b:$00; unused:$FF), // error messages [Red] |
270 else |
271 else |
271 ParseCommand('/say ' + s, true); |
272 ParseCommand('/say ' + s, true); |
272 end; |
273 end; |
273 |
274 |
274 procedure KeyPressChat(Key: Longword); |
275 procedure KeyPressChat(Key: Longword); |
275 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0); |
276 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
276 var i, btw: integer; |
277 var i, btw: integer; |
277 utf8: shortstring; |
278 utf8: shortstring; |
278 begin |
279 begin |
279 |
280 |
280 if Key <> 0 then |
281 if Key <> 0 then |
320 begin |
321 begin |
321 utf8:= char((Key or $80) and $BF) + utf8; |
322 utf8:= char((Key or $80) and $BF) + utf8; |
322 Key:= Key shr 6 |
323 Key:= Key shr 6 |
323 end; |
324 end; |
324 |
325 |
325 utf8:= char(Key or firstByteMark[btw]) + utf8; |
326 utf8:= char(Key or firstByteMark[Pred(btw)]) + utf8; |
326 |
327 |
327 if byte(InputStr.s[0]) + btw > 240 then |
328 if byte(InputStr.s[0]) + btw > 240 then |
328 exit; |
329 exit; |
329 |
330 |
330 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |
331 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |