Subversion Repositories Kolibri OS

Rev

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

  1. ; level format
  2. ; [fx|fy][hole xy][balls #]..[1-red,0-black xy]..[maze walls]
  3.  
  4. ; internal format
  5. ; [stepptr]= balls #
  6. ; [finish]= hole cell
  7. ; area: ..[1-red,0-black xy].. ( -1 if empty)
  8.  
  9. MAR_levelp:
  10.     call get_xy_sf
  11.     movzx eax,byte[esi-2]
  12.     mov  [finish],eax
  13.     movzx ecx,byte[esi-1]
  14.     mov  [stepptr],ecx
  15.     mov  edi,area
  16.     rep  movsb
  17.     mov  [pause_time],10
  18.     call unpack_level
  19.     ret
  20.  
  21. MAR_key:
  22.     cmp  eax,176
  23.     jb   .ex
  24.     cmp  eax,179
  25.     ja   .ex
  26.     mov  esi,area-1
  27.     lea  ebx,[eax-176]
  28.   .again:
  29.     and  [cur_step],0
  30.     mov  ecx,[stepptr]
  31.   .lp:
  32.     movzx eax,byte[esi+ecx]
  33.     cmp  al,-1
  34.     je   .ex1
  35.     mov  byte[player],al
  36.     and  byte[player],0x80
  37.     and  eax,0x7f
  38.     call check_move
  39.     jc   .ex1
  40.     add  eax,[dirs+ebx*4]
  41.     cmp  eax,[finish]
  42.     jne  .nohole
  43.     mov  byte[esi+ecx],-1
  44.     jmp  .ex2
  45.   .nohole:
  46.         push ecx
  47.     mov  ecx,[stepptr]
  48.     mov  edi,area
  49.   .lp2:
  50.     mov  dl,[edi]
  51.     and  dl,0x7f
  52.     cmp  al,dl
  53.     je   .exlp2
  54.     inc  edi
  55.     loop .lp2
  56.   .exlp2:
  57.     pop  ecx
  58.     je   .ex1
  59.     or   al,byte[player]
  60.     mov  [esi+ecx],al
  61.   .ex2:
  62.     inc  [cur_step]
  63.   .ex1:
  64.         loop .lp
  65.     cmp  [cur_step],0
  66.     je   .exx
  67.     call delay
  68.     call drwfld
  69.     jmp  .again
  70.   .exx:
  71.     mov  ecx,[stepptr]
  72.     inc  esi
  73.   .lp3:
  74.     lodsb
  75.     cmp  al,-1
  76.     je   .nxt
  77.     test al,0x80
  78.     jne  .ex
  79.   .nxt:
  80.                 loop .lp3
  81.     mov  [win_flag],1
  82.   .ex:
  83.     ret
  84.  
  85. MAR_drawm:
  86.                 shl  [sq_size],1
  87.     mov  eax,[finish]
  88.     call get_xy
  89.                 shr  [sq_size],1
  90.     mcall 13,[lx],[ly],0xa0a0a0
  91.     movzx ecx,byte[stepptr]
  92.     mov  edi,area
  93.   .lp:
  94.     push ecx
  95.     movzx eax,byte[edi]
  96.     mov  edx,0x0
  97.     cmp  al,-1
  98.     je   .exlp
  99.     test eax,0x80
  100.     je   .no
  101.     mov  edx,0xff00000
  102.   .no:
  103.     and  eax,0x7f
  104.     call get_xy
  105.     mcall 13,[lx],[ly]
  106.   .exlp:
  107.     pop  ecx
  108.     inc  edi
  109.     loop .lp
  110.   .ex:
  111.     ret
  112.  
  113. MAR_level:
  114. file 'marble.bin'
  115.  
  116. if lang eq ru
  117.         MAR_help mstr \
  118.         '¥áª®«ìª® ªà á­ëå ¨ ç¥à­ëå ¯« è¥ª «¥¦ â ­  ¤®áª¥,',\
  119.         '¤ëઠ ®¡®§­ ç¥­  á¥à®© ª«¥âª®©. Š®£¤  ¯« èª ',\
  120.         '¯à®å®¤¨â ­ ¤ ¤ëમ©, ®­  ¯ ¤ ¥â â㤠 ¨ ¨á祧 ¥â.',\
  121.         'ˆá¯®«ì§ã©â¥ áâ५ª¨ ¤«ï ­ ª«®­  ¤®áª¨.',\
  122.         ' ‚ è  § ¤ ç  - á¡à®á¨âì ¢á¥ ªà á­ë¥ ¯« èª¨.',\
  123.         'Š®«¨ç¥á⢮ 㯠¢è¨å ç¥à­ëå ¯« è¥ª ஫¨ ­¥ ¨£à ¥â.','',\
  124.         'http://www.clickmazes.com'
  125. else
  126.         MAR_help mstr \
  127.   'Several red and black marbles sit on a flat tray,',\
  128.   'a grey square indicate a hole in the tray. If a',\
  129.   'marble rolls onto or over the hole it drops',\
  130.   'through and disappears. Use the cursor keys to',\
  131.   'tilt the tray and start the marbles rolling, the',\
  132.   'marbles roll in a straight line until they come',\
  133.   'to rest, you can then roll again. Your challenge',\
  134.   'is to drop all the red marbles, it does not',\
  135.   'matter how many black marbles you lose in the',\
  136.   'process.','',\
  137.         'http://www.clickmazes.com'
  138. end if
  139.