Rev 3930 | Rev 6270 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
205 | heavyiron | 1 | ; |
3905 | leency | 2 | ; pipes kolibri |
3 | ; v1.21 |
||
205 | heavyiron | 4 | ; 2006 by Mario Birkner |
5 | ; |
||
6 | ; l.mod. 27.08.06/15:11 |
||
7 | ; |
||
8 | ; Compile with FASM |
||
9 | ; |
||
4697 | hidnplayr | 10 | format binary as "" |
11 | |||
205 | heavyiron | 12 | bgcolor equ 0x0074744A ;thx |
13 | fgcolor equ 0x00E7C750 ;to |
||
14 | fg2color equ 0x00E0B0A0 ;colorref |
||
15 | fg3color equ 0x007F7F55 |
||
16 | btcolor equ 0x005B6200 |
||
17 | |||
485 | heavyiron | 18 | include '..\..\macros.inc' |
3930 | kaitz | 19 | include 'lang.inc' |
20 | ; fetch the UTF-8 character in string+offs to char |
||
21 | ; common part for all encodings: translate pseudographics |
||
22 | ; Pseudographics for the boot screen: |
||
23 | ; 0x2500 -> 0xC4, 0x2502 -> 0xB3, 0x250C -> 0xDA, 0x2510 -> 0xBF, |
||
24 | ; 0x2514 -> 0xC0, 0x2518 -> 0xD9, 0x252C -> 0xC2, 0x2534 -> 0xC1, 0x2551 -> 0xBA |
||
25 | macro fetch_utf8_char string, offs, char, graph |
||
26 | { local first_byte, b |
||
27 | virtual at 0 |
||
28 | db string |
||
29 | if offs >= $ |
||
30 | char = -1 |
||
31 | else |
||
32 | ; fetch first byte |
||
33 | load first_byte byte from offs |
||
34 | if first_byte < 0x80 |
||
35 | char = first_byte |
||
36 | offs = offs + 1 |
||
37 | else if first_byte < 0xC0 |
||
38 | .err Invalid UTF-8 string |
||
39 | else if first_byte < 0xE0 |
||
40 | char = first_byte and 0x1F |
||
41 | load b byte from offs + 1 |
||
42 | char = (char shl 6) + (b and 0x3F) |
||
43 | offs = offs + 2 |
||
44 | else if first_byte < 0xF0 |
||
45 | char = first_byte and 0xF |
||
46 | load b byte from offs + 1 |
||
47 | char = (char shl 6) + (b and 0x3F) |
||
48 | load b byte from offs + 2 |
||
49 | char = (char shl 6) + (b and 0x3F) |
||
50 | offs = offs + 3 |
||
51 | else if first_byte < 0xF8 |
||
52 | char = first_byte and 0x7 |
||
53 | load b byte from offs + 1 |
||
54 | char = (char shl 6) + (b and 0x3F) |
||
55 | load b byte from offs + 2 |
||
56 | char = (char shl 6) + (b and 0x3F) |
||
57 | load b byte from offs + 3 |
||
58 | char = (char shl 6) + (b and 0x3F) |
||
59 | offs = offs + 4 |
||
60 | else |
||
61 | .err Invalid UTF-8 string |
||
62 | end if |
||
63 | end if |
||
64 | end virtual |
||
65 | if char = 0x2500 |
||
66 | graph = 0xC4 |
||
67 | else if char = 0x2502 |
||
68 | graph = 0xB3 |
||
69 | else if char = 0x250C |
||
70 | graph = 0xDA |
||
71 | else if char = 0x2510 |
||
72 | graph = 0xBF |
||
73 | else if char = 0x2514 |
||
74 | graph = 0xC0 |
||
75 | else if char = 0x2518 |
||
76 | graph = 0xD9 |
||
77 | else if char = 0x252C |
||
78 | graph = 0xC2 |
||
79 | else if char = 0x2534 |
||
80 | graph = 0xC1 |
||
81 | else if char = 0x2551 |
||
82 | graph = 0xBA |
||
83 | else |
||
84 | graph = 0 |
||
85 | end if |
||
86 | } |
||
87 | ; Latin-1 encoding |
||
88 | ; 0x00-0xFF - trivial map |
||
89 | macro latin1 [arg] |
||
90 | { local offs, char, graph |
||
91 | offs = 0 |
||
92 | while 1 |
||
93 | fetch_utf8_char arg, offs, char, graph |
||
94 | if char = -1 |
||
95 | break |
||
96 | end if |
||
97 | if graph |
||
98 | db graph |
||
99 | else if char < 0x100 |
||
100 | db char |
||
101 | else |
||
102 | .err Failed to convert to Latin-1 |
||
103 | end if |
||
104 | end while |
||
105 | } |
||
205 | heavyiron | 106 | use32 |
107 | |||
4697 | hidnplayr | 108 | org 0x0 |
205 | heavyiron | 109 | |
4697 | hidnplayr | 110 | db 'MENUET01' ; 8 byte id |
111 | dd 0x01 ; header version |
||
112 | dd START ; start of code |
||
113 | dd I_END ; size of image |
||
114 | dd 0x100000 ; memory for app |
||
115 | dd 0x7fff0 ; esp |
||
116 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
205 | heavyiron | 117 | |
4697 | hidnplayr | 118 | START: ; start of execution |
3905 | leency | 119 | jmp red |
205 | heavyiron | 120 | |
121 | still: |
||
3905 | leency | 122 | mcall 10 ; wait here for event |
4697 | hidnplayr | 123 | cmp eax,1 ; redraw request ? |
205 | heavyiron | 124 | je red |
4697 | hidnplayr | 125 | cmp eax,2 ; key in buffer ? |
205 | heavyiron | 126 | je key |
4697 | hidnplayr | 127 | cmp eax,3 ; button in buffer ? |
205 | heavyiron | 128 | je button |
129 | jmp still |
||
130 | |||
4697 | hidnplayr | 131 | red: ; redraw |
205 | heavyiron | 132 | call draw_window |
133 | call draw_board |
||
134 | call draw_message |
||
135 | jmp still |
||
136 | |||
4697 | hidnplayr | 137 | key: ; key |
138 | mcall 2 ; just read it and ignore |
||
205 | heavyiron | 139 | jmp still |
4697 | hidnplayr | 140 | button: ; button |
205 | heavyiron | 141 | call get_input |
142 | jmp still |
||
143 | |||
144 | |||
145 | |||
146 | get_input: |
||
147 | pusha |
||
4697 | hidnplayr | 148 | mcall 17 ; get id |
205 | heavyiron | 149 | |
4697 | hidnplayr | 150 | cmp ah,1 ; button id=1 ? |
205 | heavyiron | 151 | jne .noclose |
4697 | hidnplayr | 152 | mcall -1 ; close this program |
205 | heavyiron | 153 | .noclose: |
154 | cmp ah,4 |
||
155 | jne .moderate |
||
156 | mov [diffic],1 |
||
157 | jmp .enddiffic |
||
158 | .moderate: |
||
159 | cmp ah,3 |
||
160 | jne .easy |
||
161 | mov [diffic],3 |
||
162 | jmp .enddiffic |
||
163 | .easy: |
||
164 | cmp ah,2 |
||
165 | jne .board |
||
166 | mov [diffic],5 |
||
167 | .enddiffic: |
||
168 | mov [score],0 |
||
169 | mov [speed],40 |
||
170 | mov [level],1 |
||
171 | mov [stat],0 |
||
172 | mov [time],0 |
||
173 | call draw_window |
||
174 | call scramble_board |
||
175 | call draw_board |
||
176 | call countdown |
||
177 | call wassermarsch |
||
178 | jmp .getno |
||
179 | .board: |
||
180 | cmp [stat],2 |
||
181 | jge .getno |
||
4697 | hidnplayr | 182 | shr eax,8 ; -> 24bit id |
205 | heavyiron | 183 | cmp eax,10 |
184 | jle .getno |
||
185 | cmp eax,150 |
||
4697 | hidnplayr | 186 | jg .getno |
205 | heavyiron | 187 | sub eax,10 |
188 | mov edi,eax |
||
189 | add edi,map |
||
190 | cmp [edi], byte 1 |
||
4697 | hidnplayr | 191 | jg .nogerade |
205 | heavyiron | 192 | xor byte [edi], 1 |
193 | call draw_board |
||
194 | jmp .getno |
||
195 | .nogerade: |
||
196 | cmp [edi], byte 6 |
||
197 | jge .getno |
||
198 | cmp [edi], byte 5 |
||
199 | jne .rota |
||
200 | sub byte [edi],4 |
||
201 | .rota: |
||
202 | inc byte [edi] |
||
203 | call draw_board |
||
204 | .getno: |
||
205 | popa |
||
206 | ret |
||
207 | ;//// end of event detection |
||
4697 | hidnplayr | 208 | get_direction: ;Setzt Richtungs-Konstanten |
209 | pusha ;IN: |
||
210 | mov eax,[esp+28] ;eax - Richtung IN |
||
211 | mov ebx,[esp+16] ;ebx - Teilchen (Map-Wert) |
||
212 | cmp ebx,0 ;OUT: |
||
213 | jne .no0 ;eax - Richtung OUT |
||
205 | heavyiron | 214 | cmp eax,14 |
215 | jne .o0 |
||
216 | jmp .setout |
||
217 | .o0: |
||
218 | cmp eax,-14 |
||
219 | jne .col |
||
220 | jmp .setout |
||
221 | .no0: |
||
222 | cmp ebx,1 |
||
223 | jne .no1 |
||
224 | cmp eax,1 |
||
225 | jne .o1 |
||
226 | jmp .setout |
||
227 | .o1: |
||
228 | cmp eax,-1 |
||
229 | jne .col |
||
230 | jmp .setout |
||
231 | .no1: |
||
232 | cmp ebx,2 |
||
233 | jne .no2 |
||
234 | cmp eax,14 |
||
235 | jne .o2 |
||
236 | sub eax,13 |
||
237 | jmp .setout |
||
238 | .o2: |
||
239 | cmp eax,-1 |
||
240 | jne .col |
||
241 | sub eax,13 |
||
242 | jmp .setout |
||
243 | .no2: |
||
244 | cmp ebx,3 |
||
245 | jne .no3 |
||
246 | cmp eax,-14 |
||
247 | jne .o3 |
||
248 | add eax,15 |
||
249 | jmp .setout |
||
250 | .o3: |
||
251 | cmp eax,-1 |
||
252 | jne .col |
||
253 | add eax,15 |
||
254 | jmp .setout |
||
255 | .no3: |
||
256 | cmp ebx,4 |
||
257 | jne .no4 |
||
258 | cmp eax,-14 |
||
259 | jne .o4 |
||
260 | add eax,13 |
||
261 | jmp .setout |
||
262 | .o4: |
||
263 | cmp eax,1 |
||
264 | jne .col |
||
265 | add eax,13 |
||
266 | jmp .setout |
||
267 | .no4: |
||
268 | cmp ebx,5 |
||
269 | jne .no5 |
||
270 | cmp eax,14 |
||
271 | jne .o5 |
||
272 | sub eax,15 |
||
273 | jmp .setout |
||
274 | .o5: |
||
275 | cmp eax,1 |
||
276 | jne .col |
||
277 | sub eax,15 |
||
278 | jmp .setout |
||
279 | .no5: |
||
280 | cmp ebx,6 |
||
281 | jne .no6 |
||
282 | jmp .setout |
||
283 | .no6: |
||
284 | cmp ebx,7 |
||
285 | jne .no7 |
||
286 | mov eax,14 |
||
287 | jmp .setout |
||
288 | .no7: |
||
289 | cmp ebx,8 |
||
290 | jne .no8 |
||
291 | cmp eax,14 |
||
292 | jne .col |
||
293 | mov [stat],1 |
||
294 | jmp .setout |
||
295 | .no8: |
||
4697 | hidnplayr | 296 | cmp ebx,16 ; cross 2x |
205 | heavyiron | 297 | jne .col |
298 | add [score],10 ; + 10 bonus points |
||
299 | jmp .setout |
||
300 | .col: |
||
301 | xor eax,eax |
||
302 | .setout: |
||
303 | xor ebx,ebx |
||
304 | mov [esp+28],eax |
||
305 | mov [esp+16],ebx |
||
306 | popa |
||
307 | ret |
||
308 | |||
309 | countdown: |
||
310 | pusha |
||
311 | xor eax,eax |
||
312 | mov al,[diffic] |
||
313 | imul eax,10 |
||
314 | mov [time],eax |
||
315 | .udown: |
||
316 | call show_score |
||
317 | mov ecx,10 |
||
318 | .down: |
||
319 | mov eax,5 |
||
320 | mov ebx,10 |
||
485 | heavyiron | 321 | mcall |
205 | heavyiron | 322 | mov eax,11 |
485 | heavyiron | 323 | mcall |
205 | heavyiron | 324 | cmp eax,1 |
325 | jne .nored |
||
326 | call draw_window |
||
327 | call draw_board |
||
328 | jmp .nothing |
||
329 | .nored: |
||
330 | cmp eax,3 |
||
331 | jne .nothing |
||
332 | call get_input |
||
333 | .nothing: |
||
4697 | hidnplayr | 334 | cmp [stat],0 ;bugfix 210806 |
335 | jnz .exitsub ;bugfix 210806 |
||
205 | heavyiron | 336 | dec ecx |
337 | jnz .down |
||
338 | dec [time] |
||
339 | jnz .udown |
||
4697 | hidnplayr | 340 | .exitsub: ;bugfix 210806 |
205 | heavyiron | 341 | popa |
342 | ret |
||
343 | |||
344 | wassermarsch: |
||
345 | pusha |
||
346 | .restart: |
||
4697 | hidnplayr | 347 | mov esi,map+16 ;start position |
348 | mov eax, 14 ;start-richtung |
||
205 | heavyiron | 349 | .findway: |
350 | movzx ebx, byte [esi] |
||
351 | call get_direction |
||
352 | test eax,eax |
||
353 | jz .collision |
||
354 | push eax |
||
355 | xor eax,eax |
||
356 | mov al,6 |
||
357 | sub al,[diffic] |
||
4697 | hidnplayr | 358 | add [score],eax ;points/item = 6 - difficulty |
205 | heavyiron | 359 | mov ecx,dword [speed] |
360 | add byte [esi],10 |
||
361 | .down: |
||
362 | mov eax,5 |
||
363 | mov ebx,2 |
||
485 | heavyiron | 364 | mcall |
205 | heavyiron | 365 | mov eax,11 |
485 | heavyiron | 366 | mcall |
205 | heavyiron | 367 | cmp eax,1 |
368 | jne .nored |
||
369 | call draw_window |
||
370 | .nored: |
||
371 | cmp eax,3 |
||
372 | jne .noevnt |
||
373 | call get_input |
||
374 | .noevnt: |
||
375 | dec ecx |
||
376 | jnz .down |
||
377 | pop eax |
||
378 | |||
379 | add esi,eax |
||
380 | call draw_board |
||
381 | call show_score |
||
382 | jmp .findway |
||
383 | .collision: |
||
384 | cmp [stat],1 |
||
385 | jne .loose |
||
386 | call draw_message |
||
387 | mov eax,5 |
||
388 | mov ebx,500 |
||
485 | heavyiron | 389 | mcall |
205 | heavyiron | 390 | mov [stat],0 |
391 | inc [level] |
||
4697 | hidnplayr | 392 | cmp [speed],6 ;waterflowdelay < 6 ? |
205 | heavyiron | 393 | jle .skipsub |
394 | sub [speed],2 |
||
395 | .skipsub: |
||
396 | call draw_window |
||
397 | call scramble_board |
||
398 | call draw_board |
||
399 | call countdown |
||
400 | jmp .restart |
||
401 | .loose: |
||
402 | mov [stat],2 |
||
403 | call draw_message |
||
404 | popa |
||
405 | ret |
||
406 | |||
407 | show_score: |
||
408 | pusha |
||
4697 | hidnplayr | 409 | mov eax,13 ;clear time and score area |
205 | heavyiron | 410 | mov ebx,50 shl 16 +15 |
411 | mov ecx,395 shl 16 +15 |
||
412 | mov edx,bgcolor |
||
485 | heavyiron | 413 | mcall |
3930 | kaitz | 414 | if lang eq et |
415 | add ebx,60 shl 16 + 30 |
||
416 | else |
||
205 | heavyiron | 417 | add ebx,60 shl 16 + 20 |
3930 | kaitz | 418 | end if |
485 | heavyiron | 419 | mcall |
205 | heavyiron | 420 | add ebx,80 shl 16 |
485 | heavyiron | 421 | mcall |
205 | heavyiron | 422 | mov eax,47 |
423 | mov ebx,0x20000 |
||
424 | mov ecx,[time] |
||
425 | mov edx,50*65536+398 |
||
426 | mov esi,fg2color |
||
485 | heavyiron | 427 | mcall |
205 | heavyiron | 428 | mov ebx,0x50000 |
429 | mov ecx,[score] |
||
3930 | kaitz | 430 | if lang eq et |
431 | add edx,70 shl 16 |
||
432 | else |
||
205 | heavyiron | 433 | add edx,60 shl 16 |
3930 | kaitz | 434 | end if |
485 | heavyiron | 435 | mcall |
205 | heavyiron | 436 | mov ebx,0x20000 |
437 | mov ecx,[level] |
||
438 | add edx,80 shl 16 |
||
485 | heavyiron | 439 | mcall |
205 | heavyiron | 440 | |
441 | popa |
||
442 | ret |
||
443 | |||
444 | |||
445 | |||
446 | scramble_board: |
||
447 | pusha |
||
448 | mov edi,map+16 ;startpunkt |
||
449 | mov eax,7 ;wieder- |
||
4697 | hidnplayr | 450 | stosb ;herstellen |
205 | heavyiron | 451 | |
452 | mov ebx, 0x00000007 ;modul m max-wert |
||
453 | .loop_through: |
||
454 | mov esi,edi |
||
455 | lodsb |
||
456 | cmp eax, 9 |
||
457 | je .skip |
||
458 | inc eax |
||
459 | xor edx, edx |
||
4697 | hidnplayr | 460 | div ebx ;modulo -> edx |
205 | heavyiron | 461 | mov eax, edx |
462 | cmp eax,6 |
||
463 | jne .skip |
||
464 | dec [half] |
||
465 | movzx eax, byte [half] |
||
466 | jnz .skip |
||
467 | mov [half], byte 7 |
||
468 | .skip: |
||
469 | stosb |
||
470 | cmp edi,map+125 ;endpunkt erhalten |
||
471 | jge .exit |
||
472 | jmp .loop_through |
||
473 | .exit: |
||
474 | mov eax,8 |
||
475 | stosb |
||
476 | popa |
||
477 | ret |
||
478 | |||
479 | |||
480 | gen_image: |
||
481 | pusha |
||
4697 | hidnplayr | 482 | xor ebx,ebx ;default: kein wasser |
205 | heavyiron | 483 | movzx eax,byte [map] ;erstes byte der map lesen (position) |
4697 | hidnplayr | 484 | inc byte [map] ;position inkrementieren |
485 | add eax,map ;zur position die map-adresse addieren |
||
205 | heavyiron | 486 | movzx esi,byte [eax] |
487 | cmp esi,10 |
||
4697 | hidnplayr | 488 | jl .nowater |
489 | sub esi,10 ;map-werte+10 sind mit wasser gefuellt |
||
205 | heavyiron | 490 | mov ebx,1 |
491 | cmp esi,16 |
||
492 | jne .nowater |
||
493 | sub esi,10 |
||
494 | .nowater: |
||
4697 | hidnplayr | 495 | imul esi,3072 ;mapwert * 32*32*3 = image-adresse |
205 | heavyiron | 496 | add esi,images |
497 | mov edi,0x10000 |
||
498 | mov ecx,32*32*3 |
||
4697 | hidnplayr | 499 | .gendd: ;RGB-Image im Speicher generieren |
205 | heavyiron | 500 | mov eax,dword [esi] ;byte aus imagemap lesen |
501 | shl eax,8 |
||
502 | shr eax,8 |
||
503 | cmp ebx,0 |
||
4697 | hidnplayr | 504 | jz .nowcolor |
205 | heavyiron | 505 | mov ebx,eax |
506 | cmp ebx,0x00B0B5B0 |
||
507 | jne .nog1 |
||
508 | jmp .wcolor |
||
509 | .nog1: |
||
510 | cmp ebx,0x00A0A5A0 |
||
511 | jne .nog2 |
||
512 | jmp .wcolor |
||
513 | .nog2: |
||
514 | cmp ebx,0x00909590 |
||
515 | jne .nog3 |
||
516 | jmp .wcolor |
||
517 | .nog3: |
||
518 | cmp ebx,0x00808580 |
||
519 | jne .nog4 |
||
520 | jmp .wcolor |
||
521 | .nog4: |
||
522 | cmp ebx,0x00707570 |
||
523 | jne .nowcolor |
||
524 | jmp .wcolor |
||
525 | .wcolor: |
||
526 | add eax,0x40 |
||
527 | .nowcolor: |
||
528 | add esi,3 |
||
529 | stosd |
||
530 | dec edi |
||
531 | loop .gendd |
||
532 | popa |
||
533 | ret |
||
534 | |||
535 | |||
536 | |||
537 | ; ********************************************* |
||
538 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
539 | ; ********************************************* |
||
540 | draw_message: |
||
541 | pusha |
||
542 | cmp [stat],0 |
||
4697 | hidnplayr | 543 | je .nomessage |
205 | heavyiron | 544 | mov eax,13 |
545 | mov ebx,146 shl 16 + 200 |
||
546 | mov ecx,190 shl 16 + 40 |
||
547 | mov edx,0x0 |
||
485 | heavyiron | 548 | mcall |
205 | heavyiron | 549 | add ebx,2 shl 16 - 4 |
550 | add ecx,2 shl 16 - 4 |
||
551 | mov edx,fgcolor |
||
485 | heavyiron | 552 | mcall |
205 | heavyiron | 553 | |
4697 | hidnplayr | 554 | cmp [stat],3 |
555 | jne .stat1 |
||
3905 | leency | 556 | mov eax,4 |
557 | mov ebx,174 shl 16 +206 |
||
558 | mov edx,lbl_start_a_new_game+1 |
||
559 | movzx esi,byte [lbl_start_a_new_game] |
||
560 | mov ecx,btcolor |
||
561 | add ecx,0x10000000 |
||
562 | mcall |
||
4697 | hidnplayr | 563 | jmp .nomessage |
3905 | leency | 564 | |
4697 | hidnplayr | 565 | .stat1: |
205 | heavyiron | 566 | cmp [stat],1 |
567 | je .winmessage |
||
568 | mov eax,4 |
||
569 | mov ebx,186 shl 16 +200 |
||
570 | mov edx,lbl_gameover+1 |
||
571 | movzx esi,byte [lbl_gameover] |
||
572 | mov ecx,btcolor |
||
573 | add ecx,0x10000000 |
||
485 | heavyiron | 574 | mcall |
205 | heavyiron | 575 | add ebx,8 shl 16 +17 |
576 | mov edx,lbl_yscore+1 |
||
577 | movzx esi,byte [lbl_yscore] |
||
578 | mov ecx,btcolor |
||
485 | heavyiron | 579 | mcall |
4697 | hidnplayr | 580 | mov esi,ecx ;color |
581 | mov edx,ebx ;pos |
||
205 | heavyiron | 582 | add edx,80 shl 16 |
4697 | hidnplayr | 583 | mov ebx,0x50000 ;type |
584 | mov ecx,[score] ;inp |
||
205 | heavyiron | 585 | mov eax,47 |
485 | heavyiron | 586 | mcall |
205 | heavyiron | 587 | jmp .nomessage |
588 | .winmessage: |
||
589 | mov eax,4 |
||
590 | mov ebx,152 shl 16 +200 |
||
591 | mov edx,lbl_win+1 |
||
592 | movzx esi,byte [lbl_win] |
||
593 | mov ecx,btcolor |
||
594 | add ecx,0x10000000 |
||
485 | heavyiron | 595 | mcall |
205 | heavyiron | 596 | mov ebx,152 shl 16 +217 |
597 | add edx,esi |
||
598 | mov ecx,btcolor |
||
485 | heavyiron | 599 | mcall |
205 | heavyiron | 600 | .nomessage: |
601 | popa |
||
602 | ret |
||
603 | |||
604 | draw_board: |
||
605 | pusha |
||
606 | mov ebx,15*65536+32 |
||
607 | mov ecx,50*65536+32 |
||
4697 | hidnplayr | 608 | mov edx,15*65536+50 ;Spielfeldposition |
609 | mov esi,10 ;Spielfeldgroesse Y |
||
205 | heavyiron | 610 | .vloop: |
4697 | hidnplayr | 611 | mov edi,14 ;Spielfeldgroesse X |
205 | heavyiron | 612 | .hloop: |
613 | call gen_image |
||
614 | push edx |
||
615 | mov eax,8 |
||
616 | movsx edx, byte [map] |
||
4697 | hidnplayr | 617 | add edx,9 ;button-id = map-pos + 10;gen_image inkrements |
2526 | leency | 618 | add edx,0x80000000 ;first delete previous button |
4697 | hidnplayr | 619 | mcall |
3905 | leency | 620 | sub edx,0x30000000 ;first delete previous button |
485 | heavyiron | 621 | mcall |
205 | heavyiron | 622 | pop edx |
623 | push ebx |
||
624 | push ecx |
||
625 | mov eax,7 |
||
626 | mov ebx,0x10000 |
||
627 | mov ecx,32 shl 16 +32 |
||
485 | heavyiron | 628 | mcall |
205 | heavyiron | 629 | pop ecx |
630 | pop ebx |
||
631 | add edx,33 shl 16 |
||
632 | add ebx,33 shl 16 |
||
633 | dec edi |
||
634 | jnz .hloop |
||
4697 | hidnplayr | 635 | sub edx,14*(33 shl 16) ;Spielfeldgroesse X |
205 | heavyiron | 636 | sub ebx,14*(33 shl 16) |
637 | add edx,33 |
||
638 | add ecx,33 shl 16 |
||
639 | dec esi |
||
640 | jnz .vloop |
||
4697 | hidnplayr | 641 | mov [map], byte 1 ;Map-Position zuruecksetzen |
205 | heavyiron | 642 | popa |
643 | ret |
||
644 | |||
645 | |||
646 | draw_window: |
||
647 | pusha |
||
648 | |||
3905 | leency | 649 | mcall 12,1 |
4697 | hidnplayr | 650 | |
651 | mov eax,0 ; function 0 : define and draw window |
||
652 | mov ebx,100*65536+492 ; [x start] *65536 + [x size] |
||
653 | mov ecx,100*65536+420 ; [y start] *65536 + [y size] |
||
654 | mov edx,bgcolor ; color of work area RRGGBB,8->color gl |
||
551 | spraid | 655 | or edx,0x14000000 |
485 | heavyiron | 656 | mov edi,title |
657 | mcall |
||
205 | heavyiron | 658 | |
659 | mov eax,8 |
||
660 | mov ebx,84*65536+72 |
||
661 | mov ecx,28*65536+15 |
||
662 | mov edx,2 |
||
663 | mov esi,btcolor |
||
485 | heavyiron | 664 | mcall |
205 | heavyiron | 665 | add ebx,76 shl 16 |
666 | inc edx |
||
485 | heavyiron | 667 | mcall |
205 | heavyiron | 668 | add ebx,76 shl 16 |
669 | inc edx |
||
485 | heavyiron | 670 | mcall |
205 | heavyiron | 671 | |
672 | mov eax,4 |
||
673 | mov ebx,26 shl 16 +32 |
||
674 | mov ecx,fgcolor |
||
675 | mov edx,lbl_toolbar+1 |
||
676 | movsx esi, byte [lbl_toolbar] |
||
485 | heavyiron | 677 | mcall |
205 | heavyiron | 678 | mov ebx,18 shl 16 +398 |
679 | mov edx,lbl_score+1 |
||
680 | movsx esi, byte [lbl_score] |
||
485 | heavyiron | 681 | mcall |
3905 | leency | 682 | mov ebx,340 shl 16 +405 |
205 | heavyiron | 683 | mov ecx,fg3color |
684 | mov edx,lbl_copy+1 |
||
685 | movsx esi,byte [lbl_copy] |
||
485 | heavyiron | 686 | mcall |
205 | heavyiron | 687 | |
3905 | leency | 688 | mcall 12,2 |
205 | heavyiron | 689 | |
690 | popa |
||
691 | ret |
||
692 | |||
693 | |||
694 | ; DATA AREA |
||
3930 | kaitz | 695 | if lang eq et |
696 | title db 'Torud',0 |
||
697 | lbl_gameover: |
||
698 | db 19 |
||
699 | latin1 'M ä n g L ä b i !' |
||
700 | lbl_start_a_new_game: |
||
701 | db 21 |
||
702 | latin1 'Alusta enne uut mängu' |
||
703 | lbl_win: |
||
704 | db 32 |
||
705 | latin1 ' T u b l i ! ' |
||
706 | latin1 ' Lähme edasi! ' |
||
707 | lbl_yscore: |
||
708 | db 12 |
||
709 | latin1 'Sinu tulemus:' |
||
710 | lbl_toolbar: |
||
711 | db 43 |
||
712 | latin1 'Uus mäng: Lihtne Keskmine Raske' |
||
713 | lbl_copy: |
||
714 | db 24 |
||
715 | latin1 'v1.21 2006,Mario Birkner' |
||
716 | lbl_score: |
||
717 | db 28 |
||
718 | latin1 'Aeg: Tulemus: Tase:' |
||
719 | else |
||
3905 | leency | 720 | title db 'Pipes',0 |
205 | heavyiron | 721 | lbl_gameover: |
722 | db 19 |
||
723 | db 'G a m e O v e r !' |
||
3905 | leency | 724 | lbl_start_a_new_game: |
725 | db 22 |
||
726 | db 'Start a new game first' |
||
205 | heavyiron | 727 | lbl_win: |
728 | db 32 |
||
729 | db ' G r e a t ! ' |
||
4697 | hidnplayr | 730 | db " Let's keep going! " |
205 | heavyiron | 731 | lbl_yscore: |
732 | db 11 |
||
733 | db 'Your Score:' |
||
734 | lbl_toolbar: |
||
735 | db 43 |
||
736 | db 'New Game: Easy Moderate Hard' |
||
737 | lbl_copy: |
||
3905 | leency | 738 | db 24 |
739 | db 'v1.21 2006,Mario Birkner' |
||
205 | heavyiron | 740 | lbl_score: |
741 | db 28 |
||
742 | db 'Time: Score: Level:' |
||
3930 | kaitz | 743 | end if |
4697 | hidnplayr | 744 | stat db 3 ;0=gameplay 1=won 2-lost 3=stopped |
745 | speed db 0 |
||
746 | time dd 0 |
||
747 | diffic db 0 ;1=hard 3=moderate 5=easy 8=dedicated to Wildwest - try it out! |
||
748 | score dd 0 |
||
749 | level dd 1 |
||
750 | half db 1 ;reduces the random-crosses |
||
205 | heavyiron | 751 | |
4697 | hidnplayr | 752 | map: ;14*10 blocks + position |
205 | heavyiron | 753 | db 1 ;<- act. position |
754 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
||
755 | db 9,7,1,3,2,0,1,1,0,3,4,4,3,9 |
||
756 | db 9,5,0,2,2,1,3,0,3,1,1,6,4,9 |
||
757 | db 9,4,0,4,6,0,3,3,2,6,0,1,2,9 |
||
758 | db 9,3,0,1,2,4,6,4,5,1,2,4,1,9 |
||
759 | db 9,5,3,2,6,3,2,1,2,1,2,6,0,9 |
||
760 | db 9,4,0,2,3,0,4,1,2,3,2,3,4,9 |
||
761 | db 9,2,0,4,5,6,3,1,3,0,4,1,0,9 |
||
762 | db 9,1,0,3,5,4,2,2,4,1,6,0,8,9 |
||
763 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
||
764 | images: |
||
765 | file 'pipes.raw' |
||
766 | I_END:->>>>>>>> |
||
767 |