Hra Fifa98 v grafickom spracovaní

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Kategória: KMP (Klub mladých programátorov)

Autor: Ivan Dimov
Program: Fifa98b.pas
Súbor exe: Fifa98b.exe
Potrebné: Egavga.bgi

Hra Fifa98 v grafickom spracovaní.
{ FIFA98.PAS                                                        }
{                                                                   }
{ Author: Ivan Dimov                                                }
{ Date  : 15.02.1997                           http://www.trsek.com }
 
program FIFA97;        {simulator futbalu}
Uses Graph,crt,dos;   {kniznice}
Var GD,GM:Integer;    {premenne}
    ch:char;
    x,y:integer;
    m_yes:boolean;
procedure GameOver;        {procedura koniec hry}
begin
  cleardevice;
  setcolor(4);
  settextstyle(3,0,8);
  outtextxy(100,200,'GAME OVER');
end;
procedure Demo1;            {procedura pre uvodne demo}
begin
  cleardevice;
  setbkcolor(2);
  cleardevice;
  setcolor(8);
  settextstyle(10,0,48);
  outtextxy(140,-59,'FIFA');
  setfillstyle(1,1);
  floodfill(150,99,8);
  floodfill(270,99,8);
  floodfill(330,99,8);
  floodfill(450,99,8);
  settextstyle(7,0,48);
  outtextxy(0,123,'S');
  settextstyle(7,0,48);
  outtextxy(122,123,'O');
  settextstyle(7,0,48);
  Outtextxy(228,123,'C');
  settextstyle(7,0,48);
  outtextxy(329,123,'K');
  settextstyle(7,0,48);
  outtextxy(440,123,'E');
  settextstyle(7,0,48);
  outtextxy(550,123,'R');
  settextstyle(1,0,33);
  outtextxy(240,250,'98');
  settextstyle(1,0,4);
  outtextxy(235,400,'DIMOVsoft.');
end;
procedure Menu;          {procedura pre hlavne menu}
begin
  cleardevice;
  setbkcolor(0);
  cleardevice;
  setcolor(5);
  line(1,1,639,1);
  line(1,1,1,30);
  line(1,30,639,30);
  line(639,30,639,1);
  line(90,1,90,30);
  line(180,1,180,30);
  line(313,1,313,30);
  settextstyle(0,0,2);
  outtextxy(4,10,'FILE  GAME  STATICS');
  line(300,350,640,320);
  line(300,350,300,330);
  line(300,330,640,300);
  line(639,300,639,320);
  setfillstyle(3,12);
  floodfill(303,333,5);
  line(310,350,310,480);
  line(630,320,630,480);
  floodfill(600,450,5);
  setcolor(2);
  outtextxy(500,450,'FIFA 98');
 
  {circle(140,350,70);
  line(60,250,220,440);
  line(220,250,60,440);
  line(220,440,250,440);
  line(60,440,30,440);
  line(30,440,30,430);
  line(30,430,67,430);
  line(250,440,250,430);
  line(250,430,213,430);}
  floodfill(500,12,5);
 end;
procedure FileMenu;             {procedura pre menu File}
begin
  setcolor(5);
  line(1,31,160,31);
  line(1,31,1,210);
  line(1,210,160,210);
  line(160,210,160,31);
  line(1,61,160,61);
  line(1,91,160,91);
  line(1,121,160,121);
  line(1,151,160,151);
  line(1,181,160,181);
  setcolor(5);
  outtextxy(4,38,'Open');
  outtextxy(4,68,'Save');
  outtextxy(4,98,'Save as');
  outtextxy(4,128,'Save all');
  outtextxy(4,158,'Quit Game');
  outtextxy(4,188,'Quit');
 end;
procedure GameMenu;               {procedura pre menu Game}
 begin
  setcolor(5);
  line(90,31,300,31);
  line(90,31,90,151);
  line(300,31,300,151);
  line(90,151,300,151);
  line(90,61,300,61);
  line(90,91,300,91);
  line(90,121,300,121);
  line(90,151,300,151);
  outtextxy(93,38,'EXIBITION');
  outtextxy(93,68,'FRIENDLY');
  outtextxy(93,98,'OPTIONS');
  outtextxy(93,128,'TEAMS');
end;
procedure StaticsMenu;     { Procedura pre menu statics}
 begin
  setcolor(5);
  line(180,31,360,31);
  line(180,31,180,91);
  line(180,91,360,91);
  line(360,91,360,31);
  line(180,61,360,61);
  outtextxy(183,38,'PLAYARS ');
  outtextxy(183,68,'TEAMS');
 end;
 
procedure sipka(x,y,col:integer);
begin
 setcolor(col);
 line(x+1,y+27,x+7,y+20);
 line(x+7,y+20,x+15,y+27);
 line(x+7,y+20,x+7,y+40);
end;
 
BEGIN                          {ZACIATOK PROGRAMU}
 Gd:=Detect;                        {Inicializuje Graficku kartu}
 Initgraph(GD,GM,'');
 Cleardevice;
 Demo1;
 ch:=readkey;
 Menu;
 x:=12;
 y:=40;
 m_yes:=true;
 sipka(x,y,white);
 
 repeat
  ch:=readkey;
  if m_yes then begin
     Menu;
     m_yes:=false;
    end;
  if (ch=#0) then begin
      ch:=readkey;
      sipka(x,y,black);
      if(ch='K') then x:=x-10;
      if(ch='M') then x:=x+10;
      if(ch='H') then y:=y-10;
      if(ch='P') then y:=y+10;
      if (x<1) then x:=1;
      if (x>300) then x:=300;
      if (y<15)  then y:=15;
      if (y>300) then y:=300;
     end;
 
  if (ch=#13) then begin
     if (x>  0) and (x< 90) then FileMenu;
     if (x> 90) and (x<180) then GameMenu;
     if (x>180) and (x<300) then StaticsMenu;
     m_yes:=true;
    end;
  sipka(x,y,white);
 until (ch=#27);
 
 GameOver;
 repeat until keypressed;
 closegraph;
end.                          {KONIEC PROGRAMU}