quad.pp 18 KB

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