Merge pull request 'feat/TD-009-add-scoreboard' (#8) from dev into main
Reviewed-on: #8
This commit is contained in:
commit
416cbe9bbb
@ -2,7 +2,7 @@ FPC = fpc
|
|||||||
|
|
||||||
GAME_SRC = gohamster.pas arena_m.pas cell_m.pas creature_m.pas debug_m.pas \
|
GAME_SRC = gohamster.pas arena_m.pas cell_m.pas creature_m.pas debug_m.pas \
|
||||||
ghost_m.pas graphics_m.pas hamster_m.pas keys_m.pas math_m.pas \
|
ghost_m.pas graphics_m.pas hamster_m.pas keys_m.pas math_m.pas \
|
||||||
trace_m.pas
|
trace_m.pas _banners_m.pas
|
||||||
|
|
||||||
all: gohamster
|
all: gohamster
|
||||||
|
|
||||||
@ -14,3 +14,4 @@ gohamster: $(GAME_SRC)
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o *.ppu gohamster
|
rm *.o *.ppu gohamster
|
||||||
|
|
||||||
|
|||||||
358
src/_banners_m.pas
Normal file
358
src/_banners_m.pas
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
{ ************************************************** }
|
||||||
|
{ ************************************************** }
|
||||||
|
{ *** *** }
|
||||||
|
{ *** *** }
|
||||||
|
{ *** AUTOMATICALLY GENERATED FILE. DO NOT EDIT. *** }
|
||||||
|
{ *** *** }
|
||||||
|
{ *** *** }
|
||||||
|
{ ************************************************** }
|
||||||
|
{ ************************************************** }
|
||||||
|
unit _banners_m;
|
||||||
|
|
||||||
|
interface
|
||||||
|
const
|
||||||
|
KeyInfoHeight = 42;
|
||||||
|
KeyInfoWidth = 98;
|
||||||
|
MaxBannerHeight = KeyInfoHeight;
|
||||||
|
MaxBannerWidth = KeyInfoWidth;
|
||||||
|
type
|
||||||
|
BannerImage = array[1..MaxBannerHeight] of string[MaxBannerWidth];
|
||||||
|
const
|
||||||
|
KeyInfoScreen: BannerImage = (
|
||||||
|
' _',
|
||||||
|
' | |',
|
||||||
|
' _ __ ___ _____ _____ | | _____ _ _ ___ _',
|
||||||
|
' | ''_ ` _ \ / _ \ \ / / _ \ | |/ / _ \ | | / __| (_)',
|
||||||
|
' | | | | | | (_) \ V / __/ | < __/ |_| \__ \ _',
|
||||||
|
' |_| |_| |_|\___/ \_/ \___| |_|\_\___|\__, |___/ (_)',
|
||||||
|
' __/ |',
|
||||||
|
' _ |___/',
|
||||||
|
' / \',
|
||||||
|
' / . \',
|
||||||
|
' / / \ \',
|
||||||
|
' /_/| |\_\',
|
||||||
|
' | |',
|
||||||
|
' |_|',
|
||||||
|
' __ ========= __',
|
||||||
|
' / / (\_/) \ \',
|
||||||
|
' / /_____ ( 0_0 ) ______\ \ ',
|
||||||
|
' { ______| /-----\ |_______ }',
|
||||||
|
' \ \ |___| / /',
|
||||||
|
' \_\ / \ /_/',
|
||||||
|
' ========== _ ===========',
|
||||||
|
' | |',
|
||||||
|
' _ | | _ ',
|
||||||
|
' \ \| |/ /',
|
||||||
|
' \ \ / / ',
|
||||||
|
' \ ` / ',
|
||||||
|
' \_/',
|
||||||
|
' =========',
|
||||||
|
' _ _ _',
|
||||||
|
' | | | | | |',
|
||||||
|
' ___ _ __ __ _ ___ ___ ___| |_ ___ _ __ | |__ __ _ _ __ ___ ___| |_ ___ _ __',
|
||||||
|
' / __| ''_ \ / _` |/ __/ _ \ ______ / __| __/ _ \| ''_ \ | ''_ \ / _` | ''_ ` _ \/ __| __/ _ \ ''__|',
|
||||||
|
' \__ \ |_) | (_| | (_| __/ |______| \__ \ || (_) | |_) | | | | | (_| | | | | | \__ \ || __/ |',
|
||||||
|
' |___/ .__/ \__,_|\___\___| |___/\__\___/| .__/ |_| |_|\__,_|_| |_| |_|___/\__\___|_|',
|
||||||
|
' ====| |=================== | |',
|
||||||
|
' |_| |_|',
|
||||||
|
' ___ ___ ___ _ __ __ _ _ _ ___ ___',
|
||||||
|
' / _ \/ __|/ __| ______ | ''_ \ / _` | | | / __|/ _ \',
|
||||||
|
'| __/\__ \ (__ |______| | |_) | (_| | |_| \__ \ __/',
|
||||||
|
' \___||___/\___| | .__/ \__,_|\__,_|___/\___|',
|
||||||
|
'================ | |',
|
||||||
|
' |_|'
|
||||||
|
);
|
||||||
|
|
||||||
|
ExitScreenHeight = 16;
|
||||||
|
ExitWidth = 70;
|
||||||
|
ExitHeight = 8;
|
||||||
|
ExitScreen: BannerImage = (
|
||||||
|
' ______ _ _ _ _ ___',
|
||||||
|
'| ____| (_) | | | | | |__ \',
|
||||||
|
'| |__ __ ___| |_ | |_| |__ ___ __ _ __ _ _ __ ___ ___ ) |',
|
||||||
|
'| __| \ \/ / | __| | __| ''_ \ / _ \ / _` |/ _` | ''_ ` _ \ / _ \/ /',
|
||||||
|
'| |____ > <| | |_ | |_| | | | __/ | (_| | (_| | | | | | | __/_|',
|
||||||
|
'|______/_/\_\_|\__| \__|_| |_|\___| \__, |\__,_|_| |_| |_|\___(_)',
|
||||||
|
' __/ |',
|
||||||
|
' |___/',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
' _ _ ___ ___ _ __ ___',
|
||||||
|
'| | | |/ _ \/ __| | ''_ \ / _ \',
|
||||||
|
'| |_| | __/\__ \ | | | | (_) |',
|
||||||
|
' \__, |\___||___/ |_| |_|\___/',
|
||||||
|
' __/ |',
|
||||||
|
' |___/',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
PauseHeight = 22;
|
||||||
|
PauseWidth = 76;
|
||||||
|
PauseAscii: BannerImage = (
|
||||||
|
' _',
|
||||||
|
' | |',
|
||||||
|
' _ __ __ _ _ _ ___ ___ __| |',
|
||||||
|
' | ''_ \ / _` | | | / __|/ _ \/ _` |',
|
||||||
|
' | |_) | (_| | |_| \__ \ __/ (_| |',
|
||||||
|
' | .__/ \__,_|\__,_|___/\___|\__,_| ',
|
||||||
|
' | | ',
|
||||||
|
' |_| _ _',
|
||||||
|
' | | (_)',
|
||||||
|
' ___ _ __ __ _ __ ___ ___ ___ _ __ | |_ _ _ __ _ _ ___',
|
||||||
|
'/ __| ''_ \ / _` |/ __/ _ \ ______ / __/ _ \| ''_ \| __| | ''_ \| | | |/ _ \',
|
||||||
|
'\__ \ |_) | (_| | (_| __/ |______| | (_| (_) | | | | |_| | | | | |_| | __/',
|
||||||
|
'|___/ .__/ \__,_|\___\___| \___\___/|_| |_|\__|_|_| |_|\__,_|\___|',
|
||||||
|
'====| |===================',
|
||||||
|
' |_| _ _ _',
|
||||||
|
' (_) | | |',
|
||||||
|
' __ _ __ _ _ _ _| |_ | |_ ___ _ __ ___ ___ _ __ _ _',
|
||||||
|
' / _` | ______ / _` | | | | | __| | __/ _ \ | ''_ ` _ \ / _ \ ''_ \| | | |',
|
||||||
|
'| (_| | |______| | (_| | |_| | | |_ | || (_) | | | | | | | __/ | | | |_| |',
|
||||||
|
' \__, | \__, |\__,_|_|\__| \__\___/ |_| |_| |_|\___|_| '' |_|\__,_|',
|
||||||
|
'====| |= | |',
|
||||||
|
' |_| |_|',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
GameCompleteHeight = 14;
|
||||||
|
GameCompleteWidth = 74;
|
||||||
|
GameCompleteScoreWidth = 50;
|
||||||
|
GameComplete: BannerImage = (
|
||||||
|
' _____ _ _ _ ',
|
||||||
|
' / ____| | | | | | |',
|
||||||
|
'| | __ __ _ _ __ ___ ___ ___ ___ _ __ ___ _ __ | | ___| |_ ___| |',
|
||||||
|
'| | |_ |/ _` | ''_ ` _ \ / _ \ / __/ _ \| ''_ ` _ \| ''_ \| |/ _ \ __/ _ \ |',
|
||||||
|
'| |__| | (_| | | | | | | __/ | (_| (_) | | | | | | |_) | | __/ || __/_|',
|
||||||
|
' \_____|\__,_|_| |_| |_|\___| \___\___/|_| |_| |_| .__/|_|\___|\__\___(_)',
|
||||||
|
' | |',
|
||||||
|
' |_|',
|
||||||
|
'__ __',
|
||||||
|
'\ \ / / _ ',
|
||||||
|
' \ \_/ /__ _ _ _ __ ___ ___ ___ _ __ ___(_)',
|
||||||
|
' \ / _ \| | | | ''__| / __|/ __/ _ \| ''__/ _ \',
|
||||||
|
' | | (_) | |_| | | \__ \ (_| (_) | | | __/_ ',
|
||||||
|
' |_|\___/ \__,_|_| |___/\___\___/|_| \___(_)',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
GameMenuHeight = 36;
|
||||||
|
GameNameHeight = 6;
|
||||||
|
GameNameWidth = 58;
|
||||||
|
NewGameHeight = 6;
|
||||||
|
HighScoreHeight = 8;
|
||||||
|
MenuInfoHeight = 8;
|
||||||
|
ContinueHeight = 6;
|
||||||
|
ContinueWidth = 41;
|
||||||
|
GameMenuScreen: BannerImage = (
|
||||||
|
' _____ _ _ _ _',
|
||||||
|
' / ____| | | | | | | | |',
|
||||||
|
'| | __ ___ | | | |__| | __ _ _ __ ___ ___| |_ ___ _ __',
|
||||||
|
'| | |_ |/ _ \| | | __ |/ _` | ''_ ` _ \/ __| __/ _ \ ''__|',
|
||||||
|
'| |__| | (_) |_| | | | | (_| | | | | | \__ \ || __/ |',
|
||||||
|
' \_____|\___/(_) |_| |_|\__,_|_| |_| |_|___/\__\___|_|',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
' _ _ _____',
|
||||||
|
'| \ | | / ____|',
|
||||||
|
'| \| | _____ __ | | __ __ _ _ __ ___ ___',
|
||||||
|
'| . ` |/ _ \ \ /\ / / | | |_ |/ _` | ''_ ` _ \ / _ \',
|
||||||
|
'| |\ | __/\ V V / | |__| | (_| | | | | | | __/',
|
||||||
|
'|_| \_|\___| \_/\_/ \_____|\__,_|_| |_| |_|\___|',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
' _ __ _____ __',
|
||||||
|
'| |/ / |_ _| / _|',
|
||||||
|
'| '' / ___ _ _ | | _ __ | |_ ___',
|
||||||
|
'| < / _ \ | | | | | | ''_ \| _/ _ \',
|
||||||
|
'| . \ __/ |_| | _| |_| | | | || (_) |',
|
||||||
|
'|_|\_\___|\__, | |_____|_| |_|_| \___/',
|
||||||
|
' __/ |',
|
||||||
|
' |___/',
|
||||||
|
' _____ _ _ ',
|
||||||
|
' / ____| | | (_) ',
|
||||||
|
'| | ___ _ __ | |_ _ _ __ _ _ ___ ',
|
||||||
|
'| | / _ \| ''_ \| __| | ''_ \| | | |/ _ \',
|
||||||
|
'| |___| (_) | | | | |_| | | | | |_| | __/',
|
||||||
|
' \_____\___/|_| |_|\__|_|_| |_|\__,_|\___|',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
GameOverHeight = 40;
|
||||||
|
GameOverWidth = 63;
|
||||||
|
GameOverScreen: BannerImage = (
|
||||||
|
' _____ __ __ ______ ',
|
||||||
|
' / ____| /\ | \/ | ____|',
|
||||||
|
' | | __ / \ | \ / | |__ ',
|
||||||
|
' | | |_ | / /\ \ | |\/| | __|',
|
||||||
|
' | |__| |/ ____ \| | | | |____',
|
||||||
|
' \_____/_/ \_\_| |_|______|',
|
||||||
|
' ______ ________ _____',
|
||||||
|
' / __ \ \ / / ____| __ \',
|
||||||
|
' | | | \ \ / /| |__ | |__) |',
|
||||||
|
' | | | |\ \/ / | __| | _ /',
|
||||||
|
' | |__| | \ / | |____| | \ \',
|
||||||
|
' \____/ \/ |______|_| \_\',
|
||||||
|
'',
|
||||||
|
' ____ ____',
|
||||||
|
' / o@@\ /@@o \',
|
||||||
|
' / /``\@\ __,-==-,__ /@/``\ \',
|
||||||
|
' / /` `||//\______/ \||` `\ \',
|
||||||
|
' | |` // __ __ \\ `| |',
|
||||||
|
' \ \` (/ /;g\ /g;\ \) `/ |',
|
||||||
|
' \_\__(( " .. " )____/_/',
|
||||||
|
' \ " __ " / ',
|
||||||
|
' @@@@@@(||)@@@@`@@`@@@@(||)@@@@@@@',
|
||||||
|
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
|
||||||
|
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
|
||||||
|
' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',
|
||||||
|
' ',
|
||||||
|
' _ _ ___',
|
||||||
|
' | | (_) |__ \',
|
||||||
|
' ___ ___ _ __ | |_ _ _ __ _ _ ___ ) |',
|
||||||
|
' / __/ _ \| ''_ \| __| | ''_ \| | | |/ _ \ / /',
|
||||||
|
' | (_| (_) | | | | |_| | | | | |_| | __/ |_|',
|
||||||
|
' \___\___/|_| |_|\__|_|_| |_|\__,_|\___| (_)',
|
||||||
|
' ___ ___ __ ___ ___',
|
||||||
|
'| _| |_ | \ \ | _| |_ |',
|
||||||
|
'| | _ _ | | ___ ___ \ \ | | _ __ | | ___',
|
||||||
|
'| | | | | | | |/ _ \/ __| \ \ | | | ''_ \ | |/ _ \',
|
||||||
|
'| | | |_| | | | __/\__ \ \ \ | | | | | | | | (_) |',
|
||||||
|
'| |_ \__, | _| |\___||___/ \ \ | |_ |_| |_| _| |\___/',
|
||||||
|
'|___|=====/ |=|___| \_\ |___|=========|___|',
|
||||||
|
' |___/',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
LevelAnnounceHeight = 6;
|
||||||
|
LevelAnnounceWidth = 24;
|
||||||
|
LevelAnnounce: BannerImage = (
|
||||||
|
' _ _ ',
|
||||||
|
'| | | |',
|
||||||
|
'| | _____ _____| |',
|
||||||
|
'| | / _ \ \ / / _ \ |',
|
||||||
|
'| |___| __/\ V / __/ |',
|
||||||
|
'|______\___| \_/ \___|_|',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
end.
|
||||||
|
|
||||||
@ -2,7 +2,7 @@ unit arena_m;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses creature_m, trace_m, hamster_m, debug_m;
|
uses creature_m, trace_m, hamster_m;
|
||||||
|
|
||||||
const
|
const
|
||||||
ArenaH = 33;
|
ArenaH = 33;
|
||||||
@ -12,10 +12,10 @@ const
|
|||||||
ArenaSymbol = ' ';
|
ArenaSymbol = ' ';
|
||||||
|
|
||||||
type
|
type
|
||||||
arenaBooleanMatrix = array [1..ArenaW, 1..ArenaH] of boolean;
|
arenaMatrix = array [1..ArenaW, 1..ArenaH] of boolean;
|
||||||
|
|
||||||
arena = record
|
arena = record
|
||||||
captured, borders: arenaBooleanMatrix;
|
captured, borders: arenaMatrix;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ArenaSplited(var h: creature; var t: tracePtr; var a: arena): boolean;
|
function ArenaSplited(var h: creature; var t: tracePtr; var a: arena): boolean;
|
||||||
@ -36,7 +36,7 @@ implementation
|
|||||||
|
|
||||||
uses cell_m, graphics_m, math_m;
|
uses cell_m, graphics_m, math_m;
|
||||||
|
|
||||||
procedure Fill(var m: arenaBooleanMatrix; val: boolean);
|
procedure Fill(var m: arenaMatrix; val: boolean);
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -2,11 +2,11 @@ unit debug_m;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses {arena_m,} cell_m, creature_m;
|
uses arena_m, cell_m, creature_m;
|
||||||
|
|
||||||
procedure Debug;
|
procedure Debug;
|
||||||
procedure DebugCell(cell: cellItemPtr);
|
procedure DebugCell(cell: cellItemPtr);
|
||||||
{procedure Print(var m: arenaBooleanMatrix);}
|
procedure Print(var m: arenaMatrix);
|
||||||
|
|
||||||
procedure PrintCreatureDebug(var cr: creature);
|
procedure PrintCreatureDebug(var cr: creature);
|
||||||
|
|
||||||
@ -34,8 +34,7 @@ begin
|
|||||||
DebugTmp := DebugTmp + 1
|
DebugTmp := DebugTmp + 1
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
procedure Print(var m: arenaMatrix);
|
||||||
procedure Print(var m: arenaBooleanMatrix);
|
|
||||||
var
|
var
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
@ -50,7 +49,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
GotoXY(1, 1)
|
GotoXY(1, 1)
|
||||||
end;
|
end;
|
||||||
}
|
|
||||||
|
|
||||||
procedure PrintCreatureDebug(var cr: creature);
|
procedure PrintCreatureDebug(var cr: creature);
|
||||||
var
|
var
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
program go_hamster;
|
program go_hamster;
|
||||||
uses crt, arena_m, trace_m, creature_m, graphics_m, hamster_m, keys_m, ghost_m,
|
uses crt, arena_m, trace_m, creature_m, graphics_m, hamster_m, keys_m,
|
||||||
debug_m;
|
ghost_m, debug_m;
|
||||||
|
|
||||||
const
|
const
|
||||||
DelaySizeMs = 75;
|
DelaySizeMs = 100;
|
||||||
|
|
||||||
procedure RunLevel;
|
procedure RunLevel;
|
||||||
var
|
var
|
||||||
@ -17,6 +17,7 @@ begin
|
|||||||
InitGhost(g);
|
InitGhost(g);
|
||||||
DrawCreature(h);
|
DrawCreature(h);
|
||||||
DrawCreature(g);
|
DrawCreature(g);
|
||||||
|
DrawScore(12345);
|
||||||
while continueLevel do
|
while continueLevel do
|
||||||
begin
|
begin
|
||||||
delay(DelaySizeMs);
|
delay(DelaySizeMs);
|
||||||
@ -48,3 +49,4 @@ begin
|
|||||||
RunLevel;
|
RunLevel;
|
||||||
clrscr
|
clrscr
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -4,15 +4,17 @@ interface
|
|||||||
|
|
||||||
uses arena_m, creature_m, hamster_m, trace_m;
|
uses arena_m, creature_m, hamster_m, trace_m;
|
||||||
|
|
||||||
procedure DrawAfterStep(var hamster: creature; var t: tracePtr; var a: arena);
|
function IsTerminalValid: boolean;
|
||||||
procedure DrawAfterStep(var cr: creature; var a: arena);
|
procedure DrawAfterStep(var cr: creature; var a: arena);
|
||||||
|
procedure DrawAfterStep(var hamster: creature; var t: tracePtr; var a: arena);
|
||||||
procedure DrawArenaBorders(var a: arena);
|
procedure DrawArenaBorders(var a: arena);
|
||||||
procedure DrawArenaCell(arenaX, arenaY: integer; symbol: char);
|
procedure DrawArenaCell(arenaX, arenaY: integer; symbol: char);
|
||||||
procedure DrawArenaEdges;
|
procedure DrawArenaEdges;
|
||||||
procedure DrawCreature(var cr: creature);
|
procedure DrawCreature(var cr: creature);
|
||||||
|
{procedure DrawKills(killCounter: integer);}
|
||||||
|
procedure DrawScore(s: integer);
|
||||||
procedure DrawLevel;
|
procedure DrawLevel;
|
||||||
procedure EraseTrace(var hamster: creature; t: tracePtr);
|
procedure EraseTrace(var hamster: creature; t: tracePtr);
|
||||||
function IsTerminalValid: boolean;
|
|
||||||
procedure PrintTerminalHelp;
|
procedure PrintTerminalHelp;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -25,8 +27,10 @@ const
|
|||||||
BorderSize = 1;
|
BorderSize = 1;
|
||||||
ScreenW = (ArenaW - 1) * CellSize + BorderSize * 2; { 79 }
|
ScreenW = (ArenaW - 1) * CellSize + BorderSize * 2; { 79 }
|
||||||
ScreenH = (ArenaH + InterfaceH) * CellSize + BorderSize;
|
ScreenH = (ArenaH + InterfaceH) * CellSize + BorderSize;
|
||||||
|
InterfaceCellW = ScreenW div 3;
|
||||||
WidthCoefficient = 2;
|
WidthCoefficient = 2;
|
||||||
InterfaceBarH = ScreenW - ArenaH * CellSize - BorderSize * 2; { 14 }
|
InterfaceBarH = ScreenW - ArenaH * CellSize - BorderSize * 2; { 14 }
|
||||||
|
LetterWidth = 6;
|
||||||
|
|
||||||
function IsTerminalValid: boolean;
|
function IsTerminalValid: boolean;
|
||||||
begin
|
begin
|
||||||
@ -88,12 +92,10 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure DrawInterface;
|
procedure DrawInterface;
|
||||||
var
|
|
||||||
cellW: integer = ScreenW div 3;
|
|
||||||
begin
|
begin
|
||||||
DrawLineX(1, InterfaceBarH, ScreenW * WidthCoefficient);
|
DrawLineX(1, InterfaceBarH, ScreenW * WidthCoefficient);
|
||||||
DrawLineY(cellW * WidthCoefficient, 1, InterfaceBarH);
|
DrawLineY(InterfaceCellW * WidthCoefficient, 1, InterfaceBarH);
|
||||||
DrawLineY(cellW * 2 * WidthCoefficient + 1, 1, InterfaceBarH)
|
DrawLineY(InterfaceCellW * 2 * WidthCoefficient + 1, 1, InterfaceBarH)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawLevel;
|
procedure DrawLevel;
|
||||||
@ -274,4 +276,267 @@ begin
|
|||||||
DrawCreature(cr)
|
DrawCreature(cr)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
procedure DrawKills(killCounter: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(1, 81);
|
||||||
|
while killCounter <> 0 do
|
||||||
|
begin
|
||||||
|
write(killCounter mod 10);
|
||||||
|
killCounter := killCounter div 10
|
||||||
|
end;
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
}
|
||||||
|
|
||||||
|
procedure DrawZero(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawOne(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write(' @ ');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write(' @@ ');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@ @ ');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @ ');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawTwo(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write('@ ');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawThree(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawFour(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawFive(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ ');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawSix(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ ');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawSeven(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawEight(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawNine(x, y: integer);
|
||||||
|
begin
|
||||||
|
GotoXY(x, y);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 1);
|
||||||
|
write('@ @');
|
||||||
|
GotoXY(x, y + 2);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(x, y + 3);
|
||||||
|
write(' @');
|
||||||
|
GotoXY(x, y + 4);
|
||||||
|
write('@@@@@');
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure FillRectangle(x, y, w, h: integer; ch: char);
|
||||||
|
var
|
||||||
|
i, j: integer;
|
||||||
|
begin
|
||||||
|
for i := 0 to h do
|
||||||
|
begin
|
||||||
|
GotoXY(x, y + i);
|
||||||
|
for j := 0 to w do
|
||||||
|
write(ch)
|
||||||
|
end;
|
||||||
|
GotoXY(1, 1)
|
||||||
|
end;
|
||||||
|
|
||||||
|
type
|
||||||
|
stackIntPtr = ^stackIntItem;
|
||||||
|
|
||||||
|
stackIntItem = record
|
||||||
|
val: integer;
|
||||||
|
next: stackIntPtr
|
||||||
|
end;
|
||||||
|
|
||||||
|
StackInt = record
|
||||||
|
top: stackIntPtr
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure StackIntInit(var s: StackInt);
|
||||||
|
begin
|
||||||
|
s.top := nil
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure StackPush(var st: StackInt; val: integer);
|
||||||
|
var
|
||||||
|
tmp: stackIntPtr;
|
||||||
|
begin
|
||||||
|
new(tmp);
|
||||||
|
tmp^.val := val;
|
||||||
|
tmp^.next := st.top;
|
||||||
|
st.top := tmp
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure StackPop(var st: StackInt);
|
||||||
|
var
|
||||||
|
tmp: stackIntPtr;
|
||||||
|
begin
|
||||||
|
tmp := st.top;
|
||||||
|
st.top := st.top^.next;
|
||||||
|
dispose(tmp)
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawDigit(x, y, digit: integer);
|
||||||
|
begin
|
||||||
|
case digit of
|
||||||
|
0:
|
||||||
|
DrawZero(x, y);
|
||||||
|
1:
|
||||||
|
DrawOne(x, y);
|
||||||
|
2:
|
||||||
|
DrawTwo(x, y);
|
||||||
|
3:
|
||||||
|
DrawThree(x, y);
|
||||||
|
4:
|
||||||
|
DrawFour(x, y);
|
||||||
|
5:
|
||||||
|
DrawFive(x, y);
|
||||||
|
6:
|
||||||
|
DrawSix(x, y);
|
||||||
|
7:
|
||||||
|
DrawSeven(x, y);
|
||||||
|
8:
|
||||||
|
DrawEight(x, y);
|
||||||
|
9:
|
||||||
|
DrawNine(x, y)
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DrawScore(s: integer);
|
||||||
|
var
|
||||||
|
killBar: integer = InterfaceCellW * 2 * WidthCoefficient + 1;
|
||||||
|
x, y: integer;
|
||||||
|
i: integer = 0;
|
||||||
|
st: StackInt;
|
||||||
|
begin
|
||||||
|
StackIntInit(st);
|
||||||
|
if s = 0 then
|
||||||
|
StackPush(st, 0);
|
||||||
|
while s <> 0 do
|
||||||
|
begin
|
||||||
|
StackPush(st, s mod 10);
|
||||||
|
s := s div 10
|
||||||
|
end;
|
||||||
|
x := killBar + InterfaceCellW div 4;
|
||||||
|
y := InterfaceBarH div 4 + BorderSize + 1;
|
||||||
|
while st.top <> nil do
|
||||||
|
begin
|
||||||
|
DrawDigit(x + (LetterWidth + 1) * i, y, st.top^.val);
|
||||||
|
StackPop(st);
|
||||||
|
i := i + 1
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -64,7 +64,7 @@ var
|
|||||||
keyCode: integer;
|
keyCode: integer;
|
||||||
begin
|
begin
|
||||||
GetKey(keyCode);
|
GetKey(keyCode);
|
||||||
{
|
{DEBUG}
|
||||||
if keyCode = BOrd then
|
if keyCode = BOrd then
|
||||||
Print(a.borders);
|
Print(a.borders);
|
||||||
if keyCode = COrd then
|
if keyCode = COrd then
|
||||||
@ -77,7 +77,7 @@ begin
|
|||||||
writeln(GetLength(t));
|
writeln(GetLength(t));
|
||||||
GotoXY(1, 1)
|
GotoXY(1, 1)
|
||||||
end;
|
end;
|
||||||
}
|
{DEBUG}
|
||||||
if (keyCode = ArrowLeftOrd) or (keyCode = ArrowRightOrd) or
|
if (keyCode = ArrowLeftOrd) or (keyCode = ArrowRightOrd) or
|
||||||
(keyCode = ArrowUpOrd) or (keyCode = ArrowDownOrd) or
|
(keyCode = ArrowUpOrd) or (keyCode = ArrowDownOrd) or
|
||||||
(keyCode = SpaceOrd) then
|
(keyCode = SpaceOrd) then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user