1) 'box_lib' small fix element 't_edit'

2) new version 'voxel_editor'

git-svn-id: svn://kolibrios.org@2758 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2012-06-10 22:19:58 +00:00
parent 3164f7fb57
commit 3c47cb905e
4 changed files with 1305 additions and 848 deletions

View File

@ -449,6 +449,15 @@ proc ted_key, edit:dword, table:dword, control:dword
stdcall ted_text_add,edi,ecx,1,edx ;¤®¡ ¢«ï¥¬ ᨬ¢®« ¢¢¥¤¥­­ë© á ª« ¢¨ âãàë
cmp ted_key_new,13
jne .dr_m_win
;¥á«¨ ¢áâ ¢¨«¨ ᨬ¢®« ­®¢®© áâப¨
mov ecx,ted_scr_w
inc dword[ecx+sb_offs_max_area] ;㢥«¨ç¨¢ ¥¬ à §¬¥à ¢¥à⨪ «ì­®£® áªà®««¨­£ 
mov edx,ted_cur_y
cmp edx,dword[ecx+sb_offs_cur_area]
jl .no_change
dec ted_cur_y ;ªãàá®à ®áâ ¢«ï¥¬ ­  ¬¥áâ¥
inc dword[ecx+sb_offs_position] ;ᤢ¨£ ¥¬ ¯®«§ã­®ª
.no_change:
stdcall ted_draw,edi
jmp .dr_cur_l
.dr_m_win:

File diff suppressed because it is too large Load Diff

View File

@ -13,399 +13,75 @@ buf2d_bits equ byte[edi+20] ;
vox_offs_tree_table equ 4
vox_offs_data equ 12
;description:
; äã­ªæ¨ï à¨áãîé ï ®¤¨­®ç­ë© ¢®ªá¥«
;input:
; buf_i - ¡ãä¥à ¢ ª®â®à®¬ à¨áã¥âáï (24 ¡¨â )
; buf_z - ¡ãä¥à £«ã¡¨­ë (32 ¡¨â  ¯® ç¨á«ã ¯¨ªá¥«¥© ¤®«¦¥­ ᮢ¯ ¤ âì á buf_i)
; buf_v - ¡ãä¥à á ¨§®¡à ¦¥­¨¥¬ ¢®ªá¥«ï (32 ¡¨â )
; v_color - 梥â
align 4
proc draw_vox, buf_i:dword, buf_z:dword, buf_v:dword,\
coord_x:dword, coord_y:dword, coord_z:dword, v_color:dword
pushad
mov eax,[coord_x]
mov ebx,[coord_y]
mov edi,[buf_v]
mov ecx,buf2d_h
mov esi,buf2d_w
imul ecx,esi
add esi,eax
mov edx,buf2d_data
cld
;ecx - count pixels in voxel
;edx - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢ ¢®ªá¥«ì­®¬ ¡ãä¥à¥
;edi - 㪠§ â¥«ì ­  ¢®ªá¥«ì­ë© ¡ãä¥à
;esi - width voxel buffer add coord x
.cycle:
cmp dword[edx],0
je @f
;¯à®¢¥à塞 ¡ãä¥à £«ã¡¨­ë
push eax
stdcall [buf2d_get_pixel], [buf_z],eax,ebx
sub eax,[coord_z]
cmp eax,[edx]
jl .dr_pixel
pop eax
jmp @f
.dr_pixel:
;à¨á㥬 â®çªã
pop eax
stdcall [buf2d_set_pixel], [buf_i],eax,ebx,[v_color]
push ecx
mov ecx,[coord_z]
add ecx,[edx]
stdcall [buf2d_set_pixel], [buf_z],eax,ebx,ecx
pop ecx
@@:
add edx,4
inc eax
cmp eax,esi
jl @f
inc ebx
sub eax,buf2d_w
@@:
loop .cycle
popad
ret
endp
;description:
; äã­ªæ¨ï à¨áãîé ï ¢®ªá¥«ì­ë© ®¡ê¥ªâ
;input:
; buf_i - ¡ãä¥à ¢ ª®â®à®¬ à¨áã¥âáï (24 ¡¨â )
; buf_z - ¡ãä¥à £«ã¡¨­ë (32 ¡¨â  ¯® ç¨á«ã ¯¨ªá¥«¥© ¤®«¦¥­ ᮢ¯ ¤ âì á buf_i)
; h_br - ª¨áâì á ¨§®¡à ¦¥­¨ï¬¨ ¢®ªá¥«¥© (32 ¡¨â )
; v_obj - ¢®ªá¥«ì­ë© ®¡ê¥ªâ
; k_scale - ª®íä. ¤«ï ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
align 4
proc buf2d_vox_obj_draw_3g, buf_i:dword, buf_z:dword, h_br:dword, v_obj:dword,\
coord_x:dword, coord_y:dword, coord_z:dword, k_scale:dword
pushad
mov edi,[v_obj]
mov eax,[k_scale]
mov ebx,[coord_x]
;---
;â¥á⮢ ï à ¬ª 
mov ecx,[h_br]
movzx edx,byte[ecx]
movzx esi,byte[ecx+1]
cmp eax,1
jl .end_c0
mov ecx,eax
shl edx,cl
shl esi,cl
.end_c0:
stdcall [buf2d_rect_by_size], [buf_i], ebx,[coord_y],edx,esi, 0xd0d0d0
;---
mov ecx,[coord_y]
mov edx,eax
add edi,vox_offs_data
mov esi,[coord_z]
stdcall vox_go_in_node, [buf_i], [buf_z], [h_br], [v_obj]
popad
ret
endp
;description:
; äã­ªæ¨ï à¨áãîé ï ⥭¨
;input:
; buf_i - ¡ãä¥à ¢ ª®â®à®¬ à¨áã¥âáï (24 ¡¨â )
; buf_z - ¡ãä¥à £«ã¡¨­ë (32 ¡¨â  ¯® ç¨á«ã ¯¨ªá¥«¥© ¤®«¦¥­ ᮢ¯ ¤ âì á buf_i)
; h_br - ª¨áâì á ¨§®¡à ¦¥­¨ï¬¨ ¢®ªá¥«¥© (32 ¡¨â )
; k_scale - ª®íä. ¤«ï ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
align 4
proc buf2d_vox_obj_draw_3g_shadows, buf_i:dword, buf_z:dword, h_br:dword, \
coord_x:dword, coord_y:dword, color:dword, k_scale:dword, prop:dword
locals
correct_z dd 0 ;ª®à¥ªâ¨à®¢ª  ¤«ï ¡ãä¥à  £«ã¡¨­ë
endl
pushad
mov eax,[k_scale]
add eax,[prop]
mov dword[correct_z],8
sub [correct_z],eax
mov ebx,[coord_x]
;correct_z = 8-k_scale-prop
stdcall buf2d_vox_obj_get_img_w_3g, [h_br],[k_scale]
mov edx,eax ;edx - è¨à¨­  ¨§®¡à ¦¥­¨ï
stdcall buf2d_vox_obj_get_img_h_3g, [h_br],[k_scale]
mov esi,eax
mov edi,[coord_y]
mov ecx,edx
add edx,ebx ;è¨à¨­  + ®âáâ㯠᫥¢ 
imul ecx,esi
cld
.cycle_0:
stdcall [buf2d_get_pixel], [buf_z],ebx,edi
cmp eax,0
je @f
stdcall vox_correct_z, [correct_z]
push eax
stdcall [buf2d_get_pixel], [buf_i],ebx,edi
stdcall combine_colors_3,eax,[color] ;,eax
stdcall [buf2d_set_pixel], [buf_i],ebx,edi,eax
@@:
inc ebx
cmp ebx,edx
jl @f
mov ebx,[coord_x]
inc edi
@@:
loop .cycle_0
popad
ret
endp
;output:
; eax - scaled coord z
; eax - (event shl 30) + position
align 4
proc vox_correct_z uses ecx, correct_z:dword
mov ecx,[correct_z]
cmp ecx,0
je .end_f
jl .end_0
shl eax,cl
jmp .end_f
.end_0:
neg ecx
inc ecx
shr eax,cl
.end_f:
ret
endp
proc get_mouse_ev_scale uses ebx ecx edx, h_br:dword, coord_x:dword, coord_y:dword, scale_obj:dword, scale_img:dword
mov ecx,[scale_obj]
stdcall [buf2d_vox_obj_get_img_h_3g], [h_br],ecx
cmp eax,[coord_y]
jle .test_x
stdcall [buf2d_vox_obj_get_img_w_3g], [h_br],ecx
cmp eax,[coord_x]
jle .test_z
;output:
; eax - color
align 4
proc combine_colors_3 uses ebx ecx edx edi esi, col_0:dword, col_1:dword, alpha:dword
mov ebx,[col_0]
mov ecx,[col_1]
movzx di,byte[alpha] ;pro
mov si,0x00ff ;---get transparent---
sub si,di ;256-pro
;---blye---
movzx ax,bl
imul ax,si
movzx dx,cl
imul dx,di
add ax,dx
mov cl,ah
;---green---
movzx ax,bh
imul ax,si
movzx dx,ch
imul dx,di
add ax,dx
mov ch,ah
shr ebx,16
ror ecx,16
;---red---
movzx ax,bl
imul ax,si
movzx dx,cl
imul dx,di
add ax,dx
shl eax,8
ror ecx,16
mov ax,cx
and eax,0xffffff
ret
endp
;input:
; h_br - ª¨áâì á ¨§®¡à ¦¥­¨ï¬¨ ¢®ªá¥«¥© (32 ¡¨â )
; ebx - coord_x
; ecx - coord_y
; esi - coord_z
; edx - ã஢¥­ì ⥪ã襣® 㧫 
; edi - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢®ªá¥«ì­®£® ®¡ê¥ªâ 
align 4
proc vox_go_in_node, buf_i:dword, buf_z:dword, h_br:dword, v_obj:dword
;, coord_z:dword
cmp byte[edi+3],0 ;ᬮâਬ ¥áâì «¨ ¯®¤¤¥à¥¢ìï
je .sub_trees
;४ãàᨢ­ë© ¯¥à¥¡®à ¯®¤¤¥à¥¢ì¥¢
push eax ecx
;¯à®à¨á®¢ª  à ¬ª¨ ¥á«¨ à §¬¥à 㧫  = 1
cmp edx,0
jne .end_2
push eax
stdcall vox_get_sub_brush,[h_br],0 ;®¯à¥¤¥«ï¥¬ ª¨áâì ¤«ï à¨á®¢ ­¨ï
cmp eax,0 ;¥á«¨ ª¨áâì ­¥ ­ ©¤¥­ 
je @f
stdcall draw_vox, [buf_i], [buf_z], eax, ebx,ecx,esi, [edi]
@@:
pop eax
.end_2:
;¢å®¤ ¢­ãâàì 㧫 
dec edx
;---
push ebx
;mov eax,(7-4/2)
mov ebx,[h_br]
movzx eax,byte[ebx+1]
movzx ebx,byte[ebx+2]
shr ebx,1
sub eax,ebx
cmp edx,1
jl .end_c1
push ecx
mov ecx,edx
shl eax,cl
shl ebx,cl ;???
pop ecx
.end_c1:
add esi,ebx ;???
pop ebx
add ecx,eax ;ª®à¥ªâ¨à®¢ª  ¢ëá®âë ¯®¤ ¢®ªá¥«ì ­¨¦­¥£® ã஢­ï
;---
mov ah,byte[edi+3]
add edi,4
mov al,8
.cycle:
bt ax,8 ;â¥áâ¨à㥬 ⮫쪮 ah
jnc .c_next
push ebx ecx esi
stdcall vox_corect_coords, [h_br], [v_obj]
stdcall vox_go_in_node, [buf_i], [buf_z], [h_br], [v_obj]
pop esi ecx ebx
.c_next:
shr ah,1
dec al
jnz .cycle
;¢ë室 ¨§ 㧫 
inc edx
pop ecx eax
jmp .end_f
.sub_trees:
;à¨á㥬 㧥«
push eax
stdcall vox_get_sub_brush,[h_br],edx ;®¯à¥¤¥«ï¥¬ ª¨áâì ¤«ï à¨á®¢ ­¨ï
cmp eax,0 ;¥á«¨ ª¨áâì ­¥ ­ ©¤¥­ 
je @f
stdcall draw_vox, [buf_i], [buf_z], eax, ebx,ecx,esi, [edi]
@@:
pop eax
add edi,4
.end_f:
ret
endp
;¨§¢«¥ª ¥¬ ¨§ h_br 㪠§ â¥«ì ­  ¡ãä¥à á ¨§®¡à ¦¥­¨¥¬ ¢®ªá¥«ï, 㪠§ ­­®£® ¯®à浪  n
align 4
proc vox_get_sub_brush uses ebx ecx, h_br:dword, n:dword
.no_change:
xor eax,eax
mov ebx,[n]
cmp ebx,0
jl @f
mov ecx,[h_br]
cmp bl,byte[ecx+3]
jg @f
add ecx,4
imul ebx,BUF_STRUCT_SIZE
mov eax,ebx
add eax,ecx
@@:
ret
endp
jmp .end_f
;äã­ªæ¨ï ¤«ï ª®à¥ªâ¨à®¢ª¨ ª®®à¤¨­ â
;­ ¯à ¢«¥­¨ï ®á¥© ª®®à¤¨­ â ¢ ¢®ªá¥«¥:
;*z
;|
;+
; * y
; /
;+
; \
; * x
;input:
; al - ­®¬¥à 㧫  ¢ ¤¥à¥¢¥ (®â 1 ¤® 8)
; ebx - ª®®à¤¨­ â  x
; ecx - ª®®à¤¨­ â  y
; esi - ª®®à¤¨­ â  z
; edx - ã஢¥­ì ⥪ã襣® 㧫 
;output:
; ebx - ­®¢ ï ª®®à¤¨­ â  x
; ecx - ­®¢ ï ª®®à¤¨­ â  y
; esi - ­®¢ ï ª®®à¤¨­ â  z
align 4
proc vox_corect_coords, h_br:dword, v_obj:dword
locals
osn_w_2 dd ? ;è¨à¨­  ®á­®¢ ­¨ï ¥¤¨­¨ç­®£® ¢®ªá¥«ï : 2
vox_h dd ? ;¢ëá®â  ¥¤¨­¨ç­®£® ¢®ªá¥«ï
endl
cmp edx,0
jl .end_f ;¤«ï ã᪮७¨ï ®âà¨á®¢ª¨
push eax edi
and eax,15 ;¢ë¤¥«ï¥¬ ­®¬¥à 㧫  ¢ ¤¥à¥¢¥
mov edi,[v_obj]
add edi,vox_offs_tree_table
add edi,8
sub edi,eax
push ebx ecx
.test_x:
mov ebx,[h_br]
movzx ecx,byte[ebx]
shr ecx,1
mov dword[osn_w_2],ecx
movzx ecx,byte[ebx+2]
movzx ebx,byte[ebx+1]
sub ebx,ecx
mov dword[vox_h],ebx
shr ecx,1
mov eax,ecx ;eax - ¢ëá®â  ®á­®¢ ­¨ï ¥¤¨­¨ç­®£® ¢®ªá¥«ï : 2
pop ecx ebx
add eax,ebx
cmp eax,[coord_y]
jl .no_change
stdcall [buf2d_vox_obj_get_img_w_3g], [h_br],ecx
cmp eax,[coord_x]
jl .no_change
mov ebx,eax
mov ecx,[scale_img]
inc ecx
shr ebx,cl
xor edx,edx
mov eax,[coord_x]
div ebx
dec ecx
xor ebx,ebx
inc ebx
shl ebx,cl
cmp eax,ebx
jge @f
or eax,1 shl 30
jmp .end_f
@@:
sub eax,ebx
or eax,2 shl 30
jmp .end_f
cmp edx,1
jl .no_scale ;¢® ¨§¡¥¦ ­¨¥ § æ¨ª«¨¢ ­¨ï
push ecx
mov ecx,edx
shl eax,cl
shl dword[osn_w_2],cl
shl dword[vox_h],cl
pop ecx
.no_scale:
.test_z:
mov ebx,[h_br]
movzx ebx,byte[ebx]
add eax,ebx
cmp eax,[coord_x]
jl .no_change
mov ebx,[h_br]
movzx ebx,byte[ebx+1]
mov ecx,[scale_obj]
shl ebx,cl
mov ecx,[scale_img]
shr ebx,cl
mov eax,[coord_y]
xor edx,edx
div ebx
;¨­¢¥àá¨ï ª®®à¤¨­ âë y
xor edx,edx
inc edx
shl edx,cl
dec edx
sub edx,eax
mov eax,edx
or eax,3 shl 30
; add esi,eax ;¬¥­ï¥¬ £«ã¡¨­ã ¤«ï ¡ãä¥à  z (ª®¬¯¥­á æ¨ï ¤«ï ª®®à¤¨­ âë y)
bt word[edi],0 ;test voxel coord x
jnc @f
add ebx,[osn_w_2]
add ecx,eax
add esi,eax ;¬¥­ï¥¬ £«ã¡¨­ã ¤«ï ¡ãä¥à  z
@@:
bt word[edi],1 ;test voxel coord y
jnc @f
add ebx,[osn_w_2]
sub ecx,eax
sub esi,eax ;¬¥­ï¥¬ £«ã¡¨­ã ¤«ï ¡ãä¥à  z
@@:
bt word[edi],2 ;test voxel coord z
jnc @f
sub ecx,[vox_h]
@@:
pop edi eax
.end_f:
ret
endp
@ -460,245 +136,6 @@ proc vox_obj_rot_x uses eax ebx ecx, v_obj:dword
ret
endp
;à¨á®¢ ­¨¥ á१  ¨§®¡à ¦¥­¨ï
; v_size - à §¬¥à ª¢ ¤à â  á ¢®ªá¥«¥¬
; k_scale - á⥯¥­ì ¤¥â «¨§ æ¨¨ ¨§®¡à ¦¥­¨ï
; n_plane - ­®¬¥à ¯«®áª®á⨠á¥ç­¨ï (¢ ¯à¥¤¥« å ®â 0 ¤® 2^k_scale - 1)
; b_color - 梥⠣࠭¨æë
align 4
proc buf2d_vox_obj_draw_pl, buf_i:dword, v_obj:dword, coord_x:dword,\
coord_y:dword, v_size:dword, k_scale:dword, n_plane:dword, b_color:dword
cmp [k_scale],0
jl .end_f
pushad
mov eax,[v_size]
mov ecx,[k_scale]
mov ebx,eax
cmp ecx,1
jl @f
shl ebx,cl
@@:
;ebx - ¯®«­ë© à §¬¥à ¨§®¡à ¦¥­¨ï
stdcall [buf2d_rect_by_size], [buf_i], [coord_x],[coord_y],ebx,ebx, [b_color] ;à ¬ª  ­  à¨áã­®ª
add ebx,[coord_y]
mov edx,[n_plane]
imul edx,eax
add edx,[coord_x]
stdcall [buf2d_filled_rect_by_size], [buf_i], edx,ebx, eax,eax, [b_color] ;ª¢ ¤à â¨ª, ¯®ª §ë¢ î騩 ­®¬¥à á¥ç¥­¨ï
;à¨á®¢ ­¨¥ â®ç¥ª ¤«ï á¥âª¨
push ecx
mov edi,1
cmp ecx,1
jl @f
shl edi,cl
@@:
dec edi
cmp edi,1
jl .end_0
mov ecx,edi
imul ecx,edi
mov ebx,[coord_x]
mov edx,[coord_y]
add edx,eax
xor esi,esi
cld
@@:
add ebx,eax
inc esi
stdcall [buf2d_set_pixel], [buf_i], ebx,edx, [b_color]
cmp esi,edi
jl .end_1
;¯¥à¥å®¤ â®ç¥ª ­  ­®¢ãî áâபã
xor esi,esi
mov ebx,[coord_x]
add edx,eax
.end_1:
loop @b
.end_0:
pop ecx
;eax - à §¬¥à ®¤­®£® ª¢ ¤à â 
;edi - 㪠§ â¥«ì à¨áã¥¬ë¥ ¤ ­­ë¥ ¨§ ®¡ê¥ªâ 
mov ebx,[coord_x]
mov edx,[coord_y]
mov edi,[v_obj]
add edi,vox_offs_data
xor esi,esi
push eax
imul eax,[n_plane]
stdcall draw_sub_vox_obj_pl, [buf_i],[v_obj], eax
popad
.end_f:
ret
endp
;input:
; ebx - coord_x
; edx - coord_y
; esi - coord_z
; ecx - ã஢¥­ì ⥪ã襣® 㧫 
; edi - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢®ªá¥«ì­®£® ®¡ê¥ªâ 
align 4
proc draw_sub_vox_obj_pl, buf_i:dword, v_obj:dword, clip_z:dword,\
v_size:dword
cmp byte[edi+3],0 ;ᬮâਬ ¥áâì «¨ ¯®¤¤¥à¥¢ìï
je .sub_trees
;¯à®à¨á®¢ª  à ¬ª¨ ¥á«¨ à §¬¥à 㧫  = 1
cmp ecx,0
jne @f
;¯à®¢¥àª  £«ã¡¨­ë esi
;clip_z=n_plane*v_size
stdcall vox_is_clip, [clip_z],[v_size]
cmp eax,0
je @f
push ecx
mov ecx,dword[edi]
and ecx,0xffffff
stdcall [buf2d_rect_by_size], [buf_i], ebx,edx, [v_size],[v_size],ecx
pop ecx
@@:
;४ãàᨢ­ë© ¯¥à¥¡®à ¯®¤¤¥à¥¢ì¥¢
push edx
;¢å®¤ ¢­ãâàì 㧫 
dec ecx
;---
mov eax,[v_size]
cmp ecx,1
jl @f
shl eax,cl
@@:
add edx,eax ;ª®à¥ªâ¨à®¢ª  ¢ëá®âë ¯®¤ ¢®ªá¥«ì ­¨¦­¥£® ã஢­ï
;---
mov ah,byte[edi+3]
add edi,4
mov al,8
.cycle:
bt ax,8 ;â¥áâ¨à㥬 ⮫쪮 ah
jnc .c_next
push eax ebx edx esi
stdcall vox_corect_coords_pl, [v_obj],[v_size]
stdcall draw_sub_vox_obj_pl, [buf_i],[v_obj],[clip_z],[v_size]
pop esi edx ebx eax
.c_next:
shr ah,1
dec al
jnz .cycle
;¢ë室 ¨§ 㧫 
inc ecx
pop edx
jmp .end_f
.sub_trees:
cmp ecx,0
jl .end_0 ;­¥ à¨á㥬 ®ç¥­ì ¬ «¥­ìª¨¥ ¢®ªá¥«¨
;¯à®¢¥àª  £«ã¡¨­ë esi
;clip_z=n_plane*v_size
stdcall vox_is_clip, [clip_z],[v_size]
cmp eax,0
je .end_0
;à¨á㥬 㧥«
mov eax,[edi]
and eax,0xffffff
push eax ;梥â 㧫 
mov eax,[v_size]
cmp ecx,1
jl @f
shl eax,cl ;à §¬¥à 㧫 
@@:
stdcall [buf2d_filled_rect_by_size], [buf_i], ebx,edx, eax,eax
.end_0:
add edi,4
.end_f:
ret
endp
;¯à®¢¥àª  £«ã¡¨­ë esi
;input:
; ecx - ã஢¥­ì ⥪ã襣® 㧫 
; esi - coord z
; clip_z - n_plane*v_size
;output:
; eax - 0 if no draw, 1 if draw
align 4
proc vox_is_clip uses ebx edi, clip_z:dword, v_size:dword
xor eax,eax
mov ebx,[clip_z]
mov edi,[v_size]
cmp ecx,1
jl @f
shl edi,cl
@@:
;edi = 2^ecx
add edi,esi
cmp edi,ebx ;if (esi+2^ecx*v_size <= (n_plane*v_size)) no draw
jle @f
add ebx,[v_size]
cmp esi,ebx ;if (esi >= (n_plane+1)*v_size) no draw
jge @f
inc eax
@@:
ret
endp
;äã­ªæ¨ï ¤«ï ª®à¥ªâ¨à®¢ª¨ ª®®à¤¨­ â
;­ ¯à ¢«¥­¨ï ®á¥© ª®®à¤¨­ â ¢ ¢®ªá¥«¥:
;*z
;|
;+-* x
;input:
; al - ­®¬¥à 㧫  ¢ ¤¥à¥¢¥ (®â 1 ¤® 8)
; ebx - ª®®à¤¨­ â  x
; edx - ª®®à¤¨­ â  y
; esi - ª®®à¤¨­ â  z
; ecx - ã஢¥­ì ⥪ã襣® 㧫 
;output:
; ebx - ­®¢ ï ª®®à¤¨­ â  x
; edx - ­®¢ ï ª®®à¤¨­ â  y
; esi - ­®¢ ï ª®®à¤¨­ â  z
align 4
proc vox_corect_coords_pl, v_obj:dword, v_size:dword
cmp ecx,0
jl .end_f ;¤«ï ã᪮७¨ï ®âà¨á®¢ª¨
push eax edi
and eax,15 ;¢ë¤¥«ï¥¬ ­®¬¥à 㧫  ¢ ¤¥à¥¢¥
mov edi,[v_obj]
add edi,vox_offs_tree_table
add edi,8
sub edi,eax
mov eax,[v_size] ;eax - ¢ëá®â  ®á­®¢ ­¨ï ¥¤¨­¨ç­®£® ¢®ªá¥«ï
cmp ecx,1
jl @f ;¢® ¨§¡¥¦ ­¨¥ § æ¨ª«¨¢ ­¨ï
shl eax,cl
@@:
bt word[edi],0 ;test voxel coord x
jnc @f
add ebx,eax
@@:
bt word[edi],1 ;test voxel coord y
jnc @f
add esi,eax ;¬¥­ï¥¬ £«ã¡¨­ã ¤«ï ¡ãä¥à  z
@@:
bt word[edi],2 ;test voxel coord z
jnc @f
sub edx,eax
@@:
pop edi eax
.end_f:
ret
endp
;
;output:
; eax - ç¨á«® 㧫®¢ ¢ ®¡ê¥ªâ¥ v_obj
@ -711,6 +148,7 @@ proc vox_obj_get_nodes uses edi, v_obj:dword
ret
endp
;???
;input:
; edi - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢®ªá¥«ì­®£® ®¡ê¥ªâ 
;output:
@ -755,114 +193,17 @@ proc buf2d_vox_obj_get_size, v_obj:dword
ret
endp
if 0
;output:
; eax - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢®ªá¥«ï
align 4
proc buf2d_vox_obj_is_node uses ebx ecx edx edi esi, v_obj:dword,\
coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword
mov edi,[v_obj]
add edi,vox_offs_data
mov esi,[k_scale]
xor eax,eax
xor edx,edx
stdcall vox_obj_rec1, [v_obj],[coord_x],[coord_y],[coord_z], 0,0,0
ret
endp
;input:
; eax - ...
; edx - ...
; edi - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢®ªá¥«ì­®£® ®¡ê¥ªâ 
; esi - ã஢¥­ì ¨áª®¬®£® ¢®ªá¥«ï
align 4
proc vox_obj_rec1, v_obj:dword, coord_x:dword,coord_y:dword,coord_z, tc_x:dword,tc_y:dword,tc_z
cmp edx,esi
jne @f
mov ebx,[tc_x]
cmp [coord_x],ebx
jne @f
mov ebx,[tc_y]
cmp [coord_y],ebx
jne @f
mov ebx,[tc_z]
cmp [coord_z],ebx
jne @f
mov eax,edi
@@:
cmp eax,0
jne .end_f ;¥á«¨ 㪠§ â¥«ì 㦥 ­ ©¤¥­
cmp byte[edi+3],0 ;ᬮâਬ ¥áâì «¨ ¯®¤¤¥à¥¢ìï
je .sub_trees
inc edx
shl dword[tc_x],1
shl dword[tc_y],1
shl dword[tc_z],1
;४ãàᨢ­ë© ¯¥à¥¡®à ¯®¤¤¥à¥¢ì¥¢
mov bh,byte[edi+3]
add edi,4
;mov bl,8
xor bl,bl
.cycle:
bt bx,8 ;â¥áâ¨à㥬 ⮫쪮 bh
jnc .c_next
push dword[tc_x]
push dword[tc_y]
push dword[tc_z]
push edx
movzx edx,bl
add edx,[v_obj]
add edx,vox_offs_tree_table
bt word[edx],0 ;coord x
jnc .end_x
inc dword[tc_x]
.end_x:
bt word[edx],1 ;coord y
jnc .end_y
inc dword[tc_y]
.end_y:
bt word[edx],2 ;coord z
jnc .end_z
inc dword[tc_z]
.end_z:
pop edx
push ebx ecx
stdcall vox_obj_rec1, [v_obj],[coord_x],[coord_y],[coord_z], [tc_x],[tc_y],[tc_z]
pop ecx ebx
pop dword[tc_z]
pop dword[tc_y]
pop dword[tc_x]
.c_next:
shr bh,1
inc bl
;jnz .cycle
cmp bl,8
jl .cycle
dec edx
jmp .end_f
.sub_trees:
add edi,4
.end_f:
ret
endp
end if
; ᮧ¤ ­¨¥ ¢®ªá¥«ï ¢ 3 íâ ¯ :
; 1) ¨é¥¬ ¬¥áâ® ¢ áâàãªâãॠ¤¥à¥¢ , ªã¤  ­ ¤® ¢áâ ¢¨âì (¥á«¨ ¢¥â¢ì áãé¥áâ¢ã¥â, 2-© íâ ¯ ¯à®¯ã᪠¥¬)
; 2) ¢áâ ¢«ï¥¬ ­®¢ãî ¢¥â¢ì á ¢®ªá¥«¥¬ (3-© íâ ¯ 㦥 ­¥ ¤¥« ¥¬)
; 3) ¬¥­ï¥¬ 梥⠢®ªá¥«ï
align 4
proc buf2d_vox_obj_create_node, v_obj:dword,coord_x:dword,coord_y:dword,\
coord_z:dword,color:dword,k_scale:dword
coord_z:dword,k_scale:dword,color:dword
pushad
locals
p_node dd 0 ;த¨â¥«ì᪨© 㧥«
endl
;stdcall print_err, txt_f1, txt_b
mov edi,[v_obj]
add edi,vox_offs_data
@ -875,15 +216,14 @@ endl
movzx bx,byte[edi+3]
mov [p_node],edi
add edi,4
;stdcall print_err, txt_chi, txt_e
cmp eax,0
je .end_1
mov ecx,eax
cld
@@: ; 横« ¤«ï ¯à®¯ã᪠ ¯à¥¤ë¤ãé¨å ¯®¤¤¥à¥¢ì¥¢ ¢ 㧫¥
@@: ;横« ¤«ï ¯à®¯ã᪠ ¯à¥¤ë¤ãé¨å ¯®¤¤¥à¥¢ì¥¢ ¢ 㧫¥
bt bx,0 ;¯à®¢¥à塞 ¥áâì «¨ ¤®ç¥à­¨¥ 㧫ë
jnc .end_0
;stdcall print_err, txt_st, txt_e
xor eax,eax
stdcall vox_obj_rec0 ;¢ eax ¢ëç¨á«ï¥âáï ç¨á«® ¤®ç¥à­¨å 㧫®¢, ¢ ¤ ­­®© ¢¥â¢¨
.end_0:
@ -928,9 +268,9 @@ popad
ret
endp
; 㤠«¥­¨¥ ¢®ªá¥«ï ¢ 3 íâ ¯ :
; 㤠«¥­¨¥ ¢®ªá¥«ï ¢ 2 íâ ¯ :
; 1) ¨é¥¬ ¬¥áâ® ¢ áâàãªâãॠ¤¥à¥¢ , £¤¥ ¥áâì 㤠«ï¥¬ë© 㧥« (¥á«¨ ¢¥â¢ì ­¥ áãé¥áâ¢ã¥â, ¢ë室¨¬ ¨§ ä㭪樨)
; 2) ¢áâ ¢«ï¥¬ ­®¢ãî ¢¥â¢ì á ¢®ªá¥«¥¬
; 2) 㤠«ï¥¬ ¢¥â¢ì á ¢®ªá¥«¥¬
align 4
proc buf2d_vox_obj_delete_node, v_obj:dword,coord_x:dword,coord_y:dword,\
coord_z:dword,k_scale:dword
@ -953,7 +293,7 @@ endl
je .end_1
mov ecx,eax
cld
@@: ; 横« ¤«ï ¯à®¯ã᪠ ¯à¥¤ë¤ãé¨å ¯®¤¤¥à¥¢ì¥¢ ¢ 㧫¥
@@: ;横« ¤«ï ¯à®¯ã᪠ ¯à¥¤ë¤ãé¨å ¯®¤¤¥à¥¢ì¥¢ ¢ 㧫¥
bt bx,0 ;¯à®¢¥à塞 ¥áâì «¨ ¤®ç¥à­¨¥ 㧫ë
jnc .end_0
xor eax,eax
@ -1025,6 +365,7 @@ proc vox_obj_del_nodes_mem uses eax ecx edi esi, v_obj:dword,p_insert:dword
ret
endp
;???
; ®¯à¥¤¥«¥­¨¥ ¯®§¨æ¨¨ 㧫  ¢ ¤¥à¥¢¥ (®â 0 ¤® 7)
align 4
proc vox_obj_get_node_position uses ebx ecx edi, v_obj:dword,\
@ -1109,32 +450,6 @@ coord_x:dword,coord_y:dword,coord_z:dword,k_scale:dword
ret
endp
align 4
proc buf2d_vox_obj_get_img_w_3g uses ecx, h_br:dword,k_scale:dword
mov ecx,[h_br]
movzx eax,byte[ecx]
cmp dword[k_scale],1
jl .end_c0
mov ecx,[k_scale]
shl eax,cl
.end_c0:
ret
endp
align 4
proc buf2d_vox_obj_get_img_h_3g uses ecx, h_br:dword,k_scale:dword
mov ecx,[h_br]
movzx eax,byte[ecx+1]
cmp dword[k_scale],1
jl .end_c0
mov ecx,[k_scale]
shl eax,cl
.end_c0:
ret
endp
;äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¯ «¨âàë
align 4
proc buf2d_draw_palete, buf:dword, coord_x:dword, coord_y:dword,\
@ -1210,40 +525,3 @@ proc get_palete_color uses ebx ecx edx edi, ind:dword, r:dword
ret
endp
if 0
txt_f1 db 13,10,'f1',0
txt_chi db ' chi',0
txt_st db ' st',0
txt_b db 'beg'
txt_e db 13,10,0
align 4
proc print_err, fun:dword, mes:dword ;¢ë¢®¤¨¬ á®®¡é¥­¨¥ ®¡ 訡ª¥ ­  ¤®áªã ®â« ¤ª¨
pushad
mov eax,63
mov ebx,1
mov esi,[fun]
@@:
mov cl,byte[esi]
int 0x40
inc esi
cmp byte[esi],0
jne @b
mov cl,':'
int 0x40
mov cl,' '
int 0x40
mov esi,[mes]
@@:
mov cl,byte[esi]
int 0x40
inc esi
cmp byte[esi],0
jne @b
popad
ret
endp
end if

View File

@ -17,7 +17,7 @@ include 'dll.inc'
include 'vox_draw.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel editor 5.06.12',0 ;¯®¤¯¨áì ®ª­ 
caption db 'Voxel editor 11.06.12',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@ -81,7 +81,9 @@ macro load_image_file path,buf,size { ;
OT_MAP_X equ 0
OT_MAP_Y equ 0
TILE_SIZE equ 10
TILE_SIZE equ 10 ;à §¬¥à ª¢ ¤à â¨ª  ­  ¯«®áª®á⨠á á¥ç¥­¨¥¬
OT_CAPT_X_COLOR equ 5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â 
OT_CAPT_Y_COLOR equ 30
align 4
start:
@ -136,11 +138,21 @@ align 4
mouse:
pushad
mcall 37,2
bt eax,1 ;right button
jnc @f
mcall 37,1 ;get mouse coords
mov ebx,eax
shr ebx,16
and eax,0xffff
stdcall get_buf_color, buf_0
stdcall get_buf_color, buf_pl
jmp .end_f
@@:
bt eax,0 ;left button
jnc .end_f
mcall 37,1 ;get mouse coords
mov ebx,eax
shr ebx,16
and eax,0xffff
cmp dword[v_pen_mode],2 ;select color
@ -150,6 +162,37 @@ mouse:
jmp .end_f
.end_2:
push eax ebx
mov edx,[v_zoom]
cmp edx,[scaled_zoom]
jle @f
;०¨¬ ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
sub edx,[scaled_zoom]
sub ax,word[buf_0.t]
sub bx,word[buf_0.l]
stdcall get_mouse_ev_scale, buf_vox, ebx, eax, [scaled_zoom],edx
cmp eax,0
je @f
mov ebx,eax
and eax,0x3fffffff
rol ebx,2
and ebx,3
dec ebx
shl ebx,2
add ebx,cam_x
mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z]
call draw_objects
pop ebx eax
jmp .end_f
@@:
pop ebx eax
;eax - mouse coord y
;ebx - mouse coord x
movzx edx,word[buf_pl.t]
add edx,OT_MAP_Y
cmp eax,edx
@ -158,7 +201,6 @@ mouse:
xor edx,edx
mov ecx,TILE_SIZE ;H
div ecx
shr ebx,16
movzx edx,word[buf_pl.l]
add edx,OT_MAP_X
cmp ebx,edx
@ -186,12 +228,54 @@ mouse:
mov [v_cur_x],eax ;X-coord
cmp dword[v_pen_mode],0
jne @f
stdcall buf2d_vox_obj_delete_node, [open_file_vox], [v_cur_x],[n_plane],[v_cur_y], [v_zoom]
@@:
jl .end_1
cmp dword[v_pen_mode],1
jne .end_1
stdcall buf2d_vox_obj_create_node, [open_file_vox], [v_cur_x],[n_plane],[v_cur_y], [v_color], [v_zoom]
jg .end_1
mov eax,[v_cur_x]
mov ebx,[n_plane]
mov edx,[v_cur_y]
mov ecx,[v_zoom]
cmp ecx,[scaled_zoom]
jle .no_c_coord_0
;¯à¥®¡à §®¢ ­¨¥ ª®®à¤¨­ â, á ãç¥â®¬ 㢥«¨ç¥­¨ï
;sub ecx,[scaled_zoom] ;¢ ecx ¯à¨à®áâ ¬ áèâ ¡  (ecx>0)
mov ecx,[scaled_zoom]
mov edi,[cam_x]
shl edi,cl
add eax,edi
mov edi,[cam_y]
shl edi,cl
add ebx,edi
mov edi,[cam_z]
shl edi,cl
add edx,edi
.no_c_coord_0:
;®â«¨ç î騩áï ¯ à ¬¥âà ¤«ï ä㭪樨 ᮧ¤ ­¨ï ¢®ªá¥«ï
cmp dword[v_pen_mode],1
jne @f
push dword[v_color]
@@:
;¢ë§®¢ ®¡é¨å ¯ à ¬¥â஢ ¤«ï ä㭪権
push dword[v_zoom]
push edx
push ebx
push eax
push dword[open_file_vox]
;¢ë§®¢ ä㭪権
cmp dword[v_pen_mode],1
jne @f
call buf2d_vox_obj_create_node
;stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom], [v_color]
jmp .end_1
@@:
call buf2d_vox_obj_delete_node
;stdcall buf2d_vox_obj_delete_node, [open_file_vox], eax,ebx,edx, [v_zoom]
.end_1:
call draw_objects
call draw_pok
@ -199,15 +283,18 @@ mouse:
popad
ret
;input:
; eax - coord y
; ebx - coord x
align 4
proc get_buf_color uses eax ebx edi, buf:dword
proc get_buf_color, buf:dword
pushad
mov edi,[buf]
cmp ax,buf2d_t
jl .end_f
sub ax,buf2d_t
cmp eax,buf2d_h
jg .end_f
shr ebx,16
cmp bx,buf2d_l
jl .end_f
sub bx,buf2d_l
@ -215,9 +302,14 @@ proc get_buf_color uses eax ebx edi, buf:dword
jg .end_f
stdcall [buf2d_get_pixel], edi,ebx,eax
mov [v_color],eax
stdcall [buf2d_filled_rect_by_size], buf_0, 5,3, 8,8,eax
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
;stdcall [buf2d_filled_rect_by_size], buf_0, 5,3, 8,8,eax
;stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
mov edx,[v_color]
mcall 13
.end_f:
popad
ret
endp
@ -226,14 +318,15 @@ align 4
convert_y:
push ecx edx
mov ecx,[v_zoom]
cmp ecx,[scaled_zoom]
jle @f
mov ecx,[scaled_zoom]
@@:
mov edx,1
cmp ecx,1
jl .end_0
cld
jl @f
shl edx,cl
@@:
shl edx,1
loop @b
.end_0:
sub edx,eax
dec edx
mov eax,edx
@ -247,7 +340,7 @@ pushad
; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
xor eax,eax
mov ebx,(20 shl 16)+540
mov ebx,(20 shl 16)+550
mov ecx,(20 shl 16)+415
mov edx,[sc.work]
or edx,(3 shl 24)+0x30000000
@ -393,12 +486,22 @@ draw_pok:
mov ecx,[v_cur_y]
add edx,(6*0)*65536+9
int 0x40 ;
mov ebx,(5 shl 16)
mov ecx,[n_plane]
add edx,(6*0)*65536+9
int 0x40 ;
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2
mov ecx,[sc.work_text]
or ecx,0x80000000 ;or (1 shl 30)
mov edx,txt_color
int 0x40
mov ebx,((OT_CAPT_X_COLOR+35) shl 16)+16 ;¯® ®á¨ x
mov ecx,(OT_CAPT_Y_COLOR shl 16)+12 ;¯® ®á¨ y
mov edx,[v_color]
mcall 13
ret
align 4
@ -574,23 +677,43 @@ but_save_file:
popad
ret
;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
align 4
but_1:
cmp dword[v_zoom],7
cmp dword[v_zoom],10 ;¬ ªá¨¬ «ì­ë© à §¬¥à, ¤® ª®â®à®£® ¬®¦­® 㢥«¨ç¨âì 2^10=1024
jge @f
inc dword[v_zoom]
shl dword[n_plane],1
push eax
mov eax,[v_zoom]
cmp eax,[scaled_zoom]
jl .end_0
shl dword[cam_x],1
shl dword[cam_y],1
shl dword[cam_z],1
.end_0:
pop eax
call draw_objects
call draw_pok
@@:
ret
;㬥­ì襭¨¥ ¬ áèâ ¡ 
align 4
but_2:
cmp dword[v_zoom],-1
jl @f
dec dword[v_zoom]
shr dword[n_plane],1
push eax
mov eax,[v_zoom]
cmp eax,[scaled_zoom]
jl .end_0
shr dword[cam_x],1
shr dword[cam_y],1
shr dword[cam_z],1
.end_0:
pop eax
call draw_objects
call draw_pok
@@:
@ -690,12 +813,32 @@ push edi
push eax ebx ecx
mov eax,[v_zoom]
inc eax
stdcall buf2d_vox_obj_draw_3g, buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, eax
cmp eax,[scaled_zoom]
jle .end_scaled
;७¤¥à 㢥«¨ç¥­­®© ç á⨠®¡ê¥ªâ 
mov ebx,[scaled_zoom]
sub eax,ebx
inc ebx
stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, 0xd080d0
bt dword[mode_light],0
jnc @f
stdcall buf2d_vox_obj_draw_3g_shadows, buf_r_img, buf_r_z, buf_vox, 0,0, 0, eax, 3
stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, ebx, 3
@@:
xor ebx,ebx
xor ecx,ecx
mov edi,buf_r_img
stdcall [buf2d_img_hdiv2], edi
shr buf2d_h,1
stdcall [buf2d_img_wdiv2], edi
shr buf2d_w,1
jmp .show
.end_scaled:
inc eax
stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, buf_vox, [open_file_vox], 0,0, 0, eax
bt dword[mode_light],0
jnc @f
stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, buf_vox, 0,0, 0, eax, 3
@@:
mov edi,buf_r_img
@ -704,17 +847,18 @@ push edi
stdcall [buf2d_img_wdiv2], edi
shr buf2d_w,1
stdcall buf2d_vox_obj_get_img_w_3g, buf_vox,[v_zoom]
stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom]
mov ebx,[buf_0.w]
sub ebx,eax
shr ebx,1 ;ebx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® £®à¨§®­â «¨
stdcall buf2d_vox_obj_get_img_h_3g, buf_vox,[v_zoom]
stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom]
cmp eax,[buf_0.h]
jg @f
mov ecx,[buf_0.h]
sub ecx,eax
shr ecx,1 ;ecx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯®
shr ecx,1 ;ecx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® ¢¥à⨪ «¨
@@:
.show:
stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi
shl buf2d_h,1
shl buf2d_w,1
@ -726,23 +870,27 @@ pop edi
align 4
draw_palete:
stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
stdcall [buf2d_filled_rect_by_size], buf_0, 5,3, 8,8,[v_color]
stdcall buf2d_draw_palete, buf_0, 5,14, 9,6, 18, 512
stdcall buf2d_draw_palete, buf_0, 5,3, 9,6, 18, 512
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
ret
v_zoom dd 2 ;⥪ã騩 ¬ áèâ ¡
v_zoom dd 3 ;⥪ã騩 ¬ áèâ ¡
v_cur_x dd 0 ;ª®®à¤¨­ â  ªãàá®à  x
v_cur_y dd 0 ;ª®®à¤¨­ â  ªãàá®à  y (­® ®áì ¢ ®¡ê¥ªâ¥ z)
n_plane dd 0 ;¯«®áª®áâì á¥ç¥­¨ï
v_color dd 0xff ;梥⠪ à ­¤ è 
v_pen_mode dd 1 ;०¨¬: 0-áâ¨à ­¨ï, 1-à¨á®¢ ­¨ï
mode_light dd 1 ;०¨¬ ®á¢¥é¥­¨ï
cam_x dd 0
cam_y dd 0
cam_z dd 0
scaled_zoom dd 5 ;¬ áèâ ¡ ¯®á«¥ ª®â®à®£® ­ ç¨­ ¥âáï à¨á®¢ ­¨¥ ç á⨠¨§®¡à ¦¥­¨ï
txt_zoom db 'Œ áèâ ¡:',0
txt_cur_x db 'x:',0
txt_cur_y db 'y:',0
txt_n_plane db '‘¥ç¥­¨¥:',0
txt_color db '–¢¥â:',0
align 4
draw_objects:
@ -756,13 +904,13 @@ draw_objects:
jmp .end_f
@@:
push eax ebx ecx
stdcall buf2d_vox_obj_get_img_w_3g, buf_vox,[v_zoom]
stdcall [buf2d_vox_obj_get_img_w_3g], buf_vox,[v_zoom]
mov ebx,[buf_0.w]
sub ebx,eax
shr ebx,1 ;ebx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯® £®à¨§®­â «¨
xor ecx,ecx
stdcall buf2d_vox_obj_get_img_h_3g, buf_vox,[v_zoom]
stdcall [buf2d_vox_obj_get_img_h_3g], buf_vox,[v_zoom]
cmp eax,[buf_0.h]
jg @f
mov ecx,[buf_0.h]
@ -770,15 +918,31 @@ draw_objects:
shr ecx,1 ;ecx - ¤«ï 業â஢ª¨ ¬ «¥­ìª¨å ¨§®¡à ¦¥­¨© ¯®
@@:
stdcall buf2d_vox_obj_draw_3g, buf_0, buf_0z, buf_vox, [open_file_vox], ebx,ecx, 0, [v_zoom]
mov eax,[v_zoom]
cmp eax,[scaled_zoom]
jg @f
;®¡ëç­ë© ०¨¬ ¨§®¡à ¦¥­¨ï
stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, buf_vox, [open_file_vox], ebx,ecx, 0, eax
stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox], OT_MAP_X,OT_MAP_Y,TILE_SIZE, [v_zoom], [n_plane], 0xd0d0d0
bt dword[mode_light],0
jnc @f
stdcall buf2d_vox_obj_draw_3g_shadows, buf_0, buf_0z, buf_vox, ebx,ecx, 0, [v_zoom], 3
jnc .end_1
stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, ebx,ecx, 0, eax, 3
.end_1:
jmp .end_0
@@:
pop ecx ebx eax
;०¨¬ ¬ áèâ ¡¨à®¢ ­¨ï ¨§®¡à ¦¥­¨ï
sub eax,[scaled_zoom]
stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, buf_vox,\
[open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax
stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\
OT_MAP_X,OT_MAP_Y,TILE_SIZE, [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax
bt dword[mode_light],0
jnc .end_2
stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, buf_vox, 0,0, 0, [scaled_zoom], 3
.end_2:
.end_0:
stdcall buf2d_vox_obj_draw_pl, buf_pl, [open_file_vox], OT_MAP_X,OT_MAP_Y,TILE_SIZE, [v_zoom], [n_plane], 0xd0d0d0
pop ecx ebx eax
stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
stdcall [buf2d_draw], buf_pl ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
@ -1011,6 +1175,13 @@ import_buf2d:
buf2d_get_pixel dd sz_buf2d_get_pixel
buf2d_vox_brush_create dd sz_buf2d_vox_brush_create
buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete
buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g
buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g
buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g
buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled
buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl
buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled
buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows
dd 0,0
sz_init db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
@ -1039,6 +1210,13 @@ import_buf2d:
sz_buf2d_get_pixel db 'buf2d_get_pixel',0
sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0
sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0
sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0
sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0
sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0
sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0
sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0
sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0
sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0
mouse_dd dd 0x0
sc system_colors
@ -1051,8 +1229,8 @@ align 4
buf_0: dd 0 ;㪠§ â¥«ì ­  ¤a­ë¥ ¨§®¡à ¦¥­¨ï
.l: dw 5 ;+4 left
.t: dw 45 ;+6 top
.w: dd 192 ;+8 w
.h: dd 224 ;+12 h
.w: dd 192+6 ;+8 w
.h: dd 224+7 ;+12 h
.color: dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel
@ -1061,15 +1239,15 @@ align 4
buf_0z: dd 0
dw 0 ;+4 left
dw 0 ;+6 top
.w: dd 192 ;+8 w
.h: dd 224 ;+12 h
.w: dd 192+6 ;+8 w
.h: dd 224+7 ;+12 h
.color: dd 0 ;+16 color
db 32 ;+20 bit in pixel
;¡ãä¥à ¤«ï à¨á®¢ ­¨ï á१  ®¡ê¥ªâ 
align 4
buf_pl: dd 0
.l: dw 10+192 ;+4 left
.l: dw 15+192+6 ;+4 left
.t: dw 45 ;+6 top
.w: dd 320 ;+8 w
.h: dd 330 ;+12 h