Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1806 yogev_ezra 1
TM_levelp:
2
    call get_xy_sf
3
    mov  [levptr],esi
4
    call unpack_level
5
    ret
6
 
7
TM_key:
8
    cmp  eax,' '
9
    je   .mm
10
    cmp  eax,176
11
    jb   .still
12
    cmp  eax,179
13
    ja   .still
14
    lea  ebx,[eax-176]
15
    mov  eax,[teseus]
16
    call check_move
17
    jc   .still
18
    call move_teseus
19
    cmp  [win_flag],0
20
    jne  .ex
21
  .nowin:
22
    call drwfld
23
  .mm:
24
    call move_minotaur
25
    cmp  eax,[teseus]
26
    jne  .still
27
    mov  [win_flag],2
28
    jmp  .ex
29
  .still:
30
    mov  [jump],still
31
  .ex:
32
    ret
33
 
34
move_minotaur:
35
    xor  esi,esi
36
    mov  eax,[teseus]
37
    mov  ebx,[fx]
38
    div  bl
39
    mov  ecx,eax  ;teseus: ch-x, cl-y
40
    mov  eax,[minotaur]
41
  .again:
42
    call mino_xy
43
    xor  ebx,ebx
44
    cmp  dh,ch
45
    je   .stand2
46
    ja   .ok1
47
    add  ebx,3
48
  .ok1:
49
    call check_move
50
    jc   .stand2
51
    add  eax,[dirs+ebx*4]
52
    mov  [minotaur],eax
53
    inc  esi
54
    call delay
55
    call drwfld
56
    cmp  esi,2
57
    jb   .again
58
    jmp  .ex
59
  .stand1:
60
    call mino_xy
61
  .stand2:
62
    mov  ebx,2
63
    cmp  dl,cl
64
    je   .ex
65
    ja   .ok2
66
    dec  ebx
67
  .ok2:
68
    call check_move
69
    jc   .ex
70
    add  eax,[dirs+ebx*4]
71
    mov  [minotaur],eax
72
    inc  esi
73
    call delay
74
    call drwfld
75
    cmp  esi,2
76
    jb   .again
77
  .ex:
78
    ret
79
 
80
mino_xy:
81
    push eax
82
    div  byte[fx]
83
    mov  edx,eax  ;minotaur: dh-x, dl-y
84
    pop  eax
85
    ret
86
 
87
move_teseus:
88
    pusha
89
    cdq
90
    mov  ecx,[fx]
91
    div  cl
92
    add  ax,1 shl 8+1
93
    test ebx,ebx
94
    jne  .no0
95
    cmp  ah,1
96
    jne  .move
97
  .win:
98
    inc  [win_flag]
99
    jmp  .ex
100
  .no0:
101
    cmp  ebx,1
102
    jne  .no1
103
    cmp  al,byte[fy]
104
    je   .win
105
    jmp  .move
106
  .no1:
107
    cmp  ebx,2
108
    jne  .no2
109
    cmp  al,1
110
    je   .win
111
    jmp  .move
112
  .no2:
113
    cmp  ebx,3
114
    jne  .move
115
    cmp  ah,byte[fx]
116
    je   .win
117
  .move:
118
    mov  eax,[esp+28]
119
    add  eax,[dirs+ebx*4]
120
    mov  [teseus],eax
121
  .ex:
122
    popa
123
    ret
124
 
125
TM_drawm:
126
    mov  eax,[teseus]
127
    call get_xy
128
    mcall 13,[lx],[ly],0xff00
129
    mov  eax,[minotaur]
130
    call get_xy
131
    mcall 13,[lx],[ly],0xff0000
132
    ret
133
 
134
TM_level:
135
file 'tam.bin'
136
 
137
if lang eq ru
138
	TM_help mstr \
139
	' Тесей (зеленый квадрат) должен убежать из',\
140
	'лабиринта. За ним гонится механический Минотавр',\
141
	'(красный квадрат). На каждый ход Тесей Минотавр',\
142
	'делает 2 хода по такой схеме:',\
143
	' Сначала он пытается приблизиться к Тесею по',\
144
	'горизонтали на 1 квадрат. Если это невозможно,',\
145
	'он пытается подойти по вертикали на 1 квадрат.',\
146
	'Если невозможно сделать ни того, ни другого,',\
147
	'Минотавр пропускает данный ход.','',\
148
  'http://puzzleprograms.narod.ru'
149
else
150
	TM_help mstr \
151
  ' Theseus (the green dot) must escape from a maze.',\
152
  'There is also a mechanical Minotaur (the red',\
153
  'dot) in each maze. For every turn that Theseus',\
154
  'takes, the Minotaur takes two turns.',\
155
  ' Each turn he decides following:',\
156
  'First he tests if he can move horizontally and',\
157
  'get closer to Theseus. If he can, he will move',\
158
  "one square horizontally. If he can't, he will",\
159
  'test if he could move vertically and get closer',\
160
  'to Theseus. If he can, he will move one square',\
161
  "vertically. If he can't move either horizontally",\
162
  'or vertically, then he just skips that turn.','',\
163
  'http://puzzleprograms.narod.ru'
164
end if