d_parta.asm 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. .386P
  2. .model FLAT
  3. externdef _d_zistepu:dword
  4. externdef _d_pzbuffer:dword
  5. externdef _d_zistepv:dword
  6. externdef _d_zrowbytes:dword
  7. externdef _d_ziorigin:dword
  8. externdef _r_turb_s:dword
  9. externdef _r_turb_t:dword
  10. externdef _r_turb_pdest:dword
  11. externdef _r_turb_spancount:dword
  12. externdef _r_turb_turb:dword
  13. externdef _r_turb_pbase:dword
  14. externdef _r_turb_sstep:dword
  15. externdef _r_turb_tstep:dword
  16. externdef _r_bmodelactive:dword
  17. externdef _d_sdivzstepu:dword
  18. externdef _d_tdivzstepu:dword
  19. externdef _d_sdivzstepv:dword
  20. externdef _d_tdivzstepv:dword
  21. externdef _d_sdivzorigin:dword
  22. externdef _d_tdivzorigin:dword
  23. externdef _sadjust:dword
  24. externdef _tadjust:dword
  25. externdef _bbextents:dword
  26. externdef _bbextentt:dword
  27. externdef _cacheblock:dword
  28. externdef _d_viewbuffer:dword
  29. externdef _cachewidth:dword
  30. externdef _d_pzbuffer:dword
  31. externdef _d_zrowbytes:dword
  32. externdef _d_zwidth:dword
  33. externdef _d_scantable:dword
  34. externdef _r_lightptr:dword
  35. externdef _r_numvblocks:dword
  36. externdef _prowdestbase:dword
  37. externdef _pbasesource:dword
  38. externdef _r_lightwidth:dword
  39. externdef _lightright:dword
  40. externdef _lightrightstep:dword
  41. externdef _lightdeltastep:dword
  42. externdef _lightdelta:dword
  43. externdef _lightright:dword
  44. externdef _lightdelta:dword
  45. externdef _sourcetstep:dword
  46. externdef _surfrowbytes:dword
  47. externdef _lightrightstep:dword
  48. externdef _lightdeltastep:dword
  49. externdef _r_sourcemax:dword
  50. externdef _r_stepback:dword
  51. externdef _colormap:dword
  52. externdef _blocksize:dword
  53. externdef _sourcesstep:dword
  54. externdef _lightleft:dword
  55. externdef _blockdivshift:dword
  56. externdef _blockdivmask:dword
  57. externdef _lightleftstep:dword
  58. externdef _r_origin:dword
  59. externdef _r_ppn:dword
  60. externdef _r_pup:dword
  61. externdef _r_pright:dword
  62. externdef _ycenter:dword
  63. externdef _xcenter:dword
  64. externdef _d_vrectbottom_particle:dword
  65. externdef _d_vrectright_particle:dword
  66. externdef _d_vrecty:dword
  67. externdef _d_vrectx:dword
  68. externdef _d_pix_shift:dword
  69. externdef _d_pix_min:dword
  70. externdef _d_pix_max:dword
  71. externdef _d_y_aspect_shift:dword
  72. externdef _screenwidth:dword
  73. externdef _vright:dword
  74. externdef _vup:dword
  75. externdef _vpn:dword
  76. externdef _BOPS_Error:dword
  77. externdef _snd_scaletable:dword
  78. externdef _paintbuffer:dword
  79. externdef _snd_linear_count:dword
  80. externdef _snd_p:dword
  81. externdef _snd_vol:dword
  82. externdef _snd_out:dword
  83. externdef _r_leftclipped:dword
  84. externdef _r_leftenter:dword
  85. externdef _r_rightclipped:dword
  86. externdef _r_rightenter:dword
  87. externdef _modelorg:dword
  88. externdef _xscale:dword
  89. externdef _r_refdef:dword
  90. externdef _yscale:dword
  91. externdef _r_leftexit:dword
  92. externdef _r_rightexit:dword
  93. externdef _r_lastvertvalid:dword
  94. externdef _cacheoffset:dword
  95. externdef _newedges:dword
  96. externdef _removeedges:dword
  97. externdef _r_pedge:dword
  98. externdef _r_framecount:dword
  99. externdef _r_u1:dword
  100. externdef _r_emitted:dword
  101. externdef _edge_p:dword
  102. externdef _surface_p:dword
  103. externdef _surfaces:dword
  104. externdef _r_lzi1:dword
  105. externdef _r_v1:dword
  106. externdef _r_ceilv1:dword
  107. externdef _r_nearzi:dword
  108. externdef _r_nearzionly:dword
  109. externdef _edge_aftertail:dword
  110. externdef _edge_tail:dword
  111. externdef _current_iv:dword
  112. externdef _edge_head_u_shift20:dword
  113. externdef _span_p:dword
  114. externdef _edge_head:dword
  115. externdef _fv:dword
  116. externdef _edge_tail_u_shift20:dword
  117. externdef _r_apverts:dword
  118. externdef _r_anumverts:dword
  119. externdef _aliastransform:dword
  120. externdef _r_avertexnormals:dword
  121. externdef _r_plightvec:dword
  122. externdef _r_ambientlight:dword
  123. externdef _r_shadelight:dword
  124. externdef _aliasxcenter:dword
  125. externdef _aliasycenter:dword
  126. externdef _a_sstepxfrac:dword
  127. externdef _r_affinetridesc:dword
  128. externdef _acolormap:dword
  129. externdef _d_pcolormap:dword
  130. externdef _r_affinetridesc:dword
  131. externdef _d_sfrac:dword
  132. externdef _d_ptex:dword
  133. externdef _d_pedgespanpackage:dword
  134. externdef _d_tfrac:dword
  135. externdef _d_light:dword
  136. externdef _d_zi:dword
  137. externdef _d_pdest:dword
  138. externdef _d_pz:dword
  139. externdef _d_aspancount:dword
  140. externdef _erroradjustup:dword
  141. externdef _errorterm:dword
  142. externdef _d_xdenom:dword
  143. externdef _r_p0:dword
  144. externdef _r_p1:dword
  145. externdef _r_p2:dword
  146. externdef _a_tstepxfrac:dword
  147. externdef _r_sstepx:dword
  148. externdef _r_tstepx:dword
  149. externdef _a_ststepxwhole:dword
  150. externdef _zspantable:dword
  151. externdef _skintable:dword
  152. externdef _r_zistepx:dword
  153. externdef _erroradjustdown:dword
  154. externdef _d_countextrastep:dword
  155. externdef _ubasestep:dword
  156. externdef _a_ststepxwhole:dword
  157. externdef _a_tstepxfrac:dword
  158. externdef _r_lstepx:dword
  159. externdef _a_spans:dword
  160. externdef _erroradjustdown:dword
  161. externdef _d_pdestextrastep:dword
  162. externdef _d_pzextrastep:dword
  163. externdef _d_sfracextrastep:dword
  164. externdef _d_ptexextrastep:dword
  165. externdef _d_countextrastep:dword
  166. externdef _d_tfracextrastep:dword
  167. externdef _d_lightextrastep:dword
  168. externdef _d_ziextrastep:dword
  169. externdef _d_pdestbasestep:dword
  170. externdef _d_pzbasestep:dword
  171. externdef _d_sfracbasestep:dword
  172. externdef _d_ptexbasestep:dword
  173. externdef _ubasestep:dword
  174. externdef _d_tfracbasestep:dword
  175. externdef _d_lightbasestep:dword
  176. externdef _d_zibasestep:dword
  177. externdef _zspantable:dword
  178. externdef _r_lstepy:dword
  179. externdef _r_sstepy:dword
  180. externdef _r_tstepy:dword
  181. externdef _r_zistepy:dword
  182. externdef _D_PolysetSetEdgeTable:dword
  183. externdef _D_RasterizeAliasPolySmooth:dword
  184. externdef float_point5:dword
  185. externdef Float2ToThe31nd:dword
  186. externdef izistep:dword
  187. externdef izi:dword
  188. externdef FloatMinus2ToThe31nd:dword
  189. externdef float_1:dword
  190. externdef float_particle_z_clip:dword
  191. externdef float_minus_1:dword
  192. externdef float_0:dword
  193. externdef fp_16:dword
  194. externdef fp_64k:dword
  195. externdef fp_1m:dword
  196. externdef fp_1m_minus_1:dword
  197. externdef fp_8:dword
  198. externdef entryvec_table:dword
  199. externdef advancetable:dword
  200. externdef sstep:dword
  201. externdef tstep:dword
  202. externdef pspantemp:dword
  203. externdef counttemp:dword
  204. externdef jumptemp:dword
  205. externdef reciprocal_table:dword
  206. externdef DP_Count:dword
  207. externdef DP_u:dword
  208. externdef DP_v:dword
  209. externdef DP_32768:dword
  210. externdef DP_Color:dword
  211. externdef DP_Pix:dword
  212. externdef DP_EntryTable:dword
  213. externdef pbase:dword
  214. externdef s:dword
  215. externdef t:dword
  216. externdef sfracf:dword
  217. externdef tfracf:dword
  218. externdef snext:dword
  219. externdef tnext:dword
  220. externdef spancountminus1:dword
  221. externdef zi16stepu:dword
  222. externdef sdivz16stepu:dword
  223. externdef tdivz16stepu:dword
  224. externdef zi8stepu:dword
  225. externdef sdivz8stepu:dword
  226. externdef tdivz8stepu:dword
  227. externdef reciprocal_table_16:dword
  228. externdef entryvec_table_16:dword
  229. externdef ceil_cw:dword
  230. externdef single_cw:dword
  231. externdef fp_64kx64k:dword
  232. externdef pz:dword
  233. externdef spr8entryvec_table:dword
  234. _TEXT SEGMENT
  235. align 4
  236. public _D_DrawParticle
  237. _D_DrawParticle:
  238. push ebp
  239. push edi
  240. push ebx
  241. mov edi,ds:dword ptr[12+4+esp]
  242. fld ds:dword ptr[_r_origin]
  243. fsubr ds:dword ptr[0+edi]
  244. fld ds:dword ptr[0+4+edi]
  245. fsub ds:dword ptr[_r_origin+4]
  246. fld ds:dword ptr[0+8+edi]
  247. fsub ds:dword ptr[_r_origin+8]
  248. fxch st(2)
  249. fld ds:dword ptr[_r_ppn]
  250. fmul st(0),st(1)
  251. fld ds:dword ptr[_r_ppn+4]
  252. fmul st(0),st(3)
  253. fld ds:dword ptr[_r_ppn+8]
  254. fmul st(0),st(5)
  255. fxch st(2)
  256. faddp st(1),st(0)
  257. faddp st(1),st(0)
  258. fld st(0)
  259. fdivr ds:dword ptr[float_1]
  260. fxch st(1)
  261. fcomp ds:dword ptr[float_particle_z_clip]
  262. fxch st(3)
  263. fld ds:dword ptr[_r_pup]
  264. fmul st(0),st(2)
  265. fld ds:dword ptr[_r_pup+4]
  266. fnstsw ax
  267. test ah,1
  268. jnz LPop6AndDone
  269. fmul st(0),st(4)
  270. fld ds:dword ptr[_r_pup+8]
  271. fmul st(0),st(3)
  272. fxch st(2)
  273. faddp st(1),st(0)
  274. faddp st(1),st(0)
  275. fxch st(3)
  276. fmul ds:dword ptr[_r_pright+4]
  277. fxch st(2)
  278. fmul ds:dword ptr[_r_pright]
  279. fxch st(1)
  280. fmul ds:dword ptr[_r_pright+8]
  281. fxch st(2)
  282. faddp st(1),st(0)
  283. faddp st(1),st(0)
  284. fxch st(1)
  285. fmul st(0),st(2)
  286. fxch st(1)
  287. fmul st(0),st(2)
  288. fxch st(1)
  289. fsubr ds:dword ptr[_ycenter]
  290. fxch st(1)
  291. fadd ds:dword ptr[_xcenter]
  292. fxch st(1)
  293. fadd ds:dword ptr[float_point5]
  294. fxch st(1)
  295. fadd ds:dword ptr[float_point5]
  296. fxch st(2)
  297. fmul ds:dword ptr[DP_32768]
  298. fxch st(2)
  299. fistp ds:dword ptr[DP_u]
  300. fistp ds:dword ptr[DP_v]
  301. mov eax,ds:dword ptr[DP_u]
  302. mov edx,ds:dword ptr[DP_v]
  303. mov ebx,ds:dword ptr[_d_vrectbottom_particle]
  304. mov ecx,ds:dword ptr[_d_vrectright_particle]
  305. cmp edx,ebx
  306. jg LPop1AndDone
  307. cmp eax,ecx
  308. jg LPop1AndDone
  309. mov ebx,ds:dword ptr[_d_vrecty]
  310. mov ecx,ds:dword ptr[_d_vrectx]
  311. cmp edx,ebx
  312. jl LPop1AndDone
  313. cmp eax,ecx
  314. jl LPop1AndDone
  315. fld ds:dword ptr[12+edi]
  316. fistp ds:dword ptr[DP_Color]
  317. mov ebx,ds:dword ptr[_d_viewbuffer]
  318. add ebx,eax
  319. mov edi,ds:dword ptr[_d_scantable+edx*4]
  320. imul edx,ds:dword ptr[_d_zrowbytes]
  321. lea edx,ds:dword ptr[edx+eax*2]
  322. mov eax,ds:dword ptr[_d_pzbuffer]
  323. fistp ds:dword ptr[izi]
  324. add edi,ebx
  325. add edx,eax
  326. mov eax,ds:dword ptr[izi]
  327. mov ecx,ds:dword ptr[_d_pix_shift]
  328. shr eax,cl
  329. mov ebp,ds:dword ptr[izi]
  330. mov ebx,ds:dword ptr[_d_pix_min]
  331. mov ecx,ds:dword ptr[_d_pix_max]
  332. cmp eax,ebx
  333. jnl LTestPixMax
  334. mov eax,ebx
  335. jmp LTestDone
  336. LTestPixMax:
  337. cmp eax,ecx
  338. jng LTestDone
  339. mov eax,ecx
  340. LTestDone:
  341. mov ch,ds:byte ptr[DP_Color]
  342. mov ebx,ds:dword ptr[_d_y_aspect_shift]
  343. test ebx,ebx
  344. jnz LDefault
  345. cmp eax,4
  346. ja LDefault
  347. jmp dword ptr[DP_EntryTable-4+eax*4]
  348. public DP_1x1
  349. DP_1x1:
  350. cmp ds:word ptr[edx],bp
  351. jg LDone
  352. mov ds:word ptr[edx],bp
  353. mov ds:byte ptr[edi],ch
  354. jmp LDone
  355. public DP_2x2
  356. DP_2x2:
  357. push esi
  358. mov ebx,ds:dword ptr[_screenwidth]
  359. mov esi,ds:dword ptr[_d_zrowbytes]
  360. cmp ds:word ptr[edx],bp
  361. jg L2x2_1
  362. mov ds:word ptr[edx],bp
  363. mov ds:byte ptr[edi],ch
  364. L2x2_1:
  365. cmp ds:word ptr[2+edx],bp
  366. jg L2x2_2
  367. mov ds:word ptr[2+edx],bp
  368. mov ds:byte ptr[1+edi],ch
  369. L2x2_2:
  370. cmp ds:word ptr[edx+esi*1],bp
  371. jg L2x2_3
  372. mov ds:word ptr[edx+esi*1],bp
  373. mov ds:byte ptr[edi+ebx*1],ch
  374. L2x2_3:
  375. cmp ds:word ptr[2+edx+esi*1],bp
  376. jg L2x2_4
  377. mov ds:word ptr[2+edx+esi*1],bp
  378. mov ds:byte ptr[1+edi+ebx*1],ch
  379. L2x2_4:
  380. pop esi
  381. jmp LDone
  382. public DP_3x3
  383. DP_3x3:
  384. push esi
  385. mov ebx,ds:dword ptr[_screenwidth]
  386. mov esi,ds:dword ptr[_d_zrowbytes]
  387. cmp ds:word ptr[edx],bp
  388. jg L3x3_1
  389. mov ds:word ptr[edx],bp
  390. mov ds:byte ptr[edi],ch
  391. L3x3_1:
  392. cmp ds:word ptr[2+edx],bp
  393. jg L3x3_2
  394. mov ds:word ptr[2+edx],bp
  395. mov ds:byte ptr[1+edi],ch
  396. L3x3_2:
  397. cmp ds:word ptr[4+edx],bp
  398. jg L3x3_3
  399. mov ds:word ptr[4+edx],bp
  400. mov ds:byte ptr[2+edi],ch
  401. L3x3_3:
  402. cmp ds:word ptr[edx+esi*1],bp
  403. jg L3x3_4
  404. mov ds:word ptr[edx+esi*1],bp
  405. mov ds:byte ptr[edi+ebx*1],ch
  406. L3x3_4:
  407. cmp ds:word ptr[2+edx+esi*1],bp
  408. jg L3x3_5
  409. mov ds:word ptr[2+edx+esi*1],bp
  410. mov ds:byte ptr[1+edi+ebx*1],ch
  411. L3x3_5:
  412. cmp ds:word ptr[4+edx+esi*1],bp
  413. jg L3x3_6
  414. mov ds:word ptr[4+edx+esi*1],bp
  415. mov ds:byte ptr[2+edi+ebx*1],ch
  416. L3x3_6:
  417. cmp ds:word ptr[edx+esi*2],bp
  418. jg L3x3_7
  419. mov ds:word ptr[edx+esi*2],bp
  420. mov ds:byte ptr[edi+ebx*2],ch
  421. L3x3_7:
  422. cmp ds:word ptr[2+edx+esi*2],bp
  423. jg L3x3_8
  424. mov ds:word ptr[2+edx+esi*2],bp
  425. mov ds:byte ptr[1+edi+ebx*2],ch
  426. L3x3_8:
  427. cmp ds:word ptr[4+edx+esi*2],bp
  428. jg L3x3_9
  429. mov ds:word ptr[4+edx+esi*2],bp
  430. mov ds:byte ptr[2+edi+ebx*2],ch
  431. L3x3_9:
  432. pop esi
  433. jmp LDone
  434. public DP_4x4
  435. DP_4x4:
  436. push esi
  437. mov ebx,ds:dword ptr[_screenwidth]
  438. mov esi,ds:dword ptr[_d_zrowbytes]
  439. cmp ds:word ptr[edx],bp
  440. jg L4x4_1
  441. mov ds:word ptr[edx],bp
  442. mov ds:byte ptr[edi],ch
  443. L4x4_1:
  444. cmp ds:word ptr[2+edx],bp
  445. jg L4x4_2
  446. mov ds:word ptr[2+edx],bp
  447. mov ds:byte ptr[1+edi],ch
  448. L4x4_2:
  449. cmp ds:word ptr[4+edx],bp
  450. jg L4x4_3
  451. mov ds:word ptr[4+edx],bp
  452. mov ds:byte ptr[2+edi],ch
  453. L4x4_3:
  454. cmp ds:word ptr[6+edx],bp
  455. jg L4x4_4
  456. mov ds:word ptr[6+edx],bp
  457. mov ds:byte ptr[3+edi],ch
  458. L4x4_4:
  459. cmp ds:word ptr[edx+esi*1],bp
  460. jg L4x4_5
  461. mov ds:word ptr[edx+esi*1],bp
  462. mov ds:byte ptr[edi+ebx*1],ch
  463. L4x4_5:
  464. cmp ds:word ptr[2+edx+esi*1],bp
  465. jg L4x4_6
  466. mov ds:word ptr[2+edx+esi*1],bp
  467. mov ds:byte ptr[1+edi+ebx*1],ch
  468. L4x4_6:
  469. cmp ds:word ptr[4+edx+esi*1],bp
  470. jg L4x4_7
  471. mov ds:word ptr[4+edx+esi*1],bp
  472. mov ds:byte ptr[2+edi+ebx*1],ch
  473. L4x4_7:
  474. cmp ds:word ptr[6+edx+esi*1],bp
  475. jg L4x4_8
  476. mov ds:word ptr[6+edx+esi*1],bp
  477. mov ds:byte ptr[3+edi+ebx*1],ch
  478. L4x4_8:
  479. lea edx,ds:dword ptr[edx+esi*2]
  480. lea edi,ds:dword ptr[edi+ebx*2]
  481. cmp ds:word ptr[edx],bp
  482. jg L4x4_9
  483. mov ds:word ptr[edx],bp
  484. mov ds:byte ptr[edi],ch
  485. L4x4_9:
  486. cmp ds:word ptr[2+edx],bp
  487. jg L4x4_10
  488. mov ds:word ptr[2+edx],bp
  489. mov ds:byte ptr[1+edi],ch
  490. L4x4_10:
  491. cmp ds:word ptr[4+edx],bp
  492. jg L4x4_11
  493. mov ds:word ptr[4+edx],bp
  494. mov ds:byte ptr[2+edi],ch
  495. L4x4_11:
  496. cmp ds:word ptr[6+edx],bp
  497. jg L4x4_12
  498. mov ds:word ptr[6+edx],bp
  499. mov ds:byte ptr[3+edi],ch
  500. L4x4_12:
  501. cmp ds:word ptr[edx+esi*1],bp
  502. jg L4x4_13
  503. mov ds:word ptr[edx+esi*1],bp
  504. mov ds:byte ptr[edi+ebx*1],ch
  505. L4x4_13:
  506. cmp ds:word ptr[2+edx+esi*1],bp
  507. jg L4x4_14
  508. mov ds:word ptr[2+edx+esi*1],bp
  509. mov ds:byte ptr[1+edi+ebx*1],ch
  510. L4x4_14:
  511. cmp ds:word ptr[4+edx+esi*1],bp
  512. jg L4x4_15
  513. mov ds:word ptr[4+edx+esi*1],bp
  514. mov ds:byte ptr[2+edi+ebx*1],ch
  515. L4x4_15:
  516. cmp ds:word ptr[6+edx+esi*1],bp
  517. jg L4x4_16
  518. mov ds:word ptr[6+edx+esi*1],bp
  519. mov ds:byte ptr[3+edi+ebx*1],ch
  520. L4x4_16:
  521. pop esi
  522. jmp LDone
  523. LDefault:
  524. mov ebx,eax
  525. mov ds:dword ptr[DP_Pix],eax
  526. mov cl,ds:byte ptr[_d_y_aspect_shift]
  527. shl ebx,cl
  528. LGenRowLoop:
  529. mov eax,ds:dword ptr[DP_Pix]
  530. LGenColLoop:
  531. cmp ds:word ptr[-2+edx+eax*2],bp
  532. jg LGSkip
  533. mov ds:word ptr[-2+edx+eax*2],bp
  534. mov ds:byte ptr[-1+edi+eax*1],ch
  535. LGSkip:
  536. dec eax
  537. jnz LGenColLoop
  538. add edx,ds:dword ptr[_d_zrowbytes]
  539. add edi,ds:dword ptr[_screenwidth]
  540. dec ebx
  541. jnz LGenRowLoop
  542. LDone:
  543. pop ebx
  544. pop edi
  545. pop ebp
  546. ret
  547. LPop6AndDone:
  548. fstp st(0)
  549. fstp st(0)
  550. fstp st(0)
  551. fstp st(0)
  552. fstp st(0)
  553. LPop1AndDone:
  554. fstp st(0)
  555. jmp LDone
  556. _TEXT ENDS
  557. END