Rev 38 | Rev 54 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 38 | Rev 41 | ||
---|---|---|---|
1 | max_buttons=4095 |
1 | max_buttons=4095 |
2 | dececx: |
2 | dececx: |
3 | push edx |
3 | push edx |
4 | push ecx |
4 | push ecx |
5 | 5 | ||
6 | mov edx,2 |
6 | mov edx,2 |
7 | .loop: |
7 | .loop: |
8 | 8 | ||
9 | cmp byte [esp+edx],0x20 |
9 | cmp byte [esp+edx],0x20 |
10 | jae @f |
10 | jae @f |
11 | mov [esp+edx],byte 0x20 |
11 | mov [esp+edx],byte 0x20 |
12 | @@: |
12 | @@: |
13 | sub [esp+edx],byte 0x20 |
13 | sub [esp+edx],byte 0x20 |
14 | 14 | ||
15 | dec edx |
15 | dec edx |
16 | jns .loop |
16 | jns .loop |
17 | 17 | ||
18 | pop ecx |
18 | pop ecx |
19 | pop edx |
19 | pop edx |
20 | ret |
20 | ret |
21 | 21 | ||
22 | incecx: |
22 | incecx: |
23 | push edx |
23 | push edx |
24 | push ecx |
24 | push ecx |
25 | 25 | ||
26 | mov edx,2 |
26 | mov edx,2 |
27 | .loop: |
27 | .loop: |
28 | 28 | ||
29 | cmp byte [esp+edx],0xdf |
29 | cmp byte [esp+edx],0xdf |
30 | jbe @f |
30 | jbe @f |
31 | mov [esp+edx],byte 0xdf |
31 | mov [esp+edx],byte 0xdf |
32 | @@: |
32 | @@: |
33 | add [esp+edx],byte 0x20 |
33 | add [esp+edx],byte 0x20 |
34 | 34 | ||
35 | dec edx |
35 | dec edx |
36 | jns .loop |
36 | jns .loop |
37 | pop ecx |
37 | pop ecx |
38 | pop edx |
38 | pop edx |
39 | ret |
39 | ret |
40 | 40 | ||
41 | incecx2: |
41 | incecx2: |
42 | push edx |
42 | push edx |
43 | push ecx |
43 | push ecx |
44 | 44 | ||
45 | mov edx,2 |
45 | mov edx,2 |
46 | .loop: |
46 | .loop: |
47 | 47 | ||
48 | cmp byte [esp+edx],0xeb |
48 | cmp byte [esp+edx],0xeb |
49 | jbe @f |
49 | jbe @f |
50 | mov [esp+edx],byte 0xeb |
50 | mov [esp+edx],byte 0xeb |
51 | @@: |
51 | @@: |
52 | add [esp+edx],byte 0x14 |
52 | add [esp+edx],byte 0x14 |
53 | 53 | ||
54 | dec edx |
54 | dec edx |
55 | jns .loop |
55 | jns .loop |
56 | pop ecx |
56 | pop ecx |
57 | pop edx |
57 | pop edx |
58 | ret |
58 | ret |
59 | 59 | ||
60 | drawbuttonframes: |
60 | drawbuttonframes: |
61 | 61 | ||
62 | push esi |
62 | push esi |
63 | push edi |
63 | push edi |
64 | push eax |
64 | push eax |
65 | push ebx |
65 | push ebx |
66 | push ecx |
66 | push ecx |
67 | push edx |
67 | push edx |
68 | 68 | ||
69 | shr eax,16 |
69 | shr eax,16 |
70 | shr ebx,16 |
70 | shr ebx,16 |
71 | mov edx,[0x3010] |
71 | mov edx,[0x3010] |
72 | 72 | ||
73 | add eax,[edx-twdw] |
73 | add eax,[edx-twdw] |
74 | add ebx,[edx-twdw+4] |
74 | add ebx,[edx-twdw+4] |
75 | mov cx,ax |
75 | mov cx,ax |
76 | mov dx,bx |
76 | mov dx,bx |
77 | shl eax,16 |
77 | shl eax,16 |
78 | shl ebx,16 |
78 | shl ebx,16 |
79 | mov ax,cx |
79 | mov ax,cx |
80 | mov bx,dx |
80 | mov bx,dx |
81 | add ax,word [esp+12] |
81 | add ax,word [esp+12] |
82 | mov esi,ebx |
82 | mov esi,ebx |
83 | mov edi,0 |
83 | mov edi,0 |
84 | mov ecx,[esp+0] |
84 | mov ecx,[esp+0] |
85 | call incecx |
85 | call incecx |
86 | call [draw_line] |
86 | call [draw_line] |
87 | 87 | ||
88 | movzx edx,word [esp+8] |
88 | movzx edx,word [esp+8] |
89 | add ebx,edx |
89 | add ebx,edx |
90 | shl edx,16 |
90 | shl edx,16 |
91 | add ebx,edx |
91 | add ebx,edx |
92 | mov ecx,[esp+0] |
92 | mov ecx,[esp+0] |
93 | call dececx |
93 | call dececx |
94 | call [draw_line] |
94 | call [draw_line] |
95 | 95 | ||
96 | mov ebx,esi |
96 | mov ebx,esi |
97 | push edx |
97 | push edx |
98 | mov edx,eax |
98 | mov edx,eax |
99 | shr edx,16 |
99 | shr edx,16 |
100 | mov ax,dx |
100 | mov ax,dx |
101 | mov edx,ebx |
101 | mov edx,ebx |
102 | shr edx,16 |
102 | shr edx,16 |
103 | mov bx,dx |
103 | mov bx,dx |
104 | mov dx,[esp+8+4] |
104 | mov dx,[esp+8+4] |
105 | add bx,dx |
105 | add bx,dx |
106 | pop edx |
106 | pop edx |
107 | mov edi,0 |
107 | mov edi,0 |
108 | mov ecx,[esp+0] |
108 | mov ecx,[esp+0] |
109 | call incecx |
109 | call incecx |
110 | call [draw_line] |
110 | call [draw_line] |
111 | 111 | ||
112 | mov esi,edx |
112 | mov esi,edx |
113 | mov dx,[esp+12] |
113 | mov dx,[esp+12] |
114 | add ax,dx |
114 | add ax,dx |
115 | shl edx,16 |
115 | shl edx,16 |
116 | add eax,edx |
116 | add eax,edx |
117 | add ebx,1*65536 |
117 | add ebx,1*65536 |
118 | mov edx,esi |
118 | mov edx,esi |
119 | mov ecx,[esp+0] |
119 | mov ecx,[esp+0] |
120 | call dececx |
120 | call dececx |
121 | call [draw_line] |
121 | call [draw_line] |
122 | 122 | ||
123 | pop edx |
123 | pop edx |
124 | pop ecx |
124 | pop ecx |
125 | pop ebx |
125 | pop ebx |
126 | pop eax |
126 | pop eax |
127 | pop edi |
127 | pop edi |
128 | pop esi |
128 | pop esi |
129 | 129 | ||
130 | ret |
130 | ret |
131 | 131 | ||
132 | button_dececx: |
132 | button_dececx: |
133 | 133 | ||
134 | cmp [buttontype],dword 1 |
134 | cmp [buttontype],dword 1 |
135 | jne .finish |
135 | jne .finish |
136 | ; je bdece |
136 | ; je bdece |
137 | ; ret |
137 | ; ret |
138 | ; bdece: |
138 | ; bdece: |
139 | push eax |
139 | push eax |
140 | mov eax,0x01 |
140 | mov eax,0x01 |
141 | cmp edi,20 |
141 | cmp edi,20 |
142 | jg @f |
142 | jg @f |
143 | mov eax,0x02 |
143 | mov eax,0x02 |
144 | @@: |
144 | @@: |
145 | test ecx,0xff |
145 | test ecx,0xff |
146 | jz @f |
146 | jz @f |
147 | sub ecx,eax |
147 | sub ecx,eax |
148 | @@: |
148 | @@: |
149 | shl eax,8 |
149 | shl eax,8 |
150 | test ecx,0xff00 |
150 | test ecx,0xff00 |
151 | jz @f |
151 | jz @f |
152 | sub ecx,eax |
152 | sub ecx,eax |
153 | @@: |
153 | @@: |
154 | shl eax,8 |
154 | shl eax,8 |
155 | test ecx,0xff0000 |
155 | test ecx,0xff0000 |
156 | jz @f |
156 | jz @f |
157 | sub ecx,eax |
157 | sub ecx,eax |
158 | @@: |
158 | @@: |
159 | pop eax |
159 | pop eax |
160 | .finish: |
160 | .finish: |
161 | ret |
161 | ret |
162 | 162 | ||
163 | 163 | ||
164 | sys_button: |
164 | sys_button: |
165 | 165 | ||
166 | test ecx,0x80000000 |
166 | test ecx,0x80000000 |
167 | jnz remove_button |
167 | jnz remove_button |
168 | 168 | ||
169 | push esi |
169 | push esi |
170 | push edi |
170 | push edi |
171 | push eax |
171 | push eax |
172 | push ebx |
172 | push ebx |
173 | push ecx |
173 | push ecx |
174 | push edx |
174 | push edx |
175 | 175 | ||
176 | test ecx,0x40000000 |
176 | test ecx,0x40000000 |
177 | jnz button_no_draw |
177 | jnz button_no_draw |
178 | 178 | ||
179 | pushad ; button body |
179 | pushad ; button body |
180 | push ebx |
180 | push ebx |
181 | shr eax,16 |
181 | shr eax,16 |
182 | shr ebx,16 |
182 | shr ebx,16 |
183 | mov edx,[0x3010] |
183 | mov edx,[0x3010] |
184 | mov esi,[edx-twdw] |
184 | mov esi,[edx-twdw] |
185 | mov edi,[edx-twdw+4] |
185 | mov edi,[edx-twdw+4] |
186 | add eax,esi |
186 | add eax,esi |
187 | add ebx,edi |
187 | add ebx,edi |
188 | mov cx,ax |
188 | mov cx,ax |
189 | mov dx,bx |
189 | mov dx,bx |
190 | shl eax,16 |
190 | shl eax,16 |
191 | shl ebx,16 |
191 | shl ebx,16 |
192 | mov ax,cx |
192 | mov ax,cx |
193 | mov bx,dx |
193 | mov bx,dx |
194 | movzx ecx,word [4+32+esp+12] |
194 | movzx ecx,word [4+32+esp+12] |
195 | add eax,ecx |
195 | add eax,ecx |
196 | mov ecx,[4+32+esp+0] |
196 | mov ecx,[4+32+esp+0] |
197 | cmp [buttontype],dword 0 |
197 | cmp [buttontype],dword 0 |
198 | je @f |
198 | je @f |
199 | call incecx2 |
199 | call incecx2 |
200 | @@: |
200 | @@: |
201 | movzx edi,word [esp] |
201 | movzx edi,word [esp] |
202 | 202 | ||
203 | ; |
203 | ; |
204 | pop edx |
204 | pop edx |
205 | and edx, 0xFFFF |
205 | and edx, 0xFFFF |
206 | ;;cli |
206 | ;;cli |
207 | .newline: |
207 | .newline: |
208 | call button_dececx |
208 | call button_dececx |
209 | push edi |
209 | push edi |
210 | xor edi, edi |
210 | xor edi, edi |
211 | call [draw_line] |
211 | call [draw_line] |
212 | pop edi |
212 | pop edi |
213 | add ebx,1*65536+1 ; [ y start | y end ] |
213 | add ebx,1*65536+1 ; [ y start | y end ] |
214 | dec edx |
214 | dec edx |
215 | jnz .newline |
215 | jnz .newline |
216 | ;;sti |
216 | ;;sti |
217 | ;; pop ebx |
217 | ;; pop ebx |
218 | ; |
218 | ; |
219 | popad |
219 | popad |
220 | 220 | ||
221 | call drawbuttonframes |
221 | call drawbuttonframes |
222 | 222 | ||
223 | button_no_draw: |
223 | button_no_draw: |
224 | 224 | ||
225 | and ecx,0xffff |
225 | and ecx,0xffff |
226 | 226 | ||
227 | mov edi,[0x3010] |
227 | mov edi,[0x3010] |
228 | sub edi,twdw |
228 | sub edi,twdw |
229 | 229 | ||
230 | mov edi,[0xfe88] |
230 | mov edi,[0xfe88] |
231 | movzx eax,word [edi] |
231 | movzx eax,word [edi] |
232 | cmp eax,max_buttons |
232 | cmp eax,max_buttons |
233 | jge noaddbutt |
233 | jge noaddbutt |
234 | inc eax |
234 | inc eax |
235 | mov [edi],ax |
235 | mov [edi],ax |
236 | 236 | ||
237 | shl eax,4 |
237 | shl eax,4 |
238 | add eax,edi |
238 | add eax,edi |
239 | 239 | ||
240 | mov bx,[0x3000] |
240 | mov bx,[0x3000] |
241 | mov [eax],bx |
241 | mov [eax],bx |
242 | 242 | ||
243 | add eax,2 ; save button id number |
243 | add eax,2 ; save button id number |
244 | mov ebx,[esp+4] |
244 | mov ebx,[esp+4] |
245 | mov [eax],bx ; bits 0-15 |
245 | mov [eax],bx ; bits 0-15 |
246 | shr ebx,16 |
246 | shr ebx,16 |
247 | mov [eax-2+0xc],bx; bits 16-31 |
247 | mov [eax-2+0xc],bx; bits 16-31 |
248 | add eax,2 ; x start |
248 | add eax,2 ; x start |
249 | mov bx,[esp+12+2] |
249 | mov bx,[esp+12+2] |
250 | mov [eax],bx |
250 | mov [eax],bx |
251 | add eax,2 ; x size |
251 | add eax,2 ; x size |
252 | mov bx,[esp+12+0] |
252 | mov bx,[esp+12+0] |
253 | mov [eax],bx |
253 | mov [eax],bx |
254 | add eax,2 ; y start |
254 | add eax,2 ; y start |
255 | mov bx,[esp+8+2] |
255 | mov bx,[esp+8+2] |
256 | mov [eax],bx |
256 | mov [eax],bx |
257 | add eax,2 ; y size |
257 | add eax,2 ; y size |
258 | mov bx,[esp+8+0] |
258 | mov bx,[esp+8+0] |
259 | mov [eax],bx |
259 | mov [eax],bx |
260 | 260 | ||
261 | noaddbutt: |
261 | noaddbutt: |
262 | 262 | ||
263 | pop edx |
263 | pop edx |
264 | pop ecx |
264 | pop ecx |
265 | pop ebx |
265 | pop ebx |
266 | pop eax |
266 | pop eax |
267 | pop edi |
267 | pop edi |
268 | pop esi |
268 | pop esi |
269 | 269 | ||
270 | ret |
270 | ret |
271 | 271 | ||
272 | 272 | ||
273 | remove_button: |
273 | remove_button: |
274 | 274 | ||
275 | and ecx,0x7fffffff |
275 | and ecx,0x7fffffff |
276 | 276 | ||
277 | rnewba2: |
277 | rnewba2: |
278 | 278 | ||
279 | mov edi,[0xfe88] |
279 | mov edi,[0xfe88] |
280 | mov eax,edi |
280 | mov eax,edi |
281 | movzx ebx,word [edi] |
281 | movzx ebx,word [edi] |
282 | inc bx |
282 | inc bx |
283 | 283 | ||
284 | rnewba: |
284 | rnewba: |
285 | 285 | ||
286 | dec bx |
286 | dec bx |
287 | jz rnmba |
287 | jz rnmba |
288 | 288 | ||
289 | add eax,0x10 |
289 | add eax,0x10 |
290 | 290 | ||
291 | mov dx,[0x3000] |
291 | mov dx,[0x3000] |
292 | cmp dx,[eax] |
292 | cmp dx,[eax] |
293 | jnz rnewba |
293 | jnz rnewba |
294 | 294 | ||
295 | cmp cx,[eax+2] |
295 | cmp cx,[eax+2] |
296 | jnz rnewba |
296 | jnz rnewba |
297 | 297 | ||
298 | pushad |
298 | pushad |
299 | mov ecx,ebx |
299 | mov ecx,ebx |
300 | inc ecx |
300 | inc ecx |
301 | shl ecx,4 |
301 | shl ecx,4 |
302 | mov ebx,eax |
302 | mov ebx,eax |
303 | add eax,0x10 |
303 | add eax,0x10 |
304 | call memmove |
304 | call memmove |
305 | dec dword [edi] |
305 | dec dword [edi] |
306 | popad |
306 | popad |
307 | 307 | ||
308 | jmp rnewba2 |
308 | jmp rnewba2 |
309 | 309 | ||
310 | rnmba: |
310 | rnmba: |
311 | 311 | ||
312 | ret |
312 | ret |
313 | 313 | ||
314 | find_pressed_button_frames: |
314 | find_pressed_button_frames: |
315 | 315 | ||
316 | pushad |
316 | pushad |
317 | 317 | ||
318 | movzx ebx,word [eax+0] |
318 | movzx ebx,word [eax+0] |
319 | shl ebx,5 |
319 | shl ebx,5 |
320 | add ebx,window_data |
320 | add ebx,window_data |
321 | movzx ecx,word [ebx+0] ; window x start |
321 | movzx ecx,word [ebx+0] ; window x start |
322 | movzx edx,word [eax+4] ; button x start |
322 | movzx edx,word [eax+4] ; button x start |
323 | add ecx,edx |
323 | add ecx,edx |
324 | push ecx |
324 | push ecx |
325 | 325 | ||
326 | mov dx,[eax+6] ; button x size |
326 | mov dx,[eax+6] ; button x size |
327 | add cx,dx |
327 | add cx,dx |
328 | mov esi,ecx |
328 | mov esi,ecx |
329 | inc esi |
329 | inc esi |
330 | mov cx,[ebx+4] ; window y start |
330 | mov cx,[ebx+4] ; window y start |
331 | mov dx,[eax+8] ; button y start |
331 | mov dx,[eax+8] ; button y start |
332 | add ecx,edx |
332 | add ecx,edx |
333 | mov ebx,ecx |
333 | mov ebx,ecx |
334 | mov dx,[eax+10] ; button y size |
334 | mov dx,[eax+10] ; button y size |
335 | add dx,cx |
335 | add dx,cx |
336 | inc dx |
336 | inc dx |
337 | 337 | ||
338 | pop eax |
338 | pop eax |
339 | 339 | ||
340 | ; eax x beginning |
340 | ; eax x beginning |
341 | ; ebx y beginning |
341 | ; ebx y beginning |
342 | ; esi x end |
342 | ; esi x end |
343 | ; edx y end |
343 | ; edx y end |
344 | ; ecx color |
344 | ; ecx color |
345 | 345 | ||
346 | mov [pressed_button_eax],eax |
346 | mov [pressed_button_eax],eax |
347 | mov [pressed_button_ebx],ebx |
347 | mov [pressed_button_ebx],ebx |
348 | mov [pressed_button_ecx],ecx |
348 | mov [pressed_button_ecx],ecx |
349 | mov [pressed_button_edx],edx |
349 | mov [pressed_button_edx],edx |
350 | mov [pressed_button_esi],esi |
350 | mov [pressed_button_esi],esi |
351 | 351 | ||
352 | popad |
352 | popad |
353 | ret |
353 | ret |
354 | 354 | ||
355 | uglobal |
355 | uglobal |
356 | pressed_button_eax dd 0 |
356 | pressed_button_eax dd 0 |
357 | pressed_button_ebx dd 0 |
357 | pressed_button_ebx dd 0 |
358 | pressed_button_ecx dd 0 |
358 | pressed_button_ecx dd 0 |
359 | pressed_button_edx dd 0 |
359 | pressed_button_edx dd 0 |
360 | pressed_button_esi dd 0 |
360 | pressed_button_esi dd 0 |
361 | endg |
361 | endg |
362 | 362 | ||
363 | ; negative button image |
363 | ; negative button image |
364 | 364 | ||
365 | negativebutton: |
365 | negativebutton: |
366 | ; If requested, do not display button |
366 | ; If requested, do not display button |
367 | ; boarder on press. |
367 | ; boarder on press. |
368 | test ebx,0x20000000 |
368 | test ebx,0x20000000 |
369 | jz draw_negative_button |
369 | jz draw_negative_button |
370 | ret |
370 | ret |
371 | draw_negative_button: |
371 | draw_negative_button: |
372 | 372 | ||
373 | pushad |
373 | pushad |
374 | 374 | ||
375 | mov eax,[pressed_button_eax] |
375 | mov eax,[pressed_button_eax] |
376 | mov ebx,[pressed_button_ebx] |
376 | mov ebx,[pressed_button_ebx] |
377 | mov ecx,[pressed_button_ecx] |
377 | mov ecx,[pressed_button_ecx] |
378 | mov edx,[pressed_button_edx] |
378 | mov edx,[pressed_button_edx] |
379 | mov esi,[pressed_button_esi] |
379 | mov esi,[pressed_button_esi] |
380 | mov ecx,0x01000000 |
380 | mov ecx,0x01000000 |
381 | 381 | ||
382 | dec edx |
382 | dec edx |
383 | push edx |
383 | push edx |
384 | inc edx |
384 | inc edx |
385 | dec esi |
385 | dec esi |
386 | push esi |
386 | push esi |
387 | inc esi |
387 | inc esi |
388 | 388 | ||
389 | push eax |
389 | push eax |
390 | push ebx |
390 | push ebx |
391 | push ecx |
391 | push ecx |
392 | push edx |
392 | push edx |
393 | push edi |
393 | push edi |
394 | 394 | ||
395 | call [disable_mouse] |
395 | call [disable_mouse] |
396 | 396 | ||
397 | bdbnewline: |
397 | bdbnewline: |
398 | mov edi,1 ; force |
398 | mov edi,1 ; force |
399 | cmp eax,[esp+16] |
399 | cmp eax,[esp+16] |
400 | jz bneg |
400 | jz bneg |
401 | cmp eax,[esp+20] |
401 | cmp eax,[esp+20] |
402 | jz bneg |
402 | jz bneg |
403 | cmp ebx,[esp+12] |
403 | cmp ebx,[esp+12] |
404 | jz bneg |
404 | jz bneg |
405 | cmp ebx,[esp+24] |
405 | cmp ebx,[esp+24] |
406 | jnz nbneg |
406 | jnz nbneg |
407 | ; jz bneg |
407 | ; jz bneg |
408 | ; jmp nbneg |
408 | ; jmp nbneg |
409 | 409 | ||
410 | bneg: |
410 | bneg: |
411 | 411 | ||
412 | ;;;call [disable_mouse] |
412 | ;;;call [disable_mouse] |
413 | call [putpixel] |
413 | call [putpixel] |
414 | 414 | ||
415 | nbneg: |
415 | nbneg: |
416 | 416 | ||
417 | inc eax |
417 | inc eax |
418 | cmp eax,esi |
418 | cmp eax,esi |
419 | jnz bdbnewline |
419 | jnz bdbnewline |
420 | mov eax,[esp+16] |
420 | mov eax,[esp+16] |
421 | inc ebx |
421 | inc ebx |
422 | cmp ebx,edx |
422 | cmp ebx,edx |
423 | jnz bdbnewline |
423 | jnz bdbnewline |
424 | 424 | ||
425 | add esp,28 |
425 | add esp,28 |
426 | 426 | ||
427 | popad |
427 | popad |
428 | 428 | ||
429 | ret |
429 | ret |
430 | 430 | ||
431 | ; check buttons |
431 | ; check buttons |
432 | 432 | ||
433 | 433 | ||
434 | ; 0000 word process number |
434 | ; 0000 word process number |
435 | ; 0002 word button id number : bits 0-15 |
435 | ; 0002 word button id number : bits 0-15 |
436 | ; 0004 word x start |
436 | ; 0004 word x start |
437 | ; 0006 word x size |
437 | ; 0006 word x size |
438 | ; 0008 word y start |
438 | ; 0008 word y start |
439 | ; 000A word y size |
439 | ; 000A word y size |
440 | ; 000C word button id number : bits 16-31 |
440 | ; 000C word button id number : bits 16-31 |
441 | ; |
441 | ; |
442 | ; button table in 0x10 increments |
442 | ; button table in 0x10 increments |
443 | ; |
443 | ; |
444 | ; first at 0x10 |
444 | ; first at 0x10 |
445 | 445 | ||
446 | 446 | ||
447 | checkbuttons: |
447 | checkbuttons: |
448 | 448 | ||
449 | cmp [0xfb40],byte 0 ; mouse buttons pressed |
449 | cmp [0xfb40],byte 0 ; mouse buttons pressed |
450 | jnz @f |
450 | jnz @f |
451 | ret |
451 | ret |
452 | @@: |
452 | @@: |
453 | 453 | ||
454 | pushad |
454 | pushad |
455 | 455 | ||
456 | xor esi, esi |
456 | xor esi, esi |
457 | mov edi, [0xfe88] |
457 | mov edi, [0xfe88] |
458 | movzx edx, word [edi] |
458 | movzx edx, word [edi] |
459 | test edx, edx |
459 | test edx, edx |
460 | jne @f |
460 | jne @f |
461 | popad |
461 | popad |
462 | ret |
462 | ret |
463 | 463 | ||
464 | @@: |
464 | @@: |
465 | 465 | ||
466 | push esi |
466 | push esi |
467 | inc edx |
467 | inc edx |
468 | push edx |
468 | push edx |
469 | 469 | ||
470 | buttonnewcheck: |
470 | buttonnewcheck: |
471 | 471 | ||
472 | pop edx |
472 | pop edx |
473 | pop esi |
473 | pop esi |
474 | inc esi |
474 | inc esi |
475 | cmp edx,esi |
475 | cmp edx,esi |
476 | jge bch |
476 | jge bch |
477 | 477 | ||
478 | popad ; no button pressed |
478 | popad ; no button pressed |
479 | ret |
479 | ret |
480 | 480 | ||
481 | bch: |
481 | bch: |
482 | 482 | ||
483 | push esi |
483 | push esi |
484 | push edx |
484 | push edx |
485 | mov eax,esi |
485 | mov eax,esi |
486 | shl eax,4 |
486 | shl eax,4 |
487 | add eax,edi |
487 | add eax,edi |
488 | 488 | ||
489 | ;......................start 1/2 : modified by vhanla ............................. |
489 | ;......................start 1/2 : modified by vhanla ............................. |
490 | mov [buttonid],eax |
490 | mov [buttonid],eax |
491 | ;......................end 1/2 : modified by vhanla ............................. |
491 | ;......................end 1/2 : modified by vhanla ............................. |
492 | 492 | ||
493 | ; check that button is at top of windowing stack |
493 | ; check that button is at top of windowing stack |
494 | 494 | ||
495 | movzx ebx,word [eax] |
495 | movzx ebx,word [eax] |
496 | movzx ecx,word [0xC000 + ebx * 2] |
496 | movzx ecx,word [0xC000 + ebx * 2] |
497 | cmp ecx,[0x3004] |
497 | cmp ecx,[0x3004] |
498 | jne buttonnewcheck |
498 | jne buttonnewcheck |
499 | 499 | ||
500 | ; check that button start is inside window x/y end |
500 | ; check that button start is inside window x/y end |
501 | 501 | ||
502 | movzx ebx,word [eax+0] |
502 | movzx ebx,word [eax+0] |
503 | shl ebx,5 |
503 | shl ebx,5 |
- | 504 | ||
- | 505 | test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
|
- | 506 | jnz buttonnewcheck |
|
- | 507 | ||
504 | ; add ebx,window_data |
508 | ; add ebx,window_data |
505 | ; mov ecx,[window_data+ebx+8] ; window end X |
509 | ; mov ecx,[window_data+ebx+8] ; window end X |
506 | movzx edx,word [eax+4] ; button start X |
510 | movzx edx,word [eax+4] ; button start X |
507 | cmp edx, [window_data+ebx+8] ;ecx |
511 | cmp edx, [window_data+ebx+8] ;ecx |
508 | jge buttonnewcheck |
512 | jge buttonnewcheck |
509 | 513 | ||
510 | ; mov ecx,[window_data+ebx+12] ; window end Y |
514 | ; mov ecx,[window_data+ebx+12] ; window end Y |
511 | movzx edx, word [eax+8] ; button start Y |
515 | movzx edx, word [eax+8] ; button start Y |
512 | cmp edx, [window_data+ebx+12] ;ecx |
516 | cmp edx, [window_data+ebx+12] ;ecx |
513 | jge buttonnewcheck |
517 | jge buttonnewcheck |
514 | 518 | ||
515 | ; check coordinates |
519 | ; check coordinates |
516 | ; mouse x >= button x ? |
520 | ; mouse x >= button x ? |
517 | movzx ebx,word [eax+0] |
521 | movzx ebx,word [eax+0] |
518 | shl ebx,5 |
522 | shl ebx,5 |
519 | add ebx,window_data |
523 | add ebx,window_data |
520 | movzx ecx,word [ebx+0] ; window x start |
524 | movzx ecx,word [ebx+0] ; window x start |
521 | movzx edx,word [eax+4] ; button x start |
525 | movzx edx,word [eax+4] ; button x start |
522 | add edx,ecx |
526 | add edx,ecx |
523 | mov cx,[0xfb0a] |
527 | mov cx,[0xfb0a] |
524 | cmp edx,ecx |
528 | cmp edx,ecx |
525 | jg buttonnewcheck |
529 | jg buttonnewcheck |
526 | 530 | ||
527 | movzx ebx,word [eax+6] ; button x size |
531 | movzx ebx,word [eax+6] ; button x size |
528 | add edx,ebx |
532 | add edx,ebx |
529 | cmp ecx,edx |
533 | cmp ecx,edx |
530 | jg buttonnewcheck |
534 | jg buttonnewcheck |
531 | 535 | ||
532 | ; mouse y >= button y ? |
536 | ; mouse y >= button y ? |
533 | movzx ebx,word [eax+0] |
537 | movzx ebx,word [eax+0] |
534 | shl ebx,5 |
538 | shl ebx,5 |
535 | add ebx,window_data |
539 | add ebx,window_data |
536 | movzx ecx,word [ebx+4] ; window y start |
540 | movzx ecx,word [ebx+4] ; window y start |
537 | movzx edx,word [eax+8] ; button y start |
541 | movzx edx,word [eax+8] ; button y start |
538 | add edx,ecx |
542 | add edx,ecx |
539 | mov cx,[0xfb0c] |
543 | mov cx,[0xfb0c] |
540 | cmp edx,ecx |
544 | cmp edx,ecx |
541 | jg buttonnewcheck |
545 | jg buttonnewcheck |
542 | 546 | ||
543 | movzx ebx,word [eax+10] ; button y size |
547 | movzx ebx,word [eax+10] ; button y size |
544 | add edx,ebx |
548 | add edx,ebx |
545 | cmp ecx,edx |
549 | cmp ecx,edx |
546 | jg buttonnewcheck |
550 | jg buttonnewcheck |
547 | 551 | ||
548 | ; mouse on button |
552 | ; mouse on button |
549 | 553 | ||
550 | pop edx |
554 | pop edx |
551 | pop esi |
555 | pop esi |
552 | 556 | ||
553 | mov bx,[eax+0xc] ; button id : bits 16-31 |
557 | mov bx,[eax+0xc] ; button id : bits 16-31 |
554 | shl ebx,16 |
558 | shl ebx,16 |
555 | mov bx,[eax+2] ; button id : bits 00-16 |
559 | mov bx,[eax+2] ; button id : bits 00-16 |
556 | push ebx |
560 | push ebx |
557 | 561 | ||
558 | mov [0xfb44],byte 1 ; no mouse down checks |
562 | mov [0xfb44],byte 1 ; no mouse down checks |
559 | call find_pressed_button_frames |
563 | call find_pressed_button_frames |
560 | call negativebutton |
564 | call negativebutton |
561 | 565 | ||
562 | pushad |
566 | pushad |
563 | cbwaitmouseup: |
567 | cbwaitmouseup: |
564 | 568 | ||
565 | call checkidle |
569 | call checkidle |
566 | 570 | ||
567 | call [draw_pointer] |
571 | call [draw_pointer] |
568 | 572 | ||
569 | pushad |
573 | pushad |
570 | call stack_handler |
574 | call stack_handler |
571 | popad |
575 | popad |
572 | 576 | ||
573 | cmp [0xfb40],byte 0 ; mouse buttons pressed ? |
577 | cmp [0xfb40],byte 0 ; mouse buttons pressed ? |
574 | jnz cbwaitmouseup |
578 | jnz cbwaitmouseup |
575 | popad |
579 | popad |
576 | 580 | ||
577 | call negativebutton |
581 | call negativebutton |
578 | mov [0xfff4],byte 0 ; no mouse background |
582 | mov [0xfff4],byte 0 ; no mouse background |
579 | mov [0xfff5],byte 0 ; draw mouse |
583 | mov [0xfff5],byte 0 ; draw mouse |
580 | ;..................................... start 2/2 : modified by vhanla ............................. |
584 | ;..................................... start 2/2 : modified by vhanla ............................. |
581 | ; check coordinates |
585 | ; check coordinates |
582 | jmp afterbuttonid |
586 | jmp afterbuttonid |
583 | buttonid dd 0x0 ;here a will backup the eax value |
587 | buttonid dd 0x0 ;here a will backup the eax value |
584 | afterbuttonid: |
588 | afterbuttonid: |
585 | 589 | ||
586 | pusha |
590 | pusha |
587 | ; mouse x >= button x ? |
591 | ; mouse x >= button x ? |
588 | movzx ebx,word [eax+0] |
592 | movzx ebx,word [eax+0] |
589 | shl ebx,5 |
593 | shl ebx,5 |
590 | add ebx,window_data |
594 | add ebx,window_data |
591 | movzx ecx,word [ebx+0] ; window x start |
595 | movzx ecx,word [ebx+0] ; window x start |
592 | movzx edx,word [eax+4] ; button x start |
596 | movzx edx,word [eax+4] ; button x start |
593 | add edx,ecx |
597 | add edx,ecx |
594 | mov cx,[0xfb0a] |
598 | mov cx,[0xfb0a] |
595 | cmp edx,ecx |
599 | cmp edx,ecx |
596 | jg no_on_button ;if we release the pointer out of the button area |
600 | jg no_on_button ;if we release the pointer out of the button area |
597 | 601 | ||
598 | movzx ebx,word [eax+6] ; button x size |
602 | movzx ebx,word [eax+6] ; button x size |
599 | add edx,ebx |
603 | add edx,ebx |
600 | cmp ecx,edx |
604 | cmp ecx,edx |
601 | jg no_on_button |
605 | jg no_on_button |
602 | 606 | ||
603 | ; mouse y >= button y ? |
607 | ; mouse y >= button y ? |
604 | movzx ebx,word [eax+0] |
608 | movzx ebx,word [eax+0] |
605 | shl ebx,5 |
609 | shl ebx,5 |
606 | add ebx,window_data |
610 | add ebx,window_data |
607 | movzx ecx,word [ebx+4] ; window y start |
611 | movzx ecx,word [ebx+4] ; window y start |
608 | movzx edx,word [eax+8] ; button y start |
612 | movzx edx,word [eax+8] ; button y start |
609 | add edx,ecx |
613 | add edx,ecx |
610 | mov cx,[0xfb0c] |
614 | mov cx,[0xfb0c] |
611 | cmp edx,ecx |
615 | cmp edx,ecx |
612 | jg no_on_button |
616 | jg no_on_button |
613 | 617 | ||
614 | movzx ebx,word [eax+10] ; button y size |
618 | movzx ebx,word [eax+10] ; button y size |
615 | add edx,ebx |
619 | add edx,ebx |
616 | cmp ecx,edx |
620 | cmp ecx,edx |
617 | jg no_on_button |
621 | jg no_on_button |
618 | popa |
622 | popa |
619 | mov [0xf500],byte 1 ; no of buttons in buffer |
623 | mov [0xf500],byte 1 ; no of buttons in buffer |
620 | pop ebx |
624 | pop ebx |
621 | mov [0xf501],ebx ; lets put the button id in buffer |
625 | mov [0xf501],ebx ; lets put the button id in buffer |
622 | push ebx |
626 | push ebx |
623 | pusha |
627 | pusha |
624 | jmp yes_on_button |
628 | jmp yes_on_button |
625 | no_on_button: |
629 | no_on_button: |
626 | mov [0xf500],byte 0 ; no of buttons in buffer |
630 | mov [0xf500],byte 0 ; no of buttons in buffer |
627 | yes_on_button: |
631 | yes_on_button: |
628 | mov [0xfb44],byte 0 ; mouse down -> do not draw |
632 | mov [0xfb44],byte 0 ; mouse down -> do not draw |
629 | popa |
633 | popa |
630 | pop ebx |
634 | pop ebx |
631 | popa |
635 | popa |
632 | ret |
636 | ret |
633 | 637 | ||
634 | ;..................................... end 2/2 : modified by vhanla ................................ |
638 | ;..................................... end 2/2 : modified by vhanla ................................ |