Commit 83bea462 authored by Kirinn's avatar Kirinn

sakurendermatic-con: Add a truecolor mode to console port, just press ctrl+w a few times

parent b8edf53c
......@@ -391,13 +391,47 @@ end;
var asciiBuf : array of dword;
{$endif}
procedure TRendermatic.BlitzAscii(x1, y1, x2, y2 : longint);
var srcp, writep : pointer;
var srcp, writep, endp : pointer;
thispal : PPaletteEntry;
outbuf : string;
workbuf : string[20];
x, y : longint;
l : dword;
b, g, r, thiscolor : byte;
thischar : char;
procedure _TrueBlitz; inline;
begin
endp := @outbuf[230];
y := y1;
while y < y2 do begin
GotoXY(x1, y);
srcp := outputBuffy + (y * longint(sysvar.windowSize.w) + x1) shl 2;
writep := @outbuf[1];
x := x1;
while x < x2 do begin
b := byte(srcp^); inc(srcp);
g := byte(srcp^); inc(srcp);
r := byte(srcp^); inc(srcp, 2);
workbuf := chr(27) + '[48;2;' + strdec(r) + ';' + strdec(g) + ';' + strdec(b) + 'm ';
move(workbuf[1], writep^, length(workbuf));
inc(writep, length(workbuf));
if writep > endp then begin
byte(outbuf[0]) := writep - @outbuf[1];
write(outbuf);
writep := @outbuf[1];
end;
inc(x);
end;
byte(outbuf[0]) := writep - @outbuf[1];
write(outbuf);
inc(y);
end;
end;
procedure _GetPalette; inline;
begin
b := byte(srcp^); inc(srcp);
......@@ -424,6 +458,8 @@ var srcp, writep : pointer;
var sx, sy, cellcount : dword;
begin
if (x1 >= x2) or (y1 >= y2) then exit; // safety
if sakuparam.palettemode = PM_TRUECOLOR then begin _TrueBlitz; exit; end;
sx := x2 - x1; sy := y2 - y1;
cellcount := sx * sy;
l := 0;
......@@ -443,18 +479,19 @@ begin
CrtWriteConOut(@asciiBuf[0], sx, sy, x1, y1, x2, y2);
end;
{$else}
var endp : pointer;
outbuf : string;
lastcolor : byte;
var lastcolor : byte;
begin
if (x1 >= x2) or (y1 >= y2) then exit; // safety
if sakuparam.palettemode = PM_TRUECOLOR then begin _TrueBlitz; exit; end;
lastcolor := $FF; l := 0;
SetColor(0);
endp := @outbuf[240];
for y := y1 to y2 - 1 do begin
GotoXY(x1, y);
srcp := outputBuffy + (y * longint(sysvar.windowSize.w) + x1) shl 2;
writep := @outbuf[1];
endp := writep + 240;
for x := x1 to x2 - 1 do begin
_GetPalette;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment