diff --git a/programs/media/zsea/backgrnd.inc b/programs/media/zsea/backgrnd.inc index d04eff2b7c..64b151b61f 100644 --- a/programs/media/zsea/backgrnd.inc +++ b/programs/media/zsea/backgrnd.inc @@ -78,10 +78,6 @@ background: mov ebx,[screen_high] call integer_division mov [stretch_img_width],eax - mov ebx,[img_width] - sub ebx,eax - shr ebx,1 - mov [stretch_start_coordinates.x],bx jmp .continue @@: ; X = Ximg @@ -93,11 +89,18 @@ background: mov ebx,[screen_width] call integer_division mov [stretch_img_high],eax - mov ebx,[img_high] - sub ebx,eax - shr ebx,1 - mov [stretch_start_coordinates.y],bx .continue: + mov eax,[Stretch_Crop_Corner] + mov ebx,eax + shr eax,16 + shl eax,2 + mov eax,[eax+call_to_calculate_stretch_start_coordinates_Y] + call eax + and ebx,0xffff + shl ebx,2 + mov ebx,[ebx+call_to_calculate_stretch_start_coordinates_X] + call ebx + mov ebx,[screen_width] shl ebx,16 add ebx,[screen_high] @@ -119,6 +122,52 @@ background: ret ;--------------------------------------------------------------------- +call_to_calculate_stretch_start_coordinates_X: + dd calculate_stretch_start_coordinates_XL + dd calculate_stretch_start_coordinates_XC + dd calculate_stretch_start_coordinates_XR +;--------------------------------------------------------------------- +call_to_calculate_stretch_start_coordinates_Y: + dd calculate_stretch_start_coordinates_YU + dd calculate_stretch_start_coordinates_YC + dd calculate_stretch_start_coordinates_YD +;--------------------------------------------------------------------- +calculate_stretch_start_coordinates_XC: + xor ecx,ecx +.1: + mov eax,[img_width] + sub eax,[stretch_img_width] + test ecx,ecx + jnz @f + shr eax,1 +@@: + mov [stretch_start_coordinates.x],ax +calculate_stretch_start_coordinates_XL: + ret +;--------------------------------------------------------------------- +calculate_stretch_start_coordinates_XR: + xor ecx,ecx + inc ecx + jmp calculate_stretch_start_coordinates_XC.1 +;--------------------------------------------------------------------- +calculate_stretch_start_coordinates_YC: + xor ecx,ecx +.1: + mov eax,[img_high] + sub eax,[stretch_img_high] + test ecx,ecx + jnz @f + shr eax,1 +@@: + mov [stretch_start_coordinates.y],ax +calculate_stretch_start_coordinates_YU: + ret +;--------------------------------------------------------------------- +calculate_stretch_start_coordinates_YD: + xor ecx,ecx + inc ecx + jmp calculate_stretch_start_coordinates_YC.1 +;--------------------------------------------------------------------- ;.stretch_inscribe: ; ret ;--------------------------------------------------------------------- diff --git a/programs/media/zsea/data.inc b/programs/media/zsea/data.inc index 4b376022c6..044766fe0f 100644 --- a/programs/media/zsea/data.inc +++ b/programs/media/zsea/data.inc @@ -893,7 +893,7 @@ op1 option_box option_group1,60,40,6,12,0xFFFFFF,0,0xffffff,op_text.1,op_text.e1 op2 option_box option_group1,60,55,6,12,0xFFFFFF,0,0xffffff,op_text.2,op_text.e2-op_text.2 op3 option_box option_group1,60,70,6,12,0xFFFFFF,0,0xffffff,op_text.3,op_text.e3-op_text.3 op4 option_box option_group1,60,85,6,12,0xFFFFFF,0,0xffffff,op_text.4,op_text.e4-op_text.4 -option_boxes_bcgr_end: +;option_boxes_bcgr_end: op_text: .1 db 'Tiled' @@ -908,6 +908,26 @@ op_text: option_group1 dd op1 option_boxes_bcgr: dd op1,op2,op3,op4,0 + +;--------------------------------------------------------------------- +align 4 +op_UL option_box option_group3,200,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_UC option_box option_group3,223,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_UR option_box option_group3,246,40,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CL option_box option_group3,200,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CC option_box option_group3,223,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_CR option_box option_group3,246,63,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DL option_box option_group3,200,86,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DC option_box option_group3,223,86,20,20,0xFFFFFF,0,0xffffff,0,0 +op_DR option_box option_group3,246,86,20,20,0xFFFFFF,0,0xffffff,0,0 +;option_boxes_bcgr_end: + +option_group3 dd op_CC + +Stretch_Crop_Corner dd 1 shl 16+1 +option_boxes_SCC: dd op_UL,op_UC,op_UR,op_CL,op_CC,op_CR,op_DL,op_DC,op_DR,0 + +bcgr_group_pointer db 0 ;--------------------------------------------------------------------- align 4 ;option_boxes_sort: diff --git a/programs/media/zsea/win_bcgr.inc b/programs/media/zsea/win_bcgr.inc index ce61334f19..168c0a7d44 100644 --- a/programs/media/zsea/win_bcgr.inc +++ b/programs/media/zsea/win_bcgr.inc @@ -35,30 +35,58 @@ thread4: ; start of bgrd thread jmp .still ;--------------------------------------------------------------------- .mouse: + mov eax,option_group1 + mov ecx,[eax] push dword option_boxes_bcgr call [option_box_mouse] + cmp ecx,[eax] + je .option_boxes_SCC - cmp [option_group1],op1 + mov ebx,bgrmode + cmp [eax],dword op1 jne @f - mov [bgrmode],dword 1 - jmp .still + mov [ebx],dword 1 + jmp .option_group1_color_set ;--------------------------------------------------------------------- @@: - cmp [option_group1],op2 + cmp [eax],dword op2 jne @f - mov [bgrmode],dword 2 - jmp .still + mov [ebx],dword 2 + jmp .option_group1_color_set ;--------------------------------------------------------------------- @@: - cmp [option_group1],op3 + cmp [eax],dword op3 jne @f - mov [bgrmode],dword 3 - jmp .still + mov [ebx],dword 3 + jmp .option_group1_color_set ;--------------------------------------------------------------------- @@: -; cmp [option_group1],op4 -; jne .still - mov [bgrmode],dword 4 + cmp [eax],dword op4 + jne .option_boxes_SCC + mov [ebx],dword 4 +.option_group1_color_set: + mov [bcgr_group_pointer],0 + call .option_boxes_redraw + jmp .still +;--------------------------------------------------------------------- +.option_boxes_SCC: + mov eax,[option_group3] + push dword option_boxes_SCC + call [option_box_mouse] + cmp eax,[option_group3] + je .still + + call .convert_1 + mov [bcgr_group_pointer],1 + call .option_boxes_redraw + jmp .still +;--------------------------------------------------------------------- +.tab: + mov al,[bcgr_group_pointer] + inc al + and al,1 + mov [bcgr_group_pointer],al + call .option_boxes_redraw jmp .still ;--------------------------------------------------------------------- .key: @@ -69,56 +97,215 @@ thread4: ; start of bgrd thread cmp ah,13 je .kok + cmp ah,9 + je .tab + + cmp [bcgr_group_pointer],1 + je .key_option_group3 +;--------------------------------------------------------------------- +.key_option_group1: + mov ebx,bgrmode + cmp ah,178 ;up jne .nofup - cmp dword [bgrmode],1 + cmp [ebx],dword 1 je .fdn .fup: - dec dword [bgrmode] + dec dword [ebx] jmp .flagcont -;--------------------------------------------------------------------- +;-------------------------------------- .nofup: cmp ah,177 ;down jne .still - cmp dword [bgrmode],4 + cmp [ebx],dword 4 je .fup .fdn: - inc dword [bgrmode] + inc dword [ebx] .flagcont: - cmp [bgrmode],dword 1 + mov eax,option_group1 + cmp [ebx],dword 1 jne @f - mov [option_group1],op1 - call .draw_opt_boxes + mov [eax],dword op1 + call .draw_opt_boxes_bcgr jmp .still -;--------------------------------------------------------------------- +;--------------------------------------- @@: - cmp [bgrmode],dword 2 + cmp [ebx],dword 2 jne @f - mov [option_group1],op2 - call .draw_opt_boxes + mov [eax],dword op2 + call .draw_opt_boxes_bcgr jmp .still -;--------------------------------------------------------------------- +;---------------------------------------- @@: - cmp [bgrmode],dword 3 + cmp [ebx],dword 3 jne @f - mov [option_group1],op3 - call .draw_opt_boxes + mov [eax],dword op3 + call .draw_opt_boxes_bcgr + jmp .still +;----------------------------------------- +@@: + mov [eax],dword op4 + call .draw_opt_boxes_bcgr jmp .still ;--------------------------------------------------------------------- +.key_option_group3: + push eax + call .convert_1 + pop eax + + cmp ah,178 ;up + jne @f + + dec word [ebx+2] + jmp .flagcont_1 +;------------------------------------------ @@: - mov [option_group1],op4 - call .draw_opt_boxes + cmp ah,177 ;down + jne @f + + inc word [ebx+2] + jmp .flagcont_1 +;------------------------------------------ +@@: + cmp ah,176 ;left + jne @f + + dec word [ebx] + jmp .flagcont_1 +;------------------------------------------ +@@: + cmp ah,179 ;right + jne .still + + inc word [ebx] +;------------------------------------------ +.flagcont_1: + call .convert_2 + call .convert_1 ;for additional check + call .draw_opt_boxes_SCC jmp .still ;--------------------------------------------------------------------- +.convert_1: + mov eax,option_group3 + mov ebx,Stretch_Crop_Corner + cmp [eax],dword op_UL + jne @f + mov [ebx],dword 0 shl 16+0 + jmp .option_group3_color_set +;---------------------------------------- +@@: + cmp [eax],dword op_UC + jne @f + mov [ebx],dword 0 shl 16+1 + jmp .option_group3_color_set +;----------------------------------------- +@@: + cmp [eax],dword op_UR + jne @f + mov [ebx],dword 0 shl 16+2 + jmp .option_group3_color_set +;----------------------------------------- +@@: + cmp [eax],dword op_CL + jne @f + mov [ebx],dword 1 shl 16+0 + jmp .option_group3_color_set +;------------------------------------------ +@@: + cmp [eax],dword op_CC + jne @f + mov [ebx],dword 1 shl 16+1 + jmp .option_group3_color_set +;------------------------------------------- +@@: + cmp [eax],dword op_CR + jne @f + mov [ebx],dword 1 shl 16+2 + jmp .option_group3_color_set +;-------------------------------------------- +@@: + cmp [eax],dword op_DL + jne @f + mov [ebx],dword 2 shl 16+0 + jmp .option_group3_color_set +;-------------------------------------------- +@@: + cmp [eax],dword op_DC + jne @f + mov [ebx],dword 2 shl 16+1 + jmp .option_group3_color_set +;-------------------------------------------- +@@: + cmp [eax],dword op_DR + jne .option_group3_color_set + mov [ebx],dword 2 shl 16+2 +.option_group3_color_set: + ret +;--------------------------------------------------------------------- +.convert_2: + mov eax,Stretch_Crop_Corner + mov ebx,option_group3 + cmp [eax],dword 0 shl 16+0 + jne @f + mov [ebx],dword op_UL + jmp .Stretch_Crop_Corner_set +;---------------------------------------- +@@: + cmp [eax],dword 0 shl 16+1 + jne @f + mov [ebx],dword op_UC + jmp .Stretch_Crop_Corner_set +;----------------------------------------- +@@: + cmp [eax],dword 0 shl 16+2 + jne @f + mov [ebx],dword op_UR + jmp .Stretch_Crop_Corner_set +;----------------------------------------- +@@: + cmp [eax],dword 1 shl 16+0 + jne @f + mov [ebx],dword op_CL + jmp .Stretch_Crop_Corner_set +;------------------------------------------ +@@: + cmp [eax],dword 1 shl 16+1 + jne @f + mov [ebx],dword op_CC + jmp .Stretch_Crop_Corner_set +;------------------------------------------- +@@: + cmp [eax],dword 1 shl 16+2 + jne @f + mov [ebx],dword op_CR + jmp .Stretch_Crop_Corner_set +;-------------------------------------------- +@@: + cmp [eax],dword 2 shl 16+0 + jne @f + mov [ebx],dword op_DL + jmp .Stretch_Crop_Corner_set +;-------------------------------------------- +@@: + cmp [eax],dword 2 shl 16+1 + jne @f + mov [ebx],dword op_DC + jmp .Stretch_Crop_Corner_set +;-------------------------------------------- +@@: + cmp [eax],dword 2 shl 16+2 + jne .Stretch_Crop_Corner_set + mov [ebx],dword op_DR +.Stretch_Crop_Corner_set: + ret +;--------------------------------------------------------------------- .button: ; button - mov eax,17 ; get id - mcall - + mcall 17 ; get id cmp ah,1 ; button id=1 ? jne .noclose .close: @@ -141,18 +328,42 @@ thread4: ; start of bgrd thread mcall 12,1 xor eax,eax xor esi,esi - mcall ,<100,200>,<100,200>,0x13909090,,labelt4 + mcall ,<100,300>,<100,150>,0x13909090,,labelt4 mcall 8,<70,40>,<110,20>,4,0xdddddd mcall 4,<46,28>,0xffffff,bgrdtext,bgrdtext.size add ebx,40*65536+88 xor ecx,ecx mcall ,,,ok_btn,ok_btn.size - call .draw_opt_boxes + call .option_boxes_redraw ; mcall 47,0x80000,[PID4],<200, 5>,0xffffff mcall 12,2 ret ;--------------------------------------------------------------------- -.draw_opt_boxes: +.option_boxes_redraw: + call .draw_opt_boxes_bcgr + call .draw_opt_boxes_SCC + ret +;--------------------------------------------------------------------- +.draw_opt_boxes_bcgr: + mov edx,0x13909090 + cmp [bcgr_group_pointer],0 + jne @f + + mov edx,0xffff80 +@@: + mcall 13,<59,14>,<39,59>, push dword option_boxes_bcgr call [option_box_draw] + ret +;--------------------------------------------------------------------- +.draw_opt_boxes_SCC: + mov edx,0x13909090 + cmp [bcgr_group_pointer],1 + jne @f + + mov edx,0xffff80 +@@: + mcall 13,<198,70>,<38,70>, + push dword option_boxes_SCC + call [option_box_draw] ret \ No newline at end of file