1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "software/r1_software_globals.hh"
|
---|
10 |
|
---|
11 | void texture_scanline_affine_unlit_alpha_sprite(w16 *start_pixel,
|
---|
12 | sw32 start_x,
|
---|
13 | void *left, //actually affine_span *left
|
---|
14 | sw32 width)
|
---|
15 | {
|
---|
16 | _asm
|
---|
17 | {
|
---|
18 | mov ebx,dword ptr [width]
|
---|
19 | mov edi,dword ptr [left]
|
---|
20 |
|
---|
21 | mov eax,dword ptr [dsdx_frac]
|
---|
22 | mov esi,dword ptr [r1_software_texture_ptr] //esi has texture base ptr
|
---|
23 |
|
---|
24 | mov dword ptr [s_frac_add_patch+2],eax
|
---|
25 | mov ecx,dword ptr [edi]affine_span.s //get s in ecx
|
---|
26 |
|
---|
27 | shr esi,1 //get half the texture pointer
|
---|
28 | mov eax,dword ptr [edi]affine_span.t
|
---|
29 |
|
---|
30 | sar eax,16 //get integral start t
|
---|
31 | mov edx,dword ptr [edi]affine_span.s //get s in edx
|
---|
32 |
|
---|
33 | sar ecx,16 //get integral part of s
|
---|
34 | mov edi,dword ptr [start_pixel]
|
---|
35 |
|
---|
36 | sal edx,16 //shift left to get fractional part of s
|
---|
37 | add esi,ecx //setup starting texture ptr (add integral start s to esi)
|
---|
38 |
|
---|
39 | add edi,dword ptr [start_x]
|
---|
40 | mov cl,byte ptr [r1_software_twidth_log2]
|
---|
41 |
|
---|
42 | shl eax,cl
|
---|
43 |
|
---|
44 | push ebp
|
---|
45 | add esi,eax
|
---|
46 |
|
---|
47 | mov ch,16 //initial alpha accumulator value is 16 (since max alpha 15 should draw the pixel)
|
---|
48 | mov ebp,dword ptr [4+s_t_carry]
|
---|
49 |
|
---|
50 | ALIGN 16
|
---|
51 | loopcount:
|
---|
52 | mov ax,word ptr [esi*2]
|
---|
53 | s_frac_add_patch:
|
---|
54 | add edx,0xDDDDDDDD
|
---|
55 |
|
---|
56 | adc esi,ebp
|
---|
57 | and ch,240
|
---|
58 |
|
---|
59 | mov cl,ah
|
---|
60 | and eax,4095
|
---|
61 |
|
---|
62 | add edi,2
|
---|
63 | add ch,cl
|
---|
64 |
|
---|
65 | jnc skip_pixel
|
---|
66 | mov ax,word ptr [alpha_table+eax*2]
|
---|
67 |
|
---|
68 | mov word ptr [edi-2],ax
|
---|
69 | add ch,16
|
---|
70 |
|
---|
71 | skip_pixel:
|
---|
72 |
|
---|
73 | dec ebx
|
---|
74 | jnz loopcount
|
---|
75 |
|
---|
76 | pop ebp
|
---|
77 | }
|
---|
78 | }
|
---|