X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_console.pas;h=fcabed7ba667ec84613f3e80cb698ddcfbaac5f5;hb=4cd716955ad8f4e1c883f924b827c3244cee4af6;hp=d07bf3b4636efd661ddc6ec1768e0f0d1a683679;hpb=6b8ffe735038ca0a7704e7fad15868ef32a07925;p=d2df-sdl.git diff --git a/src/game/g_console.pas b/src/game/g_console.pas index d07bf3b..fcabed7 100644 --- a/src/game/g_console.pas +++ b/src/game/g_console.pas @@ -1,3 +1,18 @@ +(* Copyright (C) DooM 2D:Forever Developers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *) {$MODE DELPHI} unit g_console; @@ -858,42 +873,26 @@ begin end; end; -procedure g_Console_Add(L: String; Show: Boolean = False); -{var - a: Integer;} -begin - // Âûâîä ñòðîê ñ ïåðåíîñàìè ïî î÷åðåäè - { - while Pos(#10, L) > 0 do - begin - g_Console_Add(Copy(L, 1, Pos(#10, L) - 1), Show); - Delete(L, 1, Pos(#10, L)); - end; - } - - //SetLength(ConsoleHistory, Length(ConsoleHistory)+1); - //ConsoleHistory[High(ConsoleHistory)] := L; - - cbufPut(L); - if (length(L) = 0) or ((L[length(L)] <> #10) and (L[length(L)] <> #13)) then cbufPut(#10); +procedure g_Console_Add (L: string; Show: Boolean=false); - (* - Show := Show and gAllowConsoleMessages; - - if Show and gShowMessages then + procedure conmsg (s: AnsiString); + var + a: Integer; begin + if length(s) = 0 then exit; for a := 0 to High(MsgArray) do + begin with MsgArray[a] do + begin if Time = 0 then begin - Msg := L; + Msg := s; Time := MsgTime; - Exit; + exit; end; - - for a := 0 to High(MsgArray)-1 do - MsgArray[a] := MsgArray[a+1]; - + end; + end; + for a := 0 to High(MsgArray)-1 do MsgArray[a] := MsgArray[a+1]; with MsgArray[High(MsgArray)] do begin Msg := L; @@ -901,6 +900,31 @@ begin end; end; +var + f: Integer; +begin + // put it to console + cbufPut(L); + if (length(L) = 0) or ((L[length(L)] <> #10) and (L[length(L)] <> #13)) then cbufPut(#10); + + // now show 'em out of console too + Show := Show and gAllowConsoleMessages; + if Show and gShowMessages then + begin + // Âûâîä ñòðîê ñ ïåðåíîñàìè ïî î÷åðåäè + while length(L) > 0 do + begin + f := Pos(#10, L); + if f <= 0 then f := length(L)+1; + conmsg(Copy(L, 1, f-1)); + Delete(L, 1, f); + end; + end; + + //SetLength(ConsoleHistory, Length(ConsoleHistory)+1); + //ConsoleHistory[High(ConsoleHistory)] := L; + + (* {$IFDEF HEADLESS} e_WriteLog('CON: ' + L, MSG_NOTIFY); {$ENDIF}