kolibrios/programs/other/planet_v/tile_fun.inc
IgorA b062f4354f 1) 'box_lib.obj' update 'text_edititor'
2) modify code 't_edit' and 'planet_v'

git-svn-id: svn://kolibrios.org@1464 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-05-17 16:49:58 +00:00

955 lines
24 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
; *** ¯®à冷ª ¢ë§®¢  ä㭪権 ¯à¨ § £à㧪¥ â ©«®¢ ***
;load_tile
; get_tile_path
; load_new_tile (⥪ãé ï ª à⨭ª )
; get_tile_path
; load_new_tile (­¨¦­ïï ª à⨭ª )
; get_tile_path
; load_new_tile (­¨¦­ïï ª à⨭ª )
; get_tile_path
; load_new_tile (­¨¦­ïï ª à⨭ª )
; get_tile_path
; load_new_tile (­¨¦­ïï ª à⨭ª )
; get_parent_tiles (横«¨ç¥áª¨© ¯à®á¬®âà த¨â¥«ì᪨å â ©«®¢)
; get_tile_path
; load_new_tile (¢¥àå­ïï ª à⨭ª )
;???
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: ;¢ë¢®¤ ¨­ä®à¬ æ¨¨, ¯à¨ ­¥ 㤠筮¬ ®âªàë⨨ ª à⨭®ª
;;;jmp .end_f ;test
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 ¯ãâì ª ä ©«ã
;;; mov dword[edx+RGB_TILE_SIZE_1N4],0 ;áâ ¢¨¬ ­ã«¨, ­  á«ãç © ¥á«¨ ¢ áâப¥ á ¨¬¥­¥¬ ä ©«  ¬ãá®à
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.Buffer], [bmp_icon]
mov [run_file_70.Function], 2
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], ecx
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], 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.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], TREE_ICON_SYS16_BMP_SIZE
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
m2m [run_file_70.Buffer], [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,0
je @f ;¥á«¨ 㤠筮 ®âªà뫨 ⥪ã騩 ä ©« â® ®áâ «ì­ë¥ ¤¥©áâ¢¨ï ¯à®¯ã᪠¥¬
; cmp tile_err_f,6
; je @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,0
jne .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,0
jne .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,0
jne .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,0
jne .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,0
jne @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.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], RGB_TILE_SIZE+300 ;+54
m2m [run_file_70.Buffer], [bmp_icon]
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mov ebx,run_file_70
int 0x40
mov edi,[tile]
; cmp ebx,0xffffffff
; je .no_load
cmp al,6 ;®è¨¡ª  6 - ª®£¤  ä ©« § ª®­ç¨«áï à ­ìè¥ ç¥¬ ¡ãä¥à
jne @f
xor al,al ;­ ¬ íâ  ®è¨¡ª  ­¥ áâà è­ , ¯®â®¬ã áâ ¢¨¬ ª®¤ à ¢­ë¬ 0, ª ª ¯à¨ ®¡ëç­®¬ ®âªàë⨨
@@:
mov tile_err_f,al
cmp al,0
jne .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 al,byte[map.zoom]
cmp tile_zoom,al
jne @f
mov eax,tile_rgb_icon
mov bl,tile_err_f
add bl,'0' ;bl - ª®¤ ®è¨¡ª¨ ®âªàëâ¨ï
mov byte[eax],bl
inc eax
mov byte[eax],' '
inc eax
stdcall mem_copy, file_name,eax,250 ;ª®¯¨à㥬 ¯ãâì ª ä ©«ã ¯à¨ ®è¨¡®ç­®¬ ®âªàë⨨
@@:
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