Rev 6379 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6379 | Rev 6385 | ||
---|---|---|---|
1 | macro square_width_put |
1 | macro square_width_put |
2 | { |
2 | { |
3 | local .no_put_to_screen |
3 | local .no_put_to_screen |
4 | local .next_color_put |
4 | local .next_color_put |
5 | local .vertical_width_put |
5 | local .vertical_width_put |
6 | local .horizontal_width_put |
6 | local .horizontal_width_put |
7 | 7 | ||
8 | mov ebx,[ReserveArray] |
8 | mov ebx,[ReserveArray] |
9 | mov eax,[ebx] |
9 | mov eax,[ebx] |
10 | test eax,eax |
10 | test eax,eax |
11 | jz .no_put_to_screen |
11 | jz .no_put_to_screen |
12 | mov ecx,[ebx] |
12 | mov ecx,[ebx] |
13 | add ebx,4 |
13 | add ebx,4 |
14 | xor ebp,ebp |
14 | xor ebp,ebp |
15 | 15 | ||
16 | .next_color_put: |
16 | .next_color_put: |
17 | ;put saved pixels in ReserveArray |
17 | ;put saved pixels in ReserveArray |
18 | push ecx |
18 | push ecx |
19 | mov [counter2],5 |
19 | mov [counter2],5 |
20 | mov edi,[ebx] |
20 | mov edi,[ebx] |
21 | push edi |
21 | push edi |
22 | .vertical_width_put: |
22 | .vertical_width_put: |
23 | mov [counter],5 |
23 | mov [counter],5 |
24 | 24 | ||
25 | .horizontal_width_put: |
25 | .horizontal_width_put: |
26 | mov edx,[ebx+mem_offs_shape+ebp] |
26 | mov edx,[ebx+mem_offs_shape+ebp] |
27 | ;and edx,0xffffff |
27 | ;and edx,0xffffff |
28 | mov [edi],dx |
28 | mov [edi],dx |
29 | shr edx,16 |
29 | shr edx,16 |
30 | mov [edi+2],dl |
30 | mov [edi+2],dl |
31 | 31 | ||
32 | add edi,3 |
32 | add edi,3 |
33 | add ebp,4 |
33 | add ebp,4 |
34 | dec [counter] |
34 | dec [counter] |
35 | jnz .horizontal_width_put |
35 | jnz .horizontal_width_put |
36 | 36 | ||
37 | mov ecx,[Picture_SizeX] |
37 | mov ecx,[Picture_SizeX] |
38 | sub ecx,5 |
38 | sub ecx,5 |
39 | lea ecx,[ecx+ecx*2] |
39 | lea ecx,[ecx+ecx*2] |
40 | add edi,ecx |
40 | add edi,ecx |
41 | dec [counter2] |
41 | dec [counter2] |
42 | jnz .vertical_width_put |
42 | jnz .vertical_width_put |
43 | pop edi |
43 | pop edi |
44 | pop ecx |
44 | pop ecx |
45 | 45 | ||
46 | add ebx,4 |
46 | add ebx,4 |
47 | dec ecx |
47 | dec ecx |
48 | jnz .next_color_put |
48 | jnz .next_color_put |
49 | 49 | ||
50 | .no_put_to_screen: |
50 | .no_put_to_screen: |
51 | } |
51 | } |
52 | 52 | ||
53 | macro square_width_save |
53 | macro square_width_save |
54 | { |
54 | { |
55 | local .next_color_save |
55 | local .next_color_save |
56 | local .vertical_width_save |
56 | local .vertical_width_save |
57 | local .horizontal_width_save |
57 | local .horizontal_width_save |
58 | mov ebx,[ReserveArray] |
58 | mov ebx,[ReserveArray] |
59 | mov [ebx],eax |
59 | mov [ebx],eax |
60 | mov ecx,eax |
60 | mov ecx,eax |
61 | add ebx,4 |
61 | add ebx,4 |
62 | xor ebp,ebp |
62 | xor ebp,ebp |
63 | 63 | ||
64 | .next_color_save: |
64 | .next_color_save: |
65 | ;save color of pixel in ReserveArray |
65 | ;save color of pixel in ReserveArray |
66 | push ecx |
66 | push ecx |
67 | mov [counter2],5 |
67 | mov [counter2],5 |
68 | mov edi,[ebx] |
68 | mov edi,[ebx] |
69 | .vertical_width_save: |
69 | .vertical_width_save: |
70 | mov [counter],5 |
70 | mov [counter],5 |
71 | 71 | ||
72 | .horizontal_width_save: |
72 | .horizontal_width_save: |
73 | mov eax,edi |
73 | mov eax,edi |
74 | mov edx,[eax] |
74 | mov edx,[eax] |
75 | ;and edx,0xffffff |
75 | ;and edx,0xffffff |
76 | mov [ebx+mem_offs_shape+ebp],dx |
76 | mov [ebx+mem_offs_shape+ebp],dx |
77 | shr edx,16 |
77 | shr edx,16 |
78 | mov [ebx+mem_offs_shape+2+ebp],dl |
78 | mov [ebx+mem_offs_shape+2+ebp],dl |
79 | 79 | ||
80 | add edi,3 |
80 | add edi,3 |
81 | add ebp,4 |
81 | add ebp,4 |
82 | dec [counter] |
82 | dec [counter] |
83 | jnz .horizontal_width_save |
83 | jnz .horizontal_width_save |
84 | 84 | ||
85 | mov ecx,[Picture_SizeX] |
85 | mov ecx,[Picture_SizeX] |
86 | sub ecx,5 |
86 | sub ecx,5 |
87 | lea ecx,[ecx+ecx*2] |
87 | lea ecx,[ecx+ecx*2] |
88 | add edi,ecx |
88 | add edi,ecx |
89 | dec [counter2] |
89 | dec [counter2] |
90 | jnz .vertical_width_save |
90 | jnz .vertical_width_save |
91 | pop ecx |
91 | pop ecx |
92 | 92 | ||
93 | add ebx,4 |
93 | add ebx,4 |
94 | dec ecx |
94 | dec ecx |
95 | jnz .next_color_save |
95 | jnz .next_color_save |
96 | } |
96 | } |
97 | 97 | ||
98 | macro draw_calc_pixels brush |
98 | macro draw_calc_pixels brush |
99 | { |
99 | { |
100 | local .next_pixel_put |
100 | local .next_pixel_put |
101 | local .vertical_width |
101 | local .vertical_width |
102 | local .horizontal_width |
102 | local .horizontal_width |
103 | local .no_draw_pixel |
103 | local .no_draw_pixel |
104 | 104 | ||
105 | mov ebx,[ReserveArray] |
105 | mov ebx,[ReserveArray] |
106 | mov ecx,[ebx] |
106 | mov ecx,[ebx] |
107 | mov edx,[Color] |
107 | mov edx,[Color] |
108 | mov esi,[Color] |
108 | mov esi,[Color] |
109 | shr edx,16 |
109 | shr edx,16 |
110 | add ebx,4 |
110 | add ebx,4 |
111 | mov edi,[line_width] |
111 | mov edi,[line_width] |
112 | dec edi |
112 | dec edi |
113 | imul edi,25 |
113 | imul edi,25 |
114 | add edi,brush |
114 | add edi,brush |
115 | .next_pixel_put: |
115 | .next_pixel_put: |
116 | 116 | ||
117 | mov eax,[ebx] |
117 | mov eax,[ebx] |
118 | push eax |
118 | push eax |
119 | push ecx |
119 | push ecx |
120 | xor ebp,ebp |
120 | xor ebp,ebp |
121 | mov [counter2],5 |
121 | mov [counter2],5 |
122 | 122 | ||
123 | .vertical_width: |
123 | .vertical_width: |
124 | mov [counter],5 |
124 | mov [counter],5 |
125 | 125 | ||
126 | .horizontal_width: |
126 | .horizontal_width: |
127 | xor ecx,ecx |
127 | xor ecx,ecx |
128 | mov cl,byte[edi+ebp] |
128 | mov cl,byte[edi+ebp] |
129 | test cl,cl |
129 | test cl,cl |
130 | jz .no_draw_pixel |
130 | jz .no_draw_pixel |
131 | mov [eax],si |
131 | mov [eax],si |
132 | mov [eax+2],dl |
132 | mov [eax+2],dl |
133 | .no_draw_pixel: |
133 | .no_draw_pixel: |
134 | add eax,3 |
134 | add eax,3 |
135 | inc ebp |
135 | inc ebp |
136 | dec [counter] |
136 | dec [counter] |
137 | jnz .horizontal_width |
137 | jnz .horizontal_width |
138 | 138 | ||
139 | mov ecx,[Picture_SizeX] |
139 | mov ecx,[Picture_SizeX] |
140 | sub ecx,5 |
140 | sub ecx,5 |
141 | lea ecx,[ecx+ecx*2] |
141 | lea ecx,[ecx+ecx*2] |
142 | add eax,ecx |
142 | add eax,ecx |
143 | dec [counter2] |
143 | dec [counter2] |
144 | jnz .vertical_width |
144 | jnz .vertical_width |
145 | 145 | ||
146 | pop ecx |
146 | pop ecx |
147 | pop eax |
147 | pop eax |
148 | add ebx,4 |
148 | add ebx,4 |
149 | dec ecx |
149 | dec ecx |
150 | jnz .next_pixel_put |
150 | jnz .next_pixel_put |
151 | } |
151 | } |
152 | 152 | ||
153 | ;----------------------------------------------------------- |
153 | ;----------------------------------------------------------- |
154 | ;-----instruments of panel(icon's instruments)-------------- |
154 | ;-----instruments of panel(icon's instruments)-------------- |
155 | ;----------------------------------------------------------- |
155 | ;----------------------------------------------------------- |
156 | ;input: |
156 | ;input: |
157 | ; [Current_instrument] - instrument code |
157 | ; [Current_instrument] - instrument code |
158 | ; |
158 | ; |
159 | ; *** instrument codes *** |
159 | ; *** instrument codes *** |
160 | ;10 - pensil |
160 | ;10 - pensil |
161 | ;11 - draw brush |
161 | ;11 - draw brush |
162 | ;12 - spray |
162 | ;12 - spray |
163 | ;13 - lastik |
163 | ;13 - lastik |
164 | ;14 - flood fill |
164 | ;14 - flood fill |
165 | ;15 - pipetka |
165 | ;15 - pipetka |
166 | ;16 - draw line |
166 | ;16 - draw line |
167 | ;17 - draw rectangle |
167 | ;17 - draw rectangle |
168 | ;18 - draw circle |
168 | ;18 - draw circle |
169 | ;19 - draw ellips |
169 | ;19 - draw ellips |
170 | ;20 - draw hard contour |
170 | ;20 - draw hard contour |
171 | ;21 - allocation of a countour |
171 | ;21 - allocation of a countour |
172 | ;23 - reflection from left to right |
172 | ;23 - reflection from left to right |
173 | ;24 - reflection from up to down |
173 | ;24 - reflection from up to down |
174 | ;40 - brush 1 |
174 | ;40 - brush 1 |
175 | ;41 - brush 2 |
175 | ;41 - brush 2 |
176 | ;42 - brush 3 |
176 | ;42 - brush 3 |
177 | ;43 - brush 4 |
177 | ;43 - brush 4 |
178 | ;44 - brush 5 |
178 | ;44 - brush 5 |
179 | ;45 - zoom 1 |
179 | ;45 - zoom 1 |
180 | ;46 - zoom 2 |
180 | ;46 - zoom 2 |
181 | ;47 - zoom 3 |
181 | ;47 - zoom 3 |
182 | ;48 - zoom 4 |
182 | ;48 - zoom 4 |
183 | ;49 - zoom 8 |
183 | ;49 - zoom 8 |
184 | ;50 - zoom 16 |
184 | ;50 - zoom 16 |
185 | ;51 - palette |
185 | ;51 - palette |
186 | 186 | ||
187 | align 4 |
187 | align 4 |
188 | TakeButtonInstruments: |
188 | TakeButtonInstruments: |
189 | mov eax,[Current_instrument] |
189 | mov eax,[Current_instrument] |
190 | 190 | ||
191 | ;*************************brush 1*********************** |
191 | ;*************************brush 1*********************** |
192 | cmp eax,40 |
192 | cmp eax,40 |
193 | jne no_brush1 |
193 | jne no_brush1 |
194 | 194 | ||
195 | mov [Brush_SizeX],4 |
195 | mov [Brush_SizeX],4 |
196 | mov [Brush_SizeY],4 |
196 | mov [Brush_SizeY],4 |
197 | mov [Number_Brush],0 |
197 | mov [Number_Brush],0 |
198 | mov ebx,[Last_instrument] |
198 | mov ebx,[Last_instrument] |
199 | mov [Current_instrument],ebx |
199 | mov [Current_instrument],ebx |
200 | 200 | ||
201 | mov [line_width],1 |
201 | mov [line_width],1 |
202 | ret |
202 | ret |
203 | no_brush1: |
203 | no_brush1: |
204 | 204 | ||
205 | ;*************************brush 2*********************** |
205 | ;*************************brush 2*********************** |
206 | cmp eax,41 |
206 | cmp eax,41 |
207 | jne no_brush2 |
207 | jne no_brush2 |
208 | 208 | ||
209 | mov [Brush_SizeX],6 |
209 | mov [Brush_SizeX],6 |
210 | mov [Brush_SizeY],4 |
210 | mov [Brush_SizeY],4 |
211 | mov [Number_Brush],1 |
211 | mov [Number_Brush],1 |
212 | mov ebx,[Last_instrument] |
212 | mov ebx,[Last_instrument] |
213 | mov [Current_instrument],ebx |
213 | mov [Current_instrument],ebx |
214 | 214 | ||
215 | mov [line_width],2 |
215 | mov [line_width],2 |
216 | ret |
216 | ret |
217 | no_brush2: |
217 | no_brush2: |
218 | 218 | ||
219 | ;*************************brush 3*********************** |
219 | ;*************************brush 3*********************** |
220 | cmp eax,42 |
220 | cmp eax,42 |
221 | jne no_brush3 |
221 | jne no_brush3 |
222 | 222 | ||
223 | mov [Brush_SizeX],8 |
223 | mov [Brush_SizeX],8 |
224 | mov [Brush_SizeY],7 |
224 | mov [Brush_SizeY],7 |
225 | mov [Number_Brush],2 |
225 | mov [Number_Brush],2 |
226 | mov ebx,[Last_instrument] |
226 | mov ebx,[Last_instrument] |
227 | mov [Current_instrument],ebx |
227 | mov [Current_instrument],ebx |
228 | 228 | ||
229 | mov [line_width],3 |
229 | mov [line_width],3 |
230 | ret |
230 | ret |
231 | no_brush3: |
231 | no_brush3: |
232 | 232 | ||
233 | ;*************************brush 4*********************** |
233 | ;*************************brush 4*********************** |
234 | cmp eax,43 |
234 | cmp eax,43 |
235 | jne no_brush4 |
235 | jne no_brush4 |
236 | 236 | ||
237 | mov [Brush_SizeX],14 |
237 | mov [Brush_SizeX],14 |
238 | mov [Brush_SizeY],14 |
238 | mov [Brush_SizeY],14 |
239 | mov [Number_Brush],3 |
239 | mov [Number_Brush],3 |
240 | mov ebx,[Last_instrument] |
240 | mov ebx,[Last_instrument] |
241 | mov [Current_instrument],ebx |
241 | mov [Current_instrument],ebx |
242 | 242 | ||
243 | mov [line_width],4 |
243 | mov [line_width],4 |
244 | ret |
244 | ret |
245 | no_brush4: |
245 | no_brush4: |
246 | 246 | ||
247 | ;*************************brush 5*********************** |
247 | ;*************************brush 5*********************** |
248 | cmp eax,44 |
248 | cmp eax,44 |
249 | jne no_brush5 |
249 | jne no_brush5 |
250 | 250 | ||
251 | mov [Brush_SizeX],6 |
251 | mov [Brush_SizeX],6 |
252 | mov [Brush_SizeY],6 |
252 | mov [Brush_SizeY],6 |
253 | mov [Number_Brush],4 |
253 | mov [Number_Brush],4 |
254 | mov ebx,[Last_instrument] |
254 | mov ebx,[Last_instrument] |
255 | mov [Current_instrument],ebx |
255 | mov [Current_instrument],ebx |
256 | 256 | ||
257 | mov [line_width],5 |
257 | mov [line_width],5 |
258 | ret |
258 | ret |
259 | no_brush5: |
259 | no_brush5: |
260 | 260 | ||
261 | ;*************************pensil************************ |
261 | ;*************************pensil************************ |
262 | cmp eax,10 |
262 | cmp eax,10 |
263 | jne no_pensil |
263 | jne no_pensil |
264 | 264 | ||
265 | mov al,[exit_from_work_arrea] |
265 | mov al,[exit_from_work_arrea] |
266 | 266 | ||
267 | test al,al |
267 | test al,al |
268 | jz no_exit_from_work_arrea |
268 | jz no_exit_from_work_arrea |
269 | 269 | ||
270 | and [Activate_instrument],0 |
270 | and [Activate_instrument],0 |
271 | and [exit_from_work_arrea],0 |
271 | and [exit_from_work_arrea],0 |
272 | 272 | ||
273 | no_exit_from_work_arrea: |
273 | no_exit_from_work_arrea: |
274 | 274 | ||
275 | mov al,[Activate_instrument] |
275 | mov al,[Activate_instrument] |
276 | 276 | ||
277 | test al,al |
277 | test al,al |
278 | jnz no_activated_later |
278 | jnz no_activated_later |
279 | 279 | ||
280 | call GetScreenCordinats |
280 | call GetScreenCordinats |
281 | mov eax,[ScreenX] |
281 | mov eax,[ScreenX] |
282 | mov ebx,[ScreenY] |
282 | mov ebx,[ScreenY] |
283 | add eax,[PosX] |
283 | add eax,[PosX] |
284 | add ebx,[PosY] |
284 | add ebx,[PosY] |
285 | mov [OldX],eax |
285 | mov [OldX],eax |
286 | mov [OldY],ebx |
286 | mov [OldY],ebx |
287 | 287 | ||
288 | no_activated_later: |
288 | no_activated_later: |
289 | 289 | ||
290 | mov eax,[PointerToPicture] |
290 | mov eax,[PointerToPicture] |
291 | mov ebx,[ReserveArray] |
291 | mov ebx,[ReserveArray] |
292 | mov ecx,[Picture_SizeX] |
292 | mov ecx,[Picture_SizeX] |
293 | mov edx,[OldX] |
293 | mov edx,[OldX] |
294 | shl edx,16 |
294 | shl edx,16 |
295 | add edx,[OldY] |
295 | add edx,[OldY] |
296 | mov esi,[ScreenX] |
296 | mov esi,[ScreenX] |
297 | mov edi,[ScreenY] |
297 | mov edi,[ScreenY] |
298 | add esi,[PosX] |
298 | add esi,[PosX] |
299 | add edi,[PosY] |
299 | add edi,[PosY] |
300 | call calculate_line |
300 | call calculate_line |
301 | 301 | ||
302 | mov ecx,eax |
302 | mov ecx,eax |
303 | mov edx,[Color] |
303 | mov edx,[Color] |
304 | mov esi,[Color] |
304 | mov esi,[Color] |
305 | shr edx,16 |
305 | shr edx,16 |
306 | xor ebx,ebx |
306 | xor ebx,ebx |
307 | mov eax,[ReserveArray] |
307 | mov eax,[ReserveArray] |
308 | 308 | ||
309 | pensil_next_pixel_draw: |
309 | pensil_next_pixel_draw: |
310 | 310 | ||
311 | mov ebx,[eax] |
311 | mov ebx,[eax] |
312 | mov [ebx],si |
312 | mov [ebx],si |
313 | mov [ebx+2],dl |
313 | mov [ebx+2],dl |
314 | add eax,4 |
314 | add eax,4 |
315 | 315 | ||
316 | dec ecx |
316 | dec ecx |
317 | jnz pensil_next_pixel_draw |
317 | jnz pensil_next_pixel_draw |
318 | 318 | ||
319 | mov eax,[ScreenX] |
319 | mov eax,[ScreenX] |
320 | mov ebx,[ScreenY] |
320 | mov ebx,[ScreenY] |
321 | add eax,[PosX] |
321 | add eax,[PosX] |
322 | add ebx,[PosY] |
322 | add ebx,[PosY] |
323 | mov [OldX],eax |
323 | mov [OldX],eax |
324 | mov [OldY],ebx |
324 | mov [OldY],ebx |
325 | 325 | ||
326 | call MovePictureToWorkScreen |
326 | call MovePictureToWorkScreen |
327 | mov [Activate_instrument],1 |
327 | mov [Activate_instrument],1 |
328 | ret |
328 | ret |
329 | no_pensil: |
329 | no_pensil: |
330 | 330 | ||
331 | ;*************************draw brush******************** |
331 | ;*************************draw brush******************** |
332 | cmp eax,11 |
332 | cmp eax,11 |
333 | jne no_brush |
333 | jne no_brush |
334 | 334 | ||
335 | mov [Last_instrument],eax |
335 | mov [Last_instrument],eax |
336 | 336 | ||
337 | jmp no_lastik_ |
337 | jmp no_lastik_ |
338 | 338 | ||
339 | lastik_in: |
339 | lastik_in: |
340 | mov eax,[Color] |
340 | mov eax,[Color] |
341 | mov [SColor],eax |
341 | mov [SColor],eax |
342 | mov [Color],0xffffff |
342 | mov [Color],0xffffff |
343 | no_lastik_: |
343 | no_lastik_: |
344 | 344 | ||
345 | mov eax,[ScreenX] |
345 | mov eax,[ScreenX] |
346 | mov ebx,[ScreenY] |
346 | mov ebx,[ScreenY] |
347 | mov ecx,[Brush_SizeX] |
347 | mov ecx,[Brush_SizeX] |
348 | mov edx,[Brush_SizeY] |
348 | mov edx,[Brush_SizeY] |
349 | add eax,[PosX] |
349 | add eax,[PosX] |
350 | add ebx,[PosY] |
350 | add ebx,[PosY] |
351 | add eax,ecx |
351 | add eax,ecx |
352 | add ebx,edx |
352 | add ebx,edx |
353 | 353 | ||
354 | cmp eax,[Picture_SizeX] |
354 | cmp eax,[Picture_SizeX] |
355 | jl no_max_pos_x |
355 | jl no_max_pos_x |
356 | mov eax,[Picture_SizeX] |
356 | mov eax,[Picture_SizeX] |
357 | no_max_pos_x: |
357 | no_max_pos_x: |
358 | 358 | ||
359 | cmp ebx,[Picture_SizeY] |
359 | cmp ebx,[Picture_SizeY] |
360 | jl no_max_pos_y |
360 | jl no_max_pos_y |
361 | mov ebx,[Picture_SizeY] |
361 | mov ebx,[Picture_SizeY] |
362 | no_max_pos_y: |
362 | no_max_pos_y: |
363 | 363 | ||
364 | cmp eax,ecx |
364 | cmp eax,ecx |
365 | ja no_min_pos_x |
365 | ja no_min_pos_x |
366 | mov eax,[Brush_SizeX] |
366 | mov eax,[Brush_SizeX] |
367 | no_min_pos_x: |
367 | no_min_pos_x: |
368 | 368 | ||
369 | cmp ebx,edx |
369 | cmp ebx,edx |
370 | ja no_min_pos_y |
370 | ja no_min_pos_y |
371 | mov ebx,[Brush_SizeY] |
371 | mov ebx,[Brush_SizeY] |
372 | no_min_pos_y: |
372 | no_min_pos_y: |
373 | 373 | ||
374 | sub eax,[Brush_SizeX] |
374 | sub eax,[Brush_SizeX] |
375 | sub ebx,[Brush_SizeY] |
375 | sub ebx,[Brush_SizeY] |
376 | 376 | ||
377 | mov [x],eax |
377 | mov [x],eax |
378 | mov [y],ebx |
378 | mov [y],ebx |
379 | 379 | ||
380 | mov al,[exit_from_work_arrea] |
380 | mov al,[exit_from_work_arrea] |
381 | test al,al |
381 | test al,al |
382 | jz no_exit_from_work_arrea_brush |
382 | jz no_exit_from_work_arrea_brush |
383 | and [Activate_instrument],0 |
383 | and [Activate_instrument],0 |
384 | and [exit_from_work_arrea],0 |
384 | and [exit_from_work_arrea],0 |
385 | no_exit_from_work_arrea_brush: |
385 | no_exit_from_work_arrea_brush: |
386 | 386 | ||
387 | mov al,[Activate_instrument] |
387 | mov al,[Activate_instrument] |
388 | test al,al |
388 | test al,al |
389 | jnz no_new_brush_xy |
389 | jnz no_new_brush_xy |
390 | mov eax,[x] |
390 | mov eax,[x] |
391 | mov ebx,[y] |
391 | mov ebx,[y] |
392 | mov [OldX],eax |
392 | mov [OldX],eax |
393 | mov [OldY],ebx |
393 | mov [OldY],ebx |
394 | mov [Activate_instrument],1 |
394 | mov [Activate_instrument],1 |
395 | no_new_brush_xy: |
395 | no_new_brush_xy: |
396 | 396 | ||
397 | mov eax,[PointerToPicture] |
397 | mov eax,[PointerToPicture] |
398 | mov ebx,[ReserveArray] |
398 | mov ebx,[ReserveArray] |
399 | add ebx,4 |
399 | add ebx,4 |
400 | mov ecx,[Picture_SizeX] |
400 | mov ecx,[Picture_SizeX] |
401 | mov edx,[OldX] |
401 | mov edx,[OldX] |
402 | shl edx,16 |
402 | shl edx,16 |
403 | add edx,[OldY] |
403 | add edx,[OldY] |
404 | mov esi,[x] |
404 | mov esi,[x] |
405 | mov edi,[y] |
405 | mov edi,[y] |
406 | 406 | ||
407 | call calculate_line |
407 | call calculate_line |
408 | 408 | ||
409 | mov ebx,[ReserveArray] |
409 | mov ebx,[ReserveArray] |
410 | mov [ebx],eax |
410 | mov [ebx],eax |
411 | 411 | ||
412 | ;procedure drawing of brush |
412 | ;procedure drawing of brush |
413 | mov ebx,[ReserveArray] |
413 | mov ebx,[ReserveArray] |
414 | mov ecx,[ebx] |
414 | mov ecx,[ebx] |
415 | mov edx,[Color] |
415 | mov edx,[Color] |
416 | mov esi,[Color] |
416 | mov esi,[Color] |
417 | shr edx,16 |
417 | shr edx,16 |
418 | add ebx,4 |
418 | add ebx,4 |
419 | mov edi,[Number_Brush] |
419 | mov edi,[Number_Brush] |
420 | imul edi,20*20 |
420 | imul edi,20*20 |
421 | 421 | ||
422 | next_pixel_put_brush: |
422 | next_pixel_put_brush: |
423 | 423 | ||
424 | mov eax,[ebx] |
424 | mov eax,[ebx] |
425 | push eax |
425 | push eax |
426 | push ecx |
426 | push ecx |
427 | xor ebp,ebp |
427 | xor ebp,ebp |
428 | and [counter2],0 |
428 | and [counter2],0 |
429 | 429 | ||
430 | vertical_width_brush: |
430 | vertical_width_brush: |
431 | and [counter],0 |
431 | and [counter],0 |
432 | 432 | ||
433 | horizontal_width_brush: |
433 | horizontal_width_brush: |
434 | xor ecx,ecx |
434 | xor ecx,ecx |
435 | mov cl,byte[Brush_color+edi+ebp] |
435 | mov cl,byte[Brush_color+edi+ebp] |
436 | test cl,cl |
436 | test cl,cl |
437 | jz no_draw_pixel_brush |
437 | jz no_draw_pixel_brush |
438 | mov [eax],si |
438 | mov [eax],si |
439 | mov [eax+2],dl |
439 | mov [eax+2],dl |
440 | no_draw_pixel_brush: |
440 | no_draw_pixel_brush: |
441 | add eax,3 |
441 | add eax,3 |
442 | inc ebp |
442 | inc ebp |
443 | inc [counter] |
443 | inc [counter] |
444 | cmp [counter],20 |
444 | cmp [counter],20 |
445 | jne horizontal_width_brush |
445 | jne horizontal_width_brush |
446 | 446 | ||
447 | mov ecx,[Picture_SizeX] |
447 | mov ecx,[Picture_SizeX] |
448 | sub ecx,20 |
448 | sub ecx,20 |
449 | lea ecx,[ecx+ecx*2] |
449 | lea ecx,[ecx+ecx*2] |
450 | add eax,ecx |
450 | add eax,ecx |
451 | inc [counter2] |
451 | inc [counter2] |
452 | cmp [counter2],20 |
452 | cmp [counter2],20 |
453 | jne vertical_width_brush |
453 | jne vertical_width_brush |
454 | 454 | ||
455 | pop ecx |
455 | pop ecx |
456 | pop eax |
456 | pop eax |
457 | add ebx,4 |
457 | add ebx,4 |
458 | dec ecx |
458 | dec ecx |
459 | jnz next_pixel_put_brush |
459 | jnz next_pixel_put_brush |
460 | 460 | ||
461 | mov eax,[x] |
461 | mov eax,[x] |
462 | mov ebx,[y] |
462 | mov ebx,[y] |
463 | mov [OldX],eax |
463 | mov [OldX],eax |
464 | mov [OldY],ebx |
464 | mov [OldY],ebx |
465 | 465 | ||
466 | mov al,[lastik_is_active] |
466 | mov al,[lastik_is_active] |
467 | test al,al |
467 | test al,al |
468 | jz no_lastik_active |
468 | jz no_lastik_active |
469 | 469 | ||
470 | mov eax,[SColor] |
470 | mov eax,[SColor] |
471 | mov [Color],eax |
471 | mov [Color],eax |
472 | and [lastik_is_active],0 |
472 | and [lastik_is_active],0 |
473 | no_lastik_active: |
473 | no_lastik_active: |
474 | 474 | ||
475 | call MovePictureToWorkScreen |
475 | call MovePictureToWorkScreen |
476 | mov eax,[Current_instrument] |
476 | mov eax,[Current_instrument] |
477 | mov [Last_instrument],eax |
477 | mov [Last_instrument],eax |
478 | 478 | ||
479 | ret |
479 | ret |
480 | no_brush: |
480 | no_brush: |
481 | 481 | ||
482 | ;*************************pipetka*********************** |
482 | ;*************************pipetka*********************** |
483 | cmp eax,15 |
483 | cmp eax,15 |
484 | jne no_pipetka |
484 | jne no_pipetka |
485 | 485 | ||
486 | mov eax,[ScreenY] |
486 | mov eax,[ScreenY] |
487 | mov ebx,[Picture_SizeX] |
487 | mov ebx,[Picture_SizeX] |
488 | add eax,[PosY] |
488 | add eax,[PosY] |
489 | imul eax,ebx |
489 | imul eax,ebx |
490 | add eax,[ScreenX] |
490 | add eax,[ScreenX] |
491 | add eax,[PosX] |
491 | add eax,[PosX] |
492 | lea eax,[eax+eax*2] |
492 | lea eax,[eax+eax*2] |
493 | add eax,[PointerToPicture] |
493 | add eax,[PointerToPicture] |
494 | mov ebx,[eax] |
494 | mov ebx,[eax] |
495 | and ebx,0xffffff |
495 | and ebx,0xffffff |
496 | mov [Color],ebx |
496 | mov [Color],ebx |
497 | 497 | ||
498 | mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\ |
498 | mcall SF_DRAW_RECT, ((ci_panel_x_pos+130) shl 16)+21,\ |
499 | ((ci_panel_y_pos+28) shl 16)+21, [Color] |
499 | ((ci_panel_y_pos+28) shl 16)+21, [Color] |
500 | 500 | ||
501 | ret |
501 | ret |
502 | no_pipetka: |
502 | no_pipetka: |
503 | 503 | ||
504 | ;************************lastik************************* |
504 | ;************************lastik************************* |
505 | cmp eax,13 |
505 | cmp eax,13 |
506 | jne no_lastik |
506 | jne no_lastik |
507 | 507 | ||
508 | mov [Last_instrument],eax |
508 | mov [Last_instrument],eax |
509 | mov [lastik_is_active],1 |
509 | mov [lastik_is_active],1 |
510 | jmp lastik_in |
510 | jmp lastik_in |
511 | no_lastik: |
511 | no_lastik: |
512 | 512 | ||
513 | ;************************Flood Fill********************* |
513 | ;************************Flood Fill********************* |
514 | cmp eax,14 |
514 | cmp eax,14 |
515 | jne no_FloodFill |
515 | jne no_FloodFill |
516 | 516 | ||
517 | mov eax,[PointerToPicture] |
517 | mov eax,[PointerToPicture] |
518 | mov ebx,[PointerToEditBufer] |
518 | mov ebx,[PointerToEditBufer] |
519 | 519 | ||
520 | mov ecx,[Picture_SizeX] |
520 | mov ecx,[Picture_SizeX] |
521 | imul ecx,[Picture_SizeY] |
521 | imul ecx,[Picture_SizeY] |
522 | lea ecx,[ecx+ecx*2] |
522 | lea ecx,[ecx+ecx*2] |
523 | shl ecx,1 |
523 | shl ecx,1 |
524 | 524 | ||
525 | cmp ecx,mem_flood_f |
525 | cmp ecx,mem_flood_f |
526 | ja normal_size_of_bufer |
526 | ja normal_size_of_bufer |
527 | 527 | ||
528 | mov ebx,[ReserveArray] |
528 | mov ebx,[ReserveArray] |
529 | 529 | ||
530 | normal_size_of_bufer: |
530 | normal_size_of_bufer: |
531 | 531 | ||
532 | add ebx,4 |
532 | add ebx,4 |
533 | mov ecx,[Picture_SizeX] |
533 | mov ecx,[Picture_SizeX] |
534 | mov edx,[ScreenX] |
534 | mov edx,[ScreenX] |
535 | add edx,[PosX] |
535 | add edx,[PosX] |
536 | shl edx,16 |
536 | shl edx,16 |
537 | add edx,[ScreenY] |
537 | add edx,[ScreenY] |
538 | add edx,[PosY] |
538 | add edx,[PosY] |
539 | mov esi,[Picture_SizeX] |
539 | mov esi,[Picture_SizeX] |
540 | dec esi |
540 | dec esi |
541 | shl esi,16 |
541 | shl esi,16 |
542 | add esi,[Picture_SizeY] |
542 | add esi,[Picture_SizeY] |
543 | dec esi |
543 | dec esi |
544 | mov edi,[Color] |
544 | mov edi,[Color] |
545 | 545 | ||
546 | call flood_fill |
546 | call flood_fill |
547 | call MovePictureToWorkScreen |
547 | call MovePictureToWorkScreen |
548 | ret |
548 | ret |
549 | no_FloodFill: |
549 | no_FloodFill: |
550 | 550 | ||
551 | ;************************spray************************** |
551 | ;************************spray************************** |
552 | cmp eax,12 |
552 | cmp eax,12 |
553 | jne no_spray |
553 | jne no_spray |
554 | 554 | ||
555 | cmp [Activate_instrument],0 |
555 | cmp [Activate_instrument],0 |
556 | jne no_null_spray |
556 | jne no_null_spray |
557 | mov [Activate_instrument],1 |
557 | mov [Activate_instrument],1 |
558 | ret |
558 | ret |
559 | no_null_spray: |
559 | no_null_spray: |
560 | 560 | ||
561 | mov eax,[ScreenX] |
561 | mov eax,[ScreenX] |
562 | mov ebx,[ScreenY] |
562 | mov ebx,[ScreenY] |
563 | mov ecx,[Brush_SizeX] |
563 | mov ecx,[Brush_SizeX] |
564 | mov edx,[Brush_SizeY] |
564 | mov edx,[Brush_SizeY] |
565 | add eax,[PosX] |
565 | add eax,[PosX] |
566 | add ebx,[PosY] |
566 | add ebx,[PosY] |
567 | add eax,ecx |
567 | add eax,ecx |
568 | add ebx,edx |
568 | add ebx,edx |
569 | 569 | ||
570 | cmp eax,[Picture_SizeX] |
570 | cmp eax,[Picture_SizeX] |
571 | jl no_max_pos_x_spray |
571 | jl no_max_pos_x_spray |
572 | mov eax,[Picture_SizeX] |
572 | mov eax,[Picture_SizeX] |
573 | no_max_pos_x_spray: |
573 | no_max_pos_x_spray: |
574 | 574 | ||
575 | cmp ebx,[Picture_SizeY] |
575 | cmp ebx,[Picture_SizeY] |
576 | jl no_max_pos_y_spray |
576 | jl no_max_pos_y_spray |
577 | mov ebx,[Picture_SizeY] |
577 | mov ebx,[Picture_SizeY] |
578 | no_max_pos_y_spray: |
578 | no_max_pos_y_spray: |
579 | 579 | ||
580 | cmp eax,ecx |
580 | cmp eax,ecx |
581 | ja no_min_pos_x_spray |
581 | ja no_min_pos_x_spray |
582 | mov eax,[Brush_SizeX] |
582 | mov eax,[Brush_SizeX] |
583 | no_min_pos_x_spray: |
583 | no_min_pos_x_spray: |
584 | 584 | ||
585 | cmp ebx,edx |
585 | cmp ebx,edx |
586 | ja no_min_pos_y_spray |
586 | ja no_min_pos_y_spray |
587 | mov ebx,[Brush_SizeY] |
587 | mov ebx,[Brush_SizeY] |
588 | no_min_pos_y_spray: |
588 | no_min_pos_y_spray: |
589 | 589 | ||
590 | sub eax,[Brush_SizeX] |
590 | sub eax,[Brush_SizeX] |
591 | sub ebx,[Brush_SizeY] |
591 | sub ebx,[Brush_SizeY] |
592 | mov edi,0;[Number_Brush] |
592 | mov edi,0;[Number_Brush] |
593 | imul edi,20*20 |
593 | imul edi,20*20 |
594 | 594 | ||
595 | mov [x],eax |
595 | mov [x],eax |
596 | mov [y],ebx |
596 | mov [y],ebx |
597 | mov ebp,[Picture_SizeX] |
597 | mov ebp,[Picture_SizeX] |
598 | xor edx,edx |
598 | xor edx,edx |
599 | brush_y_spray: |
599 | brush_y_spray: |
600 | xor ecx,ecx |
600 | xor ecx,ecx |
601 | brush_x_spray: |
601 | brush_x_spray: |
602 | ;calculate position in array of spray |
602 | ;calculate position in array of spray |
603 | mov esi,edx |
603 | mov esi,edx |
604 | lea esi,[esi+esi*4] ;esi=esi*5 |
604 | lea esi,[esi+esi*4] ;esi=esi*5 |
605 | shl esi,2 ;esi=(esi*3)*4 |
605 | shl esi,2 ;esi=(esi*3)*4 |
606 | add esi,ecx |
606 | add esi,ecx |
607 | add esi,edi |
607 | add esi,edi |
608 | ;read byte from array |
608 | ;read byte from array |
609 | xor eax,eax |
609 | xor eax,eax |
610 | mov al,[Spray_color+esi] |
610 | mov al,[Spray_color+esi] |
611 | test eax,eax |
611 | test eax,eax |
612 | jz no_color_spray |
612 | jz no_color_spray |
613 | mov eax,[x] |
613 | mov eax,[x] |
614 | mov ebx,[y] |
614 | mov ebx,[y] |
615 | add eax,ecx |
615 | add eax,ecx |
616 | add ebx,edx |
616 | add ebx,edx |
617 | imul ebx,ebp; ebp=[Picture_SizeX] |
617 | imul ebx,ebp; ebp=[Picture_SizeX] |
618 | add eax,ebx |
618 | add eax,ebx |
619 | lea eax,[eax+eax*2] |
619 | lea eax,[eax+eax*2] |
620 | add eax,[PointerToPicture] |
620 | add eax,[PointerToPicture] |
621 | mov ebx,[Color] |
621 | mov ebx,[Color] |
622 | mov [eax],bx |
622 | mov [eax],bx |
623 | shr ebx,16 |
623 | shr ebx,16 |
624 | mov [eax+2],bl |
624 | mov [eax+2],bl |
625 | no_color_spray: |
625 | no_color_spray: |
626 | inc ecx |
626 | inc ecx |
627 | cmp ecx,20 |
627 | cmp ecx,20 |
628 | jl brush_x_spray |
628 | jl brush_x_spray |
629 | inc edx |
629 | inc edx |
630 | cmp edx,20 |
630 | cmp edx,20 |
631 | jl brush_y_spray |
631 | jl brush_y_spray |
632 | 632 | ||
633 | call MovePictureToWorkScreen |
633 | call MovePictureToWorkScreen |
634 | ret |
634 | ret |
635 | no_spray: |
635 | no_spray: |
636 | 636 | ||
637 | ;************************palette************************ |
637 | ;************************palette************************ |
638 | cmp eax,51 |
638 | cmp eax,51 |
639 | jne no_palette |
639 | jne no_palette |
640 | 640 | ||
641 | mov eax,20 |
641 | mov eax,20 |
642 | mov ebx,ci_palete_y_pos |
642 | mov ebx,ci_palete_y_pos |
643 | mov ecx,32*10+32*5+7 |
643 | mov ecx,32*10+32*5+7 |
644 | mov edx,140 |
644 | mov edx,140 |
645 | mov esi,1 |
645 | mov esi,1 |
646 | call draw_volume_rectangle |
646 | call draw_volume_rectangle |
647 | mov [x],20+5 |
647 | mov [x],20+5 |
648 | mov [y],ci_palete_y_pos+10 |
648 | mov [y],ci_palete_y_pos+10 |
649 | mov edi,256 |
649 | mov edi,256 |
650 | xor esi,esi |
650 | xor esi,esi |
651 | next_rectangle: |
651 | next_rectangle: |
652 | mov ebx,[x] |
652 | mov ebx,[x] |
653 | mov ecx,[y] |
653 | mov ecx,[y] |
654 | mov edx,[palitra+esi] |
654 | mov edx,[palitra+esi] |
655 | and edx,0xffffff |
655 | and edx,0xffffff |
656 | shl ebx,16 |
656 | shl ebx,16 |
657 | shl ecx,16 |
657 | shl ecx,16 |
658 | add ebx,13 |
658 | add ebx,13 |
659 | add ecx,13 |
659 | add ecx,13 |
660 | mcall SF_DRAW_RECT |
660 | mcall SF_DRAW_RECT |
661 | add [x],15 |
661 | add [x],15 |
662 | cmp [x],20+15*32 |
662 | cmp [x],20+15*32 |
663 | jl no_new_line |
663 | jl no_new_line |
664 | mov [x],20+5 |
664 | mov [x],20+5 |
665 | add [y],15 |
665 | add [y],15 |
666 | no_new_line: |
666 | no_new_line: |
667 | add esi,4 |
667 | add esi,4 |
668 | dec edi |
668 | dec edi |
669 | jnz next_rectangle |
669 | jnz next_rectangle |
670 | 670 | ||
671 | wait_events: |
671 | wait_events: |
672 | mcall SF_WAIT_EVENT |
672 | mcall SF_WAIT_EVENT |
673 | 673 | ||
674 | cmp eax,1 |
674 | cmp eax,1 |
675 | jne @f |
675 | jne @f |
676 | ret |
676 | ret |
677 | @@: |
677 | @@: |
678 | cmp eax,2 |
678 | cmp eax,2 |
679 | jne no_keys |
679 | jne no_keys |
680 | mcall SF_GET_KEY |
680 | mcall SF_GET_KEY |
681 | jmp wait_events |
681 | jmp wait_events |
682 | no_keys: |
682 | no_keys: |
683 | cmp eax,3 |
683 | cmp eax,3 |
684 | jne no_buttons |
684 | jne no_buttons |
685 | mcall SF_GET_BUTTON |
685 | mcall SF_GET_BUTTON |
686 | jmp wait_events |
686 | jmp wait_events |
687 | no_buttons: |
687 | no_buttons: |
688 | cmp eax,6 |
688 | cmp eax,6 |
689 | jne wait_events |
689 | jne wait_events |
690 | 690 | ||
691 | call GetMouseClick |
691 | call GetMouseClick |
692 | 692 | ||
693 | test eax,eax |
693 | test eax,eax |
694 | jz wait_events |
694 | jz wait_events |
695 | call GetMouseCoordinats |
695 | call GetMouseCoordinats |
696 | mov [x],20+5 |
696 | mov [x],20+5 |
697 | mov [y],ci_palete_y_pos+10 |
697 | mov [y],ci_palete_y_pos+10 |
698 | mov [counter],0 |
698 | mov [counter],0 |
699 | next_rectangle_column: |
699 | next_rectangle_column: |
700 | mov eax,[x] |
700 | mov eax,[x] |
701 | mov ebx,[y] |
701 | mov ebx,[y] |
702 | mov ecx,[MouseX] |
702 | mov ecx,[MouseX] |
703 | mov edx,[MouseY] |
703 | mov edx,[MouseY] |
704 | mov esi,13 |
704 | mov esi,13 |
705 | mov edi,13 |
705 | mov edi,13 |
706 | call columnus |
706 | call columnus |
707 | test eax,eax |
707 | test eax,eax |
708 | jz no_columnus_color |
708 | jz no_columnus_color |
709 | 709 | ||
710 | mov eax,[counter] |
710 | mov eax,[counter] |
711 | shl eax,2 |
711 | shl eax,2 |
712 | mov ebx,[palitra+eax] |
712 | mov ebx,[palitra+eax] |
713 | and ebx,0xffffff |
713 | and ebx,0xffffff |
714 | mov [Color],ebx |
714 | mov [Color],ebx |
715 | no_columnus_color: |
715 | no_columnus_color: |
716 | 716 | ||
717 | add [x],15 |
717 | add [x],15 |
718 | 718 | ||
719 | cmp [x],20+15*32 |
719 | cmp [x],20+15*32 |
720 | jl no_new_line_column |
720 | jl no_new_line_column |
721 | 721 | ||
722 | mov [x],20+5 |
722 | mov [x],20+5 |
723 | add [y],15 |
723 | add [y],15 |
724 | no_new_line_column: |
724 | no_new_line_column: |
725 | 725 | ||
726 | inc [counter] |
726 | inc [counter] |
727 | 727 | ||
728 | cmp [counter],257 |
728 | cmp [counter],257 |
729 | jne next_rectangle_column |
729 | jne next_rectangle_column |
730 | 730 | ||
731 | mcall SF_SLEEP,10 |
731 | mcall SF_SLEEP,10 |
732 | 732 | ||
733 | call drawwin |
733 | call drawwin |
734 | 734 | ||
735 | mov eax,[Last_instrument] |
735 | mov eax,[Last_instrument] |
736 | mov [Current_instrument],eax |
736 | mov [Current_instrument],eax |
737 | ret |
737 | ret |
738 | no_palette: |
738 | no_palette: |
739 | 739 | ||
740 | ;************************draw line********************** |
740 | ;************************draw line********************** |
741 | cmp eax,16 |
741 | cmp eax,16 |
742 | jne no_line |
742 | jne no_line |
743 | 743 | ||
744 | mov [Last_instrument],eax |
744 | mov [Last_instrument],eax |
745 | 745 | ||
746 | mov al,[Activate_instrument] |
746 | mov al,[Activate_instrument] |
747 | test al,al |
747 | test al,al |
748 | jnz no_new_line_xy |
748 | jnz no_new_line_xy |
749 | mov eax,[ScreenX] |
749 | mov eax,[ScreenX] |
750 | mov ebx,[ScreenY] |
750 | mov ebx,[ScreenY] |
751 | add eax,[PosX] |
751 | add eax,[PosX] |
752 | add ebx,[PosY] |
752 | add ebx,[PosY] |
753 | mov [OldX],eax |
753 | mov [OldX],eax |
754 | mov [OldY],ebx |
754 | mov [OldY],ebx |
755 | mov [Activate_instrument],1 |
755 | mov [Activate_instrument],1 |
756 | xor eax,eax |
756 | xor eax,eax |
757 | mov ecx,mem_flood_f/4 |
757 | mov ecx,mem_flood_f/4 |
758 | mov edi,[ReserveArray] |
758 | mov edi,[ReserveArray] |
759 | cld |
759 | cld |
760 | rep stosd |
760 | rep stosd |
761 | ret |
761 | ret |
762 | no_new_line_xy: |
762 | no_new_line_xy: |
763 | 763 | ||
764 | ;put saved pixels |
764 | ;put saved pixels |
765 | square_width_put |
765 | square_width_put |
766 | 766 | ||
767 | ;calculate line |
767 | ;calculate line |
768 | mov ebx,[ReserveArray] |
768 | mov ebx,[ReserveArray] |
769 | add ebx,4 |
769 | add ebx,4 |
770 | mov eax,[PointerToPicture] |
770 | mov eax,[PointerToPicture] |
771 | mov ecx,[Picture_SizeX] |
771 | mov ecx,[Picture_SizeX] |
772 | mov edx,[OldX] |
772 | mov edx,[OldX] |
773 | shl edx,16 |
773 | shl edx,16 |
774 | add edx,[OldY] |
774 | add edx,[OldY] |
775 | mov esi,[ScreenX] |
775 | mov esi,[ScreenX] |
776 | mov edi,[ScreenY] |
776 | mov edi,[ScreenY] |
777 | add esi,[PosX] |
777 | add esi,[PosX] |
778 | add edi,[PosY] |
778 | add edi,[PosY] |
779 | 779 | ||
780 | mov ebp,[Picture_SizeX] |
780 | mov ebp,[Picture_SizeX] |
781 | sub ebp,[line_width] |
781 | sub ebp,[line_width] |
782 | cmp esi,ebp |
782 | cmp esi,ebp |
783 | jl no_minimum_x_line |
783 | jl no_minimum_x_line |
784 | mov esi,ebp |
784 | mov esi,ebp |
785 | no_minimum_x_line: |
785 | no_minimum_x_line: |
786 | 786 | ||
787 | mov ebp,[Picture_SizeY] |
787 | mov ebp,[Picture_SizeY] |
788 | sub ebp,[line_width] |
788 | sub ebp,[line_width] |
789 | cmp edi,ebp |
789 | cmp edi,ebp |
790 | jl no_minimum_y_line |
790 | jl no_minimum_y_line |
791 | mov edi,ebp |
791 | mov edi,ebp |
792 | no_minimum_y_line: |
792 | no_minimum_y_line: |
793 | 793 | ||
794 | call calculate_line |
794 | call calculate_line |
795 | 795 | ||
796 | ;save color pixels in ReserveArray |
796 | ;save color pixels in ReserveArray |
797 | square_width_save |
797 | square_width_save |
798 | 798 | ||
799 | ;draw calculated pixels on work arrea |
799 | ;draw calculated pixels on work arrea |
800 | draw_calc_pixels width_pixels |
800 | draw_calc_pixels width_pixels |
801 | 801 | ||
802 | call MovePictureToWorkScreen |
802 | call MovePictureToWorkScreen |
803 | ret |
803 | ret |
804 | no_line: |
804 | no_line: |
805 | 805 | ||
806 | ;************************draw rectangle***************** |
806 | ;************************draw rectangle***************** |
807 | cmp eax,17 |
807 | cmp eax,17 |
808 | jne no_rectangle |
808 | jne no_rectangle |
809 | 809 | ||
810 | mov [Last_instrument],eax |
810 | mov [Last_instrument],eax |
811 | 811 | ||
812 | mov al,[Activate_instrument] |
812 | mov al,[Activate_instrument] |
813 | test al,al |
813 | test al,al |
814 | jnz no_new_rectangle_xy |
814 | jnz no_new_rectangle_xy |
815 | mov eax,[ScreenX] |
815 | mov eax,[ScreenX] |
816 | mov ebx,[ScreenY] |
816 | mov ebx,[ScreenY] |
817 | add eax,[PosX] |
817 | add eax,[PosX] |
818 | add ebx,[PosY] |
818 | add ebx,[PosY] |
819 | mov [OldX],eax |
819 | mov [OldX],eax |
820 | mov [OldY],ebx |
820 | mov [OldY],ebx |
821 | mov [Activate_instrument],1 |
821 | mov [Activate_instrument],1 |
822 | xor eax,eax |
822 | xor eax,eax |
823 | mov ecx,mem_flood_f/4 |
823 | mov ecx,mem_flood_f/4 |
824 | mov edi,[ReserveArray] |
824 | mov edi,[ReserveArray] |
825 | cld |
825 | cld |
826 | rep stosd |
826 | rep stosd |
827 | ret |
827 | ret |
828 | no_new_rectangle_xy: |
828 | no_new_rectangle_xy: |
829 | 829 | ||
830 | ;put saved pixels |
830 | ;put saved pixels |
831 | square_width_put |
831 | square_width_put |
832 | 832 | ||
833 | ;calculate line |
833 | ;calculate line |
834 | mov ebx,[ReserveArray] |
834 | mov ebx,[ReserveArray] |
835 | add ebx,4 |
835 | add ebx,4 |
836 | mov eax,[PointerToPicture] |
836 | mov eax,[PointerToPicture] |
837 | mov ecx,[Picture_SizeX] |
837 | mov ecx,[Picture_SizeX] |
838 | mov edx,[OldX] |
838 | mov edx,[OldX] |
839 | shl edx,16 |
839 | shl edx,16 |
840 | add edx,[OldY] |
840 | add edx,[OldY] |
841 | mov esi,[ScreenX] |
841 | mov esi,[ScreenX] |
842 | mov edi,[ScreenY] |
842 | mov edi,[ScreenY] |
843 | add esi,[PosX] |
843 | add esi,[PosX] |
844 | add edi,[PosY] |
844 | add edi,[PosY] |
845 | 845 | ||
846 | mov ebp,[Picture_SizeX] |
846 | mov ebp,[Picture_SizeX] |
847 | sub ebp,[line_width] |
847 | sub ebp,[line_width] |
848 | cmp esi,ebp |
848 | cmp esi,ebp |
849 | jl no_minimum_x_rectangle |
849 | jl no_minimum_x_rectangle |
850 | mov esi,ebp |
850 | mov esi,ebp |
851 | no_minimum_x_rectangle: |
851 | no_minimum_x_rectangle: |
852 | 852 | ||
853 | mov ebp,[Picture_SizeY] |
853 | mov ebp,[Picture_SizeY] |
854 | sub ebp,[line_width] |
854 | sub ebp,[line_width] |
855 | cmp edi,ebp |
855 | cmp edi,ebp |
856 | jl no_minimum_y_rectangle |
856 | jl no_minimum_y_rectangle |
857 | mov edi,ebp |
857 | mov edi,ebp |
858 | no_minimum_y_rectangle: |
858 | no_minimum_y_rectangle: |
859 | 859 | ||
860 | call calculate_rectangle |
860 | call calculate_rectangle |
861 | 861 | ||
862 | ;save color pixels in ReserveArray |
862 | ;save color pixels in ReserveArray |
863 | square_width_save |
863 | square_width_save |
864 | 864 | ||
865 | ;draw calculated pixels on work arrea |
865 | ;draw calculated pixels on work arrea |
866 | draw_calc_pixels width_pixels_rectangle |
866 | draw_calc_pixels width_pixels_rectangle |
867 | 867 | ||
868 | call MovePictureToWorkScreen |
868 | call MovePictureToWorkScreen |
869 | ret |
869 | ret |
870 | no_rectangle: |
870 | no_rectangle: |
871 | 871 | ||
872 | ;************************draw circle******************** |
872 | ;************************draw circle******************** |
873 | cmp eax,18 |
873 | cmp eax,18 |
874 | jne no_circle |
874 | jne no_circle |
875 | 875 | ||
876 | mov [Last_instrument],eax |
876 | mov [Last_instrument],eax |
877 | 877 | ||
878 | mov al,[Activate_instrument] |
878 | mov al,[Activate_instrument] |
879 | test al,al |
879 | test al,al |
880 | jnz no_new_circle_xy |
880 | jnz no_new_circle_xy |
881 | mov eax,[ScreenX] |
881 | mov eax,[ScreenX] |
882 | mov ebx,[ScreenY] |
882 | mov ebx,[ScreenY] |
883 | add eax,[PosX] |
883 | add eax,[PosX] |
884 | add ebx,[PosY] |
884 | add ebx,[PosY] |
885 | mov [OldX],eax |
885 | mov [OldX],eax |
886 | mov [OldY],ebx |
886 | mov [OldY],ebx |
887 | mov [Activate_instrument],1 |
887 | mov [Activate_instrument],1 |
888 | xor eax,eax |
888 | xor eax,eax |
889 | mov ecx,mem_flood_f/4 |
889 | mov ecx,mem_flood_f/4 |
890 | mov edi,[ReserveArray] |
890 | mov edi,[ReserveArray] |
891 | cld |
891 | cld |
892 | rep stosd |
892 | rep stosd |
893 | ret |
893 | ret |
894 | no_new_circle_xy: |
894 | no_new_circle_xy: |
895 | 895 | ||
896 | ;put saved pixels |
896 | ;put saved pixels |
897 | square_width_put |
897 | square_width_put |
898 | 898 | ||
899 | mov esi,[ScreenX] |
899 | mov esi,[ScreenX] |
900 | mov edi,[ScreenY] |
900 | mov edi,[ScreenY] |
901 | add esi,[PosX] |
901 | add esi,[PosX] |
902 | add edi,[PosY] |
902 | add edi,[PosY] |
903 | 903 | ||
904 | sub esi,[OldX] |
904 | sub esi,[OldX] |
905 | jns no_sign_x_circle |
905 | jns no_sign_x_circle |
906 | neg esi |
906 | neg esi |
907 | shr esi,1 |
907 | shr esi,1 |
908 | neg esi |
908 | neg esi |
909 | add esi,[OldX] |
909 | add esi,[OldX] |
910 | jmp no_plus_sign_x_circle |
910 | jmp no_plus_sign_x_circle |
911 | no_sign_x_circle: |
911 | no_sign_x_circle: |
912 | 912 | ||
913 | shr esi,1 |
913 | shr esi,1 |
914 | add esi,[OldX] |
914 | add esi,[OldX] |
915 | no_plus_sign_x_circle: |
915 | no_plus_sign_x_circle: |
916 | 916 | ||
917 | sub edi,[OldY] |
917 | sub edi,[OldY] |
918 | jns no_sign_y_circle |
918 | jns no_sign_y_circle |
919 | neg edi |
919 | neg edi |
920 | shr edi,1 |
920 | shr edi,1 |
921 | neg edi |
921 | neg edi |
922 | add edi,[OldY] |
922 | add edi,[OldY] |
923 | jmp no_plus_sign_y_circle |
923 | jmp no_plus_sign_y_circle |
924 | no_sign_y_circle: |
924 | no_sign_y_circle: |
925 | 925 | ||
926 | shr edi,1 |
926 | shr edi,1 |
927 | add edi,[OldY] |
927 | add edi,[OldY] |
928 | no_plus_sign_y_circle: |
928 | no_plus_sign_y_circle: |
929 | 929 | ||
930 | mov [x],esi |
930 | mov [x],esi |
931 | mov [y],edi |
931 | mov [y],edi |
932 | 932 | ||
933 | mov esi,[ScreenX] |
933 | mov esi,[ScreenX] |
934 | mov edi,[ScreenY] |
934 | mov edi,[ScreenY] |
935 | add esi,[PosX] |
935 | add esi,[PosX] |
936 | add edi,[PosY] |
936 | add edi,[PosY] |
937 | 937 | ||
938 | sub esi,[OldX] |
938 | sub esi,[OldX] |
939 | jns no_sign_x_circle_r |
939 | jns no_sign_x_circle_r |
940 | neg esi |
940 | neg esi |
941 | no_sign_x_circle_r: |
941 | no_sign_x_circle_r: |
942 | 942 | ||
943 | sub edi,[OldY] |
943 | sub edi,[OldY] |
944 | jns no_sign_y_circle_r |
944 | jns no_sign_y_circle_r |
945 | neg edi |
945 | neg edi |
946 | no_sign_y_circle_r: |
946 | no_sign_y_circle_r: |
947 | 947 | ||
948 | mov [Dx_],esi |
948 | mov [Dx_],esi |
949 | mov [Dy_],edi |
949 | mov [Dy_],edi |
950 | 950 | ||
951 | ;finit |
951 | ;finit |
952 | fild [Dx_] |
952 | fild [Dx_] |
953 | fmul st0,st0 |
953 | fmul st0,st0 |
954 | fild [Dy_] |
954 | fild [Dy_] |
955 | fmul st0,st0 |
955 | fmul st0,st0 |
956 | fadd st0,st1 |
956 | fadd st0,st1 |
957 | fsqrt |
957 | fsqrt |
958 | fistp [Radius] |
958 | fistp [Radius] |
959 | fistp [Icon_X] |
959 | fistp [Icon_X] |
960 | mov esi,[Radius] |
960 | mov esi,[Radius] |
961 | shr esi,1 |
961 | shr esi,1 |
962 | cmp esi,0 |
962 | cmp esi,0 |
963 | jne no_null_radius |
963 | jne no_null_radius |
964 | mov [Radius],1 |
964 | mov [Radius],1 |
965 | no_null_radius: |
965 | no_null_radius: |
966 | 966 | ||
967 | mov [Radius],esi |
967 | mov [Radius],esi |
968 | 968 | ||
969 | mov edi,[x] |
969 | mov edi,[x] |
970 | mov ebp,[y] |
970 | mov ebp,[y] |
971 | add edi,esi |
971 | add edi,esi |
972 | add ebp,esi |
972 | add ebp,esi |
973 | 973 | ||
974 | mov edx,[Picture_SizeX] |
974 | mov edx,[Picture_SizeX] |
975 | sub edx,[line_width] |
975 | sub edx,[line_width] |
976 | cmp edi,edx |
976 | cmp edi,edx |
977 | jl no_limit_x_circle |
977 | jl no_limit_x_circle |
978 | sub edi,edx |
978 | sub edi,edx |
979 | sub [Radius],edi |
979 | sub [Radius],edi |
980 | no_limit_x_circle: |
980 | no_limit_x_circle: |
981 | 981 | ||
982 | mov edx,[Picture_SizeY] |
982 | mov edx,[Picture_SizeY] |
983 | sub edx,[line_width] |
983 | sub edx,[line_width] |
984 | cmp ebp,edx |
984 | cmp ebp,edx |
985 | jl no_limit_y_circle |
985 | jl no_limit_y_circle |
986 | sub ebp,edx |
986 | sub ebp,edx |
987 | sub [Radius],ebp |
987 | sub [Radius],ebp |
988 | no_limit_y_circle: |
988 | no_limit_y_circle: |
989 | 989 | ||
990 | 990 | ||
991 | mov edi,[x] |
991 | mov edi,[x] |
992 | mov ebp,[y] |
992 | mov ebp,[y] |
993 | 993 | ||
994 | sub edi,[Radius] |
994 | sub edi,[Radius] |
995 | jns no_minimum_x_circle |
995 | jns no_minimum_x_circle |
996 | add [Radius],edi |
996 | add [Radius],edi |
997 | no_minimum_x_circle: |
997 | no_minimum_x_circle: |
998 | 998 | ||
999 | sub ebp,[Radius] |
999 | sub ebp,[Radius] |
1000 | jns no_minimum_y_circle |
1000 | jns no_minimum_y_circle |
1001 | add [Radius],ebp |
1001 | add [Radius],ebp |
1002 | no_minimum_y_circle: |
1002 | no_minimum_y_circle: |
1003 | 1003 | ||
1004 | ;calculate circle |
1004 | ;calculate circle |
1005 | mov ebx,[ReserveArray] |
1005 | mov ebx,[ReserveArray] |
1006 | add ebx,4 |
1006 | add ebx,4 |
1007 | mov eax,[PointerToPicture] |
1007 | mov eax,[PointerToPicture] |
1008 | mov ecx,[Picture_SizeX] |
1008 | mov ecx,[Picture_SizeX] |
1009 | mov edx,[x] |
1009 | mov edx,[x] |
1010 | shl edx,16 |
1010 | shl edx,16 |
1011 | add edx,[y] |
1011 | add edx,[y] |
1012 | mov esi,[Radius] |
1012 | mov esi,[Radius] |
1013 | call calculate_circle |
1013 | call calculate_circle |
1014 | 1014 | ||
1015 | ;save color pixels in ReserveArray |
1015 | ;save color pixels in ReserveArray |
1016 | square_width_save |
1016 | square_width_save |
1017 | 1017 | ||
1018 | ;draw calculated pixels on work arrea |
1018 | ;draw calculated pixels on work arrea |
1019 | draw_calc_pixels width_pixels |
1019 | draw_calc_pixels width_pixels |
1020 | 1020 | ||
1021 | call MovePictureToWorkScreen |
1021 | call MovePictureToWorkScreen |
1022 | ret |
1022 | ret |
1023 | no_circle: |
1023 | no_circle: |
1024 | 1024 | ||
1025 | ;************************zoom 1************************* |
1025 | ;************************zoom 1************************* |
1026 | cmp eax,45 |
1026 | cmp eax,45 |
1027 | jne no_1_ |
1027 | jne no_1_ |
1028 | mov [k],1 |
1028 | mov [k],1 |
1029 | call scrollbar_move_00 |
1029 | call scrollbar_move_00 |
1030 | and [Current_instrument],0 |
1030 | and [Current_instrument],0 ;??? |
1031 | call drawwin |
1031 | call drawwin |
1032 | ret |
1032 | ret |
1033 | no_1_: |
1033 | no_1_: |
1034 | 1034 | ||
1035 | ;************************zoom 2************************* |
1035 | ;************************zoom 2************************* |
1036 | cmp eax,46 |
1036 | cmp eax,46 |
1037 | jne no_2_ |
1037 | jne no_2_ |
1038 | mov [k],2 |
1038 | mov [k],2 |
1039 | call drawwin |
1039 | call drawwin |
1040 | call scrollbar_move_00 |
1040 | call scrollbar_move_00 |
1041 | and [Current_instrument],0 |
1041 | and [Current_instrument],0 |
1042 | ret |
1042 | ret |
1043 | no_2_: |
1043 | no_2_: |
1044 | 1044 | ||
1045 | ;************************zoom 3************************* |
1045 | ;************************zoom 3************************* |
1046 | cmp eax,47 |
1046 | cmp eax,47 |
1047 | jne no_3_ |
1047 | jne no_3_ |
1048 | mov [k],3 |
1048 | mov [k],3 |
1049 | call drawwin |
1049 | call drawwin |
1050 | call scrollbar_move_00 |
1050 | call scrollbar_move_00 |
1051 | and [Current_instrument],0 |
1051 | and [Current_instrument],0 |
1052 | ret |
1052 | ret |
1053 | no_3_: |
1053 | no_3_: |
1054 | 1054 | ||
1055 | ;************************zoom 4************************* |
1055 | ;************************zoom 4************************* |
1056 | cmp eax,48 |
1056 | cmp eax,48 |
1057 | jne no_4_ |
1057 | jne no_4_ |
1058 | mov [k],4 |
1058 | mov [k],4 |
1059 | call drawwin |
1059 | call drawwin |
1060 | call scrollbar_move_00 |
1060 | call scrollbar_move_00 |
1061 | and [Current_instrument],0 |
1061 | and [Current_instrument],0 |
1062 | ret |
1062 | ret |
1063 | no_4_: |
1063 | no_4_: |
1064 | 1064 | ||
1065 | ;************************zoom 8************************* |
1065 | ;************************zoom 8************************* |
1066 | cmp eax,49 |
1066 | cmp eax,49 |
1067 | jne no_8_ |
1067 | jne no_8_ |
1068 | mov [k],8 |
1068 | mov [k],8 |
1069 | call drawwin |
1069 | call drawwin |
1070 | call scrollbar_move_00 |
1070 | call scrollbar_move_00 |
1071 | and [Current_instrument],0 |
1071 | and [Current_instrument],0 |
1072 | ret |
1072 | ret |
1073 | no_8_: |
1073 | no_8_: |
1074 | 1074 | ||
1075 | ;************************zoom 16************************ |
1075 | ;************************zoom 16************************ |
1076 | cmp eax,50 |
1076 | cmp eax,50 |
1077 | jne no_16_ |
1077 | jne no_16_ |
1078 | mov [k],16 |
1078 | mov [k],16 |
1079 | call drawwin |
1079 | call drawwin |
1080 | call scrollbar_move_00 |
1080 | call scrollbar_move_00 |
1081 | and [Current_instrument],0 |
1081 | and [Current_instrument],0 |
1082 | ret |
1082 | ret |
1083 | no_16_: |
1083 | no_16_: |
1084 | 1084 | ||
1085 | ;***************allocation of a countour**************** |
1085 | ;***************allocation of a countour**************** |
1086 | cmp eax,21 |
1086 | cmp eax,21 |
1087 | jne no_allocation |
1087 | jne no_allocation |
1088 | - | ||
1089 | cmp [instrument_used],0 |
- | |
1090 | jnz instrument_not_finished_work |
- | |
1091 | - | ||
1092 | mov al,[Activate_instrument] |
- | |
1093 | test al,al |
- | |
1094 | jnz no_new_allocation_xy |
- | |
1095 | mov eax,[ScreenX] |
- | |
1096 | mov ebx,[ScreenY] |
- | |
1097 | add eax,[PosX] |
- | |
1098 | add ebx,[PosY] |
- | |
1099 | mov [OldX],eax |
- | |
1100 | mov [OldY],ebx |
- | |
1101 | inc eax |
- | |
1102 | inc ebx |
- | |
1103 | mov [rectangular_shade_x],eax |
- | |
1104 | mov [rectangular_shade_y],ebx |
1088 | |
1105 | mov [Activate_instrument],1 |
- | |
1106 | mov [instrument_used],1 |
- | |
1107 | and [crossing],0 |
- | |
1108 | and [finishing_crossing],0 |
- | |
1109 | xor eax,eax |
- | |
1110 | mov ecx,mem_flood_f/4 |
- | |
1111 | mov edi,[ReserveArray] |
- | |
1112 | cld |
- | |
1113 | rep stosd |
- | |
1114 | ret |
- | |
1115 | no_new_allocation_xy: |
- | |
1116 | instrument_not_finished_work: |
- | |
1117 | - | ||
1118 | mov al,[instrument_used] |
- | |
1119 | test al,al |
- | |
1120 | jz no_change_coordinats |
- | |
1121 | - | ||
1122 | cmp [Activate_instrument],0 |
- | |
1123 | jnz no_change_coordinats |
- | |
1124 | - | ||
1125 | ;save coordinates as old if crossing=0 |
- | |
1126 | cmp [crossing],0 |
- | |
1127 | jnz no_save_coordinate_of_crossing |
- | |
1128 | - | ||
1129 | mov eax,[OldX] |
- | |
1130 | mov ebx,[OldY] |
- | |
1131 | - | ||
1132 | cmp eax,[rectangular_shade_x] |
- | |
1133 | jl no_remove_x |
- | |
1134 | mov ecx,[rectangular_shade_x] |
- | |
1135 | mov [OldX],ecx ; OldX <-----> rectangulare_shade_x |
- | |
1136 | mov [rectangular_shade_x],eax |
- | |
1137 | no_remove_x: |
- | |
1138 | - | ||
1139 | cmp ebx,[rectangular_shade_y] |
- | |
1140 | jl no_remove_y |
- | |
1141 | mov ecx,[rectangular_shade_y] |
- | |
1142 | mov [OldY],ecx ; OldY <-----> rectangulare_shade_y |
- | |
1143 | mov [rectangular_shade_y],ebx |
- | |
1144 | no_remove_y: |
- | |
1145 | - | ||
1146 | mov eax,[ScreenX] |
- | |
1147 | mov ebx,[ScreenY] |
- | |
1148 | add eax,[PosX] |
- | |
1149 | add ebx,[PosY] |
- | |
1150 | mov [crossing_old_x],eax |
- | |
1151 | mov [crossing_old_y],ebx |
- | |
1152 | mov [crossing],1 |
- | |
1153 | - | ||
1154 | - | ||
1155 | mov eax,[OldX] |
- | |
1156 | mov ebx,[OldY] |
- | |
1157 | inc eax |
- | |
1158 | inc ebx |
- | |
1159 | mov [SpriteCoordinatX],eax |
- | |
1160 | mov [SpriteCoordinatY],ebx |
- | |
1161 | mov [SpriteOldCoordinatX],eax |
- | |
1162 | mov [SpriteOldCoordinatY],ebx |
- | |
1163 | mov esi,[rectangular_shade_x] |
- | |
1164 | mov edi,[rectangular_shade_y] |
- | |
1165 | - | ||
1166 | sub esi,eax |
- | |
1167 | jns @f |
- | |
1168 | neg esi ;sign sprite size x |
- | |
1169 | @@: |
- | |
1170 | - | ||
1171 | sub edi,ebx |
- | |
1172 | jns @f |
- | |
1173 | neg edi ;sign sprite size y |
- | |
1174 | @@: |
- | |
1175 | - | ||
1176 | test esi,esi |
- | |
1177 | jnz @f |
- | |
1178 | mov esi,1 ;null sprite x |
- | |
1179 | @@: |
- | |
1180 | - | ||
1181 | test edi,edi |
- | |
1182 | jnz @f |
- | |
1183 | mov edi,1 ;null sprite y |
- | |
1184 | @@: |
- | |
1185 | - | ||
1186 | mov [SpriteSizeX],esi |
- | |
1187 | mov [SpriteSizeY],edi |
- | |
1188 | - | ||
1189 | call SaveFonForSprite |
- | |
1190 | - | ||
1191 | no_save_coordinate_of_crossing: |
- | |
1192 | - | ||
1193 | cmp [crossing],0 |
- | |
1194 | je no_test_crossing_with_work_arrea |
- | |
1195 | ;if mouse situatad after allocation than exit |
- | |
1196 | push [ScreenX] |
- | |
1197 | push [ScreenY] |
1089 | mov [Activate_instrument],1 |
1198 | 1090 | ||
1199 | call GetScreenCordinats |
1091 | call GetScreenCordinats |
- | 1092 | ||
- | 1093 | bt [MouseBut],8 ;left button down |
|
- | 1094 | jnc .left_but_down |
|
- | 1095 | cmp [crossing],2 |
|
- | 1096 | jne @f |
|
1200 | 1097 | ;move old selection |
|
1201 | mov eax,[OldX] |
1098 | mov eax,[crossing_old_x] |
1202 | mov ebx,[OldY] |
1099 | mov ebx,[crossing_old_y] |
1203 | mov ecx,[ScreenX] |
1100 | mov ecx,[ScreenX] |
1204 | mov edx,[ScreenY] |
- | |
1205 | mov esi,[SpriteSizeX] |
- | |
1206 | mov edi,[SpriteSizeY] |
1101 | mov edx,[ScreenY] |
1207 | add ecx,[PosX] |
1102 | add ecx,[PosX] |
1208 | add edx,[PosY] |
- | |
1209 | inc esi |
- | |
1210 | inc edi |
- | |
1211 | call columnus |
- | |
1212 | - | ||
1213 | test eax,eax |
- | |
1214 | jnz crossing_with_work_area |
- | |
1215 | mov [finishing_crossing],1 |
- | |
1216 | crossing_with_work_area: |
- | |
1217 | - | ||
1218 | pop [ScreenY] |
- | |
1219 | pop [ScreenX] |
- | |
1220 | - | ||
1221 | no_test_crossing_with_work_arrea: |
- | |
1222 | - | ||
1223 | mov eax,[ScreenX] |
- | |
1224 | mov ebx,[ScreenY] |
- | |
1225 | add eax,[PosX] |
- | |
1226 | add ebx,[PosY] |
- | |
1227 | mov ecx,eax |
- | |
1228 | mov edx,ebx |
- | |
1229 | sub eax,[crossing_old_x] ;dx=(x-oldx) |
- | |
1230 | sub ebx,[crossing_old_y] ;dy=(y-oldy) |
- | |
1231 | mov [crossing_old_x],ecx |
- | |
1232 | mov [crossing_old_y],edx |
- | |
1233 | - | ||
1234 | add [OldX],eax ;x1=x1+dx |
- | |
1235 | add [OldY],ebx ;y1=y1+dy |
- | |
1236 | add [rectangular_shade_x],eax ;x2=x2+dx |
- | |
1237 | add [rectangular_shade_y],ebx ;y2+y2+dy |
- | |
1238 | - | ||
1239 | mov eax,[OldX] |
- | |
1240 | mov ebx,[OldY] |
- | |
1241 | inc eax |
- | |
1242 | inc ebx |
- | |
1243 | mov [SpriteCoordinatX],eax |
- | |
1244 | mov [SpriteCoordinatY],ebx |
- | |
1245 | - | ||
1246 | cmp [SpriteCoordinatX],0 |
- | |
1247 | jns @f |
- | |
1248 | mov [SpriteCoordinatX],1 ;null sprite coordinat x |
- | |
1249 | @@: |
- | |
1250 | cmp [SpriteCoordinatY],0 |
- | |
1251 | jns @f |
- | |
1252 | mov [SpriteCoordinatY],1 ;null sprite coordinat y |
- | |
1253 | @@: |
- | |
1254 | 1103 | add edx,[PosY] |
|
1255 | mov esi,[rectangular_shade_x] |
1104 | mov esi,[rectangular_shade_x] |
- | 1105 | mov edi,[rectangular_shade_y] |
|
- | 1106 | sub esi,eax |
|
- | 1107 | sub edi,ebx |
|
1256 | mov edi,[rectangular_shade_y] |
- | |
1257 | - | ||
1258 | sub esi,[OldX] |
1108 | call columnus |
1259 | jns @f |
- | |
1260 | neg esi |
- | |
1261 | @@: |
1109 | |
1262 | sub edi,[OldY] |
- | |
1263 | jns @f |
- | |
1264 | neg edi |
- | |
1265 | @@: |
1110 | test eax,eax |
1266 | - | ||
1267 | mov ecx,[OldX] |
- | |
1268 | mov edx,[OldY] |
- | |
1269 | - | ||
1270 | sub ecx,[PosX] |
- | |
1271 | jns @f |
- | |
1272 | xor ecx,ecx |
1111 | jz @f |
1273 | add ecx,[PosX] |
- | |
1274 | mov [OldX],ecx |
- | |
1275 | add ecx,esi |
- | |
1276 | mov [rectangular_shade_x],ecx |
- | |
1277 | @@: |
- | |
1278 | - | ||
1279 | sub edx,[PosY] |
- | |
1280 | jns @f |
- | |
1281 | xor edx,edx |
1112 | mov [crossing],3 |
1282 | add edx,[PosY] |
- | |
1283 | mov [OldY],edx |
- | |
1284 | add edx,edi |
- | |
1285 | mov [rectangular_shade_y],edx |
- | |
1286 | @@: |
1113 | mov [OldX],ecx |
1287 | - | ||
1288 | mov ecx,[Picture_SizeX] |
- | |
1289 | sub ecx,esi |
- | |
1290 | cmp [OldX],ecx |
- | |
1291 | jl @f |
- | |
1292 | dec ecx |
- | |
1293 | mov [OldX],ecx |
- | |
1294 | add ecx,esi |
1114 | mov [OldY],edx |
- | 1115 | jmp selection_update |
|
- | 1116 | @@: |
|
- | 1117 | ;start new selection |
|
- | 1118 | mov eax,[ScreenX] |
|
- | 1119 | add eax,[PosX] |
|
- | 1120 | mov [crossing_old_x],eax |
|
- | 1121 | mov [rectangular_shade_x],eax |
|
- | 1122 | mov eax,[ScreenY] |
|
- | 1123 | add eax,[PosY] |
|
- | 1124 | mov [crossing_old_y],eax |
|
- | 1125 | mov [rectangular_shade_y],eax |
|
- | 1126 | mov [crossing],1 |
|
- | 1127 | jmp selection_update |
|
- | 1128 | .left_but_down: |
|
- | 1129 | ||
- | 1130 | bt [MouseBut],0 ;left button press |
|
- | 1131 | jnc .no_mouse_move |
|
1295 | mov [rectangular_shade_x],ecx |
1132 | cmp [crossing],3 |
- | 1133 | jne .no_sel_move |
|
1296 | @@: |
1134 | ;move selection |
1297 | 1135 | mov eax,[ScreenX] |
|
- | 1136 | add eax,[PosX] |
|
- | 1137 | sub eax,[OldX] |
|
- | 1138 | add [OldX],eax |
|
1298 | mov edx,[Picture_SizeY] |
1139 | mov ebx,[crossing_old_x] |
- | 1140 | add ebx,eax |
|
- | 1141 | cmp ebx,0 |
|
1299 | sub edx,edi |
1142 | jge @f |
- | 1143 | ;exit from left border |
|
- | 1144 | sub eax,ebx |
|
- | 1145 | @@: |
|
- | 1146 | add [crossing_old_x],eax |
|
- | 1147 | add [rectangular_shade_x],eax |
|
1300 | cmp [OldY],edx |
1148 | mov eax,[ScreenY] |
- | 1149 | add eax,[PosY] |
|
1301 | jl @f |
1150 | sub eax,[OldY] |
- | 1151 | add [OldY],eax |
|
- | 1152 | mov ebx,[crossing_old_y] |
|
- | 1153 | add ebx,eax |
|
- | 1154 | cmp ebx,0 |
|
- | 1155 | jge @f |
|
- | 1156 | ;exit from top border |
|
- | 1157 | sub eax,ebx |
|
- | 1158 | @@: |
|
- | 1159 | add [crossing_old_y],eax |
|
- | 1160 | add [rectangular_shade_y],eax |
|
- | 1161 | jmp selection_update |
|
- | 1162 | .no_sel_move: |
|
- | 1163 | ;resize selection |
|
- | 1164 | mov eax,[ScreenX] |
|
- | 1165 | add eax,[PosX] |
|
1302 | dec edx |
1166 | mov [rectangular_shade_x],eax |
- | 1167 | mov eax,[ScreenY] |
|
- | 1168 | add eax,[PosY] |
|
- | 1169 | mov [rectangular_shade_y],eax |
|
- | 1170 | jmp selection_update |
|
- | 1171 | .no_mouse_move: |
|
- | 1172 | ||
- | 1173 | bt [MouseBut],16 ;left button up |
|
- | 1174 | jnc .left_but_up |
|
- | 1175 | ;finish selection |
|
- | 1176 | mov eax,[crossing_old_x] |
|
- | 1177 | mov ebx,[rectangular_shade_x] |
|
- | 1178 | cmp eax,ebx |
|
1303 | mov [OldY],edx |
1179 | jle @f |
1304 | add edx,edi |
- | |
1305 | mov [rectangular_shade_y],edx |
1180 | mov [crossing_old_x],ebx |
1306 | @@: |
1181 | mov [rectangular_shade_x],eax |
1307 | 1182 | @@: |
|
1308 | mov eax,[rectangular_shade_x] |
1183 | mov eax,[crossing_old_y] |
1309 | mov ebx,[rectangular_shade_y] |
1184 | mov ebx,[rectangular_shade_y] |
1310 | sub eax,[PosX] |
1185 | cmp eax,ebx |
- | 1186 | jle @f |
|
1311 | sub ebx,[PosY] |
1187 | mov [crossing_old_y],ebx |
1312 | mov [ScreenX],eax |
1188 | mov [rectangular_shade_y],eax |
1313 | mov [ScreenY],ebx |
- | |
1314 | no_change_coordinats: |
1189 | @@: |
- | 1190 | mov [crossing],2 |
|
- | 1191 | ret |
|
- | 1192 | .left_but_up: |
|
1315 | 1193 | ||
1316 | ;put saved pixels |
1194 | bt [MouseBut],9 ;right button down |
- | 1195 | jnc .right_but_down |
|
- | 1196 | ;delete select |
|
1317 | square_width_put |
1197 | mov [crossing],0 |
1318 | 1198 | jmp selection_update |
|
1319 | cmp [DrawSprite_flag],1 |
1199 | .right_but_down: |
1320 | jne no_activate_put_fon_ |
1200 | |
1321 | 1201 | if 0 |
|
1322 | cmp [Paste_flag],1 |
1202 | cmp [Paste_flag],1 |
1323 | je @f |
1203 | je @f |
1324 | call PutFonForSprite |
1204 | call PutFonForSprite |
1325 | @@: |
1205 | @@: |
1326 | and [Paste_flag],0 |
- | |
1327 | no_activate_put_fon_: |
- | |
1328 | - | ||
1329 | cmp [finishing_crossing],0 |
- | |
1330 | jz not_finish_from_instrument_crossing |
- | |
1331 | and [Activate_instrument],0 |
- | |
1332 | and [crossing],0 |
- | |
1333 | and [instrument_used],0 |
- | |
1334 | and [DrawSprite_flag],0 |
- | |
1335 | call MovePictureToWorkScreen |
- | |
1336 | ret |
- | |
1337 | not_finish_from_instrument_crossing: |
- | |
1338 | - | ||
1339 | ;calculate line |
- | |
1340 | mov ebx,[ReserveArray] |
- | |
1341 | add ebx,4 |
- | |
1342 | mov eax,[PointerToPicture] |
- | |
1343 | mov ecx,[Picture_SizeX] |
- | |
1344 | mov edx,[OldX] |
- | |
1345 | shl edx,16 |
- | |
1346 | add edx,[OldY] |
- | |
1347 | mov esi,[ScreenX] |
- | |
1348 | mov edi,[ScreenY] |
- | |
1349 | add esi,[PosX] |
- | |
1350 | add edi,[PosY] |
- | |
1351 | - | ||
1352 | mov ebp,[Picture_SizeX] |
- | |
1353 | dec ebp |
- | |
1354 | cmp esi,ebp |
- | |
1355 | jl @f |
- | |
1356 | mov esi,ebp ;minimum x allocation |
- | |
1357 | @@: |
- | |
1358 | - | ||
1359 | mov ebp,[Picture_SizeY] |
- | |
1360 | dec ebp |
- | |
1361 | cmp edi,ebp |
- | |
1362 | jl @f |
- | |
1363 | mov edi,ebp ;minimum y allocation |
- | |
1364 | @@: |
- | |
1365 | - | ||
1366 | call calculate_rectangle |
- | |
1367 | - | ||
1368 | ;save color pixels in ReserveArray |
- | |
1369 | square_width_save |
- | |
1370 | - | ||
1371 | cmp [DrawSprite_flag],1 |
1206 | cmp [DrawSprite_flag],1 |
1372 | jne @f |
1207 | jne @f |
1373 | ;save current coordinats as old |
- | |
1374 | mov eax,[SpriteCoordinatX] |
- | |
1375 | mov ebx,[SpriteCoordinatY] |
- | |
1376 | mov [SpriteOldCoordinatX],eax |
- | |
1377 | mov [SpriteOldCoordinatY],ebx |
- | |
1378 | - | ||
1379 | call SaveFonForSprite |
1208 | call SaveFonForSprite |
1380 | - | ||
1381 | @@: |
- | |
1382 | - | ||
1383 | cmp [DrawSprite_flag],1 |
- | |
1384 | jne @f |
- | |
1385 | call DrawSprite |
1209 | call DrawSprite |
1386 | @@: |
1210 | @@: |
- | 1211 | end if |
|
1387 | - | ||
1388 | mov al,[instrument_used] |
- | |
1389 | test al,al |
- | |
1390 | jz no_change_coordinats |
- | |
1391 | cmp [Activate_instrument],0 |
- | |
1392 | jz no_save_shades |
- | |
1393 | mov eax,[ScreenX] |
- | |
1394 | mov ebx,[ScreenY] |
- | |
1395 | add eax,[PosX] |
- | |
1396 | add ebx,[PosY] |
- | |
1397 | mov [rectangular_shade_x],eax |
- | |
1398 | mov [rectangular_shade_y],ebx |
1212 | |
1399 | no_save_shades: |
- | |
1400 | 1213 | selection_update: |
|
1401 | call MovePictureToWorkScreen |
1214 | call MovePictureToWorkScreen |
1402 | ret |
1215 | ret |
1403 | no_allocation: |
1216 | no_allocation: |
1404 | 1217 | ||
1405 | ;*************reflection from left to right************* |
1218 | ;*************reflection from left to right************* |
1406 | cmp eax,23 |
1219 | cmp eax,23 |
1407 | jne no_reflection_from_left_to_right |
1220 | jne no_reflection_from_left_to_right |
1408 | 1221 | ||
1409 | mov ebp,[PointerToPicture] |
1222 | mov ebp,[PointerToPicture] |
1410 | mov edx,[ReserveArray] |
1223 | mov edx,[ReserveArray] |
1411 | mov esi,[Picture_SizeX] |
1224 | mov esi,[Picture_SizeX] |
1412 | mov ebx,[Picture_SizeX] |
1225 | mov ebx,[Picture_SizeX] |
1413 | lea ebx,[ebx+ebx*2] |
1226 | lea ebx,[ebx+ebx*2] |
1414 | shr esi,1 |
1227 | shr esi,1 |
1415 | next_line_reflection_x: |
1228 | next_line_reflection_x: |
1416 | ;copy vertical line to array |
1229 | ;copy vertical line to array |
1417 | mov ecx,[Picture_SizeX] |
1230 | mov ecx,[Picture_SizeX] |
1418 | shr ecx,1 |
1231 | shr ecx,1 |
1419 | sub ecx,esi |
1232 | sub ecx,esi |
1420 | lea ecx,[ecx+ecx*2] |
1233 | lea ecx,[ecx+ecx*2] |
1421 | add ecx,[PointerToPicture] |
1234 | add ecx,[PointerToPicture] |
1422 | mov edx,[ReserveArray] |
1235 | mov edx,[ReserveArray] |
1423 | and edi,0 |
1236 | and edi,0 |
1424 | copy_to_array_line_reflection_y: |
1237 | copy_to_array_line_reflection_y: |
1425 | mov eax,[ecx] |
1238 | mov eax,[ecx] |
1426 | mov ebp,edi |
1239 | mov ebp,edi |
1427 | lea ebp,[ebp+ebp*2] |
1240 | lea ebp,[ebp+ebp*2] |
1428 | mov [edx+ebp],ax |
1241 | mov [edx+ebp],ax |
1429 | shr eax,16 |
1242 | shr eax,16 |
1430 | mov [edx+ebp+2],al |
1243 | mov [edx+ebp+2],al |
1431 | add ecx,ebx |
1244 | add ecx,ebx |
1432 | inc edi |
1245 | inc edi |
1433 | cmp edi,[Picture_SizeY] |
1246 | cmp edi,[Picture_SizeY] |
1434 | jne copy_to_array_line_reflection_y |
1247 | jne copy_to_array_line_reflection_y |
1435 | 1248 | ||
1436 | mov ecx,[Picture_SizeX] |
1249 | mov ecx,[Picture_SizeX] |
1437 | shr ecx,1 |
1250 | shr ecx,1 |
1438 | mov ebp,ecx |
1251 | mov ebp,ecx |
1439 | add ecx,esi |
1252 | add ecx,esi |
1440 | dec ecx |
1253 | dec ecx |
1441 | lea ecx,[ecx+ecx*2] |
1254 | lea ecx,[ecx+ecx*2] |
1442 | add ecx,[PointerToPicture] |
1255 | add ecx,[PointerToPicture] |
1443 | sub ebp,esi |
1256 | sub ebp,esi |
1444 | lea ebp,[ebp+ebp*2] |
1257 | lea ebp,[ebp+ebp*2] |
1445 | add ebp,[PointerToPicture] |
1258 | add ebp,[PointerToPicture] |
1446 | and edi,0 |
1259 | and edi,0 |
1447 | next_line_reflection_y: |
1260 | next_line_reflection_y: |
1448 | mov eax,[ecx] |
1261 | mov eax,[ecx] |
1449 | and eax,0xffffff |
1262 | and eax,0xffffff |
1450 | mov [ebp],ax |
1263 | mov [ebp],ax |
1451 | shr eax,16 |
1264 | shr eax,16 |
1452 | mov [ebp+2],al |
1265 | mov [ebp+2],al |
1453 | add ebp,ebx |
1266 | add ebp,ebx |
1454 | add ecx,ebx |
1267 | add ecx,ebx |
1455 | inc edi |
1268 | inc edi |
1456 | cmp edi,[Picture_SizeY] |
1269 | cmp edi,[Picture_SizeY] |
1457 | jnz next_line_reflection_y |
1270 | jnz next_line_reflection_y |
1458 | 1271 | ||
1459 | ;copy vertical line from array to screen |
1272 | ;copy vertical line from array to screen |
1460 | mov ecx,[Picture_SizeX] |
1273 | mov ecx,[Picture_SizeX] |
1461 | shr ecx,1 |
1274 | shr ecx,1 |
1462 | add ecx,esi |
1275 | add ecx,esi |
1463 | dec ecx |
1276 | dec ecx |
1464 | lea ecx,[ecx+ecx*2] |
1277 | lea ecx,[ecx+ecx*2] |
1465 | add ecx,[PointerToPicture] |
1278 | add ecx,[PointerToPicture] |
1466 | mov edx,[ReserveArray] |
1279 | mov edx,[ReserveArray] |
1467 | and edi,0 |
1280 | and edi,0 |
1468 | copy_from_array_to_screen_reflection_y: |
1281 | copy_from_array_to_screen_reflection_y: |
1469 | mov ebp,edi |
1282 | mov ebp,edi |
1470 | lea ebp,[ebp+ebp*2] |
1283 | lea ebp,[ebp+ebp*2] |
1471 | xor eax,eax |
1284 | xor eax,eax |
1472 | mov eax,[edx+ebp] |
1285 | mov eax,[edx+ebp] |
1473 | mov [ecx],ax |
1286 | mov [ecx],ax |
1474 | shr eax,16 |
1287 | shr eax,16 |
1475 | mov [ecx+2],al |
1288 | mov [ecx+2],al |
1476 | add ecx,ebx |
1289 | add ecx,ebx |
1477 | inc edi |
1290 | inc edi |
1478 | cmp edi,[Picture_SizeY] |
1291 | cmp edi,[Picture_SizeY] |
1479 | jne copy_from_array_to_screen_reflection_y |
1292 | jne copy_from_array_to_screen_reflection_y |
1480 | 1293 | ||
1481 | dec esi |
1294 | dec esi |
1482 | jnz next_line_reflection_x |
1295 | jnz next_line_reflection_x |
1483 | 1296 | ||
1484 | call MovePictureToWorkScreen |
1297 | call MovePictureToWorkScreen |
1485 | ret |
1298 | ret |
1486 | no_reflection_from_left_to_right: |
1299 | no_reflection_from_left_to_right: |
1487 | 1300 | ||
1488 | ;*************reflection from up to down**************** |
1301 | ;*************reflection from up to down**************** |
1489 | cmp eax,24 |
1302 | cmp eax,24 |
1490 | jne no_reflection_from_up_to_down |
1303 | jne no_reflection_from_up_to_down |
1491 | mov esi,[Picture_SizeX] |
1304 | mov esi,[Picture_SizeX] |
1492 | mov edi,esi |
1305 | mov edi,esi |
1493 | lea esi,[esi+esi*2] |
1306 | lea esi,[esi+esi*2] |
1494 | lea edi,[edi+edi*2] |
1307 | lea edi,[edi+edi*2] |
1495 | imul edi,[Picture_SizeY] |
1308 | imul edi,[Picture_SizeY] |
1496 | mov edx,[ReserveArray] |
1309 | mov edx,[ReserveArray] |
1497 | mov ecx,[Picture_SizeY] |
1310 | mov ecx,[Picture_SizeY] |
1498 | shr ecx,1 |
1311 | shr ecx,1 |
1499 | add edi,[PointerToPicture] |
1312 | add edi,[PointerToPicture] |
1500 | sub edi,esi |
1313 | sub edi,esi |
1501 | mov ebp,[PointerToPicture] |
1314 | mov ebp,[PointerToPicture] |
1502 | next_lines_reflection: |
1315 | next_lines_reflection: |
1503 | ;copy line |
1316 | ;copy line |
1504 | xor ebx,ebx |
1317 | xor ebx,ebx |
1505 | copy_line_1: |
1318 | copy_line_1: |
1506 | xor eax,eax |
1319 | xor eax,eax |
1507 | mov al,[edi+ebx] |
1320 | mov al,[edi+ebx] |
1508 | mov [edx+ebx],al |
1321 | mov [edx+ebx],al |
1509 | inc ebx |
1322 | inc ebx |
1510 | cmp ebx,esi |
1323 | cmp ebx,esi |
1511 | jne copy_line_1 |
1324 | jne copy_line_1 |
1512 | 1325 | ||
1513 | xor ebx,ebx |
1326 | xor ebx,ebx |
1514 | copy_line_2: |
1327 | copy_line_2: |
1515 | xor eax,eax |
1328 | xor eax,eax |
1516 | mov al,[ebp+ebx] |
1329 | mov al,[ebp+ebx] |
1517 | mov [edi+ebx],al |
1330 | mov [edi+ebx],al |
1518 | inc ebx |
1331 | inc ebx |
1519 | cmp ebx,esi |
1332 | cmp ebx,esi |
1520 | jne copy_line_2 |
1333 | jne copy_line_2 |
1521 | 1334 | ||
1522 | xor ebx,ebx |
1335 | xor ebx,ebx |
1523 | copy_line_3: |
1336 | copy_line_3: |
1524 | xor eax,eax |
1337 | xor eax,eax |
1525 | mov al,[edx+ebx] |
1338 | mov al,[edx+ebx] |
1526 | mov [ebp+ebx],al |
1339 | mov [ebp+ebx],al |
1527 | inc ebx |
1340 | inc ebx |
1528 | cmp ebx,esi |
1341 | cmp ebx,esi |
1529 | jne copy_line_3 |
1342 | jne copy_line_3 |
1530 | 1343 | ||
1531 | add ebp,esi |
1344 | add ebp,esi |
1532 | sub edi,esi |
1345 | sub edi,esi |
1533 | dec ecx |
1346 | dec ecx |
1534 | jnz next_lines_reflection |
1347 | jnz next_lines_reflection |
1535 | 1348 | ||
1536 | call MovePictureToWorkScreen |
1349 | call MovePictureToWorkScreen |
1537 | ret |
1350 | ret |
1538 | no_reflection_from_up_to_down: |
1351 | no_reflection_from_up_to_down: |
1539 | 1352 | ||
1540 | ;*********************draw hard contour***************** |
1353 | ;*********************draw hard contour***************** |
1541 | cmp eax,20 |
1354 | cmp eax,20 |
1542 | jne no_kontur_ |
1355 | jne no_kontur_ |
1543 | 1356 | ||
1544 | mov [Last_instrument],eax |
1357 | mov [Last_instrument],eax |
1545 | 1358 | ||
1546 | mov al,[Activate_instrument] |
1359 | mov al,[Activate_instrument] |
1547 | test al,al |
1360 | test al,al |
1548 | jnz no_new_konture_xy |
1361 | jnz no_new_konture_xy |
1549 | 1362 | ||
1550 | mov al,[instrument_used] |
1363 | mov al,[instrument_used] |
1551 | test al,al |
1364 | test al,al |
1552 | jz instrument_not_used |
1365 | jz instrument_not_used |
1553 | mov eax,[used_OldX] |
1366 | mov eax,[used_OldX] |
1554 | mov ebx,[used_OldY] |
1367 | mov ebx,[used_OldY] |
1555 | mov [OldX],eax |
1368 | mov [OldX],eax |
1556 | mov [OldY],ebx |
1369 | mov [OldY],ebx |
1557 | jmp exit_used_instrument |
1370 | jmp exit_used_instrument |
1558 | instrument_not_used: |
1371 | instrument_not_used: |
1559 | 1372 | ||
1560 | mov eax,[ScreenX] |
1373 | mov eax,[ScreenX] |
1561 | mov ebx,[ScreenY] |
1374 | mov ebx,[ScreenY] |
1562 | add eax,[PosX] |
1375 | add eax,[PosX] |
1563 | add ebx,[PosY] |
1376 | add ebx,[PosY] |
1564 | mov [OldX],eax |
1377 | mov [OldX],eax |
1565 | mov [OldY],ebx |
1378 | mov [OldY],ebx |
1566 | exit_used_instrument: |
1379 | exit_used_instrument: |
1567 | 1380 | ||
1568 | mov al,[instrument_used] |
1381 | mov al,[instrument_used] |
1569 | test al,al |
1382 | test al,al |
1570 | jnz instrument_used_true |
1383 | jnz instrument_used_true |
1571 | mov [instrument_used],byte 1 |
1384 | mov [instrument_used],byte 1 |
1572 | instrument_used_true: |
1385 | instrument_used_true: |
1573 | 1386 | ||
1574 | mov [Activate_instrument],1 |
1387 | mov [Activate_instrument],1 |
1575 | xor eax,eax |
1388 | xor eax,eax |
1576 | mov ecx,mem_flood_f/4 |
1389 | mov ecx,mem_flood_f/4 |
1577 | mov edi,[ReserveArray] |
1390 | mov edi,[ReserveArray] |
1578 | rep stosd |
1391 | rep stosd |
1579 | 1392 | ||
1580 | no_new_konture_xy: |
1393 | no_new_konture_xy: |
1581 | 1394 | ||
1582 | ;put saved pixels |
1395 | ;put saved pixels |
1583 | square_width_put |
1396 | square_width_put |
1584 | 1397 | ||
1585 | ;calculate line |
1398 | ;calculate line |
1586 | mov ebx,[ReserveArray] |
1399 | mov ebx,[ReserveArray] |
1587 | add ebx,4 |
1400 | add ebx,4 |
1588 | mov eax,[PointerToPicture] |
1401 | mov eax,[PointerToPicture] |
1589 | mov ecx,[Picture_SizeX] |
1402 | mov ecx,[Picture_SizeX] |
1590 | mov edx,[OldX] |
1403 | mov edx,[OldX] |
1591 | shl edx,16 |
1404 | shl edx,16 |
1592 | add edx,[OldY] |
1405 | add edx,[OldY] |
1593 | mov esi,[ScreenX] |
1406 | mov esi,[ScreenX] |
1594 | mov edi,[ScreenY] |
1407 | mov edi,[ScreenY] |
1595 | add esi,[PosX] |
1408 | add esi,[PosX] |
1596 | add edi,[PosY] |
1409 | add edi,[PosY] |
1597 | 1410 | ||
1598 | mov ebp,[Picture_SizeX] |
1411 | mov ebp,[Picture_SizeX] |
1599 | sub ebp,[line_width] |
1412 | sub ebp,[line_width] |
1600 | cmp esi,ebp |
1413 | cmp esi,ebp |
1601 | jl no_minimum_x_konture |
1414 | jl no_minimum_x_konture |
1602 | mov esi,ebp |
1415 | mov esi,ebp |
1603 | no_minimum_x_konture: |
1416 | no_minimum_x_konture: |
1604 | 1417 | ||
1605 | mov ebp,[Picture_SizeY] |
1418 | mov ebp,[Picture_SizeY] |
1606 | sub ebp,[line_width] |
1419 | sub ebp,[line_width] |
1607 | cmp edi,ebp |
1420 | cmp edi,ebp |
1608 | jl no_minimum_y_konture |
1421 | jl no_minimum_y_konture |
1609 | mov edi,ebp |
1422 | mov edi,ebp |
1610 | no_minimum_y_konture: |
1423 | no_minimum_y_konture: |
1611 | 1424 | ||
1612 | call calculate_line |
1425 | call calculate_line |
1613 | 1426 | ||
1614 | ;save color pixels in ReserveArray |
1427 | ;save color pixels in ReserveArray |
1615 | square_width_save |
1428 | square_width_save |
1616 | 1429 | ||
1617 | ;draw calculated pixels on work arrea |
1430 | ;draw calculated pixels on work arrea |
1618 | draw_calc_pixels width_pixels |
1431 | draw_calc_pixels width_pixels |
1619 | 1432 | ||
1620 | mov eax,[ScreenX] |
1433 | mov eax,[ScreenX] |
1621 | mov ebx,[ScreenY] |
1434 | mov ebx,[ScreenY] |
1622 | add eax,[PosX] |
1435 | add eax,[PosX] |
1623 | add ebx,[PosY] |
1436 | add ebx,[PosY] |
1624 | mov [used_OldX],eax |
1437 | mov [used_OldX],eax |
1625 | mov [used_OldY],ebx |
1438 | mov [used_OldY],ebx |
1626 | 1439 | ||
1627 | call MovePictureToWorkScreen |
1440 | call MovePictureToWorkScreen |
1628 | ret |
1441 | ret |
1629 | no_kontur_: |
1442 | no_kontur_: |
1630 | 1443 | ||
1631 | ;************************draw ellips******************** |
1444 | ;************************draw ellips******************** |
1632 | cmp eax,19 |
1445 | cmp eax,19 |
1633 | jne no_ellips |
1446 | jne no_ellips |
1634 | 1447 | ||
1635 | mov [Last_instrument],eax |
1448 | mov [Last_instrument],eax |
1636 | 1449 | ||
1637 | mov al,[Activate_instrument] |
1450 | mov al,[Activate_instrument] |
1638 | test al,al |
1451 | test al,al |
1639 | jnz no_new_ellips_xy |
1452 | jnz no_new_ellips_xy |
1640 | mov eax,[ScreenX] |
1453 | mov eax,[ScreenX] |
1641 | mov ebx,[ScreenY] |
1454 | mov ebx,[ScreenY] |
1642 | add eax,[PosX] |
1455 | add eax,[PosX] |
1643 | add ebx,[PosY] |
1456 | add ebx,[PosY] |
1644 | mov [OldX],eax |
1457 | mov [OldX],eax |
1645 | mov [OldY],ebx |
1458 | mov [OldY],ebx |
1646 | mov [Activate_instrument],1 |
1459 | mov [Activate_instrument],1 |
1647 | xor eax,eax |
1460 | xor eax,eax |
1648 | mov ecx,mem_flood_f/4 |
1461 | mov ecx,mem_flood_f/4 |
1649 | mov edi,[ReserveArray] |
1462 | mov edi,[ReserveArray] |
1650 | cld |
1463 | cld |
1651 | rep stosd |
1464 | rep stosd |
1652 | ret |
1465 | ret |
1653 | no_new_ellips_xy: |
1466 | no_new_ellips_xy: |
1654 | 1467 | ||
1655 | ;put saved pixels |
1468 | ;put saved pixels |
1656 | square_width_put |
1469 | square_width_put |
1657 | 1470 | ||
1658 | 1471 | ||
1659 | mov esi,[ScreenX] |
1472 | mov esi,[ScreenX] |
1660 | mov edi,[ScreenY] |
1473 | mov edi,[ScreenY] |
1661 | add esi,[PosX] |
1474 | add esi,[PosX] |
1662 | add edi,[PosY] |
1475 | add edi,[PosY] |
1663 | 1476 | ||
1664 | sub esi,[OldX] |
1477 | sub esi,[OldX] |
1665 | jns no_sign_x_ellips |
1478 | jns no_sign_x_ellips |
1666 | neg esi |
1479 | neg esi |
1667 | shr esi,1 |
1480 | shr esi,1 |
1668 | neg esi |
1481 | neg esi |
1669 | add esi,[OldX] |
1482 | add esi,[OldX] |
1670 | jmp no_plus_sign_x_ellips |
1483 | jmp no_plus_sign_x_ellips |
1671 | no_sign_x_ellips: |
1484 | no_sign_x_ellips: |
1672 | 1485 | ||
1673 | shr esi,1 |
1486 | shr esi,1 |
1674 | add esi,[OldX] |
1487 | add esi,[OldX] |
1675 | no_plus_sign_x_ellips: |
1488 | no_plus_sign_x_ellips: |
1676 | 1489 | ||
1677 | sub edi,[OldY] |
1490 | sub edi,[OldY] |
1678 | jns no_sign_y_ellips |
1491 | jns no_sign_y_ellips |
1679 | neg edi |
1492 | neg edi |
1680 | shr edi,1 |
1493 | shr edi,1 |
1681 | neg edi |
1494 | neg edi |
1682 | add edi,[OldY] |
1495 | add edi,[OldY] |
1683 | jmp no_plus_sign_y_ellips |
1496 | jmp no_plus_sign_y_ellips |
1684 | no_sign_y_ellips: |
1497 | no_sign_y_ellips: |
1685 | 1498 | ||
1686 | shr edi,1 |
1499 | shr edi,1 |
1687 | add edi,[OldY] |
1500 | add edi,[OldY] |
1688 | no_plus_sign_y_ellips: |
1501 | no_plus_sign_y_ellips: |
1689 | 1502 | ||
1690 | mov [x],esi |
1503 | mov [x],esi |
1691 | mov [y],edi |
1504 | mov [y],edi |
1692 | 1505 | ||
1693 | mov esi,[ScreenX] |
1506 | mov esi,[ScreenX] |
1694 | mov edi,[ScreenY] |
1507 | mov edi,[ScreenY] |
1695 | add esi,[PosX] |
1508 | add esi,[PosX] |
1696 | add edi,[PosY] |
1509 | add edi,[PosY] |
1697 | 1510 | ||
1698 | sub esi,[OldX] |
1511 | sub esi,[OldX] |
1699 | jns no_sign_x_ellips_r |
1512 | jns no_sign_x_ellips_r |
1700 | neg esi |
1513 | neg esi |
1701 | no_sign_x_ellips_r: |
1514 | no_sign_x_ellips_r: |
1702 | 1515 | ||
1703 | sub edi,[OldY] |
1516 | sub edi,[OldY] |
1704 | jns no_sign_y_ellips_r |
1517 | jns no_sign_y_ellips_r |
1705 | neg edi |
1518 | neg edi |
1706 | no_sign_y_ellips_r: |
1519 | no_sign_y_ellips_r: |
1707 | 1520 | ||
1708 | cmp edi,0 |
1521 | cmp edi,0 |
1709 | jnz no_null_a_ellips |
1522 | jnz no_null_a_ellips |
1710 | mov edi,1 |
1523 | mov edi,1 |
1711 | no_null_a_ellips: |
1524 | no_null_a_ellips: |
1712 | 1525 | ||
1713 | shr esi,1 |
1526 | shr esi,1 |
1714 | shr edi,1 |
1527 | shr edi,1 |
1715 | mov [a_ellips],esi |
1528 | mov [a_ellips],esi |
1716 | mov [b_ellips],edi |
1529 | mov [b_ellips],edi |
1717 | 1530 | ||
1718 | mov edi,[x] |
1531 | mov edi,[x] |
1719 | mov ebp,[y] |
1532 | mov ebp,[y] |
1720 | add edi,esi |
1533 | add edi,esi |
1721 | add ebp,esi |
1534 | add ebp,esi |
1722 | 1535 | ||
1723 | mov edx,[Picture_SizeX] |
1536 | mov edx,[Picture_SizeX] |
1724 | sub edx,[line_width] |
1537 | sub edx,[line_width] |
1725 | cmp edi,edx |
1538 | cmp edi,edx |
1726 | jl no_limit_x_ellips |
1539 | jl no_limit_x_ellips |
1727 | sub edi,edx |
1540 | sub edi,edx |
1728 | sub [a_ellips],edi |
1541 | sub [a_ellips],edi |
1729 | no_limit_x_ellips: |
1542 | no_limit_x_ellips: |
1730 | 1543 | ||
1731 | mov edx,[Picture_SizeY] |
1544 | mov edx,[Picture_SizeY] |
1732 | sub edx,[line_width] |
1545 | sub edx,[line_width] |
1733 | cmp ebp,edx |
1546 | cmp ebp,edx |
1734 | jl no_limit_y_ellips |
1547 | jl no_limit_y_ellips |
1735 | sub ebp,edx |
1548 | sub ebp,edx |
1736 | sub [b_ellips],ebp |
1549 | sub [b_ellips],ebp |
1737 | no_limit_y_ellips: |
1550 | no_limit_y_ellips: |
1738 | 1551 | ||
1739 | 1552 | ||
1740 | mov edi,[x] |
1553 | mov edi,[x] |
1741 | mov ebp,[y] |
1554 | mov ebp,[y] |
1742 | 1555 | ||
1743 | sub edi,[a_ellips] |
1556 | sub edi,[a_ellips] |
1744 | jns no_minimum_x_ellips |
1557 | jns no_minimum_x_ellips |
1745 | add [a_ellips],edi |
1558 | add [a_ellips],edi |
1746 | no_minimum_x_ellips: |
1559 | no_minimum_x_ellips: |
1747 | 1560 | ||
1748 | sub ebp,[b_ellips] |
1561 | sub ebp,[b_ellips] |
1749 | jns no_minimum_y_ellips |
1562 | jns no_minimum_y_ellips |
1750 | add [b_ellips],ebp |
1563 | add [b_ellips],ebp |
1751 | no_minimum_y_ellips: |
1564 | no_minimum_y_ellips: |
1752 | 1565 | ||
1753 | ;calculate circle |
1566 | ;calculate circle |
1754 | mov ebx,[ReserveArray] |
1567 | mov ebx,[ReserveArray] |
1755 | add ebx,4 |
1568 | add ebx,4 |
1756 | mov eax,[PointerToPicture] |
1569 | mov eax,[PointerToPicture] |
1757 | mov ecx,[Picture_SizeX] |
1570 | mov ecx,[Picture_SizeX] |
1758 | mov edx,[x] |
1571 | mov edx,[x] |
1759 | shl edx,16 |
1572 | shl edx,16 |
1760 | add edx,[y] |
1573 | add edx,[y] |
1761 | mov esi,[a_ellips] |
1574 | mov esi,[a_ellips] |
1762 | shl esi,16 |
1575 | shl esi,16 |
1763 | add esi,[b_ellips] |
1576 | add esi,[b_ellips] |
1764 | call calculate_ellips |
1577 | call calculate_ellips |
1765 | 1578 | ||
1766 | ;save color pixels in ReserveArray |
1579 | ;save color pixels in ReserveArray |
1767 | square_width_save |
1580 | square_width_save |
1768 | 1581 | ||
1769 | ;draw calculated pixels on work arrea |
1582 | ;draw calculated pixels on work arrea |
1770 | draw_calc_pixels width_pixels |
1583 | draw_calc_pixels width_pixels |
1771 | 1584 | ||
1772 | call MovePictureToWorkScreen |
1585 | call MovePictureToWorkScreen |
1773 | ;ret |
1586 | ;ret |
1774 | no_ellips: |
1587 | no_ellips: |
1775 | 1588 | ||
1776 | ret----->-----> |
1589 | ret |