Rev 8048 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1245 | hidnplayr | 1 | |
8232 | leency | 2 | ; with a few graphics effects demonstration. |
8014 | leency | 3 | ; compiler : FASM |
1819 | yogev_ezra | 4 | ; system : KolibriOS |
5 | ; author : Macgub aka Maciej Guba |
||
1245 | hidnplayr | 6 | ; email : macgub3@wp.pl |
7 | ; web : http://macgub.vxm.pl |
||
8047 | leency | 8 | ; Fell free to use this intro in your own distribution of KolibriOS. |
6619 | leency | 9 | ; Special greetings to KolibriOS team . |
10 | ; I hope because my demos Christian Belive will be near to each of You. |
||
6769 | IgorA | 11 | |
1245 | hidnplayr | 12 | |
13 | |||
14 | ; madis.kalme@mail.ee |
||
15 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
||
16 | ; can be: |
||
17 | ; 1) Read from a file (*.3DS standard) |
||
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
||
8232 | leency | 19 | |
1245 | hidnplayr | 20 | |
6619 | leency | 21 | |
1245 | hidnplayr | 22 | SIZE_Y equ 512 ; ///// I want definitely |
8014 | leency | 23 | TIMEOUT equ 10 ; ------ say: |
24 | ROUND equ 10 ; \ @ @/ keep smiling every |
||
25 | TEX_X equ 512 ; texture width ; \ ./ / day. |
||
26 | TEX_Y equ 512 ; height ; \/ / |
||
27 | TEX_SHIFT equ 9 ; texture width shifting ; __||__ / |
||
28 | TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 ; /| | |
||
29 | TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} ; / \ / |
||
30 | FLUENTLY = 0 ; / | | |
||
31 | SHIFTING = 1 ; ------ |
||
32 | CATMULL_SHIFT equ 8 ; | | |
||
33 | LIGHT_SIZE equ 22 ; | | |
||
34 | NON = 0 ; -/ \- |
||
35 | MMX = 1 |
||
1245 | hidnplayr | 36 | SSE = 2 |
37 | SSE2 = 3 |
||
1979 | yogev_ezra | 38 | SSE3 = 4 |
8047 | leency | 39 | Ext = SSE3 ;Ext={ NON | MMX | SSE | SSE2 | SSE3 } |
8232 | leency | 40 | |
1245 | hidnplayr | 41 | |
42 | USE_LFN = 1 ; App is Kolibri only now. |
||
8232 | leency | 43 | |
1245 | hidnplayr | 44 | |
45 | org 0x0 |
||
8014 | leency | 46 | db 'MENUET01' ; 8 byte id |
47 | dd 0x01 ; header version |
||
48 | dd START ; start of code |
||
49 | dd I_END ; size of image |
||
50 | dd MEM_END ; memory for app |
||
51 | dd MEM_END ; esp |
||
52 | dd I_Param ; I_Param |
||
53 | dd 0x0 ; I_Icon |
||
54 | |||
1245 | hidnplayr | 55 | |
8014 | leency | 56 | cld |
57 | mov eax, 500 shl 16 + 600 ; ... or set manually |
||
58 | mov [size_y_var],ax |
||
59 | shr ax,1 |
||
60 | mov [vect_y],ax |
||
61 | |||
6619 | leency | 62 | |
6648 | leency | 63 | |
8014 | leency | 64 | movzx ebx,ax |
65 | movzx ebx,ax |
||
8232 | leency | 66 | lea ebx,[ebx*3] |
8014 | leency | 67 | push ebx |
68 | fninit |
||
69 | fild dword[esp] |
||
70 | fstp [rsscale] |
||
71 | pop ebx |
||
72 | |||
6619 | leency | 73 | |
8014 | leency | 74 | mov [size_x_var],ax |
75 | shr ax,1 |
||
76 | mov [vect_x],ax |
||
77 | |||
6619 | leency | 78 | |
8232 | leency | 79 | mov [x_start],dword 20 shl 16 + 20 ;eax |
80 | |||
6619 | leency | 81 | |
6648 | leency | 82 | |
8014 | leency | 83 | call read_param |
84 | call read_from_disk ; read, if all is ok eax = 0 |
||
85 | cmp eax,0 |
||
86 | jne .gen |
||
87 | mov esi,[fptr] |
||
88 | cmp [esi],word 4D4Dh |
||
89 | jne .asc |
||
90 | call read_tp_variables ; init points and triangles count variables |
||
91 | cmp eax,0 |
||
92 | je .gen |
||
93 | jmp .malloc |
||
94 | .gen: |
||
1245 | hidnplayr | 95 | call generate_object |
8014 | leency | 96 | jmp .opt |
97 | .asc: |
||
5486 | leency | 98 | mov [triangles_count_var],10000 ; to do: read asc header |
8047 | leency | 99 | mov [points_count_var],10000 |
8014 | leency | 100 | call alloc_mem_for_tp |
101 | call read_asc |
||
102 | jmp .opt |
||
103 | .malloc: |
||
1245 | hidnplayr | 104 | if USE_LFN |
105 | call alloc_mem_for_tp |
||
8014 | leency | 106 | end if |
1245 | hidnplayr | 107 | call read_from_file |
8014 | leency | 108 | .opt: |
1245 | hidnplayr | 109 | |
6648 | leency | 110 | |
111 | |||
112 | |||
8014 | leency | 113 | ; set point(0,0,0) in center and calc all coords |
114 | ; to be in <-1.0,1.0> |
||
115 | call normalize_all_light_vectors |
||
116 | if Ext >= SSE3 |
||
8047 | leency | 117 | call copy_lights ; to aligned float |
118 | end if |
||
119 | call init_triangles_normals2 |
||
120 | call init_point_normals |
||
8014 | leency | 121 | call init_envmap2 |
122 | call init_envmap_cub |
||
123 | call generate_texture2 |
||
124 | call init_sincos_tab |
||
125 | call do_color_buffer ; intit color_map |
||
126 | mov edi,bumpmap |
||
127 | call calc_bumpmap |
||
128 | call calc_bumpmap_coords ; bump and texture mapping |
||
129 | call draw_window |
||
130 | ;mov [draw_win_at_first],0 |
||
8025 | leency | 131 | ;mov eax,40 ; set events mask |
132 | ;mov ebx,1100000000000000000000000100111b |
||
133 | ;int 0x40 |
||
134 | |||
8232 | leency | 135 | |
136 | |||
1245 | hidnplayr | 137 | cmp [edit_flag],1 |
8014 | leency | 138 | jne @f |
139 | mov eax,40 ; set events mask |
||
140 | mov ebx,1100000000000000000000000100111b |
||
141 | jmp .int |
||
142 | @@: |
||
6769 | IgorA | 143 | mov eax,40 ; set events mask |
8014 | leency | 144 | mov ebx,111b |
145 | .int: |
||
6769 | IgorA | 146 | int 0x40 |
8014 | leency | 147 | |
1245 | hidnplayr | 148 | |
8014 | leency | 149 | mov ebx,TIMEOUT |
150 | cmp [speed_flag],0 |
||
151 | je .skip |
||
152 | mov eax,11 |
||
153 | .skip: |
||
6769 | IgorA | 154 | cmp [edit_flag],1 |
8014 | leency | 155 | jne @f |
156 | mov eax,10 |
||
157 | |||
6769 | IgorA | 158 | |
159 | int 0x40 |
||
8014 | leency | 160 | |
1245 | hidnplayr | 161 | |
8025 | leency | 162 | je red |
8014 | leency | 163 | cmp eax,2 ; key event ? |
8025 | leency | 164 | je key |
8014 | leency | 165 | cmp eax,3 ; button event ? |
8025 | leency | 166 | je button |
8014 | leency | 167 | cmp eax,6 ; mouse event ? |
8025 | leency | 168 | jne @f |
8014 | leency | 169 | cmp [edit_flag],1 ; handle mouse only when edit is active |
8025 | leency | 170 | jne @f |
8014 | leency | 171 | |
8025 | leency | 172 | |
8014 | leency | 173 | mov ebx,7 ; get mouse scroll |
8025 | leency | 174 | int 0x40 |
175 | and eax, 0xFFFF ; check only vertial |
||
176 | cmp eax, 65535 |
||
177 | je button.zoom_in |
||
178 | cmp eax, 1 |
||
179 | je button.zoom_out |
||
180 | |||
181 | |||
182 | mov ebx,3 ;read mouse state |
||
8014 | leency | 183 | int 0x40 |
184 | mov [mouse_state],eax |
||
185 | call edit |
||
186 | @@: |
||
6769 | IgorA | 187 | jmp noclose |
8014 | leency | 188 | |
1245 | hidnplayr | 189 | |
6648 | leency | 190 | mov eax,9 ; get process info |
8014 | leency | 191 | mov ebx,procinfo |
192 | mov ecx,-1 |
||
193 | int 0x40 |
||
194 | mov eax,[procinfo+42] ; read params of window |
||
195 | sub eax,115 |
||
196 | mov [size_x_var],ax |
||
197 | shr ax,1 |
||
198 | mov [vect_x],ax |
||
199 | ; |
||
6648 | leency | 200 | mov eax,[procinfo+46] |
8014 | leency | 201 | sub eax,30 |
202 | mov [size_y_var],ax |
||
203 | shr ax,1 |
||
204 | mov [vect_y],ax |
||
205 | |||
6648 | leency | 206 | |
8014 | leency | 207 | mov [x_start],ax |
208 | mov eax,[procinfo+38] |
||
209 | mov [y_start],ax |
||
210 | call alloc_buffer_mem ;realloc mem for scr & z buffs |
||
211 | call draw_window |
||
212 | |||
1245 | hidnplayr | 213 | |
8014 | leency | 214 | |
1245 | hidnplayr | 215 | |
8014 | leency | 216 | mov eax,2 ; just read it and ignore |
217 | int 0x40 |
||
218 | |||
8025 | leency | 219 | |
220 | je button.zoom_in |
||
221 | cmp ah, '=' |
||
222 | je button.zoom_in |
||
223 | cmp ah, '-' |
||
224 | je button.zoom_out |
||
225 | cmp ah, 176 ;left |
||
226 | je add_vec_buttons.x_minus |
||
227 | cmp ah, 179 ;right |
||
228 | je add_vec_buttons.x_plus |
||
229 | cmp ah, 178 ;up |
||
230 | je add_vec_buttons.y_minus |
||
231 | cmp ah, 177 ;down |
||
232 | je add_vec_buttons.y_plus |
||
233 | |||
8047 | leency | 234 | |
8014 | leency | 235 | |
1245 | hidnplayr | 236 | |
8014 | leency | 237 | mov eax,17 ; get id |
238 | int 0x40 |
||
239 | |||
1245 | hidnplayr | 240 | |
8014 | leency | 241 | jne @f |
242 | |||
1245 | hidnplayr | 243 | |
8014 | leency | 244 | int 0x40 |
245 | @@: |
||
1245 | hidnplayr | 246 | cmp ah,30 |
8014 | leency | 247 | jge add_vec_buttons |
248 | call update_flags ; update flags and write labels of flags |
||
249 | |||
1245 | hidnplayr | 250 | |
8014 | leency | 251 | cmp ah,3 ; ah = 3 -> shading model |
252 | jne .next_m6 |
||
253 | cmp [dr_flag],2 |
||
254 | jne @f |
||
255 | ; call init_envmap2 ; <----! this don't works in env mode |
||
256 | ; and more than ~18 kb objects |
||
257 | ; call init_envmap_cub2 |
||
258 | @@: |
||
1245 | hidnplayr | 259 | cmp [dr_flag],4 |
8014 | leency | 260 | jne @f |
261 | call generate_texture2 |
||
262 | |||
1245 | hidnplayr | 263 | |
264 | .next_m6: |
||
265 | ; ah = 5 -> scale- |
||
8014 | leency | 266 | cmp ah,5 |
267 | jne @f |
||
268 | .zoom_out: |
||
8047 | leency | 269 | mov dword[scale],0.7 |
8014 | leency | 270 | fninit |
271 | fld [rsscale] |
||
272 | fmul [scale] |
||
273 | fstp [rsscale] |
||
274 | |||
1245 | hidnplayr | 275 | |
276 | cmp ah,6 ; ah = 6 -> scale+ |
||
8014 | leency | 277 | jne @f |
278 | .zoom_in: |
||
8047 | leency | 279 | mov dword[scale],1.3 |
8014 | leency | 280 | fninit |
281 | fld [rsscale] |
||
282 | fmul [scale] |
||
283 | fstp [rsscale] |
||
284 | |||
1245 | hidnplayr | 285 | |
286 | cmp ah,9 ; lights random ; 'flat' 0 |
||
8014 | leency | 287 | jne .next_m5 ; 'grd ' 1 |
288 | call make_random_lights ; 'env ' 2 |
||
289 | call normalize_all_light_vectors ; 'bump' 3 |
||
290 | if Ext >= SSE3 |
||
8047 | leency | 291 | call copy_lights |
292 | end if |
||
293 | call do_color_buffer ; intit color_map ; 'tex ' 4 |
||
8014 | leency | 294 | ; cmp [emboss_flag],1 ; 'pos ' 5 |
295 | ; je @f ; 'dots' 6 |
||
296 | ; cmp [dr_flag],8 |
||
297 | ; jge @f |
||
298 | ; cmp [dr_flag],2 ; 'txgr' 7 |
||
299 | ; jl .next_m5 ; '2tex' 8 |
||
300 | ; cmp [dr_flag],3 ; 'btex' 9 |
||
301 | ; jg .next_m5 |
||
302 | ; @@: |
||
1931 | yogev_ezra | 303 | call init_envmap2 ; update env map if shading model = environment or bump |
8014 | leency | 304 | .next_m5: |
1245 | hidnplayr | 305 | cmp ah,11 |
8014 | leency | 306 | je @f |
307 | cmp ah,12 |
||
308 | je @f |
||
309 | cmp ah,13 |
||
310 | jne .next_m4 |
||
311 | @@: |
||
1245 | hidnplayr | 312 | call mirror |
8014 | leency | 313 | .next_m4: |
1245 | hidnplayr | 314 | cmp ah,14 |
8014 | leency | 315 | jne @f |
316 | call exchange |
||
317 | @@: |
||
1245 | hidnplayr | 318 | cmp ah,15 |
8014 | leency | 319 | jne @f |
320 | cmp [emboss_flag],1 |
||
321 | ; call init_envmap2 |
||
8232 | leency | 322 | call do_emboss |
323 | @@: |
||
1245 | hidnplayr | 324 | ; cmp ah,17 |
8014 | leency | 325 | ; jne .next_m |
326 | ; cmp [move_flag],2 |
||
327 | ; jne @f |
||
328 | ; call draw_window ; redraw other labels to navigation buttons |
||
329 | ; @@: |
||
1245 | hidnplayr | 330 | ; cmp [move_flag],0 |
8014 | leency | 331 | ; jne .next_m |
332 | ; call draw_window ; redraw other labels to navigation buttons |
||
333 | .next_m: |
||
1245 | hidnplayr | 334 | cmp ah,18 |
8014 | leency | 335 | jne .next_m2 |
336 | |||
8047 | leency | 337 | |
8014 | leency | 338 | mov [triangles_count_var],20000 |
8232 | leency | 339 | mov [points_count_var],20000 |
340 | call alloc_mem_for_tp |
||
8014 | leency | 341 | mov [re_alloc_flag],0 |
342 | |||
8047 | leency | 343 | |
8014 | leency | 344 | ; or bl,bl |
345 | ; jz .next_m2 |
||
346 | cmp bl,1 |
||
347 | jne @f |
||
348 | call generate_object |
||
349 | jmp .calc_norm |
||
350 | @@: |
||
1245 | hidnplayr | 351 | cmp bl,4 |
8014 | leency | 352 | jg @f |
353 | movzx eax,bl ; eax < - object number |
||
8232 | leency | 354 | call generate_object2 |
8014 | leency | 355 | jmp .calc_norm |
356 | @@: |
||
1245 | hidnplayr | 357 | call generate_object3 |
8014 | leency | 358 | .calc_norm: |
1245 | hidnplayr | 359 | call optimize_object1 |
8014 | leency | 360 | call init_triangles_normals2 |
361 | call init_point_normals |
||
362 | call calc_bumpmap_coords ; bump and texture mapping |
||
363 | |||
1245 | hidnplayr | 364 | |
365 | cmp ah,19 |
||
8014 | leency | 366 | je @f |
367 | cmp ah,20 |
||
368 | jne .next_m3 |
||
369 | @@: |
||
1245 | hidnplayr | 370 | mov edi,bumpmap |
8014 | leency | 371 | call calc_bumpmap |
372 | .next_m3: |
||
1776 | yogev_ezra | 373 | cmp ah,21 ; re map bumps, texture coordinates |
8014 | leency | 374 | jne @f |
375 | call calc_bumpmap_coords |
||
376 | @@: |
||
1776 | yogev_ezra | 377 | jmp noclose |
8014 | leency | 378 | |
1245 | hidnplayr | 379 | |
380 | |||
8014 | leency | 381 | add_vec_buttons: ; can move: object, camera,.. list is open |
382 | ; |
||
383 | cmp ah,30 |
||
384 | jne .next |
||
385 | cmp [move_flag],0 |
||
386 | jne @f |
||
387 | ; cmp [move_flag],2 |
||
388 | ; je .set_light1 |
||
389 | .y_minus: |
||
8025 | leency | 390 | sub [vect_y],10 |
8014 | leency | 391 | jmp .next |
392 | @@: |
||
1245 | hidnplayr | 393 | cmp [move_flag],1 |
8014 | leency | 394 | jne @f |
395 | sub [yobs],10 ; observator = camera position |
||
396 | jmp .next |
||
397 | @@: |
||
2984 | leency | 398 | sub [sin_amplitude],10 |
8014 | leency | 399 | ;-------------------------------------------------- |
1245 | hidnplayr | 400 | ; .set_light1: ; r - |
8014 | leency | 401 | ; movzx ebx,[light_no_flag] ; * 22 |
402 | ; mov ecx,ebx |
||
403 | ; shl ebx,4 |
||
404 | ; shl ecx,1 |
||
405 | ; add ebx,ecx |
||
406 | ; shl ecx,1 |
||
407 | ; add ebx,ecx |
||
408 | ; add ebx,lights+6 ; 6 -> light vector size |
||
409 | ; |
||
1245 | hidnplayr | 410 | ; movzx ecx,[light_comp_flag] |
8014 | leency | 411 | ; lea ecx,[ecx*3} |
412 | ; add ebx,ecx ; ebx -> color to set |
||
413 | |||
1245 | hidnplayr | 414 | |
415 | .next: |
||
416 | cmp ah,31 |
||
8014 | leency | 417 | jne .next1 |
418 | cmp [move_flag],1 |
||
419 | je @f |
||
420 | add [vect_z],10 |
||
421 | jmp .next1 |
||
422 | @@: |
||
1245 | hidnplayr | 423 | add [zobs],10 ; observator = camera position |
8014 | leency | 424 | .next1: |
1245 | hidnplayr | 425 | cmp ah,33 |
8014 | leency | 426 | jne .next2 |
427 | cmp [move_flag],0 |
||
428 | jne @f |
||
429 | .x_minus: |
||
8025 | leency | 430 | sub [vect_x],10 |
8014 | leency | 431 | jmp .next2 |
432 | @@: |
||
1245 | hidnplayr | 433 | cmp [move_flag],1 |
8014 | leency | 434 | jne @f |
435 | sub [xobs],10 ; observator = camera position |
||
436 | jmp .next2 |
||
437 | @@: |
||
2984 | leency | 438 | fninit |
8014 | leency | 439 | fld [sin_frq] |
440 | fsub [sin_delta] |
||
441 | fstp [sin_frq] |
||
442 | .next2: |
||
1245 | hidnplayr | 443 | cmp ah,32 |
8014 | leency | 444 | jne .next3 |
445 | cmp [move_flag],0 |
||
446 | jne @f |
||
447 | .x_plus: |
||
8025 | leency | 448 | add [vect_x],10 |
8014 | leency | 449 | jmp .next3 |
450 | @@: |
||
1245 | hidnplayr | 451 | cmp [move_flag],1 |
8014 | leency | 452 | jne @f |
453 | add [xobs],10 ; observator = camera position |
||
454 | jmp .next3 |
||
455 | @@: |
||
2984 | leency | 456 | fninit |
8014 | leency | 457 | fld [sin_frq] ; change wave effect frequency |
458 | fadd [sin_delta] |
||
459 | fstp [sin_frq] |
||
460 | .next3: |
||
1245 | hidnplayr | 461 | cmp ah,34 |
8014 | leency | 462 | jne .next4 |
463 | cmp [move_flag],1 |
||
464 | je @f |
||
465 | |||
1245 | hidnplayr | 466 | |
8014 | leency | 467 | jmp .next4 |
468 | @@: |
||
1245 | hidnplayr | 469 | sub [zobs],10 ; observator = camera position |
8014 | leency | 470 | .next4: |
1245 | hidnplayr | 471 | cmp ah,35 |
8014 | leency | 472 | jne .next5 |
473 | cmp [move_flag],0 |
||
474 | jne @f |
||
475 | ; call add_vector |
||
476 | .y_plus: |
||
8047 | leency | 477 | add [vect_y],10 |
8014 | leency | 478 | jmp .next5 |
479 | @@: |
||
1245 | hidnplayr | 480 | cmp [move_flag],1 |
8014 | leency | 481 | jne @f |
482 | add [yobs],10 ; observator = camera position |
||
483 | jmp .next5 |
||
484 | @@: |
||
2984 | leency | 485 | add [sin_amplitude],10 |
8014 | leency | 486 | .next5: |
1245 | hidnplayr | 487 | |
488 | |||
489 | |||
490 | |||
491 | |||
492 | |||
8014 | leency | 493 | jz .end_rot |
494 | cmp [r_flag],2 |
||
495 | jne .no_x |
||
496 | inc [angle_x] |
||
497 | and [angle_x],0xff |
||
498 | mov [angle_z],0 |
||
499 | jmp .end_rot |
||
500 | |||
1245 | hidnplayr | 501 | |
502 | cmp [r_flag],0 |
||
8014 | leency | 503 | jne .no_y |
504 | inc [angle_y] |
||
505 | and [angle_y],0xff |
||
506 | mov [angle_z],0 |
||
507 | jmp .end_rot |
||
508 | |||
1245 | hidnplayr | 509 | |
510 | cmp [r_flag],1 |
||
8014 | leency | 511 | jne .end_rot |
512 | mov cx,[angle_x] |
||
513 | inc cx |
||
514 | and cx,0xff |
||
515 | mov [angle_z],0 |
||
516 | mov [angle_y],cx |
||
517 | mov [angle_x],cx |
||
518 | .end_rot: |
||
1245 | hidnplayr | 519 | |
520 | |||
8014 | leency | 521 | mov edi,matrix |
522 | call make_rotation_matrix |
||
523 | RDTSC |
||
1931 | yogev_ezra | 524 | push eax |
525 | mov esi,[points_normals_ptr] |
||
8014 | leency | 526 | mov edi,[points_normals_rot_ptr] |
527 | mov ebx,matrix |
||
528 | mov ecx,[points_count_var] |
||
529 | call rotary |
||
530 | |||
1245 | hidnplayr | 531 | |
8014 | leency | 532 | call add_scale_to_matrix |
533 | |||
1245 | hidnplayr | 534 | |
8014 | leency | 535 | mov edi,[points_rotated_ptr] |
536 | mov ebx,matrix |
||
537 | mov ecx,[points_count_var] |
||
538 | call rotary |
||
539 | |||
1245 | hidnplayr | 540 | |
541 | |||
8014 | leency | 542 | mov edi,[points_translated_ptr] |
543 | mov ecx,[points_count_var] |
||
544 | call translate_points |
||
545 | |||
1245 | hidnplayr | 546 | |
8014 | leency | 547 | jne @f |
548 | call clrscr ; clear the screen |
||
549 | @@: |
||
1245 | hidnplayr | 550 | ; cmp [catmull_flag],1 ;non sort if Catmull = on |
8014 | leency | 551 | ; je .no_sort |
552 | ; 64 indexes call sort_triangles |
||
553 | .no_sort: |
||
1245 | hidnplayr | 554 | cmp [dr_flag],7 ; fill if 2tex and texgrd |
8014 | leency | 555 | jge @f |
556 | cmp [catmull_flag],0 ;non fill if Catmull = off |
||
557 | je .non_f |
||
558 | cmp [dr_flag],6 ; non fill if dots |
||
559 | je .non_f |
||
560 | @@: |
||
1245 | hidnplayr | 561 | call fill_Z_buffer ; make background |
8014 | leency | 562 | .non_f: |
1245 | hidnplayr | 563 | cmp [dr_flag],6 |
8014 | leency | 564 | jne @f |
565 | call draw_dots |
||
566 | jmp .blurrr |
||
567 | @@: |
||
1245 | hidnplayr | 568 | call draw_triangles ; draw all triangles from the list |
8014 | leency | 569 | cmp [edit_flag],0 |
570 | jz .no_edit |
||
571 | call clear_vertices_index |
||
572 | call draw_handlers |
||
573 | ; call edit |
||
574 | |||
6769 | IgorA | 575 | |
576 | |||
577 | |||
578 | |||
579 | |||
580 | |||
581 | |||
582 | |||
1245 | hidnplayr | 583 | cmp [sinus_flag],0 |
8014 | leency | 584 | je @f |
585 | call do_sinus |
||
586 | @@: |
||
2984 | leency | 587 | cmp [fire_flag],0 |
8014 | leency | 588 | jne @f |
589 | cmp [blur_flag],0 |
||
590 | je .no_blur ; no blur, no fire |
||
591 | movzx ecx,[blur_flag] |
||
592 | call blur_screen ; blur and fire |
||
593 | jmp .no_blur |
||
594 | @@: |
||
1245 | hidnplayr | 595 | cmp [emboss_flag],0 |
8014 | leency | 596 | jne .emb ; if emboss=true -> no fire |
597 | movzx ecx,[fire_flag] |
||
598 | call blur_screen ; blur and fire |
||
599 | .no_blur: ; no blur, no fire |
||
600 | cmp [emboss_flag],0 |
||
601 | je @f |
||
602 | .emb: |
||
1245 | hidnplayr | 603 | call do_emboss |
8014 | leency | 604 | |
1245 | hidnplayr | 605 | |
606 | |||
607 | |||
608 | |||
8014 | leency | 609 | je .no_inc_bright |
610 | movzx ebx,[inc_bright_flag] |
||
2736 | leency | 611 | shl ebx,4 |
612 | mov esi,[screen_ptr] |
||
6619 | leency | 613 | movzx ecx,word[size_y_var] |
614 | movzx eax,word[size_x_var] |
||
615 | mul ecx |
||
616 | lea ecx,[eax*4] |
||
8232 | leency | 617 | |
618 | |||
2736 | leency | 619 | mov bh,bl |
620 | push bx |
||
621 | shl ebx,16 |
||
622 | pop bx |
||
623 | push ebx |
||
624 | push ebx |
||
625 | movq mm0,[esp] |
||
626 | add esp,8 |
||
627 | else if Ext >= SSE2 |
||
628 | mov bh,bl |
||
629 | push bx |
||
630 | shl ebx,16 |
||
631 | pop bx |
||
632 | movd xmm0,ebx |
||
633 | shufps xmm0,xmm0,0 |
||
634 | end if |
||
635 | .oop: |
||
636 | if Ext=NON |
||
637 | lodsb |
||
638 | add al,bl |
||
639 | jnc @f |
||
640 | mov byte[esi-1],255 |
||
641 | loop .oop |
||
642 | @@: |
||
643 | mov [esi-1],al |
||
644 | loop .oop |
||
645 | else if (Ext=MMX)|(Ext=SSE) |
||
646 | movq mm1,[esi] |
||
647 | movq mm2,[esi+8] |
||
648 | paddusb mm1,mm0 |
||
649 | paddusb mm2,mm0 |
||
650 | movq [esi],mm1 |
||
651 | movq [esi+8],mm2 |
||
652 | add esi,16 |
||
653 | sub ecx,16 |
||
654 | jnz .oop |
||
655 | else |
||
656 | movaps xmm1,[esi] |
||
657 | paddusb xmm1,xmm0 |
||
658 | movaps [esi],xmm1 |
||
659 | add esi,16 |
||
660 | sub ecx,16 |
||
661 | jnc .oop |
||
6619 | leency | 662 | end if |
2736 | leency | 663 | |
664 | |||
665 | |||
666 | |||
667 | |||
668 | je .no_dec_bright |
||
8014 | leency | 669 | movzx ebx,[dec_bright_flag] |
2736 | leency | 670 | shl ebx,4 |
671 | mov esi,[screen_ptr] |
||
6619 | leency | 672 | movzx eax,word[size_x_var] |
673 | movzx ecx,word[size_y_var] |
||
674 | mul ecx |
||
675 | lea ecx,[eax*4] |
||
8232 | leency | 676 | if (Ext = MMX)|(Ext = SSE) |
6619 | leency | 677 | mov bh,bl |
2736 | leency | 678 | push bx |
679 | shl ebx,16 |
||
680 | pop bx |
||
681 | push ebx |
||
682 | push ebx |
||
683 | movq mm0,[esp] |
||
684 | add esp,8 |
||
685 | else if Ext >=SSE2 |
||
686 | mov bh,bl |
||
687 | push bx |
||
688 | shl ebx,16 |
||
689 | pop bx |
||
690 | movd xmm0,ebx |
||
691 | shufps xmm0,xmm0,0 |
||
692 | end if |
||
693 | .oop1: |
||
694 | if Ext=NON |
||
695 | lodsb |
||
696 | sub al,bl |
||
697 | jb @f |
||
8014 | leency | 698 | mov [esi-1],al |
2736 | leency | 699 | loop .oop1 |
700 | @@: |
||
701 | mov byte[esi-1],0 |
||
702 | loop .oop1 |
||
703 | else if (Ext = MMX)|(Ext=SSE) |
||
704 | movq mm1,[esi] |
||
705 | psubusb mm1,mm0 |
||
706 | movq [esi],mm1 |
||
707 | add esi,8 |
||
708 | sub ecx,8 |
||
709 | jnz .oop1 |
||
710 | else |
||
711 | movaps xmm1,[esi] |
||
712 | psubusb xmm1,xmm0 |
||
713 | movaps [esi],xmm1 |
||
714 | add esi,16 |
||
715 | sub ecx,16 |
||
716 | jnc .oop1 |
||
6619 | leency | 717 | end if |
2736 | leency | 718 | .no_dec_bright: |
719 | |||
720 | |||
721 | |||
1245 | hidnplayr | 722 | sub eax,[esp] |
723 | sub eax,41 |
||
724 | ; pop eax |
||
725 | |||
726 | |||
727 | .dc: |
||
728 | xor edx,edx |
||
729 | mov edi,10 |
||
730 | div edi |
||
731 | add dl,30h |
||
732 | mov [STRdata+ecx-1],dl |
||
733 | loop .dc |
||
734 | pop eax |
||
735 | |||
736 | |||
8047 | leency | 737 | |
8014 | leency | 738 | mov ebx,[screen_ptr] |
6648 | leency | 739 | mov ecx,[size_y_var] |
6619 | leency | 740 | ; mov ecx,SIZE_X shl 16 + SIZE_Y |
741 | mov edx,[offset_y] ;5 shl 16 + 25 |
||
6769 | IgorA | 742 | cmp [dr_flag],12 |
8047 | leency | 743 | jge .ff |
8232 | leency | 744 | int 0x40 |
1245 | hidnplayr | 745 | jmp .f |
8047 | leency | 746 | .ff: |
747 | mov eax,65 |
||
748 | mov esi,32 |
||
749 | xor ebp,ebp |
||
750 | int 0x40 |
||
751 | .f: |
||
752 | mov eax,13 |
||
6619 | leency | 753 | mov bx,[size_x_var] |
754 | add ebx,18 |
||
755 | shl ebx,16 |
||
756 | mov bx,60 |
||
757 | mov cx,[size_y_var] |
||
758 | sub cx,2 |
||
759 | shl ecx,16 |
||
760 | mov cx,9 |
||
761 | xor edx,edx |
||
2736 | leency | 762 | int 40h |
763 | |||
6619 | leency | 764 | |
8014 | leency | 765 | mov bx,[size_x_var] |
6619 | leency | 766 | add ebx,18 |
767 | shl ebx,16 |
||
768 | mov bx,[size_y_var] |
||
769 | sub bx,2 ; [x start] *65536 + [y start] |
||
8014 | leency | 770 | mov ecx,0x00888888 |
2736 | leency | 771 | mov edx,STRdata ; pointer to text beginning |
8014 | leency | 772 | mov esi,10 ; text length |
773 | int 40h |
||
1245 | hidnplayr | 774 | |
775 | |||
776 | |||
777 | |||
8014 | leency | 778 | |
1245 | hidnplayr | 779 | |
780 | ;-------------------------PROCEDURES--------------------------------------------- |
||
781 | ;-------------------------------------------------------------------------------- |
||
782 | include "FLAT_CAT.INC" |
||
1728 | clevermous | 783 | include "TEX_CAT.INC" |
784 | include "BUMP_CAT.INC" |
||
785 | include "3DMATH.INC" |
||
786 | include "GRD_LINE.INC" |
||
2881 | leency | 787 | include "B_PROCS.INC" |
1728 | clevermous | 788 | include "A_PROCS.INC" |
789 | include "GRD_CAT.INC" |
||
790 | include "BUMP_TEX.INC" |
||
791 | include "GRD_TEX.INC" |
||
792 | include "TWO_TEX.INC" |
||
793 | include "ASC.INC" |
||
5486 | leency | 794 | if Ext >= SSE3 |
8047 | leency | 795 | include "3R_PHG.INC" |
8048 | leency | 796 | include '3STENCIL.INC' |
8232 | leency | 797 | include '3GLASS.INC' |
798 | end if |
||
8047 | leency | 799 | clear_vertices_index: |
6769 | IgorA | 800 | mov edi,[vertices_index_ptr] |
801 | movzx eax,word[size_x_var] |
||
802 | movzx ecx,word[size_y_var] |
||
803 | imul ecx,eax |
||
804 | xor eax,eax |
||
805 | shr ecx,1 |
||
806 | rep stosd |
||
807 | ret |
||
808 | edit: ; mmx required, edit mesh by vertex |
||
8014 | leency | 809 | push ebp |
810 | mov ebp,esp |
||
811 | sub esp,128 |
||
812 | |||
1245 | hidnplayr | 813 | |
8014 | leency | 814 | .x_coord equ ebp-4 |
815 | .points_translated equ ebp-10 |
||
816 | .points equ ebp-22 |
||
817 | .points_rotated equ ebp-34 |
||
818 | .mx equ ebp-70 |
||
819 | |||
2736 | leency | 820 | |
6769 | IgorA | 821 | { |
822 | movzx ebx,word[.x_coord] |
||
8014 | leency | 823 | movzx ecx,word[.y_coord] |
824 | movzx edx,word[size_x_var] |
||
825 | imul edx,ecx |
||
826 | add ebx,edx |
||
827 | push ebx |
||
8047 | leency | 828 | lea ecx,[ebx*2] |
8014 | leency | 829 | lea ebx,[ebx*3] |
830 | |||
8047 | leency | 831 | |
832 | jl @f |
||
8232 | leency | 833 | add ebx,[esp] |
8047 | leency | 834 | @@: |
835 | add esp,4 |
||
836 | add ebx,[screen_ptr] |
||
8014 | leency | 837 | mov ebx,[ebx] |
838 | and ebx,0x00ffffff |
||
839 | cmp ebx,0x00ff0000 ; is handle bar ? |
||
840 | } |
||
6769 | IgorA | 841 | |
842 | |||
8014 | leency | 843 | mov eax,37 ; get mouse state |
844 | mov ebx,1 ; x = 5, y = 25 - offsets |
||
845 | int 0x40 |
||
846 | |||
6769 | IgorA | 847 | |
8014 | leency | 848 | movd mm0,ebx |
849 | movd mm1,eax |
||
850 | movd mm3,[size_y_var] |
||
851 | pcmpgtw mm0,mm1 |
||
852 | pcmpgtw mm3,mm1 |
||
853 | pxor mm3,mm0 |
||
854 | movd eax,mm3 |
||
855 | mov cx,ax |
||
856 | shr eax,16 |
||
857 | and ax,cx |
||
858 | or ax,ax |
||
859 | jz .no_edit |
||
860 | |||
6769 | IgorA | 861 | |
862 | |||
8014 | leency | 863 | psubw mm1,mm0 |
864 | movd eax,mm1 |
||
865 | |||
6769 | IgorA | 866 | |
867 | ror eax,16 |
||
8014 | leency | 868 | ; push eax |
869 | ; sub esp,256 |
||
870 | mov [.x_coord],eax |
||
871 | test word[mouse_state],100000000b |
||
872 | jz .not_press ; check if left mouse button press |
||
873 | |||
6769 | IgorA | 874 | |
8014 | leency | 875 | |
6769 | IgorA | 876 | |
877 | |||
8014 | leency | 878 | jne .no_edit |
879 | add ecx,[vertices_index_ptr] |
||
880 | mov cx,word[ecx] |
||
881 | inc cx |
||
882 | |||
6769 | IgorA | 883 | |
884 | |||
8014 | leency | 885 | |
6769 | IgorA | 886 | |
8014 | leency | 887 | mov dword[edit_end_x],eax |
888 | mov dword[edit_start_x],eax |
||
889 | jmp .end |
||
890 | .not_press: |
||
6769 | IgorA | 891 | test byte[mouse_state],1b ; check if left button is held |
8014 | leency | 892 | jz .not_held |
893 | ; check_bar |
||
6769 | IgorA | 894 | ; jne .no_edit |
8014 | leency | 895 | ; add ecx,[vertices_index_ptr] |
896 | ; mov cx,[ecx] |
||
897 | ; inc cx |
||
898 | cmp [vertex_edit_no],0 ; cx ; vertex number |
||
899 | je .end |
||
900 | push dword[.x_coord] |
||
901 | pop dword[edit_end_x] |
||
902 | jmp .end |
||
903 | .not_held: |
||
6769 | IgorA | 904 | shr [mouse_state],16 |
8014 | leency | 905 | test byte[mouse_state],1b ; test if left button released |
906 | jz .end |
||
907 | check_bar |
||
908 | jne .end |
||
909 | |||
6769 | IgorA | 910 | |
8014 | leency | 911 | dec esi |
912 | lea esi,[esi*3] |
||
913 | add esi,esi |
||
914 | add esi,[points_translated_ptr] |
||
915 | emms |
||
916 | |||
6769 | IgorA | 917 | |
8014 | leency | 918 | paddw mm1,mm0 |
919 | psubw mm1,qword[vect_x] |
||
920 | movd dword[esi],mm1 |
||
921 | |||
6769 | IgorA | 922 | |
8014 | leency | 923 | ; detranslate |
6769 | IgorA | 924 | fninit |
8014 | leency | 925 | fild word[esi+4] |
926 | fstp dword[edi+8] |
||
927 | fild word[esi+2] |
||
928 | fisub word[offset_x] |
||
929 | fstp dword[edi+4] |
||
930 | fild word[esi] |
||
931 | fisub word[offset_y] ; proteza |
||
932 | fstp dword[edi] |
||
933 | |||
6769 | IgorA | 934 | |
8014 | leency | 935 | lea edi,[.mx] |
936 | call reverse_mx_3x3 |
||
937 | |||
6769 | IgorA | 938 | |
8014 | leency | 939 | lea edi,[.points_rotated] |
940 | lea ebx,[.mx] |
||
941 | mov ecx,1 |
||
942 | call rotary |
||
943 | |||
6769 | IgorA | 944 | |
8014 | leency | 945 | movzx edi,[vertex_edit_no] |
946 | dec edi |
||
947 | lea edi,[edi*3] |
||
948 | shl edi,2 |
||
949 | add edi,[points_ptr] |
||
950 | lea esi,[.points_rotated] |
||
951 | cld |
||
952 | movsd |
||
8232 | leency | 953 | movsd |
954 | movsd |
||
955 | ; mov ecx,3 |
||
956 | ; cld |
||
957 | ; rep movsd |
||
958 | |||
6769 | IgorA | 959 | |
960 | |||
8014 | leency | 961 | mov [vertex_edit_no],0 |
962 | |||
6769 | IgorA | 963 | |
964 | .end: |
||
965 | mov esp,ebp |
||
966 | pop ebp |
||
967 | ret |
||
968 | |||
969 | |||
1245 | hidnplayr | 970 | push ebp |
6769 | IgorA | 971 | mov ebp,esp |
972 | .temp equ ebp-4 |
||
973 | push dword 0 |
||
974 | |||
975 | |||
6648 | leency | 976 | mov ebx, 11 |
977 | int 0x40 ; -> create heap, to be sure |
||
978 | |||
979 | |||
980 | |||
6619 | leency | 981 | movzx eax,word[size_y_var] |
982 | mul ecx |
||
1245 | hidnplayr | 983 | |
6769 | IgorA | 984 | |
985 | lea ecx,[eax*4] ; more mem for r_phg cause |
||
8047 | leency | 986 | add ecx,256 |
6769 | IgorA | 987 | mov eax,68 |
6648 | leency | 988 | mov ebx,20 |
989 | mov edx,[screen_ptr] |
||
990 | int 0x40 |
||
991 | mov [screen_ptr],eax |
||
992 | |||
993 | |||
6769 | IgorA | 994 | shl ecx,2 |
6648 | leency | 995 | add ecx,256 |
6769 | IgorA | 996 | mov eax,68 |
6648 | leency | 997 | mov ebx,20 |
998 | mov edx,[Zbuffer_ptr] |
||
999 | int 0x40 |
||
1000 | mov [Zbuffer_ptr],eax |
||
1001 | |||
1002 | |||
6769 | IgorA | 1003 | |
1004 | add ecx,ecx |
||
1005 | add ecx,256 |
||
1006 | mov eax,68 |
||
1007 | mov ebx,20 |
||
1008 | mov edx,[vertices_index_ptr] |
||
1009 | int 0x40 |
||
1010 | mov [vertices_index_ptr],eax |
||
1011 | |||
1012 | |||
1013 | pop ebp |
||
1014 | |||
1015 | |||
1016 | |||
1017 | |||
1245 | hidnplayr | 1018 | |
1019 | ; updates flags and writing flag description |
||
1020 | ; in ah - button number |
||
8014 | leency | 1021 | push ax |
1022 | mov edi,menu |
||
1023 | .ch_another: |
||
1245 | hidnplayr | 1024 | cmp ah,byte[edi] ; ah = button id |
8014 | leency | 1025 | jne @f |
1026 | mov bl,byte[edi+11] ; max_flag + 1 |
||
1027 | cmp bl,255 |
||
1028 | je .no_write |
||
1029 | inc byte[edi+12] ; flag |
||
1030 | cmp byte[edi+12],bl |
||
1031 | jne .write |
||
1032 | mov byte[edi+12],0 |
||
1033 | jmp .write |
||
1034 | @@: |
||
1245 | hidnplayr | 1035 | add edi,17 |
8014 | leency | 1036 | cmp byte[edi],-1 |
1037 | jne .ch_another |
||
1038 | jmp .no_write |
||
8047 | leency | 1039 | .write: |
1245 | hidnplayr | 1040 | ; clreol {pascal never dies} |
1041 | ; * eax = 13 - function number |
||
8014 | leency | 1042 | ; * ebx = [coordinate on axis x]*65536 + [size on axis x] |
1245 | hidnplayr | 1043 | ; * ecx = [coordinate on axis y]*65536 + [size on axis y] |
1044 | ; * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill |
||
1045 | |||
1046 | |||
8014 | leency | 1047 | movzx ecx,byte[edi] |
1048 | sub cl,2 |
||
1049 | lea ecx,[ecx*3] |
||
1050 | lea ecx,[ecx*5] |
||
1051 | add ecx,28 |
||
1052 | shl ecx,16 |
||
1053 | add ecx,14 ; ecx = [coord y]*65536 + [size y] |
||
1054 | mov bx,[size_x_var] |
||
1055 | shl ebx,16 |
||
1056 | add ebx,(12+70)*65536+25 ; [x start] *65536 + [size x] |
||
1057 | mov edx,0x00000000 ; color 0x00RRGGBB |
||
1058 | int 0x40 |
||
1059 | |||
1245 | hidnplayr | 1060 | |
8014 | leency | 1061 | movzx ebx,byte[edi] |
1062 | sub bl,2 |
||
1063 | lea ebx,[ebx*3] |
||
1064 | lea ebx,[ebx*5] |
||
1065 | mov cx,[size_x_var] |
||
1066 | shl ecx,16 |
||
1067 | add ebx,ecx |
||
1068 | add ebx,(12+70)*65536+28 ; [x start] *65536 + [y start] |
||
1069 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
1070 | movzx edx,byte[edi+12] ; current flag |
||
1071 | shl edx,2 ; * 4 = text length |
||
1072 | add edx,dword[edi+13] ; pointer to text beginning |
||
1073 | mov esi,4 ; text length - |
||
1074 | ; flag description 4 characters |
||
1075 | int 0x40 |
||
1076 | |||
1245 | hidnplayr | 1077 | |
1078 | pop ax |
||
8014 | leency | 1079 | ret |
1245 | hidnplayr | 1080 | normalize_all_light_vectors: |
1081 | mov edi,lights |
||
8014 | leency | 1082 | @@: |
1245 | hidnplayr | 1083 | call normalize_vector ; 3dmath.inc |
8014 | leency | 1084 | add edi,LIGHT_SIZE |
1085 | cmp edi,lightsend ;ecx |
||
1086 | jl @b |
||
1087 | ret |
||
1245 | hidnplayr | 1088 | |
1089 | |||
8014 | leency | 1090 | ;macro .comment222 |
1245 | hidnplayr | 1091 | ; ; planar mapping |
8014 | leency | 1092 | ; mov esi,points |
1093 | ; mov edi,tex_points |
||
1094 | ; @@: |
||
1245 | hidnplayr | 1095 | ; add esi,2 |
8014 | leency | 1096 | ; movsd |
1097 | ; cmp dword[esi],dword -1 |
||
1098 | ; jne @b |
||
1099 | |||
1245 | hidnplayr | 1100 | |
1101 | |||
1102 | |||
1103 | ; sub esp,4 |
||
1104 | |||
1105 | |||
1776 | yogev_ezra | 1106 | fldpi |
1245 | hidnplayr | 1107 | fadd st,st |
8014 | leency | 1108 | mov esi,[points_ptr] |
1109 | mov edi,tex_points |
||
1110 | mov ecx,[points_count_var] |
||
1111 | inc ecx |
||
1112 | ; cmp [map_tex_flag],1 |
||
1113 | ; jne .cylindric |
||
1114 | ; spherical mapping around y axle |
||
1776 | yogev_ezra | 1115 | |
1245 | hidnplayr | 1116 | |
1117 | fld dword[esi] ; x coord |
||
8014 | leency | 1118 | fld dword[esi+8] ; z coord |
1119 | fpatan ; arctg(st1/st) |
||
1120 | ; fdiv .Pi2 |
||
1121 | fdiv st0,st1 |
||
1122 | fimul [tex_x_div2] |
||
1123 | fiadd [tex_x_div2] |
||
1124 | fistp word[edi] ; x |
||
1125 | |||
1245 | hidnplayr | 1126 | |
8014 | leency | 1127 | fld dword[esi] ; x |
1128 | fmul st,st0 |
||
1129 | fld dword[esi+4] ; y |
||
1130 | fmul st,st0 |
||
1131 | fld dword[esi+8] ; z |
||
1132 | fmul st,st0 |
||
1133 | faddp |
||
1245 | hidnplayr | 1134 | faddp |
1135 | fsqrt |
||
1136 | fpatan |
||
1137 | fldpi |
||
1138 | fdivp |
||
1139 | fimul [tex_y_div2] |
||
1140 | fiadd [tex_y_div2] |
||
1141 | fistp word[edi+2] ; y |
||
1142 | |||
1143 | |||
1144 | add edi,4 |
||
1145 | loop @b |
||
1146 | ffree st0 |
||
1147 | ; jmp .end_map |
||
8014 | leency | 1148 | ; .cylindric: |
1776 | yogev_ezra | 1149 | ; fld dword[esi] ; around y axle |
8014 | leency | 1150 | ; fld dword[esi+8] |
1151 | ; fpatan |
||
1152 | ; fdiv st0,st1 |
||
1153 | ; fimul [tex_x_div2] |
||
1154 | ; fiadd [tex_x_div2] |
||
1155 | ; fistp word[edi] |
||
1156 | |||
1245 | hidnplayr | 1157 | |
8014 | leency | 1158 | ; fimul [tex_y_div2] |
1159 | ; fiadd [tex_y_div2] |
||
1160 | ; fistp word[edi+2] |
||
1161 | |||
1776 | yogev_ezra | 1162 | |
8014 | leency | 1163 | ; add edi,4 |
1164 | ; loop .cylindric |
||
1165 | ; ffree st0 |
||
1166 | ;; mov esp,ebp |
||
1167 | ; .end_map: |
||
1776 | yogev_ezra | 1168 | ret |
1245 | hidnplayr | 1169 | |
1170 | |||
1171 | |||
8014 | leency | 1172 | ;env_map 512 x 512 x 3 bytes |
1245 | hidnplayr | 1173 | .temp equ word [ebp-2] |
1174 | .nEy equ word [ebp-4] |
||
1175 | .nEx equ word [ebp-6] |
||
1176 | .col_r equ [ebp-8] |
||
1177 | .col_g equ [ebp-9] |
||
1178 | .col_b equ [ebp-10] |
||
1179 | |||
1180 | |||
8014 | leency | 1181 | mov ebp,esp |
1182 | sub esp,20 |
||
1183 | mov edi,envmap |
||
1184 | fninit |
||
1185 | |||
1245 | hidnplayr | 1186 | |
8014 | leency | 1187 | .ie_ver: |
1245 | hidnplayr | 1188 | mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x |
8014 | leency | 1189 | .ie_hor: |
1245 | hidnplayr | 1190 | xor ebx,ebx |
8014 | leency | 1191 | mov dword .col_b, 0 |
1192 | .light: |
||
1245 | hidnplayr | 1193 | lea esi,[lights+ebx] |
8014 | leency | 1194 | fld dword[esi] ; light vector x cooficient |
1195 | fimul [tex_x_div2] ;[i256] |
||
1196 | mov .temp,cx |
||
1197 | fisubr .temp |
||
1198 | fistp .nEx |
||
1199 | fld dword[esi+4] ; light vector y cooficient |
||
1200 | fimul [tex_y_div2] ;[i256] |
||
1201 | mov .temp,dx |
||
1202 | fisubr .temp |
||
1203 | fistp .nEy |
||
1204 | |||
1245 | hidnplayr | 1205 | |
8014 | leency | 1206 | jl .update_counters |
1207 | cmp .nEy,- TEX_Y / 2 ;256 |
||
1208 | jl .update_counters |
||
1209 | cmp .nEx,TEX_X / 2 ;256 |
||
1210 | jg .update_counters |
||
1211 | cmp .nEy,TEX_Y / 2 ;256 |
||
1212 | jg .update_counters |
||
1213 | |||
1245 | hidnplayr | 1214 | |
8014 | leency | 1215 | fmul st,st0 |
1216 | fild .nEy |
||
1217 | fmul st,st0 |
||
1218 | faddp |
||
1219 | fsqrt |
||
1220 | fisubr [i256] |
||
1221 | fmul [env_const] |
||
1222 | fidiv [i256] ; st - 'virtual' dot product |
||
1223 | |||
1245 | hidnplayr | 1224 | |
8014 | leency | 1225 | fstsw ax |
1226 | sahf |
||
1227 | jb @f |
||
1228 | ffree st |
||
1229 | fld1 ;[dot_max] |
||
1230 | @@: |
||
1245 | hidnplayr | 1231 | fcom [dot_min] |
8014 | leency | 1232 | fstsw ax |
1233 | sahf |
||
1234 | ja @f |
||
1235 | ffree st |
||
1236 | fldz ;[dot_min] |
||
1237 | @@: |
||
1245 | hidnplayr | 1238 | push ebp |
8014 | leency | 1239 | movzx ax,byte[esi+21] |
1240 | push ax ;- shines |
||
1241 | mov al,byte[esi+14] ; b orginal color |
||
1242 | push ax |
||
1243 | mov al,byte[esi+13] ; g |
||
1244 | push ax |
||
1245 | mov al,byte[esi+12] ; r |
||
1246 | push ax |
||
1247 | mov al,byte[esi+20] ; b max color |
||
1248 | push ax |
||
1249 | mov al,byte[esi+19] ; g |
||
1250 | push ax |
||
1251 | mov al,byte[esi+18] ; r |
||
1252 | push ax |
||
1253 | mov al,byte[esi+17] ; b min col |
||
1254 | push ax |
||
1255 | mov al,byte[esi+16] ; g |
||
1256 | push ax |
||
1257 | mov al,byte[esi+15] ; r |
||
1258 | push ax |
||
1259 | push eax ; earlier - dot pr |
||
1260 | ; fstp .dot_product |
||
1261 | ; push .dot_product |
||
1262 | call calc_one_col |
||
1263 | pop ebp |
||
1264 | ; eax-0x00rrggbb |
||
1265 | cmp al,.col_b |
||
1266 | jbe @f |
||
1267 | mov .col_b,al |
||
1268 | @@: ; eax - ggbb00rr |
||
1269 | shr ax,8 |
||
1270 | cmp al,.col_g |
||
1271 | jbe @f |
||
1272 | mov .col_g,al |
||
1273 | @@: ; eax - bb0000gg |
||
1274 | shr eax,16 |
||
1275 | cmp al,.col_r |
||
1276 | jbe @f |
||
1277 | mov .col_r,al |
||
1278 | @@: |
||
1245 | hidnplayr | 1279 | .update_counters: ; update and jump when neccesery |
8014 | leency | 1280 | add ebx,LIGHT_SIZE |
1281 | cmp bx,[all_lights_size] |
||
1282 | jl .light ; next_light |
||
1283 | mov eax,dword .col_b |
||
1284 | stosd |
||
1285 | dec edi |
||
1286 | |||
1245 | hidnplayr | 1287 | |
8014 | leency | 1288 | cmp cx,TEX_X / 2 ;256 |
1289 | jne .ie_hor |
||
1290 | |||
1245 | hidnplayr | 1291 | |
8014 | leency | 1292 | cmp dx,TEX_Y / 2 ;256 |
1293 | jne .ie_ver |
||
1294 | |||
1245 | hidnplayr | 1295 | |
8014 | leency | 1296 | pop ebp |
1297 | ret |
||
1245 | hidnplayr | 1298 | |
1299 | |||
1931 | yogev_ezra | 1300 | |
1301 | |||
8014 | leency | 1302 | ;env_map 512 x 512 x 3 bytes ; many lights using |
1303 | .temp equ word [ebp-2] |
||
1245 | hidnplayr | 1304 | .nz equ dword [ebp-6] ; dword |
1305 | .ny equ dword [ebp-10] |
||
1306 | .nx equ dword [ebp-14] |
||
1307 | .col_r equ [ebp-16] |
||
1308 | .col_g equ [ebp-17] |
||
1309 | .col_b equ [ebp-18] |
||
1310 | |||
1311 | |||
8014 | leency | 1312 | mov ebp,esp |
1313 | sub esp,20 |
||
1314 | mov edi,color_map |
||
1315 | fninit |
||
1316 | |||
1245 | hidnplayr | 1317 | |
8014 | leency | 1318 | .ie_ver: |
1245 | hidnplayr | 1319 | mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x |
8014 | leency | 1320 | .ie_hor: |
1245 | hidnplayr | 1321 | mov .temp,cx |
8014 | leency | 1322 | fild .temp |
1323 | fidiv [i256] ;st = Nx - vector normal x cooficient |
||
1324 | fst .nx |
||
1325 | fmul st,st0 |
||
1326 | mov .temp,dx |
||
1327 | fild .temp |
||
1328 | fidiv [i256] ; st = Ny - vector normal y coeficient |
||
1329 | fst .ny |
||
1330 | fmul st,st0 |
||
1331 | faddp |
||
1332 | fld1 |
||
1333 | fchs |
||
1334 | faddp |
||
1335 | fabs |
||
1336 | fsqrt |
||
1337 | fchs |
||
1338 | fstp .nz ; st - Nz - vect normal z coeficient |
||
1339 | xor ebx,ebx |
||
1340 | mov dword .col_b, 0 |
||
1341 | .light: |
||
1245 | hidnplayr | 1342 | push edi ;env_map |
8014 | leency | 1343 | lea esi,[lights+ebx] |
1344 | lea edi,.nx |
||
1345 | call dot_product |
||
1346 | pop edi |
||
1347 | fcom [dot_min] |
||
1348 | fstsw ax |
||
1349 | sahf |
||
1350 | ja .env_ok1 ;compare with dot_max |
||
1351 | ffree st |
||
1352 | |||
1245 | hidnplayr | 1353 | |
8014 | leency | 1354 | .env_ok1: |
1245 | hidnplayr | 1355 | fcom [dot_max] |
8014 | leency | 1356 | fstsw ax |
1357 | sahf |
||
1358 | jb .env_ok2 ; calc col |
||
1359 | ffree st |
||
1360 | jmp .update_counters |
||
1361 | .env_ok2: ;calc col |
||
1362 | push ebp |
||
1363 | movzx ax,byte[esi+21] |
||
1364 | push ax ;- shines |
||
1365 | mov al,byte[esi+14] ; b orginal color |
||
1366 | push ax |
||
1367 | mov al,byte[esi+13] ; g |
||
1368 | push ax |
||
1369 | mov al,byte[esi+12] ; r |
||
1370 | push ax |
||
1371 | mov al,byte[esi+20] ; b max color |
||
1372 | push ax |
||
1373 | mov al,byte[esi+19] ; g |
||
1374 | push ax |
||
1375 | mov al,byte[esi+18] ; r |
||
1376 | push ax |
||
1377 | mov al,byte[esi+17] ; b min col |
||
1378 | push ax |
||
1379 | mov al,byte[esi+16] ; g |
||
1380 | push ax |
||
1381 | mov al,byte[esi+15] ; r |
||
1382 | push ax |
||
1383 | push eax ; earlier - dot pr |
||
1384 | ; fstp .dot_product |
||
1385 | ; push .dot_product |
||
1386 | call calc_one_col |
||
1387 | pop ebp |
||
1388 | ; eax-0x00rrggbb |
||
1389 | cmp al,.col_b |
||
1390 | jbe @f |
||
1391 | mov .col_b,al |
||
1392 | @@: |
||
1245 | hidnplayr | 1393 | shr ax,8 |
8014 | leency | 1394 | cmp al,.col_g |
1395 | jbe @f |
||
1396 | mov .col_g,al |
||
1397 | @@: |
||
1245 | hidnplayr | 1398 | shr eax,16 |
8014 | leency | 1399 | cmp al,.col_r |
1400 | jbe @f |
||
1401 | mov .col_r,al |
||
1402 | @@: |
||
1245 | hidnplayr | 1403 | .update_counters: ; update and jump when neccesery |
8014 | leency | 1404 | add ebx,LIGHT_SIZE |
1405 | cmp bx,[all_lights_size] |
||
1406 | jl .light ; next_light |
||
1407 | mov eax,dword .col_b |
||
1408 | stosd |
||
1409 | dec edi |
||
1410 | |||
1245 | hidnplayr | 1411 | |
8014 | leency | 1412 | cmp cx,TEX_X / 2 ;256 |
1413 | jne .ie_hor |
||
1414 | |||
1245 | hidnplayr | 1415 | |
8014 | leency | 1416 | cmp dx,TEX_X / 2 ;256 |
1417 | jne .ie_ver |
||
1418 | |||
1245 | hidnplayr | 1419 | |
1420 | mov esp,ebp |
||
8014 | leency | 1421 | pop ebp |
1422 | ret |
||
1245 | hidnplayr | 1423 | if Ext >= SSE3 |
8232 | leency | 1424 | init_point_normals: |
1425 | .z equ dword [ebp-8] |
||
1426 | .y equ dword [ebp-12] |
||
1427 | .x equ [ebp-16] |
||
1428 | .point_number equ dword [ebp-28] |
||
1429 | .hit_faces equ dword [ebp-32] |
||
1430 | |||
8014 | leency | 1431 | |
8232 | leency | 1432 | push ebp |
1433 | mov ebp,esp |
||
1434 | sub esp,64 |
||
1435 | and ebp,-16 |
||
1436 | mov edi,[points_normals_ptr] |
||
1437 | mov .point_number,0 |
||
1438 | .ipn_loop: |
||
1439 | movd xmm0,.point_number |
||
1440 | pshufd xmm0,xmm0,0 |
||
1441 | mov .hit_faces,0 |
||
1442 | mov .x,dword 0 |
||
1443 | mov .y,0 |
||
1444 | mov .z,0 |
||
1445 | mov esi,[triangles_ptr] |
||
1446 | xor ecx,ecx ; ecx - triangle number |
||
1447 | .ipn_check_face: |
||
1448 | movdqu xmm1,[esi] |
||
1449 | pcmpeqd xmm1,xmm0 |
||
1450 | pmovmskb eax,xmm1 |
||
1451 | and eax,0xfff |
||
1452 | or eax,eax |
||
1453 | jz .ipn_next_face |
||
1454 | push esi |
||
1455 | mov esi,ecx |
||
1456 | lea esi,[esi*3] |
||
1457 | shl esi,2 |
||
1458 | add esi,[triangles_normals_ptr] |
||
1459 | movups xmm7,[esi] |
||
1460 | addps xmm7,.x |
||
1461 | movaps .x,xmm7 |
||
1462 | pop esi |
||
1463 | inc .hit_faces |
||
1464 | |||
1465 | |||
1466 | add esi,12 |
||
1467 | inc ecx |
||
1468 | cmp ecx,[triangles_count_var] |
||
1469 | jne .ipn_check_face |
||
1470 | cvtsi2ss xmm6,.hit_faces |
||
1471 | movaps xmm7,.x |
||
1472 | rcpss xmm6,xmm6 |
||
1473 | shufps xmm6,xmm6,11000000b |
||
1474 | mulps xmm7,xmm6 |
||
1475 | movaps xmm6,xmm7 |
||
1476 | mulps xmm6,xmm6 |
||
1477 | andps xmm6,[zero_hgst_dd] |
||
1478 | haddps xmm6,xmm6 |
||
1479 | haddps xmm6,xmm6 |
||
1480 | rsqrtps xmm6,xmm6 |
||
1481 | mulps xmm7,xmm6 |
||
1482 | movlps [edi],xmm7 |
||
1483 | movhlps xmm7,xmm7 |
||
1484 | movss [edi+8],xmm7 |
||
1485 | add edi,12 |
||
1486 | inc .point_number |
||
1487 | mov edx,.point_number |
||
1488 | cmp edx,[points_count_var] |
||
1489 | jne .ipn_loop |
||
1490 | |||
1491 | |||
1492 | pop ebp |
||
1493 | ret |
||
1494 | else |
||
1495 | init_point_normals: |
||
1245 | hidnplayr | 1496 | .x equ dword [ebp-4] |
1497 | .y equ dword [ebp-8] |
||
1498 | .z equ dword [ebp-12] |
||
1499 | .point_number equ dword [ebp-28] |
||
8014 | leency | 1500 | .hit_faces equ dword [ebp-32] |
1501 | |||
1245 | hidnplayr | 1502 | |
8014 | leency | 1503 | mov ebp,esp |
1504 | sub esp,32 |
||
1505 | mov edi,[points_normals_ptr] |
||
1506 | mov .point_number,0 |
||
1507 | .ipn_loop: |
||
1245 | hidnplayr | 1508 | mov .hit_faces,0 |
8014 | leency | 1509 | mov .x,0 |
1510 | mov .y,0 |
||
1511 | mov .z,0 |
||
1512 | mov esi,[triangles_ptr] |
||
1513 | xor ecx,ecx ; ecx - triangle number |
||
1514 | .ipn_check_face: |
||
1245 | hidnplayr | 1515 | xor ebx,ebx ; ebx - 'position' in one triangle |
8014 | leency | 1516 | .ipn_check_vertex: |
1245 | hidnplayr | 1517 | mov eax,dword[esi+ebx] ; eax - point_number |
8014 | leency | 1518 | cmp eax,.point_number |
1519 | jne .ipn_next_vertex |
||
1520 | push esi |
||
1521 | mov esi,ecx |
||
1522 | lea esi,[esi*3] |
||
1523 | ; lea esi,[triangles_normals+esi*4] |
||
1524 | shl esi,2 |
||
1525 | add esi,[triangles_normals_ptr] |
||
1526 | |||
1245 | hidnplayr | 1527 | |
8014 | leency | 1528 | fadd dword[esi+vec_x] ; vec_x this defined in 3dmath.asm - x cooficient |
1529 | fstp .x ; of normal vactor |
||
1530 | fld .y |
||
1531 | fadd dword[esi+vec_y] |
||
1532 | fstp .y |
||
1533 | fld .z |
||
1534 | fadd dword[esi+vec_z] |
||
1535 | fstp .z |
||
1536 | pop esi |
||
1537 | inc .hit_faces |
||
1538 | jmp .ipn_next_face |
||
1539 | .ipn_next_vertex: |
||
1245 | hidnplayr | 1540 | add ebx,4 |
8014 | leency | 1541 | cmp ebx,12 |
1542 | jne .ipn_check_vertex |
||
1543 | .ipn_next_face: |
||
1245 | hidnplayr | 1544 | add esi,12 |
8014 | leency | 1545 | inc ecx |
1546 | cmp ecx,[triangles_count_var] |
||
1547 | jne .ipn_check_face |
||
1548 | |||
1245 | hidnplayr | 1549 | |
8014 | leency | 1550 | fidiv .hit_faces |
1551 | fstp dword[edi+vec_x] |
||
1552 | fld .y |
||
1553 | fidiv .hit_faces |
||
1554 | fstp dword[edi+vec_y] |
||
1555 | fld .z |
||
1556 | fidiv .hit_faces |
||
1557 | fstp dword[edi+vec_z] |
||
1558 | call normalize_vector |
||
1559 | add edi,12 ;type vector 3d |
||
1560 | inc .point_number |
||
1561 | mov edx,.point_number |
||
1562 | cmp edx,[points_count_var] |
||
1563 | jne .ipn_loop |
||
1564 | |||
1245 | hidnplayr | 1565 | |
8014 | leency | 1566 | ret |
1245 | hidnplayr | 1567 | ;=============================================================== |
1568 | end if |
||
8232 | leency | 1569 | init_triangles_normals2: |
1245 | hidnplayr | 1570 | mov ebx,[triangles_normals_ptr] |
8014 | leency | 1571 | mov ebp,[triangles_ptr] |
1572 | mov ecx,[triangles_count_var] |
||
1573 | @@: |
||
1245 | hidnplayr | 1574 | push ecx |
8014 | leency | 1575 | push ebx |
1576 | mov ebx,vectors |
||
1577 | mov esi,dword[ebp] ; first point index |
||
1578 | lea esi,[esi*3] |
||
1579 | ; lea esi,[points+esi*2] ; esi - pointer to 1st 3d point |
||
1580 | shl esi,2 |
||
1581 | add esi,[points_ptr] |
||
1582 | mov edi,dword[ebp+4] ; first point index |
||
1583 | lea edi,[edi*3] |
||
1584 | shl edi,2 |
||
1585 | add edi,[points_ptr] |
||
1586 | ; movzx edi,word[ebp+2] ; second point index |
||
1587 | ; lea edi,[edi*3] |
||
1588 | ; lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point |
||
1589 | call make_vector_r |
||
1590 | add ebx,12 |
||
1591 | mov esi,edi |
||
1592 | mov edi,dword[ebp+8] ; third point index |
||
1593 | lea edi,[edi*3] |
||
1594 | shl edi,2 |
||
1595 | add edi,[points_ptr] |
||
1596 | ; lea edi,[points+edi*2] |
||
1597 | call make_vector_r |
||
1598 | mov edi,ebx ; edi - pointer to 2nd vector |
||
1599 | mov esi,ebx |
||
1600 | sub esi,12 ; esi - pointer to 1st vector |
||
1601 | pop ebx |
||
1602 | call cross_product |
||
1603 | mov edi,ebx |
||
1604 | call normalize_vector |
||
1605 | add ebp,12 |
||
1606 | add ebx,12 |
||
1607 | pop ecx |
||
1608 | sub ecx,1 |
||
1609 | jnz @b |
||
1610 | ; cmp dword[ebp],-1 |
||
1611 | ; jne @b |
||
1612 | ret |
||
1245 | hidnplayr | 1613 | |
1614 | |||
8047 | leency | 1615 | copy_lights: ; after normalising ! |
1616 | mov esi,lights |
||
1617 | mov edi,lights_aligned |
||
1618 | mov ecx,3 |
||
1619 | .again: |
||
1620 | push ecx |
||
1621 | mov ecx,3 |
||
1622 | cld |
||
1623 | rep movsd |
||
1624 | xor eax,eax |
||
1625 | stosd |
||
1626 | mov ecx,3 |
||
1627 | .b: |
||
1628 | push ecx |
||
1629 | mov ecx,3 |
||
1630 | @@: |
||
1245 | hidnplayr | 1631 | movzx ebx,byte[esi] |
8047 | leency | 1632 | cvtsi2ss xmm0,ebx |
1633 | movss [edi],xmm0 |
||
1634 | inc esi |
||
1635 | add edi,4 |
||
1636 | loop @b |
||
1637 | stosd |
||
1638 | pop ecx |
||
1639 | loop .b |
||
1640 | inc esi ; skip shiness |
||
1641 | pop ecx |
||
1642 | loop .again |
||
1643 | ret |
||
1644 | end if |
||
1645 | |||
1245 | hidnplayr | 1646 | |
1647 | mov edi,[screen_ptr] |
||
8014 | leency | 1648 | movzx ecx,word[size_x_var] |
1649 | movzx eax,word[size_y_var] |
||
1650 | imul ecx,eax |
||
1651 | |||
8047 | leency | 1652 | |
1653 | |||
8014 | leency | 1654 | if Ext=NON |
1245 | hidnplayr | 1655 | rep stosd |
8014 | leency | 1656 | else if Ext = MMX |
6619 | leency | 1657 | pxor mm0,mm0 |
8014 | leency | 1658 | @@: |
1245 | hidnplayr | 1659 | movq [edi+00],mm0 |
8014 | leency | 1660 | movq [edi+08],mm0 |
1661 | movq [edi+16],mm0 |
||
1662 | movq [edi+24],mm0 |
||
1663 | add edi,32 |
||
1664 | sub ecx,8 |
||
1665 | jnc @b |
||
1666 | else |
||
6619 | leency | 1667 | push ecx |
8014 | leency | 1668 | mov ecx,edi |
1669 | and ecx,0x0000000f |
||
1670 | rep stosb |
||
1671 | pop ecx |
||
1672 | and ecx,0xfffffff0 |
||
1673 | xorps xmm0,xmm0 |
||
1674 | @@: |
||
6619 | leency | 1675 | movaps [edi],xmm0 |
8014 | leency | 1676 | movaps [edi+16],xmm0 |
1677 | movaps [edi+32],xmm0 |
||
1678 | movaps [edi+48],xmm0 |
||
1679 | add edi,64 |
||
1680 | sub ecx,16 |
||
1681 | jnz @b |
||
1682 | end if |
||
1245 | hidnplayr | 1683 | |
6619 | leency | 1684 | |
1245 | hidnplayr | 1685 | |
1686 | |||
1687 | |||
1688 | |||
6769 | IgorA | 1689 | |
8014 | leency | 1690 | ; update translated list MMX required |
6769 | IgorA | 1691 | cmp [vertex_edit_no],0 |
8014 | leency | 1692 | je @f |
1693 | movzx eax,[vertex_edit_no] |
||
1694 | dec eax |
||
1695 | movd mm0,[edit_end_x] |
||
1696 | psubw mm0,[edit_start_x] |
||
1697 | lea eax,[eax*3] |
||
1698 | add eax,eax |
||
1699 | add eax,[points_translated_ptr] |
||
1700 | movd mm1,dword[eax] |
||
1701 | paddw mm1,mm0 |
||
1702 | movd dword[eax],mm1 |
||
1703 | @@: |
||
8232 | leency | 1704 | if Ext >= SSE3 |
1705 | cmp [dr_flag],13 |
||
1706 | jne .no_stencil |
||
1707 | mov esi,[triangles_ptr] |
||
1708 | mov ecx,[triangles_count_var] |
||
1709 | @@: |
||
1710 | push esi |
||
1711 | push ecx |
||
1712 | |||
6769 | IgorA | 1713 | |
8232 | leency | 1714 | mov ebx,[esi+4] |
1715 | mov ecx,[esi+8] |
||
1716 | imul eax,[i12] |
||
1717 | imul ebx,[i12] |
||
1718 | imul ecx,[i12] |
||
1719 | add eax,[points_rotated_ptr] |
||
1720 | add ebx,[points_rotated_ptr] |
||
1721 | add ecx,[points_rotated_ptr] |
||
1722 | push dword[ecx+8] |
||
1723 | push dword[ebx+8] |
||
1724 | push dword[eax+8] |
||
1725 | movups xmm0,[esp] |
||
1726 | add esp,12 |
||
1727 | andps xmm0,[zero_hgst_dd] |
||
1728 | |||
6769 | IgorA | 1729 | |
1730 | |||
8232 | leency | 1731 | mov ebx,[esi+4] |
1732 | mov ecx,[esi+8] |
||
1733 | shl eax,1 |
||
1734 | shl ebx,1 |
||
1735 | shl ecx,1 |
||
1736 | lea eax,[eax*3] |
||
1737 | lea ebx,[ebx*3] |
||
1738 | lea ecx,[ecx*3] |
||
1739 | add eax,[points_translated_ptr] |
||
1740 | add ebx,[points_translated_ptr] |
||
1741 | add ecx,[points_translated_ptr] |
||
1742 | mov eax,[eax] |
||
1743 | mov ebx,[ebx] |
||
1744 | mov ecx,[ecx] |
||
1745 | ror eax,16 |
||
1746 | ror ebx,16 |
||
1747 | ror ecx,16 |
||
1748 | |||
1749 | |||
1750 | |||
1751 | |||
1752 | |||
1753 | |||
1754 | |||
1755 | pop esi |
||
1756 | add esi,12 |
||
1757 | dec ecx |
||
1758 | jnz @b |
||
1759 | |||
1760 | |||
1761 | end if |
||
1762 | |||
1763 | |||
1764 | |||
1765 | |||
8014 | leency | 1766 | mov ecx,[triangles_count_var] |
1767 | .again_dts: |
||
1245 | hidnplayr | 1768 | push ecx |
8014 | leency | 1769 | mov ebp,[points_translated_ptr] |
1770 | if Ext >= SSE2 |
||
1771 | mov eax,dword[esi] |
||
1772 | mov [point_index1],eax |
||
1773 | lea eax,[eax*3] |
||
1774 | add eax,eax |
||
1775 | push ebp |
||
1776 | add ebp,eax |
||
1777 | mov eax,[ebp] |
||
1778 | ; cmp [vertex_edit_no],0 |
||
1779 | ; jne @f |
||
1780 | ; |
||
1781 | ; @@: |
||
1782 | mov dword[xx1],eax |
||
1783 | mov eax,[ebp+4] |
||
1784 | mov [zz1],ax |
||
1785 | |||
6769 | IgorA | 1786 | |
8014 | leency | 1787 | |
1245 | hidnplayr | 1788 | |
1789 | |||
8014 | leency | 1790 | mov [point_index2],eax |
1791 | lea eax,[eax*3] |
||
1792 | add eax,eax |
||
1793 | push ebp |
||
1794 | add ebp,eax |
||
1795 | mov eax,[ebp] |
||
1796 | mov dword[xx2],eax |
||
1797 | mov eax,[ebp+4] |
||
1798 | mov [zz2],ax |
||
1799 | pop ebp |
||
1800 | |||
1245 | hidnplayr | 1801 | |
1802 | |||
8014 | leency | 1803 | mov [point_index3],eax |
1804 | lea eax,[eax*3] |
||
1805 | add eax,eax |
||
1806 | ; push ebp |
||
1807 | add ebp,eax |
||
1808 | mov eax,[ebp] |
||
1809 | mov dword[xx3],eax |
||
1810 | mov eax,[ebp+4] |
||
1811 | mov [zz3],ax |
||
1812 | else |
||
1245 | hidnplayr | 1813 | movq mm0,[esi] ; don't know MMX |
8014 | leency | 1814 | mov qword[point_index1],mm0 |
1815 | ; shr eax,16 |
||
1816 | ; mov [point_index2],ax |
||
1817 | mov eax,dword[esi+8] |
||
1818 | mov [point_index3],eax |
||
1819 | movdqu xmm0,[esi] |
||
1820 | paddd xmm0,xmm0 |
||
1821 | movdqa xmm1,xmm0 |
||
1822 | paddd xmm0,xmm0 |
||
1823 | paddd xmm0,xmm1 |
||
1824 | movd eax,xmm0 |
||
1825 | psrldq xmm0,4 |
||
1826 | movd ebx,xmm0 |
||
1827 | psrldq xmm0,4 |
||
1828 | movd ecx,xmm0 |
||
1829 | and eax,0FFFFh |
||
1830 | and ebx,0FFFFh |
||
1831 | and ecx,0FFFFh |
||
1832 | movq mm0,[ebp+eax] |
||
1833 | movq mm1,[ebp+ebx] |
||
1834 | movq mm2,[ebp+ecx] |
||
1835 | movq qword[xx1],mm0 |
||
1836 | movq qword[xx2],mm1 |
||
1837 | movq qword[xx3],mm2 |
||
1838 | ; emms |
||
1839 | end if ; ********************************* |
||
6769 | IgorA | 1840 | if 0 |
1841 | cmp [vertex_edit_no],0 |
||
8014 | leency | 1842 | jne .no_edit |
1843 | mov ax,[vertex_edit_no] |
||
1844 | dec ax |
||
1845 | cmp ax,[point_index1] |
||
1846 | jne @f |
||
1847 | movd mm0,[edit_start_x] |
||
1848 | psubw mm0,[edit_end_x] |
||
1849 | movd mm1,dword[xx1] |
||
1850 | paddw mm1,mm0 |
||
1851 | movd dword[xx1],mm1 |
||
1852 | jmp .no_edit |
||
1853 | @@: |
||
6769 | IgorA | 1854 | |
1855 | |||
8014 | leency | 1856 | jne @f |
1857 | movd mm0,[edit_start_x] |
||
1858 | psubw mm0,[edit_end_x] |
||
1859 | movd mm1,dword[xx2] |
||
1860 | paddw mm1,mm0 |
||
1861 | movd dword[xx2],mm1 |
||
1862 | jmp .no_edit |
||
1863 | @@: |
||
6769 | IgorA | 1864 | |
1865 | |||
8014 | leency | 1866 | jne @f |
1867 | movd mm0,[edit_start_x] |
||
1868 | psubw mm0,[edit_end_x] |
||
1869 | movd mm1,dword[xx3] |
||
1870 | paddw mm1,mm0 |
||
1871 | movd dword[xx3],mm1 |
||
1872 | jmp .no_edit |
||
1873 | @@: |
||
6769 | IgorA | 1874 | |
1875 | |||
1876 | |||
1877 | end if |
||
1878 | |||
8232 | leency | 1879 | |
8014 | leency | 1880 | fninit ; DO culling AT FIRST |
1881 | cmp [culling_flag],1 ; (if culling_flag = 1) |
||
1882 | jne .no_culling |
||
1883 | mov esi,point_index1 ; ********************************* |
||
1884 | mov ecx,3 ; |
||
1885 | @@: |
||
1245 | hidnplayr | 1886 | mov eax,dword[esi] |
8014 | leency | 1887 | lea eax,[eax*3] |
1888 | shl eax,2 |
||
1889 | add eax,[points_normals_rot_ptr] |
||
1890 | ; lea eax,[eax+point_normals_rotated] |
||
1891 | fld dword[eax+8] ; ***************************** |
||
1892 | ftst ; CHECKING OF Z COOFICIENT OF |
||
1893 | fstsw ax ; NORMAL VECTOR |
||
1894 | sahf |
||
1895 | jb @f |
||
1896 | ffree st |
||
1897 | loop @b |
||
1898 | jmp .end_draw ; non visable |
||
1899 | @@: |
||
1245 | hidnplayr | 1900 | ffree st ;is visable |
8014 | leency | 1901 | .no_culling: |
1245 | hidnplayr | 1902 | cmp [dr_flag],0 ; draw type flag |
8014 | leency | 1903 | je .flat_draw |
1904 | cmp [dr_flag],2 |
||
1905 | je .env_mapping |
||
1906 | cmp [dr_flag],3 |
||
1907 | je .bump_mapping |
||
1908 | cmp [dr_flag],4 |
||
1909 | je .tex_mapping |
||
1910 | cmp [dr_flag],5 |
||
1911 | je .rainbow |
||
1912 | cmp [dr_flag],7 |
||
1913 | je .grd_tex |
||
1914 | cmp [dr_flag],8 |
||
1915 | je .two_tex |
||
1916 | cmp [dr_flag],9 |
||
1917 | je .bump_tex |
||
1918 | cmp [dr_flag],10 |
||
1919 | je .cubic_env_mapping |
||
1920 | cmp [dr_flag],11 |
||
1921 | je .draw_smooth_line |
||
1922 | if Ext >= SSE3 |
||
8047 | leency | 1923 | cmp [dr_flag],12 |
1924 | je .r_phg |
||
1925 | cmp [dr_flag],13 |
||
8232 | leency | 1926 | je .glass |
1927 | end if ; **************** |
||
8047 | leency | 1928 | mov esi,point_index3 ; do Gouraud shading |
8014 | leency | 1929 | mov ecx,3 |
1930 | .again_grd_draw: |
||
1245 | hidnplayr | 1931 | mov eax,dword[esi] |
8014 | leency | 1932 | shl eax,2 |
1933 | lea eax,[eax*3] |
||
1934 | add eax,[points_normals_rot_ptr] |
||
1935 | ; texture x=(rotated point normal -> x * 255)+255 |
||
1936 | fld dword[eax] ; x cooficient of normal vector |
||
1937 | fimul [correct_tex] |
||
1938 | fiadd [correct_tex] |
||
1939 | fistp [temp1] |
||
8232 | leency | 1940 | ; texture y=(rotated point normal -> y * 255)+255 |
8014 | leency | 1941 | fld dword[eax+4] ; y cooficient |
1942 | fimul [correct_tex] |
||
1943 | fiadd [correct_tex] |
||
1944 | fistp [temp2] |
||
8232 | leency | 1945 | |
1245 | hidnplayr | 1946 | |
8232 | leency | 1947 | mov ebx,[temp1] |
1948 | and ebx,0xfffffff |
||
1949 | shl eax,TEX_SHIFT |
||
8014 | leency | 1950 | add eax,ebx |
1951 | lea eax,[eax*3+color_map] |
||
1952 | mov eax,dword[eax] |
||
1953 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
||
1954 | ; jne @f |
||
1955 | lea edx,[ecx*3] |
||
1956 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
||
1957 | ; @@: |
||
1958 | ror eax,16 ; eax -0xxxrrggbb -> 0xggbbxxrr |
||
1959 | xor ah,ah |
||
1960 | push ax ;r |
||
1961 | rol eax,8 ; eax-0xggbb00rr -> 0xbb00rrgg |
||
1962 | xor ah,ah |
||
1963 | push ax ;g |
||
1964 | shr eax,24 |
||
1965 | push ax ;b |
||
1966 | |||
1245 | hidnplayr | 1967 | |
8014 | leency | 1968 | dec cx |
1969 | jnz .again_grd_draw |
||
1970 | jmp .both_draw |
||
1971 | |||
1245 | hidnplayr | 1972 | |
8014 | leency | 1973 | ; lea edi,[edi*3] |
1974 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
1975 | ; mov esi,light_vector |
||
1976 | ; call dot_product |
||
1977 | ; fabs |
||
1978 | ; fimul [orginal_color_r] |
||
1979 | ; fistp [temp_col] |
||
1980 | ; and [temp_col],0x00ff |
||
1981 | ; push [temp_col] |
||
1982 | ; push [temp_col] |
||
1983 | ; push [temp_col] |
||
1984 | |||
1245 | hidnplayr | 1985 | |
8014 | leency | 1986 | ; lea edi,[edi*3] |
1987 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
1988 | ; mov esi,light_vector |
||
1989 | ; call dot_product |
||
1990 | ; fabs |
||
1991 | ; fimul [orginal_color_r] |
||
1992 | ; fistp [temp_col] |
||
1993 | ; and [temp_col],0x00ff |
||
1994 | ; push [temp_col] |
||
1995 | ; push [temp_col] |
||
1996 | ; push [temp_col] |
||
1997 | |||
1245 | hidnplayr | 1998 | |
8014 | leency | 1999 | ; lea edi,[edi*3] |
2000 | ; lea edi,[4*edi+point_normals_rotated] ; edi - normal |
||
2001 | ; mov esi,light_vector |
||
2002 | ; call dot_product |
||
2003 | ; fabs |
||
2004 | ; fimul [orginal_color_r] |
||
2005 | ; fistp [temp_col] |
||
2006 | ; and [temp_col],0x00ff |
||
2007 | ; push [temp_col] |
||
2008 | ; push [temp_col] |
||
2009 | ; push [temp_col] |
||
2010 | .rainbow: |
||
1245 | hidnplayr | 2011 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
8232 | leency | 2012 | ; jne @f |
2013 | push [zz3] |
||
8014 | leency | 2014 | @@: |
1245 | hidnplayr | 2015 | mov eax,dword[yy3] |
8014 | leency | 2016 | mov ebx,0x00ff00ff |
2017 | and eax,ebx |
||
2018 | push eax |
||
2019 | neg al |
||
2020 | push ax |
||
2021 | push [zz2] |
||
2022 | |||
8232 | leency | 2023 | |
8014 | leency | 2024 | and eax,ebx |
2025 | push eax |
||
2026 | neg al |
||
2027 | push ax |
||
2028 | push [zz1] |
||
2029 | |||
8232 | leency | 2030 | |
8014 | leency | 2031 | and eax,ebx |
2032 | push eax |
||
2033 | neg al |
||
2034 | push ax |
||
2035 | .both_draw: |
||
1245 | hidnplayr | 2036 | mov eax,dword[xx1] |
8014 | leency | 2037 | ror eax,16 |
2038 | mov ebx,dword[xx2] |
||
2039 | ror ebx,16 |
||
2040 | mov ecx,dword[xx3] |
||
2041 | ror ecx,16 |
||
2042 | mov edi,[screen_ptr] |
||
2043 | mov esi,[Zbuffer_ptr] |
||
2044 | call gouraud_triangle_z |
||
2045 | jmp .end_draw |
||
2046 | |||
1245 | hidnplayr | 2047 | |
8014 | leency | 2048 | fninit ; FLAT DRAWING |
8232 | leency | 2049 | mov eax,[point_index1] |
8014 | leency | 2050 | mov ebx,[point_index2] |
2051 | mov ecx,[point_index3] |
||
2052 | shl eax,2 |
||
2053 | shl ebx,2 |
||
2054 | shl ecx,2 |
||
2055 | lea eax,[eax*3] ;+point_normals_rotated] |
||
2056 | add eax,[points_normals_rot_ptr] |
||
2057 | lea ebx,[ebx*3] ;+point_normals_rotated] |
||
2058 | add ebx,[points_normals_rot_ptr] |
||
2059 | lea ecx,[ecx*3] ;+point_normals_rotated] |
||
2060 | add ecx,[points_normals_rot_ptr] |
||
2061 | fld dword[eax] ; x cooficient of normal vector |
||
2062 | fadd dword[ebx] |
||
2063 | fadd dword[ecx] |
||
2064 | fidiv [i3] |
||
2065 | fimul [correct_tex] |
||
2066 | fiadd [correct_tex] |
||
2067 | fistp [temp1] ;dword[esp-4] ; x temp variables |
||
8232 | leency | 2068 | fld dword[eax+4] ; y cooficient of normal vector |
8014 | leency | 2069 | fadd dword[ebx+4] |
2070 | fadd dword[ecx+4] |
||
2071 | fidiv [i3] |
||
2072 | fimul [correct_tex] |
||
2073 | fiadd [correct_tex] |
||
2074 | fistp [temp2] ;dword[esp-8] ; y |
||
8232 | leency | 2075 | mov edx,[temp2] ;dword[esp-8] |
2076 | and edx,0xfffffff |
||
2077 | and [temp1],0xfffffff |
||
2078 | shl edx,TEX_SHIFT |
||
8014 | leency | 2079 | add edx,[temp1] ;dword[esp-4] |
8232 | leency | 2080 | |
2081 | |||
8014 | leency | 2082 | add eax,color_map |
2083 | mov edx,dword[eax] |
||
2084 | |||
1245 | hidnplayr | 2085 | |
8014 | leency | 2086 | |
1245 | hidnplayr | 2087 | |
2088 | |||
2089 | |||
8014 | leency | 2090 | ; add ax,[zz2] |
2091 | ; add ax,[zz3] |
||
2092 | ; cwd |
||
2093 | ; idiv [i3] ; = -((a+b+c)/3+130) |
||
2094 | ; add ax,130 |
||
2095 | ; neg al |
||
2096 | ; xor edx,edx |
||
2097 | ; mov ah,al ;set color according to z position |
||
2098 | ; shl eax,8 |
||
2099 | ; mov edx,eax |
||
2100 | |||
1245 | hidnplayr | 2101 | |
8014 | leency | 2102 | ror eax,16 |
2103 | mov ebx,dword[xx2] |
||
2104 | ror ebx,16 |
||
2105 | mov ecx,dword[xx3] |
||
2106 | ror ecx,16 |
||
2107 | mov edi,[screen_ptr] |
||
2108 | |||
8232 | leency | 2109 | |
8014 | leency | 2110 | push word[zz3] |
2111 | push word[zz2] |
||
2112 | push word[zz1] |
||
2113 | call flat_triangle_z |
||
2114 | jmp .end_draw |
||
2115 | |||
8232 | leency | 2116 | |
1245 | hidnplayr | 2117 | push [zz3] |
8014 | leency | 2118 | push [zz2] |
2119 | push [zz1] |
||
2120 | |||
8232 | leency | 2121 | |
8014 | leency | 2122 | sub esp,12 |
2123 | mov edi,esp |
||
2124 | mov ecx,3 |
||
2125 | @@: |
||
1245 | hidnplayr | 2126 | mov eax,dword[esi] |
8014 | leency | 2127 | lea eax,[eax*3] |
2128 | shl eax,2 |
||
2129 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
||
2130 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2131 | fld dword[eax] |
||
2132 | fimul [correct_tex] |
||
2133 | fiadd [correct_tex] |
||
2134 | fistp word[edi] |
||
2135 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2136 | fld dword[eax+4] |
||
2137 | fimul [correct_tex] |
||
2138 | fiadd [correct_tex] |
||
2139 | fistp word[edi+2] |
||
2140 | |||
8232 | leency | 2141 | |
8014 | leency | 2142 | add esi,4 |
2143 | loop @b |
||
2144 | |||
1245 | hidnplayr | 2145 | |
8014 | leency | 2146 | ror eax,16 |
2147 | mov ebx,dword[xx2] |
||
2148 | ror ebx,16 |
||
2149 | mov ecx,dword[xx3] |
||
2150 | ror ecx,16 |
||
2151 | mov edi,[screen_ptr] |
||
2152 | mov esi,envmap |
||
2153 | |||
2154 | |||
2155 | call tex_triangle_z |
||
2156 | |||
8232 | leency | 2157 | |
8014 | leency | 2158 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1245 | hidnplayr | 2159 | .cubic_env_mapping: |
2160 | push [zz3] |
||
8014 | leency | 2161 | push [zz2] |
2162 | push [zz1] |
||
2163 | |||
8232 | leency | 2164 | |
8014 | leency | 2165 | sub esp,12 |
2166 | mov edi,esp |
||
2167 | mov ecx,3 |
||
2168 | @@: |
||
1245 | hidnplayr | 2169 | mov eax,dword[esi] |
8014 | leency | 2170 | lea eax,[eax*3] |
2171 | shl eax,2 |
||
2172 | add eax,[points_normals_rot_ptr] |
||
8232 | leency | 2173 | |
2174 | |||
8014 | leency | 2175 | fmul dword[eax+4] |
2176 | fld1 |
||
2177 | fld1 |
||
2178 | faddp |
||
2179 | fmulp |
||
2180 | fimul [correct_tex] |
||
2181 | fiadd [correct_tex] |
||
2182 | fistp word[edi] |
||
2183 | mov word[edi+2],0 |
||
2184 | ; fistp word[edi+2] |
||
2185 | ; # last change |
||
1245 | hidnplayr | 2186 | ; ; texture x=(rotated point normal -> x * 255)+255 |
8014 | leency | 2187 | ; fld dword[eax] |
2188 | ; fimul [correct_tex] |
||
2189 | ; fiadd [correct_tex] |
||
2190 | ; fistp word[edi] |
||
2191 | ; ; texture y=(rotated point normal -> y * 255)+255 |
||
2192 | ; fld dword[eax+4] |
||
2193 | ; fimul [correct_tex] |
||
2194 | ; fiadd [correct_tex] |
||
2195 | ; fistp word[edi+2] |
||
2196 | ; # end of last ch. |
||
1245 | hidnplayr | 2197 | add edi,4 |
8014 | leency | 2198 | add esi,4 |
2199 | loop @b |
||
2200 | |||
1245 | hidnplayr | 2201 | |
8014 | leency | 2202 | ror eax,16 |
2203 | mov ebx,dword[xx2] |
||
2204 | ror ebx,16 |
||
2205 | mov ecx,dword[xx3] |
||
2206 | ror ecx,16 |
||
2207 | mov edi,[screen_ptr] |
||
2208 | mov esi,envmap_cub |
||
2209 | mov edx,[Zbuffer_ptr] |
||
2210 | |||
8232 | leency | 2211 | |
8014 | leency | 2212 | |
8232 | leency | 2213 | |
8014 | leency | 2214 | |
1245 | hidnplayr | 2215 | |
2216 | |||
2217 | |||
2218 | |||
8014 | leency | 2219 | |
2220 | push [zz3] |
||
2221 | push [zz2] |
||
2222 | push [zz1] |
||
2223 | |||
8232 | leency | 2224 | |
8014 | leency | 2225 | sub esp,12 |
2226 | mov edi,esp |
||
2227 | mov ecx,3 |
||
2228 | @@: |
||
1245 | hidnplayr | 2229 | mov eax,dword[esi] |
8014 | leency | 2230 | lea eax,[eax*3] |
2231 | shl eax,2 |
||
2232 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
||
2233 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2234 | fld dword[eax] |
||
2235 | fimul [correct_tex] |
||
2236 | fiadd [correct_tex] |
||
2237 | fistp word[edi] |
||
2238 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2239 | fld dword[eax+4] |
||
2240 | fimul [correct_tex] |
||
2241 | fiadd [correct_tex] |
||
2242 | fistp word[edi+2] |
||
2243 | |||
1245 | hidnplayr | 2244 | |
8014 | leency | 2245 | add esi,4 |
2246 | loop @b |
||
2247 | |||
1245 | hidnplayr | 2248 | |
8014 | leency | 2249 | shl esi,2 |
2250 | add esi,tex_points |
||
2251 | push dword[esi] |
||
2252 | mov esi,[point_index2] |
||
2253 | shl esi,2 |
||
2254 | add esi,tex_points |
||
2255 | ; lea esi,[esi*3] |
||
2256 | ; lea esi,[points+2+esi*2] |
||
2257 | push dword[esi] |
||
2258 | ; push dword[xx2] |
||
2259 | mov esi,[point_index1] |
||
2260 | shl esi,2 |
||
2261 | add esi,tex_points |
||
2262 | ; lea esi,[esi*3] |
||
2263 | ; lea esi,[points+2+esi*2] |
||
2264 | push dword[esi] |
||
2265 | ; push dword[xx1] |
||
2266 | |||
1245 | hidnplayr | 2267 | |
8014 | leency | 2268 | ror eax,16 |
2269 | mov ebx,dword[xx2] |
||
2270 | ror ebx,16 |
||
2271 | mov ecx,dword[xx3] |
||
2272 | ror ecx,16 |
||
2273 | mov edi,[screen_ptr] |
||
2274 | mov esi,envmap |
||
2275 | mov edx,bumpmap ;BUMP_MAPPING |
||
2276 | |||
1245 | hidnplayr | 2277 | |
8014 | leency | 2278 | |
8232 | leency | 2279 | |
8014 | leency | 2280 | |
1245 | hidnplayr | 2281 | |
2282 | |||
2283 | |||
8014 | leency | 2284 | push [zz2] |
2285 | push [zz1] |
||
2286 | ; @@: |
||
2287 | mov esi,[point_index3] ; tex map coords |
||
2288 | shl esi,2 |
||
2289 | add esi,tex_points |
||
2290 | push dword[esi] |
||
2291 | mov esi,[point_index2] |
||
2292 | shl esi,2 |
||
2293 | add esi,tex_points |
||
2294 | push dword[esi] |
||
2295 | mov esi,[point_index1] |
||
2296 | shl esi,2 |
||
2297 | add esi,tex_points |
||
2298 | push dword[esi] |
||
2299 | |||
1245 | hidnplayr | 2300 | |
8014 | leency | 2301 | ror eax,16 |
2302 | mov ebx,dword[xx2] |
||
2303 | ror ebx,16 |
||
2304 | mov ecx,dword[xx3] |
||
2305 | ror ecx,16 |
||
2306 | mov edi,[screen_ptr] |
||
2307 | mov esi,texmap |
||
2308 | mov edx,[Zbuffer_ptr] |
||
2309 | |||
8232 | leency | 2310 | |
8014 | leency | 2311 | |
8232 | leency | 2312 | |
8014 | leency | 2313 | ; .ray: |
1245 | hidnplayr | 2314 | ; grd_triangle according to points index |
8014 | leency | 2315 | ; cmp [catmull_flag],0 |
2316 | ; je @f |
||
2317 | ; push [zz3] ; spot light with attenuation |
||
2318 | ; @@: |
||
1245 | hidnplayr | 2319 | ; movzx eax,[point_index3] ; env_map - points color list |
8014 | leency | 2320 | ; shl eax,1 ; each color as word, 0x00rr00gg00bb.. |
2321 | ; lea eax,[3*eax+bumpmap] |
||
2322 | ; push word[eax] |
||
2323 | ; push word[eax+2] |
||
2324 | ; push word[eax+4] |
||
2325 | ; cmp [catmull_flag],0 |
||
2326 | ; je @f |
||
2327 | ; push [zz2] |
||
2328 | ; @@: |
||
1245 | hidnplayr | 2329 | ; movzx eax,[point_index2] ; env_map - points color list |
8014 | leency | 2330 | ; shl eax,1 ; each color as word, 0x00rr00gg00bb.. |
2331 | ; lea eax,[eax*3+bumpmap] |
||
2332 | ; push word[eax] |
||
2333 | ; push word[eax+2] |
||
2334 | ; push word[eax+4] |
||
2335 | ; cmp [catmull_flag],0 |
||
2336 | ; je @f |
||
2337 | ; push [zz1] |
||
2338 | ; @@: |
||
1245 | hidnplayr | 2339 | ; movzx eax,[point_index1] ; env_map - points color list |
8014 | leency | 2340 | ; shl eax,1 ; each color as word, 0xrr00gg00bb00.. |
2341 | ; lea eax,[eax*3+bumpmap] |
||
2342 | ; push word[eax] |
||
2343 | ; push word[eax+2] |
||
2344 | ; push word[eax+4] |
||
2345 | ; jmp .both_draw |
||
2346 | |||
1245 | hidnplayr | 2347 | |
8014 | leency | 2348 | push ebp |
2349 | mov ebp,esp |
||
2350 | sub esp,4 |
||
2351 | push ebp |
||
2352 | |||
1245 | hidnplayr | 2353 | |
8014 | leency | 2354 | shl esi,2 |
2355 | add esi,tex_points |
||
2356 | push dword[esi] ; texture coords as first |
||
2357 | mov esi,[point_index2] ; group of parameters |
||
2358 | shl esi,2 |
||
2359 | add esi,tex_points |
||
2360 | push dword[esi] |
||
2361 | mov esi,[point_index1] |
||
2362 | shl esi,2 |
||
2363 | add esi,tex_points |
||
2364 | push dword[esi] |
||
2365 | |||
1245 | hidnplayr | 2366 | |
8014 | leency | 2367 | mov ecx,3 |
2368 | |||
1245 | hidnplayr | 2369 | |
2370 | |||
2371 | |||
8014 | leency | 2372 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
2373 | fninit |
||
8232 | leency | 2374 | mov eax,dword[esi] |
8014 | leency | 2375 | shl eax,2 |
2376 | lea eax,[eax*3] ;+point_normals_rotated] |
||
2377 | add eax,[points_normals_rot_ptr] |
||
2378 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2379 | fld dword[eax] ; x cooficient of normal vector |
||
2380 | fimul [correct_tex] |
||
2381 | fiadd [correct_tex] |
||
2382 | fistp [temp1] ;word[ebp-2] |
||
8232 | leency | 2383 | ; texture y=(rotated point normal -> y * 255)+255 |
8014 | leency | 2384 | fld dword[eax+4] ; y cooficient |
2385 | fimul [correct_tex] |
||
2386 | fiadd [correct_tex] |
||
2387 | fistp [temp2] ;word[ebp-4] |
||
8232 | leency | 2388 | |
1245 | hidnplayr | 2389 | |
8232 | leency | 2390 | mov ebx,[temp1] ;word[ebp-2] |
2391 | and ebx,0xfffffff ; some onjects need thid 'and' |
||
2392 | shl eax,TEX_SHIFT |
||
8014 | leency | 2393 | add eax,ebx |
2394 | lea eax,[eax*3] |
||
8232 | leency | 2395 | add eax,color_map |
2396 | mov eax,dword[eax] |
||
8014 | leency | 2397 | |
1245 | hidnplayr | 2398 | |
8014 | leency | 2399 | xor ah,ah |
2400 | push ax ;r |
||
2401 | rol eax,8 ; eax-0xggbb00rr -> 0xbb00rrgg |
||
2402 | xor ah,ah |
||
2403 | push ax ;g |
||
2404 | shr eax,24 |
||
2405 | push ax ;b |
||
2406 | |||
1245 | hidnplayr | 2407 | |
8014 | leency | 2408 | dec cx |
2409 | jnz .aagain_grd_draw |
||
2410 | |||
1245 | hidnplayr | 2411 | |
8014 | leency | 2412 | ror eax,16 |
2413 | mov ebx,dword[xx2] |
||
2414 | ror ebx,16 |
||
2415 | mov ecx,dword[xx3] |
||
2416 | ror ecx,16 |
||
2417 | mov edi,[screen_ptr] |
||
2418 | mov edx,texmap |
||
2419 | mov esi,[Zbuffer_ptr] |
||
2420 | |||
1245 | hidnplayr | 2421 | |
8014 | leency | 2422 | |
1245 | hidnplayr | 2423 | |
8014 | leency | 2424 | mov esp,ebp |
2425 | pop ebp |
||
2426 | jmp .end_draw |
||
2427 | |||
1245 | hidnplayr | 2428 | |
2429 | push [Zbuffer_ptr] |
||
8014 | leency | 2430 | |
1245 | hidnplayr | 2431 | |
8014 | leency | 2432 | push word[zz2] |
2433 | push word[zz1] |
||
2434 | |||
1245 | hidnplayr | 2435 | |
8014 | leency | 2436 | shl esi,2 |
2437 | add esi,tex_points |
||
2438 | push dword[esi] |
||
2439 | mov esi,[point_index2] |
||
2440 | shl esi,2 |
||
2441 | add esi,tex_points |
||
2442 | push dword[esi] |
||
2443 | mov esi,[point_index1] |
||
2444 | shl esi,2 |
||
2445 | add esi,tex_points |
||
2446 | push dword[esi] |
||
2447 | |||
1245 | hidnplayr | 2448 | |
8014 | leency | 2449 | sub esp,12 |
2450 | mov edi,esp |
||
2451 | mov ecx,3 |
||
2452 | @@: |
||
1245 | hidnplayr | 2453 | mov eax,dword[esi] |
8014 | leency | 2454 | lea eax,[eax*3] |
2455 | shl eax,2 |
||
2456 | add eax,[points_normals_rot_ptr] |
||
2457 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2458 | fld dword[eax] |
||
2459 | fimul [correct_tex] |
||
2460 | fiadd [correct_tex] |
||
2461 | fistp word[edi] |
||
2462 | |||
8232 | leency | 2463 | |
8014 | leency | 2464 | fld dword[eax+4] |
2465 | fimul [correct_tex] |
||
2466 | fiadd [correct_tex] |
||
2467 | fistp word[edi+2] |
||
2468 | and word[edi+2],0x7fff ; some objects need it |
||
8232 | leency | 2469 | add edi,4 |
8014 | leency | 2470 | add esi,4 |
2471 | loop @b |
||
2472 | |||
1245 | hidnplayr | 2473 | |
8014 | leency | 2474 | ror eax,16 |
2475 | mov ebx,dword[xx2] |
||
2476 | ror ebx,16 |
||
2477 | mov ecx,dword[xx3] |
||
2478 | ror ecx,16 |
||
2479 | mov edi,[screen_ptr] |
||
2480 | mov esi,texmap |
||
2481 | mov edx,envmap |
||
2482 | |||
1245 | hidnplayr | 2483 | |
8014 | leency | 2484 | jmp .end_draw |
2485 | |||
1245 | hidnplayr | 2486 | |
2487 | mov esi,[point_index3] ; tex map coords |
||
8014 | leency | 2488 | shl esi,2 |
2489 | add esi,tex_points |
||
2490 | push dword[esi] |
||
2491 | mov esi,[point_index2] |
||
2492 | shl esi,2 |
||
2493 | add esi,tex_points |
||
2494 | push dword[esi] |
||
2495 | mov esi,[point_index1] |
||
2496 | shl esi,2 |
||
2497 | add esi,tex_points |
||
2498 | push dword[esi] |
||
2499 | |||
1245 | hidnplayr | 2500 | |
8014 | leency | 2501 | |
1245 | hidnplayr | 2502 | |
8014 | leency | 2503 | xor edi,edi |
2504 | |||
1245 | hidnplayr | 2505 | |
8014 | leency | 2506 | push word[zz2] |
2507 | push word[zz1] |
||
2508 | |||
1245 | hidnplayr | 2509 | |
8014 | leency | 2510 | sub esp,12 |
2511 | mov edi,esp |
||
2512 | mov ecx,3 |
||
2513 | @@: |
||
1245 | hidnplayr | 2514 | mov eax,dword[esi] |
8014 | leency | 2515 | lea eax,[eax*3] |
2516 | shl eax,2 |
||
2517 | add eax,[points_normals_rot_ptr] |
||
2518 | ; texture x=(rotated point normal -> x * 255)+255 |
||
2519 | fld dword[eax] |
||
2520 | fimul [correct_tex] |
||
2521 | fiadd [correct_tex] |
||
2522 | fistp word[edi] |
||
2523 | ; texture y=(rotated point normal -> y * 255)+255 |
||
2524 | fld dword[eax+4] |
||
2525 | fimul [correct_tex] |
||
2526 | fiadd [correct_tex] |
||
2527 | fistp word[edi+2] |
||
2528 | |||
1245 | hidnplayr | 2529 | |
8014 | leency | 2530 | add esi,4 |
2531 | loop @b |
||
2532 | |||
1245 | hidnplayr | 2533 | |
8014 | leency | 2534 | ; push dword 127 shl 16 + 1 |
2535 | ; push dword 127 shl 16 + 127 |
||
2536 | |||
1245 | hidnplayr | 2537 | |
8014 | leency | 2538 | shl esi,2 |
2539 | add esi,tex_points |
||
2540 | push dword[esi] |
||
2541 | mov esi,[point_index2] |
||
2542 | shl esi,2 |
||
2543 | add esi,tex_points |
||
2544 | push dword[esi] |
||
2545 | |||
1245 | hidnplayr | 2546 | |
8014 | leency | 2547 | shl esi,2 |
2548 | add esi,tex_points |
||
2549 | push dword[esi] |
||
2550 | |||
1245 | hidnplayr | 2551 | |
8014 | leency | 2552 | ; push dword 127 shl 16 + 127 |
2553 | ; push dword 1 shl 16 + 1 ; bump coords |
||
2554 | |||
1245 | hidnplayr | 2555 | |
8014 | leency | 2556 | ror eax,16 |
2557 | mov ebx,dword[xx2] |
||
2558 | ror ebx,16 |
||
2559 | mov ecx,dword[xx3] |
||
2560 | ror ecx,16 |
||
2561 | mov edi,[screen_ptr] |
||
2562 | mov esi,envmap |
||
2563 | mov edx,bumpmap |
||
2564 | |||
1245 | hidnplayr | 2565 | |
8014 | leency | 2566 | |
1245 | hidnplayr | 2567 | |
8014 | leency | 2568 | |
2881 | leency | 2569 | |
2570 | mov esi,point_index3 |
||
8014 | leency | 2571 | mov ecx,3 |
2572 | .again_line_param: |
||
2881 | leency | 2573 | mov eax,dword[esi] |
8014 | leency | 2574 | shl eax,2 |
2575 | lea eax,[eax*3] |
||
2576 | add eax,[points_normals_rot_ptr] |
||
2577 | ; texture ;x=(rotated point normal -> x * 255)+255 |
||
2578 | fld dword[eax] ; x cooficient of normal vector |
||
2579 | fimul [correct_tex] |
||
2580 | fiadd [correct_tex] |
||
2581 | fistp [temp1] ;word[esp-2] |
||
8232 | leency | 2582 | ; texture y=(rotated point normal -> y * 255)+255 |
8014 | leency | 2583 | fld dword[eax+4] ; y cooficient |
2584 | fimul [correct_tex] |
||
2585 | fiadd [correct_tex] |
||
2586 | fistp [temp2] ;word[esp-4] |
||
8232 | leency | 2587 | |
2881 | leency | 2588 | |
8232 | leency | 2589 | mov ebx,[temp1] ;word[esp-2] |
2590 | and ebx,0xfffffff |
||
2591 | shl eax,TEX_SHIFT |
||
8014 | leency | 2592 | add eax,ebx |
2593 | lea eax,[eax*3+color_map] |
||
2594 | mov eax,dword[eax] |
||
2595 | lea ebx,[ecx-1] |
||
2596 | shl ebx,2 |
||
2597 | mov [ebx+col1],eax |
||
2598 | |||
2881 | leency | 2599 | |
8014 | leency | 2600 | dec ecx |
2601 | jnz .again_line_param |
||
2602 | |||
2881 | leency | 2603 | |
8014 | leency | 2604 | mov esi,[Zbuffer_ptr] |
2605 | |||
2881 | leency | 2606 | |
8014 | leency | 2607 | movzx bx,al |
2608 | push bx ; b |
||
2609 | movzx bx,ah |
||
2610 | push bx |
||
2611 | rol eax,16 |
||
2612 | xor ah,ah |
||
2613 | push ax |
||
2614 | push [zz1] |
||
2615 | push [yy1] |
||
2616 | push [xx1] |
||
2617 | |||
2881 | leency | 2618 | |
8014 | leency | 2619 | movzx bx,al |
2620 | push bx ; b |
||
2621 | movzx bx,ah |
||
2622 | push bx |
||
2623 | rol eax,16 |
||
2624 | xor ah,ah |
||
2625 | push ax |
||
2626 | push [zz2] |
||
2627 | push [yy2] |
||
2628 | push [xx2] |
||
2629 | |||
2881 | leency | 2630 | |
8014 | leency | 2631 | @@: |
2881 | leency | 2632 | |
2633 | |||
8014 | leency | 2634 | mov esi,[Zbuffer_ptr] |
2635 | |||
2881 | leency | 2636 | |
8014 | leency | 2637 | movzx bx,al |
2638 | push bx ; b |
||
2639 | movzx bx,ah |
||
2640 | push bx |
||
2641 | rol eax,16 |
||
2642 | xor ah,ah |
||
2643 | push ax |
||
2644 | push [zz1] |
||
2645 | push [yy1] |
||
2646 | push [xx1] |
||
2647 | |||
2881 | leency | 2648 | |
8014 | leency | 2649 | movzx bx,al |
2650 | push bx ; b |
||
2651 | movzx bx,ah |
||
2652 | push bx |
||
2653 | rol eax,16 |
||
2654 | xor ah,ah |
||
2655 | push ax |
||
2656 | push [zz3] |
||
2657 | push [yy3] |
||
2658 | push [xx3] |
||
2659 | |||
2881 | leency | 2660 | |
8014 | leency | 2661 | @@: |
2881 | leency | 2662 | |
2663 | |||
2664 | |||
8014 | leency | 2665 | mov esi,[Zbuffer_ptr] |
2666 | |||
2881 | leency | 2667 | |
8014 | leency | 2668 | movzx bx,al |
2669 | push bx ; b |
||
2670 | movzx bx,ah |
||
2671 | push bx |
||
2672 | rol eax,16 |
||
2673 | xor ah,ah |
||
2674 | push ax |
||
2675 | push [zz3] |
||
2676 | push [yy3] |
||
2677 | push [xx3] |
||
2678 | |||
2881 | leency | 2679 | |
8014 | leency | 2680 | movzx bx,al |
2681 | push bx ; b |
||
2682 | movzx bx,ah |
||
2683 | push bx |
||
2684 | rol eax,16 |
||
2685 | xor ah,ah |
||
2686 | push ax |
||
2687 | push [zz2] |
||
2688 | push [yy2] |
||
2689 | push [xx2] |
||
2690 | |||
2881 | leency | 2691 | |
8014 | leency | 2692 | jmp .end_draw |
8047 | leency | 2693 | @@: |
2881 | leency | 2694 | |
8232 | leency | 2695 | |
2696 | .r_phg: |
||
8047 | leency | 2697 | |
2881 | leency | 2698 | |
8047 | leency | 2699 | |
2700 | punpcklwd xmm5,[the_zero] |
||
2701 | pshufd xmm5,xmm5,01110011b |
||
2702 | |||
2703 | |||
2704 | |||
2705 | mov ebx,[point_index2] |
||
2706 | mov ecx,[point_index3] |
||
2707 | imul eax,[i12] |
||
2708 | imul ebx,[i12] |
||
2709 | imul ecx,[i12] |
||
2710 | add eax,[points_normals_rot_ptr] |
||
2711 | add ebx,[points_normals_rot_ptr] |
||
2712 | add ecx,[points_normals_rot_ptr] |
||
2713 | movups xmm0,[eax] |
||
2714 | movups xmm1,[ebx] |
||
2715 | movups xmm2,[ecx] |
||
2716 | andps xmm0,[zero_hgst_dd] |
||
2717 | andps xmm1,[zero_hgst_dd] |
||
2718 | andps xmm2,[zero_hgst_dd] |
||
2719 | xorps xmm3,xmm3 |
||
2720 | |||
2721 | |||
2722 | mov ebx,[point_index2] |
||
2723 | mov ecx,[point_index3] |
||
2724 | imul eax,[i12] |
||
2725 | imul ebx,[i12] |
||
2726 | imul ecx,[i12] |
||
2727 | add eax,[points_rotated_ptr] |
||
2728 | add ebx,[points_rotated_ptr] |
||
2729 | add ecx,[points_rotated_ptr] |
||
2730 | push dword[ecx+8] |
||
2731 | push dword[ebx+8] |
||
2732 | push dword[eax+8] |
||
2733 | movups xmm4,[esp] |
||
2734 | add esp,12 |
||
2735 | andps xmm4,[zero_hgst_dd] |
||
2736 | |||
2737 | |||
2738 | |||
2739 | |||
2740 | ror eax,16 |
||
2741 | mov ebx,dword[xx2] |
||
2742 | ror ebx,16 |
||
2743 | mov ecx,dword[xx3] |
||
2744 | ror ecx,16 |
||
2745 | mov edi,[screen_ptr] |
||
2746 | mov esi,[Zbuffer_ptr] |
||
2747 | |||
2748 | |||
2749 | |||
2750 | |||
2751 | |||
2752 | |||
8232 | leency | 2753 | |
8047 | leency | 2754 | |
8232 | leency | 2755 | punpcklwd xmm5,[the_zero] |
2756 | pshufd xmm5,xmm5,01110011b |
||
2757 | |||
8047 | leency | 2758 | |
2759 | |||
8232 | leency | 2760 | mov ebx,[point_index2] |
2761 | mov ecx,[point_index3] |
||
2762 | imul eax,[i12] |
||
2763 | imul ebx,[i12] |
||
2764 | imul ecx,[i12] |
||
2765 | add eax,[points_normals_rot_ptr] |
||
2766 | add ebx,[points_normals_rot_ptr] |
||
2767 | add ecx,[points_normals_rot_ptr] |
||
2768 | movups xmm0,[eax] |
||
2769 | movups xmm1,[ebx] |
||
2770 | movups xmm2,[ecx] |
||
2771 | andps xmm0,[zero_hgst_dd] |
||
2772 | andps xmm1,[zero_hgst_dd] |
||
2773 | andps xmm2,[zero_hgst_dd] |
||
2774 | xorps xmm3,xmm3 |
||
2775 | |||
8047 | leency | 2776 | |
8232 | leency | 2777 | mov ebx,[point_index2] |
2778 | mov ecx,[point_index3] |
||
2779 | imul eax,[i12] |
||
2780 | imul ebx,[i12] |
||
2781 | imul ecx,[i12] |
||
2782 | add eax,[points_rotated_ptr] |
||
2783 | add ebx,[points_rotated_ptr] |
||
2784 | add ecx,[points_rotated_ptr] |
||
2785 | push dword[ecx+8] |
||
2786 | push dword[ebx+8] |
||
2787 | push dword[eax+8] |
||
2788 | movups xmm4,[esp] |
||
2789 | add esp,12 |
||
2790 | andps xmm4,[zero_hgst_dd] |
||
2791 | |||
8047 | leency | 2792 | |
2793 | |||
2794 | |||
8232 | leency | 2795 | ror eax,16 |
2796 | mov ebx,dword[xx2] |
||
2797 | ror ebx,16 |
||
2798 | mov ecx,dword[xx3] |
||
2799 | ror ecx,16 |
||
2800 | mov edi,[screen_ptr] |
||
2801 | mov esi,[Zbuffer_ptr] |
||
2802 | |||
2803 | |||
2804 | |||
2805 | |||
2806 | end if |
||
2807 | |||
2808 | |||
2809 | |||
2810 | |||
2811 | |||
1245 | hidnplayr | 2812 | pop esi |
8014 | leency | 2813 | add esi,12 |
2814 | |||
8232 | leency | 2815 | |
8014 | leency | 2816 | sub ecx,1 |
2817 | |||
8232 | leency | 2818 | |
8014 | leency | 2819 | ret |
1245 | hidnplayr | 2820 | |
2821 | |||
2822 | |||
6769 | IgorA | 2823 | |
2824 | |||
2825 | |||
2826 | |||
2827 | |||
8014 | leency | 2828 | |
2829 | |||
2830 | |||
2831 | |||
6769 | IgorA | 2832 | |
2833 | |||
2834 | mov ebp,esp |
||
2835 | |||
2836 | |||
2837 | .xres3m18 equ ebp-8 |
||
2838 | .xres2m12 equ ebp-12 |
||
2839 | |||
2840 | |||
2841 | |||
2842 | sub esp,12 |
||
2843 | push dword 0 |
||
2844 | |||
2845 | |||
2846 | cmp [dr_flag],12 |
||
8047 | leency | 2847 | jge @f |
8232 | leency | 2848 | lea ebx,[eax*3] |
6769 | IgorA | 2849 | sub ebx,18 |
2850 | add eax,eax |
||
2851 | sub eax,12 |
||
2852 | mov [.xres3m18],ebx |
||
2853 | mov [.xres2m12],eax |
||
2854 | jmp .f |
||
8047 | leency | 2855 | @@: |
2856 | lea ebx,[eax*4] |
||
2857 | sub ebx,4*6 |
||
2858 | add eax,eax |
||
2859 | sub eax,3*4 |
||
2860 | mov [.xres3m18],ebx |
||
2861 | mov [.xres2m12],eax |
||
2862 | .f: |
||
2863 | |||
6769 | IgorA | 2864 | |
8047 | leency | 2865 | |
2866 | |||
6769 | IgorA | 2867 | .loop: |
2868 | push esi |
||
2869 | ; DO culling AT FIRST |
||
8014 | leency | 2870 | cmp [culling_flag],1 ; (if culling_flag = 1) |
2871 | jne .no_culling |
||
2872 | mov edi,[.counter] ; ********************************* |
||
2873 | lea edi,[edi*3] |
||
2874 | shl edi,2 |
||
2875 | add edi,[points_normals_rot_ptr] |
||
2876 | mov eax,[edi+8] ; check sign of z coof |
||
2877 | shr eax,31 |
||
2878 | cmp eax,1 |
||
2879 | jnz .skip |
||
2880 | .no_culling: |
||
6769 | IgorA | 2881 | mov eax,[esi] |
2882 | movzx ebx,ax ; ebx - x |
||
8014 | leency | 2883 | shr eax,16 ; eax - y |
2884 | cmp eax,4 ; check if markers not exceedes screen |
||
2885 | jle .skip |
||
6769 | IgorA | 2886 | cmp ebx,4 |
2887 | jle .skip |
||
2888 | movzx edx,word[size_x_var] |
||
2889 | sub edx,4 |
||
2890 | movzx ecx,word[size_y_var] |
||
2891 | sub ecx,4 |
||
2892 | cmp ebx,edx |
||
2893 | jge .skip |
||
2894 | cmp eax,ecx |
||
2895 | jge .skip |
||
2896 | |||
2897 | |||
2898 | ; sub ebx,3 |
||
8014 | leency | 2899 | ; sub eax,3 |
2900 | imul eax,edx |
||
6769 | IgorA | 2901 | add eax,ebx |
2902 | push eax |
||
8047 | leency | 2903 | lea edi,[eax*3] |
6769 | IgorA | 2904 | cmp [dr_flag],12 |
8047 | leency | 2905 | jl @f |
8232 | leency | 2906 | add edi,[esp] |
8047 | leency | 2907 | @@: |
2908 | add esp,4 |
||
2909 | lea eax,[eax*2] |
||
6769 | IgorA | 2910 | ; draw bar 6x6 |
2911 | add edi,[screen_ptr] |
||
2912 | add eax,dword[vertices_index_ptr] |
||
2913 | |||
2914 | |||
2915 | |||
2916 | |||
2917 | |||
2918 | mov ecx,6 |
||
2919 | |||
2920 | |||
2921 | push ecx |
||
2922 | mov ecx,6 |
||
2923 | |||
2924 | |||
8047 | leency | 2925 | mov word[edi],0x0000 ;ax |
6769 | IgorA | 2926 | mov byte[edi+2],0xff ;al |
8014 | leency | 2927 | mov word[eax],dx |
6769 | IgorA | 2928 | add eax,2 |
2929 | cmp [dr_flag],12 |
||
8047 | leency | 2930 | jl @f |
8232 | leency | 2931 | add edi,4 |
8047 | leency | 2932 | loop .do |
2933 | jmp .ad |
||
2934 | @@: |
||
2935 | add edi,3 |
||
6769 | IgorA | 2936 | loop .do |
8047 | leency | 2937 | .ad: |
2938 | add edi,[.xres3m18] |
||
6769 | IgorA | 2939 | add eax,[.xres2m12] |
2940 | pop ecx |
||
2941 | loop .oop |
||
2942 | |||
2943 | |||
2944 | pop esi |
||
2945 | add esi,6 |
||
2946 | inc dword[.counter] |
||
2947 | mov ecx,[.counter] |
||
2948 | cmp ecx,[points_count_var] |
||
8014 | leency | 2949 | jng .loop |
6769 | IgorA | 2950 | |
2951 | |||
2952 | pop ebp |
||
2953 | |||
2954 | |||
2955 | |||
2956 | |||
2957 | |||
1245 | hidnplayr | 2958 | mov eax,0x70000000 |
8014 | leency | 2959 | cmp [dr_flag],12 |
8047 | leency | 2960 | jne @f |
2961 | mov eax,60000.1 |
||
2962 | @@: |
||
2963 | mov edi,[Zbuffer_ptr] |
||
8014 | leency | 2964 | movzx ecx,word[size_x_var] |
2965 | movzx ebx,word[size_y_var] |
||
2966 | imul ecx,ebx |
||
2967 | if Ext>=SSE2 |
||
6619 | leency | 2968 | movd xmm0,eax |
8014 | leency | 2969 | shufps xmm0,xmm0,0 |
2970 | push ecx |
||
2971 | mov ecx,edi |
||
2972 | and edi,0xffffff00 |
||
2973 | and ecx,0x000000ff |
||
2974 | mov edx,ecx |
||
2975 | rep stosd |
||
2976 | pop ecx |
||
2977 | sub ecx,edx |
||
2978 | @@: |
||
6619 | leency | 2979 | movaps [edi],xmm0 |
8014 | leency | 2980 | movaps [edi+16],xmm0 |
2981 | movaps [edi+32],xmm0 |
||
2982 | movaps [edi+48],xmm0 |
||
2983 | add edi,64 |
||
2984 | sub ecx,16 |
||
2985 | jnc @b |
||
2986 | else |
||
6619 | leency | 2987 | rep stosd |
8014 | leency | 2988 | end if |
6619 | leency | 2989 | ret |
1245 | hidnplayr | 2990 | |
2991 | |||
8014 | leency | 2992 | ; and allocate memory |
2993 | xor ebx,ebx |
||
2994 | xor ebp,ebp |
||
2995 | mov [points_count_var],ebx |
||
2996 | mov [triangles_count_var],ebx |
||
2997 | if USE_LFN = 0 |
||
1245 | hidnplayr | 2998 | mov esi,SourceFile |
8014 | leency | 2999 | else |
1245 | hidnplayr | 3000 | mov esi,[fptr] |
8014 | leency | 3001 | end if |
1245 | hidnplayr | 3002 | |
3066 | leency | 3003 | |
8014 | leency | 3004 | je @f ;Must be legal .3DS file |
3005 | xor eax,eax |
||
3006 | ret |
||
3007 | @@: |
||
3066 | leency | 3008 | mov eax,dword[esi+2] |
8014 | leency | 3009 | cmp eax,[fsize] ;This must tell the length |
3010 | je @f |
||
3011 | xor eax,eax |
||
3012 | ret |
||
3013 | @@: |
||
3066 | leency | 3014 | add eax,esi |
8014 | leency | 3015 | mov [EndFile],eax ; |
3016 | |||
1245 | hidnplayr | 3017 | |
8014 | leency | 3018 | @@: |
1245 | hidnplayr | 3019 | cmp [esi],word 3D3Dh |
8014 | leency | 3020 | je @f |
3021 | add esi,[esi+2] |
||
3022 | jmp @b |
||
3023 | @@: |
||
1245 | hidnplayr | 3024 | add esi,6 |
8014 | leency | 3025 | .find4k: |
1245 | hidnplayr | 3026 | cmp [esi],word 4000h |
8014 | leency | 3027 | je @f |
3028 | add esi,[esi+2] |
||
3029 | cmp esi,[EndFile] |
||
3030 | jc .find4k |
||
3031 | jmp .exit |
||
3032 | @@: |
||
1245 | hidnplayr | 3033 | add esi,6 |
8014 | leency | 3034 | @@: |
1245 | hidnplayr | 3035 | cmp [esi],byte 0 |
8014 | leency | 3036 | je @f |
3037 | inc esi |
||
3038 | jmp @b |
||
3039 | @@: |
||
1245 | hidnplayr | 3040 | inc esi |
8014 | leency | 3041 | @@: |
1245 | hidnplayr | 3042 | cmp [esi],word 4100h |
8014 | leency | 3043 | je @f |
3044 | add esi,[esi+2] |
||
3045 | jmp @b |
||
3046 | @@: |
||
1245 | hidnplayr | 3047 | add esi,6 |
8014 | leency | 3048 | @@: |
1245 | hidnplayr | 3049 | cmp [esi],word 4110h |
8014 | leency | 3050 | je @f |
3051 | add esi,[esi+2] |
||
3052 | jmp @b |
||
3053 | @@: |
||
1245 | hidnplayr | 3054 | movzx ecx,word[esi+6] |
8014 | leency | 3055 | add [points_count_var],ecx |
3056 | |||
1245 | hidnplayr | 3057 | |
8014 | leency | 3058 | add esi,8 |
3059 | @@: |
||
1245 | hidnplayr | 3060 | |
3061 | |||
8014 | leency | 3062 | add esi,12 |
3063 | ; dec ecx |
||
3064 | loop @b |
||
3065 | @@: |
||
1245 | hidnplayr | 3066 | |
3066 | leency | 3067 | |
1245 | hidnplayr | 3068 | cmp [esi],word 4120h |
8014 | leency | 3069 | je @f |
3070 | add esi,[esi+2] |
||
3071 | jmp @b |
||
3072 | @@: |
||
1245 | hidnplayr | 3073 | movzx ecx,word[esi+6] |
8014 | leency | 3074 | add [triangles_count_var],ecx |
3075 | add esi,8 |
||
3076 | |||
3066 | leency | 3077 | |
1245 | hidnplayr | 3078 | add esi,8 |
8014 | leency | 3079 | dec ecx |
3080 | jnz @b |
||
3081 | ; xor ecx,ecx |
||
3082 | add ebp,edx |
||
3083 | jmp .find4k |
||
3084 | mov eax,-1 ;<---mark if OK |
||
3085 | .exit: |
||
1245 | hidnplayr | 3086 | ret |
3087 | |||
3088 | |||
3066 | leency | 3089 | fninit |
8014 | leency | 3090 | mov edi,[triangles_ptr] |
3091 | xor ebx,ebx |
||
3092 | xor ebp,ebp |
||
3093 | mov [points_count_var],0 |
||
3094 | mov [triangles_count_var],0 |
||
3095 | if USE_LFN = 0 |
||
1245 | hidnplayr | 3096 | mov esi,SourceFile |
8014 | leency | 3097 | else |
1245 | hidnplayr | 3098 | mov esi,[fptr] |
8014 | leency | 3099 | end if |
1245 | hidnplayr | 3100 | cmp [esi],word 4D4Dh |
8014 | leency | 3101 | jne .exit ;Must be legal .3DS file |
3102 | ; cmp dword[esi+2],EndFile-SourceFile |
||
3103 | ; jne .exit ;This must tell the length |
||
3104 | mov eax,dword[esi+2] |
||
3105 | ; cmp eax,[fsize] |
||
3106 | ; jne .exit |
||
3107 | |||
3066 | leency | 3108 | |
8014 | leency | 3109 | mov [EndFile],eax ; |
3110 | |||
1245 | hidnplayr | 3111 | |
8014 | leency | 3112 | @@: |
1245 | hidnplayr | 3113 | cmp [esi],word 3D3Dh |
8014 | leency | 3114 | je @f |
3115 | add esi,[esi+2] |
||
3116 | jmp @b |
||
3117 | @@: |
||
1245 | hidnplayr | 3118 | add esi,6 |
8014 | leency | 3119 | .find4k: |
1245 | hidnplayr | 3120 | cmp [esi],word 4000h |
8014 | leency | 3121 | je @f |
3122 | add esi,[esi+2] |
||
3123 | cmp esi,[EndFile] |
||
3124 | jc .find4k |
||
3125 | jmp .exit |
||
3126 | @@: |
||
1245 | hidnplayr | 3127 | add esi,6 |
8014 | leency | 3128 | @@: |
1245 | hidnplayr | 3129 | cmp [esi],byte 0 |
8014 | leency | 3130 | je @f |
3131 | inc esi |
||
3132 | jmp @b |
||
3133 | @@: |
||
1245 | hidnplayr | 3134 | inc esi |
8014 | leency | 3135 | @@: |
1245 | hidnplayr | 3136 | cmp [esi],word 4100h |
8014 | leency | 3137 | je @f |
3138 | add esi,[esi+2] |
||
3139 | jmp @b |
||
3140 | @@: |
||
1245 | hidnplayr | 3141 | add esi,6 |
8014 | leency | 3142 | @@: |
1245 | hidnplayr | 3143 | cmp [esi],word 4110h |
8014 | leency | 3144 | je @f |
3145 | add esi,[esi+2] |
||
3146 | jmp @b |
||
3147 | @@: |
||
1245 | hidnplayr | 3148 | movzx ecx,word[esi+6] |
8014 | leency | 3149 | add [points_count_var],ecx |
3150 | |||
1245 | hidnplayr | 3151 | |
8014 | leency | 3152 | add esi,8 |
3153 | @@: |
||
1245 | hidnplayr | 3154 | push edi |
8014 | leency | 3155 | mov edi,[points_ptr] |
3156 | push dword[esi+0] |
||
3157 | pop dword[edi+ebx*2+0] |
||
3158 | push dword[esi+4] |
||
3159 | pop dword[edi+ebx*2+4] |
||
3160 | push dword[esi+8] |
||
3161 | pop dword[edi+ebx*2+8] |
||
3162 | pop edi |
||
3163 | |||
1245 | hidnplayr | 3164 | |
8014 | leency | 3165 | add esi,12 |
3166 | dec ecx |
||
3167 | jnz @b |
||
3168 | @@: |
||
1245 | hidnplayr | 3169 | ; mov dword[points+ebx],-1 |
8014 | leency | 3170 | push edi |
3171 | mov edi,[points_ptr] |
||
3172 | mov dword[edi+ebx*2],-1 ; end mark (not always in use) |
||
3173 | pop edi |
||
3174 | @@: |
||
1245 | hidnplayr | 3175 | cmp [esi],word 4120h |
8014 | leency | 3176 | je @f |
3177 | add esi,[esi+2] |
||
3178 | jmp @b |
||
3179 | @@: |
||
1245 | hidnplayr | 3180 | movzx ecx,word[esi+6] |
8014 | leency | 3181 | add [triangles_count_var],ecx |
3182 | add esi,8 |
||
3183 | ;mov edi,triangles |
||
3184 | @@: |
||
1245 | hidnplayr | 3185 | movzx eax,word[esi] |
8014 | leency | 3186 | stosd |
3187 | movzx eax,word[esi+2] |
||
3188 | stosd |
||
3189 | movzx eax,word[esi+4] |
||
3190 | stosd |
||
3191 | add dword[edi-12],ebp |
||
3192 | add dword[edi-8],ebp |
||
3193 | add dword[edi-4],ebp |
||
3194 | add esi,8 |
||
3195 | dec ecx |
||
3196 | jnz @b |
||
3197 | add ebp,edx |
||
3198 | jmp .find4k |
||
3199 | mov eax,-1 ;<---mark if OK |
||
3200 | .exit: |
||
1245 | hidnplayr | 3201 | mov dword[edi],-1 |
8014 | leency | 3202 | ret |
1245 | hidnplayr | 3203 | |
3204 | |||
3205 | mov eax, 68 |
||
8014 | leency | 3206 | cmp [re_alloc_flag],1 |
3207 | jz @f |
||
3208 | mov ebx, 12 |
||
3209 | jmp .alloc |
||
3210 | @@: |
||
1776 | yogev_ezra | 3211 | mov ebx,20 |
8014 | leency | 3212 | .alloc: |
1776 | yogev_ezra | 3213 | |
2881 | leency | 3214 | |
8014 | leency | 3215 | add ecx,20 |
3216 | lea ecx, [ecx*3] |
||
3217 | shl ecx,2 |
||
3218 | mov edx,[triangles_ptr] |
||
3219 | int 0x40 ; -> allocate memory to triangles |
||
3220 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
||
3221 | |||
1245 | hidnplayr | 3222 | |
8014 | leency | 3223 | |
1245 | hidnplayr | 3224 | |
8014 | leency | 3225 | mov ecx, [triangles_count_var] |
3226 | lea ecx, [3+ecx*3] |
||
3227 | shl ecx, 2 |
||
3228 | mov edx,[triangles_normals_ptr] |
||
3229 | int 0x40 ; -> allocate memory for triangles normals |
||
3230 | mov [triangles_normals_ptr], eax ; -> eax = pointer to allocated mem |
||
3231 | |||
1245 | hidnplayr | 3232 | |
6769 | IgorA | 3233 | |
8014 | leency | 3234 | mov ecx, [points_count_var] |
3235 | lea ecx,[3+ecx*3] |
||
3236 | shl ecx, 2 |
||
3237 | mov edx,[points_normals_ptr] |
||
3238 | int 0x40 |
||
3239 | mov [points_normals_ptr], eax |
||
3240 | |||
1245 | hidnplayr | 3241 | |
6769 | IgorA | 3242 | |
8014 | leency | 3243 | ; mov ebx, 12 |
3244 | mov ecx, [points_count_var] |
||
3245 | lea ecx,[3+ecx*3] |
||
3246 | shl ecx, 2 |
||
3247 | mov edx,[points_normals_rot_ptr] |
||
3248 | int 0x40 |
||
3249 | mov [points_normals_rot_ptr], eax |
||
3250 | |||
1245 | hidnplayr | 3251 | |
8014 | leency | 3252 | mov edx,[points_ptr] |
3253 | int 0x40 |
||
3254 | mov [points_ptr], eax |
||
3255 | |||
1245 | hidnplayr | 3256 | |
8014 | leency | 3257 | mov edx,[points_rotated_ptr] |
3258 | int 0x40 |
||
3259 | mov [points_rotated_ptr], eax |
||
3260 | |||
1245 | hidnplayr | 3261 | |
8014 | leency | 3262 | mov ecx, [points_count_var] |
3263 | inc ecx |
||
3264 | shl ecx, 3 |
||
3265 | mov edx,[points_translated_ptr] |
||
3266 | int 0x40 |
||
3267 | mov [points_translated_ptr], eax |
||
3268 | ret |
||
1245 | hidnplayr | 3269 | |
3270 | |||
3271 | |||
8232 | leency | 3272 | |
1245 | hidnplayr | 3273 | if USE_LFN |
3274 | ;- |
||
3275 | mov eax, 68 |
||
3276 | mov ebx, 11 |
||
3277 | int 0x40 ; -> create heap |
||
8014 | leency | 3278 | |
1245 | hidnplayr | 3279 | |
8014 | leency | 3280 | ; mov ebx, file_info |
3281 | ; mov dword[ebx], 5 ; -> subfunction number |
||
3282 | ; int 0x40 ; -> read file size |
||
3283 | ; mov ebx, [fptr] |
||
3284 | ; mov ebx, dword[ebx+32] |
||
3285 | ; inc ebx |
||
3286 | ; mov [fsize], ebx |
||
3287 | |||
1245 | hidnplayr | 3288 | |
3289 | |||
7788 | leency | 3290 | |
8014 | leency | 3291 | ; mov ebx, 12 |
3292 | ; mov ecx, [fsize] |
||
3293 | ; int 0x40 ; -> allocate memory for file |
||
3294 | ; mov [fptr], eax ; -> eax = pointer to allocated mem |
||
3295 | |||
7788 | leency | 3296 | |
8014 | leency | 3297 | ; mov ebx, file_info |
3298 | ; mov dword[ebx],0 |
||
3299 | ; int 0x40 ; -> read file |
||
3300 | ;load kpacked files by Leency |
||
3301 | mov eax,68 |
||
3302 | mov ebx,27 |
||
3303 | mov ecx,file_name |
||
3304 | int 0x40 |
||
3305 | |||
7788 | leency | 3306 | |
8014 | leency | 3307 | mov [file_info+16],eax |
3308 | |||
3309 | |||
3310 | jnz .open_opened_well |
||
3311 | mov eax,6 ;otherwise => failed |
||
3312 | jmp @f |
||
3313 | .open_opened_well: |
||
3314 | xor eax,eax |
||
3315 | @@: |
||
3316 | else |
||
1245 | hidnplayr | 3317 | mov eax,58 |
3318 | mov ebx,file_info |
||
3319 | int 0x40 |
||
3320 | |||
3321 | |||
3322 | shr eax,9 |
||
3323 | inc eax |
||
3324 | mov [fsize],eax |
||
3325 | |||
6769 | IgorA | 3326 | |
3327 | |||
3328 | |||
1245 | hidnplayr | 3329 | ; add ecx,MEM_END |
3330 | ; mov ebx,1 |
||
3331 | ; mov eax,64 ; allocate mem - resize app mem |
||
8014 | leency | 3332 | ; for points and triangles |
3333 | int 0x40 |
||
1245 | hidnplayr | 3334 | |
3335 | |||
3336 | mov ebx,file_info |
||
3337 | int 0x40 |
||
3338 | end if |
||
3339 | ; eax = 0 -> ok file loaded |
||
3340 | ret |
||
3341 | ; eax = 0 -> ok file loaded |
||
8014 | leency | 3342 | ret |
3343 | read_param: |
||
1245 | hidnplayr | 3344 | mov esi,I_Param |
3345 | cmp dword[esi],0 |
||
3346 | je .end |
||
8014 | leency | 3347 | cmp byte[esi],'/' |
1245 | hidnplayr | 3348 | je .copy |
8014 | leency | 3349 | mov edi,esi |
1245 | hidnplayr | 3350 | mov ecx,25 ; 25 - would be enought |
8014 | leency | 3351 | repe scasb |
1245 | hidnplayr | 3352 | jne .end |
3353 | dec edi |
||
3354 | mov esi,edi |
||
3355 | .copy: |
||
3356 | mov edi,file_name |
||
8014 | leency | 3357 | mov ecx,50 |
3358 | rep movsd |
||
3359 | .end: |
||
1245 | hidnplayr | 3360 | ret |
3361 | buttons: ; draw some buttons (all but navigation and close ) |
||
8014 | leency | 3362 | mov edi,menu |
3363 | .again: |
||
1245 | hidnplayr | 3364 | mov eax,8 ; function 8 : define and draw button |
8014 | leency | 3365 | mov bx,[size_x_var] |
3366 | shl ebx,16 |
||
3367 | add ebx,(10)*65536+62 ; [x start] *65536 + [x size] |
||
3368 | movzx ecx,byte[edi] ; button id = position+2 |
||
3369 | sub cl,2 |
||
3370 | lea ecx,[ecx*5] |
||
3371 | lea ecx,[ecx*3] |
||
3372 | add ecx,25 |
||
3373 | shl ecx,16 |
||
3374 | add ecx,12 |
||
3375 | movzx edx,byte[edi] ; button id |
||
3376 | mov esi,0x6688dd ; button color RRGGBB |
||
3377 | int 0x40 |
||
3378 | ; BUTTON LABEL |
||
3379 | mov eax,4 ; function 4 : write text to window |
||
3380 | movzx ebx,byte[edi] |
||
3381 | sub bl,2 ; button id, according to position |
||
3382 | lea ebx,[ebx*3] |
||
3383 | lea ebx,[ebx*5] |
||
3384 | mov cx,[size_x_var] |
||
3385 | shl ecx,16 |
||
3386 | add ebx,ecx |
||
3387 | add ebx,(12)*65536+28 ; [x start] *65536 + [y start] |
||
3388 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3389 | lea edx,[edi+1] ; pointer to text beginning |
||
3390 | mov esi,10 ; text length |
||
3391 | int 0x40 |
||
3392 | cmp byte[edi+11],255 ; if max_flag=255 |
||
3393 | je @f ; skip |
||
3394 | ; flag description |
||
3395 | ; mov eax,4 ; function 4 : write text to window |
||
3396 | ; movzx ebx,byte[edi] |
||
3397 | ; sub bl,2 |
||
3398 | ; lea ebx,[ebx*3] |
||
3399 | ; lea ebx,[ebx*5] |
||
3400 | ; add ebx,(SIZE_X+12+70)*65536+28 ; [x start] *65536 + [y start] |
||
3401 | add ebx,70*65536 |
||
3402 | ; mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3403 | movzx edx,byte[edi+12] ; current flag |
||
3404 | shl edx,2 ; * 4 = text length |
||
3405 | add edx,dword[edi+13] ; pointer to text beginning |
||
3406 | mov esi,4 ; text length |
||
3407 | int 0x40 |
||
3408 | |||
1245 | hidnplayr | 3409 | |
3410 | add edi,17 |
||
8014 | leency | 3411 | cmp byte[edi],-1 |
3412 | jnz .again |
||
3413 | ret |
||
1245 | hidnplayr | 3414 | ; ********************************************* |
3415 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
3416 | ; ********************************************* |
||
3417 | draw_window: |
||
3418 | mov eax,12 ; function 12:tell os about windowdraw |
||
8014 | leency | 3419 | mov ebx,1 ; 1, start of draw |
3420 | int 0x40 |
||
3421 | |||
1245 | hidnplayr | 3422 | |
8014 | leency | 3423 | mov eax,0 ; function 0 : define and draw window |
3424 | mov bx,[x_start] |
||
3425 | shl ebx,16 |
||
3426 | mov cx,[y_start] |
||
3427 | shl ecx,16 |
||
3428 | ;ebx - [x start] *65536 + [x size] |
||
3429 | ;ecx - [y start] *65536 + [y size] |
||
3430 | mov bx,[size_x_var] |
||
3431 | add bx,115 |
||
3432 | mov cx,[size_y_var] |
||
3433 | add cx,30 |
||
3434 | ; @@: |
||
6648 | leency | 3435 | mov edx,0x13000000 ; color of work area RRGGBB,8->color gl |
8014 | leency | 3436 | mov edi,labelt ; WINDOW LABEL |
3437 | int 0x40 |
||
3438 | |||
1245 | hidnplayr | 3439 | |
8014 | leency | 3440 | |
1245 | hidnplayr | 3441 | |
8014 | leency | 3442 | |
1245 | hidnplayr | 3443 | |
8014 | leency | 3444 | mov eax,4 ; function 4 : write text to window |
3445 | movzx ebx,word[size_x_var] |
||
3446 | shl ebx,16 |
||
3447 | add ebx,(12)*65536+(168+15*(13+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3448 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3449 | mov edx,labelvector ; pointer to text beginning |
||
3450 | mov esi,labelvectorend-labelvector ; text length |
||
3451 | ; cmp [move_flag],2 |
||
3452 | ; jne @f |
||
3453 | ; add edx,navigation_size |
||
3454 | ; @@: |
||
1245 | hidnplayr | 3455 | int 0x40 |
8014 | leency | 3456 | ; VECTOR Y- BUTTON |
3457 | mov eax,8 ; function 8 : define and draw button |
||
3458 | movzx ebx,word[size_x_var] |
||
3459 | shl ebx,16 |
||
3460 | add ebx,30*65536+20 ; [x start] *65536 + [x size] |
||
3461 | mov ecx,(165+15*(14+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3462 | mov edx,30 ; button id |
||
3463 | mov esi,0x6688dd ; button color RRGGBB |
||
3464 | int 0x40 |
||
3465 | ;VECTOR Y- LABEL |
||
3466 | mov eax,4 ; function 4 : write text to window |
||
3467 | movzx ebx,word[size_x_var] |
||
3468 | shl ebx,16 |
||
3469 | add ebx,(32)*65536+(168+15*(14+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3470 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3471 | mov edx,labelyminus ; pointer to text beginning |
||
3472 | mov esi,labelyminusend-labelyminus ; text length |
||
3473 | cmp [move_flag],2 |
||
3474 | ; jne @f |
||
3475 | ; add edx,navigation_size |
||
3476 | ; @@: |
||
1245 | hidnplayr | 3477 | int 0x40 |
8014 | leency | 3478 | ; VECTOR Z+ BUTTON |
3479 | mov eax,8 ; function 8 : define and draw button |
||
3480 | movzx ebx,word[size_x_var] |
||
3481 | shl ebx,16 |
||
3482 | add ebx,(51)*65536+21 ; [x start] *65536 + [x size] |
||
3483 | mov ecx,(165+15*(14+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3484 | mov edx,31 ; button id |
||
3485 | mov esi,0x6688dd ; button color RRGGBB |
||
3486 | int 0x40 |
||
3487 | ;VECTOR Z+ LABEL |
||
3488 | mov eax,4 ; function 4 : write text to window |
||
3489 | movzx ebx,word[size_x_var] |
||
3490 | shl ebx,16 |
||
3491 | add ebx,(53)*65536+(168+15*(14+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3492 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3493 | mov edx,labelzplus ; pointer to text beginning |
||
3494 | mov esi,labelzplusend-labelzplus ; text length |
||
3495 | ; cmp [move_flag],2 |
||
3496 | ; jne @f |
||
3497 | ; add edx,navigation_size |
||
3498 | ; @@: |
||
1245 | hidnplayr | 3499 | |
3500 | |||
8014 | leency | 3501 | ; VECTOR x- BUTTON |
3502 | mov eax,8 ; function 8 : define and draw button |
||
3503 | movzx ebx,word[size_x_var] |
||
3504 | shl ebx,16 |
||
3505 | add ebx,(10)*65536+21 ; [x start] *65536 + [x size] |
||
3506 | mov ecx,(165+15*(15+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3507 | mov edx,32 ; button id |
||
3508 | mov esi,0x6688dd ; button color RRGGBB |
||
3509 | int 0x40 |
||
3510 | ;VECTOR x- LABEL |
||
3511 | mov eax,4 ; function 4 : write text to window |
||
3512 | movzx ebx,word[size_x_var] |
||
3513 | shl ebx,16 |
||
3514 | add ebx,(12)*65536+(168+15*(15+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3515 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3516 | mov edx,labelxminus ; pointer to text beginning |
||
3517 | mov esi,labelxminusend-labelxminus ; text length |
||
3518 | ; cmp [move_flag],2 |
||
3519 | ; jne @f |
||
3520 | ; add edx,navigation_size |
||
3521 | ; @@: |
||
1245 | hidnplayr | 3522 | int 0x40 |
8014 | leency | 3523 | ; VECTOR x+ BUTTON |
3524 | mov eax,8 ; function 8 : define and draw button |
||
3525 | movzx ebx,word[size_x_var] |
||
3526 | shl ebx,16 |
||
3527 | add ebx,(51)*65536+21 ; [x start] *65536 + [x size] |
||
3528 | mov ecx,(165+15*(15+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3529 | mov edx,33 ; button id |
||
3530 | mov esi,0x6688dd ; button color RRGGBB |
||
3531 | int 0x40 |
||
3532 | ;VECTOR x+ LABEL |
||
3533 | mov eax,4 ; function 4 : write text to window |
||
3534 | movzx ebx,word[size_x_var] |
||
3535 | shl ebx,16 |
||
3536 | add ebx,(53)*65536+(168+15*(15+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3537 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3538 | mov edx,labelxplus ; pointer to text beginning |
||
3539 | mov esi,labelxplusend-labelxplus ; text length |
||
3540 | ; cmp [move_flag],2 |
||
3541 | ; jne @f |
||
3542 | ; add edx,navigation_size |
||
3543 | ; @@: |
||
1245 | hidnplayr | 3544 | int 0x40 |
8014 | leency | 3545 | ; VECTOR z- BUTTON |
3546 | mov eax,8 ; function 8 : define and draw button |
||
3547 | movzx ebx,word[size_x_var] |
||
3548 | shl ebx,16 |
||
3549 | add ebx,(10)*65536+62-41 ; [x start] *65536 + [x size] |
||
3550 | mov ecx,(25+140+15*(16+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3551 | mov edx,34 ; button id |
||
3552 | mov esi,0x6688dd ; button color RRGGBB |
||
3553 | int 0x40 |
||
3554 | ;VECTOR z- LABEL |
||
3555 | mov eax,4 ; function 4 : write text to window |
||
3556 | movzx ebx,word[size_x_var] |
||
3557 | shl ebx,16 |
||
3558 | add ebx,(12)*65536+(168+15*(16+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3559 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3560 | mov edx,labelzminus ; pointer to text beginning |
||
3561 | mov esi,labelzminusend-labelzminus ; text length |
||
3562 | ; cmp [move_flag],2 |
||
3563 | ; jne @f |
||
3564 | ; add edx,navigation_size |
||
3565 | ; @@: |
||
1245 | hidnplayr | 3566 | int 0x40 |
8014 | leency | 3567 | ;VECTOR Y+ BUTTON |
1245 | hidnplayr | 3568 | mov eax,8 ; function 8 : define and draw button |
8014 | leency | 3569 | movzx ebx,word[size_x_var] |
3570 | shl ebx,16 |
||
3571 | add ebx,(10+20)*65536+20 ; [x start] *65536 + [x size] |
||
3572 | mov ecx,(165+15*(16+.Y_ADD))*65536+12 ; [y start] *65536 + [y size] |
||
3573 | mov edx,35 ; button id |
||
3574 | mov esi,0x6688dd ; button color RRGGBB |
||
3575 | int 0x40 |
||
3576 | ;VECTOR Y+ LABEL |
||
3577 | mov eax,4 ; function 4 : write text to window |
||
3578 | movzx ebx,word[size_x_var] |
||
3579 | shl ebx,16 |
||
3580 | add ebx,(32)*65536+(168+15*(16+.Y_ADD)) ; [x start] *65536 + [y start] |
||
3581 | mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
||
3582 | mov edx,labelyplus ; pointer to text beginning |
||
3583 | mov esi,labelyplusend-labelyplus ; text length |
||
3584 | ; cmp [move_flag],2 |
||
3585 | ; jne @f |
||
3586 | ; add edx,navigation_size |
||
3587 | ; @@: |
||
1245 | hidnplayr | 3588 | int 0x40 |
8014 | leency | 3589 | |
1245 | hidnplayr | 3590 | |
8014 | leency | 3591 | mov ebx,2 ; 2, end of draw |
3592 | int 0x40 |
||
3593 | ret |
||
3594 | |||
1245 | hidnplayr | 3595 | |
3596 | |||
8014 | leency | 3597 | |
1245 | hidnplayr | 3598 | |
1979 | yogev_ezra | 3599 | align 16 |
6619 | leency | 3600 | MEM_END:---mark>---mark>>----!>-1.0,1.0> |
1245 | hidnplayr | 3601 |