Rev 9910 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
9715 | Doczom | 3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
2288 | clevermous | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
8 | $Revision: 9930 $ |
||
9 | |||
10 | |||
11 | ; check mouse |
||
12 | ; |
||
13 | ; |
||
14 | ; FB00 -> FB0F mouse memory 00 chunk count - FB0A-B x - FB0C-D y |
||
15 | ; FB10 -> FB17 mouse color mem |
||
16 | ; FB21 x move |
||
17 | ; FB22 y move |
||
18 | ; FB30 color temp |
||
19 | ; FB28 high bits temp |
||
20 | ; FB4A -> FB4D FB4A-B x-under - FB4C-D y-under |
||
21 | ; FC00 -> FCFE com1/ps2 buffer |
||
22 | ; FCFF com1/ps2 buffer count starting from FC00 |
||
23 | |||
24 | uglobal |
||
2430 | mario79 | 25 | ;-------------------------------------- |
26 | align 4 |
||
5154 | hidnplayr | 27 | mousecount dd ? |
28 | mousedata dd ? |
||
29 | Y_UNDER_sub_CUR_hot_y_add_curh dw ? |
||
30 | Y_UNDER_subtraction_CUR_hot_y dw ? |
||
31 | X_UNDER_sub_CUR_hot_x_add_curh dw ? |
||
32 | X_UNDER_subtraction_CUR_hot_x dw ? |
||
2288 | clevermous | 33 | endg |
34 | |||
35 | iglobal |
||
2430 | mario79 | 36 | ;-------------------------------------- |
37 | align 4 |
||
6230 | pathoswith | 38 | mouse_speed_factor dw 4 |
39 | mouse_delay db 3 |
||
5851 | pathoswith | 40 | mouse_doubleclick_delay db 64 |
2288 | clevermous | 41 | endg |
5154 | hidnplayr | 42 | |
2430 | mario79 | 43 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 44 | |
2430 | mario79 | 45 | align 4 |
2288 | clevermous | 46 | draw_mouse_under: |
5154 | hidnplayr | 47 | |
2288 | clevermous | 48 | ; return old picture |
49 | cmp [_display.restore_cursor], 0 |
||
50 | je @F |
||
51 | |||
52 | pushad |
||
53 | movzx eax, word [X_UNDER] |
||
54 | movzx ebx, word [Y_UNDER] |
||
55 | stdcall [_display.restore_cursor], eax, ebx |
||
56 | popad |
||
57 | ret |
||
5154 | hidnplayr | 58 | |
59 | @@: |
||
2288 | clevermous | 60 | pushad |
61 | xor ecx, ecx |
||
62 | xor edx, edx |
||
5154 | hidnplayr | 63 | |
9910 | Doczom | 64 | .mres: |
2288 | clevermous | 65 | movzx eax, word [X_UNDER] |
66 | movzx ebx, word [Y_UNDER] |
||
67 | add eax, ecx |
||
68 | add ebx, edx |
||
69 | push ecx |
||
70 | push edx |
||
71 | push eax |
||
72 | push ebx |
||
73 | mov eax, edx |
||
74 | shl eax, 6 |
||
75 | shl ecx, 2 |
||
76 | add eax, ecx |
||
77 | add eax, mouseunder |
||
78 | mov ecx, [eax] |
||
79 | pop ebx |
||
80 | pop eax |
||
2430 | mario79 | 81 | mov edi, 1 ; force |
82 | or ecx, 0x04000000 ; don't save to mouseunder area |
||
2453 | mario79 | 83 | ; call [putpixel] |
84 | call __sys_putpixel |
||
2288 | clevermous | 85 | pop edx |
86 | pop ecx |
||
87 | inc ecx |
||
88 | cmp ecx, 16 |
||
9910 | Doczom | 89 | jnz .mres |
90 | |||
2288 | clevermous | 91 | xor ecx, ecx |
92 | inc edx |
||
93 | cmp edx, 24 |
||
9910 | Doczom | 94 | jnz .mres |
95 | |||
2288 | clevermous | 96 | popad |
97 | ret |
||
5154 | hidnplayr | 98 | |
2430 | mario79 | 99 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 100 | |
2430 | mario79 | 101 | align 4 |
2288 | clevermous | 102 | save_draw_mouse: |
103 | cmp [_display.move_cursor], 0 |
||
104 | je .no_hw_cursor |
||
105 | pushad |
||
106 | |||
107 | mov [X_UNDER], ax |
||
108 | mov [Y_UNDER], bx |
||
109 | movzx eax, word [MOUSE_Y] |
||
110 | movzx ebx, word [MOUSE_X] |
||
111 | push eax |
||
112 | push ebx |
||
113 | |||
2446 | mario79 | 114 | mov eax, [d_width_calc_area + eax*4] |
115 | |||
5351 | serge | 116 | add eax, [_display.win_map] |
9715 | Doczom | 117 | movzx edx, byte [ebx + eax] |
9930 | Doczom | 118 | shl edx, BSF sizeof.WDATA |
9848 | rgimad | 119 | ; edx - thread slot of window under cursor |
9930 | Doczom | 120 | mov esi, [window_data + edx + WDATA.cursor] ; cursor of window under cursor |
2288 | clevermous | 121 | |
9848 | rgimad | 122 | ; if cursor of window under cursor already equal to the |
123 | ; current_cursor then just draw it |
||
2288 | clevermous | 124 | cmp esi, [current_cursor] |
125 | je .draw |
||
126 | |||
9848 | rgimad | 127 | ; eax = thread slot of current active window |
8866 | rgimad | 128 | mov eax, [thread_count] |
9715 | Doczom | 129 | movzx eax, word [WIN_POS + eax*2] |
9930 | Doczom | 130 | shl eax, BSF sizeof.WDATA |
3069 | serge | 131 | |
9848 | rgimad | 132 | ; window under cursor == active window ? |
3069 | serge | 133 | cmp eax, edx |
9850 | rgimad | 134 | je @f |
3069 | serge | 135 | |
9850 | rgimad | 136 | ; check whether active window is being resized now: |
9848 | rgimad | 137 | mov bl, [mouse.active_sys_window.action] |
138 | and bl, mouse.WINDOW_RESIZE_S_FLAG or mouse.WINDOW_RESIZE_W_FLAG or mouse.WINDOW_RESIZE_E_FLAG |
||
139 | test bl, bl |
||
9850 | rgimad | 140 | jz .active_isnt_resizing |
9930 | Doczom | 141 | mov esi, [window_data + eax + WDATA.cursor] ; esi = cursor of active window, it is resizing cursor |
9850 | rgimad | 142 | jmp @f |
143 | .active_isnt_resizing: |
||
9848 | rgimad | 144 | |
9850 | rgimad | 145 | ; if cursor of window under the cursor is resizing cursor then draw it. |
146 | cmp esi, [def_cursor_hresize] |
||
147 | je @f |
||
148 | cmp esi, [def_cursor_vresize] |
||
149 | je @f |
||
150 | cmp esi, [def_cursor_dresize1] |
||
151 | je @f |
||
152 | cmp esi, [def_cursor_dresize2] |
||
153 | je @f |
||
9848 | rgimad | 154 | |
9850 | rgimad | 155 | ; set cursor of window under cursor |
9930 | Doczom | 156 | mov esi, [window_data + edx + WDATA.cursor] |
3069 | serge | 157 | cmp esi, [current_cursor] |
158 | je .draw |
||
159 | |||
160 | @@: |
||
2288 | clevermous | 161 | push esi |
162 | call [_display.select_cursor] |
||
163 | mov [current_cursor], esi |
||
2430 | mario79 | 164 | ;-------------------------------------- |
165 | align 4 |
||
2288 | clevermous | 166 | .draw: |
167 | stdcall [_display.move_cursor], esi |
||
168 | popad |
||
169 | ret |
||
2430 | mario79 | 170 | ;-------------------------------------- |
171 | ;align 4 |
||
172 | ;.fail: |
||
173 | ; mov ecx, [def_cursor] |
||
9930 | Doczom | 174 | ; mov [window_data + edx + WDATA.cursor], ecx |
2430 | mario79 | 175 | ; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax |
176 | ; popad |
||
177 | ; ret |
||
178 | ;-------------------------------------- |
||
179 | align 4 |
||
2288 | clevermous | 180 | .no_hw_cursor: |
181 | pushad |
||
182 | ; save & draw |
||
183 | mov [X_UNDER], ax |
||
184 | mov [Y_UNDER], bx |
||
185 | push eax |
||
186 | push ebx |
||
187 | mov ecx, 0 |
||
188 | mov edx, 0 |
||
2430 | mario79 | 189 | ;-------------------------------------- |
190 | align 4 |
||
9910 | Doczom | 191 | .drm: |
2288 | clevermous | 192 | push eax |
193 | push ebx |
||
194 | push ecx |
||
195 | push edx |
||
196 | ; helloworld |
||
197 | push ecx |
||
5154 | hidnplayr | 198 | add eax, ecx ; save picture under mouse |
2288 | clevermous | 199 | add ebx, edx |
200 | push ecx |
||
5154 | hidnplayr | 201 | or ecx, 0x04000000 ; don't load to mouseunder area |
202 | push eax ebx edx edi |
||
203 | call [GETPIXEL] |
||
204 | pop edi edx ebx eax |
||
2288 | clevermous | 205 | mov [COLOR_TEMP], ecx |
206 | pop ecx |
||
207 | mov eax, edx |
||
208 | shl eax, 6 |
||
209 | shl ecx, 2 |
||
210 | add eax, ecx |
||
211 | add eax, mouseunder |
||
212 | mov ebx, [COLOR_TEMP] |
||
2430 | mario79 | 213 | and ebx, 0xffffff |
2288 | clevermous | 214 | mov [eax], ebx |
215 | pop ecx |
||
5154 | hidnplayr | 216 | mov edi, edx ; y cycle |
217 | shl edi, 4 ; *16 bytes per row |
||
218 | add edi, ecx ; x cycle |
||
2288 | clevermous | 219 | mov esi, edi |
220 | add edi, esi |
||
5154 | hidnplayr | 221 | add edi, esi ; *3 |
2288 | clevermous | 222 | add edi, [MOUSE_PICTURE] ; we have our str address |
223 | mov esi, edi |
||
224 | add esi, 16*24*3 |
||
225 | push ecx |
||
226 | mov ecx, [COLOR_TEMP] |
||
227 | call combine_colors |
||
2430 | mario79 | 228 | and ecx, 0xffffff |
2288 | clevermous | 229 | mov [MOUSE_COLOR_MEM], ecx |
230 | pop ecx |
||
231 | pop edx |
||
232 | pop ecx |
||
233 | pop ebx |
||
234 | pop eax |
||
5154 | hidnplayr | 235 | add eax, ecx ; we have x coord+cycle |
236 | add ebx, edx ; and y coord+cycle |
||
2288 | clevermous | 237 | push ecx |
238 | mov ecx, [MOUSE_COLOR_MEM] |
||
2430 | mario79 | 239 | mov edi, 1 ; force |
5154 | hidnplayr | 240 | or ecx, 0x04000000 ; don't save to mouseunder area |
2453 | mario79 | 241 | ; call [putpixel] |
242 | call __sys_putpixel |
||
2288 | clevermous | 243 | pop ecx |
244 | mov ebx, [esp+0] ; pure y coord again |
||
245 | mov eax, [esp+4] ; and x |
||
5154 | hidnplayr | 246 | inc ecx ; +1 cycle |
247 | cmp ecx, 16 ; if more than 16 |
||
9910 | Doczom | 248 | jnz .drm |
249 | |||
2288 | clevermous | 250 | xor ecx, ecx |
251 | inc edx |
||
252 | cmp edx, 24 |
||
9910 | Doczom | 253 | jnz .drm |
254 | |||
2288 | clevermous | 255 | add esp, 8 |
256 | popad |
||
257 | ret |
||
5154 | hidnplayr | 258 | |
2430 | mario79 | 259 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 260 | |
2430 | mario79 | 261 | align 4 |
2288 | clevermous | 262 | combine_colors: |
263 | ; in |
||
264 | ; ecx - color ( 00 RR GG BB ) |
||
265 | ; edi - ref to new color byte |
||
266 | ; esi - ref to alpha byte |
||
267 | ; |
||
268 | ; out |
||
269 | ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) |
||
270 | push eax |
||
271 | push ebx |
||
272 | push edx |
||
273 | push ecx |
||
274 | xor ecx, ecx |
||
5154 | hidnplayr | 275 | ; byte 0 |
2288 | clevermous | 276 | mov eax, 0xff |
277 | sub al, [esi+0] |
||
278 | mov ebx, [esp] |
||
279 | shr ebx, 16 |
||
280 | and ebx, 0xff |
||
281 | mul ebx |
||
282 | shr eax, 8 |
||
283 | add ecx, eax |
||
284 | xor eax, eax |
||
285 | xor ebx, ebx |
||
286 | mov al, [edi+0] |
||
287 | mov bl, [esi+0] |
||
288 | mul ebx |
||
289 | shr eax, 8 |
||
290 | add ecx, eax |
||
291 | shl ecx, 8 |
||
292 | ; byte 1 |
||
293 | mov eax, 0xff |
||
294 | sub al, [esi+1] |
||
295 | mov ebx, [esp] |
||
296 | shr ebx, 8 |
||
297 | and ebx, 0xff |
||
298 | mul ebx |
||
299 | shr eax, 8 |
||
300 | add ecx, eax |
||
301 | xor eax, eax |
||
302 | xor ebx, ebx |
||
303 | mov al, [edi+1] |
||
304 | mov bl, [esi+1] |
||
305 | mul ebx |
||
306 | shr eax, 8 |
||
307 | add ecx, eax |
||
308 | shl ecx, 8 |
||
309 | ; byte 2 |
||
310 | mov eax, 0xff |
||
311 | sub al, [esi+2] |
||
312 | mov ebx, [esp] |
||
313 | and ebx, 0xff |
||
314 | mul ebx |
||
315 | shr eax, 8 |
||
316 | add ecx, eax |
||
317 | xor eax, eax |
||
318 | xor ebx, ebx |
||
319 | mov al, [edi+2] |
||
320 | mov bl, [esi+2] |
||
321 | mul ebx |
||
322 | shr eax, 8 |
||
323 | add ecx, eax |
||
324 | pop eax |
||
325 | pop edx |
||
326 | pop ebx |
||
327 | pop eax |
||
328 | ret |
||
5154 | hidnplayr | 329 | |
2430 | mario79 | 330 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 331 | |
2430 | mario79 | 332 | align 4 |
333 | check_mouse_area_for_getpixel: |
||
334 | ; in: |
||
335 | ; eax = x |
||
336 | ; ebx = y |
||
337 | ; out: |
||
338 | ; ecx = new color |
||
339 | push eax ebx |
||
340 | ; check for Y |
||
341 | xor ecx, ecx |
||
5154 | hidnplayr | 342 | mov cx, [Y_UNDER] ; [MOUSE_Y] |
2288 | clevermous | 343 | |
2430 | mario79 | 344 | cmp ebx, ecx |
345 | jb .no_mouse_area |
||
5154 | hidnplayr | 346 | add ecx, 23 ; mouse cursor Y size |
2430 | mario79 | 347 | cmp ebx, ecx |
348 | ja .no_mouse_area |
||
349 | ; offset Y |
||
5154 | hidnplayr | 350 | sub bx, [Y_UNDER] ; [MOUSE_Y] |
2430 | mario79 | 351 | ;-------------------------------------- |
352 | ; check for X |
||
353 | xor ecx, ecx |
||
5154 | hidnplayr | 354 | mov cx, [X_UNDER] ; [MOUSE_X] |
2288 | clevermous | 355 | cmp eax, ecx |
2430 | mario79 | 356 | jb .no_mouse_area |
5154 | hidnplayr | 357 | add ecx, 15 ; mouse cursor X size |
2288 | clevermous | 358 | cmp eax, ecx |
2430 | mario79 | 359 | ja .no_mouse_area |
360 | ; offset X |
||
5154 | hidnplayr | 361 | sub ax, [X_UNDER] ; [MOUSE_X] |
2430 | mario79 | 362 | ;-------------------------------------- |
363 | ; eax = offset x |
||
364 | ; ebx = offset y |
||
365 | shl ebx, 6 ;y |
||
366 | shl eax, 2 ;x |
||
367 | add eax, ebx |
||
368 | add eax, mouseunder |
||
369 | mov ecx, [eax] |
||
370 | and ecx, 0xffffff |
||
371 | or ecx, 0xff000000 |
||
372 | pop ebx eax |
||
2288 | clevermous | 373 | ret |
5154 | hidnplayr | 374 | |
375 | .no_mouse_area: |
||
2430 | mario79 | 376 | xor ecx, ecx |
377 | pop ebx eax |
||
378 | ret |
||
5154 | hidnplayr | 379 | |
2430 | mario79 | 380 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 381 | |
2430 | mario79 | 382 | align 4 |
383 | check_mouse_area_for_putpixel: |
||
384 | ; in: |
||
385 | ; ecx = x shl 16 + y |
||
386 | ; eax = color |
||
387 | ; out: |
||
388 | ; eax = new color |
||
389 | push eax |
||
390 | ; check for Y |
||
5154 | hidnplayr | 391 | mov ax, [Y_UNDER] ; [MOUSE_Y] |
2430 | mario79 | 392 | cmp cx, ax |
393 | jb .no_mouse_area |
||
5154 | hidnplayr | 394 | add ax, 23 ; mouse cursor Y size |
2430 | mario79 | 395 | cmp cx, ax |
396 | ja .no_mouse_area |
||
397 | ; offset Y |
||
5154 | hidnplayr | 398 | sub cx, [Y_UNDER] ; [MOUSE_Y] |
2430 | mario79 | 399 | mov ax, cx |
400 | shl eax, 16 |
||
5154 | hidnplayr | 401 | |
2430 | mario79 | 402 | ; check for X |
5154 | hidnplayr | 403 | mov ax, [X_UNDER] ; [MOUSE_X] |
2430 | mario79 | 404 | shr ecx, 16 |
405 | cmp cx, ax |
||
406 | jb .no_mouse_area |
||
5154 | hidnplayr | 407 | add ax, 15 ; mouse cursor X size |
2430 | mario79 | 408 | cmp cx, ax |
409 | ja .no_mouse_area |
||
410 | ; offset X |
||
5154 | hidnplayr | 411 | sub cx, [X_UNDER] ; [MOUSE_X] |
2430 | mario79 | 412 | mov ax, cx |
5154 | hidnplayr | 413 | |
2430 | mario79 | 414 | ; eax = (offset y) shl 16 + (offset x) |
2288 | clevermous | 415 | |
2430 | mario79 | 416 | pop ecx |
417 | |||
418 | push eax ebx |
||
419 | |||
420 | mov ebx, eax |
||
5154 | hidnplayr | 421 | shr ebx, 16 ; y |
422 | and eax, 0xffff ; x |
||
2430 | mario79 | 423 | |
424 | shl ebx, 6 |
||
425 | shl eax, 2 |
||
426 | add eax, ebx |
||
427 | add eax, mouseunder |
||
428 | and ecx, 0xFFFFFF |
||
429 | mov [eax], ecx |
||
430 | |||
431 | pop ebx eax |
||
432 | |||
433 | push esi edi |
||
434 | rol eax, 16 |
||
5154 | hidnplayr | 435 | movzx edi, ax ; y cycle |
436 | shl edi, 4 ; *16 bytes per row |
||
2430 | mario79 | 437 | shr eax, 16 |
5154 | hidnplayr | 438 | add edi, eax ; x cycle |
2430 | mario79 | 439 | lea edi, [edi*3] |
440 | add edi, [MOUSE_PICTURE] ; we have our str address |
||
441 | mov esi, edi |
||
442 | add esi, 16*24*3 |
||
443 | call combine_colors |
||
444 | pop edi esi |
||
445 | mov eax, ecx |
||
2288 | clevermous | 446 | ret |
5154 | hidnplayr | 447 | |
448 | .no_mouse_area: |
||
2288 | clevermous | 449 | pop eax |
450 | ret |
||
5154 | hidnplayr | 451 | |
2430 | mario79 | 452 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 453 | |
2430 | mario79 | 454 | align 4 |
455 | __sys_draw_pointer: |
||
2288 | clevermous | 456 | pushad |
457 | movzx ecx, word [X_UNDER] |
||
458 | movzx edx, word [Y_UNDER] |
||
459 | movzx ebx, word [MOUSE_Y] |
||
460 | movzx eax, word [MOUSE_X] |
||
2450 | mario79 | 461 | cmp [redrawmouse_unconditional], 0 |
462 | je @f |
||
463 | mov [redrawmouse_unconditional], 0 |
||
464 | jmp redrawmouse |
||
5154 | hidnplayr | 465 | @@: |
2288 | clevermous | 466 | cmp eax, ecx |
467 | jne redrawmouse |
||
468 | cmp ebx, edx |
||
2430 | mario79 | 469 | je nodmp |
5154 | hidnplayr | 470 | |
2430 | mario79 | 471 | ;-------------------------------------- |
5154 | hidnplayr | 472 | |
2430 | mario79 | 473 | align 4 |
2288 | clevermous | 474 | redrawmouse: |
475 | pushfd |
||
476 | cli |
||
477 | call draw_mouse_under |
||
478 | call save_draw_mouse |
||
2430 | mario79 | 479 | |
2448 | mario79 | 480 | ; mov eax, [_display.select_cursor] |
481 | ; test eax, eax |
||
482 | ; jz @f |
||
483 | cmp [_display.select_cursor], select_cursor |
||
484 | jne @f |
||
2430 | mario79 | 485 | |
486 | xor eax, eax |
||
487 | mov esi, [current_cursor] |
||
488 | |||
489 | mov ax, [Y_UNDER] |
||
9715 | Doczom | 490 | sub eax, [esi + CURSOR.hot_y] |
2575 | mario79 | 491 | mov [Y_UNDER_subtraction_CUR_hot_y], ax |
2430 | mario79 | 492 | add eax, [cur.h] |
2575 | mario79 | 493 | mov [Y_UNDER_sub_CUR_hot_y_add_curh], ax |
2430 | mario79 | 494 | |
495 | mov ax, [X_UNDER] |
||
9715 | Doczom | 496 | sub eax, [esi + CURSOR.hot_x] |
2575 | mario79 | 497 | mov [X_UNDER_subtraction_CUR_hot_x], ax |
2430 | mario79 | 498 | add eax, [cur.w] |
2575 | mario79 | 499 | mov [X_UNDER_sub_CUR_hot_x_add_curh], ax |
5154 | hidnplayr | 500 | @@: |
2288 | clevermous | 501 | popfd |
5154 | hidnplayr | 502 | nodmp: |
2288 | clevermous | 503 | popad |
504 | ret |
||
5154 | hidnplayr | 505 | |
2430 | mario79 | 506 | ;----------------------------------------------------------------------------- |
5154 | hidnplayr | 507 | |
2430 | mario79 | 508 | align 4 |
6230 | pathoswith | 509 | proc set_mouse_data stdcall uses ecx edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword |
2288 | clevermous | 510 | |
511 | mov eax, [BtnState] |
||
5154 | hidnplayr | 512 | and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements |
2288 | clevermous | 513 | mov [BTN_DOWN], eax |
4592 | hidnplayr | 514 | ;-------------------------------------- |
2288 | clevermous | 515 | mov eax, [XMoving] |
4529 | hidnplayr | 516 | test [BtnState], 0x80000000 |
4592 | hidnplayr | 517 | jnz .absolute_x |
5853 | pathoswith | 518 | test eax, eax |
519 | jz @f |
||
2288 | clevermous | 520 | call mouse_acceleration |
4592 | hidnplayr | 521 | add ax, [MOUSE_X] |
5853 | pathoswith | 522 | jns .check_x |
523 | xor eax, eax |
||
4592 | hidnplayr | 524 | jmp .set_x |
525 | .absolute_x: |
||
526 | mov edx, [_display.width] |
||
527 | mul edx |
||
528 | shr eax, 15 |
||
529 | .check_x: |
||
5350 | serge | 530 | cmp ax, word[_display.width] |
4592 | hidnplayr | 531 | jl .set_x |
5350 | serge | 532 | mov ax, word[_display.width] |
533 | dec ax |
||
4592 | hidnplayr | 534 | .set_x: |
535 | mov [MOUSE_X], ax |
||
2430 | mario79 | 536 | ;-------------------------------------- |
5853 | pathoswith | 537 | @@: |
2288 | clevermous | 538 | mov eax, [YMoving] |
4529 | hidnplayr | 539 | test [BtnState], 0x40000000 |
4592 | hidnplayr | 540 | jnz .absolute_y |
5853 | pathoswith | 541 | test eax, eax |
542 | jz @f |
||
2288 | clevermous | 543 | neg eax |
544 | call mouse_acceleration |
||
4592 | hidnplayr | 545 | add ax, [MOUSE_Y] |
5853 | pathoswith | 546 | jns .check_y |
547 | xor eax, eax |
||
4592 | hidnplayr | 548 | jmp .set_y |
549 | .absolute_y: |
||
550 | mov edx, [_display.height] |
||
551 | mul edx |
||
552 | shr eax, 15 |
||
553 | .check_y: |
||
5350 | serge | 554 | cmp ax, word[_display.height] |
4592 | hidnplayr | 555 | jl .set_y |
5350 | serge | 556 | mov ax, word[_display.height] |
557 | dec ax |
||
4592 | hidnplayr | 558 | .set_y: |
559 | mov [MOUSE_Y], ax |
||
2430 | mario79 | 560 | ;-------------------------------------- |
5853 | pathoswith | 561 | @@: |
2288 | clevermous | 562 | mov eax, [VScroll] |
5851 | pathoswith | 563 | test eax, eax |
564 | jz @f |
||
2288 | clevermous | 565 | add [MOUSE_SCROLL_V], ax |
5851 | pathoswith | 566 | bts word [BTN_DOWN], 15 |
567 | @@: |
||
2288 | clevermous | 568 | mov eax, [HScroll] |
5851 | pathoswith | 569 | test eax, eax |
570 | jz @f |
||
2288 | clevermous | 571 | add [MOUSE_SCROLL_H], ax |
5851 | pathoswith | 572 | bts dword [BTN_DOWN], 23 |
573 | @@: |
||
2288 | clevermous | 574 | mov [mouse_active], 1 |
3534 | clevermous | 575 | call wakeup_osloop |
2288 | clevermous | 576 | ret |
577 | endp |
||
5154 | hidnplayr | 578 | |
2430 | mario79 | 579 | ;----------------------------------------------------------------------------- |
2288 | clevermous | 580 | mouse_acceleration: |
6230 | pathoswith | 581 | neg ax |
582 | jl mouse_acceleration |
||
583 | add al, [mouse_delay] |
||
584 | mul al |
||
585 | mov cx, [mouse_speed_factor] |
||
586 | dec ax |
||
587 | shr ax, cl |
||
588 | inc ax |
||
589 | test eax, eax |
||
590 | jns @f |
||
591 | neg ax |
||
5853 | pathoswith | 592 | @@: |
2288 | clevermous | 593 | ret |