Rev 2523 | Rev 5916 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2523 | Rev 2574 | ||
---|---|---|---|
1 | ; |
1 | ; |
2 | ; äãªæ¨ ¤«ï ᮧ¤ ¨ï ¨ । ªâ¨à®¢ ¨ï ¯à®¢®¤®¢ |
2 | ; äãªæ¨ ¤«ï ᮧ¤ ¨ï ¨ । ªâ¨à®¢ ¨ï ¯à®¢®¤®¢ |
3 | ; |
3 | ; |
4 | 4 | ||
5 | ;-------------------------------------- |
5 | ;-------------------------------------- |
6 | struct Cell |
6 | struct Cell |
7 | x dd ? ;+0 |
7 | x dd ? ;+0 |
8 | y dd ? ;+4 |
8 | y dd ? ;+4 |
9 | liv db ? ;+8 |
9 | liv db ? ;+8 |
10 | napr db ? ;+9 |
10 | napr db ? ;+9 |
11 | ends |
11 | ends |
12 | 12 | ||
13 | offs_cell_x equ 0 |
13 | offs_cell_x equ 0 |
14 | offs_cell_y equ 4 |
14 | offs_cell_y equ 4 |
15 | offs_cell_liv equ 8 |
15 | offs_cell_liv equ 8 |
16 | offs_cell_napr equ 9 |
16 | offs_cell_napr equ 9 |
17 | 17 | ||
18 | ;áâàãªâãà ¤«ï ᮧ¤ ¨ï ¯®«ï |
18 | ;áâàãªâãà ¤«ï ᮧ¤ ¨ï ¯®«ï |
19 | align 4 |
19 | align 4 |
20 | pole: |
20 | pole: |
21 | .index dd 0 |
21 | .index dd 0 |
22 | cell dd 0 ;㪠§ â¥«ì ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª |
22 | cell dd 0 ;㪠§ â¥«ì ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª |
23 | .max_cell dd 90000 |
23 | .max_cell dd 90000 |
24 | .b_sort dd 0 ;£à ¨æ ¤«ï á®àâ¨à®¢ ëå ï祥ª |
24 | .b_sort dd 0 ;£à ¨æ ¤«ï á®àâ¨à®¢ ëå ï祥ª |
25 | 25 | ||
26 | pole_index equ dword[edi] |
26 | pole_index equ dword[edi] |
27 | pole_data equ dword[edi +4] ;㪠§ â¥«ì ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª |
27 | pole_data equ dword[edi +4] ;㪠§ â¥«ì ¯ ¬ïâì á® áâàãªâãà ¬¨ ï祥ª |
28 | pole_max_cell equ dword[edi +8] |
28 | pole_max_cell equ dword[edi +8] |
29 | pole_b_sort equ dword[edi+12] ;£à ¨æ ¤«ï á®àâ¨à®¢ ëå ï祥ª |
29 | pole_b_sort equ dword[edi+12] ;£à ¨æ ¤«ï á®àâ¨à®¢ ëå ï祥ª |
30 | offs_pole_b_sort equ 12 |
30 | offs_pole_b_sort equ 12 |
31 | 31 | ||
32 | macro get_cell_offset reg,ind |
32 | macro get_cell_offset reg,ind |
33 | { |
33 | { |
34 | mov reg,ind |
34 | mov reg,ind |
35 | imul reg,sizeof.Cell |
35 | imul reg,sizeof.Cell |
36 | add reg,dword[cell] |
36 | add reg,dword[cell] |
37 | } |
37 | } |
38 | 38 | ||
39 | er_oom db 0 ; á«ãç © ¨áç¥à¯ ¨ï ¯ ¬ï⨠|
39 | er_oom db 0 ; á«ãç © ¨áç¥à¯ ¨ï ¯ ¬ï⨠|
40 | Cor_x dd 0 |
40 | Cor_x dd 0 |
41 | Cor_y dd 0 |
41 | Cor_y dd 0 |
42 | zoom db 3 ;¬ áèâ ¡ ¯®«ï |
42 | zoom db 3 ;¬ áèâ ¡ ¯®«ï |
43 | txt_zoom db ' áèâ ¡:',0 |
43 | txt_zoom db ' áèâ ¡:',0 |
44 | txt_osob db '®ç¥ª:',0 |
44 | txt_osob db '®ç¥ª:',0 |
45 | txt_info: db ' §¬¥à: ' |
45 | txt_info: db ' §¬¥à: ' |
46 | .size: rb 16 |
46 | .size: rb 16 |
47 | txt_mull db '*',0 |
47 | txt_mull db '*',0 |
48 | txt_space db ' ',0 |
48 | txt_space db ' ',0 |
49 | txt_nl db 13,10,0 |
49 | txt_nl db 13,10,0 |
50 | txt_buf rb 32 |
50 | txt_buf rb 32 |
51 | 51 | ||
52 | 52 | ||
53 | align 4 |
53 | align 4 |
54 | proc pole_init uses eax ebx edi, pole:dword |
54 | proc pole_init uses eax ebx edi, pole:dword |
55 | mov edi,dword[pole] |
55 | mov edi,dword[pole] |
56 | 56 | ||
57 | ;*** ª®¤ á ®¤®© ®¡« áâìî ¢ ¯ ¬ï⨠*** |
57 | ;*** ª®¤ á ®¤®© ®¡« áâìî ¢ ¯ ¬ï⨠*** |
58 | mov ebx,4 |
58 | mov ebx,4 |
59 | add ebx,sizeof.Cell |
59 | add ebx,sizeof.Cell |
60 | imul ebx,pole_max_cell |
60 | imul ebx,pole_max_cell |
61 | stdcall mem.Alloc,ebx |
61 | stdcall mem.Alloc,ebx |
62 | mov pole_index,eax |
62 | mov pole_index,eax |
63 | 63 | ||
64 | mov ebx,pole_max_cell |
64 | mov ebx,pole_max_cell |
65 | shl ebx,2 |
65 | shl ebx,2 |
66 | add eax,ebx |
66 | add eax,ebx |
67 | mov pole_data,eax |
67 | mov pole_data,eax |
68 | 68 | ||
69 | stdcall pole_clear, edi |
69 | stdcall pole_clear, edi |
70 | stdcall pole_paint, edi ;à¨á®¢ ¨¥ ¯®«ï ¢ ¡ãä¥à¥ (¥ íªà ¥) |
70 | stdcall pole_paint, edi ;à¨á®¢ ¨¥ ¯®«ï ¢ ¡ãä¥à¥ (¥ íªà ¥) |
71 | ret |
71 | ret |
72 | endp |
72 | endp |
73 | 73 | ||
74 | align 4 |
74 | align 4 |
75 | proc pole_delete uses edi, pole:dword |
75 | proc pole_delete uses edi, pole:dword |
76 | mov edi,dword[pole] |
76 | mov edi,dword[pole] |
77 | stdcall mem.Free,pole_index |
77 | stdcall mem.Free,pole_index |
78 | ret |
78 | ret |
79 | endp |
79 | endp |
80 | 80 | ||
81 | ;ç¨á⪠¯à®¢®¤®¢ á奬¥ |
81 | ;ç¨á⪠¯à®¢®¤®¢ á奬¥ |
82 | align 4 |
82 | align 4 |
83 | proc pole_clear uses eax ecx edi, pole:dword |
83 | proc pole_clear uses eax ecx edi, pole:dword |
84 | mov edi,dword[pole] |
84 | mov edi,dword[pole] |
85 | 85 | ||
86 | xor eax,eax |
86 | xor eax,eax |
87 | mov pole_b_sort,eax |
87 | mov pole_b_sort,eax |
88 | mov byte[er_oom],al |
88 | mov byte[er_oom],al |
89 | cld |
89 | cld |
90 | mov ecx,pole_max_cell |
90 | mov ecx,pole_max_cell |
91 | imul ecx,sizeof.Cell |
91 | imul ecx,sizeof.Cell |
92 | mov edi,pole_data |
92 | mov edi,pole_data |
93 | repne stosb ;memset(cell,0,sizeof(Cell)*pole_max_cell); |
93 | repne stosb ;memset(cell,0,sizeof(Cell)*pole_max_cell); |
94 | 94 | ||
95 | mov edi,dword[pole] |
95 | mov edi,dword[pole] |
96 | mov ecx,pole_max_cell |
96 | mov ecx,pole_max_cell |
97 | mov edi,pole_index |
97 | mov edi,pole_index |
98 | @@: |
98 | @@: |
99 | stosd ;for(i=0;i |
99 | stosd ;for(i=0;i |
100 | ;mov dword[edi],eax |
100 | ;mov dword[edi],eax |
101 | ;add edi,4 |
101 | ;add edi,4 |
102 | inc eax |
102 | inc eax |
103 | loop @b |
103 | loop @b |
104 | ret |
104 | ret |
105 | endp |
105 | endp |
106 | 106 | ||
107 | align 4 |
107 | align 4 |
108 | proc pole_cell_creat, pole:dword, x:dword, y:dword, li:dword |
108 | proc pole_cell_creat, pole:dword, x:dword, y:dword, li:dword |
109 | pushad |
109 | pushad |
110 | mov edi,dword[pole] |
110 | mov edi,dword[pole] |
111 | mov esi,pole_index |
111 | mov esi,pole_index |
112 | 112 | ||
113 | ; *** ¥á«¨ ª«¥âª 㦥 ¡ë« ᮧ¤ |
113 | ; *** ¥á«¨ ª«¥âª 㦥 ¡ë« ᮧ¤ |
114 | stdcall pole_cell_find, [pole], [x],[y] |
114 | stdcall pole_cell_find, [pole], [x],[y] |
115 | cmp eax,0 |
115 | cmp eax,0 |
116 | je @f |
116 | je @f |
117 | get_cell_offset ebx,eax |
117 | get_cell_offset ebx,eax |
118 | jmp .change |
118 | jmp .change |
119 | @@: |
119 | @@: |
120 | 120 | ||
121 | ; *** ᮧ¤ ¨¥ ®¢®© ï祩ª¨ |
121 | ; *** ᮧ¤ ¨¥ ®¢®© ï祩ª¨ |
122 | ; 室¨¬ ®¬¥à ᢮¡®¤®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥¨ï ®¢®© |
122 | ; 室¨¬ ®¬¥à ᢮¡®¤®© ï祩ª¨ (i) ¤«ï ¤®¡ ¢«¥¨ï ®¢®© |
123 | ;mov esi,pole_index |
123 | ;mov esi,pole_index |
124 | inc dword[esi] |
124 | inc dword[esi] |
125 | mov ebx,pole_max_cell |
125 | mov ebx,pole_max_cell |
126 | cmp dword[esi],ebx |
126 | cmp dword[esi],ebx |
127 | jne @f |
127 | jne @f |
128 | dec dword[esi] |
128 | dec dword[esi] |
129 | ;... need call message: "eror out of memory" ... |
129 | ;... need call message: "eror out of memory" ... |
130 | ;... ¢ë¢®¤ á®®¡é¥¨ï ¯¥à¥¯®«¥¨ï ¤® ¤®¡ ¢¨âì ... |
130 | ;... ¢ë¢®¤ á®®¡é¥¨ï ¯¥à¥¯®«¥¨ï ¤® ¤®¡ ¢¨âì ... |
131 | mov byte[er_oom],0 |
131 | mov byte[er_oom],0 |
132 | jmp .fun_e ;return; |
132 | jmp .fun_e ;return; |
133 | @@: |
133 | @@: |
134 | mov eax,dword[esi] ;eax - ®¬¥à ¤«ï ¯®á«¥¤¥© ï祩ª¨ |
134 | mov eax,dword[esi] ;eax - ®¬¥à ¤«ï ¯®á«¥¤¥© ï祩ª¨ |
135 | shl eax,2 |
135 | shl eax,2 |
136 | add eax,pole_index ;eax - 㪠§ â¥«ì ¤®¡ ¢«ï¥¬ãî ï祩ªã (¢ ª®¥æ ¬ áᨢ ) |
136 | add eax,pole_index ;eax - 㪠§ â¥«ì ¤®¡ ¢«ï¥¬ãî ï祩ªã (¢ ª®¥æ ¬ áᨢ ) |
137 | get_cell_offset ebx,dword[eax] |
137 | get_cell_offset ebx,dword[eax] |
138 | mov ecx,dword[x] |
138 | mov ecx,dword[x] |
139 | mov dword[ebx],ecx ;+0 = .x |
139 | mov dword[ebx],ecx ;+0 = .x |
140 | mov edx,dword[y] |
140 | mov edx,dword[y] |
141 | mov dword[ebx+4],edx ;+4 = .y |
141 | mov dword[ebx+4],edx ;+4 = .y |
142 | .change: |
142 | .change: |
143 | mov ecx,[li] |
143 | mov ecx,[li] |
144 | mov byte[ebx+offs_cell_liv],cl |
144 | mov byte[ebx+offs_cell_liv],cl |
145 | .fun_e: |
145 | .fun_e: |
146 | popad |
146 | popad |
147 | ret |
147 | ret |
148 | endp |
148 | endp |
149 | 149 | ||
150 | ;㤠«¥¨¥ ï祩ª¨ |
150 | ;㤠«¥¨¥ ï祩ª¨ |
151 | align 4 |
151 | align 4 |
152 | proc pole_cell_delete, pole:dword, x:dword, y:dword |
152 | proc pole_cell_delete, pole:dword, x:dword, y:dword |
153 | pushad |
153 | pushad |
154 | mov edi,dword[pole] |
154 | mov edi,dword[pole] |
155 | mov ebx,edi |
155 | mov ebx,edi |
156 | add ebx,offs_pole_b_sort |
156 | add ebx,offs_pole_b_sort |
157 | mov esi,pole_index |
157 | mov esi,pole_index |
158 | 158 | ||
159 | mov ecx,[esi] |
159 | mov ecx,[esi] |
160 | cmp ecx,1 |
160 | cmp ecx,1 |
161 | jl .fun_e |
161 | jl .fun_e |
162 | 162 | ||
163 | stdcall pole_cell_find, [pole], [x],[y] |
163 | stdcall pole_cell_find, [pole], [x],[y] |
164 | cmp eax,0 |
164 | cmp eax,0 |
165 | je .fun_e ;¥á«¨ ª«¥âª ¥ ¡ë« ᮧ¤ |
165 | je .fun_e ;¥á«¨ ª«¥âª ¥ ¡ë« ᮧ¤ |
166 | 166 | ||
167 | dec dword[esi] |
167 | dec dword[esi] |
168 | 168 | ||
169 | mov edi,esi |
169 | mov edi,esi |
170 | add edi,4 |
170 | add edi,4 |
171 | mov edx,ecx |
171 | mov edx,ecx |
172 | cld |
172 | cld |
173 | repnz scasd ;¯®¨áª |
173 | repnz scasd ;¯®¨áª |
174 | sub edi,4 |
174 | sub edi,4 |
175 | 175 | ||
176 | cmp dword[ebx],1 ;[ebx]=pole_b_sort |
176 | cmp dword[ebx],1 ;[ebx]=pole_b_sort |
177 | jl @f |
177 | jl @f |
178 | mov eax,edi |
178 | mov eax,edi |
179 | sub eax,esi ;esi=pole_index |
179 | sub eax,esi ;esi=pole_index |
180 | shr eax,2 |
180 | shr eax,2 |
181 | dec eax |
181 | dec eax |
182 | cmp [ebx],eax ;eax - ¯®§¨æ¨ï 㪠§ ⥫ï 㤠«ï¥¬®© ï祩ª¨ |
182 | cmp [ebx],eax ;eax - ¯®§¨æ¨ï 㪠§ ⥫ï 㤠«ï¥¬®© ï祩ª¨ |
183 | jle @f ;¡ë«® jl @f |
183 | jle @f ;¡ë«® jl @f |
184 | dec dword[ebx] |
184 | dec dword[ebx] |
185 | @@: |
185 | @@: |
186 | 186 | ||
187 | shl edx,2 |
187 | shl edx,2 |
188 | add edx,esi ;ª®¥çë© í«¥¬¥â ¬ áᨢ |
188 | add edx,esi ;ª®¥çë© í«¥¬¥â ¬ áᨢ |
189 | sub edx,edi |
189 | sub edx,edi |
190 | shr edx,2 |
190 | shr edx,2 |
191 | mov ecx,edx |
191 | mov ecx,edx |
192 | 192 | ||
193 | bt ecx,31 |
193 | bt ecx,31 |
194 | jc .fun_e |
194 | jc .fun_e |
195 | mov esi,edi |
195 | mov esi,edi |
196 | add esi,4 |
196 | add esi,4 |
197 | mov edx,[edi] ;á®åà ¥¨¥ ⥪ã饣® 㪠§ ⥫ï |
197 | mov edx,[edi] ;á®åà ¥¨¥ ⥪ã饣® 㪠§ ⥫ï |
198 | cld |
198 | cld |
199 | rep movsd |
199 | rep movsd |
200 | mov [edi],edx ;¢®ááâ ®¢«¥¨¥ ⥪ã饣® 㪠§ ⥫ï (¢ ª®æ¥ ¬ áᨢ ) |
200 | mov [edi],edx ;¢®ááâ ®¢«¥¨¥ ⥪ã饣® 㪠§ ⥫ï (¢ ª®æ¥ ¬ áᨢ ) |
201 | .fun_e: |
201 | .fun_e: |
202 | popad |
202 | popad |
203 | ret |
203 | ret |
204 | endp |
204 | endp |
205 | 205 | ||
206 | if debug |
206 | if debug |
207 | align 4 |
207 | align 4 |
208 | proc but_test_pole, pole:dword |
208 | proc but_test_pole, pole:dword |
209 | pushad |
209 | pushad |
210 | stdcall [buf2d_clear], buf_0, [buf_0.color] |
210 | stdcall [buf2d_clear], buf_0, [buf_0.color] |
211 | 211 | ||
212 | mov edi,dword[pole] |
212 | mov edi,dword[pole] |
213 | stdcall pole_paint,edi |
213 | stdcall pole_paint,edi |
214 | mov ebx,5 |
214 | mov ebx,5 |
215 | 215 | ||
216 | mov esi,pole_index |
216 | mov esi,pole_index |
217 | mov ecx,[esi] |
217 | mov ecx,[esi] |
218 | 218 | ||
219 | mov eax,pole_b_sort |
219 | mov eax,pole_b_sort |
220 | mov edi,open_file_lif |
220 | mov edi,open_file_lif |
221 | stdcall convert_int_to_str |
221 | stdcall convert_int_to_str |
222 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 b_sort |
222 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 b_sort |
223 | add ebx,18 |
223 | add ebx,18 |
224 | 224 | ||
225 | mov eax,[esi] |
225 | mov eax,[esi] |
226 | add esi,4 |
226 | add esi,4 |
227 | stdcall convert_int_to_str |
227 | stdcall convert_int_to_str |
228 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 ç¨á«® â®ç¥ª |
228 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[shem_colors] ;à¨á㥬 ç¨á«® â®ç¥ª |
229 | add ebx,9 |
229 | add ebx,9 |
230 | 230 | ||
231 | cmp ecx,1 |
231 | cmp ecx,1 |
232 | jl .end_dr |
232 | jl .end_dr |
233 | cld |
233 | cld |
234 | @@: |
234 | @@: |
235 | mov eax,[esi] |
235 | mov eax,[esi] |
236 | add esi,4 |
236 | add esi,4 |
237 | stdcall convert_int_to_str |
237 | stdcall convert_int_to_str |
238 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,color_caption ;à¨á㥬 㪠§ ⥫¨ ¬ áᨢë â®ç¥ª |
238 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_captions] ;à¨á㥬 㪠§ ⥫¨ ¬ áᨢë â®ç¥ª |
239 | add ebx,9 |
239 | add ebx,9 |
240 | loop @b |
240 | loop @b |
241 | .end_dr: |
241 | .end_dr: |
242 | mov ecx,4 |
242 | mov ecx,4 |
243 | cld |
243 | cld |
244 | @@: |
244 | @@: |
245 | mov eax,[esi] |
245 | mov eax,[esi] |
246 | add esi,4 |
246 | add esi,4 |
247 | stdcall convert_int_to_str |
247 | stdcall convert_int_to_str |
248 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_border] ;à¨á㥬 4 áâப¨ 㪠§ ⥫¥© |
248 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,5,ebx,[color_border] ;à¨á㥬 4 áâப¨ 㪠§ ⥫¥© |
249 | add ebx,9 |
249 | add ebx,9 |
250 | loop @b |
250 | loop @b |
251 | 251 | ||
252 | stdcall [buf2d_draw], buf_0 |
252 | stdcall [buf2d_draw], buf_0 |
253 | 253 | ||
254 | ;call redraw_pole |
254 | ;call redraw_pole |
255 | popad |
255 | popad |
256 | ret |
256 | ret |
257 | endp |
257 | endp |
258 | end if |
258 | end if |
259 | 259 | ||
260 | ;output: |
260 | ;output: |
261 | ; eax - index |
261 | ; eax - index |
262 | align 4 |
262 | align 4 |
263 | proc pole_cell_find uses edi, pole:dword, x:dword, y:dword |
263 | proc pole_cell_find uses edi, pole:dword, x:dword, y:dword |
264 | mov edi,dword[pole] |
264 | mov edi,dword[pole] |
265 | 265 | ||
266 | mov eax,pole_index |
266 | mov eax,pole_index |
267 | cmp dword[eax],0 |
267 | cmp dword[eax],0 |
268 | jne @f |
268 | jne @f |
269 | xor eax,eax ;if(!fristC) return 0; |
269 | xor eax,eax ;if(!fristC) return 0; |
270 | jmp .fun_e |
270 | jmp .fun_e |
271 | @@: |
271 | @@: |
272 | 272 | ||
273 | xor eax,eax ;fnd=0; |
273 | xor eax,eax ;fnd=0; |
274 | cmp pole_b_sort,0 |
274 | cmp pole_b_sort,0 |
275 | je @f |
275 | je @f |
276 | stdcall pole_bin_find, pole_index, [x],[y], pole_b_sort ;i=BinFind(pole_index, x,y, pole_b_sort); |
276 | stdcall pole_bin_find, pole_index, [x],[y], pole_b_sort ;i=BinFind(pole_index, x,y, pole_b_sort); |
277 | cmp eax,0 |
277 | cmp eax,0 |
278 | je @f |
278 | je @f |
279 | shl eax,2 |
279 | shl eax,2 |
280 | add eax,pole_index |
280 | add eax,pole_index |
281 | mov eax,dword[eax] ;if(i) fnd=pole_index[i]; |
281 | mov eax,dword[eax] ;if(i) fnd=pole_index[i]; |
282 | jmp .fun_e |
282 | jmp .fun_e |
283 | @@: |
283 | @@: |
284 | 284 | ||
285 | cmp eax,0 |
285 | cmp eax,0 |
286 | jne @f ;¯®¨áª ï祩ª¨ § ¡¨ àë¬ ¤¥à¥¢®¬ |
286 | jne @f ;¯®¨áª ï祩ª¨ § ¡¨ àë¬ ¤¥à¥¢®¬ |
287 | push ebx ecx edx esi |
287 | push ebx ecx edx esi |
288 | ;ebx -> i |
288 | ;ebx -> i |
289 | ;ecx -> firstC |
289 | ;ecx -> firstC |
290 | ;edx -> &pole_index[i] |
290 | ;edx -> &pole_index[i] |
291 | ;esi -> cell[pole_index[i]] |
291 | ;esi -> cell[pole_index[i]] |
292 | mov ecx,pole_index |
292 | mov ecx,pole_index |
293 | mov ebx,pole_b_sort |
293 | mov ebx,pole_b_sort |
294 | mov edx,ebx |
294 | mov edx,ebx |
295 | shl edx,2 |
295 | shl edx,2 |
296 | add edx,ecx |
296 | add edx,ecx |
297 | mov ecx,dword[ecx] |
297 | mov ecx,dword[ecx] |
298 | .cycle_b: ;for(i=pole_b_sort+1;i<=fristC;i++) |
298 | .cycle_b: ;for(i=pole_b_sort+1;i<=fristC;i++) |
299 | inc ebx |
299 | inc ebx |
300 | cmp ebx,ecx |
300 | cmp ebx,ecx |
301 | jg .not_found |
301 | jg .not_found |
302 | add edx,4 |
302 | add edx,4 |
303 | get_cell_offset esi,dword[edx] |
303 | get_cell_offset esi,dword[edx] |
304 | mov eax,dword[x] |
304 | mov eax,dword[x] |
305 | cmp dword[esi],eax ;+0 = .x |
305 | cmp dword[esi],eax ;+0 = .x |
306 | jne .if_e |
306 | jne .if_e |
307 | mov eax,dword[y] |
307 | mov eax,dword[y] |
308 | cmp dword[esi+4],eax ;+4 = .y |
308 | cmp dword[esi+4],eax ;+4 = .y |
309 | jne .if_e |
309 | jne .if_e |
310 | ;if(cell[pole_index[i]].x==x && cell[pole_index[i]].y==y){ |
310 | ;if(cell[pole_index[i]].x==x && cell[pole_index[i]].y==y){ |
311 | mov eax,dword[edx] ;fnd=pole_index[i]; |
311 | mov eax,dword[edx] ;fnd=pole_index[i]; |
312 | jmp .cycle_e ;break; |
312 | jmp .cycle_e ;break; |
313 | .if_e: |
313 | .if_e: |
314 | jmp .cycle_b |
314 | jmp .cycle_b |
315 | .not_found: |
315 | .not_found: |
316 | xor eax,eax ;¢®ááâ ¢«¨¢ ¥¬ ã«¥¢®¥ § 票¥ ¥á«¨ ¥ 諨 ï祩ªã (¢ 横«¥ eax ¯®àâ¨âáï ¯à¨ ¯à®¢¥àª¥ ª®®à¤¨ â) |
316 | xor eax,eax ;¢®ááâ ¢«¨¢ ¥¬ ã«¥¢®¥ § 票¥ ¥á«¨ ¥ 諨 ï祩ªã (¢ 横«¥ eax ¯®àâ¨âáï ¯à¨ ¯à®¢¥àª¥ ª®®à¤¨ â) |
317 | .cycle_e: |
317 | .cycle_e: |
318 | pop esi edx ecx ebx |
318 | pop esi edx ecx ebx |
319 | @@: |
319 | @@: |
320 | .fun_e: |
320 | .fun_e: |
321 | ret |
321 | ret |
322 | endp |
322 | endp |
323 | 323 | ||
324 | ;output: |
324 | ;output: |
325 | ; eax - index |
325 | ; eax - index |
326 | align 4 |
326 | align 4 |
327 | proc pole_bin_find uses ebx ecx edx edi, mas:dword, fx:dword, fy:dword, k:dword |
327 | proc pole_bin_find uses ebx ecx edx edi, mas:dword, fx:dword, fy:dword, k:dword |
328 | xor eax,eax |
328 | xor eax,eax |
329 | mov ebx,1 ;ebx - ¬ ªá¨¬ «ìë© ¯®à冷ª ¤«ï ¤¥à¥¢ |
329 | mov ebx,1 ;ebx - ¬ ªá¨¬ «ìë© ¯®à冷ª ¤«ï ¤¥à¥¢ |
330 | @@: |
330 | @@: |
331 | cmp dword[k],ebx |
331 | cmp dword[k],ebx |
332 | jle @f ;while(k>por) |
332 | jle @f ;while(k>por) |
333 | shl ebx,1 ;por<<=1; |
333 | shl ebx,1 ;por<<=1; |
334 | jmp @b |
334 | jmp @b |
335 | @@: |
335 | @@: |
336 | cmp dword[k],ebx |
336 | cmp dword[k],ebx |
337 | jge @f ;if(k |
337 | jge @f ;if(k |
338 | shr ebx,1 ;por>>=1; |
338 | shr ebx,1 ;por>>=1; |
339 | @@: |
339 | @@: |
340 | mov ecx,ebx ;i=por; |
340 | mov ecx,ebx ;i=por; |
341 | 341 | ||
342 | ;ecx -> i |
342 | ;ecx -> i |
343 | ;edi -> mas[i] |
343 | ;edi -> mas[i] |
344 | .cycle_b: ;do{ |
344 | .cycle_b: ;do{ |
345 | shr ebx,1 ;por>>=1; |
345 | shr ebx,1 ;por>>=1; |
346 | 346 | ||
347 | mov edi,ecx |
347 | mov edi,ecx |
348 | shl edi,2 |
348 | shl edi,2 |
349 | add edi,dword[mas] |
349 | add edi,dword[mas] |
350 | ;if(compare_cells_mb(mas[i],fx,fy)){ |
350 | ;if(compare_cells_mb(mas[i],fx,fy)){ |
351 | stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy] |
351 | stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy] |
352 | cmp dl,0 |
352 | cmp dl,0 |
353 | je .if_u0_e |
353 | je .if_u0_e |
354 | @@: ;while(i+por>k) |
354 | @@: ;while(i+por>k) |
355 | mov edx,ecx |
355 | mov edx,ecx |
356 | add edx,ebx |
356 | add edx,ebx |
357 | cmp edx,dword[k] ;i+por>k |
357 | cmp edx,dword[k] ;i+por>k |
358 | jle @f |
358 | jle @f |
359 | shr ebx,1 ;por>>=1; |
359 | shr ebx,1 ;por>>=1; |
360 | jmp @b |
360 | jmp @b |
361 | @@: |
361 | @@: |
362 | add ecx,ebx ;i+=por; |
362 | add ecx,ebx ;i+=por; |
363 | jmp .if_e |
363 | jmp .if_e |
364 | .if_u0_e: |
364 | .if_u0_e: |
365 | ;else if(compare_cells_bm(mas[i],fx,fy))i-=por; |
365 | ;else if(compare_cells_bm(mas[i],fx,fy))i-=por; |
366 | stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy] |
366 | stdcall pole_compare_cells_bm_coords, dword[edi],[fx],[fy] |
367 | cmp dl,0 |
367 | cmp dl,0 |
368 | je .if_u1_e |
368 | je .if_u1_e |
369 | sub ecx,ebx |
369 | sub ecx,ebx |
370 | jmp .if_e |
370 | jmp .if_e |
371 | .if_u1_e: |
371 | .if_u1_e: |
372 | ;else { m=i; por=0; } |
372 | ;else { m=i; por=0; } |
373 | mov eax,ecx |
373 | mov eax,ecx |
374 | xor ebx,ebx |
374 | xor ebx,ebx |
375 | .if_e: |
375 | .if_e: |
376 | cmp ebx,0 |
376 | cmp ebx,0 |
377 | jne .cycle_b ;}while(por); |
377 | jne .cycle_b ;}while(por); |
378 | 378 | ||
379 | ret |
379 | ret |
380 | endp |
380 | endp |
381 | 381 | ||
382 | ;ᤢ¨£ ¢á¥å ï祥ª (¨ ®¡ê¥ªâ®¢) |
382 | ;ᤢ¨£ ¢á¥å ï祥ª (¨ ®¡ê¥ªâ®¢) |
383 | align 4 |
383 | align 4 |
384 | proc pole_move_all, pole:dword, m_d_x:dword, m_d_y:dword |
384 | proc pole_move_all, pole:dword, m_d_x:dword, m_d_y:dword |
385 | pushad |
385 | pushad |
386 | mov edi,dword[pole] |
386 | mov edi,dword[pole] |
387 | mov edx,[m_d_x] |
387 | mov edx,[m_d_x] |
388 | mov esi,[m_d_y] |
388 | mov esi,[m_d_y] |
389 | 389 | ||
390 | mov eax,pole_index |
390 | mov eax,pole_index |
391 | cmp dword[eax],0 |
391 | cmp dword[eax],0 |
392 | je .end_0 ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室 |
392 | je .end_0 ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室 |
393 | 393 | ||
394 | mov ecx,dword[eax] |
394 | mov ecx,dword[eax] |
395 | cld |
395 | cld |
396 | @@: ;横« ¯® ¢á¥¬ ï祩ª ¬ |
396 | @@: ;横« ¯® ¢á¥¬ ï祩ª ¬ |
397 | add eax,4 |
397 | add eax,4 |
398 | mov ebx,[eax] |
398 | mov ebx,[eax] |
399 | imul ebx,sizeof.Cell |
399 | imul ebx,sizeof.Cell |
400 | add ebx,pole_data |
400 | add ebx,pole_data |
401 | 401 | ||
402 | add dword[ebx+offs_cell_x],edx |
402 | add dword[ebx+offs_cell_x],edx |
403 | add dword[ebx+offs_cell_y],esi |
403 | add dword[ebx+offs_cell_y],esi |
404 | loop @b |
404 | loop @b |
405 | .end_0: |
405 | .end_0: |
406 | 406 | ||
407 | ;横« ¯® «®£¨ç¥áª¨¬ í«¥¬¥â ¬ ¨ ¯®¤¯¨áï¬ |
407 | ;横« ¯® «®£¨ç¥áª¨¬ í«¥¬¥â ¬ ¨ ¯®¤¯¨áï¬ |
408 | stdcall dword[tl_node_poi_get_info],0,tree1 |
408 | stdcall dword[tl_node_poi_get_info],0,tree1 |
409 | pop eax |
409 | pop eax |
410 | @@: |
410 | @@: |
411 | cmp eax,0 |
411 | cmp eax,0 |
412 | je .end_1 |
412 | je .end_1 |
413 | cmp word[eax],el_icon_elems ;¯®«ã票¥ ç¥à¥§ eax ⨯ ¨ª®ª¨ |
413 | cmp word[eax],el_icon_elems ;¯®«ã票¥ ç¥à¥§ eax ⨯ ¨ª®ª¨ |
414 | je .mov_1 |
414 | je .mov_1 |
415 | cmp word[eax],el_icon_captions |
415 | cmp word[eax],el_icon_captions |
416 | je .mov_1 |
416 | je .mov_1 |
417 | jmp .end_mov_1 |
417 | jmp .end_mov_1 |
418 | .mov_1: |
418 | .mov_1: |
419 | stdcall [tl_node_poi_get_data], eax, tree1 |
419 | stdcall [tl_node_poi_get_data], eax, tree1 |
420 | pop ecx |
420 | pop ecx |
421 | 421 | ||
422 | add [ecx],edx ;coord x |
422 | add [ecx],edx ;coord x |
423 | add [ecx+4],esi ;coord y |
423 | add [ecx+4],esi ;coord y |
424 | .end_mov_1: |
424 | .end_mov_1: |
425 | stdcall dword[tl_node_poi_get_next_info],eax,tree1 |
425 | stdcall dword[tl_node_poi_get_next_info],eax,tree1 |
426 | pop eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã |
426 | pop eax ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã |
427 | jmp @b |
427 | jmp @b |
428 | .end_1: |
428 | .end_1: |
429 | 429 | ||
430 | popad |
430 | popad |
431 | ret |
431 | ret |
432 | endp |
432 | endp |
433 | 433 | ||
434 | ;output: |
434 | ;output: |
435 | ; dl |
435 | ; dl |
436 | align 4 |
436 | align 4 |
437 | proc pole_compare_cells_bm_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword |
437 | proc pole_compare_cells_bm_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword |
438 | get_cell_offset eax,[i0] |
438 | get_cell_offset eax,[i0] |
439 | ;eax -> cell[i0] |
439 | ;eax -> cell[i0] |
440 | mov ebx,dword[fx] |
440 | mov ebx,dword[fx] |
441 | cmp dword[eax],ebx |
441 | cmp dword[eax],ebx |
442 | jle @f |
442 | jle @f |
443 | mov dl,1 |
443 | mov dl,1 |
444 | jmp .fun_e |
444 | jmp .fun_e |
445 | @@: |
445 | @@: |
446 | mov ecx,dword[fy] |
446 | mov ecx,dword[fy] |
447 | cmp dword[eax+4],ecx |
447 | cmp dword[eax+4],ecx |
448 | jle @f |
448 | jle @f |
449 | cmp dword[eax],ebx |
449 | cmp dword[eax],ebx |
450 | jne @f |
450 | jne @f |
451 | mov dl,1 |
451 | mov dl,1 |
452 | jmp .fun_e |
452 | jmp .fun_e |
453 | @@: |
453 | @@: |
454 | xor dl,dl |
454 | xor dl,dl |
455 | .fun_e: |
455 | .fun_e: |
456 | ret |
456 | ret |
457 | endp |
457 | endp |
458 | 458 | ||
459 | ;output: |
459 | ;output: |
460 | ; dl |
460 | ; dl |
461 | align 4 |
461 | align 4 |
462 | proc pole_compare_cells_mb_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword |
462 | proc pole_compare_cells_mb_coords uses eax ebx ecx, i0:dword, fx:dword, fy:dword |
463 | get_cell_offset eax,[i0] |
463 | get_cell_offset eax,[i0] |
464 | ;eax -> cell[i0] |
464 | ;eax -> cell[i0] |
465 | mov ebx,dword[fx] |
465 | mov ebx,dword[fx] |
466 | cmp dword[eax],ebx |
466 | cmp dword[eax],ebx |
467 | jge @f |
467 | jge @f |
468 | mov dl,1 |
468 | mov dl,1 |
469 | jmp .fun_e |
469 | jmp .fun_e |
470 | @@: |
470 | @@: |
471 | mov ecx,dword[fy] |
471 | mov ecx,dword[fy] |
472 | cmp dword[eax+4],ecx |
472 | cmp dword[eax+4],ecx |
473 | jge @f |
473 | jge @f |
474 | cmp dword[eax],ebx |
474 | cmp dword[eax],ebx |
475 | jne @f |
475 | jne @f |
476 | mov dl,1 |
476 | mov dl,1 |
477 | jmp .fun_e |
477 | jmp .fun_e |
478 | @@: |
478 | @@: |
479 | xor dl,dl |
479 | xor dl,dl |
480 | .fun_e: |
480 | .fun_e: |
481 | ret |
481 | ret |
482 | endp |
482 | endp |
483 | 483 | ||
484 | ;output: |
484 | ;output: |
485 | ; dl |
485 | ; dl |
486 | align 4 |
486 | align 4 |
487 | proc pole_compare_cells_bm, i0:dword, i1:dword |
487 | proc pole_compare_cells_bm, i0:dword, i1:dword |
488 | push eax ebx ecx |
488 | push eax ebx ecx |
489 | get_cell_offset eax,[i0] ;eax -> cell[i0] |
489 | get_cell_offset eax,[i0] ;eax -> cell[i0] |
490 | get_cell_offset ebx,[i1] ;ebx -> cell[i1] |
490 | get_cell_offset ebx,[i1] ;ebx -> cell[i1] |
491 | mov ecx,dword[ebx] ;+0 = .x |
491 | mov ecx,dword[ebx] ;+0 = .x |
492 | cmp dword[eax],ecx |
492 | cmp dword[eax],ecx |
493 | jle @f ;x0>x1 |
493 | jle @f ;x0>x1 |
494 | mov dl,1 |
494 | mov dl,1 |
495 | jmp .fun_e |
495 | jmp .fun_e |
496 | @@: |
496 | @@: |
497 | jne @f ;x0==x1 |
497 | jne @f ;x0==x1 |
498 | mov ecx,dword[ebx+4] ;+4 = .y |
498 | mov ecx,dword[ebx+4] ;+4 = .y |
499 | cmp dword[eax+4],ecx |
499 | cmp dword[eax+4],ecx |
500 | jle @f ;y0>y1 |
500 | jle @f ;y0>y1 |
501 | mov dl,1 |
501 | mov dl,1 |
502 | jmp .fun_e |
502 | jmp .fun_e |
503 | @@: |
503 | @@: |
504 | xor dl,dl |
504 | xor dl,dl |
505 | .fun_e: |
505 | .fun_e: |
506 | pop ecx ebx eax |
506 | pop ecx ebx eax |
507 | ret |
507 | ret |
508 | endp |
508 | endp |
509 | 509 | ||
510 | ;description: |
510 | ;description: |
511 | ; ç¨á⪠ï祥ª (¯à®¢®¤®¢), ãáâ ®¢ª ¢á¥å ¯à®¢®¤ å 0-£® ᨣ « |
511 | ; ç¨á⪠ï祥ª (¯à®¢®¤®¢), ãáâ ®¢ª ¢á¥å ¯à®¢®¤ å 0-£® ᨣ « |
512 | ; 㦮 ¢ë§ë¢ âì ¯à¨ ä®à¬¨à®¢ ¨¨ ¨«¨ ¯¥à¥¤ § ¯ã᪮¬ á奬ë |
512 | ; 㦮 ¢ë§ë¢ âì ¯à¨ ä®à¬¨à®¢ ¨¨ ¨«¨ ¯¥à¥¤ § ¯ã᪮¬ á奬ë |
513 | align 4 |
513 | align 4 |
514 | proc pole_reset_cells uses eax ebx ecx edi, pole:dword |
514 | proc pole_reset_cells uses eax ebx ecx edi, pole:dword |
515 | mov edi,dword[pole] |
515 | mov edi,dword[pole] |
516 | mov eax,pole_index |
516 | mov eax,pole_index |
517 | cmp dword[eax],0 |
517 | cmp dword[eax],0 |
518 | je .fun_e ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室 |
518 | je .fun_e ;¥á«¨ ¥â ï祥ª (¯à®¢®¤®¢) â® ¢ë室 |
519 | 519 | ||
520 | mov ecx,dword[eax] |
520 | mov ecx,dword[eax] |
521 | cld |
521 | cld |
522 | @@: ;横« ¯® ¢á¥¬ ï祩ª ¬ |
522 | @@: ;横« ¯® ¢á¥¬ ï祩ª ¬ |
523 | add eax,4 |
523 | add eax,4 |
524 | mov ebx,[eax] |
524 | mov ebx,[eax] |
525 | imul ebx,sizeof.Cell |
525 | imul ebx,sizeof.Cell |
526 | add ebx,pole_data |
526 | add ebx,pole_data |
527 | ;and byte[ebx+offs_cell_liv],0xfe ;á¡à®á ¬« ¤è¥£® ¡¨â |
527 | ;and byte[ebx+offs_cell_liv],0xfe ;á¡à®á ¬« ¤è¥£® ¡¨â |
528 | cmp byte[ebx+offs_cell_liv],2 |
528 | cmp byte[ebx+offs_cell_liv],2 |
529 | je .no_clear |
529 | je .no_clear |
530 | mov byte[ebx+offs_cell_liv],0 |
530 | mov byte[ebx+offs_cell_liv],0 |
531 | .no_clear: |
531 | .no_clear: |
532 | loop @b |
532 | loop @b |
533 | .fun_e: |
533 | .fun_e: |
534 | ret |
534 | ret |
535 | endp |
535 | endp |
536 | 536 | ||
537 | align 4 |
537 | align 4 |
538 | proc p_paint_elems uses eax esi |
538 | proc p_paint_elems uses eax esi |
539 | stdcall dword[tl_node_poi_get_info],0,tree1 |
539 | stdcall dword[tl_node_poi_get_info],0,tree1 |
540 | pop esi |
540 | pop esi |
541 | @@: |
541 | @@: |
542 | cmp esi,0 |
542 | cmp esi,0 |
543 | je @f |
543 | je @f |
544 | cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨ |
544 | cmp word[esi],el_icon_elems ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨ |
545 | jne .end_element |
545 | jne .end_element |
546 | stdcall [tl_node_poi_get_data], esi, tree1 |
546 | stdcall [tl_node_poi_get_data], esi, tree1 |
547 | pop eax |
547 | pop eax |
548 | stdcall el_draw, eax |
548 | stdcall el_draw, eax |
549 | .end_element: |
549 | .end_element: |
550 | cmp word[esi],el_icon_captions ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨ |
550 | cmp word[esi],el_icon_captions ;¯®«ã票¥ ç¥à¥§ esi ⨯ ¨ª®ª¨ |
551 | jne .end_caption |
551 | jne .end_caption |
552 | stdcall [tl_node_poi_get_data], esi, tree1 |
552 | stdcall [tl_node_poi_get_data], esi, tree1 |
553 | pop eax |
553 | pop eax |
554 | stdcall capt_draw, eax |
554 | stdcall capt_draw, eax |
555 | .end_caption: |
555 | .end_caption: |
556 | stdcall dword[tl_node_poi_get_next_info],esi,tree1 |
556 | stdcall dword[tl_node_poi_get_next_info],esi,tree1 |
557 | pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã |
557 | pop esi ;¯¥à¥å®¤¨¬ ª á«¥¤ã饬ã 㧫ã |
558 | jmp @b |
558 | jmp @b |
559 | @@: |
559 | @@: |
560 | ret |
560 | ret |
561 | endp |
561 | endp |
562 | 562 | ||
563 | ;description: |
563 | ;description: |
564 | ; äãªæ¨ï à¨á®¢ ¨ï í«¥¬¥â ¯®«¥ |
564 | ; äãªæ¨ï à¨á®¢ ¨ï í«¥¬¥â ¯®«¥ |
565 | align 4 |
565 | align 4 |
566 | proc el_draw, h_elem:dword |
566 | proc el_draw, h_elem:dword |
567 | pushad |
567 | pushad |
568 | ;el_offs_nam |
568 | |
569 | mov edi,[h_elem] |
569 | mov edi,[h_elem] |
570 | mov eax,[edi] ;coord x |
570 | mov eax,[edi] ;coord x |
571 | mov ebx,[edi+4] ;coord y |
571 | mov ebx,[edi+4] ;coord y |
572 | 572 | ||
573 | movzx edi,byte[edi+sp_offs_el_type] |
573 | movzx edi,byte[edi+sp_offs_el_type] |
574 | imul edi,size_el_opt |
574 | imul edi,size_el_opt |
575 | add edi,el_opt_beg ;edi - 㪠§ ⥫ì áâàãªâãàã ᮠ᢮©á⢠¬¨ í«¥¬¥â |
575 | add edi,el_opt_beg ;edi - 㪠§ ⥫ì áâàãªâãàã ᮠ᢮©á⢠¬¨ í«¥¬¥â |
576 | 576 | ||
577 | movzx ecx,byte[edi+el_offs_box_x] |
577 | movzx ecx,byte[edi+el_offs_box_x] |
578 | movzx edx,byte[edi+el_offs_box_y] |
578 | movzx edx,byte[edi+el_offs_box_y] |
579 | dec ecx |
579 | dec ecx |
580 | dec edx |
580 | dec edx |
581 | 581 | ||
582 | push eax ebx |
582 | push eax ebx |
583 | mov esi,[h_elem] |
583 | mov esi,[h_elem] |
584 | movzx esi,byte[esi+8] |
584 | movzx esi,byte[esi+8] |
585 | push dword[edi+el_offs_col] |
585 | push dword[edi+el_offs_col] |
586 | push ebx |
586 | push ebx |
587 | push eax |
587 | push eax |
588 | stdcall move_rotate_n90, ecx,edx,esi |
588 | stdcall move_rotate_n90, ecx,edx,esi |
589 | stdcall draw_scaled_rect, eax,ebx ;à¨á®¢ ¨ ª®à¯ãá í«¥¬¥â |
589 | stdcall draw_scaled_rect, eax,ebx ;à¨á®¢ ¨ ª®à¯ãá í«¥¬¥â |
590 | pop ebx eax |
590 | pop ebx eax |
591 | 591 | ||
592 | ;*** «£®à¨â¬ à¨á®¢ ¨ï ®£ *** |
592 | ;*** «£®à¨â¬ à¨á®¢ ¨ï ®£ *** |
593 | movzx esi,byte[zoom] |
593 | movzx esi,byte[zoom] |
594 | cmp esi,1 |
594 | cmp esi,1 |
595 | jne .end_m1 |
595 | jne .end_m1 |
596 | ;*** à¨á®¢ ¨¥ ®£ ¯à¨ 1-¬ ¬ áèâ ¡¥ *** |
596 | ;*** à¨á®¢ ¨¥ ®£ ¯à¨ 1-¬ ¬ áèâ ¡¥ *** |
597 | ;¢å®¤ë¥ ®£¨ |
597 | ;¢å®¤ë¥ ®£¨ |
598 | mov esi,[h_elem] |
598 | mov esi,[h_elem] |
599 | stdcall el_get_leg_coords,esi,0 ;ãáâ ®¢ª ¯ à ¬¥â஢ 0-© ®£¨ |
599 | stdcall el_get_leg_coords,esi,0 ;ãáâ ®¢ª ¯ à ¬¥â஢ 0-© ®£¨ |
600 | add eax,[Cor_x] |
600 | add eax,[Cor_x] |
601 | add ebx,[Cor_y] |
601 | add ebx,[Cor_y] |
602 | movzx esi,byte[esi+8] |
602 | movzx esi,byte[esi+8] |
603 | stdcall move_rotate_n90, 1,0,esi |
603 | stdcall move_rotate_n90, 1,0,esi |
604 | mov edx,1 |
604 | mov edx,1 |
605 | @@: |
605 | @@: |
606 | stdcall [buf2d_set_pixel], buf_0, eax,ebx,dword[edi+el_offs_col] |
606 | stdcall [buf2d_set_pixel], buf_0, eax,ebx,dword[edi+el_offs_col] |
607 | mov ecx,[edi+el_offs_legs_inp] |
607 | mov ecx,[edi+el_offs_legs_inp] |
608 | movzx ecx,byte[ecx+edx] |
608 | movzx ecx,byte[ecx+edx] |
609 | cmp ecx,0 |
609 | cmp ecx,0 |
610 | je @f |
610 | je @f |
611 | stdcall move_rotate_n90, 0,ecx,esi |
611 | stdcall move_rotate_n90, 0,ecx,esi |
612 | inc edx |
612 | inc edx |
613 | jmp @b |
613 | jmp @b |
614 | @@: |
614 | @@: |
615 | 615 | ||
616 | ;¢ëå®¤ë¥ ®£¨ |
616 | ;¢ëå®¤ë¥ ®£¨ |
617 | mov esi,[h_elem] |
617 | mov esi,[h_elem] |
618 | stdcall el_get_leg_coords,esi,(1 shl 16) ;ãáâ ®¢ª ¯ à ¬¥â஢ 0-© ®£¨ |
618 | stdcall el_get_leg_coords,esi,(1 shl 16) ;ãáâ ®¢ª ¯ à ¬¥â஢ 0-© ®£¨ |
619 | add eax,[Cor_x] ;¤«ï à ¡®âë á buf2d_line |
619 | add eax,[Cor_x] ;¤«ï à ¡®âë á buf2d_line |
620 | add ebx,[Cor_y] ;¤«ï à ¡®âë á buf2d_line |
620 | add ebx,[Cor_y] ;¤«ï à ¡®âë á buf2d_line |
621 | movzx esi,byte[esi+8] |
621 | movzx esi,byte[esi+8] |
622 | stdcall move_rotate_n90, -2,0,esi |
622 | stdcall move_rotate_n90, -2,0,esi |
623 | mov edx,el_offs_legs_out |
623 | mov edx,el_offs_legs_out |
624 | inc edx |
624 | inc edx |
625 | @@: |
625 | @@: |
626 | push dword[edi+el_offs_col] |
626 | push dword[edi+el_offs_col] |
627 | stdcall move_rotate_n90, 1,0,esi |
627 | stdcall move_rotate_n90, 1,0,esi |
628 | push ebx |
628 | push ebx |
629 | push eax |
629 | push eax |
630 | stdcall move_rotate_n90, -1,0,esi |
630 | stdcall move_rotate_n90, -1,0,esi |
631 | ;stdcall draw_scaled_rect, eax,ebx |
631 | ;stdcall draw_scaled_rect, eax,ebx |
632 | stdcall [buf2d_line], buf_0, eax,ebx |
632 | stdcall [buf2d_line], buf_0, eax,ebx |
633 | movzx ecx,byte[edi+edx] |
633 | movzx ecx,byte[edi+edx] |
634 | cmp ecx,0 |
634 | cmp ecx,0 |
635 | je @f |
635 | je @f |
636 | stdcall move_rotate_n90, 0,ecx,esi |
636 | stdcall move_rotate_n90, 0,ecx,esi |
637 | inc edx |
637 | inc edx |
638 | jmp @b |
638 | jmp @b |
639 | @@: |
639 | @@: |
640 | 640 | ||
641 | jmp .end_mn |
641 | jmp .end_mn |
642 | .end_m1: |
642 | .end_m1: |
643 | ;*** à¨á®¢ ¨¥ ®£ ¯à¨ n-¬ ¬ áèâ ¡¥ *** |
643 | ;*** à¨á®¢ ¨¥ ®£ ¯à¨ n-¬ ¬ áèâ ¡¥ *** |
644 | ;¢å®¤ë¥ ®£¨ |
644 | ;¢å®¤ë¥ ®£¨ |
645 | xor edx,edx |
645 | xor edx,edx |
646 | @@: |
646 | @@: |
647 | stdcall el_get_leg_coords,[h_elem],edx |
647 | stdcall el_get_leg_coords,[h_elem],edx |
648 | mov ecx,eax |
648 | mov ecx,eax |
649 | or ecx,ebx |
649 | or ecx,ebx |
650 | jz @f |
650 | jz @f |
651 | mov ecx,[h_elem] |
651 | mov ecx,[h_elem] |
652 | movzx ecx,byte[ecx+8] |
652 | movzx ecx,byte[ecx+8] |
653 | stdcall move_rotate_n90, 1,0,ecx |
653 | stdcall move_rotate_n90, 1,0,ecx |
654 | add eax,[Cor_x] |
654 | add eax,[Cor_x] |
655 | add ebx,[Cor_y] |
655 | add ebx,[Cor_y] |
656 | imul eax,esi |
656 | imul eax,esi |
657 | imul ebx,esi |
657 | imul ebx,esi |
658 | stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,esi,esi, dword[edi+el_offs_col] |
658 | stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,esi,esi, dword[edi+el_offs_col] |
659 | inc edx |
659 | inc edx |
660 | jmp @b |
660 | jmp @b |
661 | @@: |
661 | @@: |
662 | 662 | ||
663 | ;¢ëå®¤ë¥ ®£¨ |
663 | ;¢ëå®¤ë¥ ®£¨ |
664 | mov edx,(1 shl 16) |
664 | mov edx,(1 shl 16) |
665 | @@: |
665 | @@: |
666 | stdcall el_get_leg_coords,[h_elem],edx |
666 | stdcall el_get_leg_coords,[h_elem],edx |
667 | mov ecx,eax |
667 | mov ecx,eax |
668 | or ecx,ebx |
668 | or ecx,ebx |
669 | jz @f |
669 | jz @f |
670 | mov ecx,[h_elem] |
670 | mov ecx,[h_elem] |
671 | movzx ecx,byte[ecx+8] |
671 | movzx ecx,byte[ecx+8] |
672 | 672 | ||
673 | push dword[edi+el_offs_col] |
673 | push dword[edi+el_offs_col] |
674 | stdcall move_rotate_n90, -2,0,ecx |
674 | stdcall move_rotate_n90, -2,0,ecx |
675 | push ebx |
675 | push ebx |
676 | push eax |
676 | push eax |
677 | stdcall move_rotate_n90, 1,0,ecx |
677 | stdcall move_rotate_n90, 1,0,ecx |
678 | stdcall draw_scaled_rect, eax,ebx |
678 | stdcall draw_scaled_rect, eax,ebx |
679 | 679 | ||
680 | inc edx |
680 | inc edx |
681 | jmp @b |
681 | jmp @b |
682 | @@: |
682 | @@: |
683 | .end_mn: |
683 | .end_mn: |
684 | popad |
684 | popad |
685 | ret |
685 | ret |
686 | endp |
686 | endp |
687 | 687 | ||
688 | ;description: |
688 | ;description: |
689 | ;à¨á®¢ ¨¥ ¯®¤¯¨á¥© |
689 | ;à¨á®¢ ¨¥ ¯®¤¯¨á¥© |
690 | align 4 |
690 | align 4 |
691 | proc capt_draw uses eax ebx edi esi, h_capt:dword |
691 | proc capt_draw uses eax ebx edi esi, h_capt:dword |
692 | mov edi,[h_capt] |
692 | mov edi,[h_capt] |
693 | mov eax,[edi] ;coord x |
693 | mov eax,[edi] ;coord x |
694 | mov ebx,[edi+4] ;coord y |
694 | mov ebx,[edi+4] ;coord y |
695 | 695 | ||
696 | movzx esi,byte[zoom] |
696 | movzx esi,byte[zoom] |
697 | cmp esi,3 |
697 | cmp esi,3 |
698 | jl @f |
698 | jl @f |
699 | ;à¨á®¢ ¨¥ à ¬ª¨, ¢®ªà㣠§ ï⮩ â®çª¨ |
699 | ;à¨á®¢ ¨¥ à ¬ª¨, ¢®ªà㣠§ ï⮩ â®çª¨ |
700 | stdcall draw_point_border, eax,ebx, color_caption |
700 | stdcall draw_point_border, eax,ebx, [color_captions] |
701 | @@: |
701 | @@: |
702 | 702 | ||
703 | add eax,[Cor_x] |
703 | add eax,[Cor_x] |
704 | add ebx,[Cor_y] |
704 | add ebx,[Cor_y] |
705 | 705 | ||
706 | cmp esi,1 |
706 | cmp esi,1 |
707 | jle @f |
707 | jle @f |
708 | imul eax,esi |
708 | imul eax,esi |
709 | imul ebx,esi |
709 | imul ebx,esi |
710 | @@: |
710 | @@: |
711 | 711 | ||
712 | cmp esi,3 |
712 | cmp esi,3 |
713 | jl @f |
713 | jl @f |
714 | ;ᤢ¨£ ¤¯¨á¨ á ãç¥â®¬ à ¬ª¨ |
714 | ;ᤢ¨£ ¤¯¨á¨ á ãç¥â®¬ à ¬ª¨ |
715 | add eax,esi |
715 | add eax,esi |
716 | inc eax |
716 | inc eax |
717 | @@: |
717 | @@: |
718 | 718 | ||
719 | add edi,capt_offs ;edi - 㪠§ â¥«ì ¯®«ãî ¯®¤¯¨áì (á ª®®à¤¨ â ¬¨) |
719 | add edi,capt_offs ;edi - 㪠§ â¥«ì ¯®«ãî ¯®¤¯¨áì (á ª®®à¤¨ â ¬¨) |
720 | call str_next_val |
720 | call str_next_val |
721 | call str_next_val |
721 | call str_next_val |
722 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,eax,ebx,color_caption ;à¨á㥬 áâபã á ⥪á⮬ |
722 | stdcall [buf2d_draw_text], buf_0, buf_font,edi,eax,ebx,[color_captions] ;à¨á㥬 áâபã á ⥪á⮬ |
723 | ret |
723 | ret |
724 | endp |
724 | endp |
725 | 725 | ||
726 | ;description: |
726 | ;description: |
727 | ; äãªæ¨ï ¤«ï ¢ë¤¥«¥¨ï â®ç¥çëå ®¡ê¥ªâ®¢ ªàã¯ëå ¬ áèâ ¡ å |
727 | ; äãªæ¨ï ¤«ï ¢ë¤¥«¥¨ï â®ç¥çëå ®¡ê¥ªâ®¢ ªàã¯ëå ¬ áèâ ¡ å |
728 | ; ¤ ï äãªæ¨ï ®ç¥ì ¯®å®¦ draw_signal_rect |
728 | ; ¤ ï äãªæ¨ï ®ç¥ì ¯®å®¦ draw_signal_rect |
729 | align 4 |
729 | align 4 |
730 | proc draw_point_border uses eax ebx edi, x0:dword,y0:dword, color:dword |
730 | proc draw_point_border uses eax ebx edi, x0:dword,y0:dword, color:dword |
731 | movzx edi,byte[zoom] |
731 | movzx edi,byte[zoom] |
732 | mov ebx,[y0] |
732 | mov ebx,[y0] |
733 | mov eax,[x0] |
733 | mov eax,[x0] |
734 | 734 | ||
735 | add ebx,[Cor_y] |
735 | add ebx,[Cor_y] |
736 | imul ebx,edi |
736 | imul ebx,edi |
737 | add eax,[Cor_x] |
737 | add eax,[Cor_x] |
738 | imul eax,edi |
738 | imul eax,edi |
739 | 739 | ||
740 | stdcall [buf2d_rect_by_size], buf_0, eax,ebx,edi,edi, dword[color] |
740 | stdcall [buf2d_rect_by_size], buf_0, eax,ebx,edi,edi, dword[color] |
741 | ret |
741 | ret |
742 | endp |
742 | endp |
743 | 743 | ||
744 | ;description: |
744 | ;description: |
745 | ; ¯®¤äãªæ¨ï ¤«ï à¨á®¢ ¨ï 㢥«¨ç¥ëå ¯àאַ㣮«ì¨ª®¢ á奬¥ |
745 | ; ¯®¤äãªæ¨ï ¤«ï à¨á®¢ ¨ï 㢥«¨ç¥ëå ¯àאַ㣮«ì¨ª®¢ á奬¥ |
746 | align 4 |
746 | align 4 |
747 | proc draw_scaled_rect uses eax ebx ecx edx edi, x0:dword,y0:dword,x1:dword,y1:dword, color:dword |
747 | proc draw_scaled_rect uses eax ebx ecx edx edi, x0:dword,y0:dword,x1:dword,y1:dword, color:dword |
748 | movzx edi,byte[zoom] |
748 | movzx edi,byte[zoom] |
749 | mov edx,[y1] |
749 | mov edx,[y1] |
750 | mov ecx,[x1] |
750 | mov ecx,[x1] |
751 | mov ebx,[y0] |
751 | mov ebx,[y0] |
752 | mov eax,[x0] |
752 | mov eax,[x0] |
753 | 753 | ||
754 | cmp eax,ecx |
754 | cmp eax,ecx |
755 | jle @f |
755 | jle @f |
756 | xchg eax,ecx |
756 | xchg eax,ecx |
757 | @@: |
757 | @@: |
758 | sub ecx,eax |
758 | sub ecx,eax |
759 | cmp ebx,edx |
759 | cmp ebx,edx |
760 | jle @f |
760 | jle @f |
761 | xchg ebx,edx |
761 | xchg ebx,edx |
762 | @@: |
762 | @@: |
763 | sub edx,ebx |
763 | sub edx,ebx |
764 | 764 | ||
765 | inc ecx |
765 | inc ecx |
766 | inc edx |
766 | inc edx |
767 | 767 | ||
768 | imul edx,edi |
768 | imul edx,edi |
769 | imul ecx,edi |
769 | imul ecx,edi |
770 | add ebx,[Cor_y] |
770 | add ebx,[Cor_y] |
771 | imul ebx,edi |
771 | imul ebx,edi |
772 | add eax,[Cor_x] |
772 | add eax,[Cor_x] |
773 | imul eax,edi |
773 | imul eax,edi |
774 | 774 | ||
775 | stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,ecx,edx, dword[color] |
775 | stdcall [buf2d_filled_rect_by_size], buf_0, eax,ebx,ecx,edx, dword[color] |
776 | ret |
776 | ret |
777 | endp |
777 | endp |
778 | 778 | ||
779 | align 4 |
779 | align 4 |
780 | proc pole_paint, pole:dword |
780 | proc pole_paint, pole:dword |
781 | pushad |
781 | pushad |
782 | 782 | ||
783 | ;*** நᮢ ¨¥ à ¬ª¨ |
783 | ;*** நᮢ ¨¥ à ¬ª¨ |
784 | mov eax,[Cor_x] |
784 | mov eax,[Cor_x] |
785 | mov ebx,[Cor_y] |
785 | mov ebx,[Cor_y] |
786 | mov ecx,[shem_w] |
786 | mov ecx,[shem_w] |
787 | mov edx,[shem_h] |
787 | mov edx,[shem_h] |
788 | movzx esi,byte[zoom] |
788 | movzx esi,byte[zoom] |
789 | cmp esi,1 |
789 | cmp esi,1 |
790 | jle @f |
790 | jle @f |
791 | imul eax,esi |
791 | imul eax,esi |
792 | imul ebx,esi |
792 | imul ebx,esi |
793 | imul ecx,esi |
793 | imul ecx,esi |
794 | imul edx,esi |
794 | imul edx,esi |
795 | @@: |
795 | @@: |
796 | dec eax |
796 | dec eax |
797 | dec ebx |
797 | dec ebx |
798 | add ecx,2 |
798 | add ecx,2 |
799 | add edx,2 |
799 | add edx,2 |
800 | stdcall [buf2d_rect_by_size], buf_0, eax,ebx, ecx,edx, [color_border] |
800 | stdcall [buf2d_rect_by_size], buf_0, eax,ebx, ecx,edx, [color_border] |
801 | 801 | ||
802 | ;eax -> firstC |
802 | ;eax -> firstC |
803 | ;ebx -> i |
803 | ;ebx -> i |
804 | ;ecx -> cell[pole_index[i]] |
804 | ;ecx -> cell[pole_index[i]] |
805 | ;edx -> color |
805 | ;edx -> color |
806 | 806 | ||
807 | mov edi,dword[pole] |
807 | mov edi,dword[pole] |
808 | mov eax,pole_index |
808 | mov eax,pole_index |
809 | cmp dword[eax],0 |
809 | cmp dword[eax],0 |
810 | je .no_draw |
810 | je .no_draw |
811 | 811 | ||
812 | mov eax,dword[eax] |
812 | mov eax,dword[eax] |
813 | mov ebx,1 |
813 | mov ebx,1 |
814 | 814 | ||
815 | ;--- |
815 | ;--- |
816 | @@: ;while(i |
816 | @@: ;while(i |
817 | cmp ebx,pole_b_sort |
817 | cmp ebx,pole_b_sort |
818 | jge @f ;¯¥à¥å®¤¨¬ ç «® ¨¦¥£® 横« |
818 | jge @f ;¯¥à¥å®¤¨¬ ç «® ¨¦¥£® 横« |
819 | mov ecx,ebx |
819 | mov ecx,ebx |
820 | shl ecx,2 |
820 | shl ecx,2 |
821 | add ecx,pole_index |
821 | add ecx,pole_index |
822 | get_cell_offset ecx,dword[ecx] |
822 | get_cell_offset ecx,dword[ecx] |
823 | mov edx,dword[ecx] ;+0 = .x |
823 | mov edx,dword[ecx] ;+0 = .x |
824 | add edx,dword[Cor_x] |
824 | add edx,dword[Cor_x] |
825 | cmp edx,0 |
825 | cmp edx,0 |
826 | jge @f ;¯¥à¥å®¤¨¬ ç «® ¨¦¥£® 横« |
826 | jge @f ;¯¥à¥å®¤¨¬ ç «® ¨¦¥£® 横« |
827 | inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ï祥ª § ®ª®¬ á«¥¢ |
827 | inc ebx ;i++; // ¤«ï ¯à®¯ã᪠ï祥ª § ®ª®¬ á«¥¢ |
828 | jmp @b |
828 | jmp @b |
829 | @@: |
829 | @@: |
830 | 830 | ||
831 | ;eax -> pole_index[firstC] |
831 | ;eax -> pole_index[firstC] |
832 | ;ebx -> pole_index[i] |
832 | ;ebx -> pole_index[i] |
833 | ;edi -> coord_x |
833 | ;edi -> coord_x |
834 | ;esi -> coord_y |
834 | ;esi -> coord_y |
835 | shl eax,2 |
835 | shl eax,2 |
836 | shl ebx,2 |
836 | shl ebx,2 |
837 | add eax,pole_index |
837 | add eax,pole_index |
838 | add ebx,pole_index |
838 | add ebx,pole_index |
839 | 839 | ||
840 | cmp byte[zoom],2 |
840 | cmp byte[zoom],2 |
841 | jge .zoom2 |
841 | jge .zoom2 |
842 | @@: ;for(;i<=fristC;i++){ |
842 | @@: ;for(;i<=fristC;i++){ |
843 | get_cell_offset ecx,dword[ebx] |
843 | get_cell_offset ecx,dword[ebx] |
844 | ;... |
844 | ;... |
845 | mov edi,dword[Cor_x] |
845 | mov edi,dword[Cor_x] |
846 | add edi,dword[ecx] ;+0 = .x |
846 | add edi,dword[ecx] ;+0 = .x |
847 | mov esi,dword[Cor_y] |
847 | mov esi,dword[Cor_y] |
848 | add esi,dword[ecx+4] ;+4 = .y |
848 | add esi,dword[ecx+4] ;+4 = .y |
849 | movzx edx,byte[ecx+offs_cell_liv] |
849 | movzx edx,byte[ecx+offs_cell_liv] |
850 | and edx,3 ;®£à ¨ç¥¨¥ |
850 | and edx,3 ;®£à ¨ç¥¨¥ |
851 | shl edx,2 |
851 | shl edx,2 |
852 | add edx,shem_colors |
852 | add edx,shem_colors |
853 | stdcall [buf2d_set_pixel], buf_0, edi, esi, [edx] |
853 | stdcall [buf2d_set_pixel], buf_0, edi, esi, [edx] |
854 | ;... |
854 | ;... |
855 | add ebx,4 |
855 | add ebx,4 |
856 | cmp ebx,eax |
856 | cmp ebx,eax |
857 | jle @b |
857 | jle @b |
858 | 858 | ||
859 | jmp .no_draw |
859 | jmp .no_draw |
860 | .zoom2: |
860 | .zoom2: |
861 | 861 | ||
862 | @@: ;for(;i<=fristC;i++){ |
862 | @@: ;for(;i<=fristC;i++){ |
863 | get_cell_offset ecx,dword[ebx] |
863 | get_cell_offset ecx,dword[ebx] |
864 | 864 | ||
865 | movzx edx,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢¥á¥¨ï zoom ¢ 4 ¡ ©â®¥ ç¨á«® |
865 | movzx edx,byte[zoom] ;edx ¨á¯®«ì§ã¥âáï ¤«ï ¢¥á¥¨ï zoom ¢ 4 ¡ ©â®¥ ç¨á«® |
866 | mov edi,dword[ecx] ;+0 = .x |
866 | mov edi,dword[ecx] ;+0 = .x |
867 | add edi,dword[Cor_x] |
867 | add edi,dword[Cor_x] |
868 | imul edi,edx |
868 | imul edi,edx |
869 | mov esi,dword[ecx+4] ;+4 = .y |
869 | mov esi,dword[ecx+4] ;+4 = .y |
870 | add esi,dword[Cor_y] |
870 | add esi,dword[Cor_y] |
871 | imul esi,edx |
871 | imul esi,edx |
872 | 872 | ||
873 | movzx edx,byte[ecx+offs_cell_liv] |
873 | movzx edx,byte[ecx+offs_cell_liv] |
874 | and edx,3 ;®£à ¨ç¥¨¥ |
874 | and edx,3 ;®£à ¨ç¥¨¥ |
875 | shl edx,2 |
875 | shl edx,2 |
876 | add edx,shem_colors |
876 | add edx,shem_colors |
877 | 877 | ||
878 | movzx ecx,byte[zoom] |
878 | movzx ecx,byte[zoom] |
879 | ;;;dec ecx |
879 | ;;;dec ecx |
880 | stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, [edx] |
880 | stdcall [buf2d_filled_rect_by_size], buf_0, edi, esi, ecx, ecx, [edx] |
881 | add ebx,4 |
881 | add ebx,4 |
882 | cmp ebx,eax |
882 | cmp ebx,eax |
883 | jle @b |
883 | jle @b |
884 | 884 | ||
885 | .no_draw: |
885 | .no_draw: |
886 | popad |
886 | popad |
887 | call p_paint_elems |
887 | call p_paint_elems |
888 | ret |
888 | ret |
889 | endp |
889 | endp |
890 | 890 | ||
891 | ;®àâ¨à®¢ª ï祥ª ¯®«ï, 㦠¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª |
891 | ;®àâ¨à®¢ª ï祥ª ¯®«ï, 㦠¤«ï ¡®«¥¥ ¡ëáâண® ¯®¨áª |
892 | align 4 |
892 | align 4 |
893 | proc pole_sort uses eax edi, pole:dword |
893 | proc pole_sort uses eax edi, pole:dword |
894 | mov edi,dword[pole] |
894 | mov edi,dword[pole] |
895 | mov eax,pole_index |
895 | mov eax,pole_index |
896 | mov eax,dword[eax] ;firstC -> eax |
896 | mov eax,dword[eax] ;firstC -> eax |
897 | stdcall pole_fl_sort, pole_index,eax ;á®àâ¨à㥬 ¢á¥ ï祩ª¨ |
897 | stdcall pole_fl_sort, pole_index,eax ;á®àâ¨à㥬 ¢á¥ ï祩ª¨ |
898 | mov pole_b_sort,eax ;áâ ¢¨¬ ç¨á«® ®âá®àâ¨à®¢ ëå ï祥ª à ¢®¥ ç¨á«ã ¢á¥å áãé¥áâ¢ãîé¨å ï祥ª |
898 | mov pole_b_sort,eax ;áâ ¢¨¬ ç¨á«® ®âá®àâ¨à®¢ ëå ï祥ª à ¢®¥ ç¨á«ã ¢á¥å áãé¥áâ¢ãîé¨å ï祥ª |
899 | ret |
899 | ret |
900 | endp |
900 | endp |
901 | 901 | ||
902 | ;®àâ¨à®¢ª ¢¥ªâ®à a[1..n] ¬¥â®¤®¬ «®©¤ |
902 | ;®àâ¨à®¢ª ¢¥ªâ®à a[1..n] ¬¥â®¤®¬ «®©¤ |
903 | ;«¥¬¥â a[0] ¢ á®àâ¨à®¢ª¥ ¥ ãç áâ¢ã¥â |
903 | ;«¥¬¥â a[0] ¢ á®àâ¨à®¢ª¥ ¥ ãç áâ¢ã¥â |
904 | align 4 |
904 | align 4 |
905 | proc pole_fl_sort uses eax ecx edx edi esi, a:dword, n:dword |
905 | proc pole_fl_sort uses eax ecx edx edi esi, a:dword, n:dword |
906 | mov ecx,dword[a] |
906 | mov ecx,dword[a] |
907 | ;®à¬¨à®¢ âì ¨á室®¥ ç áâ¨ç® 㯮à冷祮¥ ¤¥à¥¢® |
907 | ;®à¬¨à®¢ âì ¨á室®¥ ç áâ¨ç® 㯮à冷祮¥ ¤¥à¥¢® |
908 | mov eax,dword[n] |
908 | mov eax,dword[n] |
909 | shr eax,1 |
909 | shr eax,1 |
910 | @@: ;for(i=n>>1; i>=2; i--) |
910 | @@: ;for(i=n>>1; i>=2; i--) |
911 | stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n) |
911 | stdcall pole_fl_surface, ecx,eax,[n] ;(a,i,n) |
912 | dec eax |
912 | dec eax |
913 | cmp eax,2 |
913 | cmp eax,2 |
914 | jge @b |
914 | jge @b |
915 | ;믮«¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï «®©¤ ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ |
915 | ;믮«¨âì ¯à®æ¥¤ãà㠢ᯫëâ¨ï «®©¤ ¤«ï ª ¦¤®£® ¯®¤¤¥à¥¢ |
916 | mov eax,dword[n] |
916 | mov eax,dword[n] |
917 | @@: ;for(i=n; i>=2; i--){ |
917 | @@: ;for(i=n; i>=2; i--){ |
918 | stdcall pole_fl_surface, ecx,1,eax ;(a,1,i) |
918 | stdcall pole_fl_surface, ecx,1,eax ;(a,1,i) |
919 | ;®¬¥áâ¨âì ©¤¥ë© ¬ ªá¨¬ «ìë© í«¥¬¥â ¢ ª®¥æ ᯨ᪠|
919 | ;®¬¥áâ¨âì ©¤¥ë© ¬ ªá¨¬ «ìë© í«¥¬¥â ¢ ª®¥æ ᯨ᪠|
920 | mov edi,eax |
920 | mov edi,eax |
921 | shl edi,2 |
921 | shl edi,2 |
922 | add edi,ecx ;edi -> &a[i] |
922 | add edi,ecx ;edi -> &a[i] |
923 | mov esi,dword[edi] ;w=a[i]; |
923 | mov esi,dword[edi] ;w=a[i]; |
924 | mov edx,dword[ecx+4] |
924 | mov edx,dword[ecx+4] |
925 | mov dword[edi],edx ;a[i]=a[1]; |
925 | mov dword[edi],edx ;a[i]=a[1]; |
926 | mov dword[ecx+4],esi ;a[1]=w; |
926 | mov dword[ecx+4],esi ;a[1]=w; |
927 | 927 | ||
928 | dec eax |
928 | dec eax |
929 | cmp eax,2 |
929 | cmp eax,2 |
930 | jge @b |
930 | jge @b |
931 | ret |
931 | ret |
932 | endp |
932 | endp |
933 | 933 | ||
934 | ;à®æ¥¤ãà ¢á¯«ëâ¨ï «®©¤ ¯® ¤¥à¥¢ã a[1..k] |
934 | ;à®æ¥¤ãà ¢á¯«ëâ¨ï «®©¤ ¯® ¤¥à¥¢ã a[1..k] |
935 | align 4 |
935 | align 4 |
936 | proc pole_fl_surface, a:dword, i:dword, k:dword |
936 | proc pole_fl_surface, a:dword, i:dword, k:dword |
937 | locals |
937 | locals |
938 | copy dd ? |
938 | copy dd ? |
939 | endl |
939 | endl |
940 | pushad |
940 | pushad |
941 | ;edx -> ... |
941 | ;edx -> ... |
942 | ;edi -> m |
942 | ;edi -> m |
943 | ;esi -> j |
943 | ;esi -> j |
944 | mov eax,dword[a] |
944 | mov eax,dword[a] |
945 | mov ebx,dword[i] |
945 | mov ebx,dword[i] |
946 | mov ecx,dword[k] |
946 | mov ecx,dword[k] |
947 | 947 | ||
948 | mov edx,ebx |
948 | mov edx,ebx |
949 | shl edx,2 |
949 | shl edx,2 |
950 | add edx,eax |
950 | add edx,eax |
951 | mov edx,dword[edx] |
951 | mov edx,dword[edx] |
952 | mov dword[copy],edx ;copy=a[i]; |
952 | mov dword[copy],edx ;copy=a[i]; |
953 | mov edi,ebx |
953 | mov edi,ebx |
954 | shl edi,1 ;m=i<<1; |
954 | shl edi,1 ;m=i<<1; |
955 | .cycle_b: ;while (m<=k) { |
955 | .cycle_b: ;while (m<=k) { |
956 | cmp edi,ecx |
956 | cmp edi,ecx |
957 | jg .cycle_e |
957 | jg .cycle_e |
958 | jne @f ;if (m==k) j=m; |
958 | jne @f ;if (m==k) j=m; |
959 | mov esi,edi |
959 | mov esi,edi |
960 | jmp .else_e |
960 | jmp .else_e |
961 | @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m; |
961 | @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m; |
962 | mov edx,edi |
962 | mov edx,edi |
963 | shl edx,2 |
963 | shl edx,2 |
964 | add edx,eax |
964 | add edx,eax |
965 | stdcall pole_compare_cells_bm, dword[edx],dword[edx+4] |
965 | stdcall pole_compare_cells_bm, dword[edx],dword[edx+4] |
966 | cmp dl,0 |
966 | cmp dl,0 |
967 | je @f |
967 | je @f |
968 | mov esi,edi |
968 | mov esi,edi |
969 | jmp .else_e |
969 | jmp .else_e |
970 | @@: ;else j=m+1; |
970 | @@: ;else j=m+1; |
971 | mov esi,edi |
971 | mov esi,edi |
972 | inc esi |
972 | inc esi |
973 | .else_e: |
973 | .else_e: |
974 | 974 | ||
975 | ;if (pole_compare_cells_bm(a[j],copy)) { |
975 | ;if (pole_compare_cells_bm(a[j],copy)) { |
976 | mov edx,esi |
976 | mov edx,esi |
977 | shl edx,2 |
977 | shl edx,2 |
978 | add edx,eax |
978 | add edx,eax |
979 | stdcall pole_compare_cells_bm, dword[edx],dword[copy] |
979 | stdcall pole_compare_cells_bm, dword[edx],dword[copy] |
980 | cmp dl,0 |
980 | cmp dl,0 |
981 | je .cycle_e ;} else break; //¢ë室 ¨§ 横« |
981 | je .cycle_e ;} else break; //¢ë室 ¨§ 横« |
982 | 982 | ||
983 | mov edx,esi |
983 | mov edx,esi |
984 | shl edx,2 |
984 | shl edx,2 |
985 | add edx,eax |
985 | add edx,eax |
986 | push dword[edx] ;push a[j]; |
986 | push dword[edx] ;push a[j]; |
987 | mov edx,ebx |
987 | mov edx,ebx |
988 | shl edx,2 |
988 | shl edx,2 |
989 | add edx,eax |
989 | add edx,eax |
990 | pop dword[edx] ;a[i]=a[j]; |
990 | pop dword[edx] ;a[i]=a[j]; |
991 | mov ebx,esi ;i=j; |
991 | mov ebx,esi ;i=j; |
992 | mov edi,ebx |
992 | mov edi,ebx |
993 | shl edi,1 ;m=i<<1; |
993 | shl edi,1 ;m=i<<1; |
994 | 994 | ||
995 | jmp .cycle_b |
995 | jmp .cycle_b |
996 | .cycle_e: |
996 | .cycle_e: |
997 | 997 | ||
998 | ;§ ç¥¨ï ¬®£¨å ॣ¨áâ஢ 㦥 ¥ ¢ ¦ë â. ª. ª®¥æ äãªæ¨¨ |
998 | ;§ ç¥¨ï ¬®£¨å ॣ¨áâ஢ 㦥 ¥ ¢ ¦ë â. ª. ª®¥æ äãªæ¨¨ |
999 | shl ebx,2 |
999 | shl ebx,2 |
1000 | add eax,ebx |
1000 | add eax,ebx |
1001 | mov edx,dword[copy] |
1001 | mov edx,dword[copy] |
1002 | mov dword[eax],edx ;a[i]=copy; |
1002 | mov dword[eax],edx ;a[i]=copy; |
1003 | 1003 | ||
1004 | popad |
1004 | popad |
1005 | ret |
1005 | ret |
1006 | endp |
1006 | endp |
1007 | ;-------------------------------------- |
1007 | ;-------------------------------------- |
1008 | 1008 | ||
1009 | align 4 |
1009 | align 4 |
1010 | proc pole_draw_pok uses eax ebx ecx edx edi esi, pole:dword |
1010 | proc pole_draw_pok uses eax ebx ecx edx edi esi, pole:dword |
1011 | ;mov edi,dword[pole] |
1011 | ;mov edi,dword[pole] |
1012 | 1012 | ||
1013 | mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ |
1013 | mov eax,4 ;à¨á®¢ ¨¥ ⥪áâ |
1014 | mov ebx,400*65536+5 |
1014 | mov ebx,400*65536+5 |
1015 | mov ecx,[sc.work_text] |
1015 | mov ecx,[sc.work_text] |
1016 | or ecx,0x80000000 ;or (1 shl 30) |
1016 | or ecx,0x80000000 ;or (1 shl 30) |
1017 | mov edx,txt_zoom |
1017 | mov edx,txt_zoom |
1018 | ;mov edi,[sc.work] |
1018 | ;mov edi,[sc.work] |
1019 | int 0x40 |
1019 | int 0x40 |
1020 | 1020 | ||
1021 | add bx,9 |
1021 | add bx,9 |
1022 | mov edx,txt_osob |
1022 | mov edx,txt_osob |
1023 | int 0x40 |
1023 | int 0x40 |
1024 | 1024 | ||
1025 | add bx,9 |
1025 | add bx,9 |
1026 | mov edx,txt_info |
1026 | mov edx,txt_info |
1027 | int 0x40 |
1027 | int 0x40 |
1028 | 1028 | ||
1029 | mov eax,47 |
1029 | mov eax,47 |
1030 | movzx ecx,byte[zoom] |
1030 | movzx ecx,byte[zoom] |
1031 | mov ebx,(2 shl 16) |
1031 | mov ebx,(2 shl 16) |
1032 | mov edx,(400+6*9)*65536+5 |
1032 | mov edx,(400+6*9)*65536+5 |
1033 | mov esi,[sc.work_button_text] |
1033 | mov esi,[sc.work_button_text] |
1034 | or esi,(1 shl 30) |
1034 | or esi,(1 shl 30) |
1035 | mov edi,[sc.work_button] |
1035 | mov edi,[sc.work_button] |
1036 | int 0x40 ;¬ áèâ ¡ |
1036 | int 0x40 ;¬ áèâ ¡ |
1037 | 1037 | ||
1038 | mov edi,dword[pole] |
1038 | mov edi,dword[pole] |
1039 | mov ecx,pole_index |
1039 | mov ecx,pole_index |
1040 | mov ecx,[ecx] |
1040 | mov ecx,[ecx] |
1041 | mov edi,[sc.work_button] |
1041 | mov edi,[sc.work_button] |
1042 | mov ebx,(5 shl 16) |
1042 | mov ebx,(5 shl 16) |
1043 | add edx,(6*0)*65536+9 |
1043 | add edx,(6*0)*65536+9 |
1044 | int 0x40 ;ç¨á«® â®ç¥ª |
1044 | int 0x40 ;ç¨á«® â®ç¥ª |
1045 | ret |
1045 | ret |
1046 | endp |
1046 | endp |
1047 | 1047 | ||
1048 | align 4 |
1048 | align 4 |
1049 | but_zoom_p: |
1049 | but_zoom_p: |
1050 | cmp byte[zoom],16 |
1050 | cmp byte[zoom],16 |
1051 | jge @f |
1051 | jge @f |
1052 | pushad |
1052 | pushad |
1053 | ;¢ëç¨á«¥¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â æ¥â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥¨¨ ¬ áèâ ¡ |
1053 | ;¢ëç¨á«¥¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â æ¥â஢ªã ¯®«ï ¯à¨ 㢥«¨ç¥¨¨ ¬ áèâ ¡ |
1054 | movzx ecx,byte[zoom] |
1054 | movzx ecx,byte[zoom] |
1055 | xor edx,edx |
1055 | xor edx,edx |
1056 | mov eax,dword[buf_0.w] |
1056 | mov eax,dword[buf_0.w] |
1057 | shr eax,1 ;¢ eax ¯®«®¢¨ è¨à¨ë ¯®«ï |
1057 | shr eax,1 ;¢ eax ¯®«®¢¨ è¨à¨ë ¯®«ï |
1058 | mov ebx,eax ;¤¥« ¥¬ १¥à¢ãî ª®¯¨î eax |
1058 | mov ebx,eax ;¤¥« ¥¬ १¥à¢ãî ª®¯¨î eax |
1059 | div ecx ;¤¥«¨¬ eax ⥪ã騩 ¬ áèâ ¡ |
1059 | div ecx ;¤¥«¨¬ eax ⥪ã騩 ¬ áèâ ¡ |
1060 | xchg eax,ebx |
1060 | xchg eax,ebx |
1061 | xor edx,edx |
1061 | xor edx,edx |
1062 | inc ecx |
1062 | inc ecx |
1063 | div ecx ;¤¥«¨¬ eax ®¢ë© ¬ áèâ ¡ |
1063 | div ecx ;¤¥«¨¬ eax ®¢ë© ¬ áèâ ¡ |
1064 | sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â æ¥â஢ªã ¯®«ï |
1064 | sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â æ¥â஢ªã ¯®«ï |
1065 | sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ x |
1065 | sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ x |
1066 | xor ecx,ecx |
1066 | xor ecx,ecx |
1067 | mov cl,byte[zoom] |
1067 | mov cl,byte[zoom] |
1068 | xor edx,edx |
1068 | xor edx,edx |
1069 | mov eax,dword[buf_0.h] |
1069 | mov eax,dword[buf_0.h] |
1070 | shr eax,1 |
1070 | shr eax,1 |
1071 | mov ebx,eax |
1071 | mov ebx,eax |
1072 | div ecx |
1072 | div ecx |
1073 | xchg eax,ebx |
1073 | xchg eax,ebx |
1074 | xor edx,edx |
1074 | xor edx,edx |
1075 | inc ecx |
1075 | inc ecx |
1076 | div ecx |
1076 | div ecx |
1077 | sub ebx,eax |
1077 | sub ebx,eax |
1078 | sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ y |
1078 | sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ y |
1079 | 1079 | ||
1080 | inc byte[zoom] |
1080 | inc byte[zoom] |
1081 | stdcall pole_draw_pok, pole |
1081 | stdcall pole_draw_pok, pole |
1082 | popad |
1082 | popad |
1083 | 1083 | ||
1084 | .buf_clear: |
1084 | .buf_clear: |
1085 | call redraw_pole |
1085 | call redraw_pole |
1086 | @@: |
1086 | @@: |
1087 | ret |
1087 | ret |
1088 | 1088 | ||
1089 | align 4 |
1089 | align 4 |
1090 | but_zoom_m: |
1090 | but_zoom_m: |
1091 | cmp byte[zoom],1 |
1091 | cmp byte[zoom],1 |
1092 | jle @f |
1092 | jle @f |
1093 | pushad |
1093 | pushad |
1094 | ;¢ëç¨á«¥¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â æ¥â஢ªã ¯®«ï ¯à¨ 㬥ì襨¨ ¬ áèâ ¡ |
1094 | ;¢ëç¨á«¥¨¥ ᤢ¨£®¢ ¤«ï ¯®«ï, ª®â®àë¥ ®¡¥á¯¥ç â æ¥â஢ªã ¯®«ï ¯à¨ 㬥ì襨¨ ¬ áèâ ¡ |
1095 | movzx ecx,byte[zoom] |
1095 | movzx ecx,byte[zoom] |
1096 | xor edx,edx |
1096 | xor edx,edx |
1097 | mov eax,dword[buf_0.w] |
1097 | mov eax,dword[buf_0.w] |
1098 | shr eax,1 ;¢ eax ¯®«®¢¨ è¨à¨ë ¯®«ï |
1098 | shr eax,1 ;¢ eax ¯®«®¢¨ è¨à¨ë ¯®«ï |
1099 | mov ebx,eax ;¤¥« ¥¬ १¥à¢ãî ª®¯¨î eax |
1099 | mov ebx,eax ;¤¥« ¥¬ १¥à¢ãî ª®¯¨î eax |
1100 | div ecx ;¤¥«¨¬ eax ⥪ã騩 ¬ áèâ ¡ |
1100 | div ecx ;¤¥«¨¬ eax ⥪ã騩 ¬ áèâ ¡ |
1101 | xchg eax,ebx |
1101 | xchg eax,ebx |
1102 | xor edx,edx |
1102 | xor edx,edx |
1103 | dec ecx |
1103 | dec ecx |
1104 | div ecx ;¤¥«¨¬ eax ®¢ë© ¬ áèâ ¡ |
1104 | div ecx ;¤¥«¨¬ eax ®¢ë© ¬ áèâ ¡ |
1105 | sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â æ¥â஢ªã ¯®«ï |
1105 | sub ebx,eax ;¢ëç¨á«ï¥âáï ᤢ¨£ ¯®«ï ª®â®àë© ®¡¥á¯¥ç¨â æ¥â஢ªã ¯®«ï |
1106 | sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ x |
1106 | sub dword[Cor_x],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ x |
1107 | xor ecx,ecx |
1107 | xor ecx,ecx |
1108 | mov cl,byte[zoom] |
1108 | mov cl,byte[zoom] |
1109 | xor edx,edx |
1109 | xor edx,edx |
1110 | mov eax,dword[buf_0.h] |
1110 | mov eax,dword[buf_0.h] |
1111 | shr eax,1 |
1111 | shr eax,1 |
1112 | mov ebx,eax |
1112 | mov ebx,eax |
1113 | div ecx |
1113 | div ecx |
1114 | xchg eax,ebx |
1114 | xchg eax,ebx |
1115 | xor edx,edx |
1115 | xor edx,edx |
1116 | dec ecx |
1116 | dec ecx |
1117 | div ecx |
1117 | div ecx |
1118 | sub ebx,eax |
1118 | sub ebx,eax |
1119 | sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ y |
1119 | sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥¨ï ¯® ®á¨ y |
1120 | 1120 | ||
1121 | dec byte[zoom] |
1121 | dec byte[zoom] |
1122 | stdcall pole_draw_pok, pole |
1122 | stdcall pole_draw_pok, pole |
1123 | popad |
1123 | popad |
1124 | 1124 | ||
1125 | .buf_clear: |
1125 | .buf_clear: |
1126 | call redraw_pole |
1126 | call redraw_pole |
1127 | @@: |
1127 | @@: |
1128 | ret |
1128 | ret |
1129 | 1129 | ||
1130 | ;æ¥â஢ª áå¥¬ë ¯® æ¥âàã íªà |
1130 | ;æ¥â஢ª áå¥¬ë ¯® æ¥âàã íªà |
1131 | align 4 |
1131 | align 4 |
1132 | proc but_center uses eax ebx ecx edx |
1132 | proc but_center uses eax ebx ecx edx |
1133 | movzx ecx,byte[zoom] |
1133 | movzx ecx,byte[zoom] |
1134 | cmp ecx,1 |
1134 | cmp ecx,1 |
1135 | jle .end_m_1 |
1135 | jle .end_m_1 |
1136 | mov eax,[buf_0.w] |
1136 | mov eax,[buf_0.w] |
1137 | mov ebx,[shem_w] |
1137 | mov ebx,[shem_w] |
1138 | imul ebx,ecx |
1138 | imul ebx,ecx |
1139 | 1139 | ||
1140 | sub eax,ebx |
1140 | sub eax,ebx |
1141 | xor edx,edx |
1141 | xor edx,edx |
1142 | shl ecx,1 |
1142 | shl ecx,1 |
1143 | cmp eax,0 |
1143 | cmp eax,0 |
1144 | jge @f |
1144 | jge @f |
1145 | neg eax |
1145 | neg eax |
1146 | inc eax |
1146 | inc eax |
1147 | div ecx |
1147 | div ecx |
1148 | neg eax |
1148 | neg eax |
1149 | inc eax |
1149 | inc eax |
1150 | jmp .set_x |
1150 | jmp .set_x |
1151 | @@: |
1151 | @@: |
1152 | div ecx |
1152 | div ecx |
1153 | .set_x: |
1153 | .set_x: |
1154 | mov [Cor_x],eax |
1154 | mov [Cor_x],eax |
1155 | mov eax,[buf_0.h] |
1155 | mov eax,[buf_0.h] |
1156 | mov ebx,[shem_h] |
1156 | mov ebx,[shem_h] |
1157 | shr ecx,1 |
1157 | shr ecx,1 |
1158 | imul ebx,ecx |
1158 | imul ebx,ecx |
1159 | sub eax,ebx |
1159 | sub eax,ebx |
1160 | xor edx,edx |
1160 | xor edx,edx |
1161 | shl ecx,1 |
1161 | shl ecx,1 |
1162 | cmp eax,0 |
1162 | cmp eax,0 |
1163 | jge @f |
1163 | jge @f |
1164 | neg eax |
1164 | neg eax |
1165 | inc eax |
1165 | inc eax |
1166 | div ecx |
1166 | div ecx |
1167 | neg eax |
1167 | neg eax |
1168 | inc eax |
1168 | inc eax |
1169 | jmp .set_y |
1169 | jmp .set_y |
1170 | @@: |
1170 | @@: |
1171 | div ecx |
1171 | div ecx |
1172 | .set_y: |
1172 | .set_y: |
1173 | mov [Cor_y],eax |
1173 | mov [Cor_y],eax |
1174 | jmp .end_m_n |
1174 | jmp .end_m_n |
1175 | .end_m_1: |
1175 | .end_m_1: |
1176 | mov eax,[buf_0.w] |
1176 | mov eax,[buf_0.w] |
1177 | sub eax,[shem_w] |
1177 | sub eax,[shem_w] |
1178 | shr eax,1 |
1178 | shr eax,1 |
1179 | bt eax,30 |
1179 | bt eax,30 |
1180 | jnc @f |
1180 | jnc @f |
1181 | bts eax,31 |
1181 | bts eax,31 |
1182 | @@: |
1182 | @@: |
1183 | mov [Cor_x],eax |
1183 | mov [Cor_x],eax |
1184 | mov eax,[buf_0.h] |
1184 | mov eax,[buf_0.h] |
1185 | sub eax,[shem_h] |
1185 | sub eax,[shem_h] |
1186 | shr eax,1 |
1186 | shr eax,1 |
1187 | bt eax,30 |
1187 | bt eax,30 |
1188 | jnc @f |
1188 | jnc @f |
1189 | bts eax,31 |
1189 | bts eax,31 |
1190 | @@: |
1190 | @@: |
1191 | mov [Cor_y],eax |
1191 | mov [Cor_y],eax |
1192 | .end_m_n: |
1192 | .end_m_n: |
1193 | call redraw_pole |
1193 | call redraw_pole |
1194 | ret |
1194 | ret |
1195 | endp |
1195 | endp |
1196 | 1196 | ||
1197 | align 4 |
1197 | align 4 |
1198 | but_pole_up: |
1198 | but_pole_up: |
1199 | push eax ecx edx |
1199 | push eax ecx edx |
1200 | mov eax,dword[buf_0.h] |
1200 | mov eax,dword[buf_0.h] |
1201 | shr eax,2 |
1201 | shr eax,2 |
1202 | movzx ecx,byte[zoom] |
1202 | movzx ecx,byte[zoom] |
1203 | cmp cx,2 |
1203 | cmp cx,2 |
1204 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1204 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1205 | xor edx,edx |
1205 | xor edx,edx |
1206 | div ecx |
1206 | div ecx |
1207 | @@: |
1207 | @@: |
1208 | add dword[Cor_y],eax |
1208 | add dword[Cor_y],eax |
1209 | pop edx ecx eax |
1209 | pop edx ecx eax |
1210 | call redraw_pole |
1210 | call redraw_pole |
1211 | ret |
1211 | ret |
1212 | 1212 | ||
1213 | align 4 |
1213 | align 4 |
1214 | but_pole_dn: |
1214 | but_pole_dn: |
1215 | push eax ecx edx |
1215 | push eax ecx edx |
1216 | mov eax,dword[buf_0.h] |
1216 | mov eax,dword[buf_0.h] |
1217 | shr eax,2 |
1217 | shr eax,2 |
1218 | xor ecx,ecx |
1218 | xor ecx,ecx |
1219 | mov cl,byte[zoom] |
1219 | mov cl,byte[zoom] |
1220 | cmp cx,2 |
1220 | cmp cx,2 |
1221 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1221 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1222 | xor edx,edx |
1222 | xor edx,edx |
1223 | div ecx |
1223 | div ecx |
1224 | @@: |
1224 | @@: |
1225 | sub dword[Cor_y],eax |
1225 | sub dword[Cor_y],eax |
1226 | pop edx ecx eax |
1226 | pop edx ecx eax |
1227 | call redraw_pole |
1227 | call redraw_pole |
1228 | ret |
1228 | ret |
1229 | 1229 | ||
1230 | align 4 |
1230 | align 4 |
1231 | but_pole_left: |
1231 | but_pole_left: |
1232 | push eax ecx edx |
1232 | push eax ecx edx |
1233 | mov eax,dword[buf_0.w] |
1233 | mov eax,dword[buf_0.w] |
1234 | shr eax,2 |
1234 | shr eax,2 |
1235 | xor ecx,ecx |
1235 | xor ecx,ecx |
1236 | mov cl,byte[zoom] |
1236 | mov cl,byte[zoom] |
1237 | cmp cx,2 |
1237 | cmp cx,2 |
1238 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1238 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1239 | xor edx,edx |
1239 | xor edx,edx |
1240 | div ecx |
1240 | div ecx |
1241 | @@: |
1241 | @@: |
1242 | add dword[Cor_x],eax |
1242 | add dword[Cor_x],eax |
1243 | pop edx ecx eax |
1243 | pop edx ecx eax |
1244 | call redraw_pole |
1244 | call redraw_pole |
1245 | ret |
1245 | ret |
1246 | 1246 | ||
1247 | align 4 |
1247 | align 4 |
1248 | but_pole_right: |
1248 | but_pole_right: |
1249 | push eax ecx edx |
1249 | push eax ecx edx |
1250 | mov eax,dword[buf_0.w] |
1250 | mov eax,dword[buf_0.w] |
1251 | shr eax,2 |
1251 | shr eax,2 |
1252 | xor ecx,ecx |
1252 | xor ecx,ecx |
1253 | mov cl,byte[zoom] |
1253 | mov cl,byte[zoom] |
1254 | cmp cx,2 |
1254 | cmp cx,2 |
1255 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1255 | jl @f ;¤¥«¥¨¥ ¢¥«¨ç¨ã zoom |
1256 | xor edx,edx |
1256 | xor edx,edx |
1257 | div ecx |
1257 | div ecx |
1258 | @@: |
1258 | @@: |
1259 | sub dword[Cor_x],eax |
1259 | sub dword[Cor_x],eax |
1260 | pop edx ecx eax |
1260 | pop edx ecx eax |
1261 | call redraw_pole |
1261 | call redraw_pole |
1262 | ret |
1262 | ret |
1263 | 1263 | ||
1264 | ;output: |
1264 | ;output: |
1265 | ; edx - count created points |
1265 | ; edx - count created points |
1266 | align 4 |
1266 | align 4 |
1267 | proc shem_create_line uses eax ebx ecx edi, x:dword, y:dword, opt:dword |
1267 | proc shem_create_line uses eax ebx ecx edi, x:dword, y:dword, opt:dword |
1268 | mov edi,pole |
1268 | mov edi,pole |
1269 | xor edx,edx |
1269 | xor edx,edx |
1270 | 1270 | ||
1271 | mov ebx,[x] |
1271 | mov ebx,[x] |
1272 | mov ecx,[y] |
1272 | mov ecx,[y] |
1273 | bt dword[opt],0 |
1273 | bt dword[opt],0 |
1274 | jnc @f |
1274 | jnc @f |
1275 | .line_lr: |
1275 | .line_lr: |
1276 | inc ebx |
1276 | inc ebx |
1277 | cmp ebx,[shem_w] |
1277 | cmp ebx,[shem_w] |
1278 | jge @f |
1278 | jge @f |
1279 | stdcall pole_cell_find, pole,ebx,ecx |
1279 | stdcall pole_cell_find, pole,ebx,ecx |
1280 | cmp eax,0 |
1280 | cmp eax,0 |
1281 | je .u0 |
1281 | je .u0 |
1282 | imul eax,sizeof.Cell |
1282 | imul eax,sizeof.Cell |
1283 | add eax,pole_data |
1283 | add eax,pole_data |
1284 | cmp byte[eax+offs_cell_liv],1 |
1284 | cmp byte[eax+offs_cell_liv],1 |
1285 | jne @f |
1285 | jne @f |
1286 | .u0: |
1286 | .u0: |
1287 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1287 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1288 | inc edx |
1288 | inc edx |
1289 | jmp .line_lr |
1289 | jmp .line_lr |
1290 | @@: |
1290 | @@: |
1291 | 1291 | ||
1292 | mov ebx,[x] |
1292 | mov ebx,[x] |
1293 | ;mov ecx,[y] |
1293 | ;mov ecx,[y] |
1294 | bt dword[opt],2 |
1294 | bt dword[opt],2 |
1295 | jnc @f |
1295 | jnc @f |
1296 | .line_rl: |
1296 | .line_rl: |
1297 | dec ebx |
1297 | dec ebx |
1298 | cmp ebx,0 |
1298 | cmp ebx,0 |
1299 | jl @f |
1299 | jl @f |
1300 | stdcall pole_cell_find, pole,ebx,ecx |
1300 | stdcall pole_cell_find, pole,ebx,ecx |
1301 | cmp eax,0 |
1301 | cmp eax,0 |
1302 | je .u1 |
1302 | je .u1 |
1303 | imul eax,sizeof.Cell |
1303 | imul eax,sizeof.Cell |
1304 | add eax,pole_data |
1304 | add eax,pole_data |
1305 | cmp byte[eax+offs_cell_liv],1 |
1305 | cmp byte[eax+offs_cell_liv],1 |
1306 | jne @f |
1306 | jne @f |
1307 | .u1: |
1307 | .u1: |
1308 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1308 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1309 | inc edx |
1309 | inc edx |
1310 | jmp .line_rl |
1310 | jmp .line_rl |
1311 | @@: |
1311 | @@: |
1312 | 1312 | ||
1313 | mov ebx,[x] |
1313 | mov ebx,[x] |
1314 | mov ecx,[y] |
1314 | mov ecx,[y] |
1315 | bt dword[opt],3 |
1315 | bt dword[opt],3 |
1316 | jnc @f |
1316 | jnc @f |
1317 | .line_du: |
1317 | .line_du: |
1318 | dec ecx |
1318 | dec ecx |
1319 | cmp ecx,0 |
1319 | cmp ecx,0 |
1320 | jl @f |
1320 | jl @f |
1321 | stdcall pole_cell_find, pole,ebx,ecx |
1321 | stdcall pole_cell_find, pole,ebx,ecx |
1322 | cmp eax,0 |
1322 | cmp eax,0 |
1323 | je .u2 |
1323 | je .u2 |
1324 | imul eax,sizeof.Cell |
1324 | imul eax,sizeof.Cell |
1325 | add eax,pole_data |
1325 | add eax,pole_data |
1326 | cmp byte[eax+offs_cell_liv],1 |
1326 | cmp byte[eax+offs_cell_liv],1 |
1327 | jne @f |
1327 | jne @f |
1328 | .u2: |
1328 | .u2: |
1329 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1329 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1330 | inc edx |
1330 | inc edx |
1331 | jmp .line_du |
1331 | jmp .line_du |
1332 | @@: |
1332 | @@: |
1333 | 1333 | ||
1334 | ;mov ebx,[x] |
1334 | ;mov ebx,[x] |
1335 | mov ecx,[y] |
1335 | mov ecx,[y] |
1336 | bt dword[opt],1 |
1336 | bt dword[opt],1 |
1337 | jnc @f |
1337 | jnc @f |
1338 | .line_ud: |
1338 | .line_ud: |
1339 | inc ecx |
1339 | inc ecx |
1340 | cmp ecx,[shem_h] |
1340 | cmp ecx,[shem_h] |
1341 | jge @f |
1341 | jge @f |
1342 | stdcall pole_cell_find, pole,ebx,ecx |
1342 | stdcall pole_cell_find, pole,ebx,ecx |
1343 | cmp eax,0 |
1343 | cmp eax,0 |
1344 | je .u3 |
1344 | je .u3 |
1345 | imul eax,sizeof.Cell |
1345 | imul eax,sizeof.Cell |
1346 | add eax,pole_data |
1346 | add eax,pole_data |
1347 | cmp byte[eax+offs_cell_liv],1 |
1347 | cmp byte[eax+offs_cell_liv],1 |
1348 | jne @f |
1348 | jne @f |
1349 | .u3: |
1349 | .u3: |
1350 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1350 | stdcall pole_cell_creat, pole,ebx,ecx,1 |
1351 | inc edx |
1351 | inc edx |
1352 | jmp .line_ud |
1352 | jmp .line_ud |
1353 | @@: |
1353 | @@: |
1354 | 1354 | ||
1355 | ret |
1355 | ret |
1356 | endp |
1356 | endp |
1357 | 1357 | ||
1358 | align 4 |
1358 | align 4 |
1359 | redraw_pole: |
1359 | redraw_pole: |
1360 | stdcall [buf2d_clear], buf_0, [buf_0.color] |
1360 | stdcall [buf2d_clear], buf_0, [buf_0.color] |
1361 | stdcall pole_paint, pole |
1361 | stdcall pole_paint, pole |
1362 | stdcall [buf2d_draw], buf_0 |
1362 | stdcall [buf2d_draw], buf_0 |
1363 | ret1; |
1363 | ret1; |
1364 | 1364 | ||
1365 | ><1; |
1365 | ><1; |
1366 | 1366 | ||
1367 | >=k)>1; |
1367 | >=k)>1; |
1368 | ><1; |
1368 | ><1; |
1369 | >=fristC;i++){ |
1369 | >=fristC;i++){ |
1370 | >=fristC;i++){ |
1370 | >=fristC;i++){ |
1371 | >0) |
1371 | >0) |
1372 | > |
1372 | > |
1373 | >=1; |
1373 | >=1; |
1374 | ><=1; |
1374 | ><=1; |
1375 | >=fristC;i++) |
1375 | >=fristC;i++) |
1376 | > |
1376 | > |