OBJECTS.PAS 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. {$R-}
  2. Unit Objects;
  3. {‡¤¥áì ­ å®¤ïâáï ¢á¥ ®¡ê¥ªâë (ª« ááë) ¨á¯®«ì§ã¥¬ë¥ ¢ ¯à®£à ¬¬¥}
  4. {$DEFINE WaitRetrace}
  5. INTERFACE
  6. Uses Graph;
  7. type
  8. FLAGS = set of (NONE,CAN_DRAW);
  9. Const
  10. FIELD_X : word = 600;
  11. TRES_LX : word = 10;
  12. TRES_MX : word = 630;
  13. TRES_LY : word = 10;
  14. TRES_MY : word = 470;
  15. SIZE_Y : word = 480;
  16. FPS : WORD = 1;
  17. TIME_FACTOR : real = 0.1;
  18. OBJTYPES : array [1..1] of string[10] = ('RAH-66');
  19. type
  20. {Globals}
  21. Vector = record
  22. x,y : real;
  23. end;
  24. TSprites = array [0..(65536 shr 2)-2] of Pointer;
  25. PSprites = ^TSprites;
  26. TWordArray = array [0..(65536 shr 1)-2] of word;
  27. PWordArray = ^TWordArray;
  28. TByteArray = array [0..65534] of Byte;
  29. PByteArray = ^TByteArray;
  30. TParams = record
  31. Pos,Speed,Accel : Vector;
  32. end;
  33. PWorld = ^TWorld;
  34. { MAIN OBJECT (Global Parent) }
  35. PWorldObject = ^TWorldObject;
  36. TWorldObject = object
  37. ObjType : string[50];
  38. Flag : FLAGS;
  39. World : PWorld;
  40. LocTime : LONGINT;
  41. Params : TParams;
  42. ZORDER : Byte;
  43. Constructor Init;
  44. Procedure Frame(t:longInt);virtual; {�à®æ¥¤ãà , ¢ë¯®«­ï¥¬ ï ­  ª ¦¤®¬
  45. è £¥, t - ¢à¥¬ï í⮣® è £  (®â१®ª)
  46. „«ï  ¡á®«îâ­®á⨠¢à¥¬¥­¨}
  47. Destructor Done;virtual;
  48. end;
  49. pDrawable = ^tDrawAble;
  50. tDrawable = object (TWorldObject)
  51. BgX,BgY : integer;
  52. BackGround : Pointer;
  53. LastSize : integer;
  54. Constructor Init;
  55. Procedure Draw;virtual;
  56. end;
  57. pRAH = ^tRAH;
  58. tRAH = object (TDrawAble)
  59. { For animation. Just for speed not in class }
  60. Frames : Psprites;
  61. Masks : PSprites;
  62. FileCount : integer;
  63. FramesCount : integer;
  64. FrameSize : PWordArray;
  65. xsize,ysize : PWordArray;
  66. CurFrame : integer;
  67. {}
  68. Constructor Init(AnimDat:string;aPar : TParams;Zord:byte);
  69. Procedure Frame(t : longint);virtual;
  70. Procedure Draw;virtual;
  71. Destructor Done;virtual;
  72. end;
  73. pSting = ^tSting;
  74. tSting = object (TDrawable)
  75. { For animation. Just for speed not in class }
  76. Frames : Psprites;
  77. FramesCount : word;
  78. FrameSize : PWordArray;
  79. xsize,ysize : PWordArray;
  80. CurFrame : word;
  81. {}
  82. Angle : integer;
  83. Omega : real;
  84. Constructor Init(AnimDat:string;aPar : TParams;Zord:byte);
  85. Procedure Frame(t : longint);virtual;
  86. Procedure Draw;virtual;
  87. Destructor Done;virtual;
  88. end;
  89. { - - - - - - - - - - - - - - - -}
  90. PWOsList = ^TWOsList;
  91. TWOsList = record
  92. o : PworldObject;
  93. next : PWOsLIst;
  94. end;
  95. TWorld = object
  96. Public
  97. Ending : boolean;
  98. Procedure Gone(aObj : PWorldObject); {Objects, that needs to be killed}
  99. Constructor Init(aBGn : string); {aBGN - BackGround fileName}
  100. Procedure Draw;
  101. Procedure Frame(t:longint);
  102. Function AddObject(aOb : PWorldObject):boolean;
  103. Function RemoveObject(aOb:PWorldObject):boolean;
  104. Destructor Done;
  105. Private
  106. WObjects : PWOsList;
  107. ToGone : PWOsList; {‘⥪ ®¡ê¥ªâ®¢ ­  "㡨©á⢮"}
  108. { BackGround }
  109. xpos, ypos : PWordArray;
  110. xsize,ysize : PWordArray;
  111. FrameCount : Byte;
  112. BackGround : Psprites;
  113. FrameSize : PWordArray;
  114. {}
  115. end;
  116. {----------- END OF OBJECTS ----------------------}
  117. IMPLEMENTATION
  118. { TWorldObject Dummy }
  119. {------------------------------------------}
  120. Constructor TworldObject.Init;
  121. begin
  122. ObjType := 'dummy';
  123. Flag := [NONE];
  124. LocTime := 0;
  125. end;{TworldObject.Init}
  126. {----}
  127. Procedure TWorldObject.Frame;
  128. begin {Nothing here now}
  129. end; {TWorldObject.Frame}
  130. {----}
  131. Destructor TWorldObject.Done;
  132. begin {Nothing here now}
  133. end; {TWorldObject.Done}
  134. {----}
  135. Constructor TDrawable.Init;
  136. begin
  137. Inherited Init;
  138. Flag := Flag + [CAN_DRAW];
  139. BgX:=0;BgY:=0;
  140. BackGround:=nil;
  141. LastSize:=0;
  142. end;{TDrawable.Init}
  143. Procedure TDrawable.Draw;
  144. begin
  145. end;{TDrawable.Draw}
  146. {------------------------------------------}
  147. { First object - Helicopter Commanche RAH-66}
  148. Constructor tRAH.Init;
  149. var
  150. i : byte;
  151. F : FILE;
  152. begin
  153. Inherited Init;
  154. ObjType := 'RAH-66';
  155. Params := aPar;
  156. ZOrder := zOrd;
  157. Assign(F,AnimDat);
  158. {$I-}
  159. Reset(F,1);
  160. If IOResult <> 0 then
  161. begin
  162. CloseGraph;
  163. WriteLn('Error opening animation library for RAH-66 (',AnimDat,')');
  164. Halt(255);
  165. end;
  166. {$I+}
  167. BlockRead(F,FileCount,2);
  168. FramesCount := (FileCount-1)*2;
  169. GetMem(Frames,FramesCount*sizeof(Pointer));
  170. GetMem( Masks,FramesCount*sizeof(Pointer));
  171. GetMem(xsize,FramesCount*sizeof(Word));
  172. GetMem(ysize,FramesCount*sizeof(Word));
  173. GetMem(FrameSize,FramesCount*sizeof(Word));
  174. for i := 0 to FileCount-1 do
  175. begin
  176. BlockRead(F,FrameSize^[i],2);
  177. GetMem(Frames^[i],FrameSize^[i]);
  178. BlockRead(F,xsize^[i],2);inc(xsize^[i]);
  179. BlockRead(F,ysize^[i],2);inc(ysize^[i]);
  180. Seek(F,FilePos(F)-4);
  181. BlockRead(F,Frames^[i]^,FrameSize^[i]);
  182. GetMem(Masks^[i],FrameSize^[i]);
  183. BlockRead(F,Masks^[i]^,FrameSize^[i]);
  184. end;
  185. for i := FileCount to FramesCount-1 do
  186. begin
  187. Frames^[i] := Frames^[FramesCount-i];
  188. Masks^[i] := Masks^[FramesCount-i];
  189. FrameSize^[i] := FrameSize^[FramesCount-i];
  190. xsize^[i] := xsize^[FramesCount-i];
  191. ysize^[i] := ysize^[FramesCount-i];
  192. end;
  193. LastSize := ImageSize(0,0,xsize^[0],ysize^[0]);
  194. if LastSize = 0 then
  195. begin
  196. CloseGraph;
  197. WriteLn('Fucked Error');
  198. Halt(255);
  199. end;
  200. GetMem(BackGround,LastSize);
  201. BgX := round(Params.Pos.x-(xsize^[0] shr 1));
  202. BgY := SIZE_Y-round(Params.Pos.y+(ysize^[0] shr 1));
  203. GetImage(BgX,BgY,BgX+xsize^[0],BgY+ysize^[0],BackGround^);
  204. CurFrame := 0;
  205. end;{tRAH.Init}
  206. {----}
  207. Procedure tRAH.Frame;
  208. begin
  209. with Params do begin
  210. Speed.x := Speed.x+Accel.x*t*TIME_FACTOR;
  211. Speed.y := Speed.y+Accel.y*t*TIME_FACTOR;
  212. Pos.x := Pos.x + Speed.X*t*TIME_FACTOR;
  213. Pos.y := Pos.y + Speed.y*t*TIME_FACTOR;
  214. if Pos.x > FIELD_X then
  215. World^.Gone(@Self);
  216. LocTime := LocTime + t;
  217. end;
  218. end;{tRAH.Frame}
  219. {----}
  220. Procedure tRAH.Draw;
  221. var
  222. Top,Left : word;
  223. begin
  224. Left := round(Params.Pos.x-(xsize^[CurFrame] shr 1));
  225. Top := SIZE_Y-round(Params.Pos.y+(ysize^[CurFrame] shr 1));
  226. { repeat until (Port[$03DA] and 8) <> 8;
  227. repeat until (Port[$03DA] and 8) = 8;
  228. } PutImage(BgX,BgY,BackGround^,NormalPut);
  229. if (Top<TRES_LY) or ((Top+ysize^[CurFrame])>=TRES_MY) or
  230. (Left<TRES_LX) or ((Left+xsize^[CurFrame])>=TRES_MX) then
  231. exit;
  232. FreeMem(BackGround,LastSize);
  233. BgX := Left;
  234. BgY := Top;
  235. LastSize := ImageSize(BgX,BgY,BgX+xsize^[CurFrame],BgY+ysize^[CurFrame]);
  236. if LastSize = 0 then
  237. begin
  238. CloseGraph;
  239. WriteLn('Fucked Error');
  240. Halt(255);
  241. end;
  242. GetMem(BackGround,LastSize);
  243. GetImage(BgX,BgY,BgX+xsize^[CurFrame],BgY+ysize^[CurFrame],BackGround^);
  244. { repeat until (Port[$03DA] and 8) <> 8;
  245. repeat until (Port[$03DA] and 8) = 8;
  246. } PutImage(Left,Top,Masks^[CurFrame]^,AndPut);
  247. {$IFDEF WaitRetrace}
  248. repeat until (Port[$03DA] and 8) <> 8;
  249. repeat until (Port[$03DA] and 8) = 8;
  250. {$ENDIF}
  251. PutImage(Left,Top,Frames^[CurFrame]^,OrPut);
  252. CurFrame := (CurFrame+LocTime div FPS) mod FramesCount;
  253. LocTime := LocTime mod FPS;
  254. end;{tRAH.Draw}
  255. {----}
  256. Destructor tRAH.Done;
  257. var
  258. i:byte;
  259. begin
  260. PutImage(BgX,BgY,BackGround^,NormalPut);
  261. FreeMem(BackGround,LastSize);
  262. for i := 0 to FileCount-1 do
  263. begin
  264. FreeMem(Frames^[i],FrameSize^[i]);
  265. FreeMem( Masks^[i],FrameSize^[i]);
  266. end;
  267. FreeMem(Frames,FramesCount*sizeof(Pointer));
  268. FreeMem( Masks,FramesCount*sizeof(Pointer));
  269. FreeMem(FrameSize,FramesCount*sizeof(Word));
  270. FreeMem(xsize,FramesCount*sizeof(Word));
  271. FreeMem(ysize,FramesCount*sizeof(Word));
  272. Inherited Done;
  273. end; {tRAH.Done}
  274. {-------------------------------------------------}
  275. { Second object - rocket earth-air Stinger (hand-made) :) }
  276. Constructor tSting.Init;
  277. var
  278. i : byte;
  279. F : FILE;
  280. begin
  281. Inherited Init;
  282. ObjType := 'Stinger';
  283. Params := aPar;
  284. ZOrder := zOrd;
  285. if Params.Speed.x = 0 then
  286. begin
  287. if Params.Speed.y > 0 then Angle := 90 else
  288. Angle := 270;
  289. end else
  290. Angle := round(360/(2*Pi)*ArcTan(Params.Speed.y/Params.Speed.x));
  291. if Angle < 0 then Inc(Angle,360);
  292. if Params.Speed.X < 0 then Inc(Angle, 180);
  293. if Angle >= 360 then Dec(Angle, 360);
  294. Assign(F,AnimDat);
  295. {$I-}
  296. Reset(F,1);
  297. If IOResult <> 0 then
  298. begin
  299. CloseGraph;
  300. WriteLn('Error opening animation library for Stinger (',AnimDat,')');
  301. Halt(255);
  302. end;
  303. {$I+}
  304. BlockRead(F,FramesCount,2);
  305. GetMem(Frames,FramesCount*sizeof(Pointer));
  306. GetMem(xsize,FramesCount*sizeof(Word));
  307. GetMem(ysize,FramesCount*sizeof(Word));
  308. GetMem(FrameSize,FramesCount*sizeof(Word));
  309. for i := 0 to FramesCount-1 do
  310. begin
  311. BlockRead(F,FrameSize^[i],2);
  312. GetMem(Frames^[i],FrameSize^[i]);
  313. BlockRead(F,xsize^[i],2);inc(xsize^[i]);
  314. BlockRead(F,ysize^[i],2);inc(ysize^[i]);
  315. Seek(F,FilePos(F)-4);
  316. BlockRead(F,Frames^[i]^,FrameSize^[i]);
  317. end;
  318. CurFrame := (Angle div 6) - 1;
  319. if CurFrame < 0 then inc(curframe,FramesCount);
  320. LastSize := ImageSize(0,0,xsize^[CurFrame],ysize^[CurFrame]);
  321. if LastSize = 0 then
  322. begin
  323. CloseGraph;
  324. WriteLn('Stupid Error! (Can''t get mem for CREATED image)');
  325. Halt(255);
  326. end;
  327. GetMem(BackGround,LastSize);
  328. BgX := round(Params.Pos.x-(xsize^[CurFrame] shr 1));
  329. BgY := SIZE_Y-round(Params.Pos.y+(ysize^[CurFrame] shr 1));
  330. GetImage(BgX,BgY,BgX+xsize^[CurFrame],BgY+ysize^[CurFrame],BackGround^);
  331. end;{tSting.Init}
  332. {----}
  333. Procedure tSting.Frame;
  334. begin
  335. with Params do begin
  336. Speed.x := Speed.x+Accel.x*t*TIME_FACTOR;
  337. Speed.y := Speed.y+Accel.y*t*TIME_FACTOR;
  338. if Params.Speed.x = 0 then
  339. begin
  340. if Params.Speed.y > 0 then Angle := 90 else
  341. Angle := 270;
  342. end else
  343. Angle := round(360/(2*Pi)*ArcTan(Params.Speed.y/Params.Speed.x));
  344. if Angle < 0 then Inc(Angle,360);
  345. if Speed.X < 0 then Inc(Angle, 180);
  346. if Angle >= 360 then Dec(Angle, 360);
  347. Pos.x := Pos.x + Speed.X*t*TIME_FACTOR;
  348. Pos.y := Pos.y + Speed.y*t*TIME_FACTOR;
  349. if not ((Pos.X>TRES_LX) and (Pos.X<TRES_MX) and
  350. (Pos.Y>TRES_LY) and (Pos.Y<TRES_MY)) then
  351. if (((Pos.x>TRES_MX) and ((Speed.X>0) or (Accel.X>0))) or
  352. ((Pos.x<TRES_LX) and ((Speed.X<0) or (Accel.X<0))) or
  353. ((Pos.y>TRES_MY) and ((Speed.Y>0) or (Accel.Y>0))) or
  354. ((Pos.y<TRES_LY) and ((Speed.Y<0) or (Accel.Y<0))))
  355. then
  356. World^.Gone(@Self);
  357. LocTime := LocTime + t;
  358. end;
  359. end;{tSting.Frame}
  360. {----}
  361. Procedure tSting.Draw;
  362. var
  363. Top,Left : integer;
  364. begin
  365. CurFrame := (Angle div (360 div FramesCount)) - 1;
  366. if CurFrame < 0 then inc(curframe,FramesCount);
  367. Left := round(Params.Pos.x-(xsize^[CurFrame] shr 1));
  368. Top := SIZE_Y-round(Params.Pos.y+(ysize^[CurFrame] shr 1));
  369. { repeat until (Port[$03DA] and 8) <> 8;
  370. repeat until (Port[$03DA] and 8) = 8;}
  371. PutImage(BgX,BgY,BackGround^,NormalPut);
  372. if (Top<TRES_LY) or ((Top+ysize^[CurFrame])>=TRES_MY) or
  373. (Left<TRES_LX) or ((Left+xsize^[CurFrame])>=TRES_MX) then
  374. exit;
  375. FreeMem(BackGround,LastSize);
  376. BgX := Left;
  377. BgY := Top;
  378. LastSize := ImageSize(BgX,BgY,BgX+xsize^[CurFrame],BgY+ysize^[CurFrame]);
  379. if LastSize = 0 then
  380. begin
  381. CloseGraph;
  382. WriteLn('Fucked Error');
  383. Halt(255);
  384. end;
  385. GetMem(BackGround,LastSize);
  386. GetImage(BgX,BgY,BgX+xsize^[CurFrame],BgY+ysize^[CurFrame],BackGround^);
  387. {$IFDEF WaitRetrace}
  388. repeat until (Port[$03DA] and 8) <> 8;
  389. repeat until (Port[$03DA] and 8) = 8;
  390. {$ENDIF}
  391. PutImage(Left,Top,Frames^[CurFrame]^,AndPut);
  392. LocTime := LocTime mod FPS;
  393. end;{tSting.Draw}
  394. {----}
  395. Destructor tSting.Done;
  396. var
  397. i:byte;
  398. begin
  399. PutImage(BgX,BgY,BackGround^,NormalPut);
  400. FreeMem(BackGround,LastSize);
  401. for i := 0 to FramesCount-1 do
  402. FreeMem(Frames^[i],FrameSize^[i]);
  403. FreeMem(Frames,FramesCount*sizeof(Pointer));
  404. FreeMem(FrameSize,FramesCount*sizeof(Word));
  405. FreeMem(xsize,FramesCount*sizeof(Word));
  406. FreeMem(ysize,FramesCount*sizeof(Word));
  407. Inherited Done;
  408. end; {tSting.Done}
  409. {-------------------------------------------------}
  410. { ------ WOLRD OBJECT ( ã¯à ¢«ï¥â ¢á¥¬ ) --------}
  411. Constructor TWorld.Init;
  412. var
  413. F: FILE;
  414. k:byte;
  415. begin
  416. New(WObjects); {Init Dummy Element in Objectlist}
  417. WObjects^.Next:=nil;
  418. WObjects^.O:=nil;
  419. ToGone:=nil;
  420. Ending := false; {Global variable showing need to end}
  421. if aBGN <> '' then
  422. begin
  423. Assign(F,aBGN);
  424. {$I-}
  425. Reset(F,1);
  426. If IOResult <> 0 then exit;
  427. {$I+}
  428. BlockRead(F,FrameCount,1);
  429. GetMem(Background,FrameCount*sizeof(Pointer));
  430. GetMem(xpos,FrameCount*sizeof(word));
  431. GetMem(ypos,FrameCount*sizeof(word));
  432. GetMem(xsize,FrameCount*sizeof(word));
  433. GetMem(ysize,FrameCount*sizeof(word));
  434. GetMem(FrameSize,FrameCount*sizeof(word));
  435. for k:=0 to FrameCount-1 do
  436. begin
  437. BlockRead(F,FrameSize^[k],2);
  438. BlockRead(F,xPos^[k],2);
  439. BlockRead(F,yPos^[k],2);
  440. BlockRead(F,xSize^[k],2);
  441. BlockRead(F,ySize^[k],2);
  442. Seek(F,FilePos(F)-4);
  443. GetMem(BackGround^[k],FrameSize^[k]);
  444. BlockRead(F,BackGround^[k]^,FrameSize^[k]);
  445. PutImage(xpos^[k],ypos^[k],BackGround^[k]^,NormalPut);
  446. end;
  447. Close(F);
  448. end
  449. else
  450. BackGround := nil;
  451. end;{TWorld.Init}
  452. {------}
  453. Function TWorld.AddObject(aOb : PWorldObject):boolean;
  454. var
  455. N,C : PWOsList;
  456. begin
  457. New(N);
  458. N^.O := aOb;
  459. n^.Next:=NIL;
  460. aOb^.World := @Self;
  461. { LastObj^.Next^.Next:=nil;
  462. LAstObj:=LastObj^.Next;}
  463. c:=WObjects; {ˆ­¨æ. "¡¥£ã­®ª"}
  464. while (c^.next <> nil) and {�®ª  ­¥ ¯®á«¥¤­¨© í«-â,}
  465. (aOb^.ZORDER > c^.next^.o^.ZORDER) {¨ ¢ë¯®«­ï¥âáï ®âá®àâ¨à®¢ ­­®áâì}
  466. do c:=c^.next;
  467. n^.next := c^.next; {‚áâ ¢«ï¥¬ ­ è í«-â ¬¥¦¤ã "¡¥£ã­ª®¬"}
  468. c^.next := n; {¨ á«¥¤ãî騬 §  ­¨¬}
  469. AddObject:=true;
  470. end;
  471. {------}
  472. Procedure TWorld.Gone;
  473. var
  474. N : PWOsList;
  475. begin
  476. New(N);
  477. N^.O := aObj;
  478. n^.Next:=ToGone;
  479. ToGone := n;
  480. end;
  481. {------}
  482. Function TWorld.RemoveObject(aOb:PWorldObject):boolean;
  483. var
  484. c,g : PWOsList;
  485. begin
  486. C:=WObjects;
  487. while (C^.next <> nil) and (c^.next^.o <> aOb) do c:=c^.next;
  488. if c^.next <> nil then
  489. begin
  490. RemoveObject:=true;
  491. g := c^.next;
  492. c^.next := g^.next;
  493. Dispose(g^.O,Done);
  494. Dispose(g);
  495. end
  496. else
  497. RemoveObject := false;
  498. end;{TWorld.RemoveObject}
  499. {----------------------------}
  500. Procedure TWorld.Frame;
  501. var
  502. c,c2 : PWOsList;
  503. ob : PDrawable;
  504. begin
  505. c := ToGone; {Killing dead objects}
  506. while c<>nil do
  507. begin
  508. RemoveObject(c^.o);
  509. c2:=c^.next;
  510. dispose(c);
  511. c:=c2;
  512. end;
  513. ToGone:=nil;
  514. c:=WObjects^.Next;
  515. if c = nil then Ending:=true;
  516. while c <> nil do
  517. begin
  518. C^.O^.Frame(t);
  519. C:=C^.next;
  520. end;
  521. end;{TWorld.Frame}
  522. {----------------------------}
  523. Procedure TWorld.Draw;
  524. var
  525. c : PWOsList;
  526. begin
  527. c:=WObjects^.Next;
  528. while c <> nil do
  529. begin
  530. if CAN_DRAW IN C^.O^.Flag then PDrawable(C^.O)^.Draw;
  531. C:=C^.next;
  532. end;
  533. end;{TWorld.Draw}
  534. {----------------------------}
  535. Destructor TWorld.Done;
  536. var
  537. g:PWOsList;
  538. begin
  539. while WObjects <> nil do
  540. begin
  541. g := WObjects^.next;
  542. if WObjects^.o <> nil then Dispose(WObjects^.o,Done);
  543. Dispose(WObjecTs);
  544. WObjects := g;
  545. end;
  546. while ToGone <> nil do
  547. begin
  548. g := ToGone^.next;
  549. Dispose(ToGone^.o,Done);
  550. Dispose(ToGone);
  551. ToGone := g;
  552. end;
  553. if BackGround <> nil then
  554. begin
  555. FreeMem(Background,FrameCount*sizeof(Pointer));
  556. FreeMem(xpos,FrameCount*sizeof(word));
  557. FreeMem(ypos,FrameCount*sizeof(word));
  558. FreeMem(xsize,FrameCount*sizeof(word));
  559. FreeMem(ysize,FrameCount*sizeof(word));
  560. FreeMem(FrameSize,FrameCount*sizeof(word));
  561. end;
  562. end; {TWorld.Done}
  563. {---------------------------------------------}
  564. {------ OTHER PROCEDURES ---------------}
  565. END.