Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ; level format
  2. ; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2]
  3.  
  4. ; internal format
  5. ; [stepptr]= worms #
  6. ; area: [worm_len][start_cell #][end_cell #]..[dirs]..
  7. ; [cur_step]: dragged worm pointer
  8. ; [finish]: 0 - if head dragged, 1- if tail
  9.  
  10. OR_levelp:
  11.                 mov  [Ces],40
  12.                 mcall 40,100111b
  13.                 inc  [drag_flag]
  14.                 mov  eax,OR_strip
  15.                 call need_image
  16.     inc  esi
  17.     movzx ecx,byte[esi]
  18.     inc  esi
  19.     push esi
  20.     mov  esi,OR_maze
  21.     jecxz .sk
  22.   .nxtmz:
  23.     movzx eax,byte[esi]
  24.     add  esi,eax
  25.     loop .nxtmz
  26.   .sk:
  27.     call get_xy_sf
  28.     call unpack_level
  29.     pop  esi
  30.     movzx ecx,byte[esi]
  31.     inc  esi
  32.     mov  [cur_step],ecx
  33.     jecxz .sk2
  34.     mov  edi,area
  35.     rep  movsb
  36.   .sk2:
  37.     mov  ecx,[cell_count]
  38.     mov  edi,area+16
  39.     rep  movsb
  40.     mov  [stepptr],2
  41. ;    call erase_field
  42. ;    ud2
  43.     ret
  44.  
  45. OR_key:
  46.                 cmp  eax,0
  47.                 jl   OR_mouse
  48.     ret
  49.  
  50. OR_drawf:
  51.     mov  ecx,[cell_count]
  52.     push [sq_size]
  53.                 mov  [sq_size],0
  54.   .lp:
  55.     push ecx
  56.     movzx ebx,byte[area+16+ecx-1]
  57.     cmp  bl,0xf
  58.     je   .no
  59.     lea  eax,[ecx-1]
  60.     call out_image
  61.   .no:
  62.     pop  ecx
  63.     loop .lp
  64.                 pop  [sq_size]
  65.                 ret
  66.  
  67. OR_drawm:
  68.     push [sq_size]
  69.                 mov  [sq_size],0
  70.     mov  eax,[player]
  71.     mov  ebx,[stepptr]
  72.     add  ebx,8
  73.     call out_image
  74.     mov  ecx,[cur_step]
  75.     jecxz .skipb
  76.     mov  ebx,7
  77.                 mov  esi,area
  78.                 xor  eax,eax
  79.         .nxtb:
  80.                 lodsb
  81.                 call out_image
  82.                 loop .nxtb
  83.         .skipb:
  84.                 mov  eax,[player]
  85.         .again:
  86.     mov  ebx,[stepptr]
  87.     call check_move
  88.     jc   .ex
  89.                 add  eax,[dirs+ebx*4]
  90.                 cmp  byte[area+16+eax],6
  91.                 je   .ex
  92.                 mov  ecx,[cur_step]
  93.                 jecxz .skbchk
  94.                 mov  edi,area
  95.                 repne scasb
  96.                 je   .again
  97.         .skbchk:
  98.                 mov  [sq_size],1
  99.                 push eax
  100.     call get_xy
  101.                 mov  ebx,[lx]
  102.                 sub  bx,2
  103.                 mov  ecx,[ly]
  104.                 mov  cx,3
  105.                 mcall 13,,,0xFFC633
  106.                 xchg bx,cx
  107.                 mcall
  108.                 mov  esi,[Ces]
  109.                 sub  esi,3+2
  110.                 shl  esi,16
  111.                 push ebx
  112.                 add  ebx,esi
  113.                 mcall
  114.                 pop  ebx
  115.                 add  ecx,esi
  116.                 xchg bx,cx
  117.                 add  bx,2
  118.                 mcall
  119.                 pop  eax
  120.                 jmp  .again
  121.         .ex:
  122.                 pop  [sq_size]
  123.     ret
  124.  
  125. OR_mouse:
  126.                 cmp  [win_flag],1
  127.                 je   .ex
  128.     mov  [jump],still
  129.     mov  edx,eax
  130.                 call get_last_mclick
  131.     cmp  edx,-2
  132.     jne  .ex
  133.                 test eax,eax
  134.                 jnz  .noempty
  135.         .drw:
  136.     mov  [jump],drw
  137.     ret
  138.         .noempty:
  139.  
  140. ; First Click at ebx cell
  141.                 mov  eax,[player]
  142.     cmp  eax,ebx
  143.     je   OR_drawf
  144.                 mov  ecx,[cur_step]
  145.                 jecxz .skbchk
  146.                 mov  edi,area
  147.                 xchg eax,ebx
  148.                 repne scasb
  149.                 xchg eax,ebx
  150.                 je   OR_drawf
  151.         .skbchk:
  152.         cmp  byte[area+16+ebx],0xf
  153.         je   .ex
  154.         cmp  byte[area+16+ebx],6
  155.         je   .ex
  156.     push eax
  157.     mov  edx,ebx
  158.     call get_offset
  159.     mov  ebx,eax
  160.     pop  eax
  161.     cmp  ebx,[stepptr]
  162.     jne  .ex
  163.  
  164.     call check_move
  165.     jc   .ex
  166.     movzx ecx,byte[area+16+edx]
  167.                 cmp  ecx,4
  168.                 jae  .noarr
  169.                 mov  ebx,ecx
  170.                 call check_move
  171.                 jc   .ex
  172.                 mov  edx,eax
  173.                 add  eax,[dirs+ebx*4]
  174.                 mov  [player],eax
  175.                 mov  ecx,[cur_step]
  176.                 jecxz .skbchk2
  177.                 mov  edi,area
  178.                 repne scasb
  179.                 jne  .skbchk2
  180.                 mov  [edi-1],dl
  181.         .skbchk2:
  182.                 cmp  eax,[finish]
  183.                 jne  .drw
  184.                 mov  [win_flag],1
  185.     jmp  .drw
  186.   .noarr:
  187.         mov  edx,[stepptr]
  188.         cmp  ecx,4
  189.         jne  .nocw
  190.         movzx edx,byte[dir_rotate+edx]
  191.         jmp  .ex2
  192.   .nocw:
  193.         cmp  ecx,5
  194.         jne  .ex
  195.         movzx edx,byte[dir_rotate+4+edx]
  196.   .ex2:
  197.         mov  [stepptr],edx
  198.     jmp  .drw
  199.         .ex:
  200.                 ret
  201.  
  202. OR_maze:
  203. file  'omaze.bin'
  204.  
  205. OR_level:
  206. file 'or2.bin'
  207.  
  208. if lang eq ru
  209.         OR_help mstr \
  210.         '™¥«ç®ª ­  ¢ë¤¥«¥­­®© ª«¥âª¥ ¯¥à¥¤¢¨£ ¥â ¨«¨',\
  211.         '¢à é ¥â ªà á­ãî áâ५ªã. ‘¨­¨© ¡«®ª ¤¥©áâ¢ã¥â',\
  212.         'ª ª ¯à¥¯ïâá⢨¥, áªàë¢ ï ®¤­ã ª«¥âªã. à¨',\
  213.         '¯¥à¥å®¤¥ áâ५ª¨ ­  ª«¥âªã ᨭ¥£® ¡«®ª  ®­¨',\
  214.         '¯®¬¥­ïîâáï ¬¥áâ ¬¨. ‡ ¤ ç  - ¯à®¢¥á⨠ªà á­ãî',\
  215.         'áâ५ªã ¨§ ­¨¦­¥© ª«¥âª¨ ¢ ¢¥àå­îî.','',\
  216.         'http://www.clickmazes.com'
  217. else
  218.         OR_help mstr \
  219.         'Click on a highlighted square to move or rotate',\
  220.         'the red pointer. The blue switcher acts as an',\
  221.         'obstacle, hiding one square. The red pointer and',\
  222.         'blue switcher will swap places if the red pointer',\
  223.         'is pushed onto a square occupied by a blue',\
  224.         'switcher. Your challenge is to negotiate the red',\
  225.         'arrow from the bottom to the top square.','',\
  226.         'http://www.clickmazes.com'
  227. end if
  228.