author | koda |
Thu, 03 May 2012 16:04:38 +0100 | |
changeset 7016 | 8b34f46e10c1 |
parent 6982 | 8d41d22a291d |
child 7028 | 0f60591f3a16 |
permissions | -rw-r--r-- |
71 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
71 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
71 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
71 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
71 | 17 |
*) |
18 |
||
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uAIActions; |
22 |
interface |
|
4357
a1fcfc341a52
Introduce unit uTypes in order to remove some cyclic unit dependencies
unC0Rr
parents:
3407
diff
changeset
|
23 |
uses uFloat, uTypes; |
2630 | 24 |
|
3165
3ec07a7d8456
just some very sane stuff for the iphone port (plus some macro on pascal files)
koda
parents:
2630
diff
changeset
|
25 |
const MAXACTIONS = 96; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
26 |
aia_none = 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
27 |
aia_Left = 1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
28 |
aia_Right = 2; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
29 |
aia_Timer = 3; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
30 |
aia_attack = 4; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
31 |
aia_Up = 5; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
32 |
aia_Down = 6; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
33 |
aia_Switch = 7; |
4 | 34 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
35 |
aia_Weapon = $8000; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
36 |
aia_WaitXL = $8001; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
37 |
aia_WaitXR = $8002; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
38 |
aia_LookLeft = $8003; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
39 |
aia_LookRight = $8004; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
40 |
aia_AwareExpl = $8005; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
41 |
aia_HJump = $8006; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
42 |
aia_LJump = $8007; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
43 |
aia_Skip = $8008; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
44 |
aia_Wait = $8009; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
45 |
aia_Put = $800A; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
46 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
47 |
aim_push = $8000; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
48 |
aim_release = $8001; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
49 |
ai_specmask = $8000; |
4 | 50 |
|
64 | 51 |
type TAction = record |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
52 |
Action: Longword; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
53 |
X, Y, Param: LongInt; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
54 |
Time: Longword; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
55 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
56 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
57 |
TActions = record |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
58 |
Count, Pos: Longword; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
59 |
actions: array[0..Pred(MAXACTIONS)] of TAction; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
60 |
Score: LongInt; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
61 |
isWalkingToABetterPlace: boolean; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
62 |
end; |
4 | 63 |
|
371 | 64 |
procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt); |
64 | 65 |
procedure ProcessAction(var Actions: TActions; Me: PGear); |
369 | 66 |
|
4 | 67 |
implementation |
6535
51a7e71ad317
It seems there's no need to copy gear's msg. Fixes bots getting stuck after hog switch.
unc0rr
parents:
6474
diff
changeset
|
68 |
uses uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils, uDebug, uIO{$IFDEF TRACEAIACTIONS}, uConsole{$ENDIF}; |
4 | 69 |
|
6393 | 70 |
const ActionIdToStr: array[0..7] of string[16] = ( |
4 | 71 |
{aia_none} '', |
72 |
{aia_Left} 'left', |
|
73 |
{aia_Right} 'right', |
|
74 |
{aia_Timer} 'timer', |
|
75 |
{aia_attack} 'attack', |
|
76 |
{aia_Up} 'up', |
|
6393 | 77 |
{aia_Down} 'down', |
78 |
{aia_Switch} 'switch' |
|
64 | 79 |
); |
4 | 80 |
|
80 | 81 |
{$IFDEF TRACEAIACTIONS} |
195
edae828322a0
Fixed compilation with freepascal version prior to 1.9.6
unc0rr
parents:
194
diff
changeset
|
82 |
const SpecActionIdToStr: array[$8000..$8009] of string[16] = ( |
80 | 83 |
{aia_Weapon} 'aia_Weapon', |
84 |
{aia_WaitX} 'aia_WaitX', |
|
85 |
{aia_WaitY} 'aia_WaitY', |
|
86 |
{aia_LookLeft} 'aia_LookLeft', |
|
87 |
{aia_LookRight} 'aia_LookRight', |
|
88 |
{aia_AwareExpl} 'aia_AwareExpl', |
|
89 |
{aia_HJump} 'aia_HJump', |
|
144 | 90 |
{aia_LJump} 'aia_LJump', |
193 | 91 |
{aia_Skip} 'aia_Skip', |
92 |
{aia_Wait} 'aia_Wait' |
|
80 | 93 |
); |
94 |
||
95 |
procedure DumpAction(Action: TAction; Me: PGear); |
|
96 |
begin |
|
97 |
if (Action.Action and ai_specmask) = 0 then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
98 |
WriteLnToConsole('AI action: '+ActionIdToStr[Action.Action]) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
99 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
100 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
101 |
WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
102 |
if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
103 |
WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X))) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
104 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
105 |
else if (Action.Action = aia_AwareExpl) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
106 |
WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y)); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
107 |
end |
80 | 108 |
end; |
109 |
{$ENDIF} |
|
110 |
||
371 | 111 |
procedure AddAction(var Actions: TActions; Action: Longword; Param: LongInt; TimeDelta: Longword; X, Y: LongInt); |
4 | 112 |
begin |
64 | 113 |
with Actions do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
114 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
115 |
actions[Count].Action:= Action; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
116 |
actions[Count].Param:= Param; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
117 |
actions[Count].X:= X; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
118 |
actions[Count].Y:= Y; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
119 |
if Count > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
120 |
actions[Count].Time:= TimeDelta |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
121 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
122 |
actions[Count].Time:= GameTicks + TimeDelta; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
123 |
inc(Count); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
124 |
TryDo(Count < MAXACTIONS, 'AI: actions overflow', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
125 |
end |
4 | 126 |
end; |
127 |
||
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6395
diff
changeset
|
128 |
procedure CheckHang(Me: PGear); |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6395
diff
changeset
|
129 |
begin |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6395
diff
changeset
|
130 |
if hwRound(Me^.X) <> PrevX then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
131 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
132 |
PrevX:= hwRound(Me^.X); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
133 |
timedelta:= 0 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
134 |
end else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
135 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
136 |
inc(timedelta); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
137 |
if timedelta > 1700 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
138 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
139 |
timedelta:= 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
140 |
FreeActionsList |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
141 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
142 |
end |
6474
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6395
diff
changeset
|
143 |
end; |
42e9773eedfd
- Improve renderer a bit, disallow nested functions
unc0rr
parents:
6395
diff
changeset
|
144 |
|
64 | 145 |
procedure ProcessAction(var Actions: TActions; Me: PGear); |
4 | 146 |
var s: shortstring; |
147 |
begin |
|
194 | 148 |
repeat |
64 | 149 |
if Actions.Pos >= Actions.Count then exit; |
150 |
with Actions.actions[Actions.Pos] do |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
151 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
152 |
if Time > GameTicks then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
153 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
154 |
{$IFDEF TRACEAIACTIONS} |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
155 |
DumpAction(Actions.actions[Actions.Pos], Me); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
156 |
{$ENDIF} |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
157 |
if (Action and ai_specmask) <> 0 then |
4 | 158 |
case Action of |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
159 |
aia_Weapon: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
160 |
SetWeapon(TAmmoType(Param)); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
161 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
162 |
aia_WaitXL: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
163 |
if hwRound(Me^.X) = Param then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
164 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
165 |
Action:= aia_LookLeft; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
166 |
Time:= GameTicks; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
167 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
168 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
169 |
else if hwRound(Me^.X) < Param then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
170 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
171 |
//OutError('AI: WaitXL assert (' + IntToStr(hwRound(Me^.X)) + ' < ' + IntToStr(Param) + ')', false); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
172 |
FreeActionsList; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
173 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
174 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
175 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
176 |
begin CheckHang(Me); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
177 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
178 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
179 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
180 |
aia_WaitXR: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
181 |
if hwRound(Me^.X) = Param then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
182 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
183 |
Action:= aia_LookRight; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
184 |
Time:= GameTicks; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
185 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
186 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
187 |
else if hwRound(Me^.X) > Param then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
188 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
189 |
//OutError('AI: WaitXR assert (' + IntToStr(hwRound(Me^.X)) + ' > ' + IntToStr(Param) + ')', false); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
190 |
FreeActionsList; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
191 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
192 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
193 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
194 |
begin CheckHang(Me); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
195 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
196 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
197 |
aia_LookLeft: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
198 |
if not Me^.dX.isNegative then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
199 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
200 |
ParseCommand('+left', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
201 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
202 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
203 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
204 |
ParseCommand('-left', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
205 |
aia_LookRight: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
206 |
if Me^.dX.isNegative then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
207 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
208 |
ParseCommand('+right', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
209 |
exit |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
210 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
211 |
else ParseCommand('-right', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
212 |
aia_AwareExpl: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
213 |
AwareOfExplosion(X, Y, Param); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
214 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
215 |
aia_HJump: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
216 |
ParseCommand('hjump', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
217 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
218 |
aia_LJump: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
219 |
ParseCommand('ljump', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
220 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
221 |
aia_Skip: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
222 |
ParseCommand('skip', true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
223 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
224 |
aia_Put: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
225 |
doPut(X, Y, true); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
226 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
227 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
228 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
229 |
s:= ActionIdToStr[Action]; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
230 |
if (Param and ai_specmask) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
231 |
case Param of |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
232 |
aim_push: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
233 |
s:= '+' + s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
234 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
235 |
aim_release: |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
236 |
s:= '-' + s; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
237 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
238 |
else if Param <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
239 |
s:= s + ' ' + IntToStr(Param); |
369 | 240 |
ParseCommand(s, true) |
4 | 241 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
242 |
end; |
66
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
243 |
inc(Actions.Pos); |
9643d75baf1e
Many AI improvements, bots do think in separate thread
unc0rr
parents:
64
diff
changeset
|
244 |
if Actions.Pos <= Actions.Count then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6535
diff
changeset
|
245 |
inc(Actions.actions[Actions.Pos].Time, GameTicks); |
194 | 246 |
until false |
4 | 247 |
end; |
369 | 248 |
|
4 | 249 |
end. |