91 if (Action.Action and ai_specmask) = 0 then |
91 if (Action.Action and ai_specmask) = 0 then |
92 WriteLnToConsole('AI action: '+ActionIdToStr[Action.Action]) |
92 WriteLnToConsole('AI action: '+ActionIdToStr[Action.Action]) |
93 else begin |
93 else begin |
94 WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); |
94 WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); |
95 if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then |
95 if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then |
96 WriteLnToConsole('AI action Wait X = '+inttostr(Action.Param)+', current X = '+inttostr(round(Me.X))); |
96 WriteLnToConsole('AI action Wait X = '+inttostr(Action.Param)+', current X = '+inttostr(hwRound(Me^.X))); |
97 end |
97 end |
98 end; |
98 end; |
99 {$ENDIF} |
99 {$ENDIF} |
100 |
100 |
101 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt); |
101 procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt); |
145 DumpAction(Actions.actions[Actions.Pos], Me); |
145 DumpAction(Actions.actions[Actions.Pos], Me); |
146 {$ENDIF} |
146 {$ENDIF} |
147 if (Action and ai_specmask) <> 0 then |
147 if (Action and ai_specmask) <> 0 then |
148 case Action of |
148 case Action of |
149 aia_Weapon: SetWeapon(TAmmoType(Param)); |
149 aia_Weapon: SetWeapon(TAmmoType(Param)); |
150 aia_WaitXL: if hwRound(Me^.X) = Param then Time:= GameTicks |
150 aia_WaitXL: if hwRound(Me^.X) = Param then |
|
151 begin |
|
152 Action:= aia_LookLeft; |
|
153 Time:= GameTicks; |
|
154 exit |
|
155 end |
151 else if hwRound(Me^.X) < Param then |
156 else if hwRound(Me^.X) < Param then |
152 begin |
157 begin |
153 OutError('AI: WaitXL assert', false); |
158 OutError('AI: WaitXL assert (' + IntToStr(hwRound(Me^.X)) + ' < ' + IntToStr(Param) + ')', false); |
154 FreeActionsList; |
159 FreeActionsList; |
155 exit |
160 exit |
156 end |
161 end |
157 else begin CheckHang; exit end; |
162 else begin CheckHang; exit end; |
158 aia_WaitXR: if hwRound(Me^.X) = Param then Time:= GameTicks |
163 aia_WaitXR: if hwRound(Me^.X) = Param then |
|
164 begin |
|
165 Action:= aia_LookRight; |
|
166 Time:= GameTicks; |
|
167 exit |
|
168 end |
159 else if hwRound(Me^.X) > Param then |
169 else if hwRound(Me^.X) > Param then |
160 begin |
170 begin |
161 OutError('AI: WaitXR assert', false); |
171 OutError('AI: WaitXR assert (' + IntToStr(hwRound(Me^.X)) + ' > ' + IntToStr(Param) + ')', false); |
162 FreeActionsList; |
172 FreeActionsList; |
163 exit |
173 exit |
164 end |
174 end |
165 else begin CheckHang; exit end; |
175 else begin CheckHang; exit end; |
166 aia_LookLeft: if not Me^.dX.isNegative then |
176 aia_LookLeft: if not Me^.dX.isNegative then |