forked from KolibriOS/kolibrios
165 lines
3.3 KiB
PHP
165 lines
3.3 KiB
PHP
|
TM_levelp:
|
|||
|
call get_xy_sf
|
|||
|
mov [levptr],esi
|
|||
|
call unpack_level
|
|||
|
ret
|
|||
|
|
|||
|
TM_key:
|
|||
|
cmp eax,' '
|
|||
|
je .mm
|
|||
|
cmp eax,176
|
|||
|
jb .still
|
|||
|
cmp eax,179
|
|||
|
ja .still
|
|||
|
lea ebx,[eax-176]
|
|||
|
mov eax,[teseus]
|
|||
|
call check_move
|
|||
|
jc .still
|
|||
|
call move_teseus
|
|||
|
cmp [win_flag],0
|
|||
|
jne .ex
|
|||
|
.nowin:
|
|||
|
call drwfld
|
|||
|
.mm:
|
|||
|
call move_minotaur
|
|||
|
cmp eax,[teseus]
|
|||
|
jne .still
|
|||
|
mov [win_flag],2
|
|||
|
jmp .ex
|
|||
|
.still:
|
|||
|
mov [jump],still
|
|||
|
.ex:
|
|||
|
ret
|
|||
|
|
|||
|
move_minotaur:
|
|||
|
xor esi,esi
|
|||
|
mov eax,[teseus]
|
|||
|
mov ebx,[fx]
|
|||
|
div bl
|
|||
|
mov ecx,eax ;teseus: ch-x, cl-y
|
|||
|
mov eax,[minotaur]
|
|||
|
.again:
|
|||
|
call mino_xy
|
|||
|
xor ebx,ebx
|
|||
|
cmp dh,ch
|
|||
|
je .stand2
|
|||
|
ja .ok1
|
|||
|
add ebx,3
|
|||
|
.ok1:
|
|||
|
call check_move
|
|||
|
jc .stand2
|
|||
|
add eax,[dirs+ebx*4]
|
|||
|
mov [minotaur],eax
|
|||
|
inc esi
|
|||
|
call delay
|
|||
|
call drwfld
|
|||
|
cmp esi,2
|
|||
|
jb .again
|
|||
|
jmp .ex
|
|||
|
.stand1:
|
|||
|
call mino_xy
|
|||
|
.stand2:
|
|||
|
mov ebx,2
|
|||
|
cmp dl,cl
|
|||
|
je .ex
|
|||
|
ja .ok2
|
|||
|
dec ebx
|
|||
|
.ok2:
|
|||
|
call check_move
|
|||
|
jc .ex
|
|||
|
add eax,[dirs+ebx*4]
|
|||
|
mov [minotaur],eax
|
|||
|
inc esi
|
|||
|
call delay
|
|||
|
call drwfld
|
|||
|
cmp esi,2
|
|||
|
jb .again
|
|||
|
.ex:
|
|||
|
ret
|
|||
|
|
|||
|
mino_xy:
|
|||
|
push eax
|
|||
|
div byte[fx]
|
|||
|
mov edx,eax ;minotaur: dh-x, dl-y
|
|||
|
pop eax
|
|||
|
ret
|
|||
|
|
|||
|
move_teseus:
|
|||
|
pusha
|
|||
|
cdq
|
|||
|
mov ecx,[fx]
|
|||
|
div cl
|
|||
|
add ax,1 shl 8+1
|
|||
|
test ebx,ebx
|
|||
|
jne .no0
|
|||
|
cmp ah,1
|
|||
|
jne .move
|
|||
|
.win:
|
|||
|
inc [win_flag]
|
|||
|
jmp .ex
|
|||
|
.no0:
|
|||
|
cmp ebx,1
|
|||
|
jne .no1
|
|||
|
cmp al,byte[fy]
|
|||
|
je .win
|
|||
|
jmp .move
|
|||
|
.no1:
|
|||
|
cmp ebx,2
|
|||
|
jne .no2
|
|||
|
cmp al,1
|
|||
|
je .win
|
|||
|
jmp .move
|
|||
|
.no2:
|
|||
|
cmp ebx,3
|
|||
|
jne .move
|
|||
|
cmp ah,byte[fx]
|
|||
|
je .win
|
|||
|
.move:
|
|||
|
mov eax,[esp+28]
|
|||
|
add eax,[dirs+ebx*4]
|
|||
|
mov [teseus],eax
|
|||
|
.ex:
|
|||
|
popa
|
|||
|
ret
|
|||
|
|
|||
|
TM_drawm:
|
|||
|
mov eax,[teseus]
|
|||
|
call get_xy
|
|||
|
mcall 13,[lx],[ly],0xff00
|
|||
|
mov eax,[minotaur]
|
|||
|
call get_xy
|
|||
|
mcall 13,[lx],[ly],0xff0000
|
|||
|
ret
|
|||
|
|
|||
|
TM_level:
|
|||
|
file 'tam.bin'
|
|||
|
|
|||
|
if lang eq ru
|
|||
|
TM_help mstr \
|
|||
|
' <20><>ᥩ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㡥<><E3A1A5><EFBFBD><EFBFBD> <20><>',\
|
|||
|
'<27><><EFBFBD><EFBFBD>ਭ<EFBFBD><E0A8AD>. <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>堭<EFBFBD><E5A0AD><EFBFBD>᪨<EFBFBD> <20><><EFBFBD><EFBFBD>⠢<EFBFBD>',\
|
|||
|
'(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>). <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 室 <20><>ᥩ <20><><EFBFBD><EFBFBD>⠢<EFBFBD>',\
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 室<> <20><> ⠪<><E2A0AA> <20>奬<EFBFBD>:',\
|
|||
|
' <20><><EFBFBD>砫<EFBFBD> <20><> <20><>⠥<EFBFBD><E2A0A5><EFBFBD> <20>ਡ<EFBFBD><E0A8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>',\
|
|||
|
'<27><>ਧ<EFBFBD><E0A8A7>⠫<EFBFBD> <20><> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,',\
|
|||
|
'<27><> <20><>⠥<EFBFBD><E2A0A5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>⨪<EFBFBD><E2A8AA><EFBFBD> <20><> 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.',\
|
|||
|
'<27> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᤥ<><E1A4A5><EFBFBD><EFBFBD> <20><> ⮣<>, <20><> <20><>㣮<EFBFBD><E3A3AE>,',\
|
|||
|
'<27><><EFBFBD><EFBFBD>⠢<EFBFBD> <20>ய<EFBFBD>᪠<EFBFBD><E1AAA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 室.','',\
|
|||
|
'http://puzzleprograms.narod.ru'
|
|||
|
else
|
|||
|
TM_help mstr \
|
|||
|
' Theseus (the green dot) must escape from a maze.',\
|
|||
|
'There is also a mechanical Minotaur (the red',\
|
|||
|
'dot) in each maze. For every turn that Theseus',\
|
|||
|
'takes, the Minotaur takes two turns.',\
|
|||
|
' Each turn he decides following:',\
|
|||
|
'First he tests if he can move horizontally and',\
|
|||
|
'get closer to Theseus. If he can, he will move',\
|
|||
|
"one square horizontally. If he can't, he will",\
|
|||
|
'test if he could move vertically and get closer',\
|
|||
|
'to Theseus. If he can, he will move one square',\
|
|||
|
"vertically. If he can't move either horizontally",\
|
|||
|
'or vertically, then he just skips that turn.','',\
|
|||
|
'http://puzzleprograms.narod.ru'
|
|||
|
end if
|