1) changes in 'TreeList':

- fix 'tl_iterat_perv'
- small fix 'tl_mouse'
- update 'tl_node_lev_inc'
- optimization 'tl_node_lev_dec'
2) add new programm 'PlanetV'

git-svn-id: svn://kolibrios.org@1401 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2010-02-09 14:54:59 +00:00
parent 1ddcc97e9d
commit e1a0b0c660
13 changed files with 2379 additions and 40 deletions

View File

@ -1,6 +1,6 @@
; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj ; ìàêðîñ äëÿ ñèñòåìíîé áèáëèîòåêè box_lib.obj
; ýëåìåíò TreeList äëÿ Kolibri OS ; ýëåìåíò TreeList äëÿ Kolibri OS
; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 05.02.2010 IgorA ; ôàéë ïîñëåäíèé ðàç èçìåíÿëñÿ 09.02.2010 IgorA
; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ ; íà êîä ïðèìåíåíà GPL2 ëèöåíçèÿ
@ -16,8 +16,10 @@ sizeof.TreeList equ 20
;ends ;ends
tl_info_size equ word[edi +4] ;ðàçìåð äàííûõ âûäåëÿåìûõ äëÿ êàæäîãî óçëà (ïîëüçîâàòåëüñüêèå äàííûå + òåêñò äëÿ ïîäïèñè) tl_info_size equ word[edi +4] ;ðàçìåð äàííûõ âûäåëÿåìûõ äëÿ êàæäîãî óçëà (ïîëüçîâàòåëüñüêèå äàííûå + òåêñò äëÿ ïîäïèñè)
tl_info_max_count equ dword[edi+6] ;ìàêñèìàëüíîå êîëè÷åñòâî óçëîâ, êîòîðûå ìîæíî äîáàâèòü â ýëåìåíò
tl_style equ dword[edi+10] ;ñòèëè ýëåìåíòà tl_style equ dword[edi+10] ;ñòèëè ýëåìåíòà
tl_data_nodes equ dword[edi+14] ;óêàçàòåëü íà ñòðóêòóðû óçëîâ tl_data_nodes equ dword[edi+14] ;óêàçàòåëü íà ñòðóêòóðû óçëîâ
tl_data_img equ dword[edi+18] ;óêàçàòåëü íà èçîáðàæåíèÿ ñ èêîíêàìè óçëîâ
tl_img_cx equ word[edi+22] ;øèðèíà èêîíîê tl_img_cx equ word[edi+22] ;øèðèíà èêîíîê
tl_img_cy equ word[edi+24] ;âûñîòà èêîíîê tl_img_cy equ word[edi+24] ;âûñîòà èêîíîê
tl_data_img_sys equ dword[edi+26] ;óêàçàòåëü íà ñèñòåìíûå èçîáðàæåíèÿ (ñòðåëêè, ïëþñèêè) tl_data_img_sys equ dword[edi+26] ;óêàçàòåëü íà ñèñòåìíûå èçîáðàæåíèÿ (ñòðåëêè, ïëþñèêè)
@ -51,8 +53,6 @@ tl_load_mode_add equ 0x20000 ;
tl_save_load_heder_size equ 26 ;ðàçìåð çàãîëîâêà äëÿ çàïèñè/÷òåíèÿ ýëåìåíòîâ tl_save_load_heder_size equ 26 ;ðàçìåð çàãîëîâêà äëÿ çàïèñè/÷òåíèÿ ýëåìåíòîâ
;data_info dd ? ;+ 0 óêàçàòåëü íà îñíîâíûå äàíûå ;data_info dd ? ;+ 0 óêàçàòåëü íà îñíîâíûå äàíûå
;info_max_count dd ? ;+ 6 ìàêñèìàëüíîå êîëëè÷åñòâî ñòðóêòóð
;data_img dd ? ;+18 óêàçàòåëü íà èçîáðàæåíèÿ
;ls_tim dd ? ;+34 âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ ;ls_tim dd ? ;+34 âðåìÿ ïîñëåäíåãî ñîõðàíåíèÿ
;on_activate dd ? ;+92 óêàçàòåëü íà ôóíêöèþ ïðè àêòèâèðîâàíèè óçëà ;on_activate dd ? ;+92 óêàçàòåëü íà ôóíêöèþ ïðè àêòèâèðîâàíèè óçëà
@ -133,7 +133,7 @@ tl_data_init: ;
imul ecx,dword[edi+6] imul ecx,dword[edi+6]
call mem_Alloc call mem_Alloc
mov dword[edi],eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó mov dword[edi],eax ;êîïèðóåì óêàçàòåëü íà ïîëó÷åíóþ ïàìÿòü â ñòðóêòóðó
mov dword[edi+18],0 ;îáíóëÿåì óêàçàòåëü 'data_img' mov tl_data_img,0 ;îáíóëÿåì óêàçàòåëü 'data_img'
mov tl_data_img_sys,0 ;îáíóëÿåì óêàçàòåëü 'data_img_sys' mov tl_data_img_sys,0 ;îáíóëÿåì óêàçàòåëü 'data_img_sys'
mov ecx,sizeof.TreeList mov ecx,sizeof.TreeList
@ -174,7 +174,7 @@ tl_data_clear: ;
mov ebp,esp mov ebp,esp
push ecx edi push ecx edi
mov edi,dword[ebp+8] mov edi,dword[ebp+8]
cmp dword[edi+18],0 ;data_img cmp tl_data_img,0
je @f je @f
mov ecx,dword[edi+18] mov ecx,dword[edi+18]
call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê call mem_Free ;÷èñòêà ñèñòåìíûõ èêîíîê
@ -327,7 +327,7 @@ tl_mouse: ;
mov ebx,tl_box_left mov ebx,tl_box_left
shl ebx,16 shl ebx,16
cmp eax,ebx ;ëåâàÿ ãðàíèöà îêíà cmp eax,ebx ;ëåâàÿ ãðàíèöà îêíà
jl .test_scroll jl .no_in_wnd ;.test_scroll
mov ebx,tl_box_left mov ebx,tl_box_left
add ebx,tl_box_width add ebx,tl_box_width
@ -573,7 +573,7 @@ align 4
tl_draw: ;âûâîä ñïèñêà íà ýêðàí tl_draw: ;âûâîä ñïèñêà íà ýêðàí
push ebp push ebp
mov ebp,esp mov ebp,esp
push eax ebx ecx edx edi esi pushad
;draw dir_list main rect ;draw dir_list main rect
mov edi,dword[ebp+8] mov edi,dword[ebp+8]
mov ebx,tl_box_left mov ebx,tl_box_left
@ -670,7 +670,7 @@ tl_draw: ;
call scroll_bar_vertical.draw call scroll_bar_vertical.draw
.end_draw: .end_draw:
pop esi edi edx ecx ebx eax popad
pop ebp pop ebp
ret 4 ret 4
@ -755,13 +755,9 @@ tl_iterat_next_all:
align 4 align 4
tl_iterat_perv: tl_iterat_perv:
push eax push eax
; mov bl,byte[edx+2]
cmp tl_tim_undo,0 cmp tl_tim_undo,0
je .beg1 je .beg1
push eax
.beg0: .beg0:
call tl_move_perv call tl_move_perv
cmp edx,ecx cmp edx,ecx
@ -1028,7 +1024,7 @@ tl_get_display_cur_pos: ;
;input: ;input:
; eax = node position ; eax = node position
; edx = pointer to some node struct ; edx = pointer to some node struct
; edi = pointer to TreeInfo struct ; edi = pointer to 'TreeList' struct
; esi = coord of bottom border ; esi = coord of bottom border
align 4 align 4
tl_draw_node: tl_draw_node:
@ -1067,7 +1063,7 @@ tl_draw_node:
.crop: .crop:
mov esi,ecx ;save ecx mov esi,ecx ;save ecx
cmp dword[edi+18],0 ;data_img cmp tl_data_img,0
jne .draw_img_n jne .draw_img_n
push edx push edx
mov edx,tl_col_txt mov edx,tl_col_txt
@ -1088,7 +1084,7 @@ tl_draw_node:
imul bx,tl_img_cx imul bx,tl_img_cx
imul bx,tl_img_cy imul bx,tl_img_cy
imul ebx,esi ;esi = icon index imul ebx,esi ;esi = icon index
add ebx,dword[edi+18] ;data_img add ebx,tl_data_img
mov eax,7 mov eax,7
int 0x40 ;draw node icon '-' int 0x40 ;draw node icon '-'
@ -1116,6 +1112,7 @@ tl_draw_node:
;input: ;input:
; ecx = pointer to 1 node struct ; ecx = pointer to 1 node struct
; edx = pointer to some node struct
;... ;...
align 4 align 4
tl_draw_node_icon_opn_clo: ;ðèñóåò èêîíêè îòêðûòîãî èëè çàêðûòîãî óçëà (îáû÷íî + èëè -) tl_draw_node_icon_opn_clo: ;ðèñóåò èêîíêè îòêðûòîãî èëè çàêðûòîãî óçëà (îáû÷íî + èëè -)
@ -1158,6 +1155,8 @@ tl_draw_node_icon_opn_clo: ;
;input: ;input:
; al = óðîâåíü ýëåìåíòà ; al = óðîâåíü ýëåìåíòà
; ecx = pointer to 1 node struct
; edx = pointer to some node struct
;... ;...
align 4 align 4
tl_draw_node_icon_par_lin: tl_draw_node_icon_par_lin:
@ -1213,30 +1212,32 @@ tl_draw_node_icon_par_lin:
ret ret
;input:
;icon:
; al = óðîâåíü ýëåìåíòà ; al = óðîâåíü ýëåìåíòà
;... ; ecx = pointer to 1 node struct
; edx = pointer to some node struct
; edi = pointer to 'TreeList' struct
align 4 align 4
tl_draw_node_icon_par_lin_up: tl_draw_node_icon_par_lin_up:
push eax ebx ecx edx esi push eax ebx ecx edx
push esi
cmp tl_data_img_sys,0 ;if not image cmp tl_data_img_sys,0 ;if not image
je @f je @f
cmp al,0 cmp al,0
je @f je @f
;---------
xor esi,esi ;â si áóäåì íàñ÷èòûâàòü êîë-âî èêîíîê, íóæíûõ äëÿ ïðîðèñîâêè ëèíèè xor esi,esi ;â si áóäåì íàñ÷èòûâàòü êîë-âî èêîíîê, íóæíûõ äëÿ ïðîðèñîâêè ëèíèè
;--- öèêë äëÿ âû÷èñëåíèÿ êîëëè÷åñòâà âåðòèêàëüíûõ ëèíèé ---
.cycle0: .cycle0:
call tl_iterat_perv ;get perv visible item call tl_iterat_perv ;get perv visible item
cmp edx,ecx cmp edx,ecx
jle .cycle1 ;if begin of list jle .cycle1 ;if begin of list
cmp byte[edx+2],al cmp byte[edx+2],al
jle .cycle1 ;óðîâåíü âåðõíåãî ýëåìåíòà íå òðåáóåò ïðîðèñîâêè jle .cycle0end ;óðîâåíü âåðõíåãî ýëåìåíòà íå òðåáóåò ïðîðèñîâêè
inc si inc si
jmp .cycle0 jmp .cycle0
.cycle1: .cycle0end:
cmp si,0 ;si = êîë-âî èêîíîê ëèíèè êîòîðûå íóæíî íàðèñîâàòü ñâåðõó cmp si,0 ;si = êîë-âî èêîíîê ëèíèè êîòîðûå íóæíî íàðèñîâàòü ñâåðõó
je @f je @f
shl esi,16 shl esi,16
@ -1257,25 +1258,24 @@ tl_draw_node_icon_par_lin_up:
mov ebx,3 ;rgb = 3 bytes mov ebx,3 ;rgb = 3 bytes
imul bx,tl_img_cx imul bx,tl_img_cx
imul bx,tl_img_cy imul bx,tl_img_cy
;imul ebx,1
add ebx,tl_data_img_sys add ebx,tl_data_img_sys
add esi,tl_box_top add esi,tl_box_top
add si,tl_capt_cy ;si = âåðõíÿÿ ãðàíèöà îêíà add si,tl_capt_cy ;si = âåðõíÿÿ ãðàíèöà îêíà
mov eax,7 mov eax,7
;--------- ;--- öèêë äëÿ ðèñîâàíèÿ âåðòèêàëüíîé ëèíèè ---
.cycle2: .cycle1:
sub dx,tl_img_cy ;ïîäíèìàåì êîîðäèíàòó y ââåðõ sub dx,tl_img_cy ;ïîäíèìàåì êîîðäèíàòó y ââåðõ
cmp dx,si cmp dx,si
jl @f jl @f
; int 0x40 ;draw line icon
cmp esi,0x10000 cmp esi,0x10000
jl @f jl @f
int 0x40 ;draw line icon int 0x40 ;draw line icon
sub esi,0x10000 ;óìåíüøàåì ñ÷åò÷èê èêîíîê sub esi,0x10000 ;óìåíüøàåì ñ÷åò÷èê èêîíîê
jmp .cycle2 jmp .cycle1
@@: @@:
pop esi edx ecx ebx eax pop esi
pop edx ecx ebx eax
ret ret
;input: ;input:
@ -1470,7 +1470,7 @@ tl_node_add: ;
pop dword [edx+8] pop dword [edx+8]
call tl_get_node_index ;*** eax = i *** call tl_get_node_index ;*** eax = i ***
cmp eax,dword[edi+6] ;info_max_count cmp eax,tl_info_max_count
jge .u0 jge .u0
mov [ecx],eax ;node[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì mov [ecx],eax ;node[po_t].next=i; // ññûëêè ïåðåíàïðàâëÿåì
@ -2008,19 +2008,26 @@ align 4
tl_node_lev_inc: ;óâåëè÷èòü óðîâåíü tl_node_lev_inc: ;óâåëè÷èòü óðîâåíü
push ebp push ebp
mov ebp,esp mov ebp,esp
push eax edx edi push eax ecx edx edi
mov edi,dword[ebp+8] mov edi,dword[ebp+8]
bt tl_style,2 ;tl_list_box_mode bt tl_style,2 ;tl_list_box_mode
jc @f jc @f
call tl_get_cur_node_index ;eax=po_t call tl_get_cur_node_index ;eax=po_t
cmp eax,2 cmp eax,2
jl @f jl @f
mov ecx,tl_data_nodes
imul eax,sizeof.TreeList imul eax,sizeof.TreeList
add eax,tl_data_nodes add eax,ecx ;eax = pointer to some node struct
add ecx,sizeof.TreeList ;ecx = pointer to 1 node struct
mov edx,eax mov edx,eax
inc word[edx+2] call tl_iterat_perv ;ïðîâåðÿåì åñòü ëè âåðõíèé óçåë
cmp edx,ecx
jle @f ;åñëè âåðõíåãî óçëà íå òî òåêóùèé óçåë íå äâèãàåì
inc word[eax+2]
@@: @@:
pop edi edx eax pop edi edx ecx eax
pop ebp pop ebp
ret 4 ret 4
@ -2028,19 +2035,18 @@ align 4
tl_node_lev_dec: ;óìåíüøèòü óðîâåíü tl_node_lev_dec: ;óìåíüøèòü óðîâåíü
push ebp push ebp
mov ebp,esp mov ebp,esp
push eax edx edi push eax edi
mov edi,dword[ebp+8] mov edi,dword[ebp+8]
call tl_get_cur_node_index ;eax=po_t call tl_get_cur_node_index ;eax=po_t
cmp eax,2 cmp eax,2
jl @f jl @f
imul eax,sizeof.TreeList imul eax,sizeof.TreeList
add eax,tl_data_nodes add eax,tl_data_nodes
mov edx,eax cmp word[eax+2],0
cmp word[edx+2],0
je @f je @f
dec word[edx+2] dec word[eax+2]
@@: @@:
pop edi edx eax pop edi eax
pop ebp pop ebp
ret 4 ret 4
@ -2464,8 +2470,6 @@ txt_capt_otm db '
;input: ;input:
; eax = value ; eax = value
; edi = string buffer ; edi = string buffer
;output:
; edi =
align 4 align 4
tl_convert_to_str: tl_convert_to_str:
pushad pushad

View File

@ -0,0 +1,10 @@
if not exist bin mkdir bin
if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png
if not exist bin\tl_nod_16.bmp @copy tl_nod_16.bmp bin\tl_nod_16.bmp
if not exist bin\planet_v.ini @copy planet_v.ini bin\planet_v.ini
if not exist bin\pl_metki.lst @copy pl_metki.lst bin\pl_metki.lst
if not exist bin\str.obj @copy str.obj bin\str.obj
@fasm.exe -m 16384 planet_v.asm bin\planet_v.kex
@kpack bin\planet_v.kex
pause

View File

@ -0,0 +1,99 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -0,0 +1,48 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

View File

@ -0,0 +1,175 @@
align 4
boxlib_import:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
; version_ed dd aVersion_ed
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
; version_ch dd aVersion_ch
; option_box_draw dd aOption_box_draw
; option_box_mouse dd aOption_box_mouse
; version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw
; scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw
; scrollbar_hor_mouse dd aScrollbar_hor_mouse
; version_scrollbar dd aVersion_scrollbar
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_save_mem dd sz_tl_save_mem
tl_load_mem dd sz_tl_load_mem
tl_get_mem_size dd sz_tl_get_mem_size
dd 0,0
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
; aVersion_ed db 'version_ed',0
aCheck_box_draw db 'check_box_draw',0
aCheck_box_mouse db 'check_box_mouse',0
; aVersion_ch db 'version_ch',0
; aOption_box_draw db 'option_box_draw',0
; aOption_box_mouse db 'option_box_mouse',0
; aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0
; aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0
; aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
; aVersion_scrollbar db 'version_scrollbar',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_save_mem db 'tl_save_mem',0
sz_tl_load_mem db 'tl_load_mem',0
sz_tl_get_mem_size db 'tl_get_mem_size',0
align 4
libini_import:
lib_init_ini dd alib_init0
ini_get_str dd aini_get_str
dd 0,0
alib_init0 db 'lib_init',0
aini_get_str db 'ini_get_str',0
align 4
libimg_import:
lib_init dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;îïðåäåëÿåò ïî äàííûì, ìîæåò ëè áèáëèîòåêà ñäåëàòü èç íèõ èçîáðàæåíèå
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;ïðåîáðàçîâàíèå èçîáðàæåíèÿ â äàííûå RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;àâòîìàòè÷åñêè îïðåäåëÿåò ôîðìàò ãðàôè÷åñêèõ äàííûõ
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
strlib_import:
str_copy dd astr_copy
str_cat dd astr_cat
str_catchar dd astr_catchar
str_inschar dd astr_inschar
str_lowcase dd astr_lowcase
str_upcase dd astr_upcase
str_len dd astr_len
str_cmp dd astr_cmp
str_cmpi dd astr_cmpi
str_poschar dd astr_poschar
dd 0,0
astr_copy db 'str_copy',0
astr_cat db 'str_cat',0
astr_catchar db 'str_catchar',0
; str_ins db 'str_ins',0
astr_inschar db 'str_inschar',0
; str_sub db 'str_sub',0
astr_lowcase db 'str_lowcase',0
astr_upcase db 'str_upcase',0
astr_len db 'str_len',0
astr_cmp db 'str_cmp',0
astr_cmpi db 'str_cmpi',0
; str_pos db 'str_pos',0
astr_poschar db 'str_poschar',0

Binary file not shown.

View File

@ -0,0 +1,979 @@
;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
use32
org 0x0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x1
dd start
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd 0x0
dd sys_path
include '../../proc32.inc'
include '../../macros.inc'
include 'mem.inc'
include 'dll.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/tree_list.mac'
include '../../develop/libraries/box_lib/trunk/editbox.mac'
include '../../develop/libraries/box_lib/trunk/checkbox.mac'
min_window_w equ 485 ;¬¨­¨¬ «ì­ ï è¨à¨­  ®ª­ 
min_window_h equ 325 ;¬¨­¨¬ «ì­ ï ¢ëá®â  ®ª­ 
otst_panel_left equ 265
include 'tile_fun.inc'
include 'pl_import.inc'
@use_library
struct f70
func_n dd ?
param1 dd ?
param2 dd ?
param3 dd ?
param4 dd ?
rezerv db ?
name dd ?
ends
fn_metki db 'pl_metki.lst',0
fn_icon1 db 'tl_sys_16.png',0
fn_icon2 db 'tl_nod_16.bmp',0
ini_name db 'planet_v.ini',0
ini_sec db 'Map',0
ini_k_cache db 'Cache',0
ini_def_cache db '/cache/sat',0
ini_ext db 'ext'
.number db '?'
.def db 0 ;à áè¨à¥­¨¥ ¯® 㬮«ç ­¨î
align 4
start:
load_libraries l_libs_start,load_lib_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib0
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib1
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib2
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib3
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
stdcall dll.Init,dword[lib_init]
stdcall dll.Init,dword[lib_init_ini]
copy_path ini_name,sys_path,file_name,0x0
stdcall dword[ini_get_str],file_name,ini_sec,ini_k_cache,dword[edit1.text],dword[edit1.max],ini_def_cache
stdcall [str_len],dword[edit1.text],dword[edit1.max]
mov dword[edit1.size],eax
mov dword[edit1.pos],eax
stdcall dword[tl_data_init], tree1
stdcall dword[tl_data_init], tree2
;áç¨â뢠¥¬ à áè¨à¥­¨ï ª àâ ¨§ *.ini ä ©« 
mov byte[ini_ext.number],'0'
@@: ;áç¨â뢠¥¬ ¯ à ¬¥âàë ®â ext1 ¤® ext9
inc byte[ini_ext.number]
stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
cmp byte[txt_tile_type_0],0
je @f
stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
jmp @b
@@:
mov byte[ini_ext.number],'0' ;áç¨â뢠¥¬ ¯ à ¬¥âà ®â ext0 ª®â®àë© ¡ã¤¥â ¢ë¡à ­ ¢ ᯨ᪥
stdcall dword[ini_get_str],file_name,ini_sec,ini_ext,txt_tile_type_0,dword[tree1.info_capt_len],ini_ext.def
cmp byte[txt_tile_type_0],0
jne @f
mov dword[txt_tile_type_0],'.bmp' ;¥á«¨ ¢ *.ini ä ©«¥ ­¨ç¥£® ­¥â ¤®¡ ¢«ï¥¬ à áè¨à¥­¨¥ .bmp
@@:
stdcall dword[tl_node_add], txt_tile_type_0, 0, tree1
; init bmp file
push dword RGB_TILE_SIZE+300 ;300 - § ¯ á­ë¥ ¡ ©âë á ãç¥â®¬ § £®«®¢ª  bmp ä ©« 
call mem.Alloc
mov [bmp_icon],eax
stdcall array_tile_function, tile_00,max_tiles_count,tile_init
stdcall tiles_init_grid, tile_00,max_tiles_count,max_tiles_cols
push dword TREE_ICON_SYS16_BMP_SIZE
call mem.Alloc
mov [tree_sys_icon],eax
push dword TREE_ICON_NOD16_BMP_SIZE
call mem.Alloc
mov [tree_nod_icon],eax
copy_path fn_icon1,sys_path,file_name,0x0
mov eax,70 ;load icon file
mov [run_file_70.func_n], 0
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], TREE_ICON_SYS16_BMP_SIZE
m2m [run_file_70.param4], [tree_sys_icon]
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
mov ebx,run_file_70
int 0x40
cmp ebx,0xffffffff
je @f
stdcall dword[img_decode], dword[tree_sys_icon],ebx,0
mov dword[data_icon],eax
stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_sys_icon]
stdcall dword[img_destroy], dword[data_icon]
m2m dword[tree1.data_img_sys],dword[tree_sys_icon]
m2m dword[tree2.data_img_sys],dword[tree_sys_icon]
@@:
copy_path fn_icon2,sys_path,file_name,0x0
mov eax,70 ;load icon file
mov [run_file_70.param3], TREE_ICON_NOD16_BMP_SIZE
m2m [run_file_70.param4], [tree_nod_icon]
mov ebx,run_file_70
int 0x40
cmp ebx,0xffffffff
je @f
stdcall dword[img_decode], dword[tree_nod_icon],ebx,0
mov dword[data_icon],eax
stdcall dword[img_to_rgb2], dword[data_icon],dword[tree_nod_icon]
stdcall dword[img_destroy], dword[data_icon]
m2m dword[tree1.data_img],dword[tree_nod_icon]
m2m dword[tree2.data_img],dword[tree_nod_icon]
@@:
mcall 40,0x27
mcall 48,3,sc,sizeof.system_colors
;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
edit_boxes_set_sys_color edit1,editboxes_end,sc
check_boxes_set_sys_color ch1,checkboxes_end,sc
mov byte[file_name],0
red_win:
call draw_win
call but_MetLoad
still:
mov eax,10
mcall
cmp al,0x1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz red_win
cmp al,0x2
jz key
cmp al,0x3
jz button
push dword ch2
call [check_box_mouse]
push dword ch1
call [check_box_mouse]
stdcall [edit_box_mouse], edit1
stdcall [edit_box_mouse], edit2
stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2
jmp still
key:
push eax ebx
mcall 2
stdcall [edit_box_key], edit1
stdcall [edit_box_key], edit2
push dword tree1
call [tl_key]
push dword tree2
call [tl_key]
mov ebx,dword[el_focus] ;÷òî-áû êàðòà íå äâèãàëàñü åñëè îêíà treelist â ôîêóñå
cmp ebx, dword tree1
je .end_f
cmp ebx, dword tree2
je .end_f
;÷òî-áû êàðòà íå äâèãàëàñü åñëè òåêñòîâûå ïîëÿ â ôîêóñå
test word[edit1.flags],10b ;ed_focus
jne .end_f
test word[edit2.flags],10b ;ed_focus
jne .end_f
cmp ah,179 ;Right
jne @f
call CursorMoveRight
@@:
cmp ah,176 ;Left
jne @f
cmp dword[map.coord_x],0
je @f
dec dword[map.coord_x]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢¯à ¢®, çâ®-¡ë ç áâì â ©«®¢ ᮢ¯ «¨ ¨ ¯à¨è«®áì ¬¥­ìè¥ § £à㦠âì ­®¢ëå
stdcall tiles_grid_move_right, tile_00,max_tiles_count,max_tiles_cols
call but_Refresh
@@:
cmp ah,177 ;Down
jne @f
call CursorMoveDown
@@:
cmp ah,178 ;Up
jne @f
cmp dword[map.coord_y],0
je @f
dec dword[map.coord_y]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢­¨§
stdcall tiles_grid_move_down, tile_00,max_tiles_count,max_tiles_rows
call but_Refresh
@@:
cmp ah,45 ;-
jne @f
call but_ZoomM
@@:
cmp ah,61 ;+
jne @f
call but_ZoomP
@@:
.end_f:
pop ebx eax
jmp still
align 4
draw_win:
pushad
mcall 12,1
xor eax,eax
mov ebx,20*65536+min_window_w
mov ecx,20*65536+min_window_h
mov edx,[sc.work]
or edx,0x33000000
mov edi,hed
mcall
mcall 9,procinfo,-1
cmp dword[procinfo.box.width],min_window_w ; ¯à®¢¥à塞 è¨à¨­ã ®ª­ 
jge @f
mov dword[procinfo.box.width],min_window_w ; ¥á«¨ ®ª­® ®ç¥­ì 㧪®¥, 㢥«¨ç¨¢ ¥¬ è¨à¨­ã ¤«ï ¨§¡¥¦ ­¨ï £«îª®¢
@@:
mov edi,dword[procinfo.box.width]
sub edi,min_window_w-otst_panel_left
mov dword[tree1.box_left],edi
mov dword[tree2.box_left],edi
mov eax,dword[tree2.box_left] ;¤¢¨£ ¥¬ áªà®««¨­£
add eax,dword[tree2.box_width]
mov ebx,dword[tree2.p_scrol]
mov word[ebx+2],ax
mov dword[edit2.left],edi
add dword[edit2.left],370-otst_panel_left
stdcall dword[tl_draw],dword tree1
stdcall dword[tl_draw],dword tree2
mov dword[wScrMetki.all_redraw],1
push dword wScrMetki
call [scrollbar_ver_draw]
mov eax,8 ;ª­®¯ª 
mov ebx,145*65536+20
mov ecx,5*65536+25
mov edx,6
mov esi,[sc.work_button]
int 0x40
mov ebx,100*65536+20
mov ecx,5*65536+25
mov edx,5
int 0x40
mov bx,di
shl ebx,16
mov bx,100
mov ecx,265*65536+25
mov edx,9
int 0x40
;ebx ...
mov ecx,235*65536+25
mov edx,8
int 0x40
mov bx,di
add bx,410-otst_panel_left
shl ebx,16
mov bx,55
;mov ebx,410*65536+55
mov ecx,5*65536+25
mov edx,7
int 0x40
mov bx,di
add bx,440-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,440*65536+30
mov ecx,265*65536+25
mov edx,12
int 0x40
mov bx,di
add bx,405-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,405*65536+30
mov ecx,265*65536+25
mov edx,11
int 0x40
mov bx,di
add bx,370-otst_panel_left
shl ebx,16
mov bx,30
;mov ebx,370*65536+30
mov ecx,265*65536+25
mov edx,10
int 0x40
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,152*65536+13
mov ecx,[sc.work_button_text]
or ecx,0x80000000
mov edx,txt_zoom_p
mcall
mov ebx,107*65536+13
mov edx,txt_zoom_m
int 0x40
mov bx,di
add bx,270-otst_panel_left
shl ebx,16
mov bx,243
;mov ebx,270*65536+243
mov edx,txt151
int 0x40
mov bx,di
add bx,270-otst_panel_left
shl ebx,16
mov bx,273
;mov ebx,270*65536+273
mov edx,txt152
int 0x40
mov bx,di
add bx,415-otst_panel_left
shl ebx,16
mov bx,13
;mov ebx,415*65536+13
mov edx,txt_but_refresh
int 0x40
mov bx,di
add bx,380-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,380*65536+275
mov edx,txt_met_up
int 0x40
mov bx,di
add bx,415-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,415*65536+275
mov edx,txt_met_dn
int 0x40
mov bx,di
add bx,450-otst_panel_left
shl ebx,16
mov bx,275
;mov ebx,450*65536+275
mov edx,txt_met_sh
int 0x40
mov ecx,[sc.work_text]
or ecx,0x80000000
mov ebx,175*65536+13
mov edx,txt_cache
int 0x40
mov bx,di
;add bx,450-otst_panel_left
shl ebx,16
mov bx,35
;mov ebx,265*65536+35
mov edx,txt141
int 0x40
mov bx,135
;mov ebx,265*65536+135
mov edx,txt142
int 0x40
call draw_tiles
push dword ch2
call [check_box_draw]
push dword ch1
call [check_box_draw]
stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2
mcall 12,2
popad
ret
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
err_message_found_lib0 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã box_lib.obj',0
err_message_import0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ box_lib.obj',0
err_message_found_lib1 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libimg.obj',0
err_message_import1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libimg.obj',0
err_message_found_lib2 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã str.obj',0
err_message_import2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ str.obj',0
err_message_found_lib3 db '<27>¥ 㤠«®áì ­ ©â¨ ¡¨¡«¨®â¥ªã libini.obj',0
err_message_import3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ libini.obj',0
system_dir0 db '/sys/lib/'
boxlib_name db 'box_lib.obj',0
system_dir1 db '/sys/lib/'
libimg_name db 'libimg.obj',0
system_dir2 db '/sys/lib/'
strlib_name db 'str.obj',0
system_dir3 db '/sys/lib/'
libini_name db 'libini.obj',0
;library structures
l_libs_start:
lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l, boxlib_import,err_message_import0, head_f_i
lib1 l_libs libimg_name, sys_path, file_name, system_dir1, err_message_found_lib1, head_f_l, libimg_import, err_message_import1, head_f_i
lib2 l_libs strlib_name, sys_path, file_name, system_dir2, err_message_found_lib2, head_f_l, strlib_import, err_message_import2, head_f_i
lib3 l_libs libini_name, sys_path, file_name, system_dir3, err_message_found_lib3, head_f_l, libini_import, err_message_import3, head_f_i
load_lib_end:
align 4
button:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,5
jne @f
call but_ZoomM
@@:
cmp ah,6
jne @f
call but_ZoomP
@@:
cmp ah,7
jne @f
call but_Refresh
@@:
cmp ah,9
jz but_MetSave
cmp ah,8
jz but_MetAdd
cmp ah,10
jne @f
call but_met_up
@@:
cmp ah,11
jne @f
call but_met_dn
@@:
cmp ah,12
jne @f
call fun_goto_met
@@:
cmp ah,1
jne still
.exit:
push dword[bmp_icon]
call mem.Free
stdcall array_tile_function, tile_00,max_tiles_count,tile_destroy
stdcall dword[tl_data_clear], tree1
mov dword[tree2.data_img_sys],0 ;÷èñòèì óêàçàòåëü íà ñèñòåìíûå èêîíêè,
;ò. ê. îíè áûëè óäàëåíû âåðõíåé ôóíêöèåé tl_data_clear
;ïîâòîðíûé âûçîâ tl_data_clear áåç ÷èñòêè óêàçàòåëÿ âûçâåò îøèáêó
mov dword[tree2.data_img],0 ;÷èñòèì óêàçàòåëü íà èêîíêè óçëîâ
stdcall dword[tl_data_clear], tree2
; stdcall dword[img_destroy], dword[data_icon]
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
align 4
proc img_rgb_wdiv2 data_rgb:dword, size:dword
push eax ebx ecx edx
mov eax,dword[data_rgb]
mov ecx,dword[size] ;ecx = size
imul ecx,3
@@: ;çàòåìíåíèå öâåòà ïèêñåëåé
shr byte[eax],1
and byte[eax],0x7f
inc eax
loop @b
mov eax,dword[data_rgb]
mov ecx,dword[size] ;ecx = size
shr ecx,1
@@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
mov ebx,dword[eax+3] ;êîïèðóåì öâåò ñîñåäíåãî ïèêñåëÿ
add word[eax],bx
shr ebx,16
add byte[eax+2],bl
add eax,6 ;=2*3
loop @b
mov eax,dword[data_rgb]
add eax,3
mov ebx,eax
add ebx,3
mov ecx,dword[size] ;ecx = size
shr ecx,1
dec ecx ;ëèøíèé ïèêñåëü
@@: ;ïîäæàòèå ïèêñåëåé
mov edx,dword[ebx]
mov word[eax],dx
shr edx,16
mov byte[eax+2],dl
add eax,3
add ebx,6
loop @b
pop edx ecx ebx eax
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hdiv2, data_rgb:dword, size:dword, size_w:dword
pushad
mov eax,dword[data_rgb] ;eax =
mov ecx,dword[size] ;ecx = size
imul ecx,3
@@: ;çàòåìíåíèå öâåòà ïèêñåëåé
shr byte[eax],1
and byte[eax],0x7f
inc eax
loop @b
mov eax,dword[data_rgb] ;eax =
mov edi,dword[size_w]
lea esi,[edi+edi*2] ;esi = width*3(rgb)
mov ebx,esi
add ebx,eax
mov ecx,dword[size] ;ecx = size
shr ecx,1
xor edi,edi
@@: ;ñëîæåíèå öâåòîâ ïèêñåëåé
mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
add word[eax],dx
shr edx,16
add byte[eax+2],dl
add eax,3
add ebx,3
inc edi
cmp edi,dword[size_w]
jl .old_line
add eax,esi
add ebx,esi
xor edi,edi
.old_line:
loop @b
mov eax,dword[data_rgb] ;eax =
add eax,esi ;esi = width*3(rgb)
mov ebx,esi
add ebx,eax
mov ecx,dword[size] ;ecx = size
shr ecx,1
sub ecx,dword[size_w] ;ëèøíÿÿ ñòðîêà ïèêñåëåé
xor edi,edi
@@: ;ïîäæàòèå ïèêñåëåé
mov edx,dword[ebx] ;êîïèðóåì öâåò íèæíåãî ïèêñåëÿ
mov word[eax],dx
shr edx,16
mov byte[eax+2],dl
add eax,3
add ebx,3
inc edi
cmp edi,dword[size_w]
jl .old_line_2
add ebx,esi
xor edi,edi
.old_line_2:
loop @b
popad
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
align 4
proc img_rgb_wmul2, data_rgb:dword, size:dword
push eax ebx ecx edx
;eax - source
;ebx - destination
mov ecx,dword[size] ;ecx = size
mov eax,ecx
dec eax
lea eax,[eax+eax*2] ;eax = (size-1)*3
mov ebx,eax ;ebx = size*3
add eax,dword[data_rgb] ;eax = pointer + size*3
add ebx,eax ;ebx = pointer + 2*size*3
@@:
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
mov word[ebx+3],dx
shr edx,16
mov byte[ebx+2],dl
mov byte[ebx+3+2],dl
sub eax,3
sub ebx,6
loop @b
pop edx ecx ebx eax
ret
endp
;äã­ªæ¨ï ¤«ï à áâ¢ ­¨ï ¨§®¡à ¦¥­¨ï ¯® ¢ëá®â¥ ¢ 2 à § 
;¢ 㪠§ â¥«¥ data_rgb ¯ ¬ï⨠¤®«¦­® ¡ëâì ¢ 2 à §  ¡®«ìè¥ ç¥¬ size*3
;¨­ ç¥ ¯à¨ à áâ¢ ­¨¨ ¡ã¤¥â ®è¨¡ª , ¢ë室  ­  çã¦ãî ¯ ¬ïâì
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hmul2, data_rgb:dword, size:dword, size_w:dword
pushad
mov esi,dword[size_w]
lea esi,[esi+esi*2] ;esi = width * 3(rgb)
mov eax,dword[size]
lea eax,[eax+eax*2]
mov edi,eax
shl edi,1
add eax,dword[data_rgb] ;eax = pointer to end pixel (old image) + 1
add edi,dword[data_rgb] ;edi = pointer to end pixel (new image) + 1
mov ebx,edi
sub ebx,esi
.beg_line:
mov ecx,dword[size_w]
@@:
sub eax,3
sub ebx,3
sub edi,3
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
mov word[edi],dx
shr edx,16
mov byte[ebx+2],dl
mov byte[edi+2],dl
loop @b
sub ebx,esi
sub edi,esi
cmp eax,dword[data_rgb]
jg .beg_line
popad
ret
endp
;input:
;data_rgb - pointer to rgb data
;size - count img pixels (size img data / 3(rgb) )
;size_w - width img in pixels
align 4
proc img_rgb_hoffs, data_rgb:dword, size:dword, size_w:dword, hoffs:dword
push eax ebx ecx edx esi
mov esi,dword[size_w]
lea esi,[esi+esi*2] ;esi = width * 3(rgb)
imul esi,dword[hoffs]
mov eax,dword[size]
lea eax,[eax+eax*2]
add eax,dword[data_rgb] ;eax = pointer to end pixel + 1
sub eax,3
mov ebx,eax
add ebx,esi
mov ecx,dword[size]
dec ecx
@@:
mov edx,dword[eax] ;edx = pixel color
mov word[ebx],dx
shr edx,16
mov byte[ebx+2],dl
sub eax,3
sub ebx,3
loop @b
pop esi edx ecx ebx eax
ret
endp
;input:
;data_rgb - pointer to rgb data
;size_w_old - width img in pixels
;size_w_new - new width img in pixels
;size_h - height img in pixels
align 4
proc img_rgb_wcrop, data_rgb:dword, size_w_old:dword, size_w_new:dword, size_h:dword
pushad
mov eax, dword[size_w_old]
lea eax, dword[eax+eax*2] ;eax = width(old) * 3(rgb)
mov ebx, dword[size_w_new]
lea ebx, dword[ebx+ebx*2] ;ebx = width(new) * 3(rgb)
mov edx, dword[size_h]
;dec edx
mov edi, dword[data_rgb] ;edi - ¯®«ã砥⠤ ­­ë¥
mov esi, edi
add edi, ebx
add esi, eax
cld
@@:
dec edx ;㬥­ìè ¥¬ áç¥â稪 ®áâ ¢è¨åáï áâப ­  1
cmp edx,0
jle @f
mov ecx, ebx
rep movsb ;¯¥à¥­®á (ª®¯¨à®¢ ­¨¥) áâப¨ ¯¨ªá¥«¥©
;stdcall mem_copy,esi,edi,ebx
add esi,eax ;¯¥à¥å®¤ ­  ­®¢ãî áâà®çªã ¨§®¡à ¦¥­¨ï
sub esi,ebx
;add esi,eax
;add edi,ebx
jmp @b
@@:
popad
ret
endp
align 4
proc mem_copy, source:dword, destination:dword, len:dword
push ecx esi edi
cld
mov esi, dword[source]
mov edi, dword[destination]
mov ecx, dword[len]
rep movsb
pop edi esi ecx
ret
endp
align 4
proc mem_clear, mem:dword, len:dword
push eax ecx edi
cld
xor al,al
mov edi, dword[mem]
mov ecx, dword[len]
repne stosb
pop edi ecx eax
ret
endp
txt_met_up db 24,0
txt_met_dn db 25,0
txt_met_sh db '*',0
txt_zoom_m db '-',0
txt_zoom_p db '+',0
txt151 db '„®¡ ¢¨âì ¬¥âªã',0
txt152 db '‘®åà ­¨âì ¬¥âª¨',0
txt_but_refresh db 'Ž¡­®¢¨âì',0
txt_cache db 'Cache:',0
txt141 db '‚¨¤ ª àâë',0
txt142 db '‚ë¡®à ¬¥âª¨',0
; check_boxes
ch1 check_box 5, 5, 6, 12, 0xffffd0, 0x800000, 0, ch_text1, 12,ch_flag_en
ch2 check_box 5, 20, 6, 12, 0xffffd0, 0x800000, 0, ch_text2, 11,ch_flag_en
checkboxes_end:
ch_text1 db '¡à âì ᢥàåã'
ch_text2 db '¡à âì á­¨§ã'
edit1 edit_box 190, 215, 10, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 500, ed_buffer.1, mouse_dd, 0
edit2 edit_box 100, 370, 240, 0xd0ffff, 0xff, 0x80ff, 0, 0xa000, 30, ed_buffer.2, mouse_dd, 0
editboxes_end:
tree1 tree_list 10,10, tl_list_box_mode+tl_key_no_edit, 16,16,\
0x8080ff,0x0000ff,0xffffff, 265,45,90,85, 0,0,0,\
el_focus, 0,fun_new_map_type
tree2 tree_list 32,300, tl_draw_par_line, 16,16,\
0x8080ff,0x0000ff,0xffffff, 265,145,190,85, 0,12,0,\
el_focus, wScrMetki,fun_goto_met
align 4
wScrMetki:
.x:
.size_x dw 16 ;+0
.start_x dw 0 ;+2
.y:
.size_y dw 100 ;+4
.start_y dw 0 ;+6
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
.cur_area dd 30 ;+20
.position dd 0 ;+24
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
ed_buffer: ;òåêñò äëÿ edit
.1: rb 502
.2: rb 32
el_focus dd tree1
tree_sys_icon dd 0
tree_nod_icon dd 0
bmp_icon dd 0 ;¯ ¬ïâì ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨ï
data_icon dd 0 ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï ª à⨭ª¨ äã­ªæ¨ï¬¨ libimg
run_file_70 f70
txt_tile_path db 'tile path',0
rb 300
txt_tile_type dd txt_tile_type_0 ;óêàçàòåëü íà âûáðàííûé òèï ôàéëîâ
txt_tile_type_0 db 0
rb 10
align 4
map: ;êîîðäèíàòû êàðòû
.coord_x dd 0 ;êîîðäèíàòà x
.coord_y dd 0 ;êîîðäèíàòà y
.zoom db 1 ;ìàñøòàá
align 4
tile_00 rb size_tile_struc * max_tiles_count
;ýòîò êîä íå ìîé, îí ïðåîáðàçóåò ÷èñëî â ñòðîêó
;input:
; eax = value
; edi = string buffer
;output:
; edi =
align 4
tl_convert_to_str:
pushad
mov dword[edi+1],0;0x20202020
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 ;âåðíóòüñÿ ÷åíü èíòåðåñíûé õîä ò.ê. ïîêà â ñòåêå õðàíèòüñÿ êîë-âî âûçîâîâ òî ñòîëüêî ðàç ìû è áóäåì âûçûâàòüñÿ
hed db 'Planet viewer 09.02.10',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
mouse_dd dd 0 ;­ã¦­® ¤«ï Shift-  ¢ editbox
sys_path rb 4096
file_name:
rb 4096
i_end:
procinfo process_information
rb 1024
stacktop:
mem:

View File

@ -0,0 +1,5 @@
[Map]
Cache=/hd0/1/Planet_v/Cache/Sat
ext0=.jpg
ext1=.png
ext2=.gif

View File

@ -0,0 +1,98 @@
<html>
<head>
<title>Planet viewer</title>
<meta http-equiv="content-type" content="text/html; charset=WINDOWS-1251">
<style>
body
{
font-size: 15px;
font-family: "Bookman Old Style";
color: black;
text-align: justify;
width: 750px;
}
h1 {
color: white;
background-color: 808080;
font-size: 25px;
text-align: center;
}
h2 { color: green; font-size: 21px; }
h3 { color: green; font-size: 19px; }
h4 { color: #803f00; font-size: 17px; }
i { color: #0099cc; }
b { color: #0099cc; }
p {
text-indent: 2em;
margin-top: 3px;
margin-bottom: 2px;
margin-left: 0px;
margin-right: 0px;
}
ol, ul, dl{
margin-top: 3px;
margin-bottom: 2px;
}
</style>
</head>
<body>
<h1>Planet viewer 08.02.10</h1>
<p>Программа предназначена для просмотра карт, загружаемых с разных
картографических сервисов.</p>
<h1>Управление</h1>
<p>В текстовое поле 'Cache:' введите путь к папке с интересующими Вас картами. (Параметр Cache из *.ini файла задает путь по умолчанию)</p>
<p>В списке 'Вид карты' выберите расширения просматриваемых файлов. (Параметр ext0 из *.ini файла задает расширение по умолчанию)</p>
<p>Кнопка 'Обновить' перерисовывает окно.</p>
<p>Кнопка со знаком 'минус' уменьшает масштаб. Тоже действие на клавиатуре вызывается кнопкой '-'.</p>
<p>Кнопка со знаком 'плюс' увеличивает масштаб. Тоже действие на клавиатуре вызывается кнопкой '+'.</p>
<p>Курсорами можно двигатся по карте (на всех масштабах кроме 1-го где всего 1
картинка).</p>
<p>Кнопкой 'Добавить метку' добавляется метка, на которую можно вернутся при
необходимости.</p>
<p>При нажатии 'Del' (когда окно с метками в фокусе) выбраная метка удаляется.</p>
<p>При нажатии 'Enter' (когда окно с метками в фокусе) программа открывает карту
на выбранной метке. Так же для перехода можно нажать на кнопке со звёздочкой '*'.</p>
<p>Кнопка 'Сохранить метки' сохраняет все метки (с их структурой) в файл
'pl_metki.lst'.</p>
<p>В каждой метке сохраняется координата картинки по оси x и y, а также масштаб
z. Метки не привязаны к географическим координатам, потому на разных картах
может ити смещение просматриваемой области.</p>
<h1>Где взять карты?</h1>
<p>Карты я загружал через программу SAS.Planet ( её сайт <a href="http://sasgis.ru/sasplaneta/">http://sasgis.ru/sasplaneta/</a> ).
В этой программе есть папка 'Cache' в которую она сохраняет файлы, загружаемые из
интернета. В текстовое поле 'Cache:' нужно вводить путь к этой папке и к одной
из её подпапок.</p>
<h1>История версий:</h1>
<p><b>08.02.10</b> - Появились новые параметры для *.ini файла от ext0 до ext9, которые задают возможные расширения для карт.</p>
<p><b>29.01.10</b> - При запуске программы в текстовое поле 'Cache:' вводится путь прописанный в файле 'planet_v.ini'.
Устранен небольшой глюк при растягивании тайлов (не растягивалась 1-я строка пикселей вверху картинки, было заметно на крупных увеличениях), немного ускорено растягивание.
Изменен файл иконок tl_sys_16.bmp на tl_sys_16.png для экономии места. Перенос имен не найденых файлов, если они не влазят в строку. Устранен глюк когда за нажним краем карты рисовались верхние картинки.</p>
<p><b>25.01.10</b> - 1) Оптимизировано обращение к диску при перемещении по карте
курсорами. Загружается или строка или столбец тайлов, которые стали видны при
прокрутке, раньше грузилась вся область.
2) Растягивание верхних тайлов сделано в цикле. Это значит что теперь верхние
картинки могут быть растянуты в 32 раза (2 в 5-й степени).
3) Расчет высоты тайлов, теперь более точный (по высоте окна). Окно больше
заполняется картой чем раньше.
4) В текстовое поле 'Cache:' можно не вводить слеш вконце. (подсказал Albom)</p>
<p><b>23.01.10</b> - Исправлено несколько мелких глюков. Можно просматривать большой кусок карты,
т. к. сделаны функции для работы с массивом тайлов.</p>
<p><b>21.01.10</b> - Работает опция 'брать сверху' (верхняя картинка растягивается в 2 раза).
Цвета кнопок заменены на системные. В окно программы добавлена цифра текущего масштаба.</p>
<p><b>16.01.10</b> - Устранен глюк при формировании имен файлов на крупных масштабах.
Добавлена работа с метками. Полностью работает опция 'брать снизу'.</p>
<p><b>14.01.10</b> - Выход программы</p>
<h1>Авторы:</h1>
<ul>
<li><b>IgorA</b> - идея создания программы,</li>
<li><b>diamond</b> - библиотека libimg.obj (загрузка *.bmp, *.jpg, *.png),</li>
<li><b>mike.dld</b> - библиотека libini.obj (работа с *.ini файлами),</li>
<li>и другие.</li>
</ul>
</body>
</html>

Binary file not shown.

View File

@ -0,0 +1,921 @@
TILE_LEN equ 256
TILE_LEN_W equ TILE_LEN
TILE_LEN_H equ TILE_LEN
RGB_TILE_SIZE_1N4 equ (TILE_LEN*TILE_LEN*3/4) ;1/4 ç áâì ¯ ¬ï⨠ª à⨭ª¨
RGB_TILE_SIZE_1N2 equ (TILE_LEN*TILE_LEN*3/2) ;1/2 ç áâì ¯ ¬ï⨠ª à⨭ª¨
RGB_TILE_SIZE equ TILE_LEN*TILE_LEN*3 ;à §¬¥à 1-© ª à⨭ª¨
TREE_ICON_SYS16_BMP_SIZE equ 256*3*11+54 ;à §¬¥à bmp ä ©«  á á¨á⥬­ë¬¨ ¨ª®­ª ¬¨
TREE_ICON_NOD16_BMP_SIZE equ 256*3* 1+54
TILE_TEXT_MAX_LEN equ 40 ;¬ ªá¨¬ «ì­ ï ¤«¨­­  ⥪áâ  ¤«ï ¢ë¢®¤  ¨¬¥­¨ ä ©« 
FRACT_TILE_00 equ 1 ;¤à®¡­ë© ä ©«, 1/4 - ¢¥àå­¨© «¥¢ë© 㣮«
FRACT_TILE_01 equ 2 ;¤à®¡­ë© ä ©«, 1/4 - ­¨¦­¨© «¥¢ë© 㣮«
FRACT_TILE_10 equ 4 ;¤à®¡­ë© ä ©«, 1/4 - ¢¥àå­¨© ¯à ¢ë© 㣮«
FRACT_TILE_11 equ 8 ;¤à®¡­ë© ä ©«, 1/4 - ­¨¦­¨© ¯à ¢ë© 㣮«
FRACT_TILE_ALL equ 15 ;15=1+2+4+8
FRACT_TILE_BIT00 equ 0
FRACT_TILE_BIT01 equ 1
FRACT_TILE_BIT10 equ 2
FRACT_TILE_BIT11 equ 3
;ä« £¨, ­ã¦­ë¥ ¯à¨ à áâ¢ ­¨¨:
SCALE_0BIT_USE equ 8
SCALE_1BIT_USE equ 9
SCALE_0_USE equ 0x100 ;ä« £ ®âªàëâ¨ï ª à⨭ª¨ ⥪ã饣® ã஢­ï
SCALE_1_USE equ 0x200 ;ä« £ ®âªàëâ¨ï ª à⨭ª¨ ¢ëá襣® ã஢­ï (¡ã¤¥â à áâ¢ âáï ¢ ¯à®¯à¨á®¢ª¥)
met_fr_opn db 0 ;ä« £ ®âªàëâ¨ï ä ©«  á ¬¥âª ¬¨
size_tile_struc equ 32 ;à §¬¥à áâàãªâãàë â ©« 
max_tiles_cols equ 4 ;¬ ªá¨¬ «ì­®¥ ç¨á«® â ©«®¢ ¯® è¨à¨­¥ ®ª­ 
max_tiles_rows equ 3 ;¬ ªá¨¬ «ì­®¥ ç¨á«® â ©«®¢ ¯® ¢ëá®â¥ ®ª­ 
max_tiles_count equ (max_tiles_cols*max_tiles_rows) ;¬ ªá¨¬ «ì­®¥ ç¨á«® â ©«®¢ ¢ ¯à®£à ¬¬¥
tile_coord_x equ dword[edi] ;ª®®à¤¨­ â  x (ª ª ¯ à ¬¥âà ¤«ï § £à㧪¨)
tile_coord_y equ dword[edi+ 4] ;ª®®à¤¨­ â  y (ª ª ¯ à ¬¥âà ¤«ï § £à㧪¨)
tile_zoom equ byte[edi+ 8] ;¬ áèâ ¡ § £à㦠¥¬®£® â ©« 
tile_err_f equ byte[edi+ 9] ;ª®¤ ®è¨¡ª¨ ¯à¨ ®âªàë⨨ ¨§®¡à ¦¥­¨ï
tile_drobn equ word[edi+10] ;¯®«¥ ¤«ï á®åà ­¥­¨ï १ã«ìâ â®¢ ®âªàëâ¨ï ¤à®¡­ëå ª à⨭®ª
tile_offs_l_load equ 12 ;offset params last load tile
tile_key_coord_x equ dword[edi+12] ;ª®®à¤¨­ â  x (ª ª ª«îç ¯®á«¥¤­¥© § £à㧪¨)
tile_key_coord_y equ dword[edi+16] ;ª®®à¤¨­ â  y (ª ª ª«îç ¯®á«¥¤­¥© § £à㧪¨)
tile_key_path_len equ byte[edi+21] ;¤«¨­­  ⥪áâ  ¢ ¯®«¥ Cache
tile_rgb_icon equ dword[edi+22] ;㪠§ â¥«ì ­  ¡ãä¥à ¤«ï åà ­¥­¨ï ®á­®¢­®© ¨«¨ à áâï­ã⮩ ª à⨭ª¨
tile_drobn_icon equ dword[edi+26] ;㪠§ â¥«ì ­  ¡ãä¥à ¤«ï åà ­¥­¨ï 4-å ¤à®¡­ëå ª à⨭®ª
tile_delta_x equ byte[edi+30] ;ᤢ¨£ â ©«  ®â­®á¨â¥«ì­® ªãàá®à  ¯® ®á¨ x
tile_delta_y equ byte[edi+31] ;ᤢ¨£ â ©«  ®â­®á¨â¥«ì­® ªãàá®à  ¯® ®á¨ y
;???
align 4
CursorMoveRight: ;¯¥à¥¤¢¨£ ¥¬ ª®®à¤¨­ âã ªãàá®à  ¢¯à ¢®
push ebx ecx
xor ebx,ebx
xor ecx,ecx
mov cl,byte[map.zoom]
dec ecx
cmp cx,0
jle .no_move ;¯à¨ 0-¬ ¬ áèâ ¡¥ ­¥ ¤¢¨£ ¥¬áï
@@:
rol ebx,1
or ebx,1 ;­ ª ¯«¨¢ ¥¬ ¬ ªá¨¬ «ì­ãî ª®®à¤¨­ âã, ¯à¨ ¤ ­®¬ ¬ áèâ ¡¥
loop @b
cmp dword[map.coord_x],ebx
jge .no_move ;¥á«¨ ª®®à¤¨­ â  ªà ©­ïï, ­¥ ¤¢¨£ ¥¬áï
inc dword[map.coord_x]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢«¥¢®, çâ®-¡ë ç áâì â ©«®¢ ᮢ¯ «¨ ¨ ¯à¨è«®áì ¬¥­ìè¥ § £à㦠âì ­®¢ëå
stdcall tiles_grid_move_left, tile_00,max_tiles_count,max_tiles_cols
call but_Refresh
.no_move:
pop ecx ebx
ret
;???
align 4
CursorMoveDown: ;¯¥à¥¤¢¨£ ¥¬ ª®®à¤¨­ âã ªãàá®à  ¢­¨§
push ebx ecx
xor ebx,ebx
xor ecx,ecx
mov cl,byte[map.zoom]
dec ecx
cmp cx,0
jle .no_move ;¯à¨ 0-¬ ¬ áèâ ¡¥ ­¥ ¤¢¨£ ¥¬áï
@@:
rol ebx,1
or ebx,1 ;­ ª ¯«¨¢ ¥¬ ¬ ªá¨¬ «ì­ãî ª®®à¤¨­ âã, ¯à¨ ¤ ­®¬ ¬ áèâ ¡¥
loop @b
cmp dword[map.coord_y],ebx
jge .no_move ;¥á«¨ ª®®à¤¨­ â  ªà ©­ïï, ­¥ ¤¢¨£ ¥¬áï
inc dword[map.coord_y]
;ᤢ¨£ ¥¬ á¥âªã â ©«®¢ ¢¢¥àå
stdcall tiles_grid_move_up, tile_00,max_tiles_count,max_tiles_rows
call but_Refresh
.no_move:
pop ecx ebx
ret
;???
align 4
but_met_up: ;¯¥à¥¬¥é¥­¨¥ ¬¥âª¨ ¢¢¥àå, ¯® ᯨáªã
stdcall dword[tl_node_move_up], tree2
ret
;???
align 4
but_met_dn: ;¯¥à¥¬¥é¥­¨¥ ¬¥âª¨ ¢­¨§, ¯® ᯨáªã
stdcall dword[tl_node_move_down], tree2
ret
;???
align 4
fun_new_map_type: ;¬¥­ï¥¬ à áè¨à¥­¨¥ ¤«ï ª àâë
push eax
stdcall dword[tl_node_get_data], tree1
pop eax
cmp eax,0
je @f
mov dword[txt_tile_type],eax
@@:
pop eax
ret
;§ ¤ ¥¬ à á¯®«®¦¥­¨¥ â ©«®¢ ¯® á¥âª¥
align 4
proc tiles_init_grid, beg_tiles:dword, count:dword, cols:dword
push eax ebx ecx edx edi
xor eax,eax
xor ebx,ebx
mov edi,[beg_tiles]
mov ecx,[count]
mov edx,[cols]
@@:
mov tile_delta_x,al
mov tile_delta_y,bl
add edi,size_tile_struc
inc ax
cmp eax,edx
jl .old_lin
xor eax,eax
inc bx
.old_lin:
loop @b
pop edi edx ecx ebx eax
ret
endp
;ᤢ¨£ ¥¬ á¥âªã ¢«¥¢®, ¢ë«¥§è¨¥ á⮫¡æë ¡ã¤ãâ ¯¥à¥ª¨­ãâë ­  ¯à ¢ãî áâ®à®­ã
;äã­ªæ¨ï ­ã¦­  ¤«ï ®¯â¨¬¨§ æ¨¨ ®¡à é¥­¨ï ª ¤¨áªã, ¯à¨ ¤¢¨¦¥­¨¨ ªãàá®à  ¬ë ¤¢¨£ ¥¬
;â ©«ë ¢ ¯à®â¨¢®¯®«®¦­ãî áâ®à®­ã, ¢ १ã«ìâ â¥ ª®®à¤¨­ âë ¡®«ì設á⢠ â ©«®¢ ­¥ ¬¥­ïîâáï
;  §­ ç¨â ¯à®£à ¬¬  ­¥ ¡ã¤¥â ¯¥à¥ç¨â뢠âì ¨å § ­®¢®, 祬 ¨ ¤®á⨣ ¥âáï ®¯â¨¬¨§ æ¨ï
align 4
proc tiles_grid_move_left, beg_tiles:dword, count:dword, cols:dword
push eax ebx ecx edx edi
xor eax,eax
xor ebx,ebx
mov edi,[beg_tiles]
mov ecx,[count]
mov edx,[cols]
@@:
cmp tile_delta_x,0
jne .no_jump
add tile_delta_x,dl ;¥á«¨ á⮫¡¥æ = 0, â® ¤®¡ ¢«ï¥¬ 'cols' çâ®-¡ë ­¥ ¢ë« §¨« ¢«¥¢®
.no_jump:
dec tile_delta_x
add edi,size_tile_struc
loop @b
pop edi edx ecx ebx eax
ret
endp
;ᤢ¨£ ¥¬ á¥âªã ¢¯à ¢®, ¢ë«¥§è¨¥ á⮫¡æë ¡ã¤ãâ ¯¥à¥ª¨­ãâë ­  «¥¢ãî áâ®à®­ã
;¤¥« ¥â ⮦¥ çâ® ¨ tiles_grid_move_left ⮫쪮 ¤¢¨£ ¥â ª®®à¤¨­ âë ¢ ¤àã£ãî áâ®à®­ã
align 4
proc tiles_grid_move_right, beg_tiles:dword, count:dword, cols:dword
push eax ebx ecx edx edi
xor eax,eax
xor ebx,ebx
mov edi,[beg_tiles]
mov ecx,[count]
mov edx,[cols]
@@:
inc tile_delta_x
cmp tile_delta_x,dl
jl .no_jump
mov tile_delta_x,0 ;¥á«¨ á⮫¡¥æ = 'cols', â® áâ ¢¨¬ ¥¬ã 0 çâ®-¡ë ­¥ ¢ë« §¨« ¢¯à ¢®
.no_jump:
add edi,size_tile_struc
loop @b
pop edi edx ecx ebx eax
ret
endp
align 4
proc tiles_grid_move_up, beg_tiles:dword, count:dword, rows:dword
push eax ebx ecx edx edi
xor eax,eax
xor ebx,ebx
mov edi,[beg_tiles]
mov ecx,[count]
mov edx,[rows]
@@:
cmp tile_delta_y,0
jne .no_jump
add tile_delta_y,dl ;¥á«¨ áâப  = 0, â® ¤®¡ ¢«ï¥¬ 'rows' çâ®-¡ë ­¥ ¢ë« §¨«  ¢­¨§
.no_jump:
dec tile_delta_y
add edi,size_tile_struc
loop @b
pop edi edx ecx ebx eax
ret
endp
align 4
proc tiles_grid_move_down, beg_tiles:dword, count:dword, rows:dword
push eax ebx ecx edx edi
xor eax,eax
xor ebx,ebx
mov edi,[beg_tiles]
mov ecx,[count]
mov edx,[rows]
@@:
inc tile_delta_y
cmp tile_delta_y,dl
jl .no_jump
mov tile_delta_y,0 ;¥á«¨ áâப  = 'rows', â® áâ ¢¨¬ ¥© 0 çâ®-¡ë ­¥ ¢ë« §¨«  ¢¢¥àå
.no_jump:
add edi,size_tile_struc
loop @b
pop edi edx ecx ebx eax
ret
endp
align 4
proc array_tile_function, beg_tiles:dword, count:dword, funct:dword
push ecx edi
mov edi,[beg_tiles]
mov ecx,[count]
@@:
stdcall [funct],edi
add edi,size_tile_struc
loop @b
pop edi ecx
ret
endp
align 4
draw_tiles:
pushad
mov eax,47
mov ebx,0x20000
xor ecx,ecx
mov cl,byte[map.zoom]
mov edx,128*65536+13
mov esi,[sc.work_text]
or esi,0x40000000
mov edi,[sc.work]
int 0x40
stdcall array_tile_function, tile_00,max_tiles_count,draw_tile
popad
ret
; edi - pointer tile struct
;output:
; eax - 7
; edx - coordinates to tile draw
align 4
proc tile_clear_area, height:dword
pushad
mov eax,13 ;draw rect
mov cx,dx
shl ecx,16
mov cx,word[height]
shr edx,16
mov bx,dx
shl ebx,16
mov bx,TILE_LEN_W
mov edx,0xffffd0
int 0x40
popad
ret
endp
;???
align 4
proc draw_tile, tile:dword
pushad
mov edi,[tile]
;*** set base point ***
mov edx,5*65536+35
xor eax,eax
mov al,tile_delta_y
shl ax,8 ;*256
add edx,eax
xor eax,eax
mov al,tile_delta_x
shl eax,8+16
add edx,eax
;*** set base point ***
mov ebx,dword[procinfo.box.width] ;¯à®¢¥à塞 ¢« §¨â «¨ ª à⨭ª  ¯® ®á¨ x
sub ebx,min_window_w-5 ;5 - ®âáâ㯠᫥¢  ¤«ï 1-© ª à⨭ª¨
shl ebx,16
mov bx,dx ;­¨¦­ïï ª®®à¤¨­ â  ¯®ª  ­¥ ãç¨â뢠¥âáï, ¯®â®¬ã ¤¥« ¥¬ ¨å à ¢­ë¬¨
cmp edx,ebx
jg .end_f
;¯à®¢¥à塞 ¢« §¨â «¨ ª à⨭ª  ¯® ®á¨ y
mcall 48,4 ;eax = ¢ëá®â  ᪨­ 
mov ecx,dword[procinfo.box.height]
mov ebx,edx
and ebx,0xffff ;ebx = ª®®à¤¨­ â  'y' ¤«ï ¢ë¢®¤  â ©« 
add eax,ebx
add eax,5+5 ;5-à ¬ª 
cmp ecx,eax
jle .end_f
sub ecx,eax
cmp ecx,TILE_LEN_H
jle @f
mov ecx,TILE_LEN_H
@@:
mov eax,7
bt tile_drobn,SCALE_0BIT_USE
jc .draw
bt tile_drobn,SCALE_1BIT_USE
jc .draw
jmp @f
.draw:
mov ebx,tile_rgb_icon
or ecx,TILE_LEN_W*65536 ;§ ¤ ­¨¥ è¨à¨­ë ¤«ï 楫®© ª à⨭ª¨
int 0x40 ;¢ë¢®¤ ­  íªà ­ 楫®© ¨«¨ 㢥«¨ç¨­®© ª à⨭ª¨
jmp .end_clear_tile
@@:
cmp tile_drobn,FRACT_TILE_ALL
je .end_clear_tile
stdcall tile_clear_area, ecx ;ç¨á⪠ ®¡« á⨠⠩« 
.end_clear_tile:
cmp tile_drobn,0
je .info ;¥á«¨ ­¥â ­¨ ®¤­®© ¤à®¡­®© ª à⨭ª¨
mov si,cx ;si - ¢ëá®â  ­¨¦­¥© ¤à®¡­®© ª à⨭ª¨
sub si,TILE_LEN_H/2 ;si - ¢ëá®â  ­¨¦­¥© ¤à®¡­®© ª à⨭ª¨
cmp cx,TILE_LEN_H/2
jl @f
mov cx,TILE_LEN_H/2 ;§ ¤ ­¨¥ ¢ëá®âë ¤«ï ¢¥àå­¥© ¤à®¡­®© ª à⨭ª¨
@@:
and ecx,0xffff ;áâ¨à ­¨¥ áâ à®© è¨à¨­ë
or ecx,(TILE_LEN_W/2)*65536 ;§ ¤ ­¨¥ è¨à¨­ë ¤«ï ¤à®¡­®© ª à⨭ª¨
mov ebx,tile_drobn_icon
bt tile_drobn,FRACT_TILE_BIT00
jae @f
int 0x40
@@:
add dx,TILE_LEN_H/2
add ebx,RGB_TILE_SIZE_1N4
bt tile_drobn,FRACT_TILE_BIT01
jae @f
xchg cx,si
int 0x40
xchg cx,si
@@:
sub dx,TILE_LEN_H/2
ror edx,16
add dx,TILE_LEN_W/2
ror edx,16
add ebx,RGB_TILE_SIZE_1N4
bt tile_drobn,FRACT_TILE_BIT10
jae @f
int 0x40
@@:
add dx,TILE_LEN_H/2
add ebx,RGB_TILE_SIZE_1N4
bt tile_drobn,FRACT_TILE_BIT11
jae @f
xchg cx,si
int 0x40
@@:
jmp .end_f
.info: ;¢ë¢®¤ ¨­ä®à¬ æ¨¨, ¯à¨ ­¥ 㤠筮¬ ®âªàë⨨ ª à⨭®ª
bt tile_drobn,SCALE_0BIT_USE
jc .end_f
bt tile_drobn,SCALE_1BIT_USE
jc .end_f
mov ebx,edx
add ebx,0x30003
mov edx,tile_rgb_icon ;¯à¨ ­¥ã¤ ç­®¬ ®âªàë⨨ ¢ tile_rgb_icon ¯ãâì ª ä ©«ã
stdcall [str_len],tile_rgb_icon,RGB_TILE_SIZE_1N4
mov edi,eax
mov eax,4 ;draw text
mov ecx,0xff
;or ecx,0x80000000
mov esi,TILE_TEXT_MAX_LEN
@@:
cmp edi,TILE_TEXT_MAX_LEN
jg .no_line_last
mov esi,edi
int 0x40
jmp .end_f
.no_line_last:
int 0x40
add edx,esi
sub edi,esi
add ebx,10 ;®¯ã᪠¥¬áï ­  ­¨¦­îî áâபã
jmp @b
.end_f:
popad
ret
endp
;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
align 4
but_ZoomP:
cmp byte[map.zoom],24
jge @f
inc byte[map.zoom]
shl dword[map.coord_x],1
shl dword[map.coord_y],1
call but_Refresh
@@:
ret
;㬥­ì襭¨¥ ¬ áèâ ¡ 
align 4
but_ZoomM:
cmp byte[map.zoom],1
jle @f
dec byte[map.zoom]
shr dword[map.coord_x],1
shr dword[map.coord_y],1
call but_Refresh
@@:
ret
;???
align 4
but_MetSave: ;á®åà ­¥­¨¥ ä ©«  á ¬¥âª ¬¨
stdcall dword[tl_save_mem], TREE_ICON_SYS16_BMP_SIZE,[bmp_icon],0,tree2
push eax ebx ecx edi
copy_path fn_metki,sys_path,file_name,0x0
stdcall dword[tl_get_mem_size], [bmp_icon],tree2
pop ecx
inc ecx ;¤«ï § ¯¨á¨ ¢ ä ©« § ¢¥àè î饣® ­ã«ï
mov eax,70
m2m [run_file_70.param4], [bmp_icon]
mov [run_file_70.func_n], 2
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], ecx
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
mov ebx,run_file_70
int 0x40
pop edi ecx ebx eax
jmp still
;???
align 4
but_MetLoad: ;áç¨â뢠¥¬ ä ©« á ¬¥âª ¬¨
cmp byte[met_fr_opn],0
jne .end_f
pushad
mov byte[met_fr_opn],1
copy_path fn_metki,sys_path,file_name,0x0
mov eax,70 ;load icon file
mov [run_file_70.func_n], 0
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], TREE_ICON_SYS16_BMP_SIZE
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
m2m [run_file_70.param4], [bmp_icon]
mov eax,70
mov ebx,run_file_70
int 0x40
cmp ebx,0xffffffff
je @f
stdcall [tl_load_mem], TREE_ICON_SYS16_BMP_SIZE,dword[bmp_icon],0,tree2
stdcall [tl_cur_beg], tree2 ;?
stdcall [tl_draw], tree2 ;?
pop eax
@@:
mov byte[file_name],0 ;clear file name
popad
.end_f:
ret
;???
align 4
but_MetAdd: ;¤®¡ ¢«¥­¨¥ ¬¥âª¨
push eax
mov eax,dword[bmp_icon]
m2m dword[eax], dword[map.coord_x]
m2m dword[eax+4],dword[map.coord_y]
m2m word[eax+8], word[map.zoom]
add eax,12
stdcall dword[str_copy], eax,30,dword[edit2.text],30
stdcall dword[tl_node_add], dword[bmp_icon], 0, tree2
stdcall dword[tl_draw], tree2
pop eax
jmp still
;???
align 4
fun_goto_met: ;¯¥à¥å®¤ ª ¢ë¡à ­­®© ¬¥âª¥
push eax
stdcall dword[tl_node_get_data], tree2
pop eax
cmp eax,0
je @f ;ªãàá®à ­¥ á⮨⠭  ¬¥âª¥
m2m dword[map.coord_x],dword[eax]
m2m dword[map.coord_y],dword[eax+4]
m2m word[map.zoom],word[eax+8]
call but_Refresh
@@:
pop eax
ret
;???
align 4
but_Refresh:
call fun_new_map_type ;¯à®¢¥à塞 ­¥ ¯®¬¥­ï«áï «¨ ⨯ ¯à®á¬ âਢ ¥¬ëå ä ©«®¢
stdcall array_tile_function, tile_00,max_tiles_count,load_tile
stdcall draw_tiles
ret
align 4
proc tile_init, tile:dword
push eax edi
mov edi,[tile]
push dword RGB_TILE_SIZE+300
call mem.Alloc
mov tile_rgb_icon,eax
push dword RGB_TILE_SIZE
call mem.Alloc
mov tile_drobn_icon,eax
pop edi eax
ret
endp
align 4
proc tile_destroy, tile:dword
push edi
mov edi,[tile]
push tile_rgb_icon
call mem.Free
push tile_drobn_icon
call mem.Free
pop edi
ret
endp
;???
align 4 ;§ £à㦠¥â â ©«ë, ¢ ®¯à¥¤¥«¥­­®© ®¡« áâ¨
proc load_tile, tile:dword
push eax ebx ecx edi
mov edi,dword[tile] ;ª®¯¨à㥬 㪠§ â¥«ì ­  áâàãªâãàã â ©« , çâ®-¡ë à ¡®â «¨ ª®­áâ ­âë
stdcall mem_copy, map,edi, 9 ;ª®¯¨à㥬 ª®®à¤¨­ âë ªãàá®à  ¢ áâàãªâãàã â ©« 
xor eax,eax
mov al,tile_delta_x
add tile_coord_x,eax ;ᤢ¨£ ¥¬ ª®®à¤¨­ âë â ©« , ®â­®á¨â¥«ì­® ªãàá®à 
mov al,tile_delta_y
add tile_coord_y,eax
stdcall get_tile_path,edi ;¡¥à¥¬ ¯ãâì ª â ©«ã
;***
; ¯à®¢¥àª  ª®®à¤¨­ â ¯®á«¥¤­¥© § £à㦥­­®© ª à⨭ª¨
mov eax,edi
mov ecx,9
@@:
mov bl,byte[eax+tile_offs_l_load]
cmp byte[eax],bl
jne .st_load
inc eax
loop @b
mov ebx,dword[edit1.size];¯à®¢¥à塞 â ª¦¥ ⨯ ª àâ, ª®â®àë© ¡ë« à ­¥¥ § £à㦥­
cmp tile_key_path_len,bl ;¯à¨ ¨§¬¥­¥­¨¨ ⨯  ª àâë ­ã¦­® â ª¦¥ ¯¥à¥ç¨â뢠âì ä ©«ë
jne .st_load
jmp @f ;¥á«¨ ª®®à¤¨­ âë ᮢ¯ «¨ ⮠㦥 ­¥ § £à㦠¥¬
.st_load: ;start load tile
; ãáâ ­®¢ª  ­®¢ëå ª®®à¤¨­ â ¤«ï ¯®á«¥¤­¥© § £à㦥­­®© ª à⨭ª¨
mov eax,edi
add eax,tile_offs_l_load
stdcall mem_copy, edi,eax,9
mov ebx,dword[edit1.size]
mov tile_key_path_len,bl
;***
;mov tile_drobn,0
mov tile_drobn,SCALE_0_USE ;áâ ¢¨¬ ä« £ ®âªàëâ¨ï ª à⨭ª¨ ⥪ã饣® ã஢­ï
stdcall load_new_tile,edi
cmp tile_err_f,5
jne @f
mov tile_drobn,0
mov eax,ch2 ;¯à®¢¥à塞 ®¯æ¨î '¡à âì á­¨§ã'
bt dword[eax+32],1 ;ch_flags equ [edi+32] ;ä« £¨
jae .opt_drobn_false
;¥á«¨ ä ©« ­¥ ­ ©¤¥­, ¯®¯ ¤ ¥¬ á
inc tile_zoom
shl tile_coord_y,1
shl tile_coord_x,1
stdcall get_tile_path,edi
stdcall load_new_tile,edi
cmp tile_err_f,5
je .no_tile_00
or tile_drobn,FRACT_TILE_00
; 1 ᦠ⨥ ª à⨭ª¨ ¯® ¢ëá®â¥
stdcall img_rgb_hdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN, TILE_LEN
; 2 ᦠ⨥ ª à⨭ª¨ ¯® è¨à¨­¥
stdcall img_rgb_wdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN/2
; 3 ª®¯¨à®¢ ­¨¥ 1-© ª à⨭ª¨ ¢ १¥à¢­ë© ¡ãä¥à
stdcall mem_copy, tile_rgb_icon, tile_drobn_icon, RGB_TILE_SIZE_1N4
.no_tile_00:
;¥á«¨ ä ©« ­¥ ­ ©¤¥­, ¯®¯ ¤ ¥¬ á
inc tile_coord_y
stdcall get_tile_path,edi
stdcall load_new_tile,edi
cmp tile_err_f,5
je .no_tile_01
; mov byte[map.drobn],0
or tile_drobn,FRACT_TILE_01
; 1 ᦠ⨥ ª à⨭ª¨ ¯® ¢ëá®â¥
stdcall img_rgb_hdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN, TILE_LEN
; 2 ᦠ⨥ ª à⨭ª¨ ¯® è¨à¨­¥
stdcall img_rgb_wdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN/2
; 3 ª®¯¨à®¢ ­¨¥ 2-© ª à⨭ª¨ ¢ १¥à¢­ë© ¡ãä¥à
mov eax,tile_drobn_icon
add eax,RGB_TILE_SIZE_1N4 ; ᤢ¨£ ª à⨭ª¨ ¢­¨§ (â. ª. ®­  ­¨¦­ïï)
stdcall mem_copy, tile_rgb_icon, eax, RGB_TILE_SIZE_1N4
.no_tile_01:
;¥á«¨ ä ©« ­¥ ­ ©¤¥­, ¯®¯ ¤ ¥¬ á
dec tile_coord_y
inc tile_coord_x
stdcall get_tile_path,edi
stdcall load_new_tile,edi
cmp tile_err_f,5
je .no_tile_10
; mov byte[map.drobn],0
or tile_drobn,FRACT_TILE_10
; 1 ᦠ⨥ ª à⨭ª¨ ¯® ¢ëá®â¥
stdcall img_rgb_hdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN, TILE_LEN
; 2 ᦠ⨥ ª à⨭ª¨ ¯® è¨à¨­¥
stdcall img_rgb_wdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN/2
; 3 ª®¯¨à®¢ ­¨¥ 3-© ª à⨭ª¨ ¢ १¥à¢­ë© ¡ãä¥à
mov eax,tile_drobn_icon
add eax,RGB_TILE_SIZE_1N2 ; ᤢ¨£ ª à⨭ª¨ ¢­¨§ (â. ª. ®­  ­¨¦­ïï)
stdcall mem_copy, tile_rgb_icon, eax, RGB_TILE_SIZE_1N4
.no_tile_10:
;¥á«¨ ä ©« ­¥ ­ ©¤¥­, ¯®¯ ¤ ¥¬ á
inc tile_coord_y
stdcall get_tile_path,edi
stdcall load_new_tile,edi
cmp tile_err_f,5
je .no_tile_11
; mov byte[map.drobn],0
or tile_drobn,FRACT_TILE_11
; 1 ᦠ⨥ ª à⨭ª¨ ¯® ¢ëá®â¥
stdcall img_rgb_hdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN, TILE_LEN
; 2 ᦠ⨥ ª à⨭ª¨ ¯® è¨à¨­¥
stdcall img_rgb_wdiv2, tile_rgb_icon, TILE_LEN*TILE_LEN/2
; 3 ᤢ¨£ ª à⨭ª¨ ¢­¨§ ¡¥§ ª®¯¨à®¢ ­¨ï (â. ª. ®­  ­¨¦­ïï)
stdcall img_rgb_hoffs, tile_rgb_icon, TILE_LEN*TILE_LEN/4, TILE_LEN/2, TILE_LEN*3/2
;ª®¯¨à㥬 ¯®á«¥¤­îî ¤à®¡­ãî ª à⨭ªã ¢ ¡ãä¥à drobn_icon
;¢ ª®â®à®¬ 㦥 ¡ë«¨ áä®à¬¨à®¢ ­ë 3 ¤à㣨¥
mov eax,tile_drobn_icon
add eax,RGB_TILE_SIZE_1N4*3
stdcall mem_copy, tile_rgb_icon, eax, RGB_TILE_SIZE_1N4
.no_tile_11:
.opt_drobn_false:
mov eax,ch1 ;¯à®¢¥à塞 ®¯æ¨î '¡à âì ᢥàåã'
bt dword[eax+32],1 ;ch_flags equ [edi+32] ;ä« £¨
jae @f
cmp tile_drobn,FRACT_TILE_ALL ;¥á«¨ ᮡ࠭  ¢áï ª à⨭ª , ⮠ᢥàåã 㦥 ­¥ ¡¥à¥¬
je @f
;­¥ §­ ¥¬ ¡ë« -«¨ ¢ª«î祭  ®¯æ¨ï '¡à âì á­¨§ã', ¤«ï ª®â®à®© ¨§¬¥­ï«¨áì ª®®à¤¨­ âë
;¯®â®¬ã ®¯ïâì ª®¯¨à㥬 ª®®à¤¨­ âë ªãàá®à  ¢ áâàãªâãàã â ©« 
stdcall mem_copy, map,edi, 9
xor eax,eax
mov al,tile_delta_x
add tile_coord_x,eax ;ᤢ¨£ ¥¬ ª®®à¤¨­ âë â ©« , ®â­®á¨â¥«ì­® ªãàá®à 
mov al,tile_delta_y
add tile_coord_y,eax
xor ecx,ecx
.zoom:
cmp tile_zoom,0
je @f ;¯à®á¬ âਢ ¥âáï á ¬ ï ¢¥àå­ïï ª à⨭ª , ¢ë室¨¬
call get_parent_tiles ;横«¨ç¥áª¨© ¯à®á¬®âà த¨â¥«ì᪨å â ©«®¢
bt tile_drobn,SCALE_1BIT_USE
jc @f
cmp ecx,5 ;5 - ®£à ­¨ç¥­¨¥ ­  á⥯¥­ì à áâ¢ ­¨ï ª à⨭ª¨
je @f
jmp .zoom
@@:
pop edi ecx ebx eax
ret
endp
;output:
;ecx - if not file = count parent levels else = 0
align 4
proc get_parent_tiles
dec tile_zoom
shr tile_coord_y,1
shr tile_coord_x,1
inc ecx
stdcall get_tile_path,edi ;¡¥à¥¬ ¯ãâì ª â ©«ã
stdcall load_new_tile,edi
cmp tile_err_f,5
je @f
or tile_drobn,SCALE_1_USE
mov ebx,ecx
.zoom_cycle:
xor eax,eax
dec ebx
bt tile_key_coord_y,ebx
jae .scale_bot_l
add eax,RGB_TILE_SIZE_1N2
.scale_bot_l:
bt tile_key_coord_x,ebx
jae .scale_rig_l
add eax,TILE_LEN_W*3/2
.scale_rig_l:
cmp eax,0
je .scale_top_left
add eax,tile_rgb_icon
stdcall mem_copy, eax, tile_rgb_icon, RGB_TILE_SIZE_1N2
.scale_top_left:
;à áâ¢ ­¨¥ ¢¥àå­¥© ª à⨭ª¨
stdcall img_rgb_wcrop, tile_rgb_icon,TILE_LEN_W,TILE_LEN_W/2,TILE_LEN_H ;®â१ ¥¬ «¨è­¥¥
stdcall img_rgb_wmul2, tile_rgb_icon,RGB_TILE_SIZE_1N4/3 ;à á⨣¨¢ ¥¬ ¯® è¨à¨­¥
stdcall img_rgb_hmul2, tile_rgb_icon,RGB_TILE_SIZE_1N2/3,TILE_LEN_W ;à áâ¢ ¥¬ ¯® ¢ëá®â¥
loop .zoom_cycle
@@:
ret
endp
;tile - 㪠§ â¥«ì ­  áâàãªâãàã â ©« 
align 4 ;§ £à㦠¥â ®¯à¥¤¥«¥­­ë© â ©«
proc load_new_tile, tile:dword
pushad
mov eax,70 ;load icon file
mov [run_file_70.func_n], 0
mov [run_file_70.param1], 0
mov [run_file_70.param2], 0
mov [run_file_70.param3], RGB_TILE_SIZE+300 ;+54
m2m [run_file_70.param4], [bmp_icon]
mov [run_file_70.rezerv], 0
mov [run_file_70.name], file_name
mov ebx,run_file_70
int 0x40
mov edi,[tile]
mov tile_err_f,al
cmp ebx,0xffffffff
je .no_load
stdcall dword[img_decode], dword[bmp_icon],ebx,0
mov dword[data_icon],eax
stdcall dword[img_to_rgb2], dword[data_icon],tile_rgb_icon
stdcall dword[img_destroy], dword[data_icon]
jmp @f
.no_load:
; mov edi,[tile]
mov al,byte[map.zoom]
cmp tile_zoom,al
jne @f
stdcall mem_copy, file_name,tile_rgb_icon,150
@@:
popad
ret
endp
;äã­ªæ¨ï £¥­¥à¨àã¥â ç áâì ¯ã⨠ª ä ©«ã ¢ ¢¨¤¥: \z?\?\x?\?\y?
align 4
proc get_tile_path, tile:dword
push eax ecx edi esi
mov ecx,300
mov edi,txt_tile_path
@@:
mov byte[edi],0 ;ç¨á⨬ áâபã
inc edi
loop @b
mov esi,dword[tile] ;¡¥à¥¬ 㪠§ â¥«ì
mov ecx,0x80000000 ;rol 0x80000000,1 = 1
xor eax,eax
mov al,byte[esi+8] ;+8 = zoom
.calc_coord:
rol ecx,1 ;ecx = maximum coord
dec ax
cmp ax,0
jg .calc_coord
mov byte[txt_tile_path],'z'
mov edi,txt_tile_path
inc edi
xor eax,eax
mov al,byte[esi+8] ;+8 = zoom
call tl_convert_to_str
inc edi
cmp byte[esi+8],9 ;+8 = zoom
jle @f
inc edi
@@:
mov byte[edi],'/'
inc edi
mov eax,[esi] ;coord_x
cmp eax,ecx
jge .out_of_rang ;coord_x ¡®«ìè¥ ¤®¯ãá⨬®£® §­ ç¥­¨ï ¯à¨ § ¤ ­­®¬ ¬ áèâ ¡¥
shr eax,10
call tl_convert_to_str
@@:
inc edi
cmp byte[edi],'0'
jge @b
mov byte[edi],'/'
inc edi
mov byte[edi],'x'
inc edi
mov eax,[esi] ;coord_x
call tl_convert_to_str
@@:
inc edi
cmp byte[edi],'0'
jl @f
cmp byte[edi],'9'
jg @f
jmp @b
@@:
;coord y
mov byte[edi],'/'
inc edi
mov eax,[esi+4] ;coord_y
cmp eax,ecx
jge .out_of_rang ;coord_y ¡®«ìè¥ ¤®¯ãá⨬®£® §­ ç¥­¨ï ¯à¨ § ¤ ­­®¬ ¬ áèâ ¡¥
shr eax,10
call tl_convert_to_str
@@:
inc edi
cmp byte[edi],'0'
jge @b
mov byte[edi],'/'
inc edi
mov byte[edi],'y'
inc edi
mov eax,[esi+4] ;coord_y]
call tl_convert_to_str
.out_of_rang:
call get_all_path
pop esi edi ecx eax
ret
endp
align 4
get_all_path: ;äã­ªæ¨ï ¤«ï ᮡ¨à ­¨ï ¯®«­®£® ¯ã⨠¨§ ¢á¥å ªã᪮¢
mov ecx,dword[edit1.text]
add ecx,dword[edit1.size]
dec ecx
stdcall [str_copy], file_name,4096-1, dword[edit1.text],dword[edit1.max]
cmp byte[ecx],'/'
je @f
stdcall [str_catchar],file_name,4096-1, dword '/'
@@:
stdcall [str_cat], file_name,4096-1, txt_tile_path,300
stdcall [str_cat], file_name,4096-1, dword [txt_tile_type],10
ret

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB