quad.pp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. PROGRAM Quad;
  2. {A demo which loads some graphics etc. Nice. Don't forget to distribute
  3. quaddata.inc!
  4. The sources for this game was found on a site that claims to only have
  5. PD stuff with the below header(which was only reindented), and the webmaster
  6. said that everything he published was sent to him with that purpose. We tried
  7. to contact the authors mentioned below via mail over internet, but that
  8. failed. If there is somebody that claims authorship of these programs,
  9. please mail [email protected], and the sources will be removed from our
  10. websites.
  11. ------------------------------------------------------------------------
  12. ORIGINAL Header:
  13. Programmed by: Justin Pierce
  14. Graphics by: Whitney Pierce
  15. Inspired by: Jos Dickman''s triple memory!
  16. -----
  17. Old version requires egavga.bgi. FPC doesn't require BGI's (VGA and VESA
  18. support are built in the Graph, others are ignored).}
  19. {$Define UseGraphics}
  20. {$ifdef UseGraphics}
  21. {$ifdef Win32}
  22. {$define Win32Graph} // Needed for GameUnit.
  23. {$APPTYPE GUI}
  24. {$endif}
  25. {$endif}
  26. Uses
  27. {$ifdef Win32}
  28. WinCrt,Windows,
  29. {$else}
  30. Crt,
  31. {$endif}
  32. Dos,Graph,GameUnit; {Supplied with FPC demoes package. Wrapper for
  33. mousesupport (via msmouse or api), and contains
  34. highscore routines}
  35. Const nox = 10;
  36. noy = 8;
  37. card_border = red;
  38. PicBufferSize = 64000; {Buffersize for deRLE'ed picture data}
  39. ComprBufferSize = 20000; {Buffer for diskread- RLE'ed data}
  40. PicsFilename = 'quaddata.dat'; {Name of picturesfile}
  41. ScoreFileName = 'quad.scr';
  42. {$IFDEF UseGraphics}
  43. DisplGrX=110;
  44. DisplGrY=90;
  45. DisplGrScale=16;
  46. HelpY=130;
  47. {$ENDIF}
  48. Type
  49. pByte = ^Byte; {BufferTypes}
  50. Card = Record
  51. exposed: boolean;
  52. pic: byte;
  53. End;
  54. {Assigns an enumeration to each picture}
  55. PictureEnum= (zero,one,two,three,four,five,six,seven,eight,nine,colon,
  56. back,score,exit_b,score_b,chunk,p1,p2,p3,p4,p5,p6,p7,p8,
  57. p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20);
  58. {A pictures definition;
  59. x and y dimensions and offset in PicData buffer}
  60. Picture = packed Record
  61. start: longint;
  62. x,y: byte;
  63. End;
  64. {All pictures. This array, and the data in PicData is all pic info.}
  65. PictureArray= ARRAY[zero..p20] OF Picture;
  66. selected = Record
  67. x,y: byte;
  68. pic: byte;
  69. End;
  70. time_record = Record
  71. o_hr,o_min,o_sec,o_sec100: word;
  72. hr,min,sec,sec100: word;
  73. a_sec,a_min: word;
  74. End;
  75. Var b : array[1..nox,1..noy] Of card;
  76. Pics : PictureArray;
  77. PicData : PByte;
  78. s : array[1..4] Of selected;
  79. os : byte;
  80. turns : integer;
  81. off,ok,exit1: boolean;
  82. opened : byte;
  83. bgidirec : string;
  84. time : time_record;
  85. {
  86. Procedure fatal(fcall:String);
  87. Begin
  88. textmode(CO80);
  89. clrscr;
  90. Writeln('A fatal error has occured');
  91. Writeln('Error: ',fcall);
  92. Writeln;
  93. Write('Hit enter to halt program--');
  94. readln;
  95. halt;
  96. End;
  97. }
  98. Procedure ginit640x480x16(direc:String);
  99. Var grd,grmode: integer;
  100. Begin
  101. {$ifdef Win32}
  102. {$ifndef Debug}
  103. ShowWindow(GetActiveWindow,0);
  104. {$endif}
  105. grmode:=vgaHI;
  106. grd:=vga;
  107. Direc:='';
  108. {$else}
  109. closegraph;
  110. grd := 9;{ detect;}
  111. grmode := 2;{ m800x600x16;}
  112. {$endif}
  113. initgraph(grd,grmode,direc);
  114. {$ifndef Win32}
  115. setgraphmode(2);
  116. {$endif}
  117. End;
  118. procedure WaitForMouse;
  119. var ms_mx,ms_my,ms_but : LONGINT;
  120. begin
  121. Repeat
  122. GetMouseState(ms_mx,ms_my,ms_but);
  123. Until ms_but=0;
  124. Repeat
  125. GetMouseState(ms_mx,ms_my,ms_but);
  126. Until ms_but<>0;
  127. end;
  128. Procedure clean_board;
  129. Var x,y: byte;
  130. Begin
  131. y := 1;
  132. Repeat
  133. x := 1;
  134. Repeat
  135. b[x,y].pic := 0;
  136. b[x,y].exposed := false;
  137. inc(x);
  138. Until x>nox;
  139. inc(y);
  140. Until y>noy
  141. End;
  142. Procedure showpic(xp,yp:integer; tp:pictureenum);
  143. Var x,y,x1,y1: byte;
  144. tx: integer;
  145. Begin
  146. x := pics[tp].x; {mb[tp.start];}
  147. y := pics[tp].y; {mb[tp.start+1];}
  148. y1 := 1;
  149. tx := 0;
  150. Repeat
  151. x1 := 1;
  152. Repeat
  153. putpixel(xp+(x1-1),yp+(y1-1),picdata[pics[tp].start-1+tx]);
  154. inc(x1);
  155. inc(tx);
  156. Until x1>x;
  157. inc(y1);
  158. Until y1>y;
  159. End;
  160. Procedure NumberOutput(X,Y,Number:LONGINT;RightY:BOOLEAN);
  161. Var num: string;
  162. plc: byte;
  163. Begin
  164. str(number,num);
  165. If length(num)=1 Then
  166. insert('0',num,0);
  167. IF RightY THEN
  168. dec (x,length(num)*11);
  169. plc := 1;
  170. Repeat
  171. IF (Num[plc]>CHR(47)) AND (Num[plc]<CHR(58)) THEN
  172. showpic(((plc-1)*11)+X,Y,pictureenum(ORD(Zero)+ORD(Num[plc])-48));
  173. inc(plc);
  174. Until plc>length(num);
  175. End;
  176. Procedure update_secs;
  177. Begin
  178. showpic(605,453,colon);
  179. NumberOutput(615,453,time.a_sec,FALSE);
  180. End;
  181. Procedure showturn(x,y:integer);
  182. Begin
  183. hidemouse;
  184. If (x=0) And (y=0) Then
  185. NumberOutput(4,453,Turns,FALSE)
  186. ELSE
  187. NumberOutput(x,y,Turns,FALSE);
  188. showmouse;
  189. End;
  190. Procedure get_original_time;
  191. Begin
  192. With time Do
  193. Begin
  194. a_sec := 0;
  195. a_min := 0;
  196. gettime(o_hr,o_min,o_sec,o_sec100);
  197. gettime(hr,min,sec,sec100);
  198. End;
  199. End;
  200. Procedure update_time(ForcedUpdate:BOOLEAN);
  201. Begin
  202. With time Do
  203. Begin
  204. gettime(hr,min,sec,sec100);
  205. If sec<>o_sec Then
  206. Begin
  207. inc(a_sec);
  208. If a_sec<=60 Then update_secs;
  209. End;
  210. If a_sec>60 Then
  211. Begin
  212. a_sec := 0;
  213. inc(a_min);
  214. ForcedUpdate:=TRUE;
  215. End;
  216. IF ForcedUpdate THEN
  217. BEGIN
  218. Update_secs;
  219. showpic(606,453,colon);
  220. NumberOutput(606,453,time.a_min,TRUE);
  221. END;
  222. o_hr := hr;
  223. o_min := min;
  224. o_sec := sec;
  225. o_sec100 := sec;
  226. End;
  227. End;
  228. Procedure makecard(x,y:byte);
  229. Var xp,yp: integer;
  230. Begin
  231. hidemouse;
  232. xp := ((x-1)*63);
  233. yp := ((y-1)*56);
  234. setcolor(card_border);
  235. setfillstyle(1,0);
  236. bar(xp+1,yp+1,xp+62,yp+55);
  237. rectangle(xp,yp,xp+63,yp+56);
  238. If b[x,y].exposed=false Then
  239. Begin
  240. showpic(xp+1,yp+1,back);
  241. End;
  242. showmouse;
  243. If b[x,y].exposed=true Then
  244. Begin
  245. hidemouse;
  246. showpic(xp+7,yp+4,pictureenum(ORD(b[x,y].pic)+ORD(p1)-1));
  247. showmouse;
  248. End;
  249. End;
  250. Function used(pic:byte): byte;
  251. Var cx,cy,u: byte;
  252. Begin
  253. used := 0;
  254. u := 0;
  255. cy := 1;
  256. Repeat
  257. cx := 1;
  258. Repeat
  259. If b[cx,cy].pic=pic Then inc(u);
  260. inc(cx);
  261. Until cx>nox;
  262. inc(cy);
  263. Until cy>noy;
  264. used := u;
  265. End;
  266. Procedure set_board;
  267. CONST Outstr=#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+
  268. #219+#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+#219+
  269. #219+#219+#219+#219;
  270. Var cx,cy,pic: byte;
  271. Begin
  272. setcolor(0);
  273. outtextxy(0,470,OutStr);
  274. setcolor(green);
  275. outtextxy(0,470,'Dealing board, please wait...');
  276. Delay(1000);
  277. cy := 1;
  278. Repeat
  279. cx := 1;
  280. Repeat
  281. Repeat
  282. pic := random(20)+1;
  283. Until used(pic)<4;
  284. b[cx,cy].pic := pic;
  285. makecard(cx,cy);
  286. inc(cx);
  287. Until cx>nox;
  288. inc(cy);
  289. Until cy>noy;
  290. setcolor(0);
  291. outtextxy(0,470,OutStr);
  292. End;
  293. Procedure fire_works;
  294. Const
  295. nof = 30;
  296. Type
  297. fires = Record
  298. x,y: Longint;
  299. direct: longint;
  300. speed: Longint;
  301. explode: boolean;
  302. color: byte;
  303. oex: longint;
  304. End;
  305. Var fire: array[1..nof] Of fires;
  306. Procedure clean_fires;
  307. Var c: longint;
  308. Begin
  309. c := 1;
  310. Repeat
  311. fire[c].direct := random(2)+1;
  312. fire[c].color := random(15)+1;
  313. fire[c].x := random(639);
  314. fire[c].y := 479;
  315. fire[c].explode := false;
  316. fire[c].speed := random(20)+15;
  317. fire[c].oex := 1;
  318. inc(c);
  319. Until c>nof;
  320. End;
  321. Procedure inact;
  322. Var c: longint;
  323. Begin
  324. c := 1;
  325. Repeat
  326. If fire[c].explode=false Then
  327. Begin
  328. setcolor(fire[c].color);
  329. circle(fire[c].x,fire[c].y,1);
  330. End;
  331. If (fire[c].explode=true) And (fire[c].oex<10) Then
  332. Begin
  333. setcolor(fire[c].color);
  334. circle(fire[c].x,fire[c].y,fire[c].oex);
  335. setcolor(random(15)+1);
  336. circle(fire[c].x,fire[c].y,fire[c].oex-1);
  337. End;
  338. inc(c);
  339. Until c>nof;
  340. delay(75);
  341. {$ifndef Win32}
  342. gotoxy(1,1);
  343. {$endif}
  344. c := 1;
  345. Repeat
  346. setcolor(0);
  347. circle(fire[c].x,fire[c].y,1);
  348. If (fire[c].explode=true) And (fire[c].oex<10) Then
  349. Begin
  350. circle(fire[c].x,fire[c].y,fire[c].oex);
  351. circle(fire[c].x,fire[c].y,fire[c].oex-1);
  352. inc(fire[c].oex);
  353. End;
  354. If fire[c].explode=false Then
  355. Begin
  356. dec(fire[c].speed,1);
  357. dec(fire[c].y,fire[c].speed);
  358. If fire[c].direct=1 Then inc(fire[c].x,2);
  359. If fire[c].direct=2 Then dec(fire[c].x,2);
  360. If fire[c].speed<=(-1*LONGINT(random(11))) Then
  361. fire[c].explode := true;
  362. End;
  363. inc(c);
  364. Until c>nof;
  365. c := 1;
  366. End;
  367. Function exploded: boolean;
  368. Var c: longint;
  369. m: boolean;
  370. Begin
  371. c := 1;
  372. m := true;
  373. Repeat
  374. If fire[c].oex<6 Then m := false;
  375. inc(c);
  376. Until (c>nof);
  377. exploded := m;
  378. End;
  379. Begin
  380. cleardevice;
  381. Repeat
  382. clean_fires;
  383. Repeat
  384. inact;
  385. Until (exploded=true) Or (keypressed);
  386. Until keypressed;
  387. End;
  388. {$ifdef Win32Graph}
  389. Procedure ClearTextCoord(x1,y1,x2,y2:Longint);
  390. Begin
  391. SetFillStyle(SolidFill,0); {Clear part of playfield}
  392. Bar ((x1+1) * DisplGrScale, (Y1+1)*DisplGrScale,(x2+1) * DisplGrScale, (Y2+1)*DisplGrScale);
  393. End;
  394. {$endif}
  395. Procedure win;
  396. Var m,s: string;
  397. I,J : LONGINT;
  398. Const GameOver='Game Over, turns needed = ';
  399. Begin
  400. hidemouse;
  401. // fire_works;
  402. cleardevice;
  403. {$ifndef Win32}
  404. closegraph;
  405. textmode(co80+font8x8);
  406. clrscr;
  407. {$endif}
  408. I:=SlipInScore(Turns);
  409. {$ifndef Win32}
  410. GotoXY(1,23);
  411. Writeln(GameOver,Turns);
  412. FOR J:=9 TO 22 DO
  413. BEGIN
  414. GotoXY(20,J);
  415. Write(' ':38);
  416. END;
  417. {$else}
  418. SetColor(White);
  419. ClearTextCoord(20,9,58,22);
  420. Str(Turns,S);
  421. S:=GameOver+S;
  422. OutTextXY(5,40+9*LineDistY,S);
  423. OutTextXY(5,40+23*LineDistY,'Press mouse to continue');
  424. WaitForMouse;
  425. {$endif}
  426. IF I<>0 THEN
  427. BEGIN
  428. ShowHighScore;
  429. {$IFDEF USEGRAPHICS}
  430. SetColor(Black);
  431. Bar(5,40+23*LineDisty,5+8*26,40+23*LineDisty+8);
  432. SetColor(White);
  433. OutTextXY(5,40+23*LineDistY,'Please enter your name');
  434. GrInputStr(S,300,HelpY+20+(17-I+1)*LineDistY,16,12,10,FALSE,AlfaBeta);
  435. {$ELSE}
  436. InputStr(S,20,21-I,10,FALSE,AlfaBeta);
  437. {$ENDIF}
  438. IF Length(S)<12 THEN
  439. BEGIN
  440. str(time.a_min,m);
  441. S:=S+'['+m+':';
  442. str(time.a_sec,m);
  443. S:=S+'m'+']';
  444. END;
  445. HighScore[I-1].Name:=S;
  446. END;
  447. ShowHighScore;
  448. {$ifdef Win32}
  449. Bar(5,40+23*LineDisty,5+8*26,40+23*LineDisty+8);
  450. OutTextXY(5,40+23*LineDistY,'Press mouse to continue');
  451. WaitForMouse;
  452. {$else}
  453. ginit640x480x16(bgidirec);
  454. {$endif}
  455. off := false;
  456. clean_board;
  457. set_board;
  458. turns := 0;
  459. showpic(0,450,score);
  460. showpic(80,450,score_b);
  461. showpic(150,450,exit_b);
  462. showpic(569,450,score);
  463. showturn(0,0);
  464. exit1 := false;
  465. get_original_time;
  466. update_time(True);
  467. SetMousePosition(0,0);
  468. showmouse;
  469. End;
  470. Procedure show_scores;
  471. Var x,y,c: byte;
  472. Begin
  473. hidemouse;
  474. y := 1;
  475. Repeat
  476. x := 1;
  477. showpic(x+135,(y-1)*21,score);
  478. showpic(x,(y-1)*21,score);
  479. showpic(x+204,(y-1)*21,score);
  480. Repeat
  481. showpic(((x-1)*10)+3,(y-1)*21,chunk);
  482. inc(x);
  483. Until x>20;
  484. inc(y);
  485. Until y>10;
  486. c := 0;
  487. Repeat
  488. If HighScore[c].name<>'' Then
  489. Begin
  490. setcolor(white);
  491. outtextxy(4,7+(c*21),HighScore[c].name);
  492. turns:= HighScore[c].Score;
  493. showturn(211,3+(c*21));
  494. End;
  495. inc(c);
  496. Until c>9;
  497. turns := 0;
  498. {$ifndef Win32}
  499. gotoxy(1,1);
  500. {$endif}
  501. readln;
  502. off := false;
  503. clean_board;
  504. set_board;
  505. turns := 0;
  506. showpic(0,450,score);
  507. showpic(80,450,score_b);
  508. showpic(150,450,exit_b);
  509. showpic(569,450,score);
  510. showturn(0,0);
  511. exit1 := false;
  512. get_original_time;
  513. update_time(True);
  514. SetMousePosition(0,0);
  515. showmouse;
  516. End;
  517. Procedure interpret;
  518. Var mpx,mpy: byte;
  519. ms_mx,ms_my,ms_but : LONGINT;
  520. Begin
  521. GetMouseState(ms_mx,ms_my,ms_but);
  522. ms_mx:=ms_mx shr 1;;
  523. If ms_but=0 Then off := false;
  524. If ((ms_but AND 1)=1) And (off=false) Then
  525. Begin
  526. off := true;
  527. mpx := ms_mx*2 Div 63;
  528. mpy := (ms_my) Div 56;
  529. If (ms_mx*2>=80) And (ms_mx*2<=129) And (ms_my>=450) And (ms_my<=466)
  530. And (ok=true) Then show_scores;
  531. If (ms_mx*2>=150) And (ms_mx*2<=199) And (ms_my>=450) And (ms_my<=466)
  532. Then
  533. Begin
  534. exit1 := true;
  535. End;
  536. inc(mpx);
  537. inc(mpy);
  538. If (b[mpx,mpy].exposed=false) And (mpx>=1) And (mpy>=1) And (mpx<=10) And (mpy<=8)
  539. Then
  540. Begin
  541. setfillstyle(1,0);
  542. bar(80,450,130,466);
  543. ok := false;
  544. b[mpx,mpy].exposed := true;
  545. makecard(mpx,mpy);
  546. inc(os);
  547. s[os].x := mpx;
  548. s[os].y := mpy;
  549. s[os].pic := b[mpx,mpy].pic;
  550. End;
  551. End;
  552. If os=4 Then
  553. Begin
  554. inc(turns);
  555. showturn(0,0);
  556. os := 0;
  557. delay(700);
  558. inc(opened);
  559. If Not((s[1].pic=s[2].pic) And (s[1].pic=s[3].pic) And (s[1].pic=s[4].pic)) Then
  560. Begin
  561. dec(opened);
  562. b[s[1].x,s[1].y].exposed := false;
  563. b[s[2].x,s[2].y].exposed := false;
  564. b[s[3].x,s[3].y].exposed := false;
  565. b[s[4].x,s[4].y].exposed := false;
  566. makecard(s[1].x,s[1].y);
  567. makecard(s[2].x,s[2].y);
  568. makecard(s[3].x,s[3].y);
  569. makecard(s[4].x,s[4].y);
  570. End;
  571. If opened=20 Then win;
  572. End;
  573. If NOT ok Then
  574. update_time(FALSE);
  575. End;
  576. Procedure load_pics(PicBuf:PByte);
  577. {loads picture structures from disc}
  578. VAR F : File;
  579. Buf1Ind,
  580. I,J,K : LONGINT;
  581. TData : PByte;
  582. Begin
  583. GetMem(TData,ComprBufferSize); { allocate buffer}
  584. Assign(F,Picsfilename); { Open file}
  585. {$I-}
  586. Reset(F,1);
  587. {$I+}
  588. If ioresult<>0 Then
  589. BEGIN
  590. {$ifdef Win32}
  591. MessageBox(GetActiveWindow,'Error','Fatal error, couldn''t find graphics data file quaddata.dat',WM_QUIT);
  592. {$else}
  593. TextMode(CO80);
  594. Writeln('Fatal error, couldn''t find graphics data file quaddata.dat');
  595. {$endif}
  596. HALT;
  597. END;
  598. {Read the array with picture information; (X,Y dimensions and offset in
  599. binary data)}
  600. BlockRead(F,pics,SIZEOF(Picture)*(ORD(p20)-ORD(zero)+1),I);
  601. {Read some slackspace which shouldn't be in the file ;-)}
  602. blockread(F,TData[0],6,Buf1ind);
  603. {Read the real, RLE'ed graphics data}
  604. BlockRead(F,TData[0],ComprBufferSize,Buf1Ind);
  605. Close(F);
  606. {Expand the RLE data. Of each byte, the high nibble is the count-1, low
  607. nibble is the value}
  608. I:=0; J:=0;
  609. REPEAT
  610. K:=(TData[I] SHR 4) +1;
  611. FillChar(PicBuf[J],K,TData [I] AND 15);
  612. INC(J,K);
  613. INC(I);
  614. UNTIL I>=Buf1Ind;
  615. {Release the temporary buffer (the compressed data isn't necesary anymore)}
  616. Freemem(TData,ComprBufferSize);
  617. End;
  618. Procedure clean;
  619. VAR I : LONGINT;
  620. Begin
  621. Randomize; {Initialize random generator}
  622. Negative:=TRUE; {Higher highscore is worse}
  623. {$ifdef Win32}
  624. HighX :=300; {Coordinates of highscores}
  625. HighY :=130+20+8*LineDistY; {y coordinate relative to other options}
  626. {$else}
  627. HighX:=20; HighY:=9; {coordinates for highscores}
  628. {$endif}
  629. GetMem(PicData,PicBufferSize); {Allocate room for pictures}
  630. load_pics(PicData); {Load picture data from file}
  631. FOR I:=0 TO 9 DO {Create default scores}
  632. begin
  633. HighScore[I].Score:=-100*I; {Negative, because then the
  634. "highest" score is best}
  635. If HighScore[I].Score>0 Then
  636. Writeln('ohoh');
  637. End;
  638. LoadHighScore(ScoreFileName); {Try to load highscore file}
  639. // closegraph;
  640. {$ifNdef FPC}
  641. bgidirec := 'd:\prog\bp\bgi';
  642. {$ENDIF}
  643. ginit640x480x16(bgidirec);
  644. setcolor(card_border);
  645. ok := true;
  646. opened := 0;
  647. os := 0;
  648. s[1].x := 0;
  649. s[2].x := 0;
  650. s[3].x := 0;
  651. off := false;
  652. clean_board;
  653. set_board;
  654. turns := 0;
  655. showpic(0,450,score); showpic(80,450,score_b);
  656. showpic(150,450,exit_b); showpic(569,450,score);
  657. showturn(0,0);
  658. exit1 := false;
  659. SetMousePosition(0,0);
  660. get_original_time;
  661. update_time(True);
  662. showmouse;
  663. End;
  664. Begin
  665. Initmouse;
  666. Negative:=True;
  667. clean;
  668. Repeat
  669. interpret;
  670. Until (exit1=true) {$ifdef Debug} or (turns=1) {$endif};
  671. {$ifndef Win32}
  672. closegraph;
  673. {$endif}
  674. Freemem(PicData,PicBufferSize);
  675. SaveHighScore;
  676. {$ifndef Win32}
  677. Textmode(co80);
  678. clrscr;
  679. HideMouse;
  680. Writeln('Thanks for playing Quadruple Memory');
  681. Writeln('Feel free to distribute this software.');
  682. Writeln;
  683. Writeln('Programmed by: Justin Pierce');
  684. Writeln('Graphics by: Whitney Pierce');
  685. Writeln('Inspired by: Jos Dickman''s triple memory!');
  686. Writeln('FPC conversion and cleanup by Marco van de Voort');
  687. Writeln;
  688. ShowMouse;
  689. {$else}
  690. SetbkColor(black);
  691. SetColor(White);
  692. SetViewPort(0,0,getmaxx,getmaxy,clipoff);
  693. ClearViewPort;
  694. SetTextStyle(0,Horizdir,2);
  695. SetTextStyle(0,Horizdir,1);
  696. OutTextXY(220,10,'QUAD');
  697. OutTextXY(5,40+1*LineDistY,'Thanks for playing Quadruple Memory');
  698. OutTextXY(5,40+2*LineDistY,'Feel free to distribute this software.');
  699. OutTextXY(5,40+4*LineDistY,'Programmed by: Justin Pierce');
  700. OutTextXY(5,40+5*LineDistY,'Graphics by: Whitney Pierce');
  701. OutTextXY(5,40+6*LineDistY,'Inspired by: Jos Dickman''s triple memory!');
  702. OutTextXY(5,40+7*LineDistY,'FPC conversion and cleanup by Marco van de Voort');
  703. OutTextXY(5,40+9*LineDistY,'Press mouse to continue');
  704. WaitForMouse;
  705. {$endif}
  706. {$ifdef Win32}
  707. CloseGraph;
  708. {$endif}
  709. DoneMouse;
  710. End.
  711. {
  712. $Log$
  713. Revision 1.5 2002-09-07 15:06:35 peter
  714. * old logs removed and tabs fixed
  715. Revision 1.4 2002/06/02 09:49:17 marco
  716. * Renamefest
  717. Revision 1.3 2002/02/27 16:29:54 carl
  718. * We should initialize the mouse!
  719. Revision 1.2 2002/02/25 12:23:05 marco
  720. * Fixes for Quad Win32 GUI mode
  721. }