1,44 → 1,23 |
use32 |
org 0x0 |
db 'MENUET01' ;¨¤¥â¨ä. ¨á¯®«ï¥¬®£® ä ©« ¢á¥£¤ 8 ¡ ©â |
dd 0x1 |
dd start |
dd i_end ;à §¬¥à ¯à¨«®¦¥¨ï |
dd mem |
dd stacktop |
dd 0 |
dd sys_path |
dd 1, start, i_end, mem, stacktop, 0, sys_path |
|
include '../../../../programs/macros.inc' |
include '../../../../programs/proc32.inc' |
include '../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../dll.inc' |
include '../../../../programs/KOSfuncs.inc' |
include '../../../../programs/load_img.inc' |
include 'vox_draw.inc' |
include 'vox_rotate.inc' |
include 'str.inc' |
|
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
caption db 'Voxel editor 02.02.15',0 ;¯®¤¯¨áì ®ª |
caption db 'Voxel editor 18.02.16',0 ;¯®¤¯¨áì ®ª |
|
struct FileInfoBlock |
Function dd ? |
Position dd ? |
Flags dd ? |
Count dd ? |
Buffer dd ? |
db ? |
FileName dd ? |
ends |
|
run_file_70 FileInfoBlock |
image_data dd 0 ;㪠§ â¥«ì ¢à¥¬¥ãî ¯ ¬ïâì. ¤«ï 㦥 ¯à¥®¡à §®¢ ¨ï ¨§®¡à ¦¥¨ï |
|
fn_toolbar db 'toolbar.png',0 |
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 |
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*27 |
image_data_toolbar dd 0 |
cursors_count equ 4 |
IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨪¨ á ªãàá®à ¬¨ |
|
;§ ç¥¨ï § ¤ ¢ ¥¬ë¥ ¯® 㬮«ç ¨î, ¡¥§ ini ä ©« |
ini_def_window_t equ 10 |
65,45 → 44,6 |
key_f_size db 'file_size',0 |
key_col_b db 'c_background',0 |
|
macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥¨© |
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬ |
if path eqtype '' ;¯à®¢¥à塞 § ¤ «¨ áâப®© ¯ à ¬¥âà path |
jmp @f |
local .path_str |
.path_str db path ;ä®à¬¨à㥬 «®ª «ìãî ¯¥à¥¬¥ãî |
db 0 |
@@: |
;32 - áâ ¤ àâë© ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥ ¡ëâì ¡ãä¥à á á¨áâ¥¬ë¬ ¯ã⥬ |
copy_path .path_str,[32],file_name,0x0 |
else |
copy_path path,[32],file_name,0x0 ;ä®à¬¨à㥬 ¯®«ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ® ¢ ®¤®© ¯ ¯ª¥ á ¯à®£à ¬¬®© |
end if |
|
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥¨ï |
mov [buf],eax |
|
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨ |
mov [run_file_70.Function], 0 |
mov [run_file_70.Position], 0 |
mov [run_file_70.Flags], 0 |
mov [run_file_70.Count], dword size |
m2m [run_file_70.Buffer], [buf] |
mov byte[run_file_70+20], 0 |
mov [run_file_70.FileName], file_name |
mov ebx,run_file_70 |
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥¨ï |
cmp ebx,0xffffffff |
je @f |
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥ë© ¡ãä¥à image_data |
stdcall dword[img_decode], dword[buf],ebx,0 |
mov dword[image_data],eax |
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥¨¥ ª ä®à¬ âã rgb |
stdcall dword[img_to_rgb2], dword[image_data],dword[buf] |
;㤠«ï¥¬ ¢à¥¬¥ë© ¡ãä¥à image_data |
stdcall dword[img_destroy], dword[image_data] |
@@: |
} |
|
OT_MAP_X equ 0 |
OT_MAP_Y equ 0 |
OT_CAPT_X_COLOR equ 5 ;®âáâ㯠¤«ï ¯®¤¯¨á¨ 梥â |
113,17 → 53,23 |
PEN_MODE_SELECT_COLOR equ 2 ;०¨¬ ¢ë¡®à 梥â |
PEN_MODE_BRUSH equ 3 ;०¨¬ à ¡®âë á ª¨áâìî |
|
run_file_70 FileInfoBlock |
|
align 4 |
start: |
load_libraries l_libs_start,l_libs_end |
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨« áì ¡¨¡«¨®â¥ª |
mov ebp,lib_2 |
;¯à®¢¥àª ᪮«ìª® ã¤ ç® § £ã§¨«¨áì ¡¨¡«¨®â¥ª¨ |
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 |
@@: |
mcall 48,3,sc,sizeof.system_colors |
mcall 40,0x27 |
add ebp,ll_struc_size |
cmp ebp,l_libs_end |
jl .test_lib_open |
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors |
mcall SF_SET_EVENTS_MASK,0xC0000027 |
stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª ¤¨ «®£ |
|
;--- load ini file --- |
172,11 → 118,11 |
mov [buf_pl.h],eax |
|
;*** § £à㧪 ªãàá®à®¢ |
load_image_file 'cursors_gr.png',image_data_toolbar,IMAGE_CURSORS_SIZE |
load_image_file 'cursors_gr.png',image_data_toolbar |
stdcall [buf2d_create_f_img], buf_curs_8,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à |
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì |
|
load_image_file 'cursors.png',image_data_toolbar, IMAGE_CURSORS_SIZE |
load_image_file 'cursors.png',image_data_toolbar |
stdcall [buf2d_create_f_img], buf_curs,[image_data_toolbar] ;ᮧ¤ ¥¬ ¡ãä¥à |
stdcall mem.Free,[image_data_toolbar] ;®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì |
|
191,7 → 137,7 |
stdcall [buf2d_vox_brush_create], buf_vox_g3, vox_6_7_z |
stdcall [buf2d_vox_brush_create], buf_vox_g2, vox_6_4_z |
|
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE |
load_image_file fn_toolbar, image_data_toolbar |
|
stdcall mem.Alloc,[max_open_file_size] |
mov dword[open_file_vox],eax |
207,7 → 153,7 |
|
align 4 |
still: |
mcall 10 |
mcall SF_WAIT_EVENT |
|
cmp al,1 |
jz red_win |
217,7 → 163,7 |
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 |
227,10 → 173,10 |
align 4 |
mouse: |
pushad |
mcall 37,2 |
mcall SF_MOUSE_GET,SSF_BUTTON |
bt eax,1 ;right button |
jnc @f |
mcall 37,1 ;get mouse coords |
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
mov ebx,eax |
shr ebx,16 |
and eax,0xffff |
240,7 → 186,7 |
@@: |
bt eax,0 ;left button |
jnc .end_f |
mcall 37,1 ;get mouse coords |
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
mov ebx,eax |
shr ebx,16 |
and eax,0xffff |
352,7 → 298,7 |
mov ecx,dword[v_zoom] |
mov edi,eax |
mov esi,ebx |
mcall 66,3 |
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS |
and eax,3 ;3 -> ¡¨â 0 «¥¢ë© Shift ¦ â, ¡¨â 1 ¯à ¢ë© Shift ¦ â |
jz .shift_end |
;¥á«¨ ¦ â Shift, ⮠। ªâ¨à㥬 ¢¥à奬 ã஢¥ |
432,21 → 378,16 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
|
; *** à¨á®¢ ¨¥ £« ¢®£® ®ª (¢ë¯®«ï¥âáï 1 à § ¯à¨ § ¯ã᪥) *** |
mov edx,[sc.work] |
or edx,(3 shl 24)+0x30000000 |
mov edi,caption |
mcall 0,dword[wnd_s_pos],dword[wnd_s_pos+4] |
mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4] |
|
; *** ᮧ¤ ¨¥ ª®¯®ª ¯ ¥«ì *** |
mov eax,8 |
mov ebx,(5 shl 16)+20 |
mov ecx,(5 shl 16)+20 |
mov edx,3 |
mov esi,[sc.work_button] |
int 0x40 |
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button] |
|
mov ebx,(30 shl 16)+20 |
inc edx |
528,11 → 469,7 |
int 0x40 |
|
; *** à¨á®¢ ¨¥ ¨ª®®ª ª®¯ª å *** |
mov eax,7 |
mov ebx,[image_data_toolbar] |
mov ecx,(16 shl 16)+16 |
mov edx,(7 shl 16)+7 ;icon new |
int 0x40 |
mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new |
|
add ebx,IMAGE_TOOLBAR_ICON_SIZE |
add edx,(25 shl 16) ;icon open |
618,7 → 555,7 |
call draw_objects |
call draw_pok |
|
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
|
660,12 → 597,10 |
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] |
or ecx,0x80000000 ;or (1 shl 30) |
mov edx,txt_color |
int 0x40 |
mcall SF_DRAW_TEXT,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2 |
|
mov edx,txt_curor |
add ebx,115 shl 16 |
691,30 → 626,26 |
align 4 |
on_change_color: |
pushad |
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 |
mcall SF_DRAW_RECT,((OT_CAPT_X_COLOR+35) shl 16)+16,(OT_CAPT_Y_COLOR shl 16)+12,[v_color] |
|
mov ebx,(1 shl 8)+(6 shl 16) |
mov ecx,edx |
mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2 |
mov esi,[sc.work_text] |
add esi,(1 shl 30) |
mov edi,[sc.work] |
mcall 47 |
mcall SF_DRAW_NUMBER,(1 shl 8)+(6 shl 16) |
popad |
ret |
|
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
jmp still |
|
|
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,3 |
jne @f |
call but_new_file |
842,7 → 773,7 |
stdcall [buf2d_delete],buf_curs_8 |
stdcall mem.Free,[image_data_toolbar] |
stdcall mem.Free,[open_file_vox] |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
|
;¤ ë¥ ¤«ï ¨¨æ¨ «¨§ 樨 ¢®ªá¥«ì®£® ®¡ê¥ªâ |
align 4 |
864,7 → 795,6 |
|
align 4 |
open_file_vox dd 0 ;㪠§ â¥«ì ®¡« áâì ¤«ï ®âªàëâ¨ï ä ©«®¢ |
open_b rb 560 |
|
align 4 |
but_open_file: |
876,8 → 806,7 |
je .end_open_file |
;ª®¤ ¯à¨ 㤠箬 ®âªàë⨨ ¤¨ «®£ |
|
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨ |
mov [run_file_70.Function], 5 |
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 |
884,8 → 813,7 |
mov dword[run_file_70.Buffer], open_b |
mov byte[run_file_70+20], 0 |
mov dword[run_file_70.FileName], openfile_path |
mov ebx,run_file_70 |
int 0x40 |
mcall SF_FILE,run_file_70 |
|
mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©« ¢ ¡ ©â å |
cmp ecx,[max_open_file_size] ;¯à®¢¥à塞 à §¬¥à ¢ë¤¥«¥®© ¯ ¬ï⨠|
896,8 → 824,7 |
notify_window_run txt_need_memory |
@@: |
|
mov eax,70 ;70-ï äãªæ¨ï à ¡®â á ä ©« ¬¨ |
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 |
904,15 → 831,13 |
m2m dword[run_file_70.Buffer], dword[open_file_vox] |
mov byte[run_file_70+20], 0 |
mov dword[run_file_70.FileName], openfile_path |
mov ebx,run_file_70 |
int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥¨ï |
mcall SF_FILE,run_file_70 |
cmp ebx,0xffffffff |
je .end_open_file |
|
mcall 71,1,openfile_path |
mcall SF_SET_CAPTION,1,openfile_path |
|
;--- |
; |
mov eax,[open_file_vox] |
movzx eax,byte[eax] |
and eax,0xff ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ¨î |
941,7 → 866,7 |
|
stdcall buf2d_vox_obj_get_size, ebx |
mov dword[run_file_70.Count], eax ;à §¬¥à ä ©« |
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_vox] |
948,7 → 873,7 |
mov [run_file_70.Buffer], 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 |
|
1743,12 → 1668,12 |
mov ecx,[icon] |
shl ecx,12 ;㬮¦ ¥¬ 4 ª¡ |
add ecx,[buf_curs.data] |
mcall 37,4 |
mcall SF_MOUSE_GET,SSF_LOAD_CURSOR |
|
cmp eax,0 |
je @f |
mov [cursor_pointer],eax |
mcall 37,5,[cursor_pointer] |
mcall SF_MOUSE_GET,SSF_SET_CURSOR,[cursor_pointer] |
@@: |
ret |
endp |
1817,9 → 1742,9 |
err_msg_import_3 db '訡ª ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,0 |
|
l_libs_start: |
lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ |
lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ |
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i |
lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ |
lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ |
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i |
lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ |
err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i |
2075,7 → 2000,8 |
i_end: |
wnd_s_pos: ;¬¥áâ® ¤«ï áâ஥ª áâ à⮢®© ¯®§¨æ¨¨ ®ª |
rq 0 |
rb 4096 ;2048 |
rb 4096 |
align 16 |
stacktop: |
sys_path rb 1024 |
file_name: |