equal
deleted
inserted
replaced
294 procedure KeyPressChat(Key: Longword); |
294 procedure KeyPressChat(Key: Longword); |
295 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
295 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
296 var i, btw: integer; |
296 var i, btw: integer; |
297 utf8: shortstring; |
297 utf8: shortstring; |
298 begin |
298 begin |
299 if Key <> 0 then |
299 if Key <> 0 then |
300 case Key of |
300 case Key of |
301 {Backspace} |
301 {Backspace} |
302 8, 127: if Length(InputStr.s) > 0 then |
302 8, 127: if Length(InputStr.s) > 0 then |
303 begin |
303 begin |
304 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])]; |
304 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])]; |
323 FreezeEnterKey; |
323 FreezeEnterKey; |
324 SDL_EnableKeyRepeat(0,0); |
324 SDL_EnableKeyRepeat(0,0); |
325 GameState:= gsGame; |
325 GameState:= gsGame; |
326 ResetKbd; |
326 ResetKbd; |
327 end; |
327 end; |
328 else |
|
329 if (Key < $80) then |
|
330 btw:= 1 |
|
331 else if (Key < $800) then |
|
332 btw:= 2 |
|
333 else if (Key < $10000) then |
|
334 btw:= 3 |
|
335 else |
328 else |
336 btw:= 4; |
329 if (Key < $80) then |
337 |
330 btw:= 1 |
338 utf8:= ''; |
331 else if (Key < $800) then |
339 |
332 btw:= 2 |
340 for i:= btw downto 2 do |
333 else if (Key < $10000) then |
341 begin |
334 btw:= 3 |
342 utf8:= char((Key or $80) and $BF) + utf8; |
335 else |
343 Key:= Key shr 6 |
336 btw:= 4; |
344 end; |
337 |
345 |
338 utf8:= ''; |
346 utf8:= char(Key or firstByteMark[Pred(btw)]) + utf8; |
339 |
347 |
340 for i:= btw downto 2 do |
348 if byte(InputStr.s[0]) + btw > 240 then |
341 begin |
349 exit; |
342 utf8:= char((Key or $80) and $BF) + utf8; |
350 |
343 Key:= Key shr 6 |
351 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |
344 end; |
352 SetLine(InputStr, InputStr.s + utf8, true) |
345 |
353 end |
346 utf8:= char(Key or firstByteMark[Pred(btw)]) + utf8; |
|
347 |
|
348 if byte(InputStr.s[0]) + btw > 240 then |
|
349 exit; |
|
350 |
|
351 InputStrL[byte(InputStr.s[0]) + btw]:= InputStr.s[0]; |
|
352 SetLine(InputStr, InputStr.s + utf8, true) |
|
353 end |
354 end; |
354 end; |
355 |
355 |
356 procedure chChatMessage(var s: shortstring); |
356 procedure chChatMessage(var s: shortstring); |
357 begin |
357 begin |
358 AddChatString(s) |
358 AddChatString(s) |