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