update programs

git-svn-id: svn://kolibrios.org@6081 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-01-19 20:53:55 +00:00
parent 87bab698eb
commit fc6f59584d
6 changed files with 334 additions and 161 deletions

View File

@ -52,16 +52,16 @@ block_3ds 0x0011,4,1,txt_0011
block_3ds 0x0100,3,1,txt_0100
block_3ds CHUNK_ambient_color,3,0,txt_2100 ; [-] ambient color
block_3ds CHUNK_OBJMESH, 3,0,txt_3d3d
block_3ds CHUNK_OBJBLOCK,3,1,txt_4000
block_3ds CHUNK_OBJBLOCK,11,1,txt_4000
block_3ds CHUNK_TRIMESH, 3,0,txt_4100
block_3ds CHUNK_VERTLIST,3,1,txt_4110
block_3ds CHUNK_VERTLIST,8,1,txt_4110
block_3ds CHUNK_FACELIST,3,1,txt_4120
block_3ds CHUNK_FACEMAT, 3,1,txt_4130
block_3ds CHUNK_FACEMAT,10,1,txt_4130
block_3ds CHUNK_MAPLIST, 3,1,txt_4140
block_3ds CHUNK_TRMATRIX,3,1,txt_4160
block_3ds 0x4600,3,1,txt_4600
block_3ds CHUNK_CAMERA, 3,1,txt_4700
block_3ds CHUNK_MATERIAL,3,0,txt_afff
block_3ds CHUNK_MATERIAL,10,0,txt_afff
block_3ds CHUNK_MATNAME, 3,1,txt_a000
block_3ds 0xa010,4,0,txt_a010
block_3ds 0xa020,4,0,txt_a020

View File

@ -1,10 +1,11 @@
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 1, start, i_end, mem, stacktop, 0, sys_path
dd 1, start, i_end, mem, stacktop, file_name, sys_path
include '../../macros.inc'
include '../../proc32.inc'
include '../../kosfuncs.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
@ -55,7 +56,7 @@ image_data_toolbar dd 0
TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
icon_tl_sys dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
icon_toolbar dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
IMAGE_CHUNKS_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
IMAGE_CHUNKS_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*12+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
;
IMAGE_FILE1_SIZE equ 128*144*3+54 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬
@ -76,14 +77,14 @@ macro load_image_file path,buf,size { ;
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
mov [run_file_70.Function], 0
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
mov [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
@ -120,19 +121,32 @@ include 'info_wnd_coords.inc'
align 4
start:
;--- copy cmd line ---
mov esi,file_name
mov edi,openfile_path
@@:
lodsd
cmp eax,0
je @f ;¢ë室, ¥á«¨ 0
stosd
jmp @b
@@:
stosd
load_libraries l_libs_start,l_libs_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨«¨áì ¡¨¡«¨®â¥ª¨
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
mcall SF_TERMINATE_PROCESS ;exit not correct
@@:
add ebp,ll_struc_size
cmp ebp,l_libs_end
jl .test_lib_open
mcall 48,3,sc,sizeof.sys_colors_new
mcall 40,0x27
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.sys_colors_new
mcall SF_SET_EVENTS_MASK,0x27
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
;kmenu initialisation
@ -255,7 +269,7 @@ start:
fdiv dword[fl255]
fstp dword[color_bk]
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
@ -266,11 +280,21 @@ start:
stdcall [gluNewQuadric]
mov [qObj],eax
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
mov dword[buf_ogl],eax
;open file from cmd line
cmp dword[openfile_path],0
je @f
call but_open_file.no_dlg
@@:
call draw_window
align 4
still:
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov ebx,[last_time]
add ebx,10 ;§ ¤¥à¦ª 
cmp ebx,eax
@ -278,7 +302,7 @@ still:
mov ebx,eax
@@:
sub ebx,eax
mcall 23
mcall SF_WAIT_EVENT_TIMEOUT
cmp eax,0
je timer_funct
@ -293,7 +317,7 @@ still:
jz button
cmp al,6
jne @f
mcall 9,procinfo,-1
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo+4]
jne @f ;®ª­® ­¥  ªâ¨¢­®
call mouse
@ -308,7 +332,7 @@ mouse:
align 4
timer_funct:
pushad
mcall 26,9
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå
@ -316,7 +340,7 @@ timer_funct:
cmp eax,0
je @f
mov ebx,eax
mov eax,dword[ebx] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
mov eax,dword[ebx]
mov ecx,dword[ebx+4] ;à §¬¥à ¡«®ª 
stdcall hex_in_str, txt_3ds_offs.dig, eax,8
stdcall hex_in_str, txt_3ds_offs.siz, ecx,8
@ -326,7 +350,7 @@ timer_funct:
je @f
;¥á«¨ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå ­¥ ᮢ¯ ¤ ¥â á ¯®á«¥¤­¨¬ § ¯®¬­¥­­ë¬
mov dword[offs_last_timer],eax
call buf_draw_beg
stdcall buf_draw_beg, buf_0
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_offs,5,35,0xb000
mov edx,dword[ebx+list_offs_p_data]
cmp edx,0 ;ᬮâਬ ¥áâì «¨ ®¯¨á ­¨¥ ¡«®ª 
@ -340,17 +364,6 @@ timer_funct:
popad
jmp still
align 4
buf_draw_beg:
stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
stdcall [buf2d_draw_text], buf_0, buf_1,txt_open_3ds,5,5,0xff
stdcall [buf2d_draw_text], buf_0, buf_1,openfile_path,5,15,0xff
cmp dword[level_stack],FILE_ERROR_CHUNK_SIZE ;¢®§¬®¦­  ®è¨¡ª  ä ©« 
jne @f
stdcall [buf2d_draw_text], buf_0, buf_1,txt_3ds_err_sizes,5,25,0xff0000
@@:
ret
align 4
proc buf_draw_hex_table, offs:dword, size_line:dword
pushad
@ -408,14 +421,14 @@ endp
align 4
draw_window:
pushad
mcall 12,1
mcall SF_REDRAW,SSF_BEGIN_DRAW
xor eax,eax
mov edx,[sc.work]
or edx,0x33000000
mov edi,capt
mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height
mcall 9,procinfo,-1
mcall SF_THREAD_INFO,procinfo,-1
mov eax,dword[procinfo.box.height]
cmp eax,250
jge @f
@ -444,23 +457,17 @@ pushad
mov word[buf_0.l],ax
mov esi,[sc.work_button]
mcall 8,(5 shl 16)+20,(5 shl 16)+20,3
mov ebx,(30 shl 16)+20
mov edx,4
int 0x40
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3
mcall ,(30 shl 16)+20,,4
cmp byte[can_save],0
je @f
mov ebx,(55 shl 16)+20
mov edx,5
int 0x40
mcall ,(55 shl 16)+20,,5
@@:
mcall ,(85 shl 16)+20,,6 ;®ª­® á ª®®à¤¨­ â ¬¨
mcall ,(110 shl 16)+20,,7 ;㤠«¥­¨¥ ¡«®ª 
mcall 7,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;new
mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;new
add ebx,IMAGE_TOOLBAR_ICON_SIZE
mov edx,(32 shl 16)+7 ;open
@ -487,20 +494,20 @@ pushad
stdcall [buf2d_draw], buf_0
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
popad
ret
align 4
key:
mcall 2
mcall SF_GET_KEY
stdcall [tl_key], dword tree1
jmp still
align 4
button:
mcall 17
mcall SF_GET_BUTTON
cmp ah,3
jne @f
call but_new_file
@ -538,7 +545,7 @@ button:
stdcall mem.Free,[image_data_toolbar]
stdcall mem.Free,[open_file_data]
stdcall [gluDeleteQuadric], [qObj]
mcall -1
mcall SF_TERMINATE_PROCESS
align 4
@ -559,33 +566,36 @@ but_open_file:
cmp [OpenDialog_data.status],2
je .end_open_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov [run_file_70.Function], 5
jmp @f
.no_dlg: ;¥á«¨ ¬¨­ã¥¬ ¤¨ «®£ ®âªàëâ¨ï ä ©« 
pushad
@@:
mov [run_file_70.Function], SSF_GET_INFO
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
mcall SF_FILE,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.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
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 ;§ £à㦠¥¬ ä ©« 3ds
mcall SF_FILE,run_file_70 ;§ £à㦠¥¬ ä ©« 3ds
cmp ebx,0xffffffff
je .end_open_file
mov [open_file_size],ebx
;mcall 71,1,openfile_path
;mcall SF_SET_CAPTION,1,openfile_path
mov byte[can_save],0
call init_tree
@ -608,7 +618,7 @@ init_tree:
mov esi,dword[open_file_data]
cmp word[esi],CHUNK_MAIN
je @f
call buf_draw_beg
stdcall buf_draw_beg, buf_0
stdcall [buf2d_draw_text], buf_0, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
@ -659,6 +669,7 @@ init_tree:
; ­ «¨§ ¤ ­­ëå ¡«®ª 
;input:
; eax - stack pointer
; esi - memory pointer
;output:
; eax - new stack pointer
@ -716,11 +727,16 @@ block_analiz_data:
sub ecx,eax
cmp ecx,1
jl .data_3 ;¯à®¢¥à塞 ¥áâì «¨ ¡«®ª ®¯¨á뢠î騩 ¬ â¥à¨ «, ¯à¨¬¥­ï¥¬ë© ª ®¡ê¥ªâã
if 0
add esi,eax
mov ecx,dword[esi+2]
stdcall add_3ds_object, 10,ebx,ecx,0 ;¤ ­­ë¥ ¬ â¥à¨ « 
sub esi,eax
else
add esi,eax
pop eax
jmp .next_bl
;stdcall add_3ds_object, ID_ICON_DATA,ebx,ecx,0 ;¤ ­­ë¥ ¬ â¥à¨ « 
;sub esi,eax ;¢®ááâ ­®¢«¥­¨¥ esi
end if
.data_3:
sub esi,8 ;¢®ááâ ­®¢«¥­¨¥ esi
@ -928,32 +944,6 @@ align 4
@@:
ret
align 4
proc hex_in_str, buf:dword,val:dword,zif:dword
pushad
mov edi,dword[buf]
mov ecx,dword[zif]
add edi,ecx
dec edi
mov ebx,dword[val]
.cycle:
mov al,bl
and al,0xf
cmp al,10
jl @f
add al,'a'-'0'-10
@@:
add al,'0'
mov byte[edi],al
dec edi
shr ebx,4
loop .cycle
popad
ret
endp
align 4
but_save_file:
pushad
@ -964,7 +954,7 @@ but_save_file:
je .end_save_file
;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
mov [run_file_70.Function], 2
mov [run_file_70.Function], SSF_CREATE_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov ebx, dword[open_file_data]
@ -973,7 +963,7 @@ but_save_file:
mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©« 
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], openfile_path
mcall 70,run_file_70
mcall SF_FILE,run_file_70
cmp ebx,0xffffffff
je .end_save_file
;...á®®¡é¥­¨¥...
@ -986,7 +976,7 @@ but_wnd_coords:
cmp byte[prop_wnd_run],0
jne @f
pushad
mcall 51,1,prop_start,thread_coords
mcall SF_CREATE_THREAD,1,prop_start,thread_coords
popad
@@:
ret
@ -1006,7 +996,7 @@ but_delete_chunk:
mov edx,dword[eax+4] ;à §¬¥à ¡«®ª 
sub [open_file_size],edx ;¨§¬¥­¥­¨¥ à §¬¥à®¢ ä ©« 
mov ecx,[open_file_size]
mov ebx,dword[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
mov ebx,dword[eax]
sub ecx,ebx ;ecx - à §¬¥à ­¨¦­¥© ᤢ¨£ ¥¬®© ç á⨠䠩« 
add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
mov edi,ebx
@ -1429,9 +1419,9 @@ 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 ¢¥àá¨ï 16.01.16',0 ;¯®¤¯¨áì ®ª­ 
capt db 'info 3ds ¢¥àá¨ï 19.01.16',0 ;¯®¤¯¨áì ®ª­ 
else
capt db 'info 3ds version 16.01.16',0 ;window caption
capt db 'info 3ds version 19.01.16',0 ;window caption
end if
align 16

View File

@ -61,7 +61,7 @@ image_data_toolbar dd 0
TREE_ICON_SYS16_BMP_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
icon_tl_sys dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
icon_toolbar dd 0 ;㪠§ â¥¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï ¨ª®­®ª ®¡ê¥ªâ®¢
IMAGE_CHUNKS_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
IMAGE_CHUNKS_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*12+54 ;à §¬¥à bmp ä ©«  á ¨ª®­ª ¬¨ ®¡ê¥ªâ®¢
;
IMAGE_FILE1_SIZE equ 128*144*3+54 ;à §¬¥à ä ©«  á ¨§®¡à ¦¥­¨¥¬
@ -320,6 +320,15 @@ mouse:
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
stdcall [tl_node_get_data],tree1
cmp eax,0
je .end_d
mov ebx,dword[eax]
add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp word[ebx],CHUNK_OBJBLOCK
jne .end_d
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
shr ebx,16 ;mouse.x
@ -358,8 +367,7 @@ mouse:
fstp dword[angle_y]
stdcall [tl_node_get_data],tree1
cmp eax,0
je .end_d
;cmp eax,0 - ­¥ ­ ¤®, ¡ë«® ᤥ« ­® ¢ëè¥
add eax,list_offs_obj3d
stdcall draw_3d, eax
jmp .end_d
@ -410,7 +418,7 @@ timer_funct:
mov edi,eax
add edi,list_offs_obj3d
mov ebx,eax
mov eax,dword[ebx] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
mov eax,dword[ebx]
mov ecx,dword[ebx+4] ;à §¬¥à ¡«®ª 
stdcall hex_in_str, txt_3ds_offs.dig, eax,8
stdcall hex_in_str, txt_3ds_offs.siz, ecx,8
@ -434,7 +442,22 @@ timer_funct:
call mnu_reset_settings ;á¡à®á 㣫®¢ ¯®¢®à®â  ¨ ०¨¬®¢ à¨á®¢ ­¨ï
jmp .end_f
.end_oblo:
call buf_draw_beg
cmp word[eax],CHUNK_MATERIAL
jne .end_mblo
cmp dword[edi+offs_mat_name],0
je .ini_mblo
stdcall draw_material,edi
jmp .end_f
.ini_mblo:
stdcall mat_init,edi ;¯®¯ë⪠ ­ áâநâì ¤ ­­ë¥ ¬ â¥à¨ « 
cmp dword[edi+offs_mat_name],0
je .end_f
stdcall draw_material,edi
jmp .end_f
.end_mblo:
stdcall buf_draw_beg, buf_ogl
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000
mov edx,dword[ebx+list_offs_p_data]
cmp edx,0 ;ᬮâਬ ¥áâì «¨ ®¯¨á ­¨¥ ¡«®ª 
@ -446,17 +469,6 @@ timer_funct:
popad
jmp still
align 4
buf_draw_beg:
stdcall [buf2d_clear], buf_ogl, [buf_ogl.color] ;ç¨á⨬ ¡ãä¥à
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_open_3ds,5,5,0xff
stdcall [buf2d_draw_text], buf_ogl, buf_1,openfile_path,5,15,0xff
cmp dword[level_stack],FILE_ERROR_CHUNK_SIZE ;¢®§¬®¦­  ®è¨¡ª  ä ©« 
jne @f
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_err_sizes,5,25,0xff0000
@@:
ret
align 4
draw_window:
pushad
@ -715,7 +727,7 @@ init_tree:
mov esi,dword[open_file_data]
cmp word[esi],CHUNK_MAIN
je @f
call buf_draw_beg
stdcall buf_draw_beg, buf_ogl
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open
@@:
@ -738,14 +750,14 @@ init_tree:
mov edx,dword[esi+2] ;à §¬¥à ¡«®ª 
call block_analiz
;cmp word[esi],CHUNK_MATERIAL
;je @f
cmp word[esi],CHUNK_OBJMESH
je @f
cmp word[esi],CHUNK_OBJBLOCK
je @f
mov dword[bl_found],0
@@:
cmp word[esi],CHUNK_MATERIAL
je @f
cmp word[esi],CHUNK_OBJMESH
je @f
cmp word[esi],CHUNK_OBJBLOCK
je @f
mov dword[bl_found],0
@@:
cmp dword[bl_found],0
jne @f
;®¡ê¥ªâ ­¥ ¨§¢¥áâ­®£® ¢¨¤ 
@ -760,10 +772,19 @@ mov dword[bl_found],0
add esi,6
push esi
sub esi,6
jmp .pod2
jmp .pod3
.pod1:
push dword[ecx+5] ;áâ ­¤ àâ­®¥ ­ §¢ ­¨¥ ¡«®ª 
cmp word[esi],CHUNK_MATERIAL
jne .pod2
cmp word[esi+6],CHUNK_MATNAME
jne .pod2
add esi,12
push esi
sub esi,12
jmp .pod3
.pod2:
push dword[ecx+5] ;áâ ­¤ àâ­®¥ ­ §¢ ­¨¥ ¡«®ª 
.pod3:
stdcall add_3ds_object, ebx,dword[level_stack],edx
cmp byte[ecx+4],1
je .bl_data
@ -782,6 +803,7 @@ mov dword[bl_found],0
; ­ «¨§ ¤ ­­ëå ¡«®ª 
;input:
; eax - stack pointer
; esi - memory pointer
;output:
; eax - new stack pointer
@ -833,9 +855,16 @@ proc block_analiz_data uses ebx ecx edx edi
sub ecx,eax
cmp ecx,1
jl .data_3 ;¯à®¢¥à塞 ¥áâì «¨ ¡«®ª ®¯¨á뢠î騩 ¬ â¥à¨ «, ¯à¨¬¥­ï¥¬ë© ª ®¡ê¥ªâã
if 1
add esi,eax
mov ecx,dword[esi+2]
stdcall add_3ds_object, 10,ebx,ecx,0 ;¤ ­­ë¥ ¬ â¥à¨ « 
sub esi,eax
else
add esi,eax
pop eax
jmp .next_bl
end if
.data_3:
sub esi,8 ;¢®ááâ ­®¢«¥­¨¥ esi
@ -1044,31 +1073,6 @@ align 4
@@:
ret
align 4
proc hex_in_str, buf:dword,val:dword,zif:dword
pushad
mov edi,dword[buf]
mov ecx,dword[zif]
add edi,ecx
dec edi
mov ebx,dword[val]
.cycle:
mov al,bl
and al,0xf
cmp al,10
jl @f
add al,'a'-'0'-10
@@:
add al,'0'
mov byte[edi],al
dec edi
shr ebx,4
loop .cycle
popad
ret
endp
;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
align 4
OpenDialog_data:
@ -1448,9 +1452,9 @@ 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 [user] ¢¥àá¨ï 16.01.16',0 ;¯®¤¯¨áì ®ª­ 
capt db 'info 3ds [user] ¢¥àá¨ï 19.01.16',0 ;¯®¤¯¨áì ®ª­ 
else
capt db 'info 3ds [user] version 16.01.16',0 ;window caption
capt db 'info 3ds [user] version 19.01.16',0 ;window caption
end if
align 16

View File

@ -48,6 +48,17 @@ offs_obj_z_min equ 68
offs_obj_z_centr equ 72
offs_obj_z_scale equ 76
struct material
name dd ?
col_ambient dd ? ;梥⠬ â¥à¨ « 
col_diffuse dd ?
col_specular dd ?
ends
offs_mat_name equ 0
offs_mat_col_ambient equ 4
offs_mat_col_diffuse equ 8
offs_mat_col_specular equ 12
bit_vertexes equ 0
bit_faces equ 1
@ -71,6 +82,30 @@ key_select db 'col_select',0
rad_c dd 150 ;¤«ï ¢ëç¨á«¥­¨ï à ¤¨ãá 
align 4
proc hex_in_str, buf:dword,val:dword,zif:dword
pushad
mov edi,dword[buf]
mov ecx,dword[zif]
add edi,ecx
dec edi
mov ebx,dword[val]
.cycle:
mov al,bl
and al,0xf
cmp al,10
jl @f
add al,'a'-'0'-10
@@:
add al,'0'
mov byte[edi],al
dec edi
shr ebx,4
loop .cycle
popad
ret
endp
;ãáâ ­®¢ª  ¢á¥å ®á­®¢­ëå ¯¥à¥¬¥­­ëå ¯® 㬮«ç ­¨î
align 4
@ -503,6 +538,151 @@ end if
ret
endp
;­ áâனª  ¬ â¥à¨ « 
align 4
proc mat_init, m_data:dword
pushad
mov edi,[m_data]
;... clear edi ...
mov dword[edi+offs_mat_name],0
mov dword[edi+offs_mat_col_ambient],0
mov dword[edi+offs_mat_col_diffuse],0
mov dword[edi+offs_mat_col_specular],0
stdcall [tl_node_get_data],tree1
xor edx,edx
cmp eax,0
je .no_material
mov ebx,[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª 
add ebx,[open_file_data]
xor ecx,ecx
cmp word[ebx],CHUNK_MATERIAL
jne .no_material
mov ecx,ebx
add ecx,dword[ecx+2] ;£à ­¨æ  ¡«®ª 
add ebx,6
cmp word[ebx],CHUNK_MATNAME
jne .no_material
;*** (0) ***
mov esi,ebx
add ebx,6
mov [edi+offs_mat_name],ebx
sub ebx,6
;*** (1) ***
.cycle_0: ;横« ¤«ï ¯®¨áª  æ¢¥â  ¬ â¥à¨ « 
add esi,dword[esi+2]
cmp word[esi],0xa010
je @f
cmp ecx,esi
jg .cycle_0 ;¯®ª  ­¥ ¤®á⨣­ãâ  £à­¨æ  áâ à襣® ¡«®ª 
jmp .end_material ;¥á«¨ ­¥ ­ è«¨ 梥⠬ â¥à¨ « 
@@:
;¥á«¨ ­ è«¨ 梥⠬ â¥à¨ « 
add esi,6
cmp word[esi],0x0011
jne .end_material
add esi,6
mov dl,byte[esi]
mov [edi+offs_mat_col_ambient+2],dl
mov dx,word[esi+1]
ror dx,8
mov [edi+offs_mat_col_ambient],dx
;*** (2) ***
mov esi,ebx
.cycle_1: ;横« ¤«ï ¯®¨áª  æ¢¥â  ¬ â¥à¨ « 
add esi,dword[esi+2]
cmp word[esi],0xa020
je @f
cmp ecx,esi
jg .cycle_1 ;¯®ª  ­¥ ¤®á⨣­ãâ  £à­¨æ  áâ à襣® ¡«®ª 
jmp .end_material ;¥á«¨ ­¥ ­ è«¨ 梥⠬ â¥à¨ « 
@@:
;¥á«¨ ­ è«¨ 梥⠬ â¥à¨ « 
add esi,6
cmp word[esi],0x0011
jne .end_material
add esi,6
mov dl,byte[esi]
mov [edi+offs_mat_col_diffuse+2],dl
mov dx,word[esi+1]
ror dx,8
mov [edi+offs_mat_col_diffuse],dx
;*** (3) ***
mov esi,ebx
.cycle_2: ;横« ¤«ï ¯®¨áª  æ¢¥â  ¬ â¥à¨ « 
add esi,dword[esi+2]
cmp word[esi],0xa030
je @f
cmp ecx,esi
jg .cycle_2 ;¯®ª  ­¥ ¤®á⨣­ãâ  £à­¨æ  áâ à襣® ¡«®ª 
jmp .end_material ;¥á«¨ ­¥ ­ è«¨ 梥⠬ â¥à¨ « 
@@:
;¥á«¨ ­ è«¨ 梥⠬ â¥à¨ « 
add esi,6
cmp word[esi],0x0011
jne .end_material
add esi,6
mov dl,byte[esi]
mov [edi+offs_mat_col_specular+2],dl
mov dx,word[esi+1]
ror dx,8
mov [edi+offs_mat_col_specular],dx
.end_material:
.no_material:
popad
ret
endp
align 4
proc buf_draw_beg uses eax, buf:dword
mov eax,[buf]
stdcall [buf2d_clear], eax, [eax+16] ;ç¨á⨬ ¡ãä¥à
stdcall [buf2d_draw_text], eax, buf_1,txt_open_3ds,5,5,0xff
stdcall [buf2d_draw_text], eax, buf_1,openfile_path,5,15,0xff
cmp dword[level_stack],FILE_ERROR_CHUNK_SIZE ;¢®§¬®¦­  ®è¨¡ª  ä ©« 
jne @f
stdcall [buf2d_draw_text], eax, buf_1,txt_3ds_err_sizes,5,25,0xff0000
@@:
ret
endp
;à¨á®¢ ­¨¥ ¬ â¥à¨ « 
align 4
proc draw_material uses edi, m_data:dword
mov edi,[m_data]
stdcall buf_draw_beg, buf_ogl
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_afff,5,35,0xff
stdcall [buf2d_draw_text], buf_ogl,buf_1,[edi+offs_mat_name],15,45,0 ;¨¬ï ¬ â¥à¨ « 
stdcall draw_color, [edi+offs_mat_col_ambient], txt_a010,2,55 ;®ªà㦠î騩 梥â
stdcall draw_color, [edi+offs_mat_col_diffuse], txt_a020,2,75 ;¤¨äã§­ë© æ¢¥â
stdcall draw_color, [edi+offs_mat_col_specular],txt_a030,2,95 ;§¥àª «ì­ë© 梥â
stdcall [buf2d_draw], buf_ogl
ret
endp
align 4
proc draw_color uses eax ebx, color:dword, text:dword, c_x:dword, c_y:dword
mov eax,[c_x]
mov ebx,[c_y]
; ¯àאַ㣮«ì­¨ª
inc ebx
stdcall [buf2d_filled_rect_by_size], buf_ogl,eax,ebx,30,17,[color]
dec ebx
stdcall [buf2d_rect_by_size], buf_ogl,eax,ebx,30,19, 0
; ¯®¤¯¨á¨
add eax,33
stdcall [buf2d_draw_text], buf_ogl, buf_1,[text],eax,ebx,0
add ebx,10
stdcall hex_in_str, buffer,[color],6
mov byte[buffer+6],0
stdcall [buf2d_draw_text], buf_ogl, buf_1,buffer,eax,ebx,0
ret
endp
;à¨á®¢ ­¨¥ â®ç¥ª ¢ 3d
align 4
proc draw_3d uses eax ebx ecx edi, o_data:dword
@ -730,14 +910,18 @@ else
align 4
update_obj:
push eax
push eax ebx
stdcall [tl_node_get_data],tree1
cmp eax,0
je @f
add eax,14 ;14=list_offs_obj3d
stdcall draw_3d, eax
mov ebx,dword[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª  ®â­®á¨â¥«ì­® ­ ç «  ä ©« 
add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp word[ebx],CHUNK_OBJBLOCK
jne @f
add eax,14 ;14=list_offs_obj3d
stdcall draw_3d, eax
@@:
pop eax
pop ebx eax
ret
end if

View File

@ -37,18 +37,13 @@ dq 0,0
align 4
prop_start:
pushad
mcall 40,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
mcall SF_SET_EVENTS_MASK,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
inc byte[prop_wnd_run]
mov dword[w_scr_t3.type],1
mov edi,o3d
stdcall obj_clear_param, edi
call mnu_reset_settings
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
mov dword[buf_ogl],eax
stdcall [tl_node_get_data],tree1
xor edx,edx
mov dword[capt_p],txt_q
@ -170,7 +165,7 @@ align 4
prop_still:
pushad
mcall 23,10
mcall SF_WAIT_EVENT_TIMEOUT,10
or eax,eax
jnz @f
call prop_timer_funct
@ -200,7 +195,7 @@ prop_still:
align 4
prop_red_win:
pushad
mcall 12,1
mcall SF_REDRAW,SSF_BEGIN_DRAW
xor eax,eax
mov edi,dword[capt_p] ;children window caption
@ -218,12 +213,12 @@ pushad
int 0x40
mov esi,[sc.work_button]
mcall 8, (5 shl 16)+20, (266 shl 16)+20, 3
mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 3
mcall , (30 shl 16)+20, (266 shl 16)+20, 4
mov ebx,[image_data_toolbar]
add ebx,3*IMAGE_TOOLBAR_ICON_SIZE
mcall 7, , (16 shl 16)+16, (7 shl 16)+268 ;load
mcall SF_PUT_IMAGE, , (16 shl 16)+16, (7 shl 16)+268 ;load
sub ebx,IMAGE_TOOLBAR_ICON_SIZE
mov edx,(32 shl 16)+268 ;save
@ -238,13 +233,13 @@ pushad
stdcall [kmainmenu_draw], [main_menu]
stdcall draw_3d, o3d
mcall 12,2
mcall SF_REDRAW,SSF_END_DRAW
popad
ret
align 4
proc prop_key uses eax ebx
mcall 2
mcall SF_GET_KEY
test word [edit1.flags],10b ;ed_focus
je @f
@ -306,13 +301,13 @@ endp
align 4
prop_mouse:
push eax ebx
mcall 37,3
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
bt eax,0
jnc .end_m
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
@ -361,7 +356,7 @@ prop_mouse:
bt eax,8
jnc .end_d
;mouse l. but. press
mcall 37,1 ;get mouse coords
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION ;get mouse coords
mov ebx,eax
shr ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
@ -390,7 +385,7 @@ prop_mouse:
align 4
prop_button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
mcall SF_GET_BUTTON
cmp ah,3
jne @f
@ -528,7 +523,7 @@ prop_button:
mov dword[edi+offs_obj_normals_tri_data],0
mov dword[edi+offs_obj_normals_poi_data],0
mov byte[prop_wnd_run],0 ;®¡­ã«ï¥¬ áç¥â稪 ®ª®­
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
align 4
get_point_coords:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB