summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d58548)
raw | patch | inline | side by side (parent: 7d58548)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 24 Aug 2017 16:07:48 +0000 (19:07 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 24 Aug 2017 16:08:02 +0000 (19:08 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_holmes.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index d80fb01700e774af6aee4e1a1097c4b5f71437f7..0668507b333bf73cd52bfb3e763705adddbc115d 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
procedure g_Console_Clear();
function g_Console_CommandBlacklisted(C: String): Boolean;
+procedure conwriteln (const s: AnsiString; show: Boolean=false);
+procedure conwritefln (const s: AnsiString; args: array of const; show: Boolean=false);
+
procedure g_Console_Chat_Switch(Team: Boolean = False);
var
uses
g_textures, g_main, e_graphics, e_input, g_game,
SysUtils, g_basic, g_options, wadreader, Math,
- g_menu, g_language, g_net, g_netmsg, e_log, conbuf;
+ g_menu, g_language, g_net, g_netmsg, e_log, conbuf, utils;
type
TCmdProc = procedure (P: SArray);
*)
end;
+
+var
+ consolewriterLastWasEOL: Boolean = false;
+
+procedure consolewriter (constref buf; len: SizeUInt);
+var
+ b: PByte;
+begin
+ if (len < 1) then exit;
+ b := PByte(@buf);
+ consolewriterLastWasEOL := (b[len-1] = 13) or (b[len-1] = 10);
+ while (len > 0) do
+ begin
+ if (b[0] <> 13) and (b[0] <> 10) then
+ begin
+ cbufPut(Char(b[0]));
+ end
+ else
+ begin
+ if (len > 1) and (b[0] = 13) then begin len -= 1; b += 1; end;
+ cbufPut(#10);
+ end;
+ len -= 1;
+ b += 1;
+ end;
+end;
+
+
+// returns formatted string if `writerCB` is `nil`, empty string otherwise
+//function formatstrf (const fmt: AnsiString; args: array of const; writerCB: TFormatStrFCallback=nil): AnsiString;
+//TFormatStrFCallback = procedure (constref buf; len: SizeUInt);
+procedure conwriteln (const s: AnsiString; show: Boolean=false);
+begin
+ g_Console_Add(s, show);
+end;
+
+
+procedure conwritefln (const s: AnsiString; args: array of const; show: Boolean=false);
+begin
+ if show then
+ begin
+ g_Console_Add(formatstrf(s, args), true);
+ end
+ else
+ begin
+ consolewriterLastWasEOL := false;
+ formatstrf(s, args, consolewriter);
+ if not consolewriterLastWasEOL then cbufPut(#10);
+ end;
+end;
+
+
procedure g_Console_Clear();
begin
//ConsoleHistory := nil;
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 8bbb880328132e98a426af6d69bfc7ac21c862dc..c518ca11f404a40bb59fda5495113515c79728f1 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
mapGrid.dbgRayTraceTileHitCB := nil;
{$ENDIF}
e_LogWritefln('v-trace: (%d,%d)-(%d,%d); end=(%d,%d); hit=%d', [pmsCurMapX, pmsCurMapY, pmsCurMapX, pmsCurMapY+10, ex, ey, (pan <> nil)]);
+ //conwritefln('!!!v-trace: (%d,%d)-(%d,%d); end=(%d,%d); hit=%d', [pmsCurMapX, pmsCurMapY, pmsCurMapX, pmsCurMapY+10, ex, ey, (pan <> nil)]);
exit;
end;
end;