17,7 → 17,7 |
include 'vox_draw.inc' |
|
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
caption db 'Voxel editor 17.07.12',0 ;¯®¤¯¨áì ®ª |
caption db 'Voxel editor 19.07.12',0 ;¯®¤¯¨áì ®ª |
|
struct FileInfoBlock |
Function dd ? |
34,7 → 34,7 |
|
fn_toolbar db 'toolbar.png',0 |
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 |
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*14 |
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*21 |
image_data_toolbar dd 0 |
|
;§ ç¥¨ï § ¤ ¢ ¥¬ë¥ ¯® 㬮«ç ¨î, ¡¥§ ini ä ©« |
105,6 → 105,7 |
OT_MAP_Y equ 0 |
OT_CAPT_X_COLOR equ 5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â |
OT_CAPT_Y_COLOR equ 30 |
PEN_MODE_SELECT_COLOR equ 2 ;०¨¬ ¢ë¡®à 梥â |
|
align 4 |
start: |
221,7 → 222,7 |
shr ebx,16 |
and eax,0xffff |
|
cmp dword[v_pen_mode],2 ;select color |
cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
jne .end_2 |
stdcall get_buf_color, buf_0 |
stdcall get_buf_color, buf_pl |
452,6 → 453,27 |
add ebx,25 shl 16 |
mov edx,16 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,17 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,18 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,19 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,20 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,21 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,22 |
int 0x40 |
add ebx,25 shl 16 |
mov edx,23 |
int 0x40 |
|
; *** à¨á®¢ ¨¥ ¨ª®®ª ª®¯ª å *** |
mov eax,7 |
468,38 → 490,59 |
int 0x40 |
|
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(30 shl 16) ; |
add edx,(30 shl 16) ;㢥«¨ç. ¬ áèâ ¡ |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;㬥ìè. ¬ áèâ ¡ |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¯®¢®à®â 1 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¯®¢®à®â 2 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;ᤢ¨£ ¯«®áª®á⨠+ |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;ᤢ¨£ ¯«®áª®á⨠- |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¨áâà㬥⠪ à ¤ è |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¨áâà㬥⠪¨áâì |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¨áâà㬥⠧ â¨à çª |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;¢ë¡®à 梥â |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; |
add edx,(25 shl 16) ;®á¢¥é¥¨¥ |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;।¥à 2*2 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;ᮧ¤ âì ª¨áâì |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ; à¨á®¢ âì ª¨áâì |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;è¨à¨ ª¨á⨠-1 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;è¨à¨ ª¨á⨠+1 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;¢ëá®â ª¨á⨠-1 |
int 0x40 |
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;¢ëá®â ª¨á⨠+1 |
int 0x40 |
|
; *** à¨á®¢ ¨¥ ¡ãä¥à®¢ *** |
call draw_objects |
511,41 → 554,42 |
|
align 4 |
draw_pok: |
mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ |
mov ebx,(365 shl 16)+5 |
mov ecx,[sc.work_text] |
or ecx,0x80000000 ;or (1 shl 30) |
mov edx,txt_zoom |
;mov edi,[sc.work] |
int 0x40 |
add bx,9 |
mov edx,txt_cur_x |
int 0x40 |
add bx,9 |
mov edx,txt_cur_y |
int 0x40 |
add bx,9 |
mov edx,txt_n_plane |
int 0x40 |
|
mov eax,47 |
mov ecx,[v_zoom] |
mov ebx,(3 shl 16)+(1 shl 31) |
mov edx,((365+6*9) shl 16)+5 |
mov edx,((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 |
mov esi,[sc.work_button_text] |
or esi,(1 shl 30) |
mov edi,[sc.work_button] |
int 0x40 ;¬ áèâ ¡ |
mov ecx,[v_cur_x] |
add edx,9 |
int 0x40 ;ªãàá®à x |
mov ecx,[v_cur_y] |
add edx,9 |
int 0x40 ;ªãàá®à y |
mov ecx,[n_plane] |
add edx,9 |
add edx,115 shl 16 ;9 |
int 0x40 ;®¬¥à á¥ç¥¨ï |
|
;®¡®¢«¥¨¥ ¯ à ¬¥â஢ ªãàá®à |
mov dword[txt_curor.size],0 |
mov eax,dword[v_cur_x] |
mov edi,txt_curor.size |
call convert_int_to_str |
stdcall str_cat, edi,txt_mull |
mov eax,dword[v_cur_y] |
mov edi,txt_buf |
call convert_int_to_str |
stdcall str_cat, txt_curor.size,edi |
stdcall str_cat, txt_curor.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥« |
|
;®¡®¢«¥¨¥ ¯ à ¬¥â஢ ª¨á⨠|
mov dword[txt_brush.size],0 |
mov eax,dword[brush_w] |
mov edi,txt_brush.size |
call convert_int_to_str |
stdcall str_cat, edi,txt_mull |
mov eax,dword[brush_h] |
mov edi,txt_buf |
call convert_int_to_str |
stdcall str_cat, txt_brush.size,edi |
stdcall str_cat, txt_brush.size,txt_space ;§ ¢¥àè î騩 ¯à®¡¥« |
|
mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ |
mov ebx,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2 |
mov ecx,[sc.work_text] |
553,6 → 597,24 |
mov edx,txt_color |
int 0x40 |
|
mov edx,txt_curor |
add ebx,115 shl 16 |
or ecx,(1 shl 30) |
mov edi,[sc.work] |
int 0x40 |
|
mov edx,txt_brush |
add ebx,115 shl 16 |
int 0x40 |
|
mov edx,txt_zoom |
add ebx,115 shl 16 |
int 0x40 |
|
mov edx,txt_n_plane |
add ebx,115 shl 16 |
int 0x40 |
|
call on_change_color |
ret |
|
623,25 → 685,53 |
@@: |
cmp ah,12 |
jne @f |
call but_7 |
call but_mode_pen |
@@: |
cmp ah,13 |
jne @f |
call but_8 |
call but_mode_brush |
@@: |
cmp ah,14 |
jne @f |
mov dword[v_pen_mode],2 ;select color |
call draw_palete |
call but_mode_clear |
@@: |
cmp ah,15 |
jne @f |
call but_light |
mov dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
call draw_palete |
@@: |
cmp ah,16 |
jne @f |
call but_light |
@@: |
cmp ah,17 |
jne @f |
call but_rend_2_2 |
@@: |
cmp ah,18 |
jne @f |
call but_brush_copy |
@@: |
cmp ah,19 |
jne @f |
call but_brush_draw |
@@: |
cmp ah,20 |
jne @f |
call but_bru_w_m |
@@: |
cmp ah,21 |
jne @f |
call but_bru_w_p |
@@: |
cmp ah,22 |
jne @f |
call but_bru_h_m |
@@: |
cmp ah,23 |
jne @f |
call but_bru_h_p |
@@: |
cmp ah,1 |
jne still |
.exit: |
907,11 → 997,11 |
ret |
|
align 4 |
but_7: |
but_mode_pen: |
push eax |
mov eax,dword[v_pen_mode] |
mov dword[v_pen_mode],1 ;draw |
cmp eax,2 |
mov dword[v_pen_mode],1 ;pen |
cmp eax,PEN_MODE_SELECT_COLOR |
jne @f |
call draw_objects |
@@: |
919,11 → 1009,23 |
ret |
|
align 4 |
but_8: |
but_mode_brush: |
push eax |
mov eax,dword[v_pen_mode] |
mov dword[v_pen_mode],3 ;brush |
cmp eax,PEN_MODE_SELECT_COLOR |
jne @f |
call draw_objects |
@@: |
pop eax |
ret |
|
align 4 |
but_mode_clear: |
push eax |
mov eax,dword[v_pen_mode] |
mov dword[v_pen_mode],0 ;clear |
cmp eax,2 |
cmp eax,PEN_MODE_SELECT_COLOR |
jne @f |
call draw_objects |
@@: |
1027,7 → 1129,173 |
stdcall [buf2d_draw], buf_0 ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
ret |
|
;㬥ìè ¥¬ è¨à¨ã ª¨á⨠|
align 4 |
but_bru_w_m: |
cmp dword[brush_w],1 |
jle @f |
dec dword[brush_w] |
pushad |
call draw_pok |
call draw_vox_cursor |
stdcall [buf2d_draw], buf_pl ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
popad |
@@: |
ret |
;㢥«¨ç¨¢ ¥¬ è¨à¨ã ª¨á⨠|
align 4 |
but_bru_w_p: |
cmp dword[brush_w],32 |
jge @f |
inc dword[brush_w] |
pushad |
call draw_pok |
call draw_vox_cursor |
stdcall [buf2d_draw], buf_pl ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
popad |
@@: |
ret |
;㬥ìè ¥¬ ¢ëá®âã ª¨á⨠|
align 4 |
but_bru_h_m: |
cmp dword[brush_h],1 |
jle @f |
dec dword[brush_h] |
pushad |
call draw_pok |
call draw_vox_cursor |
stdcall [buf2d_draw], buf_pl ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
popad |
@@: |
ret |
;㢥«¨ç¨¢ ¥¬ ¢ëá®âã ª¨á⨠|
align 4 |
but_bru_h_p: |
cmp dword[brush_h],32 |
jge @f |
inc dword[brush_h] |
pushad |
call draw_pok |
call draw_vox_cursor |
stdcall [buf2d_draw], buf_pl ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
popad |
@@: |
ret |
|
align 4 |
but_brush_copy: |
cmp dword[v_pen_mode],3 |
jne .end_f |
pushad |
mov eax,[v_cur_x] |
mov ebx,[n_plane] |
mov edx,[v_cur_y] |
|
mov ecx,[v_zoom] |
cmp ecx,[scaled_zoom] |
jle @f |
;¯à¥®¡à §®¢ ¨¥ ª®®à¤¨ â, á ãç¥â®¬ 㢥«¨ç¥¨ï |
;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 |
@@: |
|
cld |
mov edi,brush_data |
mov esi,edx |
sub esi,[brush_h] |
.cycle_0: |
mov ecx,[brush_w] |
@@: |
push eax |
stdcall buf2d_vox_obj_node_get_color, [open_file_vox], eax,ebx,edx, [v_zoom] |
cmp eax,[v_color] |
jne .end_0 |
mov eax,1 shl 30 |
.end_0: |
mov dword[edi],eax ;color |
pop eax |
inc eax |
add edi,4 |
loop @b |
dec edx |
sub eax,[brush_w] |
cmp edx,esi |
jg .cycle_0 |
|
call draw_objects |
popad |
.end_f: |
ret |
|
align 4 |
but_brush_draw: |
cmp dword[v_pen_mode],3 |
jne .end_f |
pushad |
mov eax,[v_cur_x] |
mov ebx,[n_plane] |
mov edx,[v_cur_y] |
|
mov ecx,[v_zoom] |
cmp ecx,[scaled_zoom] |
jle @f |
;¯à¥®¡à §®¢ ¨¥ ª®®à¤¨ â, á ãç¥â®¬ 㢥«¨ç¥¨ï |
;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 |
@@: |
|
cld |
mov edi,brush_data |
mov esi,edx |
sub esi,[brush_h] |
.cycle_0: |
mov ecx,[brush_w] |
@@: |
bt dword[edi],31 ;¡¨â ¯à®§à ç®á⨠|
jc .end_2 |
bt dword[edi],30 ;¡¨â ⥪ã饣® 梥â |
jnc .end_0 |
push dword[v_color] |
jmp .end_1 |
.end_0: |
push dword[edi] |
.end_1: |
stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom] ;, color |
.end_2: |
inc eax |
add edi,4 |
loop @b |
dec edx |
sub eax,[brush_w] |
cmp edx,esi |
jg .cycle_0 |
|
call draw_objects |
popad |
.end_f: |
ret |
|
align 4 |
draw_palete: |
stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à |
stdcall buf2d_draw_palete, buf_0, 5,3, 9,6, 18, 512 |
1034,6 → 1302,7 |
stdcall [buf2d_draw], buf_0 ;®¡®¢«ï¥¬ ¡ãä¥à íªà ¥ |
ret |
|
align 4 |
v_zoom dd 3 ;⥪ã騩 ¬ áèâ ¡ |
v_cur_x dd 0 ;ª®®à¤¨ â ªãàá®à x |
v_cur_y dd 0 ;ª®®à¤¨ â ªãàá®à y (® ®áì ¢ ®¡ê¥ªâ¥ z) |
1047,12 → 1316,25 |
scaled_zoom dd 5 ;¬ áèâ ¡ ¯®á«¥ ª®â®à®£® ç¨ ¥âáï à¨á®¢ ¨¥ ç á⨠¨§®¡à ¦¥¨ï |
tile_size dd ? ;à §¬¥à ª¢ ¤à ⨪ ¯«®áª®á⨠á á¥ç¥¨¥¬ |
max_open_file_size dd ? |
brush_w dd 5 ;è¨à¨ ª¨á⨠|
brush_h dd 5 ;¢ëá®â ª¨á⨠|
brush_data dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
rd 999 ;32*32-25 |
|
txt_zoom db ' áèâ ¡:',0 |
txt_cur_x db 'x:',0 |
txt_cur_y db 'y:',0 |
txt_curor: db 'ãàá®à: ' |
.size: rb 10 |
txt_n_plane db '¥ç¥¨¥:',0 |
txt_color db '¢¥â:',0 |
txt_brush: db '¨áâì: ' |
.size: rb 10 |
txt_mull db '*',0 |
txt_space db ' ',0 |
txt_buf rb 16 |
|
align 4 |
draw_objects: |
1060,7 → 1342,7 |
stdcall [buf2d_clear], buf_0z, 0 ;ç¨á⨬ ¡ãä¥à |
stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;ç¨á⨬ ¡ãä¥à |
|
cmp dword[v_pen_mode],2 |
cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
jne @f |
call draw_palete |
jmp .end_f |
1146,6 → 1428,9 |
dec ebx |
add edi,2 |
|
cmp dword[v_pen_mode],3 |
je .brush |
|
;£®à¨§®â «ìë¥ «¨¨¨ |
sub eax,2 |
mov ecx,edi |
1162,7 → 1447,19 |
dec edi |
stdcall [buf2d_line], buf_pl, eax,ebx, edi,ebx,[sc.work_graph] |
@@: |
jmp .end_f |
|
;à ¬ª ¤«ï ª¨á⨠|
.brush: |
dec eax |
mov ecx,[brush_w] |
imul ecx,[tile_size] |
;mov edi,eax |
mov edi,ecx |
mov esi,[brush_h] |
imul esi,[tile_size] |
stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,esi,[sc.work_graph] |
|
.end_f: |
popad |
ret |
1242,6 → 1539,67 |
endp |
end if |
|
;input: |
; eax = value |
; edi = string buffer |
;output: |
align 4 |
convert_int_to_str: |
pushad |
mov dword[edi+1],0 |
mov word[edi+5],0 |
call .str |
popad |
ret |
|
align 4 |
.str: |
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬ áç¨á«¥¨ï ¨§¬¥ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤ë¥ ¯ à ¬¥âàë eax - ç¨á«® |
;¯à¥à¥¢®¤ ç¨á« ¢ ASCII áâப㠢§®¤ë¥ ¤ ë¥ ecx=á¨á⥬ áç¨á«¥ï edi ¤à¥á ªã¤ § ¯¨áë¢ âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®¥æ ¯¥à¥¬¥®© |
cmp eax,ecx ;áà ¢¨âì ¥á«¨ ¢ eax ¬¥ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ @@-1 â.¥. pop eax |
jb @f |
xor edx,edx ;®ç¨áâ¨âì edx |
div ecx ;à §¤¥«¨âì - ®áâ ⮪ ¢ edx |
push edx ;¯®«®¦¨âì ¢ á⥪ |
;dec edi ;ᬥ饨¥ ¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®æ áâப¨ |
call .str ;¯¥à¥©â¨ á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥â ¯®ª ¢ eax ¥ á⠥⠬¥ìè¥ ç¥¬ ¢ ecx |
pop eax |
@@: ;cmp al,10 ;¯à®¢¥à¨âì ¥ ¬¥ìè¥ «¨ § 票¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥ï 10 ¤ ï ª®¬ ¤ - «¨è ï)) |
or al,0x30 ;¤ ï ª®¬ ¤ ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥ |
stosb ;§ ¯¨á âì í«¥¬¥â ¨§ ॣ¨áâà al ¢ ï祪㠯 ¬ï⨠es:edi |
ret ;¢¥àãâìáï ç¥ì ¨â¥à¥áë© å®¤ â.ª. ¯®ª ¢ á⥪¥ åà ¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï |
|
align 4 |
proc str_cat, str1:dword, str2:dword |
push eax ecx edi esi |
mov esi,dword[str2] |
stdcall str_len,esi |
mov ecx,eax |
inc ecx |
mov edi,dword[str1] |
stdcall str_len,edi |
add edi,eax |
cld |
repne movsb |
pop esi edi ecx eax |
ret |
endp |
|
;output: |
; eax = strlen |
align 4 |
proc str_len, str1:dword |
mov eax,[str1] |
@@: |
cmp byte[eax],0 |
je @f |
inc eax |
jmp @b |
@@: |
sub eax,[str1] |
ret |
endp |
|
;¤ ë¥ ¤«ï ¤¨ «®£ ®âªàëâ¨ï ä ©«®¢ |
align 4 |
OpenDialog_data: |