196 lines
5.0 KiB
ObjectPascal
196 lines
5.0 KiB
ObjectPascal
program convbanners;
|
|
|
|
const
|
|
BannerModuleName = '_banners_m.pas';
|
|
GameCompleteFile = 'completed.txt';
|
|
ExitFile = 'exit.txt';
|
|
KeysFile = 'keys.txt';
|
|
MenuFile = 'menu.txt';
|
|
GameOverFile = 'gameover.txt';
|
|
PausedFile = 'paused.txt';
|
|
LevelFile = 'level.txt';
|
|
AfterImageLinesN = 2;
|
|
|
|
|
|
ModuleBeginH = 13;
|
|
|
|
{
|
|
const
|
|
MaxBannerWidth = KeyInfoWidth;
|
|
MaxBannerHeight = KeyInfoHeight;
|
|
type
|
|
BannerImage = array[1..MaxBannerHeight] of string[MaxBannerWidth];
|
|
}
|
|
|
|
|
|
ModuleBegin: array[1..ModuleBeginH] of string = (
|
|
'{ ************************************************** }',
|
|
'{ ************************************************** }',
|
|
'{ *** *** }',
|
|
'{ *** *** }',
|
|
'{ *** AUTOMATICALLY GENERATED FILE. DO NOT EDIT. *** }',
|
|
'{ *** *** }',
|
|
'{ *** *** }',
|
|
'{ ************************************************** }',
|
|
'{ ************************************************** }',
|
|
'unit _banners_m;',
|
|
'',
|
|
'interface',
|
|
'const'
|
|
);
|
|
|
|
KeyInfoCodeH = 10;
|
|
BannersKeyInfo: array[1..KeyInfoCodeH] of string = (
|
|
'KeyInfoHeight = 42;',
|
|
'KeyInfoWidth = 98;',
|
|
'MaxBannerHeight = KeyInfoHeight;',
|
|
'MaxBannerWidth = KeyInfoWidth;',
|
|
'type',
|
|
'BannerImage = array[1..MaxBannerHeight] of string[MaxBannerWidth];',
|
|
'const',
|
|
'KeyInfoScreen: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
{
|
|
KeyInfoCodeH = 5;
|
|
BannersKeyInfo: array[1..KeyInfoCodeH] of string = (
|
|
'KeyInfoHeight = 42;',
|
|
'KeyInfoWidth = 98;',
|
|
'KeyInfoScreen: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
}
|
|
|
|
ExitCodeH = 6;
|
|
BannersExit: array[1..ExitCodeH] of string = (
|
|
'ExitScreenHeight = 16;',
|
|
'ExitWidth = 70;',
|
|
'ExitHeight = 8;',
|
|
'ExitScreen: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
PauseCodeH = 5;
|
|
BannersPause: array[1..PauseCodeH] of string = (
|
|
'PauseHeight = 22;',
|
|
'PauseWidth = 76;',
|
|
'PauseAscii: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
CompleteCodeH = 6;
|
|
BannersGameComplete: array[1..CompleteCodeH] of string = (
|
|
'GameCompleteHeight = 14;',
|
|
'GameCompleteWidth = 74;',
|
|
'GameCompleteScoreWidth = 50;',
|
|
'GameComplete: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
MenuCodeH = 11;
|
|
BannersMenu: array[1..MenuCodeH] of string = (
|
|
'GameMenuHeight = 36;',
|
|
'GameNameHeight = 6;',
|
|
'GameNameWidth = 58;',
|
|
'NewGameHeight = 6;',
|
|
'HighScoreHeight = 8;',
|
|
'MenuInfoHeight = 8;',
|
|
'ContinueHeight = 6;',
|
|
'ContinueWidth = 41;',
|
|
'GameMenuScreen: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
GameOverCodeH = 5;
|
|
BannersGameOver: array[1..GameOverCodeH] of string = (
|
|
'GameOverHeight = 40;',
|
|
'GameOverWidth = 63;',
|
|
'GameOverScreen: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
LevelCodeH = 5;
|
|
BannersLevel: array[1..LevelCodeH] of string = (
|
|
'LevelAnnounceHeight = 6;',
|
|
'LevelAnnounceWidth = 24;',
|
|
'LevelAnnounce: BannerImage = (',
|
|
');',
|
|
''
|
|
);
|
|
|
|
ModuleEndH = 3;
|
|
ModuleEnd: array[1..ModuleEndH] of string = (
|
|
'implementation',
|
|
'end.',
|
|
''
|
|
);
|
|
|
|
procedure AppendText(var f: text; var t: array of string; h: integer);
|
|
var
|
|
i: integer;
|
|
begin
|
|
for i := 1 to h do
|
|
writeln(f, t[i - 1])
|
|
end;
|
|
|
|
procedure ConcatenateFiles(var fTo: text; var filename: string);
|
|
var
|
|
ln: string;
|
|
fFrom: text;
|
|
begin
|
|
assign(fFrom, fileName);
|
|
reset(fFrom);
|
|
while not eof(fFrom) do
|
|
begin
|
|
readln(fFrom, ln);
|
|
writeln(fTo, ln)
|
|
end
|
|
end;
|
|
|
|
procedure AppendAsciiBanner(var f: text; var t: array of string;
|
|
h: integer; fileName: string);
|
|
var
|
|
i: integer;
|
|
begin
|
|
for i := 1 to h do
|
|
begin
|
|
writeln(f, t[i - 1]);
|
|
if i = h - AfterImageLinesN then
|
|
ConcatenateFiles(f, fileName)
|
|
end
|
|
end;
|
|
|
|
procedure CreateBannerModule;
|
|
var
|
|
newModule: text;
|
|
begin
|
|
assign(newModule, BannerModuleName);
|
|
rewrite(newModule);
|
|
AppendText(newModule, ModuleBegin, ModuleBeginH);
|
|
AppendAsciiBanner(newModule, BannersKeyInfo, KeyInfoCodeH, KeysFile);
|
|
AppendAsciiBanner(newModule, BannersExit, ExitCodeH, ExitFile);
|
|
AppendAsciiBanner(newModule, BannersPause, PauseCodeH, PausedFile);
|
|
AppendAsciiBanner(newModule, BannersGameComplete, CompleteCodeH,
|
|
GameCompleteFile);
|
|
AppendAsciiBanner(newModule, BannersMenu, MenuCodeH, MenuFile);
|
|
AppendAsciiBanner(newModule, BannersGameOver, GameOverCodeH, GameOverFile);
|
|
|
|
AppendAsciiBanner(newModule, BannersLevel, LevelCodeH, LevelFile);
|
|
|
|
AppendText(newModule, ModuleEnd, ModuleEndH);
|
|
close(newModule)
|
|
end;
|
|
|
|
begin
|
|
CreateBannerModule
|
|
end.
|
|
|