surf8.asm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. sb_v dd 0
  236. _DATA ENDS
  237. _TEXT SEGMENT
  238. align 4
  239. public _R_Surf8Start
  240. _R_Surf8Start:
  241. align 4
  242. public _R_DrawSurfaceBlock8_mip0
  243. _R_DrawSurfaceBlock8_mip0:
  244. push ebp
  245. push edi
  246. push esi
  247. push ebx
  248. mov ebx,ds:dword ptr[_r_lightptr]
  249. mov eax,ds:dword ptr[_r_numvblocks]
  250. mov ds:dword ptr[sb_v],eax
  251. mov edi,ds:dword ptr[_prowdestbase]
  252. mov esi,ds:dword ptr[_pbasesource]
  253. Lv_loop_mip0:
  254. mov eax,ds:dword ptr[ebx]
  255. mov edx,ds:dword ptr[4+ebx]
  256. mov ebp,eax
  257. mov ecx,ds:dword ptr[_r_lightwidth]
  258. mov ds:dword ptr[_lightright],edx
  259. sub ebp,edx
  260. and ebp,0FFFFFh
  261. lea ebx,ds:dword ptr[ebx+ecx*4]
  262. mov ds:dword ptr[_r_lightptr],ebx
  263. mov ecx,ds:dword ptr[4+ebx]
  264. mov ebx,ds:dword ptr[ebx]
  265. sub ebx,eax
  266. sub ecx,edx
  267. sar ecx,4
  268. or ebp,0F0000000h
  269. sar ebx,4
  270. mov ds:dword ptr[_lightrightstep],ecx
  271. sub ebx,ecx
  272. and ebx,0FFFFFh
  273. or ebx,0F0000000h
  274. sub ecx,ecx
  275. mov ds:dword ptr[_lightdeltastep],ebx
  276. sub ebx,ebx
  277. Lblockloop8_mip0:
  278. mov ds:dword ptr[_lightdelta],ebp
  279. mov cl,ds:byte ptr[14+esi]
  280. sar ebp,4
  281. mov bh,dh
  282. mov bl,ds:byte ptr[15+esi]
  283. add edx,ebp
  284. mov ch,dh
  285. add edx,ebp
  286. mov ah,ds:byte ptr[12345678h+ebx]
  287. LBPatch0:
  288. mov bl,ds:byte ptr[13+esi]
  289. mov al,ds:byte ptr[12345678h+ecx]
  290. LBPatch1:
  291. mov cl,ds:byte ptr[12+esi]
  292. mov bh,dh
  293. add edx,ebp
  294. ror eax,16
  295. mov ch,dh
  296. add edx,ebp
  297. mov ah,ds:byte ptr[12345678h+ebx]
  298. LBPatch2:
  299. mov bl,ds:byte ptr[11+esi]
  300. mov al,ds:byte ptr[12345678h+ecx]
  301. LBPatch3:
  302. mov cl,ds:byte ptr[10+esi]
  303. mov ds:dword ptr[12+edi],eax
  304. mov bh,dh
  305. add edx,ebp
  306. mov ch,dh
  307. add edx,ebp
  308. mov ah,ds:byte ptr[12345678h+ebx]
  309. LBPatch4:
  310. mov bl,ds:byte ptr[9+esi]
  311. mov al,ds:byte ptr[12345678h+ecx]
  312. LBPatch5:
  313. mov cl,ds:byte ptr[8+esi]
  314. mov bh,dh
  315. add edx,ebp
  316. ror eax,16
  317. mov ch,dh
  318. add edx,ebp
  319. mov ah,ds:byte ptr[12345678h+ebx]
  320. LBPatch6:
  321. mov bl,ds:byte ptr[7+esi]
  322. mov al,ds:byte ptr[12345678h+ecx]
  323. LBPatch7:
  324. mov cl,ds:byte ptr[6+esi]
  325. mov ds:dword ptr[8+edi],eax
  326. mov bh,dh
  327. add edx,ebp
  328. mov ch,dh
  329. add edx,ebp
  330. mov ah,ds:byte ptr[12345678h+ebx]
  331. LBPatch8:
  332. mov bl,ds:byte ptr[5+esi]
  333. mov al,ds:byte ptr[12345678h+ecx]
  334. LBPatch9:
  335. mov cl,ds:byte ptr[4+esi]
  336. mov bh,dh
  337. add edx,ebp
  338. ror eax,16
  339. mov ch,dh
  340. add edx,ebp
  341. mov ah,ds:byte ptr[12345678h+ebx]
  342. LBPatch10:
  343. mov bl,ds:byte ptr[3+esi]
  344. mov al,ds:byte ptr[12345678h+ecx]
  345. LBPatch11:
  346. mov cl,ds:byte ptr[2+esi]
  347. mov ds:dword ptr[4+edi],eax
  348. mov bh,dh
  349. add edx,ebp
  350. mov ch,dh
  351. add edx,ebp
  352. mov ah,ds:byte ptr[12345678h+ebx]
  353. LBPatch12:
  354. mov bl,ds:byte ptr[1+esi]
  355. mov al,ds:byte ptr[12345678h+ecx]
  356. LBPatch13:
  357. mov cl,ds:byte ptr[esi]
  358. mov bh,dh
  359. add edx,ebp
  360. ror eax,16
  361. mov ch,dh
  362. mov ah,ds:byte ptr[12345678h+ebx]
  363. LBPatch14:
  364. mov edx,ds:dword ptr[_lightright]
  365. mov al,ds:byte ptr[12345678h+ecx]
  366. LBPatch15:
  367. mov ebp,ds:dword ptr[_lightdelta]
  368. mov ds:dword ptr[edi],eax
  369. add esi,ds:dword ptr[_sourcetstep]
  370. add edi,ds:dword ptr[_surfrowbytes]
  371. add edx,ds:dword ptr[_lightrightstep]
  372. add ebp,ds:dword ptr[_lightdeltastep]
  373. mov ds:dword ptr[_lightright],edx
  374. jc Lblockloop8_mip0
  375. cmp esi,ds:dword ptr[_r_sourcemax]
  376. jb LSkip_mip0
  377. sub esi,ds:dword ptr[_r_stepback]
  378. LSkip_mip0:
  379. mov ebx,ds:dword ptr[_r_lightptr]
  380. dec ds:dword ptr[sb_v]
  381. jnz Lv_loop_mip0
  382. pop ebx
  383. pop esi
  384. pop edi
  385. pop ebp
  386. ret
  387. align 4
  388. public _R_DrawSurfaceBlock8_mip1
  389. _R_DrawSurfaceBlock8_mip1:
  390. push ebp
  391. push edi
  392. push esi
  393. push ebx
  394. mov ebx,ds:dword ptr[_r_lightptr]
  395. mov eax,ds:dword ptr[_r_numvblocks]
  396. mov ds:dword ptr[sb_v],eax
  397. mov edi,ds:dword ptr[_prowdestbase]
  398. mov esi,ds:dword ptr[_pbasesource]
  399. Lv_loop_mip1:
  400. mov eax,ds:dword ptr[ebx]
  401. mov edx,ds:dword ptr[4+ebx]
  402. mov ebp,eax
  403. mov ecx,ds:dword ptr[_r_lightwidth]
  404. mov ds:dword ptr[_lightright],edx
  405. sub ebp,edx
  406. and ebp,0FFFFFh
  407. lea ebx,ds:dword ptr[ebx+ecx*4]
  408. mov ds:dword ptr[_r_lightptr],ebx
  409. mov ecx,ds:dword ptr[4+ebx]
  410. mov ebx,ds:dword ptr[ebx]
  411. sub ebx,eax
  412. sub ecx,edx
  413. sar ecx,3
  414. or ebp,070000000h
  415. sar ebx,3
  416. mov ds:dword ptr[_lightrightstep],ecx
  417. sub ebx,ecx
  418. and ebx,0FFFFFh
  419. or ebx,0F0000000h
  420. sub ecx,ecx
  421. mov ds:dword ptr[_lightdeltastep],ebx
  422. sub ebx,ebx
  423. Lblockloop8_mip1:
  424. mov ds:dword ptr[_lightdelta],ebp
  425. mov cl,ds:byte ptr[6+esi]
  426. sar ebp,3
  427. mov bh,dh
  428. mov bl,ds:byte ptr[7+esi]
  429. add edx,ebp
  430. mov ch,dh
  431. add edx,ebp
  432. mov ah,ds:byte ptr[12345678h+ebx]
  433. LBPatch22:
  434. mov bl,ds:byte ptr[5+esi]
  435. mov al,ds:byte ptr[12345678h+ecx]
  436. LBPatch23:
  437. mov cl,ds:byte ptr[4+esi]
  438. mov bh,dh
  439. add edx,ebp
  440. ror eax,16
  441. mov ch,dh
  442. add edx,ebp
  443. mov ah,ds:byte ptr[12345678h+ebx]
  444. LBPatch24:
  445. mov bl,ds:byte ptr[3+esi]
  446. mov al,ds:byte ptr[12345678h+ecx]
  447. LBPatch25:
  448. mov cl,ds:byte ptr[2+esi]
  449. mov ds:dword ptr[4+edi],eax
  450. mov bh,dh
  451. add edx,ebp
  452. mov ch,dh
  453. add edx,ebp
  454. mov ah,ds:byte ptr[12345678h+ebx]
  455. LBPatch26:
  456. mov bl,ds:byte ptr[1+esi]
  457. mov al,ds:byte ptr[12345678h+ecx]
  458. LBPatch27:
  459. mov cl,ds:byte ptr[esi]
  460. mov bh,dh
  461. add edx,ebp
  462. ror eax,16
  463. mov ch,dh
  464. mov ah,ds:byte ptr[12345678h+ebx]
  465. LBPatch28:
  466. mov edx,ds:dword ptr[_lightright]
  467. mov al,ds:byte ptr[12345678h+ecx]
  468. LBPatch29:
  469. mov ebp,ds:dword ptr[_lightdelta]
  470. mov ds:dword ptr[edi],eax
  471. mov eax,ds:dword ptr[_sourcetstep]
  472. add esi,eax
  473. mov eax,ds:dword ptr[_surfrowbytes]
  474. add edi,eax
  475. mov eax,ds:dword ptr[_lightrightstep]
  476. add edx,eax
  477. mov eax,ds:dword ptr[_lightdeltastep]
  478. add ebp,eax
  479. mov ds:dword ptr[_lightright],edx
  480. jc Lblockloop8_mip1
  481. cmp esi,ds:dword ptr[_r_sourcemax]
  482. jb LSkip_mip1
  483. sub esi,ds:dword ptr[_r_stepback]
  484. LSkip_mip1:
  485. mov ebx,ds:dword ptr[_r_lightptr]
  486. dec ds:dword ptr[sb_v]
  487. jnz Lv_loop_mip1
  488. pop ebx
  489. pop esi
  490. pop edi
  491. pop ebp
  492. ret
  493. align 4
  494. public _R_DrawSurfaceBlock8_mip2
  495. _R_DrawSurfaceBlock8_mip2:
  496. push ebp
  497. push edi
  498. push esi
  499. push ebx
  500. mov ebx,ds:dword ptr[_r_lightptr]
  501. mov eax,ds:dword ptr[_r_numvblocks]
  502. mov ds:dword ptr[sb_v],eax
  503. mov edi,ds:dword ptr[_prowdestbase]
  504. mov esi,ds:dword ptr[_pbasesource]
  505. Lv_loop_mip2:
  506. mov eax,ds:dword ptr[ebx]
  507. mov edx,ds:dword ptr[4+ebx]
  508. mov ebp,eax
  509. mov ecx,ds:dword ptr[_r_lightwidth]
  510. mov ds:dword ptr[_lightright],edx
  511. sub ebp,edx
  512. and ebp,0FFFFFh
  513. lea ebx,ds:dword ptr[ebx+ecx*4]
  514. mov ds:dword ptr[_r_lightptr],ebx
  515. mov ecx,ds:dword ptr[4+ebx]
  516. mov ebx,ds:dword ptr[ebx]
  517. sub ebx,eax
  518. sub ecx,edx
  519. sar ecx,2
  520. or ebp,030000000h
  521. sar ebx,2
  522. mov ds:dword ptr[_lightrightstep],ecx
  523. sub ebx,ecx
  524. and ebx,0FFFFFh
  525. or ebx,0F0000000h
  526. sub ecx,ecx
  527. mov ds:dword ptr[_lightdeltastep],ebx
  528. sub ebx,ebx
  529. Lblockloop8_mip2:
  530. mov ds:dword ptr[_lightdelta],ebp
  531. mov cl,ds:byte ptr[2+esi]
  532. sar ebp,2
  533. mov bh,dh
  534. mov bl,ds:byte ptr[3+esi]
  535. add edx,ebp
  536. mov ch,dh
  537. add edx,ebp
  538. mov ah,ds:byte ptr[12345678h+ebx]
  539. LBPatch18:
  540. mov bl,ds:byte ptr[1+esi]
  541. mov al,ds:byte ptr[12345678h+ecx]
  542. LBPatch19:
  543. mov cl,ds:byte ptr[esi]
  544. mov bh,dh
  545. add edx,ebp
  546. ror eax,16
  547. mov ch,dh
  548. mov ah,ds:byte ptr[12345678h+ebx]
  549. LBPatch20:
  550. mov edx,ds:dword ptr[_lightright]
  551. mov al,ds:byte ptr[12345678h+ecx]
  552. LBPatch21:
  553. mov ebp,ds:dword ptr[_lightdelta]
  554. mov ds:dword ptr[edi],eax
  555. mov eax,ds:dword ptr[_sourcetstep]
  556. add esi,eax
  557. mov eax,ds:dword ptr[_surfrowbytes]
  558. add edi,eax
  559. mov eax,ds:dword ptr[_lightrightstep]
  560. add edx,eax
  561. mov eax,ds:dword ptr[_lightdeltastep]
  562. add ebp,eax
  563. mov ds:dword ptr[_lightright],edx
  564. jc Lblockloop8_mip2
  565. cmp esi,ds:dword ptr[_r_sourcemax]
  566. jb LSkip_mip2
  567. sub esi,ds:dword ptr[_r_stepback]
  568. LSkip_mip2:
  569. mov ebx,ds:dword ptr[_r_lightptr]
  570. dec ds:dword ptr[sb_v]
  571. jnz Lv_loop_mip2
  572. pop ebx
  573. pop esi
  574. pop edi
  575. pop ebp
  576. ret
  577. align 4
  578. public _R_DrawSurfaceBlock8_mip3
  579. _R_DrawSurfaceBlock8_mip3:
  580. push ebp
  581. push edi
  582. push esi
  583. push ebx
  584. mov ebx,ds:dword ptr[_r_lightptr]
  585. mov eax,ds:dword ptr[_r_numvblocks]
  586. mov ds:dword ptr[sb_v],eax
  587. mov edi,ds:dword ptr[_prowdestbase]
  588. mov esi,ds:dword ptr[_pbasesource]
  589. Lv_loop_mip3:
  590. mov eax,ds:dword ptr[ebx]
  591. mov edx,ds:dword ptr[4+ebx]
  592. mov ebp,eax
  593. mov ecx,ds:dword ptr[_r_lightwidth]
  594. mov ds:dword ptr[_lightright],edx
  595. sub ebp,edx
  596. and ebp,0FFFFFh
  597. lea ebx,ds:dword ptr[ebx+ecx*4]
  598. mov ds:dword ptr[_lightdelta],ebp
  599. mov ds:dword ptr[_r_lightptr],ebx
  600. mov ecx,ds:dword ptr[4+ebx]
  601. mov ebx,ds:dword ptr[ebx]
  602. sub ebx,eax
  603. sub ecx,edx
  604. sar ecx,1
  605. sar ebx,1
  606. mov ds:dword ptr[_lightrightstep],ecx
  607. sub ebx,ecx
  608. and ebx,0FFFFFh
  609. sar ebp,1
  610. or ebx,0F0000000h
  611. mov ds:dword ptr[_lightdeltastep],ebx
  612. sub ebx,ebx
  613. mov bl,ds:byte ptr[1+esi]
  614. sub ecx,ecx
  615. mov bh,dh
  616. mov cl,ds:byte ptr[esi]
  617. add edx,ebp
  618. mov ch,dh
  619. mov al,ds:byte ptr[12345678h+ebx]
  620. LBPatch16:
  621. mov edx,ds:dword ptr[_lightright]
  622. mov ds:byte ptr[1+edi],al
  623. mov al,ds:byte ptr[12345678h+ecx]
  624. LBPatch17:
  625. mov ds:byte ptr[edi],al
  626. mov eax,ds:dword ptr[_sourcetstep]
  627. add esi,eax
  628. mov eax,ds:dword ptr[_surfrowbytes]
  629. add edi,eax
  630. mov eax,ds:dword ptr[_lightdeltastep]
  631. mov ebp,ds:dword ptr[_lightdelta]
  632. mov cl,ds:byte ptr[esi]
  633. add ebp,eax
  634. mov eax,ds:dword ptr[_lightrightstep]
  635. sar ebp,1
  636. add edx,eax
  637. mov bh,dh
  638. mov bl,ds:byte ptr[1+esi]
  639. add edx,ebp
  640. mov ch,dh
  641. mov al,ds:byte ptr[12345678h+ebx]
  642. LBPatch30:
  643. mov edx,ds:dword ptr[_sourcetstep]
  644. mov ds:byte ptr[1+edi],al
  645. mov al,ds:byte ptr[12345678h+ecx]
  646. LBPatch31:
  647. mov ds:byte ptr[edi],al
  648. mov ebp,ds:dword ptr[_surfrowbytes]
  649. add esi,edx
  650. add edi,ebp
  651. cmp esi,ds:dword ptr[_r_sourcemax]
  652. jb LSkip_mip3
  653. sub esi,ds:dword ptr[_r_stepback]
  654. LSkip_mip3:
  655. mov ebx,ds:dword ptr[_r_lightptr]
  656. dec ds:dword ptr[sb_v]
  657. jnz Lv_loop_mip3
  658. pop ebx
  659. pop esi
  660. pop edi
  661. pop ebp
  662. ret
  663. public _R_Surf8End
  664. _R_Surf8End:
  665. _TEXT ENDS
  666. _DATA SEGMENT
  667. align 4
  668. LPatchTable8:
  669. dd LBPatch0-4
  670. dd LBPatch1-4
  671. dd LBPatch2-4
  672. dd LBPatch3-4
  673. dd LBPatch4-4
  674. dd LBPatch5-4
  675. dd LBPatch6-4
  676. dd LBPatch7-4
  677. dd LBPatch8-4
  678. dd LBPatch9-4
  679. dd LBPatch10-4
  680. dd LBPatch11-4
  681. dd LBPatch12-4
  682. dd LBPatch13-4
  683. dd LBPatch14-4
  684. dd LBPatch15-4
  685. dd LBPatch16-4
  686. dd LBPatch17-4
  687. dd LBPatch18-4
  688. dd LBPatch19-4
  689. dd LBPatch20-4
  690. dd LBPatch21-4
  691. dd LBPatch22-4
  692. dd LBPatch23-4
  693. dd LBPatch24-4
  694. dd LBPatch25-4
  695. dd LBPatch26-4
  696. dd LBPatch27-4
  697. dd LBPatch28-4
  698. dd LBPatch29-4
  699. dd LBPatch30-4
  700. dd LBPatch31-4
  701. _DATA ENDS
  702. _TEXT SEGMENT
  703. align 4
  704. public _R_Surf8Patch
  705. _R_Surf8Patch:
  706. push ebx
  707. mov eax,ds:dword ptr[_colormap]
  708. mov ebx,offset LPatchTable8
  709. mov ecx,32
  710. LPatchLoop8:
  711. mov edx,ds:dword ptr[ebx]
  712. add ebx,4
  713. mov ds:dword ptr[edx],eax
  714. dec ecx
  715. jnz LPatchLoop8
  716. pop ebx
  717. ret
  718. _TEXT ENDS
  719. END