Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.91 KB | None | 0 0
  1. const
  2. secondlevelobject_changingID = 'ck.h';
  3.  
  4. (*
  5. R_GetInteractableObject
  6. ~~~~~~~~~~~~~~~~~~~~~~~
  7.  
  8. .. code-block:: pascal
  9.  
  10. function R_GetInteractableObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  11.  
  12. Loads the information from the inputed GroundObj and returns a TRSObject. For
  13. use in object searching functions in this include, not in scripts.
  14.  
  15. .. note::
  16.  
  17. by Drags111
  18.  
  19. *)
  20. function R_GetInteractableObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  21. var
  22. Node, Last, Obj: Integer;
  23. ID, SecondLevel: Integer;
  24. ChangingID: Integer;
  25. begin
  26. Node := SmartGetFieldObject(GroundObj, hook_ground_AnimableList);
  27. while(Node <> 0)do
  28. begin
  29. Obj := SmartGetFieldObject(Node, hook_AnimableNode_GetAnimable);
  30. if(Obj <> 0)then
  31. Break;
  32. Last := Node;
  33. Node := SmartGetFieldObject(Last, hook_AnimableNode_GetNext);
  34. SmartFreeObject(Last);
  35. end;
  36. SmartFreeObject(Node);
  37.  
  38. if(Obj <= 0)then
  39. Exit;
  40.  
  41. ID := SmartGetFieldShort(Obj, hook_InteractiveObject_GetID) and $FFFF;
  42. if(ID = -1) or (ID = 65535)then //65535 is an unsigned -1...
  43. begin
  44. SecondLevel := SmartGetFieldObject(Obj, hook_interactiveobject2_GetObjectData);
  45.  
  46. ID := SmartGetFieldInt(SecondLevel, hook_secondlevelobject_GetID) and $FFFF;
  47. ChangingID := SmartGetFieldInt(SecondLevel, secondlevelobject_changingID);// and $FFFF;
  48.  
  49. Writeln('ID: '+ToStr(ID));
  50. Writeln('ChangingID: '+ToStr(ChangingID));
  51.  
  52. if(ID = -1) or (ID = 65535)then
  53. begin
  54. SmartFreeObject(SecondLevel);
  55. SmartFreeObject(Obj);
  56. Exit;
  57. end;
  58. end;
  59.  
  60. if(ID <> -1) and (ID <> 65535)then
  61. begin
  62. Result.ID := ID;
  63. Result.ObjType := OBJ_INTERACTABLE;
  64.  
  65. Result.Tile.X := BaseX + (SmartGetFieldInt(Obj, hook_animable_PixelX) / 512);
  66. Result.Tile.Y := BaseY + (SmartGetFieldInt(Obj, hook_animable_PixelY) / 512);
  67.  
  68. Result.TileArea.X1 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX1));
  69. Result.TileArea.Y1 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY1));
  70. Result.TileArea.X2 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX2));
  71. Result.TileArea.Y2 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY2));
  72. end;
  73.  
  74. SmartFreeObject(SecondLevel);
  75. SmartFreeObject(Obj);
  76. end;
  77.  
  78. (*
  79. R_GetWallObject
  80. ~~~~~~~~~~~~~~~
  81.  
  82. .. code-block:: pascal
  83.  
  84. function R_GetWallObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  85.  
  86. Loads the information from the inputed GroundObj and returns a TRSObject. For
  87. use in object searching functions in this include, not in scripts.
  88.  
  89. .. note::
  90.  
  91. by Drags111
  92.  
  93. *)
  94. function R_GetWallObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  95. var
  96. Obj, ID: Integer;
  97. begin
  98. Obj := SmartGetFieldObject(GroundObj, hook_ground_WallObject1);
  99. if(Obj = 0)then
  100. begin
  101. SmartFreeObject(Obj);
  102. Obj := SmartGetFieldObject(GroundObj, hook_ground_WallObject2);
  103. if(Obj <= 0)then
  104. begin
  105. SmartFreeObject(Obj);
  106. Exit;
  107. end;
  108. end;
  109.  
  110. ID := SmartGetFieldShort(Obj, hook_WallObjectData_GetID) and $FFFF;
  111. if(ID = -1) or (ID = 65535)then
  112. ID := SmartGetFieldInt(Obj, hook_secondlevelobject_GetID) and $FFFF;
  113. if(ID = -1) or (ID = 65535)then
  114. Exit;
  115.  
  116. Result.ID := ID;
  117. Result.ObjType := OBJ_INTERACTABLE;
  118.  
  119. Result.Tile.X := BaseX + (SmartGetFieldInt(Obj, hook_animable_PixelX) / 512);
  120. Result.Tile.Y := BaseY + (SmartGetFieldInt(Obj, hook_animable_PixelY) / 512);
  121.  
  122. Result.TileArea.X1 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX1));
  123. Result.TileArea.Y1 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY1));
  124. Result.TileArea.X2 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX2));
  125. Result.TileArea.Y2 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY2));
  126.  
  127. SmartFreeObject(Obj);
  128. end;
  129.  
  130. (*
  131. R_GetWallDecorationObject
  132. ~~~~~~~~~~~~~~~~~~~~~~~~~
  133.  
  134. .. code-block:: pascal
  135.  
  136. function R_GetWallDecorationObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  137.  
  138. Loads the information from the inputed GroundObj and returns a TRSObject. For
  139. use in object searching functions in this include, not in scripts.
  140.  
  141. .. note::
  142.  
  143. by Drags111
  144.  
  145. *)
  146. function R_GetWallDecorationObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  147. var
  148. Obj, ID: Integer;
  149. begin
  150. Obj := SmartGetFieldObject(GroundObj, hook_ground_WallDecoration1);
  151. if(Obj = 0)then
  152. begin
  153. SmartFreeObject(Obj);
  154. Obj := SmartGetFieldObject(GroundObj, hook_ground_WallDecoration2);
  155. if(Obj <= 0)then
  156. begin
  157. SmartFreeObject(Obj);
  158. Exit;
  159. end;
  160. end;
  161.  
  162. ID := SmartGetFieldShort(Obj, hook_WallDecorationData_GetID) and $FFFF;
  163. if(ID = -1) or (ID = 65535)then
  164. ID := SmartGetFieldInt(Obj, hook_secondlevelobject_GetID) and $FFFF;
  165. if(ID = -1) or (ID = 65535)then
  166. Exit;
  167.  
  168. Result.ID := ID;
  169. Result.ObjType := OBJ_INTERACTABLE;
  170.  
  171. Result.Tile.X := BaseX + (SmartGetFieldInt(Obj, hook_animable_PixelX) / 512);
  172. Result.Tile.Y := BaseY + (SmartGetFieldInt(Obj, hook_animable_PixelY) / 512);
  173.  
  174. Result.TileArea.X1 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX1));
  175. Result.TileArea.Y1 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY1));
  176. Result.TileArea.X2 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX2));
  177. Result.TileArea.Y2 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY2));
  178.  
  179. SmartFreeObject(Obj);
  180. end;
  181.  
  182. (*
  183. R_GetFloorDecorationObject
  184. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  185.  
  186. .. code-block:: pascal
  187.  
  188. function R_GetFloorDecorationObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  189.  
  190. Loads the information from the inputed GroundObj and returns a TRSObject. For
  191. use in object searching functions in this include, not in scripts.
  192.  
  193. .. note::
  194.  
  195. by Drags111
  196.  
  197. *)
  198. function R_GetFloorDecorationObject(GroundObj, BaseX, BaseY: Integer): TRSObject;
  199. var
  200. Obj, ID: Integer;
  201. begin
  202. Obj := SmartGetFieldObject(GroundObj, hook_ground_FloorDecoration);
  203. if(Obj = 0)then
  204. begin
  205. SmartFreeObject(Obj);
  206. Exit;
  207. end;
  208.  
  209. ID := SmartGetFieldShort(Obj, hook_FloorDecorationData_GetID) and $FFFF;
  210. if(ID = -1) or (ID = 65535)then
  211. ID := SmartGetFieldInt(Obj, hook_secondlevelobject_GetID) and $FFFF;
  212. if(ID = -1) or (ID = 65535)then
  213. Exit;
  214.  
  215. Result.ID := ID;
  216. Result.ObjType := OBJ_INTERACTABLE;
  217.  
  218. Result.Tile.X := BaseX + (SmartGetFieldInt(Obj, hook_animable_PixelX) / 512);
  219. Result.Tile.Y := BaseY + (SmartGetFieldInt(Obj, hook_animable_PixelY) / 512);
  220.  
  221. Result.TileArea.X1 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX1));
  222. Result.TileArea.Y1 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY1));
  223. Result.TileArea.X2 := (BaseX + SmartGetFieldShort(Obj, hook_animableentity_getAreaX2));
  224. Result.TileArea.Y2 := (BaseY + SmartGetFieldShort(Obj, hook_animableentity_getAreaY2));
  225.  
  226. SmartFreeObject(Obj);
  227. end;
  228.  
  229. (*
  230. R_GetAllObjects
  231. ~~~~~~~~~~~~~~~
  232.  
  233. .. code-block:: pascal
  234.  
  235. function R_GetAllObjects(ObjType: Integer): TRSObjectArray;
  236.  
  237. Gets all the loaded object types of ObjType and stores them in a TRSObjectArray.
  238. The ObjTypes are as follows:
  239. {Object constants}
  240. OBJ_INTERACTABLE = 1;
  241. OBJ_WALLOBJECT = 2;
  242. OBJ_WALLDECORATION = 3;
  243. OBJ_FLOORDECORATION = 4;
  244.  
  245. .. note::
  246.  
  247. by Drags111
  248.  
  249. *)
  250. function R_GetAllObjects(ObjType: Integer): TRSObjectArray;
  251. var
  252. Plane, GroundObj, X, Y, C, BaseX, BaseY: Integer;
  253. Temp: TRSObject;
  254. ObjFunction: function(GroundObj, BaseX, BaseY: Integer): TRSObject;
  255. begin
  256. SetLength(Result, 104*104);
  257. C := 0;
  258.  
  259. case ObjType of
  260. OBJ_INTERACTABLE: ObjFunction := @R_GetInteractableObject;
  261. OBJ_WALLOBJECT: ObjFunction := @R_GetWallObject;
  262. OBJ_WALLDECORATION: ObjFunction := @R_GetWallDecorationObject;
  263. OBJ_FLOORDECORATION: ObjFunction := @R_GetFloorDecorationObject;
  264. else begin
  265. R_Debug('Not a valid ObjType!', 'R_GetAllObjects');
  266. Exit;
  267. end;
  268. end;
  269.  
  270. BaseX := SmartGetFieldInt(0, hook_static_BaseX);
  271. BaseY := SmartGetFieldInt(0, hook_static_BaseY);
  272. Plane := SmartGetFieldInt(0, hook_static_LoadedPlane);
  273.  
  274. for X := 0 to 103 do
  275. for Y := 0 to 103 do
  276. begin
  277. GroundObj := SmartGetFieldArray3DObject(0, hook_static_GroundTiles, Plane, X, Y);
  278. Temp := NULL_RSOBJECT;
  279.  
  280. Temp := ObjFunction(GroundObj, BaseX, BaseY);
  281.  
  282. if(Temp = NULL_RSOBJECT)then
  283. begin
  284. SmartFreeObject(GroundObj);
  285. Continue;
  286. end;
  287. Result[C] := Temp;
  288. Inc(C);
  289. SmartFreeObject(GroundObj);
  290. end;
  291. SetLength(Result, C);
  292. end;
  293.  
  294. (*
  295. R_GetObjectAt
  296. ~~~~~~~~~~~~~
  297.  
  298. .. code-block:: pascal
  299.  
  300. function R_GetObjectAt(Tile: TTile; ObjType: Integer): TRSObject;
  301.  
  302. Returns the object at the specified tile, with the type of objType.
  303. {Object constants}
  304. OBJ_INTERACTABLE = 1;
  305. OBJ_WALLOBJECT = 2;
  306. OBJ_WALLDECORATION = 3;
  307. OBJ_FLOORDECORATION = 4;
  308.  
  309. .. note::
  310.  
  311. by Drags111
  312.  
  313. *)
  314. function R_GetObjectAt(Tile: TTile; ObjType: Integer): TRSObject;
  315. var
  316. Ground, LocalX, LocalY, Plane: Integer;
  317. ObjFunction: function(GroundObj, BaseX, BaseY: Integer): TRSObject;
  318. begin
  319. Result := NULL_RSOBJECT;
  320.  
  321. case ObjType of
  322. OBJ_INTERACTABLE: ObjFunction := @R_GetInteractableObject;
  323. OBJ_WALLOBJECT: ObjFunction := @R_GetWallObject;
  324. OBJ_WALLDECORATION: ObjFunction := @R_GetWallDecorationObject;
  325. OBJ_FLOORDECORATION: ObjFunction := @R_GetFloorDecorationObject;
  326. else begin
  327. R_Debug('Not a valid ObjType!', 'R_GetObjectAt');
  328. Exit;
  329. end;
  330. end;
  331.  
  332. try
  333. LocalX := Tile.X - SmartGetFieldInt(0, hook_static_BaseX);
  334. LocalY := Tile.Y - SmartGetFieldInt(0, hook_static_BaseY);
  335. Plane := SmartGetFieldInt(0, hook_static_LoadedPlane);
  336. Ground := SmartGetFieldArray3DObject(0, hook_static_GroundTiles, Plane, LocalX, LocalY);
  337.  
  338. Result := ObjFunction(Ground, Tile.X - LocalX, Tile.Y - LocalY);
  339. finally
  340. SmartFreeObject(Ground);
  341. end;
  342. end;
  343.  
  344. (*
  345. R_GetObjectAt
  346. ~~~~~~~~~~~~~
  347.  
  348. .. code-block:: pascal
  349.  
  350. function R_SortedCircleTPA(Center: TPoint; Radius: Integer): TPointArray;
  351.  
  352. Returns an array of all TPoints inside the circle. Sorted from closest to the
  353. Center.
  354.  
  355. .. note::
  356.  
  357. by Wizzup and BenLand100
  358.  
  359. *)
  360. function R_SortedCircleTPA(Center: TPoint; Radius: Integer): TPointArray;
  361. begin
  362. SetLength(Result,0);
  363. Result := TPAFromBox(IntToBox(Center.X - Radius, Center.Y - Radius, Center.X + Radius, Center.Y + Radius));
  364. FilterPointsPie(Result, 0, 360, 0, Radius, Center.X, Center.Y);
  365. SortTPAFrom(Result, Center);
  366. end;
  367.  
  368. (*
  369. R_GetObjectsEx
  370. ~~~~~~~~~~~~~~
  371.  
  372. .. code-block:: pascal
  373.  
  374. function R_GetObjectsEx(IDs: TIntegerArray; ObjType, MaxDist: Integer): TRSObjectArray;
  375.  
  376. Returns a TRSObjectArray of all the objects that contain one of the id's
  377. in the IDs parameter. Sorted from closest to you.
  378.  
  379. .. note::
  380.  
  381. by Drags111
  382.  
  383. *)
  384. function R_GetObjectsEx(IDs: TIntegerArray; ObjType, MaxDist: Integer): TRSObjectArray;
  385. var
  386. F, BX, BY, C, Plane, Ground: Integer;
  387. MyPos: TTile;
  388. Tiles, BadTiles: TTileArray;
  389. Temp: TRSObject;
  390. ObjFunction: function(GroundObj, BaseX, BaseY: Integer): TRSObject;
  391. begin
  392. SetLength(Result, 0);
  393. case ObjType of
  394. OBJ_INTERACTABLE: ObjFunction := @R_GetInteractableObject;
  395. OBJ_WALLOBJECT: ObjFunction := @R_GetWallObject;
  396. OBJ_WALLDECORATION: ObjFunction := @R_GetWallDecorationObject;
  397. OBJ_FLOORDECORATION: ObjFunction := @R_GetFloorDecorationObject;
  398. else begin
  399. R_Debug('Not a valid ObjType!', 'R_GetObjectAt');
  400. Exit;
  401. end;
  402. end;
  403.  
  404. C := 0;
  405. BX := SmartGetFieldInt(0, hook_static_BaseX);
  406. BY := SmartGetFieldInt(0, hook_static_BaseY);
  407. MyPos := R_GetMyPos;
  408. MyPos.X := MyPos.X - BX;
  409. MyPos.Y := MyPos.Y - BY;
  410. Tiles := R_SortedCircleTPA(MyPos, MaxDist);
  411. SetLength(Result, Length(Tiles));
  412. Plane := SmartGetFieldInt(0, hook_static_LoadedPlane);
  413.  
  414. if Length(Tiles) < 1 then
  415. Exit;
  416.  
  417. for F := 0 to High(Tiles) do
  418. begin
  419. Ground := SmartGetFieldArray3DObject(0, hook_static_GroundTiles, Plane, Tiles[F].X, Tiles[F].Y);
  420. Temp := ObjFunction(Ground, BX, BY);
  421. SmartFreeObject(Ground);
  422.  
  423. if (Temp = NULL_RSOBJECT) then
  424. Continue;
  425.  
  426. if(InIntArray(IDs, Temp.ID) and not PointInTPA(Temp.Tile, BadTiles))then
  427. begin
  428. Result[C] := Temp;
  429. AppendTPA(BadTiles, TPAFromBox(Temp.TileArea));
  430. Inc(C);
  431. end;
  432. end;
  433. SetLength(Result, C);
  434. end;
  435.  
  436. (*
  437. R_GetObjects
  438. ~~~~~~~~~~~~
  439.  
  440. .. code-block:: pascal
  441.  
  442. function R_GetObjects(ID, ObjType, MaxDist: Integer): TRSObjectArray;
  443.  
  444. Returns a TRSObjectArray of all the objects that contains the id specified in
  445. the ID parameter. Sorted from closest to you.
  446.  
  447. .. note::
  448.  
  449. by Drags111
  450.  
  451. *)
  452. function R_GetObjects(ID, ObjType, MaxDist: Integer): TRSObjectArray;
  453. begin
  454. Result := R_GetObjectsEx([ID], ObjType, MaxDist);
  455. end;
  456.  
  457. (*
  458. R_GetObjectEx
  459. ~~~~~~~~~~~~~
  460.  
  461. .. code-block:: pascal
  462.  
  463. function R_GetObjectEx(IDs: TIntegerArray; ObjType, MaxDist: Integer): TRSObject;
  464.  
  465. Returns a TRSObject of the nearest object that has one of the id's specified in
  466. the IDs parameter. Chooses the closest to you.
  467.  
  468. .. note::
  469.  
  470. by Drags111
  471.  
  472. *)
  473. function R_GetObjectEx(IDs: TIntegerArray; ObjType, MaxDist: Integer): TRSObject;
  474. var
  475. F, BX, BY, Plane, Ground: Integer;
  476. MyPos: TTile;
  477. Tiles: TTileArray;
  478. Temp: TRSObject;
  479. ObjFunction: function(GroundObj, BaseX, BaseY: Integer): TRSObject;
  480. begin
  481. Result := NULL_RSOBJECT;
  482. case ObjType of
  483. OBJ_INTERACTABLE: ObjFunction := @R_GetInteractableObject;
  484. OBJ_WALLOBJECT: ObjFunction := @R_GetWallObject;
  485. OBJ_WALLDECORATION: ObjFunction := @R_GetWallDecorationObject;
  486. OBJ_FLOORDECORATION: ObjFunction := @R_GetFloorDecorationObject;
  487. else begin
  488. R_Debug('Not a valid ObjType!', 'R_GetObjectAt');
  489. Exit;
  490. end;
  491. end;
  492.  
  493. BX := SmartGetFieldInt(0, hook_static_BaseX);
  494. BY := SmartGetFieldInt(0, hook_static_BaseY);
  495. MyPos := R_GetMyPos;
  496. MyPos.X := MyPos.X - BX;
  497. MyPos.Y := MyPos.Y - BY;
  498. Tiles := R_SortedCircleTPA(MyPos, MaxDist);
  499. Plane := SmartGetFieldInt(0, hook_static_LoadedPlane);
  500.  
  501. if Length(Tiles) < 1 then
  502. Exit;
  503.  
  504. for F := 0 to High(Tiles) do
  505. begin
  506. Ground := SmartGetFieldArray3DObject(0, hook_static_GroundTiles, Plane, Tiles[F].X, Tiles[F].Y);
  507. Temp := ObjFunction(Ground, BX, BY);
  508. SmartFreeObject(Ground);
  509.  
  510. if (Temp = NULL_RSOBJECT) then
  511. Continue;
  512.  
  513. if InIntArray(IDs, Temp.ID)then
  514. begin
  515. Result := Temp;
  516. Exit;
  517. end;
  518. end;
  519. end;
  520.  
  521. (*
  522. R_GetObject
  523. ~~~~~~~~~~~
  524.  
  525. .. code-block:: pascal
  526.  
  527. function R_GetObject(ID, ObjType, MaxDist: Integer): TRSObject;
  528.  
  529. Returns a TRSObject of the nearest object that has the id specified in the ID
  530. parameter. Chooses the closest to you.
  531.  
  532. .. note::
  533.  
  534. by Drags111
  535.  
  536. *)
  537. function R_GetObject(ID, ObjType, MaxDist: Integer): TRSObject;
  538. begin
  539. Result := R_GetObjectEx([ID], ObjType, MaxDist);
  540. end;
  541.  
  542. (*
  543. R_FindObjectsEx
  544. ~~~~~~~~~~~~~~~
  545.  
  546. .. code-block:: pascal
  547.  
  548. function R_FindObjectsEx(IDs: TIntegerArray; ObjType, MaxDist: Integer; var Objs: TRSObjectArray): Boolean;
  549.  
  550. Returns true if objects were found with the ID's specified, and stores those
  551. objects in the Objs var given in the parameters. Objs are sorted from closest
  552. to you.
  553.  
  554. .. note::
  555.  
  556. by Drags111
  557.  
  558. *)
  559. function R_FindObjectsEx(IDs: TIntegerArray; ObjType, MaxDist: Integer; var Objs: TRSObjectArray): Boolean;
  560. begin
  561. Objs := R_GetObjectsEx(IDs, ObjType, MaxDist);
  562. Result := (Length(Objs) > 0);
  563. end;
  564.  
  565. (*
  566. R_FindObjects
  567. ~~~~~~~~~~~~~
  568.  
  569. .. code-block:: pascal
  570.  
  571. function R_FindObjects(ID, ObjType, MaxDist: Integer; var Objs: TRSObjectArray): Boolean;
  572.  
  573. Returns true if objects were found with the ID specified, and stores those
  574. objects in the Objs var given in the parameters. Objs are sorted from closest
  575. to you.
  576.  
  577. .. note::
  578.  
  579. by Drags111
  580.  
  581. *)
  582. function R_FindObjects(ID, ObjType, MaxDist: Integer; var Objs: TRSObjectArray): Boolean;
  583. begin
  584. Result := R_FindObjectsEx([ID], ObjType, MaxDist, Objs);
  585. end;
  586.  
  587. (*
  588. R_FindObjectEx
  589. ~~~~~~~~~~~~~~
  590.  
  591. .. code-block:: pascal
  592.  
  593. function R_FindObjectEx(IDs: TIntegerArray; ObjType, MaxDist: Integer; var Obj: TRSObject): Boolean;
  594.  
  595. Returns true if an object was found with one of the ID's specified, and stores
  596. that object in the Obj var given in the parameters. Returns the closest one to
  597. you.
  598.  
  599. .. note::
  600.  
  601. by Drags111
  602.  
  603. *)
  604. function R_FindObjectEx(IDs: TIntegerArray; ObjType, MaxDist: Integer; var Obj: TRSObject): Boolean;
  605. begin
  606. Obj := R_GetObjectEx(IDs, ObjType, MaxDist);
  607. Result := (Obj <> NULL_RSOBJECT);
  608. end;
  609.  
  610. (*
  611. R_FindObject
  612. ~~~~~~~~~~~~
  613.  
  614. .. code-block:: pascal
  615.  
  616. function R_FindObject(ID, ObjType, MaxDist: Integer; var Obj: TRSObject): Boolean;
  617.  
  618. Returns true if an object was found with the ID specified, and stores that
  619. object in the Obj var given in the parameters. Returns the closest one to you.
  620.  
  621. .. note::
  622.  
  623. by Drags111
  624.  
  625. *)
  626. function R_FindObject(ID, ObjType, MaxDist: Integer; var Obj: TRSObject): Boolean;
  627. begin
  628. Result := R_FindObjectEx([ID], ObjType, MaxDist, Obj);
  629. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement