update program, use *.ini file

git-svn-id: svn://kolibrios.org@5938 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2015-11-29 14:40:02 +00:00
parent 9dc87d083b
commit 612d1e757d
7 changed files with 416 additions and 101 deletions

View File

@ -2,6 +2,7 @@ if not exist bin mkdir bin
@erase lang.inc
@echo lang fix en >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp

View File

@ -2,6 +2,7 @@ if not exist bin mkdir bin
@erase lang.inc
@echo lang fix ru >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp

View File

@ -1,11 +1,8 @@
if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 26.11.15',0 ;¯®¤¯¨áì ®ª­ 
else
capt db 'info 3ds version 26.11.15',0 ;window caption
end if
;
; §¤¥áì á®¡à ­ë ¤ ­­ë¥ ¯® ¡«®ª ¬ *.3ds
;
MAX_FILE_LEVEL equ 20 ;¬ ªá¨¬ «ì­ë© ã஢¥­ì ¢«®¦¥­­®á⨠¡«®ª®¢ ¤«ï  ­ «¨§ 
MAX_FILE_SIZE equ 150*0x400 ;¬ ªá¨¬ «ì­ë© à §¬¥à ä ©«  (0x400=1Kb)
sizeof.block_3ds equ 9
can_save db 0 ;¨§¬¥­ï«áï «¨ ä ©«
@ -295,7 +292,6 @@ end if
if lang eq ru
txt_open_3ds db 'Žâªàëâ ä ©«:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0
txt_3ds_big_file db '<27> §¬¥à ä ©«  ¡®«ìè¥ MAX_FILE_SIZE',0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_count db 'Š®«¨ç¥á⢮',0
txt_3ds_offs:
@ -307,7 +303,6 @@ txt_3ds_offs:
else
txt_open_3ds db 'Open file:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0
txt_3ds_big_file db '<27> §¬¥à ä ©«  ¡®«ìè¥ MAX_FILE_SIZE',0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_count db 'Count',0
txt_3ds_offs:

View File

@ -27,10 +27,12 @@ struct FileInfoBlock
FileName dd ?
ends
run_file_70 FileInfoBlock
align 4
fl255 dd 255.0
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì, ­ã¦¥­ ¤«ï ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
open_file_lif dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢ 3ds
open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢ 3ds
open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
open_b rb 560
;
main_wnd_height equ 460 ;¢ëá®â  £« ¢­®£® ®ª­  ¯à®£à ¬¬ë
@ -126,7 +128,7 @@ start:
add ebp,ll_struc_size
cmp ebp,l_libs_end
jl .test_lib_open
mcall 48,3,sc,sizeof.system_colors
mcall 48,3,sc,sizeof.sys_colors_new
mcall 40,0x27
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
@ -141,12 +143,16 @@ start:
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 [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7
stdcall [ksubmenu_add], [main_menu_view], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 7
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8
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_SUBMENU, sz_main_menu_View, [main_menu_view]
stdcall [ksubmenu_add], [main_menu], eax
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 9
stdcall [ksubmenu_add], [main_menu_view], eax
mov dword[w_scr_t1.type],1
stdcall dword[tl_data_init], tree1
@ -171,16 +177,69 @@ start:
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
stdcall mem.Alloc,MAX_FILE_SIZE
mov dword[open_file_lif],eax
;à ¡®â  á ä ©«®¬ ­ áâ஥ª
copy_path ini_name,sys_path,file_name,0
mov dword[def_dr_mode],0
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_vertexes
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces_fill
@@:
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_light
@@:
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff
mov [color_ox],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000
mov [color_oy],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00
mov [color_oz],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000
mov [color_bk],eax
shr eax,8
mov [color_bk+4],eax
shr eax,8
mov [color_bk+8],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff
mov [color_vert],eax
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080
mov [color_face],eax
finit
fild dword[color_bk+8]
fdiv dword[fl255]
fstp dword[color_bk+8]
mov eax,[color_bk+4]
and eax,0xff
mov [color_bk+4],eax
fild dword[color_bk+4]
fdiv dword[fl255]
fstp dword[color_bk+4]
mov eax,[color_bk]
and eax,0xff
mov [color_bk],eax
fild dword[color_bk]
fdiv dword[fl255]
fstp dword[color_bk]
mcall 26,9
mov [last_time],eax
stdcall [kosglMakeCurrent], 5,23,320,240,ctx1
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
stdcall [glClearColor], 0.0,0.0,0.0,0.0
stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0
stdcall [glShadeModel], GL_SMOOTH
stdcall [gluNewQuadric]
mov [qObj],eax
@ -240,7 +299,7 @@ timer_funct:
stdcall hex_in_str, txt_3ds_offs.dig, eax,8
stdcall hex_in_str, txt_3ds_offs.siz, ecx,8
add eax,dword[open_file_lif] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
add eax,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp dword[offs_last_timer],eax
je @f
;¥á«¨ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå ­¥ ᮢ¯ ¤ ¥â á ¯®á«¥¤­¨¬ § ¯®¬­¥­­ë¬
@ -257,12 +316,6 @@ timer_funct:
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
@@:
popad
;¯à®á¬®âà ®ª­  á ª®®à¤¨­ â ¬¨ â®ç¥ª
;cmp byte[prop_wnd_run],0
;je @f
; call prop_timer_funct
;@@:
jmp still
align 4
@ -283,7 +336,7 @@ proc buf_draw_hex_table, offs:dword, size_line:dword
coord_y dd 55 ;ª®®à¤¨­ â  y ¤«ï ­ ç «  ¢ë¢®¤  â ¡«¨æë
endl
mov esi,dword[offs]
mov edi,dword[open_file_lif]
mov edi,dword[open_file_data]
add edi,dword[file_3ds.size] ;edi - 㪠§ â¥«ì ­  ª®­¥æ ä ©«  ¢ ¯ ¬ïâ¨
mov dword[txt_3ds_offs.dig],0
cld
@ -461,7 +514,7 @@ button:
stdcall [buf2d_delete],buf_0
stdcall [buf2d_delete],buf_1 ;㤠«ï¥¬ ¡ãä¥à
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_lif]
stdcall mem.Free,[open_file_data]
stdcall [gluDeleteQuadric], [qObj]
mcall -1
@ -485,14 +538,27 @@ but_open_file:
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov [run_file_70.Function], 5
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], 0
mov dword[run_file_70.Buffer], open_b
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70
mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
stdcall mem.ReAlloc,[open_file_data],ecx
mov [open_file_data],eax
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov dword[run_file_70.Count], MAX_FILE_SIZE
m2m [run_file_70.Buffer], dword[open_file_lif]
mov dword[run_file_70.Count], ecx
m2m dword[run_file_70.Buffer], dword[open_file_data]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« 3ds
cmp ebx,0xffffffff
je .end_open_file
@ -517,19 +583,13 @@ align 4
init_tree:
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
mov esi,dword[open_file_lif]
mov esi,dword[open_file_data]
cmp word[esi],CHUNK_MAIN
je @f
call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
cmp dword[esi+2],MAX_FILE_SIZE
jle @f
call buf_draw_beg
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_big_file,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
;--- ®¡à ¡®âª  ®âªàë⮣® *.3ds ä ©« 
mov eax,file_3ds
mov dword[level_stack],0 ;®¡­ã«ï¥¬ ã஢¥­ì á⥪ 
@ -771,7 +831,7 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov bx,word[level]
mov eax,esi
sub eax,dword[open_file_lif]
sub eax,dword[open_file_data]
mov dword[buffer],eax ;ᬥ饭¨¥ ¡«®ª 
mov ecx,dword[size_bl]
mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨)
@ -841,14 +901,17 @@ proc print_err, fun:dword, mes:dword ;
ret
endp
end if
;input:
; eax - value
; edi - string buffer
; buf - string buffer
; len - buffer len
;output:
align 4
proc convert_int_to_str, len:dword
proc convert_int_to_str, buf:dword, len:dword
pushad
mov edi,[buf]
mov esi,[len]
add esi,edi
dec esi
@ -876,8 +939,6 @@ align 4
@@:
ret
end if
align 4
proc hex_in_str, buf:dword,val:dword,zif:dword
pushad
@ -917,7 +978,7 @@ but_save_file:
mov [run_file_70.Function], 2
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ebx, dword[open_file_lif]
mov ebx, dword[open_file_data]
mov [run_file_70.Buffer], ebx
mov ebx,dword[ebx+2]
mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©« 
@ -958,7 +1019,7 @@ but_delete_chunk:
mov ecx,[open_file_size]
mov ebx,dword[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
sub ecx,ebx ;ecx - à §¬¥à ­¨¦­¥© ᤢ¨£ ¥¬®© ç á⨠䠩« 
add ebx,dword[open_file_lif] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
mov edi,ebx
mov esi,ebx
add esi,edx
@ -978,7 +1039,7 @@ but_delete_chunk:
jge .cycle_2
mov bl,byte[eax+list_offs_chunk_lev]
mov ecx,[eax]
add ecx,[open_file_lif]
add ecx,[open_file_data]
sub dword[ecx+2],edx
cmp bl,0 ;¥á«¨ á ¬ë© ¢¥àå­¨© 㧥«, â® bl=0
jne .cycle_2
@ -1119,6 +1180,8 @@ system_dir_4 db '/sys/lib/'
lib_name_4 db 'kmenu.obj',0
system_dir_5 db '/sys/lib/'
lib_name_5 db 'tinygl.obj',0
system_dir_6 db '/sys/lib/'
lib_name_6 db 'libini.obj',0
if lang eq ru
head_f_i:
@ -1135,6 +1198,8 @@ if lang eq ru
err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,0
err_msg_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0
err_msg_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0
err_msg_found_lib_6 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,0
err_msg_import_6 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,0
else
head_f_i:
head_f_l db 'System error',0
@ -1150,6 +1215,8 @@ else
err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,0
err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,0
err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,0
err_msg_found_lib_6 db 'Sorry I cannot found library ',39,'libini.obj',39,0
err_msg_import_6 db 'Error on load import library ',39,'libini',39,0
end if
align 4
@ -1166,6 +1233,8 @@ l_libs_start:
err_msg_found_lib_4, head_f_l, import_libkmenu,err_msg_import_4,head_f_i
lib_5 l_libs lib_name_5, sys_path, library_path, system_dir_5,\
err_msg_found_lib_5, head_f_l, import_lib_tinygl,err_msg_import_5,head_f_i
lib_6 l_libs lib_name_6, sys_path, library_path, system_dir_6,\
err_msg_found_lib_6, head_f_l, import_libini, err_msg_import_6,head_f_i
l_libs_end:
align 4
@ -1386,6 +1455,18 @@ macro E_LIB n
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
align 4
import_libini:
dd alib_init0
ini_get_str dd aini_get_str
ini_get_int dd aini_get_int
ini_get_color dd aini_get_color
dd 0,0
alib_init0 db 'lib_init',0
aini_get_str db 'ini_get_str',0
aini_get_int db 'ini_get_int',0
aini_get_color db 'ini_get_color',0
align 4
mouse_dd dd 0x0
last_time dd 0
@ -1420,10 +1501,6 @@ ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
qObj dd 0
angle_x dd 0.0
angle_y dd 0.0
angle_z dd 0.0
delt_size dd 3.0
light_position dd 0.0, 0.0, -2.0, 1.0 ; <20> á¯®«®¦¥­¨¥ ¨áâ®ç­¨ª  [0][1][2]
;[3] = (0.0 - ¡¥áª®­¥ç­® 㤠«¥­­ë© ¨áâ®ç­¨ª, 1.0 - ¨áâ®ç­¨ª á¢¥â  ­  ®¯à¥¤¥«¥­­®¬ à ááâ®ï­¨¨)
@ -1434,10 +1511,27 @@ mat_shininess dd 3.0 ;
white_light dd 0.8, 0.8, 0.8, 1.0 ; –¢¥â ¨ ¨­â¥­á¨¢­®áâì ®á¢¥é¥­¨ï, £¥­¥à¨à㥬®£® ¨áâ®ç­¨ª®¬
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 29.11.15',0 ;¯®¤¯¨áì ®ª­ 
else
capt db 'info 3ds version 29.11.15',0 ;window caption
end if
align 16
i_end:
procinfo process_information
run_file_70 FileInfoBlock
sc system_colors
rb sizeof.sys_colors_new-sizeof.system_colors
angle_x rd 1 ;ã£«ë ¯®¢®à®â  á業ë
angle_y rd 1
angle_z rd 1
color_ox rd 1
color_oy rd 1
color_oz rd 1
color_bk rd 3
color_vert rd 1
color_face rd 1
rb 2048
align 16
thread_coords:

View File

@ -0,0 +1,11 @@
[Window 3d]
draw_vertices=1
draw_faces=1
draw_faces_fill=0
draw_light=0
col_ox=255,0,0
col_oy=0,0,255
col_oz=0,255,0
col_bkgnd=0,32,64
col_vertices=255,255,255
col_faces=128,192,192

View File

@ -1 +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
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_Faces_Fill db '‡ «¨¢ª  £à ­¥© ¢ª«./¢ëª«.', 0 sz_main_menu_Veiw_Light db '‘¢¥â ¢ª«./¢ëª«.', 0 Light db '‘¢¥â ¢ª«./¢ëª«.', 0 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_Faces_Fill db 'Faces fill on/off', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 sz_main_menu_Veiw_Reset db 'Reset settings', 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

@ -4,7 +4,11 @@
;
prop_wnd_width equ 340 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
prop_wnd_height equ 460
prop_wnd_height equ 460 ;¢ëá®â  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
3d_wnd_t equ 23 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
3d_wnd_w equ 320
3d_wnd_h equ 240
SIZE_ONE_FLOAT equ 14
MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1)
@ -12,7 +16,19 @@ bit_vertexes equ 0
bit_faces equ 1
bit_faces_fill equ 2
bit_light equ 3
def_dr_mode equ 0x1111b
ini_name db 'info3ds.ini',0
ini_sec_w3d db 'Window 3d',0
key_dv db 'draw_vertices',0
key_df db 'draw_faces',0
key_dff db 'draw_faces_fill',0
key_dl db 'draw_light',0
key_ox db 'col_ox',0
key_oy db 'col_oy',0
key_oz db 'col_oz',0
key_bk db 'col_bkgnd',0
key_vert db 'col_vertices',0
key_face db 'col_faces',0
prop_wnd_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­®
@ -46,29 +62,68 @@ pushad
cmp eax,0
je .no_points
mov ebx,[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª 
add ebx,[open_file_lif]
add ebx,[open_file_data]
cmp word[ebx],CHUNK_VERTLIST
jne .end_vlist
movzx edx,word[ebx+6] ;ª®««¨ç¥á⢮ â®ç¥ª
add ebx,8
mov dword[capt_p],txt_4110
;¯®¨áª ¤ ­­ëå ¤«ï âà¥ã£®«ìª®¢
mov ecx,eax
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 word[ebx],CHUNK_OBJBLOCK
jne .end_oblo
mov dword[capt_p],txt_4000
call found_block_data
cmp eax,0
jne @b
jmp .set_points
@@:
;¥á«¨ ­ è«¨ ¢ë¡à ­­ë© 㧥«, â® ¤ «¥¥ ¯ëâ ¥¬áï ­ ©â¨ 㧥« á âà¥ã£®«ì­¨ª ¬¨
je .no_points
mov esi,eax
movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
.cycle_0:
stdcall [tl_node_poi_get_next_info], tree1,esi
cmp eax,0
je .no_points
cmp byte[eax+2],cl
jle .no_points
mov esi,eax
stdcall [tl_node_poi_get_data], tree1,esi
mov ebx,[eax]
add ebx,[open_file_data]
cmp word[ebx],CHUNK_VERTLIST
je .ini_vlist
jmp .cycle_0
jmp .no_points
.end_oblo:
cmp word[ebx],CHUNK_TRIMESH
jne .end_trim
mov dword[capt_p],txt_4100
call found_block_data
cmp eax,0
je .no_points
mov esi,eax
movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
.cycle_1:
stdcall [tl_node_poi_get_next_info], tree1,esi
cmp eax,0
je .no_points
cmp byte[eax+2],cl
jle .no_points
mov esi,eax
stdcall [tl_node_poi_get_data], tree1,esi
mov ebx,[eax]
add ebx,[open_file_data]
cmp word[ebx],CHUNK_VERTLIST
je .ini_vlist
jmp .cycle_1
jmp .no_points
.end_trim:
cmp word[ebx],CHUNK_VERTLIST
jne .end_vlist
mov dword[capt_p],txt_4110
.ini_vlist:
movzx edx,word[ebx+6] ;ª®««¨ç¥á⢮ â®ç¥ª
add ebx,8
;¯®¨áª ¤ ­­ëå ¤«ï âà¥ã£®«ìª®¢
call found_block_data
cmp eax,0
je .set_points
mov esi,eax
;¥á«¨ ­ è«¨ ¢ë¡à ­­ë© 㧥«, â® ¤ «¥¥ ¯ëâ ¥¬áï ­ ©â¨ 㧥« á âà¥ã£®«ì­¨ª ¬¨
movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
.cycle_2:
stdcall [tl_node_poi_get_next_info], tree1,esi
cmp eax,0
je .set_points
@ -77,14 +132,14 @@ pushad
cmp byte[esi+2],cl
jl .set_points
je .found
jmp .cycle_0
jmp .cycle_2
.found: ;¥á«¨ ­ è«¨ 㧥« ⮣®¦¥ ã஢­ï çâ® ¨ ¢ë¡à ­­ë© 㧥«
cmp eax,0
je .set_points
mov eax,[eax]
add eax,[open_file_lif]
add eax,[open_file_data]
cmp word[eax],CHUNK_FACELIST
jne .cycle_0
jne .cycle_2
movzx ecx,word[eax+6]
mov [obj_tri_count],ecx
add eax,8 ;2+4+2 (chunk+size+count)
@ -155,6 +210,24 @@ pushad
stdcall [edit_box_set_text], edit1, txt_q
stdcall [edit_box_set_text], edit2, txt_q
stdcall [edit_box_set_text], edit3, txt_q
mov eax,0xc0c0c0
mov ebx,[color_ox]
shr ebx,2
and ebx,0x3f3f3f
add eax,ebx
mov [edit1.color],eax
mov eax,0xc0c0c0
mov ebx,[color_oy]
shr ebx,2
and ebx,0x3f3f3f
add eax,ebx
mov [edit2.color],eax
mov eax,0xc0c0c0
mov ebx,[color_oz]
shr ebx,2
and ebx,0x3f3f3f
add eax,ebx
mov [edit3.color],eax
popad
call prop_red_win
@ -207,7 +280,8 @@ pushad
add cx,word[buf_0.t]
shl ecx,16
mov cx,prop_wnd_height
mov edx,0xffffd0+0x33000000
mov edx,[sc.work]
or edx,0x33000000
int 0x40
mov esi,[sc.work_button]
@ -215,7 +289,7 @@ pushad
mcall , (30 shl 16)+20, (266 shl 16)+20, 4
mov ebx,[image_data_toolbar]
add ebx,4*IMAGE_TOOLBAR_ICON_SIZE
add ebx,3*IMAGE_TOOLBAR_ICON_SIZE
mcall 7, , (16 shl 16)+16, (7 shl 16)+268 ;load
sub ebx,IMAGE_TOOLBAR_ICON_SIZE
@ -238,14 +312,39 @@ popad
;ãáâ ­®¢ª  ¢á¥å ®á­®¢­ëå ¯¥à¥¬¥­­ëå ¯® 㬮«ç ­¨î
align 4
prop_wnd_clear_param:
mov dword[angle_x],0.0
mov dword[angle_y],0.0
mov dword[angle_z],0.0
;ãáâ ­®¢ª  ¯ à ¬¥â஢ ®â®¡à ¦¥­¨ï
call mnu_reset_settings
;®¡­ã«¥­¨¥ 㪠§ â¥«¥© ­  ¤ ­­ë¥ ®¡ê¥ªâ®¢
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
;¯®¨áª ¤ ­­ëå
;input:
;eax - ⥪ã騩 㧥«
;output:
;eax - áâàãªâãà  â¥ªã饣® 㧫  (¨«¨ 0 ¯à¨ ­¥ã¤ ç¥)
align 4
found_block_data:
push ebx ecx
mov ecx,eax
stdcall [tl_node_poi_get_info], tree1,0
@@:
mov ebx,eax
stdcall [tl_node_poi_get_data], tree1,ebx
cmp eax,ecx
je @f ;¥á«¨ ¯®¯ «¨ ­  ¢ë¡à ­­ë© 㧥«
stdcall [tl_node_poi_get_next_info], tree1,ebx
cmp eax,0
jne @b
jmp .end
@@:
mov eax,ebx
.end:
pop ecx ebx
ret
;ãáâ ­®¢ª  à §¬¥à®¢ ®¡ê¥ªâ 
@ -418,7 +517,6 @@ align 4
draw_3d:
cmp dword[obj_poi_count],2
jl .end_f
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë
stdcall [glPushMatrix]
bt dword[draw_mode],bit_light
@ -439,7 +537,7 @@ draw_3d:
;à¨á®¢ ­¨¥ â®ç¥ª
bt dword[draw_mode],bit_vertexes
jnc .end_points
stdcall [glColor3f], 1.0,1.0,1.0
stdcall [glColor3ub],[color_vert+2],[color_vert+1],[color_vert]
stdcall [glBegin],GL_POINTS
mov eax,[obj_poi_data]
mov ebx,[obj_poi_count]
@ -459,13 +557,13 @@ draw_3d:
mov eax,[eax]
stdcall [glBegin],GL_LINES
stdcall [glColor3f], 1.0, 0.0, 0.0
stdcall [glColor3ub],[color_ox+2],[color_ox+1],[color_ox]
stdcall [glVertex3f], [obj_x_min],[eax+4],[eax+8]
stdcall [glVertex3f], [obj_x_max],[eax+4],[eax+8]
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glColor3ub],[color_oy+2],[color_oy+1],[color_oy]
stdcall [glVertex3f], [eax],[obj_y_min],[eax+8]
stdcall [glVertex3f], [eax],[obj_y_max],[eax+8]
stdcall [glColor3f], 0.0, 1.0, 0.0
stdcall [glColor3ub],[color_oz+2],[color_oz+1],[color_oz]
stdcall [glVertex3f], [eax],[eax+4],[obj_z_min]
stdcall [glVertex3f], [eax],[eax+4],[obj_z_max]
stdcall [glEnd]
@ -484,10 +582,15 @@ draw_3d:
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
;@@:
bt dword[draw_mode],bit_faces_fill
jc @f
push GL_LINE
jmp .end_0
@@:
push GL_FILL
.end_0:
stdcall [glPolygonMode], GL_FRONT_AND_BACK ;mode - 㦥 ¢ á⥪¥
stdcall [glColor3ub],[color_face+2],[color_face+1],[color_face]
stdcall [glBegin],GL_TRIANGLES
mov eax,[obj_tri_data]
mov ecx,[obj_tri_count]
@ -596,13 +699,87 @@ endp
align 4
prop_mouse:
;push ecx edi
push eax ebx
mcall 37,3
bt eax,0
jnc .end_m
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
mcall 37,1 ;get mouse coords
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jg @f
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jle @f
mov ebx,3d_wnd_w
@@:
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
jg @f
mov eax,3d_wnd_t
@@:
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jle @f
mov eax,3d_wnd_h
@@:
finit
fild dword[mouse_y]
mov [mouse_y],eax
fisub dword[mouse_y]
fdiv dword[angle_dxm] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ y (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ x
fadd dword[angle_x]
fstp dword[angle_x]
fild dword[mouse_x]
mov [mouse_x],ebx
fisub dword[mouse_x]
fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
fadd dword[angle_y]
fstp dword[angle_y]
call draw_3d
jmp .end_d
.end_m:
bt eax,16
jnc @f
;mouse l. but. up
mov dword[mouse_drag],0
jmp .end_d
@@:
bt eax,8
jnc .end_d
;mouse l. but. press
mcall 37,1 ;get mouse coords
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jg .end_d
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
jl .end_d
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jg .end_d
mov dword[mouse_drag],1
mov dword[mouse_x],ebx
mov dword[mouse_y],eax
.end_d:
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
stdcall [tl_mouse], tree3
stdcall [edit_box_mouse], edit1
stdcall [edit_box_mouse], edit2
stdcall [edit_box_mouse], edit3
;pop edi ecx
pop ebx eax
ret
align 4
@ -692,10 +869,20 @@ prop_button:
jmp prop_still.end
@@:
cmp ah,7
jne @f
call mnu_faces_fill_on_off
jmp prop_still.end
@@:
cmp ah,8
jne @f
call mnu_light_on_off
jmp prop_still.end
@@:
cmp ah,9
jne @f
call mnu_reset_settings
jmp prop_still.end
@@:
cmp ah,1
jne prop_still.end
@ -747,23 +934,49 @@ proc prop_timer_funct uses eax
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_faces_fill_on_off:
xor dword[draw_mode], 1 shl bit_faces_fill
or 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
mnu_reset_settings:
mov dword[angle_x],0.0
mov dword[angle_y],0.0
mov dword[angle_z],0.0
m2m dword[draw_mode],dword[def_dr_mode]
ret
align 4
def_dr_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ¯® 㬮«ç ­¨î
delt_size dd 3.0 ;¨§¬¥­¥­¨¥ 㣫®¢ ¯à¨ ¯®¢®à®â å á ª«¨¢¨ âãàë
mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
mouse_x dd 0
mouse_y dd 0
angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
angle_dym dd 1.3335 ;~ 3d_wnd_h/180
;angle_dzm dd ?
draw_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ®¡ê¥ªâ 
obj_poi_data dd 0 ;㪠§ â¥«ì ­  ª®®à¤¨­ âë ¢¥à設
obj_poi_count dd 0 ;ª®««¨ç¥á⢮ ¢¥à設
obj_tri_data dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ âà¥ã£®«ì­¨ª®¢