equal
deleted
inserted
replaced
43 aia_Skip = $8008; |
43 aia_Skip = $8008; |
44 aia_Wait = $8009; |
44 aia_Wait = $8009; |
45 aia_Put = $800A; |
45 aia_Put = $800A; |
46 aia_waitAngle = $800B; |
46 aia_waitAngle = $800B; |
47 aia_waitAmmoXY = $800C; |
47 aia_waitAmmoXY = $800C; |
48 |
48 |
49 aim_push = $8000; |
49 aim_push = $8000; |
50 aim_release = $8001; |
50 aim_release = $8001; |
51 ai_specmask = $8000; |
51 ai_specmask = $8000; |
52 |
52 |
53 type TAction = record |
53 type TAction = record |
54 Action: Longword; |
54 Action: Longword; |
55 X, Y, Param: LongInt; |
55 X, Y, Param: LongInt; |
56 Time: Longword; |
56 Time: Longword; |
57 end; |
57 end; |
58 |
58 |
59 TActions = record |
59 TActions = record |
60 Count, Pos: Longword; |
60 Count, Pos: Longword; |
61 actions: array[0..Pred(MAXACTIONS)] of TAction; |
61 actions: array[0..Pred(MAXACTIONS)] of TAction; |
62 Score: LongInt; |
62 Score: LongInt; |
63 isWalkingToABetterPlace: boolean; |
63 isWalkingToABetterPlace: boolean; |
107 else |
107 else |
108 begin |
108 begin |
109 WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); |
109 WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); |
110 if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then |
110 if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then |
111 WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X))) |
111 WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X))) |
112 |
112 |
113 else if (Action.Action = aia_AwareExpl) then |
113 else if (Action.Action = aia_AwareExpl) then |
114 WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y)); |
114 WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y)); |
115 end |
115 end |
116 end; |
116 end; |
117 {$ENDIF} |
117 {$ENDIF} |
163 {$IFDEF TRACEAIACTIONS} |
163 {$IFDEF TRACEAIACTIONS} |
164 DumpAction(Actions.actions[Actions.Pos], Me); |
164 DumpAction(Actions.actions[Actions.Pos], Me); |
165 {$ENDIF} |
165 {$ENDIF} |
166 if (Action and ai_specmask) <> 0 then |
166 if (Action and ai_specmask) <> 0 then |
167 case Action of |
167 case Action of |
168 aia_Weapon: |
168 aia_Weapon: |
169 SetWeapon(TAmmoType(Param)); |
169 SetWeapon(TAmmoType(Param)); |
170 |
170 |
171 aia_WaitXL: |
171 aia_WaitXL: |
172 if hwRound(Me^.X) = Param then |
172 if hwRound(Me^.X) = Param then |
173 begin |
173 begin |
174 Action:= aia_LookLeft; |
174 Action:= aia_LookLeft; |
175 Time:= GameTicks; |
175 Time:= GameTicks; |
176 exit |
176 exit |
180 //OutError('AI: WaitXL assert (' + IntToStr(hwRound(Me^.X)) + ' < ' + IntToStr(Param) + ')', false); |
180 //OutError('AI: WaitXL assert (' + IntToStr(hwRound(Me^.X)) + ' < ' + IntToStr(Param) + ')', false); |
181 FreeActionsList; |
181 FreeActionsList; |
182 exit |
182 exit |
183 end |
183 end |
184 else |
184 else |
185 begin |
185 begin |
186 CheckHang(Me); |
186 CheckHang(Me); |
187 exit |
187 exit |
188 end; |
188 end; |
189 |
189 |
190 aia_WaitXR: |
190 aia_WaitXR: |
191 if hwRound(Me^.X) = Param then |
191 if hwRound(Me^.X) = Param then |
192 begin |
192 begin |
193 Action:= aia_LookRight; |
193 Action:= aia_LookRight; |
194 Time:= GameTicks; |
194 Time:= GameTicks; |
195 exit |
195 exit |
199 //OutError('AI: WaitXR assert (' + IntToStr(hwRound(Me^.X)) + ' > ' + IntToStr(Param) + ')', false); |
199 //OutError('AI: WaitXR assert (' + IntToStr(hwRound(Me^.X)) + ' > ' + IntToStr(Param) + ')', false); |
200 FreeActionsList; |
200 FreeActionsList; |
201 exit |
201 exit |
202 end |
202 end |
203 else |
203 else |
204 begin |
204 begin |
205 CheckHang(Me); |
205 CheckHang(Me); |
206 exit |
206 exit |
207 end; |
207 end; |
208 aia_LookLeft: |
208 aia_LookLeft: |
209 if not Me^.dX.isNegative then |
209 if not Me^.dX.isNegative then |
220 exit |
220 exit |
221 end |
221 end |
222 else ParseCommand('-right', true); |
222 else ParseCommand('-right', true); |
223 aia_AwareExpl: |
223 aia_AwareExpl: |
224 AwareOfExplosion(X, Y, Param); |
224 AwareOfExplosion(X, Y, Param); |
225 |
225 |
226 aia_HJump: |
226 aia_HJump: |
227 ParseCommand('hjump', true); |
227 ParseCommand('hjump', true); |
228 |
228 |
229 aia_LJump: |
229 aia_LJump: |
230 ParseCommand('ljump', true); |
230 ParseCommand('ljump', true); |
231 |
231 |
232 aia_Skip: |
232 aia_Skip: |
233 ParseCommand('skip', true); |
233 ParseCommand('skip', true); |
234 |
234 |
235 aia_Put: |
235 aia_Put: |
236 doPut(X, Y, true); |
236 doPut(X, Y, true); |
237 |
237 |
238 aia_waitAngle: |
238 aia_waitAngle: |
239 if LongInt(Me^.Angle) <> Abs(Param) then exit; |
239 if LongInt(Me^.Angle) <> Abs(Param) then exit; |
240 |
240 |
241 aia_waitAmmoXY: |
241 aia_waitAmmoXY: |
242 if (CurAmmoGear <> nil) and ((hwRound(CurAmmoGear^.X) <> X) or (hwRound(CurAmmoGear^.Y) <> Y)) then |
242 if (CurAmmoGear <> nil) and ((hwRound(CurAmmoGear^.X) <> X) or (hwRound(CurAmmoGear^.Y) <> Y)) then |
243 exit; |
243 exit; |
244 end |
244 end |
245 else |
245 else |
246 begin |
246 begin |
247 s:= ActionIdToStr[Action]; |
247 s:= ActionIdToStr[Action]; |
248 if (Param and ai_specmask) <> 0 then |
248 if (Param and ai_specmask) <> 0 then |
249 case Param of |
249 case Param of |
250 aim_push: |
250 aim_push: |
251 s:= '+' + s; |
251 s:= '+' + s; |
252 |
252 |
253 aim_release: |
253 aim_release: |
254 s:= '-' + s; |
254 s:= '-' + s; |
255 end |
255 end |
256 else if Param <> 0 then |
256 else if Param <> 0 then |
257 s:= s + ' ' + IntToStr(Param); |
257 s:= s + ' ' + IntToStr(Param); |