Source

quake / QW / client / surf16.asm

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
 .386P
 .model FLAT
 externdef _d_zistepu:dword
 externdef _d_pzbuffer:dword
 externdef _d_zistepv:dword
 externdef _d_zrowbytes:dword
 externdef _d_ziorigin:dword
 externdef _r_turb_s:dword
 externdef _r_turb_t:dword
 externdef _r_turb_pdest:dword
 externdef _r_turb_spancount:dword
 externdef _r_turb_turb:dword
 externdef _r_turb_pbase:dword
 externdef _r_turb_sstep:dword
 externdef _r_turb_tstep:dword
 externdef _r_bmodelactive:dword
 externdef _d_sdivzstepu:dword
 externdef _d_tdivzstepu:dword
 externdef _d_sdivzstepv:dword
 externdef _d_tdivzstepv:dword
 externdef _d_sdivzorigin:dword
 externdef _d_tdivzorigin:dword
 externdef _sadjust:dword
 externdef _tadjust:dword
 externdef _bbextents:dword
 externdef _bbextentt:dword
 externdef _cacheblock:dword
 externdef _d_viewbuffer:dword
 externdef _cachewidth:dword
 externdef _d_pzbuffer:dword
 externdef _d_zrowbytes:dword
 externdef _d_zwidth:dword
 externdef _d_scantable:dword
 externdef _r_lightptr:dword
 externdef _r_numvblocks:dword
 externdef _prowdestbase:dword
 externdef _pbasesource:dword
 externdef _r_lightwidth:dword
 externdef _lightright:dword
 externdef _lightrightstep:dword
 externdef _lightdeltastep:dword
 externdef _lightdelta:dword
 externdef _lightright:dword
 externdef _lightdelta:dword
 externdef _sourcetstep:dword
 externdef _surfrowbytes:dword
 externdef _lightrightstep:dword
 externdef _lightdeltastep:dword
 externdef _r_sourcemax:dword
 externdef _r_stepback:dword
 externdef _colormap:dword
 externdef _blocksize:dword
 externdef _sourcesstep:dword
 externdef _lightleft:dword
 externdef _blockdivshift:dword
 externdef _blockdivmask:dword
 externdef _lightleftstep:dword
 externdef _r_origin:dword
 externdef _r_ppn:dword
 externdef _r_pup:dword
 externdef _r_pright:dword
 externdef _ycenter:dword
 externdef _xcenter:dword
 externdef _d_vrectbottom_particle:dword
 externdef _d_vrectright_particle:dword
 externdef _d_vrecty:dword
 externdef _d_vrectx:dword
 externdef _d_pix_shift:dword
 externdef _d_pix_min:dword
 externdef _d_pix_max:dword
 externdef _d_y_aspect_shift:dword
 externdef _screenwidth:dword
 externdef _vright:dword
 externdef _vup:dword
 externdef _vpn:dword
 externdef _BOPS_Error:dword
 externdef _snd_scaletable:dword
 externdef _paintbuffer:dword
 externdef _snd_linear_count:dword
 externdef _snd_p:dword
 externdef _snd_vol:dword
 externdef _snd_out:dword
 externdef _r_leftclipped:dword
 externdef _r_leftenter:dword
 externdef _r_rightclipped:dword
 externdef _r_rightenter:dword
 externdef _modelorg:dword
 externdef _xscale:dword
 externdef _r_refdef:dword
 externdef _yscale:dword
 externdef _r_leftexit:dword
 externdef _r_rightexit:dword
 externdef _r_lastvertvalid:dword
 externdef _cacheoffset:dword
 externdef _newedges:dword
 externdef _removeedges:dword
 externdef _r_pedge:dword
 externdef _r_framecount:dword
 externdef _r_u1:dword
 externdef _r_emitted:dword
 externdef _edge_p:dword
 externdef _surface_p:dword
 externdef _surfaces:dword
 externdef _r_lzi1:dword
 externdef _r_v1:dword
 externdef _r_ceilv1:dword
 externdef _r_nearzi:dword
 externdef _r_nearzionly:dword
 externdef _edge_aftertail:dword
 externdef _edge_tail:dword
 externdef _current_iv:dword
 externdef _edge_head_u_shift20:dword
 externdef _span_p:dword
 externdef _edge_head:dword
 externdef _fv:dword
 externdef _edge_tail_u_shift20:dword
 externdef _r_apverts:dword
 externdef _r_anumverts:dword
 externdef _aliastransform:dword
 externdef _r_avertexnormals:dword
 externdef _r_plightvec:dword
 externdef _r_ambientlight:dword
 externdef _r_shadelight:dword
 externdef _aliasxcenter:dword
 externdef _aliasycenter:dword
 externdef _a_sstepxfrac:dword
 externdef _r_affinetridesc:dword
 externdef _acolormap:dword
 externdef _d_pcolormap:dword
 externdef _r_affinetridesc:dword
 externdef _d_sfrac:dword
 externdef _d_ptex:dword
 externdef _d_pedgespanpackage:dword
 externdef _d_tfrac:dword
 externdef _d_light:dword
 externdef _d_zi:dword
 externdef _d_pdest:dword
 externdef _d_pz:dword
 externdef _d_aspancount:dword
 externdef _erroradjustup:dword
 externdef _errorterm:dword
 externdef _d_xdenom:dword
 externdef _r_p0:dword
 externdef _r_p1:dword
 externdef _r_p2:dword
 externdef _a_tstepxfrac:dword
 externdef _r_sstepx:dword
 externdef _r_tstepx:dword
 externdef _a_ststepxwhole:dword
 externdef _zspantable:dword
 externdef _skintable:dword
 externdef _r_zistepx:dword
 externdef _erroradjustdown:dword
 externdef _d_countextrastep:dword
 externdef _ubasestep:dword
 externdef _a_ststepxwhole:dword
 externdef _a_tstepxfrac:dword
 externdef _r_lstepx:dword
 externdef _a_spans:dword
 externdef _erroradjustdown:dword
 externdef _d_pdestextrastep:dword
 externdef _d_pzextrastep:dword
 externdef _d_sfracextrastep:dword
 externdef _d_ptexextrastep:dword
 externdef _d_countextrastep:dword
 externdef _d_tfracextrastep:dword
 externdef _d_lightextrastep:dword
 externdef _d_ziextrastep:dword
 externdef _d_pdestbasestep:dword
 externdef _d_pzbasestep:dword
 externdef _d_sfracbasestep:dword
 externdef _d_ptexbasestep:dword
 externdef _ubasestep:dword
 externdef _d_tfracbasestep:dword
 externdef _d_lightbasestep:dword
 externdef _d_zibasestep:dword
 externdef _zspantable:dword
 externdef _r_lstepy:dword
 externdef _r_sstepy:dword
 externdef _r_tstepy:dword
 externdef _r_zistepy:dword
 externdef _D_PolysetSetEdgeTable:dword
 externdef _D_RasterizeAliasPolySmooth:dword
 externdef float_point5:dword
 externdef Float2ToThe31nd:dword
 externdef izistep:dword
 externdef izi:dword
 externdef FloatMinus2ToThe31nd:dword
 externdef float_1:dword
 externdef float_particle_z_clip:dword
 externdef float_minus_1:dword
 externdef float_0:dword
 externdef fp_16:dword
 externdef fp_64k:dword
 externdef fp_1m:dword
 externdef fp_1m_minus_1:dword
 externdef fp_8:dword
 externdef entryvec_table:dword
 externdef advancetable:dword
 externdef sstep:dword
 externdef tstep:dword
 externdef pspantemp:dword
 externdef counttemp:dword
 externdef jumptemp:dword
 externdef reciprocal_table:dword
 externdef DP_Count:dword
 externdef DP_u:dword
 externdef DP_v:dword
 externdef DP_32768:dword
 externdef DP_Color:dword
 externdef DP_Pix:dword
 externdef DP_EntryTable:dword
 externdef pbase:dword
 externdef s:dword
 externdef t:dword
 externdef sfracf:dword
 externdef tfracf:dword
 externdef snext:dword
 externdef tnext:dword
 externdef spancountminus1:dword
 externdef zi16stepu:dword
 externdef sdivz16stepu:dword
 externdef tdivz16stepu:dword
 externdef zi8stepu:dword
 externdef sdivz8stepu:dword
 externdef tdivz8stepu:dword
 externdef reciprocal_table_16:dword
 externdef entryvec_table_16:dword
 externdef ceil_cw:dword
 externdef single_cw:dword
 externdef fp_64kx64k:dword
 externdef pz:dword
 externdef spr8entryvec_table:dword
_DATA SEGMENT
k dd 0
loopentry dd 0
 align 4
blockjumptable16:
 dd LEnter2_16
 dd LEnter4_16
 dd 0, LEnter8_16
 dd 0, 0, 0, LEnter16_16
_DATA ENDS
_TEXT SEGMENT
 align 4
 public _R_Surf16Start
_R_Surf16Start:
 align 4
 public _R_DrawSurfaceBlock16
_R_DrawSurfaceBlock16:
 push ebp
 push edi
 push esi
 push ebx
 mov eax,ds:dword ptr[_blocksize]
 mov edi,ds:dword ptr[_prowdestbase]
 mov esi,ds:dword ptr[_pbasesource]
 mov ebx,ds:dword ptr[_sourcesstep]
 mov ecx,ds:dword ptr[blockjumptable16-4+eax*2]
 mov ds:dword ptr[k],eax
 mov ds:dword ptr[loopentry],ecx
 mov edx,ds:dword ptr[_lightleft]
 mov ebp,ds:dword ptr[_lightright]
Lblockloop16:
 sub ebp,edx
 mov cl,ds:byte ptr[_blockdivshift]
 sar ebp,cl
 jns Lp1_16
 test ebp,ds:dword ptr[_blockdivmask]
 jz Lp1_16
 inc ebp
Lp1_16:
 sub eax,eax
 sub ecx,ecx
 jmp dword ptr[loopentry]
 align 4
LEnter16_16:
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch0:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch1:
 mov ds:word ptr[2+edi],cx
 add edi,04h
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch2:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch3:
 mov ds:word ptr[2+edi],cx
 add edi,04h
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch4:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch5:
 mov ds:word ptr[2+edi],cx
 add edi,04h
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch6:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch7:
 mov ds:word ptr[2+edi],cx
 add edi,04h
LEnter8_16:
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch8:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch9:
 mov ds:word ptr[2+edi],cx
 add edi,04h
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch10:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch11:
 mov ds:word ptr[2+edi],cx
 add edi,04h
LEnter4_16:
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch12:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch13:
 mov ds:word ptr[2+edi],cx
 add edi,04h
LEnter2_16:
 mov al,ds:byte ptr[esi]
 mov cl,ds:byte ptr[esi+ebx]
 mov ah,dh
 add edx,ebp
 mov ch,dh
 lea esi,ds:dword ptr[esi+ebx*2]
 mov ax,ds:word ptr[12345678h+eax*2]
LBPatch14:
 add edx,ebp
 mov ds:word ptr[edi],ax
 mov cx,ds:word ptr[12345678h+ecx*2]
LBPatch15:
 mov ds:word ptr[2+edi],cx
 add edi,04h
 mov esi,ds:dword ptr[_pbasesource]
 mov edx,ds:dword ptr[_lightleft]
 mov ebp,ds:dword ptr[_lightright]
 mov eax,ds:dword ptr[_sourcetstep]
 mov ecx,ds:dword ptr[_lightrightstep]
 mov edi,ds:dword ptr[_prowdestbase]
 add esi,eax
 add ebp,ecx
 mov eax,ds:dword ptr[_lightleftstep]
 mov ecx,ds:dword ptr[_surfrowbytes]
 add edx,eax
 add edi,ecx
 mov ds:dword ptr[_pbasesource],esi
 mov ds:dword ptr[_lightright],ebp
 mov eax,ds:dword ptr[k]
 mov ds:dword ptr[_lightleft],edx
 dec eax
 mov ds:dword ptr[_prowdestbase],edi
 mov ds:dword ptr[k],eax
 jnz Lblockloop16
 pop ebx
 pop esi
 pop edi
 pop ebp
 ret
 public _R_Surf16End
_R_Surf16End:
_TEXT ENDS
_DATA SEGMENT
 align 4
LPatchTable16:
 dd LBPatch0-4
 dd LBPatch1-4
 dd LBPatch2-4
 dd LBPatch3-4
 dd LBPatch4-4
 dd LBPatch5-4
 dd LBPatch6-4
 dd LBPatch7-4
 dd LBPatch8-4
 dd LBPatch9-4
 dd LBPatch10-4
 dd LBPatch11-4
 dd LBPatch12-4
 dd LBPatch13-4
 dd LBPatch14-4
 dd LBPatch15-4
_DATA ENDS
_TEXT SEGMENT
 align 4
 public _R_Surf16Patch
_R_Surf16Patch:
 push ebx
 mov eax,ds:dword ptr[_colormap]
 mov ebx,offset LPatchTable16
 mov ecx,16
LPatchLoop16:
 mov edx,ds:dword ptr[ebx]
 add ebx,4
 mov ds:dword ptr[edx],eax
 dec ecx
 jnz LPatchLoop16
 pop ebx
 ret
_TEXT ENDS
 END
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.