hedgewars/uChat.pas
changeset 15684 c7fe94d56d6e
parent 15673 74ede02bc882
child 15875 d7b53d08ad9c
equal deleted inserted replaced
15683:0d0f48f098f4 15684:c7fe94d56d6e
    36 
    36 
    37 implementation
    37 implementation
    38 uses uConsts, uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO, uScript, uRenderUtils, uStore, uLocale
    38 uses uConsts, uInputHandler, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO, uScript, uRenderUtils, uStore, uLocale
    39      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec{$ENDIF};
    39      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec{$ENDIF};
    40 
    40 
    41 const MaxStrIndex = 27;
    41 const MaxStrIndex = 27; // Max. possible string index
       
    42       MaxStrPartial = 7; // Max. displayed strings in normal mode
    42       MaxInputStrLen = 200;
    43       MaxInputStrLen = 200;
    43 
    44 
    44 type TChatLine = record
    45 type TChatLine = record
    45     Tex: PTexture;
    46     Tex: PTexture;
    46     Time: Longword;
    47     Time: Longword;
   387 
   388 
   388 if ChatHidden and (not showAll) then
   389 if ChatHidden and (not showAll) then
   389     visibleCount:= 0;
   390     visibleCount:= 0;
   390 
   391 
   391 // draw chat lines with some distance from screen border
   392 // draw chat lines with some distance from screen border
       
   393 left:= 4 - cScreenWidth div 2;
   392 {$IFDEF USE_TOUCH_INTERFACE}
   394 {$IFDEF USE_TOUCH_INTERFACE}
   393 left:= 4 - cScreenWidth div 2;
   395 i:= 55;
   394 top := 55 + visibleCount * ClHeight; // we start with input line (if any)
       
   395 {$ELSE}
   396 {$ELSE}
   396 left:= 4 - cScreenWidth div 2;
   397 i:= 10;
   397 top := 10 + visibleCount * ClHeight; // we start with input line (if any)
       
   398 {$ENDIF}
   398 {$ENDIF}
       
   399 top := i + visibleCount * ClHeight; // we start with input line (if any)
       
   400 if top > cScreenHeight - ClHeight - 60 then
       
   401     begin
       
   402     top:= cScreenHeight - ClHeight - 60;
       
   403     top:= i + top - (top mod ClHeight);
       
   404     end;
   399 
   405 
   400 // draw chat input line first and under all other lines
   406 // draw chat input line first and under all other lines
   401 if isInChatMode and (InputStr.Tex <> nil) then
   407 if isInChatMode and (InputStr.Tex <> nil) then
   402     begin
   408     begin
   403 
   409 
   482 
   488 
   483     cnt:= 0; // count of lines displayed
   489     cnt:= 0; // count of lines displayed
   484     t  := 1; // # of current line processed
   490     t  := 1; // # of current line processed
   485 
   491 
   486     // draw lines in reverse order
   492     // draw lines in reverse order
   487     while (((t < 7) and (Strs[i].Time > RealTicks)) or ((t <= MaxStrIndex + 1) and showAll))
   493     while (((t < MaxStrPartial) and (Strs[i].Time > RealTicks)) or ((t <= MaxStrIndex + 1) and showAll))
   488     and (Strs[i].Tex <> nil) do
   494     and (Strs[i].Tex <> nil) do
   489         begin
   495         begin
   490         top:= top - ClHeight;
   496         top:= top - ClHeight;
   491         // draw chatline only if not offscreen
   497         // draw chatline only if not offscreen
   492         if top > 0 then
   498         if top > 0 then