libgs.pas 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032
  1. // libgs.h: Graphic Library Header
  2. unit libgs;
  3. interface
  4. uses libgte, libgpu;
  5. type
  6. PACKET = byte; // packet peripheral pointer
  7. PPACKET = ^PACKET;
  8. const
  9. PSBANK = $80000000;
  10. ZRESOLUTION = $3fff; // --- Zsort resolution ---
  11. WORLD = 0;
  12. // function SCREEN ((GsCOORDINATE2 *)0x0001)
  13. type
  14. GsCOORD2PARAM = packed record
  15. scale : VECTOR;
  16. rotate : SVECTOR;
  17. trans : VECTOR;
  18. end;
  19. PGsCOORD2PARAM = ^GsCOORD2PARAM;
  20. PGsCOORDINATE2 = ^GsCOORDINATE2;
  21. GsCOORDINATE2 = packed record
  22. flg : dword;
  23. coord : MATRIX;
  24. workm : MATRIX;
  25. param : PGsCOORD2PARAM;
  26. super : PGsCOORDINATE2;
  27. _sub : PGsCOORDINATE2;
  28. end;
  29. GsVIEW2 = packed record
  30. view : MATRIX;
  31. super : GsCOORDINATE2;
  32. end;
  33. GsRVIEW2 = packed record
  34. vpx, vpy, vpz : longint;
  35. vrx, vry, vrz : longint;
  36. rz : longint;
  37. super : PGsCOORDINATE2;
  38. end;
  39. PGsRVIEW2 = ^GsRVIEW2;
  40. GsF_LIGHT = packed record
  41. vx, vy, vz : longint;
  42. r, g, b : byte;
  43. end;
  44. PGsF_LIGHT = ^GsF_LIGHT;
  45. GsOT_TAG = packed record
  46. p : 0..16777215;
  47. num : 0..255;
  48. end;
  49. PGsOT_TAG = ^GsOT_TAG;
  50. GsOT = packed record
  51. len : dword;
  52. org : PGsOT_TAG;
  53. offset : dword;
  54. point : dword;
  55. tag : PGsOT_TAG;
  56. end;
  57. PGsOT = ^GsOT;
  58. GsDOBJ2 = packed record
  59. attr : dword; // pers,trans,rotate,disp
  60. coord2 : PGsCOORDINATE2; // local dmatrix
  61. tmd : pdword;
  62. id : dword;
  63. end;
  64. PGsDOBJ2 = ^GsDOBJ2;
  65. GsDOBJ3 = packed record
  66. attr : dword; // pers,trans,rotate,disp
  67. coord2 : PGsCOORDINATE2; // local dmatrix
  68. pmd : pdword; // pmd top address
  69. base : pdword; // object base address
  70. sv : pdword; // shared vertex base
  71. id : dword;
  72. end;
  73. PGsDOBJ3 = ^GsDOBJ3;
  74. GsDOBJ4 = packed record
  75. attr : dword; // pers,trans,rotate,disp
  76. coord2 : PGsCOORDINATE2; // local dmatrix
  77. tmd : pdword;
  78. id : dword;
  79. end;
  80. GsDOBJ5 = packed record
  81. attr : dword;
  82. coord2 : PGsCOORDINATE2;
  83. tmd : pdword;
  84. packet : pdword;
  85. id : dword;
  86. end;
  87. PGsDOBJ5 = ^GsDOBJ5;
  88. GsSPRITE = packed record
  89. attr : dword;
  90. x, y : smallint;
  91. w, h : word;
  92. tpage : word;
  93. u, v : byte;
  94. cx, cy : smallint;
  95. r, g, b : byte;
  96. mx, my : smallint;
  97. scalex, scaley : smallint;
  98. rotate : longint;
  99. end;
  100. PGsSPRITE = ^GsSPRITE;
  101. GsCELL = packed record
  102. u, v : byte;
  103. cba : word;
  104. flag : word;
  105. tpage : word;
  106. end;
  107. PGsCell = ^GsCELL;
  108. GsMAP = packed record
  109. cellw, cellh : byte;
  110. ncellw, ncellh : word;
  111. base : PGsCELL;
  112. index : pword;
  113. end;
  114. PGsMAP = ^GsMAP;
  115. GsBG = packed record
  116. attr : dword;
  117. x, y : smallint;
  118. w, h : smallint;
  119. scrollx, scrolly : smallint;
  120. r, g, b : byte;
  121. map : PGsMAP;
  122. mx, my : smallint;
  123. scalex, scaley : smallint;
  124. rotate : longint;
  125. end;
  126. PGsBG = ^GsBG;
  127. GsLINE = packed record
  128. attr : dword;
  129. x0, y0 : smallint;
  130. x1, y1 : smallint;
  131. r, g, b : byte;
  132. end;
  133. PGsLINE = ^GsLINE;
  134. GsGLINE = packed record
  135. attr : dword;
  136. x0, y0 : smallint;
  137. x1, y1 : smallint;
  138. r0, g0, b0 : byte;
  139. r1, g1, b1 : byte;
  140. end;
  141. GsBOXF = packed record
  142. attr : dword;
  143. x, y : smallint;
  144. w, h : word;
  145. r, g, b : byte;
  146. end;
  147. PGsBOXF = ^GsBOXF;
  148. GsFOGPARAM = packed record
  149. dqa : smallint;
  150. dqb : longint;
  151. rfc, gfc, bfc : byte;
  152. end;
  153. PGsFOGPARAM = ^GsFOGPARAM;
  154. GsIMAGE = packed record
  155. pmode : dword;
  156. px, py : smallint;
  157. pw, ph : word;
  158. pixel : pointer;
  159. cx, cy : smallint;
  160. cw, ch : word;
  161. clut : pointer;
  162. end;
  163. PGsIMAGE = ^GsIMAGE;
  164. _GsPOSITION = packed record
  165. offx, offy : smallint;
  166. end;
  167. GsOBJTABLE2 = packed record
  168. top : PGsDOBJ2;
  169. nobj : longint;
  170. maxobj : longint;
  171. end;
  172. //typedef struct {
  173. // PACKET
  174. // * (*f3[2][3]) ();
  175. // PACKET
  176. // * (*nf3[2]) ();
  177. // PACKET
  178. // * (*g3[2][3]) ();
  179. // PACKET
  180. // * (*ng3[2]) ();
  181. // PACKET
  182. // * (*tf3[2][3]) ();
  183. // PACKET
  184. // * (*ntf3[2]) ();
  185. // PACKET
  186. // * (*tg3[2][3]) ();
  187. // PACKET
  188. // * (*ntg3[2]) ();
  189. // PACKET
  190. // * (*f4[2][3]) ();
  191. // PACKET
  192. // * (*nf4[2]) ();
  193. // PACKET
  194. // * (*g4[2][3]) ();
  195. // PACKET
  196. // * (*ng4[2]) ();
  197. // PACKET
  198. // * (*tf4[2][3]) ();
  199. // PACKET
  200. // * (*ntf4[2]) ();
  201. // PACKET
  202. // * (*tg4[2][3]) ();
  203. // PACKET
  204. // * (*ntg4[2]) ();
  205. // PACKET
  206. // * (*f3g[3])();
  207. // PACKET
  208. // * (*g3g[3])();
  209. // PACKET
  210. // * (*f4g[3])();
  211. // PACKET
  212. // * (*g4g[3])();
  213. // _GsFCALL;
  214. const
  215. GsDivMODE_NDIV = 0;
  216. GsDivMODE_DIV = 1;
  217. GsLMODE_NORMAL = 0;
  218. GsLMODE_FOG = 1;
  219. GsLMODE_LOFF = 2;
  220. // libgs macro
  221. GsOFSGTE = 0;
  222. GsOFSGPU = 4;
  223. GsINTER = 1;
  224. GsNONINTER = 0;
  225. GsRESET0 = 0;
  226. GsRESET3 = 3 shl 4;
  227. // object attribute set macro
  228. GsLDIM0 = 0;
  229. GsLDIM1 = 1;
  230. GsLDIM2 = 2;
  231. GsLDIM3 = 3;
  232. GsLDIM4 = 4;
  233. GsLDIM5 = 5;
  234. GsLDIM6 = 6;
  235. GsLDIM7 = 7;
  236. GsFOG = 1 shl 3;
  237. GsMATE = 1 shl 4;
  238. GsLLMOD = 1 shl 5;
  239. GsLOFF = 1 shl 6;
  240. GsZIGNR = 1 shl 7;
  241. GsNBACKC = 1 shl 8;
  242. GsDIV1 = 1 shl 9;
  243. GsDIV2 = 2 shl 9;
  244. GsDIV3 = 3 shl 9;
  245. GsDIV4 = 4 shl 9;
  246. GsDIV5 = 5 shl 9;
  247. GsAZERO = 0 shl 28;
  248. GsAONE = 1 shl 28;
  249. GsATWO = 2 shl 28;
  250. GsATHREE = 3 shl 28;
  251. GsALON = 1 shl 30;
  252. GsDOFF = 1 shl 31;
  253. // BG/sprite attribute set macro
  254. GsPERS = 1 shl 26;
  255. GsROTOFF = 1 shl 27;
  256. GsTMDFlagGRD = $04;
  257. // FLIP macro for GsSort[Fast]SpriteB
  258. GsHFLIP = $01;
  259. GsVFLIP = $02;
  260. // TMD structure
  261. // GTE PACKET to-GPU command '<packet-name>.code'
  262. GPU_COM_F3 = $20;
  263. GPU_COM_TF3 = $24;
  264. GPU_COM_G3 = $30;
  265. GPU_COM_TG3 = $34;
  266. GPU_COM_F4 = $28;
  267. GPU_COM_TF4 = $2c;
  268. GPU_COM_G4 = $38;
  269. GPU_COM_TG4 = $3c;
  270. GPU_COM_NF3 = $21;
  271. GPU_COM_NTF3 = $25;
  272. GPU_COM_NG3 = $31;
  273. GPU_COM_NTG3 = $35;
  274. GPU_COM_NF4 = $29;
  275. GPU_COM_NTF4 = $2d;
  276. GPU_COM_NG4 = $39;
  277. GPU_COM_NTG4 = $3d;
  278. type
  279. // TMD structure
  280. TMD_P_F3 = packed record
  281. out, _in, dummy, cd : byte;
  282. r0, g0, b0, code : byte;
  283. n0, v0 : word;
  284. v1, v2 : word;
  285. end;
  286. PTMD_P_F3 = ^TMD_P_F3;
  287. TMD_P_G3 = packed record
  288. out, _in, dummy, cd : byte;
  289. r0, g0, b0, code : byte;
  290. n0, v0 : word;
  291. n1, v1 : word;
  292. n2, v2 : word;
  293. end;
  294. PTMD_P_G3 = ^TMD_P_G3;
  295. TMD_P_F3G = packed record
  296. out, _in, dummy, cd : byte;
  297. r0, g0, b0, code : byte;
  298. r1, g1, b1, dummy1 : byte;
  299. r2, g2, b2, dummy2 : byte;
  300. n0, v0 : word;
  301. v1, v2 : word;
  302. end;
  303. PTMD_P_F3G = ^TMD_P_F3G;
  304. TMD_P_G3G = packed record
  305. out, _in, dummy, cd : byte;
  306. r0, g0, b0, code : byte;
  307. r1, g1, b1, dummy1 : byte;
  308. r2, g2, b2, dummy2 : byte;
  309. n0, v0 : word;
  310. n1, v1 : word;
  311. n2, v2 : word;
  312. end;
  313. PTMD_P_G3G = ^TMD_P_G3G;
  314. TMD_P_NF3 = packed record
  315. out, _in, dummy, cd : byte;
  316. r0, g0, b0, code : byte;
  317. v0, v1 : word;
  318. v2, p : word;
  319. end;
  320. PTMD_P_NF3 = ^TMD_P_NF3;
  321. TMD_P_NG3 = packed record
  322. out, _in, dummy, cd : byte;
  323. r0, g0, b0, code : byte;
  324. r1, g1, b1, p1 : byte;
  325. r2, g2, b2, p2 : byte;
  326. v0, v1 : word;
  327. v2, p : word;
  328. end;
  329. PTMD_P_NG3 = ^TMD_P_NG3;
  330. TMD_P_F4 = packed record
  331. out, _in, dummy, cd : byte;
  332. r0, g0, b0, code : byte;
  333. n0, v0 : word;
  334. v1, v2 : word;
  335. v3, p : word;
  336. end;
  337. PTMD_P_F4 = ^TMD_P_F4;
  338. TMD_P_G4 = packed record
  339. out, _in, dummy, cd : byte;
  340. r0, g0, b0, code : byte;
  341. n0, v0 : word;
  342. u1, v1 : word;
  343. n2, v2 : word;
  344. n3, v3 : word;
  345. end;
  346. PTMD_P_G4 = ^TMD_P_G4;
  347. TMD_P_F4G = packed record
  348. _out, _in, dummy, cd : byte;
  349. r0, g0, b0, code : byte;
  350. r1, g1, b1, dummy1 : byte;
  351. r2, g2, b2, dummy2 : byte;
  352. r3, g3, b3, dummy3 : byte;
  353. n0, v0 : word;
  354. v1, v2 : word;
  355. v3, dummy4 : word;
  356. end;
  357. PTMD_P_F4G = ^TMD_P_F4G;
  358. TMD_P_G4G = packed record
  359. _out, _in, dummy, cd : byte;
  360. r0, g0, b0, code : byte;
  361. r1, g1, b1, dummy1 : byte;
  362. r2, g2, b2, dummy2 : byte;
  363. r3, g3, b3, dummy3 : byte;
  364. n0, v0 : word;
  365. n1, v1 : word;
  366. n2, v2 : word;
  367. n3, v3 : word;
  368. end;
  369. PTMD_P_G4G = ^TMD_P_G4G;
  370. TMD_P_NF4 = packed record
  371. _out, _in, dummy, cd : byte;
  372. r0, g0, b0, code : byte;
  373. v0, v1 : word;
  374. v2, v3 : word;
  375. end;
  376. PTMD_P_NF4 = ^TMD_P_NF4;
  377. TMD_P_NG4 = packed record
  378. _out, _in, dummy, cd : byte;
  379. r0, g0, b0, code : byte;
  380. r1, g1, b1, p1 : byte;
  381. r2, g2, b2, p2 : byte;
  382. r3, g3, b3, p3 : byte;
  383. v0, v1 : word;
  384. v2, v3 : word;
  385. end;
  386. PTMD_P_NG4 = ^TMD_P_NG4;
  387. TMD_P_TF3 = packed record
  388. _out, _in, dummy, cd : byte;
  389. tu0, tv0 : byte;
  390. clut : word;
  391. tu1, tv1 : byte;
  392. tpage : word;
  393. tu2, tv2 : byte;
  394. p : word;
  395. n0, v0 : word;
  396. v1, v2 : word;
  397. end;
  398. PTMD_P_TF3 = ^TMD_P_TF3;
  399. TMD_P_TG3 = packed record
  400. _out, _in, dummy, cd : byte;
  401. tu0, tv0 : byte;
  402. clut : word;
  403. tu1, tv1 : byte;
  404. tpage : word;
  405. tu2, tv2 : byte;
  406. p : word;
  407. u0, v0 : word;
  408. n1, v1 : word;
  409. n2, v2 : word;
  410. end;
  411. PTMD_P_TG3 = ^TMD_P_TG3;
  412. TMD_P_TNF3 = packed record
  413. _out, _in, dummy, cd : byte;
  414. tu0, tv0 : byte;
  415. clut : word;
  416. tu1, tv1 : byte;
  417. tpage : word;
  418. tu2, tv2 : byte;
  419. p0 : word;
  420. r0, g0, b0, p1 : byte;
  421. v0, v1 : word;
  422. v2, p2 : word;
  423. end;
  424. PTMD_P_TNF3 = ^TMD_P_TNF3;
  425. TMD_P_TNG3 = packed record
  426. _out, _in, dummy, cd : byte;
  427. tu0, tv0 : byte;
  428. clut : word;
  429. tu1, tv1 : byte;
  430. tpage : word;
  431. tu2, tv2 : byte;
  432. p0 : word;
  433. r0, g0, b0, p1 : byte;
  434. r1, g1, b1, p2 : byte;
  435. r2, g2, b2, p3 : byte;
  436. v0, v1 : word;
  437. v2, p4 : word;
  438. end;
  439. PTMD_P_TNG3 = ^TMD_P_TNG3;
  440. TMD_P_TF4 = packed record
  441. _out, _in, dummy, cd : byte;
  442. tu0, tv0 : byte;
  443. clut : word;
  444. tu1, tv1 : byte;
  445. tpage : word;
  446. tu2, tv2 : byte;
  447. p0 : word;
  448. tu3, tv3 : byte;
  449. p1 : word;
  450. n0, v0 : word;
  451. v1, v2 : word;
  452. v3, p2 : word;
  453. end;
  454. PTMD_P_TF4 = ^TMD_P_TF4;
  455. TMD_P_TG4 = packed record
  456. _out, _in, dummy, cd : byte;
  457. tu0, tv0 : byte;
  458. clut : word;
  459. tu1, tv1 : byte;
  460. tpage : word;
  461. tu2, tv2 : byte;
  462. p0 : word;
  463. tu3, tv3 : byte;
  464. p1 : word;
  465. n0, v0 : word;
  466. n1, v1 : word;
  467. n2, v2 : word;
  468. n3, v3 : word;
  469. end;
  470. PTMD_P_TG4 = ^TMD_P_TG4;
  471. TMD_P_TNF4 = packed record
  472. _out, _in, dummy, cd : byte;
  473. tu0, tv0 : byte;
  474. clut : word;
  475. tu1, tv1 : byte;
  476. tpage : word;
  477. tu2, tv2 : byte;
  478. p0 : word;
  479. tu3, tv3 : byte;
  480. p1 : word;
  481. r0, g0, b0, p2 : byte;
  482. v0, v1 : word;
  483. v2, v3 : word;
  484. end;
  485. PTMD_P_TNF4 = ^TMD_P_TNF4;
  486. TMD_P_TNG4 = packed record
  487. _out, _in, dummy, cd : byte;
  488. tu0, tv0 : byte;
  489. clut : word;
  490. tu1, tv1 : byte;
  491. tpage : word;
  492. tu2, tv2 : byte;
  493. p0 : word;
  494. tu3, tv3 : byte;
  495. p1 : word;
  496. r0, g0, b0, p2 : byte;
  497. r1, g1, b1, p3 : byte;
  498. r2, g2, b2, p4 : byte;
  499. r3, g3, b3, p5 : byte;
  500. v0, v1 : word;
  501. v2, v3 : word;
  502. end;
  503. PTMD_P_TNG4 = ^TMD_P_TNG4;
  504. TMD_STRUCT = packed record
  505. vertop : pdword; // vertex top address of TMD format
  506. vern : dword; // the number of vertex of TMD format
  507. nortop : pdword; // normal top address of TMD format
  508. norn : dword; // the number of normal of TMD format
  509. primtop : pdword; // primitive top address of TMD format
  510. primn : dword; // the number of primitives of TMD format
  511. scale : dword; // the scale factor of TMD format
  512. end;
  513. VERT = packed record
  514. vx, vy, vz : smallint;
  515. tu, tv : byte;
  516. end;
  517. PVERT = ^VERT;
  518. VERTC = packed record
  519. vx, vy, vz : smallint;
  520. tu, tv : byte;
  521. col : CVECTOR;
  522. end;
  523. GsADIV_FT4 = packed record
  524. limit : dword; // divide limit
  525. hwd, vwd : longint; // dummy
  526. shift : longint; // OT shift
  527. org : pdword; // OT org
  528. pk : pdword; // packet base
  529. otz : longint; // gte otz
  530. adivz : longint; // active divide codition z
  531. adivw, adivh : smallint; // active divide condition w,h
  532. flg0 : longint; // gte flag
  533. flg : longint; // gte flag
  534. minx, miny, maxx, maxy : smallint; // polygon min-max
  535. hwd0, vwd0 : smallint; // resolution of screen
  536. tag : pdword; // work temprly for addPrim
  537. si : POLY_FT4; // work packet
  538. end;
  539. GsADIV_P_FT4 = packed record
  540. vt : array [0..3] of VERT;
  541. end;
  542. GsADIV_GT4 = packed record
  543. limit : dword; // divide limit
  544. hwd, vwd : longint; // dummy
  545. shift : longint; // OT shift
  546. org : pdword; // OT org
  547. pk : pdword; // packet base
  548. otz : longint; // gte otz
  549. adivz : longint; // active divide codition z
  550. adivw, adivh : smallint; // active divide condition w,h
  551. flg0 : longint; // gte flag
  552. flg : longint; // gte flag
  553. minx, miny, maxx, maxy : smallint; // polygon min-max
  554. hwd0, vwd0 : smallint; // resolution of screen
  555. tag : pdword; // work temprly for addPrim
  556. si : POLY_GT4; // work packet
  557. end;
  558. GsADIV_P_GT4 = packed record
  559. vt : array [0..3] of VERTC;
  560. end;
  561. GsADIV_G4 = packed record
  562. limit : dword; // divide limit
  563. hwd, vwd : longint; // dummy
  564. shift : longint; // OT shift
  565. org : pdword; // OT org
  566. pk : pdword; // packet base
  567. otz : longint; // gte otz
  568. adivz : longint; // active divide codition z
  569. adivw, adivh : smallint; // active divide condition w,h
  570. flg0 : longint; // gte flag
  571. flg : longint; // gte flag
  572. minx, miny, maxx, maxy : smallint; // polygon min-max
  573. hwd0, vwd0: smallint; // resolution of screen
  574. tag : pdword; // work temprly for addPrim
  575. si : POLY_G4; // work packet
  576. end;
  577. GsADIV_P_G4 = packed record
  578. vt : array [0..3] of VERTC;
  579. end;
  580. GsADIV_F4 = packed record
  581. limit : dword; // divide limit
  582. hwd, vwd : longint; // dummy
  583. shift : longint; // OT shift
  584. org : pdword; // OT org
  585. pk : pdword; // packet base
  586. otz : longint; // gte otz
  587. adivz : longint; // active divide codition z
  588. adivw, adivh : smallint; // active divide condition w,h
  589. flg0 : longint; // gte flag
  590. flg : longint; // gte flag
  591. minx, miny, maxx, maxy : smallint; // polygon min-max
  592. hwd0, vwd0 : smallint; // resolution of screen
  593. tag : pdword; // work temprly for addPrim
  594. si : POLY_F4; // work packet
  595. end;
  596. GsADIV_P_F4 = packed record
  597. vt : array [0..3] of VERT;
  598. end;
  599. GsADIV_FT3 = packed record
  600. limit : dword; // divide limit
  601. hwd, vwd : longint; // dummy
  602. shift : longint; // OT shift
  603. org : pdword; // OT org
  604. pk : pdword; // packet base
  605. otz : longint; // gte otz
  606. adivz : longint; // active divide codition z
  607. adivw, adivh : smallint; // active divide condition w,h
  608. flg : longint; // gte flag
  609. minx, miny, maxx, maxy : smallint; // polygon min-max
  610. hwd0, vwd0 : smallint; // resolution of screen
  611. tag : pdword; // work temprly for addPrim
  612. si : POLY_FT3; // work packet
  613. end;
  614. GsADIV_P_FT3 = packed record
  615. vt : array [0..2] of VERT;
  616. end;
  617. GsADIV_GT3 = packed record
  618. limit : dword; // divide limit
  619. hwd, vwd : longint; // dummy
  620. shift : longint; // OT shift
  621. org : pdword; // OT org
  622. pk : pdword; // packet base
  623. otz : longint; // gte otz
  624. adivz : longint; // active divide codition z
  625. adivw, adivh : smallint; // active divide condition w,h
  626. flg : longint; // gte flag
  627. minx, miny, maxx, maxy : smallint; // polygon min-max
  628. hwd0, vwd0 : smallint; // resolution of screen
  629. tag : pdword; // work temprly for addPrim
  630. si : POLY_GT3; // work packet
  631. end;
  632. GsADIV_P_GT3 = packed record
  633. vt : array [0..2] of VERTC;
  634. end;
  635. GsADIV_G3 = packed record
  636. limit : dword; // divide limit
  637. hwd, vwd : longint; // dummy
  638. shift : longint; // OT shift
  639. org : pdword; // OT org
  640. pk : pdword; // packet base
  641. otz : longint; // gte otz
  642. adivz : longint; // active divide codition z
  643. adivw, adivh : smallint; // active divide condition w,h
  644. flg : longint; // gte flag
  645. minx, miny, maxx, maxy : smallint; // polygon min-max
  646. hwd0, vwd0 : smallint; // resolution of screen
  647. tag : pdword; // work temprly for addPrim
  648. si : POLY_G3; // work packet
  649. end;
  650. GsADIV_P_G3 = packed record
  651. vt : array [0..2] of VERTC;
  652. end;
  653. GsADIV_F3 = packed record
  654. limit : dword; // divide limit
  655. hwd, vwd : longint; // dummy
  656. shift : longint; // OT shift
  657. org : pdword; // OT org
  658. pk : pdword; // packet base
  659. otz : longint; // gte otz
  660. adivz : longint; // active divide codition z
  661. adivw, adivh : smallint; // active divide condition w,h
  662. flg : longint; // gte flag
  663. minx, miny, maxx, maxy : smallint; // polygon min-max
  664. hwd0, vwd0 : smallint; // resolution of screen
  665. tag : pdword; // work temprly for addPrim
  666. si : POLY_F3; // work packet
  667. end;
  668. GsADIV_P_F3 = packed record
  669. vt : array [0..2] of VERT;
  670. end;
  671. procedure GsInitGraph(x, y: word; intmode: word; dith: word; varmmode: word); external;
  672. procedure GsInit3D; external;
  673. procedure GsMapModelingData(p: dword); external;
  674. procedure GsSetProjection(h: longint); external;
  675. function GsSetFlatLight(id: longint; lt: PGsF_LIGHT): longint; external;
  676. procedure GsSetLightMode(mode: longint); external;
  677. procedure GsSetFogParam(fogparm: PGsFOGPARAM); external;
  678. procedure GsSetAmbient(r, g, b: longint); external;
  679. procedure GsDrawOt(ot: PGsOT); external;
  680. procedure GsSetWorkBase(outpacketp: PPACKET); external;
  681. procedure GsSortObject3(objp: PGsDOBJ3; ot: PGsOT; shift: longint); external;
  682. procedure GsSortObject4(objp: PGsDOBJ2; ot: PGsOT; shift: longint; scratch: pdword); external;
  683. procedure GsSortObject5(objp: PGsDOBJ5; ot: PGsOT; shift: longint; scratch: pdword); external;
  684. procedure GsSortObject5J(objp: PGsDOBJ5; ot: PGsOT; shift: longint; scratch: pdword); external;
  685. procedure GsSortSprite(sp: PGsSPRITE; ot: PGsOT; pri: word); external;
  686. procedure GsSortSpriteB(sp: PGsSPRITE; ot: PGsOT; pri: word; flip: word); external;
  687. procedure GsSortFastSprite(sp: PGsSPRITE; ot: PGsOT; pri: word); external;
  688. procedure GsSortFastSpriteB(sp: PGsSPRITE; ot: PGsOT; pri: word; flip: word); external;
  689. procedure GsSortFlipSprite(sp: PGsSPRITE; ot: PGsOT; pri: word); external;
  690. procedure GsSortBg(bg: PGsBG; ot: PGsOT; pri: word); external;
  691. procedure GsSortFastBg(bg: PGsBG; ot: PGsOT; pri: word); external;
  692. procedure GsInitFixBg16(bg: PGsBG; work: pdword); external;
  693. procedure GsSortFixBg16(bg: PGsBG; work: pdword; otp: PGsOT; pri: word); external;
  694. procedure GsInitFixBg32(bg: PGsBG; work: pdword); external;
  695. procedure GsSortFixBg32(bg: PGsBG; work: pdword; otp: PGsOT; pri: word); external;
  696. procedure GsSortLine(lp: PGsLINE; ot: PGsOT; pri: word); external;
  697. procedure GsSortGLine(lp: PGsLINE; ot: PGsOT; pri: word); external;
  698. procedure GsSortBoxFill(bp: PGsBOXF; ot: PGsOT; pri: word); external;
  699. procedure GsSortPoly(pp: pointer; ot: PGsOT; pri: word); external;
  700. procedure GsClearOt(offs: dword; point: word; otp: PGsOT); external;
  701. function GsSortOt(ot_src: PGsOT; ot_dest: PGsOT): PGsOT; external;
  702. function GsCutOt(ot_src: PGsOT; ot_dest: PGsOT): PGsOT; external;
  703. procedure GsDefDispBuff(x0, y0, x1, y1: word); external;
  704. procedure GsSortClear(r, g, b: byte; otp: PGsOT); external;
  705. procedure GsGetTimInfo(im: pdword; tim: PGsIMAGE); external;
  706. procedure GsSwapDispBuff; external;
  707. function GsGetActiveBuff: longint; external;
  708. procedure GsSetDrawBuffClip; external;
  709. procedure GsSetDrawBuffOffset; external;
  710. procedure GsSetClip(clip: PRECT); external;
  711. function GsSetClip2(clip: PRECT): PDRAWENV; external;
  712. procedure GsSetOffset(x, y: longint); external;
  713. procedure GsSetOrign(x, y: longint); external;
  714. procedure GsInitCoordinate2(super: PGsCOORDINATE2; base: PGsCOORDINATE2); external;
  715. procedure GsMulCoord0(m1, m2, m3: PMATRIX); external;
  716. procedure GsMulCoord2(m1, m2: PMATRIX); external;
  717. procedure GsMulCoord3(m1, m2: PMATRIX); external;
  718. procedure GsGetLw(m: PGsCOORDINATE2; out: PMATRIX); external;
  719. procedure GsGetLs(m: PGsCOORDINATE2; out: PMATRIX); external;
  720. procedure GsGetLws(m: PGsCOORDINATE2; outw, outs: PMATRIX); external;
  721. function GsLinkObject3(pmd_base: dword; objp: PGsDOBJ3): dword; external;
  722. procedure GsLinkObject4(tmd_base: dword; objp: PGsDOBJ2; n: longint); external;
  723. procedure GsLinkObject5(tmd_base: dword; objp: PGsDOBJ5; n: longint); external;
  724. procedure GsSetLightMatrix(mp: PMATRIX); external;
  725. procedure GsSetLightMatrix2(mp: PMATRIX); external;
  726. function GsSetRefView2(pv: PGsRVIEW2): longint; external;
  727. function GsSetRefView2L(pv: PGsRVIEW2): longint; external;
  728. function GsSetView2(pv: PGsRVIEW2): longint; external;
  729. procedure GsSetLsMatrix(mp: PMATRIX); external;
  730. procedure GsSetClip2D(rectp: PRECT); external;
  731. procedure GsInitVcount; external;
  732. procedure GsGetVcount; external;
  733. procedure GsClearVcount; external;
  734. procedure GsDefDispBuff2(x0, y0, x1, y1: word); external;
  735. procedure GsDrawOtIO(ot: PGsOT); external;
  736. function GsGetWorkBase: PPACKET; external;
  737. procedure GsInitGraph2(x, y: word; intmode: word; dith: word; vrammode: word); external;
  738. procedure GsSortObject4J(objp: PGsDOBJ2; otp: PGsOT; shift: longint; scratch: pdword); external;
  739. procedure GsClearDispArea(r, g, b: byte); external;
  740. function GsPresetObject(objp: PGsDOBJ5; base_addr: pdword): pdword; external;
  741. procedure GsScaleScreen(scale: PSVECTOR); external;
  742. function GsA4divF3L(op: PTMD_P_F3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  743. function GsA4divF3LFG(op: PTMD_P_F3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  744. function GsA4divF3NL(op: PTMD_P_F3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  745. function GsA4divNF3(op: PTMD_P_NF3; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  746. function GsA4divF4L(op: PTMD_P_F4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  747. function GsA4divF4LFG(op: PTMD_P_F4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  748. function GsA4divF4NL(op: PTMD_P_F4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  749. function GsA4divNF4(op: PTMD_P_NF4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  750. function GsA4divG3L(op: PTMD_P_G3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  751. function GsA4divG3LFG(op: PTMD_P_G3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  752. function GsA4divG3NL(op: PTMD_P_G3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  753. function GsA4divNG3(op: PTMD_P_NG3; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  754. function GsA4divG4L(op: PTMD_P_G4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  755. function GsA4divG4LFG(op: PTMD_P_G4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  756. function GsA4divG4NL(op: PTMD_P_G4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  757. function GsA4divNG4(op: PTMD_P_NG4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  758. function GsA4divTF3L(op: PTMD_P_TF3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  759. function GsA4divTF3LFG(op: PTMD_P_TF3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  760. function GsA4divTF3NL(op: PTMD_P_TF3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  761. function GsA4divTNF3(op: PTMD_P_TNF3; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  762. function GsA4divTF4L(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  763. function GsA4divTF4LFG(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  764. function GsA4divTF4NL(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  765. function GsA4divTNF4(op: PTMD_P_TNF4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  766. function GsA4divTF4LM(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  767. function GsA4divTF4LFGM(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  768. function GsA4divTF4NLM(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  769. function GsA4divTNF4M(op: PTMD_P_TNF4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  770. function GsA4divTG3L(op: PTMD_P_TG3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  771. function GsA4divTG3LFG(op: PTMD_P_TG3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  772. function GsA4divTG3NL(op: PTMD_P_TG3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  773. function GsA4divTNG3(op: PTMD_P_TNG3; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  774. function GsA4divTG4L(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  775. function GsA4divTG4LFG(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  776. function GsA4divTG4NL(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  777. function GsA4divTNG4(op: PTMD_P_TNG4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  778. function GsA4divTG4LM(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  779. function GsA4divTG4LFGM(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  780. function GsA4divTG4NLM(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  781. function GsA4divTNG4M(op: PTMD_P_TNG4; vp: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  782. function GsTMDfastF3GL(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  783. function GsTMDfastF3GLFG(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  784. function GsTMDfastF3GNL(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  785. function GsTMDfastG3GL(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  786. function GsTMDfastG3GLFG(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  787. function GsTMDfastG3GNL(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  788. function GsPrstF3GL(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  789. function GsPrstF3GLFG(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  790. function GsPrstF3GNL(op: PTMD_P_F3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  791. function GsPrstG3GL(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  792. function GsPrstG3GLFG(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  793. function GsPrstG3GNL(op: PTMD_P_G3G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  794. function GsTMDfastG3M(op: PTMD_P_G3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  795. function GsTMDfastG3MFG(op: PTMD_P_G3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  796. function GsTMDfastTG3M(op: PTMD_P_TG3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  797. function GsTMDfastTG3MFG(op: PTMD_P_TG3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  798. function GsTMDfastF4GL(op: PTMD_P_F4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  799. function GsTMDfastF4GLFG(op: PTMD_P_F4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  800. function GsTMDfastF4GNL(op: PTMD_P_F4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  801. function GsTMDfastG4GL(op: PTMD_P_G4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  802. function GsTMDfastG4GLFG(op: PTMD_P_G4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  803. function GsTMDfastG4GNL(op: PTMD_P_G4G; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  804. function GsTMDfastG4M(op: PTMD_P_G4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  805. function GsTMDfastG4MFG(op: PTMD_P_G4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  806. function GsTMDfastTG4M(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  807. function GsTMDfastTG4MFG(op: PTMD_P_TG4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  808. function GsTMDfastF3M(op: PTMD_P_F3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  809. function GsTMDfastF3MFG(op: PTMD_P_F3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  810. function GsTMDfastTF3M(op: PTMD_P_TF3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  811. function GsTMDfastTF3MFG(op: PTMD_P_TF3; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  812. function GsTMDfastF4M(op: PTMD_P_F4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  813. function GsTMDfastF4MFG(op: PTMD_P_F4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  814. function GsTMDfastTF4M(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  815. function GsTMDfastTF4MFG(op: PTMD_P_TF4; vp, np: PVERT; pk: PPACKET; n, shift: longint; ot: PGsOT; scratch: pdword): PPACKET; external;
  816. var
  817. CLIP2 : RECT; external; // clipping area
  818. PSDBASEX : array [0..1] of smallint; external; // double buffer base
  819. PSDBASEY : array [0..1] of smallint; external;
  820. PSDIDX : smallint; external; // double buffer index
  821. PSDCNT : dword; external; // frame counter for using matrix cache
  822. POSITION : _GsPOSITION; external; // 2d offset
  823. GsDRAWENV : DRAWENV; external; // DRAWENV of Gs
  824. GsDISPENV : DISPENV; external; // DISPENV of Gs
  825. GsWSMATRIX : MATRIX; external; // Current World-Screen Matrix of Gs
  826. GsWSMATRIX_ORG : MATRIX; external; // Original World-Screen Matrix of Gs
  827. HWD0 : longint; external;
  828. VWD0 : longint; external; // rezolution of Holyzontal and Vertical
  829. GsLIGHTWSMATRIX : MATRIX; external; // World-Screen Light Matrix of Gs
  830. GsIDMATRIX : MATRIX; external; // Unit Matrix
  831. GsIDMATRIX2 : MATRIX; external; // Unit Matrix including Aspect retio
  832. GsOUT_PACKET_P : PPACKET; external; // Work Base pointer
  833. GsADIVZ : longint; external; // Active sub divide condition (z)
  834. GsADIVW : smallint; external;
  835. GsADIVH : smallint; external; // Active sub divide condition (w,h)
  836. GsLIGHT_MODE : longint; external; // lighting mode global
  837. GsMATE_C : dword; external;
  838. GsLMODE : dword; external;
  839. GsLIGNR : dword; external;
  840. GsLIOFF : dword; external;
  841. GsZOVER : dword; external;
  842. GsBACKC : dword; external;
  843. GsNDIV : dword; external;
  844. GsTRATE : dword; external;
  845. GsTON : dword; external;
  846. GsDISPON : dword; external;
  847. procedure GsIncFrame;
  848. procedure GsUpdateCoord;
  849. procedure GsSetAzwh(z: longint; w, h: smallint);
  850. procedure minmax4(var x1,x2,x3,x4,x5,x6: longint);
  851. procedure minmax3(var x1,x2,x3,x4,x5: longint);
  852. implementation
  853. procedure GsIncFrame;
  854. begin
  855. inc(PSDCNT);
  856. if PSDCNT > 0 then PSDCNT:= PSDCNT else PSDCNT:= 1;
  857. if PSDIDX = 0 then PSDIDX:=1 else PSDIDX:= 0;
  858. end;
  859. procedure GsUpdateCoord;
  860. begin
  861. inc(PSDCNT);
  862. if PSDCNT > 0 then PSDCNT:= PSDCNT else PSDCNT:= 1;
  863. end;
  864. procedure GsSetAzwh(z: longint; w, h: smallint);
  865. begin
  866. GsADIVZ:= z;
  867. GsADIVW:= w;
  868. GsADIVH:= h;
  869. end;
  870. procedure minmax4(var x1,x2,x3,x4,x5,x6: longint);
  871. begin
  872. if x1 > x2 then begin x6:= x1; x5:= x2; end else begin x5:= x1; x6:= x2; end;
  873. if x3 > x6 then begin x6:=x3; end else begin if x3 < x5 then x5:=x3; end;
  874. if x4 > x6 then begin x6:=x4; end else begin if x4 < x5 then x5:=x4; end;
  875. end;
  876. procedure minmax3(var x1,x2,x3,x4,x5: longint);
  877. begin
  878. if x1 > x2 then begin x5:= x1; x4:= x2; end else begin x4:= x1; x5:=x2; end;
  879. if x3 > x5 then begin x5:=x3; end else begin if x3 < x4 then x4:=x3; end;
  880. end;
  881. begin
  882. end.