Subversion Repositories Kolibri OS

Rev

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

  1. FH_levelp:
  2.                 mcall 40,100111b
  3.     call get_xy_sf
  4.     call erase_field
  5.     sub  esi,2
  6.     mov  [levptr],esi
  7.     movzx ecx,byte[esi-2]
  8.     sub  ecx,2
  9.     xor  eax,eax
  10.   .lp:
  11.     lodsb
  12.     mov  byte[field+eax],-1
  13.     loop .lp
  14.     mov  dword[player],-1
  15.     mov  [win_flag],3
  16.     ret
  17.  
  18. FH_key:
  19.                 cmp  eax,-1
  20.                 je   FH_mouse
  21.                 cmp  eax,8
  22.                 jne  .nobsp
  23.                 cmp  [stepptr],0
  24.                 jne  .no1st
  25.                 mov  [jump],run.game
  26.                 ret
  27.         .no1st:
  28.                 mov  [win_flag],0
  29.                 sub  [cur_step],2
  30.                 mov  esi,[cur_step]
  31.                 mov  edi,[finish]
  32.                 mov  eax,3
  33.                 movzx ebx,byte[esi]
  34.                 sub  eax,ebx
  35.                 movzx ecx,byte[esi+1]
  36.         .lp0:
  37.                 and  byte[field+edi],0
  38.                 add  edi,[dirs+eax*4]
  39.                 loop .lp0
  40.                 mov  [finish],edi
  41.                 dec  [stepptr]
  42.                 ret
  43.         .nobsp:
  44.     cmp  eax,176
  45.     jb   .ex
  46.     cmp  eax,179
  47.     ja   .ex
  48.     sub  eax,176
  49.     jmp  FH_mouse.fromkey
  50.   .ex:
  51.     ret
  52.  
  53. FH_drawm:
  54.     mov  ecx,[cell_count]
  55.   .lp:
  56.     push ecx
  57.     movzx ebx,byte[field+ecx-1]
  58.     test ebx,ebx
  59.     jz   .no
  60.     lea  eax,[ecx-1]
  61.     call get_xy
  62.     mov  edx,0
  63.     cmp  ebx,0xf
  64.     jne  .stable
  65.     mov  edx,0x909090
  66.   .stable:
  67.     mcall 13,[lx],[ly]
  68.   .no:
  69.     pop  ecx
  70.     loop .lp
  71.  
  72.     mov  eax,[player]
  73.     cmp  eax,-1
  74.     je   .ex
  75.     call get_xy
  76.     mcall 13,[lx],[ly],0xff00
  77.     mov  eax,[finish]
  78.     call get_xy
  79.     mcall 13,[lx],[ly],0xff0000
  80.  
  81.     mov  ecx,[stepptr]
  82.     jecxz .ex
  83.     mov  ebx,area
  84.     mov  edi,[player]
  85.     mov  edx,0xffffff
  86.   .lp3:
  87.     push ecx
  88.     mov  esi,edi
  89.     movzx eax,byte[ebx]
  90.     movzx ecx,byte[ebx+1]
  91.     add  ebx,2
  92.   .lp2:
  93.     add  edi,[dirs+eax*4]
  94.     loop .lp2
  95.                 call getline
  96.     pop  ecx
  97.     loop .lp3
  98.   .ex:
  99.     ret
  100.  
  101. FH_mouse:
  102.     mov  [jump],drw;red
  103.                 call get_last_mclick
  104.                 cmp  byte[field+ebx],0
  105.                 jne  .ex
  106.                 cmp  dword[player],-1
  107.                 jne  .nostart
  108.                 mov  dword[player],ebx
  109.                 mov  byte[field+ebx],0xf
  110.                 mov  [finish],ebx
  111.                 and  [win_flag],0
  112.     mov  [cur_step],area
  113.     and  [stepptr],0
  114.     ret
  115.         .nostart:
  116.                 mov  eax,[finish]
  117.                 call get_offset
  118.                 cmp  eax,-1
  119.                 je   .ex
  120.         .fromkey:
  121.                 xor  ecx,ecx
  122.                 mov  edx,eax
  123.                 mov  esi,[finish]
  124.         .lp:
  125.                 add  esi,[dirs+edx*4]
  126.                 cmp  byte[field+esi],0
  127.                 jnz  .exlp
  128.                 mov  eax,[finish]
  129.                 mov  ebx,esi
  130.                 call get_offset
  131.                 cmp  eax,edx
  132.                 jne  .exlp
  133.                 mov  byte[field+esi],0xf
  134.                 inc  ecx
  135.                 mov  [finish],esi
  136.                 jmp  .lp
  137.  
  138.         .exlp:
  139.                 jecxz .ex
  140.                 mov  eax,edx
  141.                 mov  edi,[cur_step]
  142.                 stosb
  143.                 mov  [edi],cl
  144.                 inc  edi
  145.                 mov  [cur_step],edi
  146.                 inc  [stepptr]
  147.                 mov  edi,field
  148.                 mov  ecx,[cell_count]
  149.                 xor  eax,eax
  150.                 repne scasb
  151.                 je   .ch_deadend
  152.                 mov  [win_flag],1
  153.         .ex:
  154.                 ret
  155.         .ch_deadend:
  156.                 mov  ecx,4
  157.                 mov  edx,dirs
  158.         .lpp:
  159.                 mov  eax,[finish]
  160.                 mov  ebx,[edx]
  161.                 add  ebx,eax
  162.                 push ebx
  163.                 call get_offset
  164.                 pop  ebx
  165.                 cmp  eax,-1
  166.                 je   .nxtlp
  167.                 cmp  byte[field+ebx],0
  168.                 jz   .ex
  169.         .nxtlp:
  170.                 add  edx,4
  171.                 loop .lpp
  172.                 mov  [win_flag],4
  173.                 ret
  174.  
  175. FH_level:
  176. file 'fhouse.bin'
  177.  
  178. if lang eq ru
  179.         FH_help mstr \
  180.         '‚ § ¤ ­¨¨ ­ ©¤¨â¥ ­ ç «ì­ãî ª«¥âªã ¨ ¯à®¢¥¤¨â¥',\
  181.         '«¨­¨î, ª®â®à ï ¯à®å®¤¨â ç¥à¥§ ¯ãáâë¥ ª«¥âª¨ ¯®',\
  182.         '®¤­®¬ã à §ã.',\
  183.         ' Š ¦¤ë© à § ªà á­ë© ª¢ ¤à â ¤¢¨£ ¥âáï ¯àאַ,',\
  184.         '®áâ ­ ¢«¨¢ ïáì ⮫쪮 ã ªà ï, ¯¥à¥¤ ç¥à­ë¬¨',\
  185.         'ª¢ ¤à â ¬¨ ¨«¨ 㦥 ¯®á¥é¥­­ë¬¨ ª«¥âª ¬¨.','',\
  186.         'http://www.clickmazes.com'
  187. else
  188.         FH_help mstr \
  189.         'For each puzzle find the starting square and draw',\
  190.         'a path moving horizontally and vertically that',\
  191.         'passes through each open square exactly once.','',\
  192.         'At each move the red runner will always run',\
  193.         'straight, as far as possible, stopping only when',\
  194.         "blocked by the grid's edge, a black square, or a",\
  195.         'square already visited.','',\
  196.         'http://www.clickmazes.com'
  197. end if
  198.