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