r_drawa.asm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  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. _DATA SEGMENT
  235. Ld0 dd 0.0
  236. Ld1 dd 0.0
  237. Lstack dd 0
  238. Lfp_near_clip dd 0.01
  239. Lceilv0 dd 0
  240. Lv dd 0
  241. Lu0 dd 0
  242. Lv0 dd 0
  243. Lzi0 dd 0
  244. _DATA ENDS
  245. _TEXT SEGMENT
  246. align 4
  247. public _R_ClipEdge
  248. _R_ClipEdge:
  249. push esi
  250. push edi
  251. push ebx
  252. mov ds:dword ptr[Lstack],esp
  253. mov ebx,ds:dword ptr[12+12+esp]
  254. mov esi,ds:dword ptr[4+12+esp]
  255. mov edx,ds:dword ptr[8+12+esp]
  256. test ebx,ebx
  257. jz Lemit
  258. Lcliploop:
  259. fld ds:dword ptr[0+0+esi]
  260. fmul ds:dword ptr[0+0+ebx]
  261. fld ds:dword ptr[0+4+esi]
  262. fmul ds:dword ptr[0+4+ebx]
  263. fld ds:dword ptr[0+8+esi]
  264. fmul ds:dword ptr[0+8+ebx]
  265. fxch st(1)
  266. faddp st(2),st(0)
  267. fld ds:dword ptr[0+0+edx]
  268. fmul ds:dword ptr[0+0+ebx]
  269. fld ds:dword ptr[0+4+edx]
  270. fmul ds:dword ptr[0+4+ebx]
  271. fld ds:dword ptr[0+8+edx]
  272. fmul ds:dword ptr[0+8+ebx]
  273. fxch st(1)
  274. faddp st(2),st(0)
  275. fxch st(3)
  276. faddp st(2),st(0)
  277. faddp st(2),st(0)
  278. fsub ds:dword ptr[12+ebx]
  279. fxch st(1)
  280. fsub ds:dword ptr[12+ebx]
  281. fxch st(1)
  282. fstp ds:dword ptr[Ld0]
  283. fstp ds:dword ptr[Ld1]
  284. mov eax,ds:dword ptr[Ld0]
  285. mov ecx,ds:dword ptr[Ld1]
  286. or ecx,eax
  287. js Lp2
  288. Lcontinue:
  289. mov ebx,ds:dword ptr[16+ebx]
  290. test ebx,ebx
  291. jnz Lcliploop
  292. Lemit:
  293. fldcw ds:word ptr[ceil_cw]
  294. cmp ds:dword ptr[_r_lastvertvalid],0
  295. jz LCalcFirst
  296. mov eax,ds:dword ptr[_r_lzi1]
  297. mov ecx,ds:dword ptr[_r_u1]
  298. mov ds:dword ptr[Lzi0],eax
  299. mov ds:dword ptr[Lu0],ecx
  300. mov ecx,ds:dword ptr[_r_v1]
  301. mov eax,ds:dword ptr[_r_ceilv1]
  302. mov ds:dword ptr[Lv0],ecx
  303. mov ds:dword ptr[Lceilv0],eax
  304. jmp LCalcSecond
  305. LCalcFirst:
  306. call near ptr LTransformAndProject
  307. fst ds:dword ptr[Lv0]
  308. fxch st(2)
  309. fstp ds:dword ptr[Lu0]
  310. fstp ds:dword ptr[Lzi0]
  311. fistp ds:dword ptr[Lceilv0]
  312. LCalcSecond:
  313. mov esi,edx
  314. call near ptr LTransformAndProject
  315. fld ds:dword ptr[Lu0]
  316. fxch st(3)
  317. fld ds:dword ptr[Lzi0]
  318. fxch st(3)
  319. fld ds:dword ptr[Lv0]
  320. fxch st(3)
  321. fist ds:dword ptr[_r_ceilv1]
  322. fldcw ds:word ptr[single_cw]
  323. fst ds:dword ptr[_r_v1]
  324. fxch st(4)
  325. fcom st(1)
  326. fnstsw ax
  327. test ah,1
  328. jz LP0
  329. fstp st(0)
  330. fld st(0)
  331. LP0:
  332. fxch st(1)
  333. fstp ds:dword ptr[_r_lzi1]
  334. fxch st(1)
  335. fst ds:dword ptr[_r_u1]
  336. fxch st(1)
  337. fcom ds:dword ptr[_r_nearzi]
  338. fnstsw ax
  339. test ah,045h
  340. jnz LP1
  341. fst ds:dword ptr[_r_nearzi]
  342. LP1:
  343. mov eax,ds:dword ptr[_r_nearzionly]
  344. test eax,eax
  345. jz LP2
  346. LPop5AndDone:
  347. mov eax,ds:dword ptr[_cacheoffset]
  348. mov edx,ds:dword ptr[_r_framecount]
  349. cmp eax,07FFFFFFFh
  350. jz LDoPop
  351. and edx,07FFFFFFFh
  352. or edx,080000000h
  353. mov ds:dword ptr[_cacheoffset],edx
  354. LDoPop:
  355. fstp st(0)
  356. fstp st(0)
  357. fstp st(0)
  358. fstp st(0)
  359. fstp st(0)
  360. jmp Ldone
  361. LP2:
  362. mov ebx,ds:dword ptr[Lceilv0]
  363. mov edi,ds:dword ptr[_edge_p]
  364. mov ecx,ds:dword ptr[_r_ceilv1]
  365. mov edx,edi
  366. mov esi,ds:dword ptr[_r_pedge]
  367. add edx,32
  368. cmp ebx,ecx
  369. jz LPop5AndDone
  370. mov eax,ds:dword ptr[_r_pedge]
  371. mov ds:dword ptr[28+edi],eax
  372. fstp ds:dword ptr[24+edi]
  373. jc LSide0
  374. LSide1:
  375. fsubp st(3),st(0)
  376. fsub st(0),st(1)
  377. fdivp st(2),st(0)
  378. mov ds:dword ptr[_r_emitted],1
  379. mov ds:dword ptr[_edge_p],edx
  380. mov eax,ds:dword ptr[edx]
  381. mov eax,ecx
  382. lea ecx,ds:dword ptr[-1+ebx]
  383. mov ebx,eax
  384. mov eax,ds:dword ptr[_surface_p]
  385. mov esi,ds:dword ptr[_surfaces]
  386. sub edx,edx
  387. sub eax,esi
  388. shr eax,6
  389. mov ds:dword ptr[16+edi],edx
  390. mov ds:dword ptr[16+2+edi],eax
  391. sub esi,esi
  392. mov ds:dword ptr[Lv],ebx
  393. fild ds:dword ptr[Lv]
  394. fsubrp st(1),st(0)
  395. fmul st(0),st(1)
  396. fadd ds:dword ptr[_r_u1]
  397. jmp LSideDone
  398. LSide0:
  399. fsub st(0),st(3)
  400. fxch st(2)
  401. fsub st(0),st(1)
  402. fdivp st(2),st(0)
  403. mov ds:dword ptr[_r_emitted],1
  404. mov ds:dword ptr[_edge_p],edx
  405. mov eax,ds:dword ptr[edx]
  406. dec ecx
  407. mov eax,ds:dword ptr[_surface_p]
  408. mov esi,ds:dword ptr[_surfaces]
  409. sub edx,edx
  410. sub eax,esi
  411. shr eax,6
  412. mov ds:dword ptr[16+2+edi],edx
  413. mov ds:dword ptr[16+edi],eax
  414. mov esi,1
  415. mov ds:dword ptr[Lv],ebx
  416. fild ds:dword ptr[Lv]
  417. fsubrp st(1),st(0)
  418. fmul st(0),st(1)
  419. faddp st(2),st(0)
  420. fxch st(1)
  421. LSideDone:
  422. fmul ds:dword ptr[fp_1m]
  423. fxch st(1)
  424. fmul ds:dword ptr[fp_1m]
  425. fxch st(1)
  426. fadd ds:dword ptr[fp_1m_minus_1]
  427. fxch st(1)
  428. fistp ds:dword ptr[4+edi]
  429. fistp ds:dword ptr[0+edi]
  430. mov eax,ds:dword ptr[0+edi]
  431. mov edx,ds:dword ptr[_r_refdef+76]
  432. cmp eax,edx
  433. jl LP4
  434. mov edx,ds:dword ptr[_r_refdef+80]
  435. cmp eax,edx
  436. jng LP5
  437. LP4:
  438. mov ds:dword ptr[0+edi],edx
  439. mov eax,edx
  440. LP5:
  441. add eax,esi
  442. mov esi,ds:dword ptr[_newedges+ebx*4]
  443. test esi,esi
  444. jz LDoFirst
  445. cmp ds:dword ptr[0+esi],eax
  446. jl LNotFirst
  447. LDoFirst:
  448. mov ds:dword ptr[12+edi],esi
  449. mov ds:dword ptr[_newedges+ebx*4],edi
  450. jmp LSetRemove
  451. LNotFirst:
  452. LFindInsertLoop:
  453. mov edx,esi
  454. mov esi,ds:dword ptr[12+esi]
  455. test esi,esi
  456. jz LInsertFound
  457. cmp ds:dword ptr[0+esi],eax
  458. jl LFindInsertLoop
  459. LInsertFound:
  460. mov ds:dword ptr[12+edi],esi
  461. mov ds:dword ptr[12+edx],edi
  462. LSetRemove:
  463. mov eax,ds:dword ptr[_removeedges+ecx*4]
  464. mov ds:dword ptr[_removeedges+ecx*4],edi
  465. mov ds:dword ptr[20+edi],eax
  466. Ldone:
  467. mov esp,ds:dword ptr[Lstack]
  468. pop ebx
  469. pop edi
  470. pop esi
  471. ret
  472. Lp2:
  473. test eax,eax
  474. jns Lp1
  475. mov eax,ds:dword ptr[Ld1]
  476. test eax,eax
  477. jns Lp3
  478. mov eax,ds:dword ptr[_r_leftclipped]
  479. mov ecx,ds:dword ptr[_r_pedge]
  480. test eax,eax
  481. jnz Ldone
  482. mov eax,ds:dword ptr[_r_framecount]
  483. and eax,07FFFFFFFh
  484. or eax,080000000h
  485. mov ds:dword ptr[_cacheoffset],eax
  486. jmp Ldone
  487. Lp1:
  488. fld ds:dword ptr[Ld0]
  489. fld ds:dword ptr[Ld1]
  490. fsubr st(0),st(1)
  491. mov ds:dword ptr[_cacheoffset],07FFFFFFFh
  492. fdivp st(1),st(0)
  493. sub esp,12
  494. fld ds:dword ptr[0+8+edx]
  495. fsub ds:dword ptr[0+8+esi]
  496. fld ds:dword ptr[0+4+edx]
  497. fsub ds:dword ptr[0+4+esi]
  498. fld ds:dword ptr[0+0+edx]
  499. fsub ds:dword ptr[0+0+esi]
  500. mov edx,esp
  501. mov eax,ds:dword ptr[20+ebx]
  502. test al,al
  503. fmul st(0),st(3)
  504. fxch st(1)
  505. fmul st(0),st(3)
  506. fxch st(2)
  507. fmulp st(3),st(0)
  508. fadd ds:dword ptr[0+0+esi]
  509. fxch st(1)
  510. fadd ds:dword ptr[0+4+esi]
  511. fxch st(2)
  512. fadd ds:dword ptr[0+8+esi]
  513. fxch st(1)
  514. fstp ds:dword ptr[0+0+esp]
  515. fstp ds:dword ptr[0+8+esp]
  516. fstp ds:dword ptr[0+4+esp]
  517. jz Ltestright
  518. mov ds:dword ptr[_r_leftclipped],1
  519. mov eax,ds:dword ptr[0+0+esp]
  520. mov ds:dword ptr[_r_leftexit+0+0],eax
  521. mov eax,ds:dword ptr[0+4+esp]
  522. mov ds:dword ptr[_r_leftexit+0+4],eax
  523. mov eax,ds:dword ptr[0+8+esp]
  524. mov ds:dword ptr[_r_leftexit+0+8],eax
  525. jmp Lcontinue
  526. Ltestright:
  527. test ah,ah
  528. jz Lcontinue
  529. mov ds:dword ptr[_r_rightclipped],1
  530. mov eax,ds:dword ptr[0+0+esp]
  531. mov ds:dword ptr[_r_rightexit+0+0],eax
  532. mov eax,ds:dword ptr[0+4+esp]
  533. mov ds:dword ptr[_r_rightexit+0+4],eax
  534. mov eax,ds:dword ptr[0+8+esp]
  535. mov ds:dword ptr[_r_rightexit+0+8],eax
  536. jmp Lcontinue
  537. Lp3:
  538. mov ds:dword ptr[_r_lastvertvalid],0
  539. fld ds:dword ptr[Ld0]
  540. fld ds:dword ptr[Ld1]
  541. fsubr st(0),st(1)
  542. mov ds:dword ptr[_cacheoffset],07FFFFFFFh
  543. fdivp st(1),st(0)
  544. sub esp,12
  545. fld ds:dword ptr[0+8+edx]
  546. fsub ds:dword ptr[0+8+esi]
  547. fld ds:dword ptr[0+4+edx]
  548. fsub ds:dword ptr[0+4+esi]
  549. fld ds:dword ptr[0+0+edx]
  550. fsub ds:dword ptr[0+0+esi]
  551. mov eax,ds:dword ptr[20+ebx]
  552. test al,al
  553. fmul st(0),st(3)
  554. fxch st(1)
  555. fmul st(0),st(3)
  556. fxch st(2)
  557. fmulp st(3),st(0)
  558. fadd ds:dword ptr[0+0+esi]
  559. fxch st(1)
  560. fadd ds:dword ptr[0+4+esi]
  561. fxch st(2)
  562. fadd ds:dword ptr[0+8+esi]
  563. fxch st(1)
  564. fstp ds:dword ptr[0+0+esp]
  565. fstp ds:dword ptr[0+8+esp]
  566. fstp ds:dword ptr[0+4+esp]
  567. mov esi,esp
  568. jz Ltestright2
  569. mov ds:dword ptr[_r_leftclipped],1
  570. mov eax,ds:dword ptr[0+0+esp]
  571. mov ds:dword ptr[_r_leftenter+0+0],eax
  572. mov eax,ds:dword ptr[0+4+esp]
  573. mov ds:dword ptr[_r_leftenter+0+4],eax
  574. mov eax,ds:dword ptr[0+8+esp]
  575. mov ds:dword ptr[_r_leftenter+0+8],eax
  576. jmp Lcontinue
  577. Ltestright2:
  578. test ah,ah
  579. jz Lcontinue
  580. mov ds:dword ptr[_r_rightclipped],1
  581. mov eax,ds:dword ptr[0+0+esp]
  582. mov ds:dword ptr[_r_rightenter+0+0],eax
  583. mov eax,ds:dword ptr[0+4+esp]
  584. mov ds:dword ptr[_r_rightenter+0+4],eax
  585. mov eax,ds:dword ptr[0+8+esp]
  586. mov ds:dword ptr[_r_rightenter+0+8],eax
  587. jmp Lcontinue
  588. LTransformAndProject:
  589. fld ds:dword ptr[0+0+esi]
  590. fsub ds:dword ptr[_modelorg+0]
  591. fld ds:dword ptr[0+4+esi]
  592. fsub ds:dword ptr[_modelorg+4]
  593. fld ds:dword ptr[0+8+esi]
  594. fsub ds:dword ptr[_modelorg+8]
  595. fxch st(2)
  596. fld st(0)
  597. fmul ds:dword ptr[_vpn+0]
  598. fld st(1)
  599. fmul ds:dword ptr[_vright+0]
  600. fxch st(2)
  601. fmul ds:dword ptr[_vup+0]
  602. fld st(3)
  603. fmul ds:dword ptr[_vpn+4]
  604. fld st(4)
  605. fmul ds:dword ptr[_vright+4]
  606. fxch st(5)
  607. fmul ds:dword ptr[_vup+4]
  608. fxch st(1)
  609. faddp st(3),st(0)
  610. fxch st(3)
  611. faddp st(4),st(0)
  612. faddp st(2),st(0)
  613. fld st(3)
  614. fmul ds:dword ptr[_vpn+8]
  615. fld st(4)
  616. fmul ds:dword ptr[_vright+8]
  617. fxch st(5)
  618. fmul ds:dword ptr[_vup+8]
  619. fxch st(1)
  620. faddp st(2),st(0)
  621. fxch st(4)
  622. faddp st(3),st(0)
  623. fxch st(1)
  624. faddp st(3),st(0)
  625. fcom ds:dword ptr[Lfp_near_clip]
  626. fnstsw ax
  627. test ah,1
  628. jz LNoClip
  629. fstp st(0)
  630. fld ds:dword ptr[Lfp_near_clip]
  631. LNoClip:
  632. fdivr ds:dword ptr[float_1]
  633. fxch st(1)
  634. fld ds:dword ptr[_xscale]
  635. fmul st(0),st(2)
  636. fmulp st(1),st(0)
  637. fadd ds:dword ptr[_xcenter]
  638. fcom ds:dword ptr[_r_refdef+68]
  639. fnstsw ax
  640. test ah,1
  641. jz LClampP0
  642. fstp st(0)
  643. fld ds:dword ptr[_r_refdef+68]
  644. LClampP0:
  645. fcom ds:dword ptr[_r_refdef+84]
  646. fnstsw ax
  647. test ah,045h
  648. jnz LClampP1
  649. fstp st(0)
  650. fld ds:dword ptr[_r_refdef+84]
  651. LClampP1:
  652. fld st(1)
  653. fmul ds:dword ptr[_yscale]
  654. fmulp st(3),st(0)
  655. fxch st(2)
  656. fsubr ds:dword ptr[_ycenter]
  657. fcom ds:dword ptr[_r_refdef+72]
  658. fnstsw ax
  659. test ah,1
  660. jz LClampP2
  661. fstp st(0)
  662. fld ds:dword ptr[_r_refdef+72]
  663. LClampP2:
  664. fcom ds:dword ptr[_r_refdef+88]
  665. fnstsw ax
  666. test ah,045h
  667. jnz LClampP3
  668. fstp st(0)
  669. fld ds:dword ptr[_r_refdef+88]
  670. LClampP3:
  671. ret
  672. _TEXT ENDS
  673. END