Tank battle game.
{$A+,B+,D+,E-,F-,G+,I+,L+,N+,O-,P-,Q-,R-,S+,T-,V+,X+,Y+}
program Brains_Out_game;
uses
crt, graph, dos, BOshared, globals, general, mouse;
function GetHighestCap(Table: Pointer; Modes: Word; Size: Integer): Integer;
near; assembler;
asm
XOR AX,AX
LES DI, Table
@@1:
MOV SI, Modes
ADD SI, Size
ADD SI, Size
MOV BX, ES:[DI]
CMP BX, 0FFFFH
JE @@4
INC DI
INC DI
MOV CX,Size
@@2:
CMP BX,[SI]
JZ @@3
DEC SI
DEC SI
LOOP @@2
@@3:
CMP AX,CX
JA @@1
MOV AX,CX
JMP @@1
@@4:
end;
function DetectVesa16: Integer; far; assembler;
var
VesaInfo: array[0..255] of Byte;
asm
MOV AX,SS
MOV ES,AX
LEA DI,VesaInfo
MOV AX,4F00H
INT 10H
CMP AX,004FH
MOV AX,grError
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[0], 'EV'
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[2], 'AS'
JNZ @@Exit
LES DI,ES:[DI].VgaInfoBlock.VideoModePtr
PUSH ES
PUSH DI
MOV AX, OFFSET Vesa16Modes
PUSH AX
MOV AX,3
PUSH AX
CALL GetHighestCap
@@Exit:
end;
procedure SVGAinitialize;
var
PathToDriver : string; {Stores the DOS path to *.BGI & *.CHR}
begin
PathToDriver:=PathTo_DATA;
VESA16 := InstallUserDriver('VESA', @DetectVesa16);
GD := IBM8514;
GM := IBM8514Hi;
GD := Detect; {Use autodetection}
InitGraph(GD, GM,PathToDriver);
end; { SVGA initialize }
{----------------------------------------------------------------------------}
begin
SVGAinitialize;
setgraphmode( 3 ); { 800 x 600 }
player1.name := 'Player 1';
player2.name := 'Player 2';
center := getmaxy div 2;
tanksizex := 7;
tanksizey := 11;
new( player1.tankbox );
new( player2.tankbox );
if mouseinit( mouseflag ) then { check mouse }
begin
mousesetXrange( 0, getmaxx );
mousesetYrange( 0, getmaxy );
mousesetpos( getmaxx div 2, getmaxy div 2 - 50 );
initmousecursor( PATHTO_DATA + 'arrow.crf' );
mouseshow;
repeat
case mainmenu of
0 : begin { *** start new game *** }
randomize;
cleardevice;
gamestarted := false; { game not started }
player1.score := 0;
player2.score := 0;
playerswitch := first; { player 1 selected }
player1.getcagex := 0;
player1.getcagey := 23;
player2.getcagex := 0;
player2.getcagey := 0;
visfield; { game field visualization }
displayplayersinfo; { display information about players }
playgame;
gamestarted := true; { game started }
end;
1 : begin { *** return to current game *** }
cleardevice;
visfield; { game field visualization }
displayplayersinfo; { output information about players }
playgame;
end;
3 : rankingtable; { *** call ranking table *** }
5 : quit; { *** quit the game *** }
end; { case }
until false;
end
else { mouse not present }
begin
closegraph;
textcolor( 10 );
textbackground( 0 );
write( 'Mouse not found...' );
textcolor( 7 );
end
end. { 2001 Created by Sergei Drozdov }