1,7 → 1,14 |
;****************************************************** |
;***GRAPHICS EDIT ANIMAGE creted by andrew_programmer** |
;****************************************************** |
;******************************************************* |
;**************GRAPHICS EDITOR ANIMAGE ***************** |
;******************************************************* |
|
|
; version 1.1 year 9.12.2006 |
|
; AUTORS: |
; programming by andrew_programmer |
; design by golus |
|
use32 |
org 0x0 |
|
11,8 → 18,9 |
dd I_END |
dd 0x19000;100 kb |
dd 0x19000; |
dd 0x0 |
dd 0x0 |
dd parameters,0x0 |
|
|
include 'giflib.inc' |
include 'bmplib.inc' |
include 'dialog.inc' |
19,6 → 27,11 |
include 'dialog2.inc' |
include 'design.inc' |
include 'graphlib.inc' |
|
include 'cursors.inc' |
|
include 'load_from_parameters.inc' |
|
START: |
|
;-------------------------------------------------------- |
27,5071 → 40,93 |
mov eax,40 |
mov ebx,1100111b |
int 0x40 |
|
;--------------------------------------------------------- |
;--------initializate data and params of program---------- |
;-----------------------init data------------------------- |
;--------------------------------------------------------- |
mov [Scroll1CoordinatX],8+1 |
mov [Scroll2CoordinatY],20+15+1+46+3 |
mov [Window_SizeX],640 |
mov [Window_SizeY],400 |
mov [Window_CordinatX],50 |
mov [Window_CordinatY],50 |
mov [WorkScreen_SizeX],100 |
mov [WorkScreen_SizeY],100 |
mov [MaxWorkScreen_SizeX],100 |
mov [MaxWorkScreen_SizeY],100 |
mov [ScreenPointer],0x19000 |
and [PosX],0 |
and [PosY],0 |
mov [Picture_SizeX],640;400 |
mov [Picture_SizeY],400;280 |
mov [k],1 |
mov [PointerToPicture],0x19000+(1200*1000*3)+30*(20*20*3)+500000 |
mov [PointerToCopyPicture],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3) |
mov [PointerToCopyPicture2],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*2 |
mov [PointerToEditBufer],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*3 |
mov [PointerToSpriteBufer],0x19000+(1200*1000*3)+30*(20*20*3)+500000+(640*400*3)*4 |
mov [PointerToPalette],0x19000+(1200*100*3)+30*(20*20*3)+1 |
mov [ReserveArray],0x19000+(1200*1000)*3+30*(20*20*3)+8 |
and [save_flag],0 |
mov [line_width],1 |
mov [lastik_is_active],0 |
and [crossing],0 |
and [finishing_crossing],0 |
and [number_undo],0 |
and [instrument_used],0 |
and [DrawSprite_flag],0 |
and [extended_memory],0 |
|
finit |
include 'init_data.inc' |
;---------------------------------------------------------- |
;--------get memory and draw window of program------------- |
;---------------------------------------------------------- |
call GetMemory |
|
call cleare_work_arrea |
call load_icons |
call drawwin |
;---------------------------------------------------------- |
;---------------------MAIN LOOP---------------------------- |
;---------------------------------------------------------- |
main_loop: |
still: |
|
call event |
;load cursors |
mov eax,CursorsID |
call load_cursors |
|
cmp eax,1 |
jne no_redraw_window |
call drawwin |
call drawwin |
jmp still |
no_redraw_window: |
cmp eax,3 |
je buttons |
cmp eax,6 |
je mouse |
cmp eax,2 |
je keys |
jmp main_loop |
|
;------------------------------------------ |
;-------------KEYS------------------------- |
;------------------------------------------ |
keys: |
|
mov eax,2 |
int 0x40 |
shr eax,8 |
|
cmp eax,176 |
jne key2 |
sub [PosX],20 |
jmp change_screen |
key2: |
cmp eax,179 |
jne key3 |
add [PosX],20 |
jmp change_screen |
key3: |
cmp eax,177 |
jne key4 |
add [PosY],20 |
jmp change_screen |
key4: |
cmp eax,178 |
jne key5 |
sub [PosY],20 |
jmp change_screen |
key5: |
cmp eax,49 |
jne key6 |
mov [k],1 |
mov [Scroll1CoordinatX],9 |
mov [Scroll2CoordinatY],85 |
call drawwin |
jmp change_screen |
key6: |
cmp eax,50 |
jne key7 |
mov [k],2 |
mov [Scroll1CoordinatX],9 |
mov [Scroll2CoordinatY],85 |
call drawwin |
jmp change_screen |
key7: |
cmp eax,52 |
jne key8 |
mov [k],4 |
mov [Scroll1CoordinatX],9 |
mov [Scroll2CoordinatY],85 |
call drawwin |
jmp change_screen |
key8: |
cmp eax,56 |
jne key9 |
mov [k],8 |
mov [Scroll1CoordinatX],9 |
mov [Scroll2CoordinatY],85 |
call drawwin |
jmp change_screen |
key9: |
cmp eax,48 |
jne key10 |
mov [k],16 |
mov [Scroll1CoordinatX],9 |
mov [Scroll2CoordinatY],85 |
call drawwin |
jmp change_screen |
key10: |
cmp eax,255 |
jne key11 |
call analizing_picture_to_palette |
call drawwin |
jmp change_screen |
key11: |
cmp eax,27 |
jne still |
mov eax,-1 |
int 0x40 |
jmp still |
|
change_screen: |
|
call CalculatePositionScreen |
call MovePictureToWorkScreen |
call draw_scrollers |
call PrintMousePos |
|
jmp still |
;--------------------------------------------- |
;-----------panel BUTTONS--------------------- |
;--------------------------------------------- |
buttons: |
|
cmp [Current_instrument],30 |
jne no_finish_instrument_button |
|
cmp [instrument_used],1 |
jne no_finish_instrument_button |
|
cmp [Activate_instrument],0 |
jne no_finish_instrument_button |
|
cmp [crossing],1 |
jne no_finish_instrument_button |
|
mov [finishing_crossing],1 |
call TakeButtonInstruments |
|
no_finish_instrument_button: |
|
mov eax,17 |
int 0x40 |
|
shr eax,8 |
|
cmp eax,1 |
jne no_exit |
|
mov eax,-1 |
int 0x40 |
|
no_exit: |
|
mov [Current_instrument],eax |
|
cmp eax,10 |
jl still |
|
cmp eax,15 |
je still |
|
cmp eax,17 |
je still |
|
cmp eax,18 |
je still |
|
cmp eax,19 |
je still |
|
cmp eax,20 |
je still |
|
cmp eax,21 |
jne no_palette_ |
|
call TakeButtonInstruments |
jmp still |
|
no_palette_: |
|
cmp eax,23 |
je still |
|
cmp eax,30 |
jne no_allocation__ |
|
and [Activate_instrument],0 |
jmp still |
|
no_allocation__: |
|
cmp eax,38 |
jne no_kontur__ |
|
and [instrument_used],0 |
jmp still |
|
no_kontur__: |
|
call TakeButtonInstruments |
jmp still |
;--------------------------------------------- |
;-------------interraction MOUSE-------------- |
;--------------------------------------------- |
mouse: |
|
call GetMouseCoordinats |
|
;panel |
mov edx,[Window_SizeX] |
sub edx,5 |
|
cmp ebx,20 |
jle no_panel |
|
cmp ebx,20+15 |
jae no_panel |
|
cmp eax,5 |
jle no_panel |
|
cmp eax,edx ;585 |
jae no_panel |
|
call GetMouseCoordinats |
|
mov [counter],7 |
mov edi,panel_text |
call panel_interraction |
|
jmp still |
no_panel: |
|
cmp [Panel_flag],0 |
jz no_redraw_panel |
|
mov [counter],7 |
mov edi,panel_text |
call panel_interraction |
|
no_redraw_panel: |
|
call GetMouseCoordinats |
mov eax,[MouseX] |
mov ebx,[MouseY] |
mov ecx,[WorkScreen_SizeX] |
mov edx,[WorkScreen_SizeY] |
add ecx,9 |
add edx,85 |
|
cmp eax,ecx |
jae mouse_scroll |
|
cmp ebx,edx |
jae mouse_scroll |
|
jmp no_scrollers |
|
mouse_scroll: |
|
mov [exit_from_work_arrea],1 ;mouse situated after work arrea |
|
;scrollers |
call GetMouseClick |
|
cmp eax,1 |
jne no_click |
|
call GetMouseCoordinats |
;interraction with horizontal scroller |
mov eax,[Scroll1CoordinatX] |
mov ebx,[Scroll1CoordinatY] |
mov ecx,[MouseX] |
mov edx,[MouseY] |
mov esi,[Scroll1MaxSizeX] |
mov edi,[Scroll1MaxSizeY] |
call columnus |
|
test eax,eax |
jz no_horizontal |
|
|
mov eax,9 |
mov ebx,[Scroll1CoordinatY] |
mov ecx,[Scroll1MaxSizeX] |
mov edx,14+10 |
mov esi,7 |
inc ecx |
call draw_volume_rectangle |
|
mov eax,[MouseX] |
mov ebx,[Scroll1SizeX] |
shr ebx,1 |
sub eax,ebx |
mov ecx,[MouseX] |
add ecx,ebx |
mov edx,8+1 |
add edx,[Scroll1MaxSizeX] |
mov [Scroll1CoordinatX],eax |
|
sub eax,9 |
jns no_min_scroll |
|
mov [Scroll1CoordinatX],9 |
|
no_min_scroll: |
|
cmp ecx,edx |
jl no_max_scroll |
|
sub edx,ebx |
sub edx,ebx |
mov [Scroll1CoordinatX],edx |
|
no_max_scroll: |
; |
mov eax,[Scroll1CoordinatX] |
sub eax,9 |
mov ebx,[Picture_SizeX] |
imul eax,ebx |
mov ebx,[Scroll1MaxSizeX] |
cdq |
idiv ebx |
mov [PosX],eax |
|
jmp no_vertical |
|
no_horizontal: |
|
mov eax,[Scroll2CoordinatX] |
mov ebx,[Scroll2CoordinatY] |
mov ecx,[MouseX] |
mov edx,[MouseY] |
mov esi,[Scroll2MaxSizeX] |
mov edi,[Scroll2MaxSizeY] |
call columnus |
|
test eax,eax |
jz no_vertical |
|
mov eax,[Scroll2CoordinatX] |
mov ebx,85 |
mov ecx,14+10 |
mov edx,[Scroll2MaxSizeY] |
mov esi,7 |
inc edx |
call draw_volume_rectangle |
|
mov eax,[MouseY] |
mov ebx,[Scroll2SizeY] |
shr ebx,1 |
sub eax,ebx |
mov ecx,[MouseY] |
add ecx,ebx |
mov edx,85 |
add edx,[Scroll2MaxSizeY] |
mov [Scroll2CoordinatY],eax |
|
sub eax,85 |
jns no_min_scroll2 |
|
mov [Scroll2CoordinatY],85 |
|
no_min_scroll2: |
|
cmp ecx,edx |
jl no_max_scroll2 |
|
sub edx,ebx |
sub edx,ebx |
mov [Scroll2CoordinatY],edx |
|
no_max_scroll2: |
; |
mov eax,[Scroll2CoordinatY] |
sub eax,85 |
mov ebx,[Picture_SizeY] |
imul eax,ebx |
mov ebx,[Scroll2MaxSizeY] |
cdq |
idiv ebx |
mov [PosY],eax |
|
no_vertical: |
|
call CalculatePositionScreen |
|
call draw_scrollers |
call MovePictureToWorkScreen |
|
no_click: |
|
jmp still |
no_scrollers: |
|
|
mov eax,[MouseX] |
mov ebx,[MouseY] |
mov ecx,[Window_SizeX] |
mov edx,[Window_SizeY] |
sub ecx,36 |
sub edx,35 |
|
cmp eax,9 |
jle not_work_arrea |
|
cmp eax,ecx |
jae not_work_arrea |
|
cmp ebx,20+15+1+46 |
jle not_work_arrea |
|
cmp ebx,edx |
jae not_work_arrea |
|
jmp mouse_in_work_arrea |
|
not_work_arrea: |
|
mov [exit_from_work_arrea],1 |
|
jmp still |
|
mouse_in_work_arrea: |
|
call GetScreenCordinats |
call PrintMousePos |
call GetMouseClick |
|
test eax,eax |
jz no_use_instruments |
|
cmp [Activate_instrument],0 |
|
jnz no_undo___ |
;------------begin copy for undo------------- |
inc [number_undo] |
|
cmp [number_undo],1 |
jne no_one__ |
|
mov edi,[PointerToCopyPicture] |
|
no_one__: |
|
cmp [number_undo],2 |
jne no_two__ |
|
mov edi,[PointerToCopyPicture2] |
|
no_two__: |
|
cmp [number_undo],3 |
jne no_three__ |
|
;copy bufer number two to bufer number one |
mov esi,[PointerToCopyPicture2] |
mov edi,[PointerToCopyPicture] |
mov ecx,[Picture_SizeX] |
imul ecx,[Picture_SizeY] |
lea ecx,[ecx+ecx*2] |
add ecx,4 |
shr ecx,2 |
inc ecx |
cld |
rep movsd |
;end copy |
dec [number_undo] |
mov edi,[PointerToCopyPicture2] |
|
no_three__: |
|
mov esi,[PointerToPicture] |
mov ecx,[Picture_SizeX] |
imul ecx,[Picture_SizeY] |
lea ecx,[ecx+ecx*2] |
add ecx,4 |
shr ecx,2 |
inc ecx |
cld |
rep movsd |
;--------------end copy for undo------------- |
no_undo___: |
|
call TakeButtonInstruments |
no_use_instruments: |
|
mov eax,[Current_instrument] |
and [Activate_instrument],0 |
|
jmp still |
;----------------------------------------------- |
;---------get mouse cordinats------------------- |
;----------------------------------------------- |
GetMouseCoordinats: |
|
mov eax,37 |
mov ebx,1 |
int 0x40 |
|
mov ebx,eax |
shr eax,16 |
and ebx,0xffff |
|
mov [MouseX],eax |
mov [MouseY],ebx |
|
ret |
;------------------------------------------------ |
;-------get mouse attributs---------------------- |
;------------------------------------------------ |
GetMouseClick: |
mov eax,37 |
mov ebx,2 |
int 0x40 |
|
ret |
;------------------------------------------------- |
;-----interraction panel with user---------------- |
;------------------------------------------------- |
panel_interraction: |
;>>>>>>>>>>>>>>>>>>>>>>>>>> |
mov eax,18 |
mov ebx,14 |
int 0x40 |
|
and [Panel_flag],0 |
;collision with text on panel |
next_columnus_text: |
|
mov eax,[edi] |
mov ebx,[edi+4] |
sub eax,10 |
sub ebx,3 |
mov [Icon_text_x],eax |
mov [Icon_text_y],ebx |
mov esi,[edi+8] |
add edi,esi |
add edi,3*4 |
mov ecx,[MouseX] |
mov edx,[MouseY] |
push edi |
mov edi,13 |
mov esi,80 |
call columnus |
|
pop edi |
mov esi,7 |
|
test eax,eax |
jz no_columnus_text |
|
mov esi,1 |
mov [Panel_flag],1 |
call GetMouseClick |
|
test eax,eax |
jz no_mouse_pressed |
|
call print_panel_menu |
|
no_mouse_pressed: |
|
no_columnus_text: |
|
mov eax,[Icon_text_x] |
mov ebx,[Icon_text_y] |
mov ecx,79 |
mov edx,13 |
call draw_volume_rectangle |
|
push [counter] |
push edi |
mov [counter],7 |
mov edi,panel_text |
call print_panel_text |
|
pop edi |
pop [counter] |
dec [counter] |
jnz next_columnus_text |
|
ret |
;--------------------------------------------------------- |
;-----draw panel menu(main engin of panel)---------------- |
;---------Check loading of file from psrsmeters----------- |
;--------------------------------------------------------- |
print_panel_menu: |
|
mov eax,parameters |
mov ebx,file_path |
call check_loading_from_parameters |
|
push [counter] |
;delit icon buttons(some time) |
mov [counter],10 |
next_icon_delit: |
mov eax,8 |
mov edx,[counter] |
add edx,11100000000000000000000000000000b |
int 0x40 |
inc [counter] |
|
cmp [counter],30 |
jl next_icon_delit |
|
pop [counter] |
|
push esi |
mov esi,[counter] |
dec esi |
shl esi,4 |
|
mov eax,[menu_rectangles+esi] |
mov ebx,[menu_rectangles+esi+4] |
mov ecx,[menu_rectangles+esi+8] |
mov edx,[menu_rectangles+esi+12] |
mov esi,1 |
mov [menu_coordinat_x],eax |
mov [menu_size_x],ecx |
call draw_volume_rectangle |
pop esi |
|
calculate_counter_menu: |
|
|
;calculate menu counter |
mov eax,[counter] |
dec eax |
shl eax,2 |
mov ebx,[menu_counters+eax] |
mov [counter_menu],ebx |
|
call GetMouseCoordinats |
|
and [menu_counter],0 |
push esi |
push edi |
;ᣫ ¦¨¢ ¨¥ ¨¬ 樨 >>>>>>>>>>>>>>>>>> |
mov eax,18 |
mov ebx,14 |
int 0x40 |
|
menu_loop: |
|
mov eax,[menu_coordinat_x] |
mov ebx,36 |
mov ecx,[MouseX] |
mov edx,[MouseY] |
mov esi,[menu_size_x] |
mov edi,18 |
add ebx,[menu_counter] |
add eax,2 |
sub esi,3 |
inc ebx |
call columnus |
mov esi,7 |
|
test eax,eax |
jz no_columnus_menu_text |
|
mov esi,1 |
|
no_columnus_menu_text: |
|
mov eax,[menu_coordinat_x] |
mov ebx,36 |
mov ecx,[menu_size_x] |
mov edx,18 |
add ebx,[menu_counter] |
add eax,2 |
sub ecx,3 |
inc ebx |
call draw_volume_rectangle |
add [menu_counter],20 |
|
|
dec [counter_menu] |
jnz menu_loop |
|
;print menu text |
push [counter] |
mov esi,[counter] |
dec esi |
shl esi,2 |
mov edi,[menu_text_en+esi] |
mov eax,[menu_counters+esi] |
mov [counter],eax |
call print_panel_text |
pop [counter] |
pop edi |
pop esi |
|
|
menu_still: |
|
mov eax,10 |
int 0x40 |
mov eax,2 |
int 0x40 |
mov eax,17 |
int 0x40 |
|
call GetMouseClick |
|
test eax,eax |
jz calculate_counter_menu |
|
call GetMouseCoordinats |
|
;calculate menu counter |
mov eax,[counter] |
dec eax |
shl eax,2 |
mov ebx,[menu_counters+eax] |
mov [counter_menu],ebx |
|
and [menu_counter],0 |
and [counter_11],0 |
|
push esi |
push edi |
|
menu_loop2: |
|
|
mov eax,[menu_coord |