update program

git-svn-id: svn://kolibrios.org@5935 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2015-11-26 14:58:32 +00:00
parent 3243cdfaac
commit 698f3bcead
4 changed files with 315 additions and 85 deletions

View File

@ -1,7 +1,7 @@
if lang eq ru if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 10.11.15',0 ;¯®¤¯¨áì ®ª­  capt db 'info 3ds ¢¥àá¨ï 26.11.15',0 ;¯®¤¯¨áì ®ª­ 
else else
capt db 'info 3ds version 10.11.15',0 ;window caption capt db 'info 3ds version 26.11.15',0 ;window caption
end if end if
MAX_FILE_LEVEL equ 20 ;¬ Şá¨¬ «ě­ë© ă஢Ą­ě ˘«®¦Ą­­®á⨠ˇ«®Ş®˘ ¤«ď  ­ «¨§  MAX_FILE_LEVEL equ 20 ;¬ Şá¨¬ «ě­ë© ă஢Ą­ě ˘«®¦Ą­­®á⨠ˇ«®Ş®˘ ¤«ď  ­ «¨§ 
@ -69,6 +69,7 @@ block_3ds CHUNK_MATNAME, 3,1,txt_a000
block_3ds 0xa010,4,0,txt_a010 block_3ds 0xa010,4,0,txt_a010
block_3ds 0xa020,4,0,txt_a020 block_3ds 0xa020,4,0,txt_a020
block_3ds 0xa030,4,0,txt_a030 block_3ds 0xa030,4,0,txt_a030
block_3ds 0xa100,5,1,txt_a100
block_3ds CHUNK_TEXTURE, 3,0,txt_a200 block_3ds CHUNK_TEXTURE, 3,0,txt_a200
block_3ds CHUNK_MAPFILE, 6,1,txt_a300 block_3ds CHUNK_MAPFILE, 6,1,txt_a300
block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000 block_3ds CHUNK_KEYFRAMER, 7,0,txt_b000
@ -145,10 +146,10 @@ txt_4160 db '
txt_4600 db '‘˘Ąâ',0 txt_4600 db '‘˘Ąâ',0
txt_4700 db 'Š ¬Ąŕ ',0 txt_4700 db 'Š ¬Ąŕ ',0
txt_a000 db 'Ť §˘ ­¨Ą ¬ âĄŕ¨ « ',0 txt_a000 db 'Ť §˘ ­¨Ą ¬ âĄŕ¨ « ',0
;txt_a100 db 'MAT_SHADING',0
txt_a010 db 'ŽŞŕ㦠î騩 梥â',0 txt_a010 db 'ŽŞŕ㦠î騩 梥â',0
txt_a020 db '„¨ääă§­ë© ć˘Ąâ',0 txt_a020 db '„¨ääă§­ë© ć˘Ąâ',0
txt_a030 db '‡ĄŕŞ «ě­ë© 梥â',0 txt_a030 db '‡ĄŕŞ «ě­ë© 梥â',0
txt_a100 db '’¨¯ ¬ â¥à¨ «  [1=flat 2=gouraud 3=phong 4=metal]',0
txt_a200 db '’ĄŞáâăŕ  ¬ âĄŕ¨ «  1',0 txt_a200 db '’ĄŞáâăŕ  ¬ âĄŕ¨ «  1',0
txt_a300 db '<27>¬ď ä ©«  ⥪áâăŕë',0 txt_a300 db '<27>¬ď ä ©«  ⥪áâăŕë',0
;txt_a353 db 'MAT_MAP_TEXBLUR',0 ;txt_a353 db 'MAT_MAP_TEXBLUR',0
@ -230,6 +231,7 @@ txt_a000 db 'Material name',0
txt_a010 db 'Ambient color',0 txt_a010 db 'Ambient color',0
txt_a020 db 'Diffuse color',0 txt_a020 db 'Diffuse color',0
txt_a030 db 'Specular color',0 txt_a030 db 'Specular color',0
txt_a100 db 'Material type [1=flat 2=gouraud 3=phong 4=metal]',0
txt_a200 db 'Texture map 1',0 txt_a200 db 'Texture map 1',0
txt_a300 db 'Mapping filename',0 txt_a300 db 'Mapping filename',0
txt_afff db 'Meterial',0 txt_afff db 'Meterial',0

View File

@ -11,6 +11,7 @@ include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include '../../dll.inc' include '../../dll.inc'
include 'lang.inc' include 'lang.inc'
include 'info_fun_float.inc' include 'info_fun_float.inc'
include 'info_menu.inc'
debug equ 0 debug equ 0
@ -129,6 +130,24 @@ start:
mcall 40,0x27 mcall 40,0x27
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£  stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
;kmenu initialisation
stdcall [kmenu_init],sc
stdcall [ksubmenu_new]
mov [main_menu], eax
stdcall [ksubmenu_new]
mov [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5
stdcall [ksubmenu_add], [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6
stdcall [ksubmenu_add], [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
stdcall [ksubmenu_add], [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 7
stdcall [ksubmenu_add], [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view]
stdcall [ksubmenu_add], [main_menu], eax
mov dword[w_scr_t1.type],1 mov dword[w_scr_t1.type],1
stdcall dword[tl_data_init], tree1 stdcall dword[tl_data_init], tree1
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list ;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
@ -158,7 +177,7 @@ start:
mcall 26,9 mcall 26,9
mov [last_time],eax mov [last_time],eax
stdcall [kosglMakeCurrent], 5,3,320,240,ctx1 stdcall [kosglMakeCurrent], 5,23,320,240,ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢ stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
stdcall [glClearColor], 0.0,0.0,0.0,0.0 stdcall [glClearColor], 0.0,0.0,0.0,0.0
@ -208,13 +227,10 @@ mouse:
align 4 align 4
timer_funct: timer_funct:
pushad pushad
if debug
mcall 4, (5 shl 16)+8, 0xff+0x80000000, txt_0002
end if
mcall 26,9 mcall 26,9
mov [last_time],eax mov [last_time],eax
; ;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 cmp eax,0
je @f je @f
@ -227,6 +243,7 @@ end if
add eax,dword[open_file_lif] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ï⨠add eax,dword[open_file_lif] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp dword[offs_last_timer],eax cmp dword[offs_last_timer],eax
je @f je @f
;¥á«¨ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå ­¥ ᮢ¯ ¤ ¥â á ¯®á«¥¤­¨¬ § ¯®¬­¥­­ë¬
mov dword[offs_last_timer],eax mov dword[offs_last_timer],eax
call buf_draw_beg call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000 stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000
@ -240,6 +257,12 @@ end if
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥ stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
@@: @@:
popad popad
;¯à®á¬®âà ®ª­  á ª®®à¤¨­ â ¬¨ â®ç¥ª
;cmp byte[prop_wnd_run],0
;je @f
; call prop_timer_funct
;@@:
jmp still jmp still
align 4 align 4
@ -479,9 +502,7 @@ but_open_file:
mov byte[can_save],0 mov byte[can_save],0
call init_tree call init_tree
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥ stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
mov dword[angle_x],0.0 call prop_wnd_clear_param ;ç¨á⨬ ¯ à ¬¥âàë ®ª­  á ª®®à¤¨­ â ¬¨
mov dword[angle_y],0.0
mov dword[angle_z],0.0
cmp byte[prop_wnd_run],0 cmp byte[prop_wnd_run],0
je @f je @f
;ç¨á⨬ ®ª­® á ª®®à¤¨­ â ¬¨ ;ç¨á⨬ ®ª­® á ª®®à¤¨­ â ¬¨
@ -778,7 +799,7 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov ecx,size_one_list-(list_offs_text+5) mov ecx,size_one_list-(list_offs_text+5)
cld cld
rep movsb rep movsb
mov byte[buffer+size_one_list-1],0 ;0 - ᨬ¢®« ª®­¥æ  áâப¨ mov byte[buffer+size_one_list-1],0 ;0 - ᨬ¢®« ª®­æ  áâப¨
.no_capt: .no_capt:
stdcall [tl_node_add], tree1, ebx, buffer stdcall [tl_node_add], tree1, ebx, buffer
stdcall [tl_cur_next], tree1 stdcall [tl_cur_next], tree1
@ -819,6 +840,42 @@ proc print_err, fun:dword, mes:dword ;
popad popad
ret ret
endp endp
;input:
; eax - value
; edi - string buffer
; len - buffer len
;output:
align 4
proc convert_int_to_str, len:dword
pushad
mov esi,[len]
add esi,edi
dec esi
call .str
popad
ret
endp
align 4
.str:
mov ecx,0x0a
cmp eax,ecx
jb @f
xor edx,edx
div ecx
push edx
call .str
pop eax
@@:
cmp edi,esi
jge @f
or al,0x30
stosb
mov byte[edi],0
@@:
ret
end if end if
align 4 align 4
@ -857,7 +914,6 @@ but_save_file:
je .end_save_file je .end_save_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£  ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
mov [run_file_70.Function], 2 mov [run_file_70.Function], 2
mov [run_file_70.Position], 0 mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0 mov [run_file_70.Flags], 0
@ -867,11 +923,10 @@ but_save_file:
mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©«  mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©« 
mov byte[run_file_70+20], 0 mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path mov dword[run_file_70.FileName], openfile_path
mov ebx,run_file_70 mcall 70,run_file_70
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff cmp ebx,0xffffffff
je .end_save_file je .end_save_file
;...á®®¡é¥­¨¥...
.end_save_file: .end_save_file:
popad popad
ret ret
@ -1333,7 +1388,6 @@ include '../../develop/libraries/TinyGL/asm_fork/export.inc'
align 4 align 4
mouse_dd dd 0x0 mouse_dd dd 0x0
sc system_colors
last_time dd 0 last_time dd 0
align 4 align 4
@ -1371,7 +1425,7 @@ angle_y dd 0.0
angle_z dd 0.0 angle_z dd 0.0
delt_size dd 3.0 delt_size dd 3.0
light_position dd 0.0, 0.0, 2.0, 1.0 ; <20> á¯®«®¦¥­¨¥ ¨áâ®ç­¨ª  [0][1][2] light_position dd 0.0, 0.0, -2.0, 1.0 ; <20> á¯®«®¦¥­¨¥ ¨áâ®ç­¨ª  [0][1][2]
;[3] = (0.0 - ¡¥áª®­¥ç­® 㤠«¥­­ë© ¨áâ®ç­¨ª, 1.0 - ¨áâ®ç­¨ª á¢¥â  ­  ®¯à¥¤¥«¥­­®¬ à ááâ®ï­¨¨) ;[3] = (0.0 - ¡¥áª®­¥ç­® 㤠«¥­­ë© ¨áâ®ç­¨ª, 1.0 - ¨áâ®ç­¨ª á¢¥â  ­  ®¯à¥¤¥«¥­­®¬ à ááâ®ï­¨¨)
light_dir dd 0.0,0.0,0.0 ;­ ¯à ¢«¥­¨¥ « ¬¯ë light_dir dd 0.0,0.0,0.0 ;­ ¯à ¢«¥­¨¥ « ¬¯ë
@ -1383,6 +1437,7 @@ lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ;
align 16 align 16
i_end: i_end:
procinfo process_information procinfo process_information
sc system_colors
rb 2048 rb 2048
align 16 align 16
thread_coords: thread_coords:

View File

@ -0,0 +1 @@
if lang eq ru sz_main_menu_View db '‚¨¤', 0 sz_main_menu_Veiw_Vertexes db '‚¥àè¨­ë ¢ª«./¢ëª«.', 0 sz_main_menu_Veiw_Faces db 'ƒà ­¨ ¢ª«./¢ëª«.', 0 sz_main_menu_Veiw_Light db '‘¢¥â ¢ª«./¢ëª«.', 0 else sz_main_menu_View db 'View', 0 sz_main_menu_Veiw_Vertexes db 'Vertexes on/off', 0 sz_main_menu_Veiw_Faces db 'Faces on/off', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 end if main_menu dd 0 main_menu_file dd 0 main_menu_view dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 KMENUITEM_SEPARATOR equ 2

View File

@ -1,6 +1,6 @@
; ;
; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï ᮧ¤ ­¨ï ¨ ; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï ᮧ¤ ­¨ï ¨
; à ¡®âë ®ª­  á ª®®à¤¨­ â ¬¨ ; à ¡®âë ®ª­  á ª®®à¤¨­ â ¬¨ ¢¥à設
; ;
prop_wnd_width equ 340 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ  prop_wnd_width equ 340 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
@ -8,6 +8,12 @@ prop_wnd_height equ 460
SIZE_ONE_FLOAT equ 14 SIZE_ONE_FLOAT equ 14
MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1)
bit_vertexes equ 0
bit_faces equ 1
bit_faces_fill equ 2
bit_light equ 3
def_dr_mode equ 0x1111b
prop_wnd_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­® prop_wnd_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­®
txt_q db '?',0 txt_q db '?',0
@ -32,36 +38,76 @@ pushad
mcall 40,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩ mcall 40,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
inc byte[prop_wnd_run] inc byte[prop_wnd_run]
mov dword[w_scr_t3.type],1 mov dword[w_scr_t3.type],1
call prop_wnd_clear_param
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
xor edx,edx xor edx,edx
mov dword[capt_p],txt_q mov dword[capt_p],txt_q
cmp eax,0 cmp eax,0
je .no_points je .no_points
mov ebx,dword[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  mov ebx,[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª 
add ebx,dword[open_file_lif] add ebx,[open_file_lif]
cmp word[ebx],CHUNK_VERTLIST cmp word[ebx],CHUNK_VERTLIST
jne @f jne .end_vlist
movzx edx,word[ebx+6] ;ª®««¨ç¥á⢮ â®ç¥ª movzx edx,word[ebx+6] ;ª®««¨ç¥á⢮ â®ç¥ª
add ebx,8 add ebx,8
mov dword[capt_p],txt_4110 mov dword[capt_p],txt_4110
jmp .no_points ;¯®¨áª ¤ ­­ëå ¤«ï âà¥ã£®«ìª®¢
@@: mov ecx,eax
cmp word[ebx],0xb013 stdcall [tl_node_poi_get_info], tree1,0
@@:
mov esi,eax
stdcall [tl_node_poi_get_data], tree1,esi
cmp eax,ecx
je @f ;¥á«¨ ¯®¯ «¨ ­  ¢ë¡à ­­ë© 㧥«
stdcall [tl_node_poi_get_next_info], tree1,esi
cmp eax,0
jne @b
jmp .set_points
@@:
;¥á«¨ ­ è«¨ ¢ë¡à ­­ë© 㧥«, â® ¤ «¥¥ ¯ëâ ¥¬áï ­ ©â¨ 㧥« á âà¥ã£®«ì­¨ª ¬¨
movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
.cycle_0:
stdcall [tl_node_poi_get_next_info], tree1,esi
cmp eax,0
je .set_points
mov esi,eax
stdcall [tl_node_poi_get_data], tree1,esi
cmp byte[esi+2],cl
jl .set_points
je .found
jmp .cycle_0
.found: ;¥á«¨ ­ è«¨ 㧥« ⮣®¦¥ ã஢­ï çâ® ¨ ¢ë¡à ­­ë© 㧥«
cmp eax,0
je .set_points
mov eax,[eax]
add eax,[open_file_lif]
cmp word[eax],CHUNK_FACELIST
jne .cycle_0
movzx ecx,word[eax+6]
mov [obj_tri_count],ecx
add eax,8 ;2+4+2 (chunk+size+count)
mov [obj_tri_data],eax
jmp .set_points
.end_vlist:
cmp word[ebx],CHUNK_TRACKPIVOT
jne @f jne @f
inc edx inc edx
add ebx,6 add ebx,6
mov dword[capt_p],txt_b013 mov dword[capt_p],txt_b013
jmp .no_points jmp .set_points
@@: @@:
cmp word[ebx],0xb014 cmp word[ebx],0xb014
jne @f jne @f
mov edx,2 mov edx,2
add ebx,6 add ebx,6
mov dword[capt_p],txt_b014 mov dword[capt_p],txt_b014
;jmp .no_points ;jmp .set_points
@@: @@:
.set_points:
mov [obj_poi_data],ebx
mov [obj_poi_count],edx
.no_points: .no_points:
;­ áâனª  ᯨ᪠ ®¡ê¥ªâ®¢ ;­ áâனª  ᯨ᪠ ®¡ê¥ªâ®¢
@ -117,7 +163,13 @@ popad
align 4 align 4
prop_still: prop_still:
pushad pushad
mcall 10
mcall 23,10
or eax,eax
jnz @f
call prop_timer_funct
jmp .end
@@:
cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­  cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jne @f jne @f
@ -159,15 +211,15 @@ pushad
int 0x40 int 0x40
mov esi,[sc.work_button] mov esi,[sc.work_button]
mcall 8, (5 shl 16)+20, (246 shl 16)+20, 3 mcall 8, (5 shl 16)+20, (266 shl 16)+20, 3
mcall , (30 shl 16)+20, (246 shl 16)+20, 4 mcall , (30 shl 16)+20, (266 shl 16)+20, 4
mov ebx,[image_data_toolbar] mov ebx,[image_data_toolbar]
add ebx,4*IMAGE_TOOLBAR_ICON_SIZE add ebx,4*IMAGE_TOOLBAR_ICON_SIZE
mcall 7, , (16 shl 16)+16, (7 shl 16)+247 ;load mcall 7, , (16 shl 16)+16, (7 shl 16)+268 ;load
sub ebx,IMAGE_TOOLBAR_ICON_SIZE sub ebx,IMAGE_TOOLBAR_ICON_SIZE
mov edx,(32 shl 16)+247 ;save mov edx,(32 shl 16)+268 ;save
int 0x40 int 0x40
mov dword[w_scr_t3.all_redraw],1 mov dword[w_scr_t3.all_redraw],1
@ -177,19 +229,32 @@ pushad
stdcall [edit_box_draw], edit2 stdcall [edit_box_draw], edit2
stdcall [edit_box_draw], edit3 stdcall [edit_box_draw], edit3
stdcall [kmainmenu_draw], [main_menu]
call draw_3d call draw_3d
mcall 12,2 mcall 12,2
popad popad
ret ret
;ãáâ ­®¢ª  ¢á¥å ®á­®¢­ëå ¯¥à¥¬¥­­ëå ¯® 㬮«ç ­¨î
align 4
prop_wnd_clear_param:
mov dword[angle_x],0.0
mov dword[angle_y],0.0
mov dword[angle_z],0.0
mov dword[obj_poi_data],0
mov dword[obj_poi_count],0
mov dword[obj_tri_data],0
mov dword[obj_tri_count],0
mov dword[draw_mode],def_dr_mode
ret
;ãáâ ­®¢ª  à §¬¥à®¢ ®¡ê¥ªâ 
align 4 align 4
proc obj_set_sizes uses eax ebx esi proc obj_set_sizes uses eax ebx esi
stdcall dword[tl_node_poi_get_info], tree3,0 cmp dword[obj_poi_count],0
cmp eax,0
je .end je .end
stdcall [tl_node_poi_get_data], tree3,eax
finit finit
mov eax,[eax] mov eax,[obj_poi_data]
mov ebx,dword[eax] mov ebx,dword[eax]
mov [obj_x_min],ebx mov [obj_x_min],ebx
mov [obj_x_max],ebx mov [obj_x_max],ebx
@ -200,13 +265,10 @@ proc obj_set_sizes uses eax ebx esi
mov [obj_z_min],ebx mov [obj_z_min],ebx
mov [obj_z_max],ebx mov [obj_z_max],ebx
stdcall dword[tl_node_poi_get_info], tree3,0 mov ebx,[obj_poi_data]
mov esi,[obj_poi_count]
align 4 align 4
.cycle_0: ;à ¡®â  á ª®®à¤¨­ â®© x .cycle_0: ;à ¡®â  á ª®®à¤¨­ â®© x
mov esi,eax
stdcall [tl_node_poi_get_data], tree3,esi
mov ebx,[eax]
fld dword[ebx] fld dword[ebx]
fld dword[obj_x_min] fld dword[obj_x_min]
fcomp fcomp
@ -228,9 +290,9 @@ align 4
mov [obj_x_max],eax mov [obj_x_max],eax
.next_x: .next_x:
stdcall dword[tl_node_poi_get_next_info], tree3,esi add ebx,12
cmp eax,0 dec esi
jne .cycle_0 jnz .cycle_0
fld1 fld1
fld dword[obj_x_max] fld dword[obj_x_max]
@ -248,13 +310,10 @@ align 4
fchs fchs
fstp dword[obj_x_centr] fstp dword[obj_x_centr]
stdcall dword[tl_node_poi_get_info], tree3,0 mov ebx,[obj_poi_data]
mov esi,[obj_poi_count]
align 4 align 4
.cycle_1: ;à ¡®â  á ª®®à¤¨­ â®© y .cycle_1: ;à ¡®â  á ª®®à¤¨­ â®© y
mov esi,eax
stdcall [tl_node_poi_get_data], tree3,esi
mov ebx,[eax]
fld dword[ebx+4] fld dword[ebx+4]
fld dword[obj_y_min] fld dword[obj_y_min]
fcomp fcomp
@ -276,9 +335,9 @@ align 4
mov [obj_y_max],eax mov [obj_y_max],eax
.next_y: .next_y:
stdcall dword[tl_node_poi_get_next_info], tree3,esi add ebx,12
cmp eax,0 dec esi
jne .cycle_1 jnz .cycle_1
fld1 fld1
fld dword[obj_y_max] fld dword[obj_y_max]
@ -296,13 +355,10 @@ align 4
fchs fchs
fstp dword[obj_y_centr] fstp dword[obj_y_centr]
stdcall dword[tl_node_poi_get_info], tree3,0 mov ebx,[obj_poi_data]
mov esi,[obj_poi_count]
align 4 align 4
.cycle_2: ;à ¡®â  á ª®®à¤¨­ â®© z .cycle_2: ;à ¡®â  á ª®®à¤¨­ â®© z
mov esi,eax
stdcall [tl_node_poi_get_data], tree3,esi
mov ebx,[eax]
fld dword[ebx+8] fld dword[ebx+8]
fld dword[obj_z_min] fld dword[obj_z_min]
fcomp fcomp
@ -324,9 +380,9 @@ align 4
mov [obj_z_max],eax mov [obj_z_max],eax
.next_z: .next_z:
stdcall dword[tl_node_poi_get_next_info], tree3,esi add ebx,12
cmp eax,0 dec esi
jne .cycle_2 jnz .cycle_2
fld1 fld1
fld dword[obj_z_max] fld dword[obj_z_max]
@ -360,8 +416,18 @@ endp
;à¨á®¢ ­¨¥ â®ç¥ª ¢ 3d ;à¨á®¢ ­¨¥ â®ç¥ª ¢ 3d
align 4 align 4
draw_3d: draw_3d:
cmp dword[obj_poi_count],2
jl .end_f
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë
stdcall [glPushMatrix] stdcall [glPushMatrix]
bt dword[draw_mode],bit_light
jnc @f
call SetLight
jmp .end_l
@@:
stdcall [glDisable],GL_LIGHTING
.end_l:
stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z
stdcall [glScalef], [obj_x_scale],[obj_y_scale],[obj_z_scale] stdcall [glScalef], [obj_x_scale],[obj_y_scale],[obj_z_scale]
stdcall [glScalef], 1.0,1.0,0.7 ;correct for z stdcall [glScalef], 1.0,1.0,0.7 ;correct for z
@ -370,22 +436,22 @@ draw_3d:
stdcall [glRotatef], [angle_x],1.0,0.0,0.0 stdcall [glRotatef], [angle_x],1.0,0.0,0.0
stdcall [glTranslatef], [obj_x_centr],[obj_y_centr],[obj_z_centr] stdcall [glTranslatef], [obj_x_centr],[obj_y_centr],[obj_z_centr]
stdcall [glColor3f], 1.0,1.0,1.0 ;à¨á®¢ ­¨¥ â®ç¥ª
stdcall [glBegin],GL_POINTS bt dword[draw_mode],bit_vertexes
jnc .end_points
stdcall dword[tl_node_poi_get_info], tree3,0 stdcall [glColor3f], 1.0,1.0,1.0
@@: stdcall [glBegin],GL_POINTS
cmp eax,0 mov eax,[obj_poi_data]
je @f mov ebx,[obj_poi_count]
mov esi,eax @@:
stdcall [tl_node_poi_get_data], tree3,esi stdcall [glVertex3f], [eax],[eax+4],[eax+8]
mov eax,[eax] add eax,12
stdcall [glVertex3f], [eax],[eax+4],[eax+8] dec ebx
stdcall dword[tl_node_poi_get_next_info], tree3,esi jnz @b
jmp @b stdcall [glEnd]
@@: .end_points:
stdcall [glEnd]
;à¨á®¢ ­¨¥ ¢ë¤¥«¥­­®© â®çª¨
stdcall [tl_node_get_data],tree3 stdcall [tl_node_get_data],tree3
cmp eax,0 cmp eax,0
je @f je @f
@ -405,17 +471,70 @@ draw_3d:
stdcall [glEnd] stdcall [glEnd]
stdcall [glColor3f], 1.0, 1.0, 0.0 stdcall [glColor3f], 1.0, 1.0, 0.0
stdcall [glTranslatef], [eax],[eax+4],[eax+8] stdcall [glPushMatrix]
stdcall [gluSphere], [qObj], [sph_radius], 8,8 stdcall [glTranslatef], [eax],[eax+4],[eax+8]
stdcall [gluSphere], [qObj], [sph_radius], 8,8
stdcall [glPopMatrix]
@@: @@:
;à¨á®¢ ­¨¥ £à ­¥©
bt dword[draw_mode],bit_faces
jnc .end_triangles
cmp dword[obj_tri_count],0
je .end_triangles
cmp dword[obj_poi_count],0
je .end_triangles
stdcall [glColor3f], 0.5,0.5,0.5
;bt dword[draw_mode],bit_faces_fill
;jnc @f
;@@:
stdcall [glBegin],GL_TRIANGLES
mov eax,[obj_tri_data]
mov ecx,[obj_tri_count]
@@:
movzx ebx,word[eax] ;1-ï ¢¥à設 
imul ebx,12
add ebx,[obj_poi_data]
stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
movzx ebx,word[eax+2] ;2-ï ¢¥à設 
imul ebx,12
add ebx,[obj_poi_data]
stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
movzx ebx,word[eax+4] ;3-ï ¢¥à設 
imul ebx,12
add ebx,[obj_poi_data]
stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
add eax,8 ;à §¬¥à âà¥ã£®«ì­¨ª  = (3 ¢¥à設ë (¯® 2¡) + ᢮©á⢠ (2¡))
dec ecx
jnz @b
stdcall [glEnd]
.end_triangles:
stdcall [glPopMatrix] stdcall [glPopMatrix]
stdcall [kosglSwapBuffers] stdcall [kosglSwapBuffers]
.end_f:
ret ret
align 4 align 4
prop_key: SetLight:
push eax stdcall [glLightfv], GL_LIGHT0, GL_POSITION, light_position
stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, light_dir
stdcall [glLightfv], GL_LIGHT0, GL_DIFFUSE, white_light
stdcall [glLightfv], GL_LIGHT0, GL_SPECULAR, white_light
stdcall [glEnable], GL_COLOR_MATERIAL
stdcall [glColorMaterial], GL_FRONT, GL_AMBIENT_AND_DIFFUSE
stdcall [glMaterialfv], GL_FRONT, GL_SPECULAR, mat_specular
stdcall [glMaterialf], GL_FRONT, GL_SHININESS, mat_shininess
stdcall [glLightModelfv], GL_LIGHT_MODEL_AMBIENT, lmodel_ambient
stdcall [glEnable],GL_LIGHTING
stdcall [glEnable],GL_LIGHT0
ret
align 4
proc prop_key uses eax ebx
mcall 2 mcall 2
test word [edit1.flags],10b ;ed_focus test word [edit1.flags],10b ;ed_focus
@ -433,7 +552,11 @@ push eax
stdcall [edit_box_key], edit3 stdcall [edit_box_key], edit3
jmp .end jmp .end
@@: @@:
stdcall [tl_key], tree3 cmp dword[el_focus], tree3
jne @f
stdcall [tl_key], tree3
jmp .end
@@:
cmp ah,178 ;Up cmp ah,178 ;Up
jne @f jne @f
@ -468,12 +591,13 @@ push eax
;jmp .end ;jmp .end
@@: @@:
.end: .end:
pop eax
ret ret
endp
align 4 align 4
prop_mouse: prop_mouse:
;push ecx edi ;push ecx edi
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
stdcall [tl_mouse], tree3 stdcall [tl_mouse], tree3
stdcall [edit_box_mouse], edit1 stdcall [edit_box_mouse], edit1
stdcall [edit_box_mouse], edit2 stdcall [edit_box_mouse], edit2
@ -557,6 +681,21 @@ prop_button:
pop esi edi ecx ebx eax pop esi edi ecx ebx eax
jmp prop_still.end jmp prop_still.end
@@: @@:
cmp ah,5
jne @f
call mnu_vertexes_on_off
jmp prop_still.end
@@:
cmp ah,6
jne @f
call mnu_faces_on_off
jmp prop_still.end
@@:
cmp ah,7
jne @f
call mnu_light_on_off
jmp prop_still.end
@@:
cmp ah,1 cmp ah,1
jne prop_still.end jne prop_still.end
@ -597,6 +736,39 @@ get_point_coords:
ret ret
align 4 align 4
proc prop_timer_funct uses eax
;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ãî ª®®à¤¨­ âã
stdcall [tl_node_get_data],tree3
cmp [cursor_last_draw],eax
je @f
mov [cursor_last_draw],eax
call draw_3d
@@:
ret
endp
align 4
mnu_vertexes_on_off:
xor dword[draw_mode], 1 shl bit_vertexes
ret
align 4
mnu_faces_on_off:
xor dword[draw_mode], 1 shl bit_faces
ret
align 4
mnu_light_on_off:
xor dword[draw_mode], 1 shl bit_light
ret
align 4
draw_mode dd 0
obj_poi_data dd 0 ;㪠§ â¥«ì ­  ª®®à¤¨­ âë ¢¥à設
obj_poi_count dd 0 ;ª®««¨ç¥á⢮ ¢¥à設
obj_tri_data dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ âà¥ã£®«ì­¨ª®¢
obj_tri_count dd 0 ;ª®««¨ç¥á⢮ âà¥ã£®«ì­¨ª®¢
cursor_last_draw dd 0 ;¯®«®¦¥­¨¥ ªãàá®à  ¯à¨ ¯®á«¥¤­¥© ¯à®à¨á®¢ª¥ 3d ®ª­ 
sph_radius dd 0 ;à ¤¨ãá áä¥àë ¤«ï ¢ë¤¥«¥­¨ï  ªâ¨¢­®© â®çª¨ sph_radius dd 0 ;à ¤¨ãá áä¥àë ¤«ï ¢ë¤¥«¥­¨ï  ªâ¨¢­®© â®çª¨
obj_x_max dd 0 obj_x_max dd 0
obj_x_min dd 0 obj_x_min dd 0
@ -615,12 +787,12 @@ capt_p dd 0
;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥ ;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥
tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,270,303,160, 16, 4,0, el_focus,\ 16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\
w_scr_t3,get_point_coords w_scr_t3,get_point_coords
edit1 edit_box 80, 76, 249, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0 edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0
edit2 edit_box 80, 160, 249, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0 edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0
edit3 edit_box 80, 244, 249, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0
editboxes_end: editboxes_end:
string1 rb 34 string1 rb 34