Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DOC/ABOUT.HLP
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ _ __
$/ `| _ _ _. _ / _ _ February 5th, 2025
$\_,|(_|_\_\|(_/_(_)(_) Version 4.40
$/ `| _ _ _. _ / _ _ August 5th, 2025
$\_,|(_|_\_\|(_/_(_)(_) Version 4.41

$Table of Contents

Expand Down
12 changes: 12 additions & 0 deletions DOC/CHANGES.HLP
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Legend:
- Removals / Bugfixes
[] Platform {} Engine

$< ClassicZoo 4.41 >

+ [Windows] Fullscreen now available.
+ [SDL2] Custom charset and palettes
are now saved and reloaded on launch.
(Only if in the same directory as ZZT.)
* [SDL2] Fullscreen is now Borderless
Windowed instead of Exclusive.
* [SDL2] Fullscreen is now the default
on first launch.
* [Windows] Updated SDL2 to 2.32.8.

$< ClassicZoo 4.40 >

* [DOS] Replaced /NOSNOW and /SAFEV
Expand Down
8 changes: 6 additions & 2 deletions SRC/GAMECONF.PAS
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,6 @@ procedure GameConfigInit;
Inc(i);
{$ENDIF}
{$IFDEF SDL2}
{$IFNDEF WINDOWS}
with ConfigEntries[i] do begin
Category := CCFrontend;
Key := 'FVidWin';
Expand All @@ -1010,7 +1009,6 @@ procedure GameConfigInit;
ShowValue := ConfigFullscreenShowValue;
end;
Inc(i);
{$ENDIF}

with ConfigEntries[i] do begin
Category := CCFrontend;
Expand Down Expand Up @@ -1144,6 +1142,10 @@ function GameConfigLoad: boolean;
{$IFDEF SDL2}
end else if k = 'FInputID' then begin
InputSetControllerID(s);
end else if k = 'FChrFile' then begin
VideoSetCharsetFileName(s);
end else if k = 'FPalFile' then begin
VideoSetPaletteFileName(s);
{$ENDIF}
end else begin
Val(s, v, code);
Expand Down Expand Up @@ -1182,6 +1184,8 @@ function GameConfigSave: boolean;
end;
{$IFDEF SDL2}
WriteLn(f, 'Input=' + InputGetControllerID);
WriteLn(f, 'FChrFile=' + VideoGetCharsetFileName);
WriteLn(f, 'FPalFile=' + VideoGetPaletteFileName);
{$ENDIF}
for i := 1 to ConfigEntryCount do with ConfigEntries[i] do begin
{$IFNDEF FPC} if Length(Key) > 0 then begin {$ENDIF}
Expand Down
46 changes: 43 additions & 3 deletions SRC/SDL2/ZVIDEO.PAS
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ interface
{$ENDIF}
function VideoIsCharsetCustom: boolean;
function VideoIsPaletteCustom: boolean;
function VideoGetCharsetFileName: string;
function VideoGetPaletteFileName: string;
procedure VideoSetCharsetFileName(filename: string);
procedure VideoSetPaletteFileName(filename: string);
function VideoSetCharset(data: pointer; height: integer): boolean;
function VideoSetPaletteColor(idx, r, g, b: byte): boolean;
procedure VideoLoadCharsetDialog;
Expand Down Expand Up @@ -151,6 +155,8 @@ var
installed: boolean;
usingCustomCharset: boolean;
usingCustomPalette: boolean;
customCharsetFileName: string;
customPaletteFileName: string;
windowedLastWidth, windowedLastHeight: Int32;

{ macOS expects the SDL2 framework symbols. }
Expand Down Expand Up @@ -375,7 +381,7 @@ procedure VideoSetSDLWindowed(value: boolean);
SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(window), @mode);
SDL_SetWindowSize(window, mode.w, mode.h);
AfterSetWindowSize;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
AfterSetWindowSize;
windowed := false;
end else begin
Expand Down Expand Up @@ -549,22 +555,26 @@ procedure VideoLoadCharsetFromFile(filename: string);
begin
if filename = '' then begin
VideoSetCharset(nil, 14);
customCharsetFileName := '';
exit;
end;

charsetLen := FileReadAll(filename, charsetData, 8192);
if charsetLen >= 5027 then begin
if CompareMem(charsetData + 8, @FONT_MANIA_ID_STRING[1], Length(FONT_MANIA_ID_STRING)) then begin
VideoSetCharset(charsetData + 1442, 14);
customCharsetFileName := filename;
goto FinishLoadCharset;
end;
end else if ((charsetLen and $FF) = 0) and (charsetLen > 0) then begin
VideoSetCharset(charsetData, charsetLen shr 8);
customCharsetFileName := filename;
goto FinishLoadCharset;
end;

{ Fallback }
VideoSetCharset(nil, 14);
customCharsetFileName := '';
FinishLoadCharset:
if charsetLen > 0 then
FreeMem(charsetData, charsetLen);
Expand Down Expand Up @@ -610,6 +620,7 @@ procedure VideoLoadPaletteFromFile(filename: string);
begin
if filename = '' then begin
VideoSetPalette(EGA_PALETTE, false);
customPaletteFileName := '';
exit;
end;

Expand All @@ -623,6 +634,7 @@ procedure VideoLoadPaletteFromFile(filename: string);
or (((paletteDataArr^[(EGA_PALETTE_LUT[i] * 3) + 1] and $3F) * 255 div 63) shl 8)
or (((paletteDataArr^[(EGA_PALETTE_LUT[i] * 3) + 2] and $3F) * 255 div 63));
VideoSetPalette(palette, true);
customPaletteFileName := filename;
end else if paletteLen = 48 then begin
{ .PAL file }
for i := 0 to 15 do
Expand All @@ -631,9 +643,11 @@ procedure VideoLoadPaletteFromFile(filename: string);
or (((paletteDataArr^[(i * 3) + 1] and $3F) * 255 div 63) shl 8)
or (((paletteDataArr^[(i * 3) + 2] and $3F) * 255 div 63));
VideoSetPalette(palette, true);
customPaletteFileName := filename;
end else begin
{ Fallback }
VideoSetPalette(EGA_PALETTE, false);
customPaletteFileName := '';
end;

if paletteLen > 0 then
Expand Down Expand Up @@ -942,6 +956,16 @@ function VideoIsPaletteCustom: boolean;
VideoIsPaletteCustom := usingCustomPalette;
end;

function VideoGetPaletteFileName: string;
begin
VideoGetPaletteFileName := customPaletteFileName;
end;

procedure VideoSetPaletteFileName(filename: string);
begin
customPaletteFileName := filename;
end;

function VideoSetPaletteColor(idx, r, g, b: byte): boolean;
begin
SDL_LockMutex(eventMutex);
Expand All @@ -955,6 +979,16 @@ function VideoSetPaletteColor(idx, r, g, b: byte): boolean;
VideoSetPaletteColor := true;
end;

function VideoGetCharsetFileName: string;
begin
VideoGetCharsetFileName := customCharsetFileName;
end;

procedure VideoSetCharsetFileName(filename: string);
begin
customCharsetFileName := filename;
end;

function VideoSetCharset(data: pointer; height: integer): boolean;
label FinishSetCharset;
begin
Expand Down Expand Up @@ -1012,12 +1046,12 @@ function VideoInstall(mode: integer; charsetData: PTCharsetData; charsetHeight:
VideoCurrentMode := mode;

if not installed then begin
windowed := true;

window := SDL_CreateWindow('%NAME% %VERSION%',
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, {$IFDEF E_SUPERZ}400{$ELSE}{$IFDEF SHIFTJIS}400{$ELSE}350{$ENDIF}{$ENDIF},
SDL_WINDOW_RESIZABLE or SDL_WINDOW_ALLOW_HIGHDPI);
if not windowed then
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
end;

{$IFDEF SHIFTJIS}
Expand Down Expand Up @@ -1045,6 +1079,12 @@ function VideoInstall(mode: integer; charsetData: PTCharsetData; charsetHeight:
palette[i] := EGA_PALETTE[i];
usingCustomPalette := false;

if VideoGetCharsetFileName <> '' then
VideoLoadCharsetFromFile(VideoGetCharsetFileName);

if VideoGetPaletteFileName <> '' then
VideoLoadPaletteFromFile(VideoGetPaletteFileName);

if not installed then begin
mainThreadSdlChangesMutex := SDL_CreateMutex;
playfieldMutex := SDL_CreateMutex;
Expand Down
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME=ClassicZoo
VERSION=4.39
COPYRIGHT=Copyright (c) 2022, 2023 Adrian Siekierka
VERSION=4.41
COPYRIGHT=Copyright (c) 2022-2025 Adrian Siekierka