fix some functions

git-svn-id: svn://kolibrios.org@2501 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2012-03-23 17:24:30 +00:00
parent 6d3caf1b30
commit 1386fef88b
3 changed files with 198 additions and 44 deletions

View File

@ -16,7 +16,7 @@ include '../../nu_pogodi/trunk/mem.inc'
include '../../nu_pogodi/trunk/dll.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
hed db 'Life 20.02.12',0 ;¯®¤¯¨áì ®ª­ 
hed db 'Life 23.03.12',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@ -329,9 +329,11 @@ proc pole_cell_find, x:dword, y:dword
mov edx,ebx
shl edx,2
add edx,ecx
inc ebx
mov ecx,dword[ecx]
.cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
inc ebx
cmp ebx,ecx
jg .cycle_e
add edx,4
get_cell_offset edi,dword[edx]
mov esi,dword[x]
@ -344,9 +346,7 @@ proc pole_cell_find, x:dword, y:dword
mov eax,dword[edx] ;fnd=memCell[i];
jmp .cycle_e ;break;
.if_e:
inc ebx
cmp ebx,ecx
jle .cycle_b
jmp .cycle_b
.cycle_e:
pop esi edi edx ecx ebx
@@:
@ -886,7 +886,8 @@ start:
mov [CellColors],eax
load_image_file fn_toolbar, image_data_toolbar,IMAGE_TOOLBAR_SIZE
stdcall pole_init_colors, 0xffffff,0xff0000,0x0000ff
;­ áâனª  梥⮢ ï祥ª
stdcall pole_init_colors, 0xffffd0,0xff0000,0x0000ff
call pole_clear
call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)

View File

@ -27,6 +27,7 @@ pole_index equ dword[edi]
pole_data equ dword[edi +4] ;㪠§ â¥«ì ­  ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª
pole_max_cell equ dword[edi +8]
pole_b_sort equ dword[edi+12] ;£à ­¨æ  ¤«ï á®àâ¨à®¢ ­­ëå ï祥ª
offs_pole_b_sort equ 12
macro get_cell_offset reg,ind
{
@ -151,6 +152,8 @@ align 4
proc pole_cell_delete, pole:dword, x:dword, y:dword
pushad
mov edi,dword[pole]
mov ebx,edi
add ebx,offs_pole_b_sort
mov esi,pole_index
mov ecx,[esi]
@ -161,10 +164,6 @@ proc pole_cell_delete, pole:dword, x:dword, y:dword
cmp eax,0
je .fun_e ;¥á«¨ ª«¥âª  ­¥ ¡ë«  ᮧ¤ ­ 
cmp pole_b_sort,0
je @f
dec pole_b_sort
@@:
dec dword[esi]
mov edi,esi
@ -174,6 +173,17 @@ proc pole_cell_delete, pole:dword, x:dword, y:dword
repnz scasd ;¯®¨áª
sub edi,4
cmp dword[ebx],1 ;[ebx]=pole_b_sort
jl @f
mov eax,edi
sub eax,esi ;esi=pole_index
shr eax,2
dec eax
cmp [ebx],eax ;eax - ¯®§¨æ¨ï 㪠§ â¥«ï 㤠«ï¥¬®© ï祩ª¨
jle @f ;¡ë«® jl @f
dec dword[ebx]
@@:
shl edx,2
add edx,esi ;ª®­¥ç­ë© í«¥¬¥­â ¬ áᨢ 
sub edx,edi
@ -193,7 +203,7 @@ proc pole_cell_delete, pole:dword, x:dword, y:dword
ret
endp
if 0
if debug
align 4
proc but_test_pole, pole:dword
pushad
@ -205,7 +215,12 @@ proc but_test_pole, pole:dword
mov esi,pole_index
mov ecx,[esi]
mov eax,pole_b_sort
mov edi,open_file_lif
stdcall convert_int_to_str
stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,color_s0 ;à¨á㥬 b_sort
add ebx,18
mov eax,[esi]
add esi,4
@ -279,9 +294,11 @@ proc pole_cell_find uses edi, pole:dword, x:dword, y:dword
mov edx,ebx
shl edx,2
add edx,ecx
inc ebx
mov ecx,dword[ecx]
.cycle_b: ;for(i=pole_b_sort+1;i<=fristC;i++)
inc ebx
cmp ebx,ecx
jg .not_found
add edx,4
get_cell_offset esi,dword[edx]
mov eax,dword[x]
@ -294,9 +311,8 @@ proc pole_cell_find uses edi, pole:dword, x:dword, y:dword
mov eax,dword[edx] ;fnd=pole_index[i];
jmp .cycle_e ;break;
.if_e:
inc ebx
cmp ebx,ecx
jle .cycle_b
jmp .cycle_b
.not_found:
xor eax,eax ;¢®ááâ ­ ¢«¨¢ ¥¬ ­ã«¥¢®¥ §­ ç¥­¨¥ ¥á«¨ ­¥ ­ è«¨ ï祩ªã (¢ 横«¥ eax ¯®àâ¨âáï ¯à¨ ¯à®¢¥àª¥ ª®®à¤¨­ â)
.cycle_e:
pop esi edx ecx ebx
@ -363,6 +379,58 @@ proc pole_bin_find uses ebx ecx edx edi, mas:dword, fx:dword, fy:dword, k:dword
ret
endp
;ᤢ¨£ ¢á¥å ï祥ª (¨ ®¡ê¥ªâ®¢)
align 4
proc pole_move_all, pole:dword, m_d_x:dword, m_d_y:dword
pushad
mov edi,dword[pole]
mov edx,[m_d_x]
mov esi,[m_d_y]
mov eax,pole_index
cmp dword[eax],0
je .end_0 ;¥á«¨ ­¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室
mov ecx,dword[eax]
cld
@@: ;横« ¯® ¢á¥¬ ï祩ª ¬
add eax,4
mov ebx,[eax]
imul ebx,sizeof.Cell
add ebx,pole_data
add dword[ebx+offs_cell_x],edx
add dword[ebx+offs_cell_y],esi
loop @b
.end_0:
;横« ¯® «®£¨ç¥áª¨¬ í«¥¬¥­â ¬ ¨ ¯®¤¯¨áï¬
stdcall dword[tl_node_poi_get_info],0,tree1
pop eax
@@:
cmp eax,0
je .end_1
cmp word[eax],el_icon_elems ;¯®«ã祭¨¥ ç¥à¥§ eax ⨯ ¨ª®­ª¨
je .mov_1
cmp word[eax],el_icon_captions
je .mov_1
jmp .end_mov_1
.mov_1:
stdcall [tl_node_poi_get_data], eax, tree1
pop ecx
add [ecx],edx ;coord x
add [ecx+4],esi ;coord y
.end_mov_1:
stdcall dword[tl_node_poi_get_next_info],eax,tree1
pop eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã
jmp @b
.end_1:
popad
ret
endp
;output:
; dl
align 4
@ -910,7 +978,7 @@ proc pole_draw_pok uses eax ebx ecx edx edi esi, pole:dword
;mov edi,dword[pole]
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,325*65536+5
mov ebx,400*65536+5
mov ecx,[sc.work_text]
or ecx,0x80000000 ;or (1 shl 30)
mov edx,txt_zoom
@ -928,7 +996,7 @@ proc pole_draw_pok uses eax ebx ecx edx edi esi, pole:dword
mov eax,47
movzx ecx,byte[zoom]
mov ebx,(2 shl 16)
mov edx,(325+6*9)*65536+5
mov edx,(400+6*9)*65536+5
mov esi,[sc.work_button_text]
or esi,(1 shl 30)
mov edi,[sc.work_button]

View File

@ -16,6 +16,8 @@ color_s2 equ 0xff00 ;
color_s3 equ 0xff0000 ;¢à¥¬¥­­®¥ §­ ç¥­¨¥ ¤«ï á®åà ­¥­¨ï
color_caption equ 0x808080
debug equ 0
;­®¬ à  ¨ª®­®ª:
el_icon_group equ 0 ;£à㯯®¢ ï
el_icon_points equ 1 ;â®çª¨
@ -48,7 +50,7 @@ include 'le_pole.inc'
include 'le_signal.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 21.03.12',0 ;¯®¤¯¨áì ®ª­ 
caption db '‹®£¨ç¥áª¨¥ í«¥¬¥­âë 23.03.12',0 ;¯®¤¯¨áì ®ª­ 
panel_0_coord_top equ 5 ;¢¥àå­ïï ª®®à¤¨­ â  0-£® à鸞 ¯ ­¥«¨ ¨­áâà㬥­â®¢
panel_1_coord_top equ 35
@ -104,6 +106,7 @@ elOpt 'or[4]', 0xff00ff,5,9,tbl_or, tbl_il_4, 4
elOpt 'and[2]',0xffff00,5,5,tbl_and.2, tbl_il_2, 2
elOpt 'and[3]',0xffff00,5,7,tbl_and.3, tbl_il_3, 3
elOpt 'and[4]',0xffff00,5,9,tbl_and.4, tbl_il_4, 4
elOpt 'and[5]',0xffff00,5,11,tbl_and.5, tbl_il_5, 5
elOpt 'not', 0xffff, 3,3,tbl_not, tbl_il_1, 1
elOpt 'xor', 0x8000ff,5,5,tbl_xor, tbl_il_2, 2
elOpt 'sm[1]', 0x8080ff,7,7,tbl_sm, tbl_il_3, 1,4
@ -116,6 +119,7 @@ align 4
tbl_or db 0,1,1,1, 1,1,1,1 ;or2, or3
db 1,1,1,1,1,1,1,1 ;or4
tbl_and:
.5: dq 0,0
.4: dq 0
.3: dd 0
.2: db 0,0,0,1
@ -129,6 +133,7 @@ tbl_il_1 db 1,0 ;
tbl_il_2 db 1,2,0 ;ª®à¯ãá ­  2 ­®£¨
tbl_il_3 db 1,2,2,0
tbl_il_4 db 1,2,2,2,0
tbl_il_5 db 1,2,2,2,2,0
;tbl_il_8 db 1,2,2,2,2,2,2,2,0
time dd 0
@ -339,15 +344,18 @@ mouse:
stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2
push eax ebx ecx edx
pushad
mcall 37,2 ;­ ¦ âë¥ ª­®¯ª¨ ¬ëè¨
bt eax,0 ;«¥¢ ï ª­®¯ª  ­ ¦ â ?
jc @f
bt eax,1 ;¯à ¢ ï ª­®¯ª  ­ ¦ â ?
jc @f
xor eax,eax
mov [pen_coord_x],eax
mov [pen_coord_y],eax
jmp .end_buf_wnd
@@:
mov esi,eax
mcall 37,1 ;eax = (x shl 16) + y
cmp ax,word[buf_0.t]
@ -384,6 +392,8 @@ mouse:
cmp byte[pen_mode],0
jne .end_mode_0
bt esi,1
jc .end_mode_0
;०¨¬ ªãàá®à  (¢ë¡®à í«¥¬¥­â  ¯à¨ ­ ¦ â¨¨)
stdcall element_is_click,eax,ebx
test eax,eax
@ -445,32 +455,50 @@ mouse:
mov eax,[pen_coord_x] ;¯à¨¢ï§ª  ª ª®®à¤¨­ â¥ x
.beg_draw:
bt esi,1
jc @f
stdcall pole_cell_creat, pole,eax,ebx,0
;­¨ç¥£® ­¥ ã¡à «®áì redraw_pole ­¥ ¯®¤å®¤¨â, â. ª. ç¨áâ¨âì ¯®«¥ ­¥ ­ã¦­®
stdcall pole_paint, pole
stdcall [buf2d_draw], buf_0
;stdcall but_test_pole, pole
jmp .end_buf_wnd
@@:
stdcall pole_cell_delete, pole,eax,ebx
call redraw_pole
jmp .end_buf_wnd
.end_mode_1:
cmp byte[pen_mode],2
jne @f
;०¨¬ à¨á®¢ ­¨ï ¨§®«ï樨 ¤«ï ¯à®¢®¤ 
bt esi,1
jc .mode_2_del
stdcall pole_cell_creat, pole,eax,ebx,2
jmp .mode_2_draw
.mode_2_del:
;áâ¨à ­¨¥ ¨§®«ï樨
mov ecx,eax
stdcall pole_cell_find, pole,ecx,ebx
test eax,eax
jz .end_buf_wnd
stdcall pole_cell_creat, pole,ecx,ebx,0
.mode_2_draw:
stdcall pole_paint, pole
stdcall [buf2d_draw], buf_0
;stdcall but_test_pole, pole
jmp .end_buf_wnd
@@:
cmp byte[pen_mode],3
jne @f
bt esi,1
jc @f
;०¨¬ áâ¨à ­¨ï ¯à®¢®¤ 
stdcall pole_cell_delete, pole,eax,ebx
call redraw_pole
;stdcall but_test_pole, pole
jmp .end_buf_wnd
@@:
cmp byte[pen_mode],4
jne @f
bt esi,1
jc @f
;०¨¬ ᮧ¤ ­¨ï í«¥¬¥­â®¢
stdcall shem_element_creat, eax,ebx
stdcall pole_paint, pole
@ -479,7 +507,10 @@ mouse:
@@:
.end_buf_wnd:
pop edx ecx ebx eax
if debug
stdcall but_test_pole, pole
end if
popad
ret
;output:
@ -589,44 +620,60 @@ pushad
mov esi,[sc.work_button]
int 0x40
mov ebx,(30 shl 16)+20
add ebx,25 shl 16
mov edx,4
int 0x40
mov ebx,(55 shl 16)+20
add ebx,25 shl 16
mov edx,5
int 0x40
mov ebx,(85 shl 16)+20
mov edx,6
add ebx,30 shl 16
mov edx,6 ;¯ã᪠| ®áâ ­®¢ª 
int 0x40
mov ebx,(110 shl 16)+20
add ebx,25 shl 16
mov edx,7
int 0x40
mov ebx,(135 shl 16)+20
add ebx,25 shl 16
mov edx,8
int 0x40
mov ebx,(160 shl 16)+20
add ebx,25 shl 16
mov edx,9
int 0x40
mov ebx,(185 shl 16)+20
add ebx,25 shl 16
mov edx,10
int 0x40
mov ebx,(210 shl 16)+20
add ebx,25 shl 16
mov edx,11
int 0x40
mov ebx,(235 shl 16)+20
add ebx,25 shl 16
mov edx,12
int 0x40
mov ebx,(265 shl 16)+20
mov edx,13
add ebx,30 shl 16
mov edx,13 ;業â஢ª  á奬ë
int 0x40
add ebx,25 shl 16
mov edx,14
int 0x40
add ebx,25 shl 16
mov edx,15
int 0x40
add ebx,25 shl 16
mov edx,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
int 0x40
add ebx,25 shl 16
mov edx,17 ;ᤢ¨£ áå¥¬ë ¢­¨§
int 0x40
; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
@ -846,6 +893,32 @@ button:
jne @f
call but_center
@@:
;¯¥à¥¤¢¨¦¥­¨¥ ¢á¥å ®¡ê¥ªâ®¢ á奬ë
cmp byte[tim_ch],0
jne .no_move
cmp ah,14
jne @f
stdcall pole_move_all, pole, -1, 0
call redraw_pole
@@:
cmp ah,15
jne @f
stdcall pole_move_all, pole, 1, 0
call redraw_pole
@@:
cmp ah,16 ;ᤢ¨£ áå¥¬ë ¢¢¥àå
jne @f
stdcall pole_move_all, pole, 0, -1
call redraw_pole
@@:
cmp ah,17 ;ᤢ¨£ áå¥¬ë ¢­¨§
jne @f
stdcall pole_move_all, pole, 0, 1
call redraw_pole
@@:
.no_move:
cmp ah,20
jne @f
call but_set_0
@ -1275,6 +1348,7 @@ align 4
proc but_save_file
locals
napr dd ?
s_param dd ? ;¯ à ¬¥âà ¤«ï ªà á¨¢®£® á®åà ­¥­¨ï
endl
pushad
;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
@ -1549,6 +1623,7 @@ pushad
mov edi,eax
mov ecx,dword[esi]
mov dword[s_param],0
.cycle4: ;横« ¯® ¢á¥¬ â®çª ¬
add esi,4
mov ebx,[esi]
@ -1574,12 +1649,22 @@ pushad
add edi,eax
movzx eax,dh
stdcall convert_int_to_str
cmp dword[s_param],7 ;¤«ï ä®à¬ â  áâப¨
je .new_line
inc dword[s_param]
stdcall str_cat,edi,txt_space
;stdcall str_cat,edi,txt_nl
jmp @f
.new_line:
mov dword[s_param],0
stdcall str_cat,edi,txt_nl
@@:
dec ecx
jnz .cycle4
cmp dword[s_param],0
je @f
stdcall str_cat,edi,txt_nl
@@:
;*** á®åà ­¥­¨¥ ¨§®«ï樮­­ëå â®ç¥ª ***
stdcall str_cat,edi,txt_sub_points