author | Xeli |
Wed, 23 May 2012 21:19:15 +0200 | |
changeset 7118 | dcdbb6fcc924 |
parent 6913 | 73984ea24ff5 |
child 7206 | ce46b56ae9f5 |
permissions | -rw-r--r-- |
3441 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
3441 | 4 |
* |
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 |
|
8 |
* |
|
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. |
|
13 |
* |
|
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 |
|
17 |
*) |
|
5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
18 |
|
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
19 |
(* |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
20 |
* This file contains the step handlers for visual gears. |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
21 |
* |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
22 |
* Since the effects of visual gears do not affect the course of the game, |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
23 |
* no "synchronization" between players is required. |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
24 |
* => The usage of safe functions or data types (e.g. GetRandom() or hwFloat) |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
25 |
* is usually not necessary and therefore undesirable. |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
26 |
*) |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
4976
diff
changeset
|
27 |
|
3441 | 28 |
procedure doStepFlake(Gear: PVisualGear; Steps: Longword); |
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
29 |
var sign: real; |
3441 | 30 |
begin |
3641 | 31 |
if vobCount = 0 then exit; |
3611 | 32 |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
33 |
sign:= 1; |
3441 | 34 |
with Gear^ do |
35 |
begin |
|
36 |
inc(FrameTicks, Steps); |
|
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
37 |
if not SuddenDeathDmg and (FrameTicks > vobFrameTicks) then |
3441 | 38 |
begin |
39 |
dec(FrameTicks, vobFrameTicks); |
|
40 |
inc(Frame); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
41 |
if Frame = vobFramesCount then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
42 |
Frame:= 0 |
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
43 |
end |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
44 |
else if SuddenDeathDmg and (FrameTicks > vobSDFrameTicks) then |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
45 |
begin |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
46 |
dec(FrameTicks, vobSDFrameTicks); |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
47 |
inc(Frame); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
48 |
if Frame = vobSDFramesCount then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
49 |
Frame:= 0 |
3441 | 50 |
end; |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
51 |
X:= X + (cWindSpeedf * 400 + dX + tdX) * Steps * Gear^.Scale; |
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
52 |
if SuddenDeathDmg then |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
53 |
Y:= Y + (dY + tdY + cGravityf * vobSDFallSpeed) * Steps * Gear^.Scale |
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
54 |
else |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
55 |
Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale; |
3441 | 56 |
Angle:= Angle + dAngle * Steps; |
4152
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
57 |
if Angle > 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
58 |
Angle:= Angle - 360 |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
59 |
else |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
60 |
if Angle < - 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
61 |
Angle:= Angle + 360; |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
62 |
|
3441 | 63 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
64 |
if (round(X) >= cLeftScreenBorder) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
65 |
and (round(X) <= cRightScreenBorder) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
66 |
and (round(Y) - 75 <= LAND_HEIGHT) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
67 |
and (Timer > 0) and (Timer-Steps > 0) then |
3441 | 68 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
69 |
if tdX > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
70 |
sign := 1 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
71 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
72 |
sign:= -1; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
73 |
tdX:= tdX - 0.005*Steps*sign; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
74 |
if ((sign < 0) and (tdX > 0)) or ((sign > 0) and (tdX < 0)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
75 |
tdX:= 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
76 |
if tdX > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
77 |
sign := 1 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
78 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
79 |
sign:= -1; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
80 |
tdY:= tdY - 0.005*Steps*sign; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
81 |
if ((sign < 0) and (tdY > 0)) or ((sign > 0) and (tdY < 0)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
82 |
tdY:= 0; |
3441 | 83 |
dec(Timer, Steps) |
84 |
end |
|
85 |
else |
|
86 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
87 |
if round(X) < cLeftScreenBorder then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
88 |
X:= X + cScreenSpace |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
89 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
90 |
if round(X) > cRightScreenBorder then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
91 |
X:= X - cScreenSpace; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
92 |
// if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
93 |
if (Gear^.Layer = 2) and (round(Y) - 225 > LAND_HEIGHT) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
94 |
Y:= Y - (1024 + 300) // TODO - configure in theme (jellies for example could use limited range) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
95 |
else if (Gear^.Layer <> 2) and (round(Y) + 50 > LAND_HEIGHT) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
96 |
Y:= Y - (1024 + 25); |
3441 | 97 |
Timer:= 0; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
98 |
tdX:= 0; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
99 |
tdY:= 0 |
3441 | 100 |
end; |
101 |
end; |
|
102 |
||
103 |
end; |
|
104 |
||
105 |
//////////////////////////////////////////////////////////////////////////////// |
|
106 |
procedure doStepBeeTrace(Gear: PVisualGear; Steps: Longword); |
|
107 |
begin |
|
108 |
if Gear^.FrameTicks > Steps then |
|
109 |
dec(Gear^.FrameTicks, Steps) |
|
110 |
else |
|
111 |
DeleteVisualGear(Gear); |
|
112 |
end; |
|
113 |
||
114 |
//////////////////////////////////////////////////////////////////////////////// |
|
115 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
116 |
var s: Longword; |
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
117 |
t: real; |
3441 | 118 |
begin |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
119 |
Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX * Gear^.Scale) * Steps; |
3441 | 120 |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
121 |
// up-and-down-bounce magic |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
122 |
s := (GameTicks + Gear^.Timer) mod 4096; |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
123 |
t := 8 * Gear^.Scale * hwFloat2Float(AngleSin(s mod 2048)); |
3597
978c30ef50fc
visual gears: fixing nemo's c-style assignment/multiplications
sheepluva
parents:
3593
diff
changeset
|
124 |
if (s < 2048) then t := -t; |
3441 | 125 |
|
4161 | 126 |
Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t; |
3441 | 127 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
128 |
if round(Gear^.X) < cLeftScreenBorder then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
129 |
Gear^.X:= Gear^.X + cScreenSpace |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
130 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
131 |
if round(Gear^.X) > cRightScreenBorder then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
132 |
Gear^.X:= Gear^.X - cScreenSpace |
3441 | 133 |
end; |
134 |
||
135 |
//////////////////////////////////////////////////////////////////////////////// |
|
136 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
|
137 |
begin |
|
138 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
139 |
||
140 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
141 |
//Gear^.dY:= Gear^.dY + cGravityf; |
3441 | 142 |
|
143 |
if Gear^.FrameTicks <= Steps then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
144 |
if Gear^.Frame = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
145 |
DeleteVisualGear(Gear) |
3441 | 146 |
else |
147 |
begin |
|
148 |
dec(Gear^.Frame); |
|
149 |
Gear^.FrameTicks:= cExplFrameTicks |
|
150 |
end |
|
151 |
else dec(Gear^.FrameTicks, Steps) |
|
152 |
end; |
|
153 |
||
154 |
//////////////////////////////////////////////////////////////////////////////// |
|
3704 | 155 |
procedure doStepNote(Gear: PVisualGear; Steps: Longword); |
156 |
begin |
|
157 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
158 |
||
159 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3706 | 160 |
Gear^.dY:= Gear^.dY + cGravityf * Steps / 2; |
3704 | 161 |
|
3706 | 162 |
Gear^.Angle:= Gear^.Angle + (Gear^.Frame + 1) * Steps / 10; |
163 |
while Gear^.Angle > cMaxAngle do |
|
164 |
Gear^.Angle:= Gear^.Angle - cMaxAngle; |
|
3704 | 165 |
|
166 |
if Gear^.FrameTicks <= Steps then |
|
167 |
DeleteVisualGear(Gear) |
|
168 |
else |
|
169 |
dec(Gear^.FrameTicks, Steps) |
|
170 |
end; |
|
171 |
||
172 |
//////////////////////////////////////////////////////////////////////////////// |
|
4279 | 173 |
procedure doStepLineTrail(Gear: PVisualGear; Steps: Longword); |
174 |
begin |
|
175 |
Steps := Steps; |
|
176 |
if Gear^.Timer <= Steps then |
|
177 |
DeleteVisualGear(Gear) |
|
178 |
else |
|
179 |
dec(Gear^.Timer, Steps) |
|
180 |
end; |
|
181 |
||
182 |
//////////////////////////////////////////////////////////////////////////////// |
|
3441 | 183 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
184 |
begin |
|
185 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
186 |
||
187 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
188 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 189 |
|
190 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
191 |
||
192 |
if Gear^.FrameTicks <= Steps then |
|
6128 | 193 |
begin |
194 |
DeleteVisualGear(Gear); |
|
195 |
exit |
|
196 |
end |
|
3441 | 197 |
else |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
198 |
dec(Gear^.FrameTicks, Steps); |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
199 |
|
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
200 |
if Gear^.FrameTicks < $FF then |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
201 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Gear^.FrameTicks |
3441 | 202 |
end; |
203 |
||
204 |
//////////////////////////////////////////////////////////////////////////////// |
|
205 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
3751 | 206 |
var vgt: PVisualGear; |
3441 | 207 |
begin |
208 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
209 |
||
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
210 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps); |
3751 | 211 |
if (Gear^.State and gstTmpFlag) = 0 then |
212 |
begin |
|
213 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
3764 | 214 |
if ((GameTicks mod 200) < Steps + 1) then |
3751 | 215 |
begin |
216 |
vgt:= AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtFire); |
|
217 |
if vgt <> nil then |
|
218 |
begin |
|
219 |
vgt^.dx:= 0; |
|
220 |
vgt^.dy:= 0; |
|
221 |
vgt^.State:= gstTmpFlag; |
|
222 |
end; |
|
223 |
end |
|
224 |
end |
|
225 |
else |
|
226 |
inc(Steps, Steps); |
|
3441 | 227 |
|
228 |
if Gear^.FrameTicks <= Steps then |
|
229 |
DeleteVisualGear(Gear) |
|
230 |
else |
|
231 |
dec(Gear^.FrameTicks, Steps) |
|
232 |
end; |
|
233 |
||
234 |
//////////////////////////////////////////////////////////////////////////////// |
|
235 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
236 |
begin |
|
237 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
238 |
||
239 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
240 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 241 |
|
242 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
243 |
||
244 |
if Gear^.FrameTicks <= Steps then |
|
245 |
DeleteVisualGear(Gear) |
|
246 |
else |
|
247 |
dec(Gear^.FrameTicks, Steps) |
|
248 |
end; |
|
249 |
||
250 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
251 |
begin |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
252 |
Gear^.Y:= Gear^.Y - 0.02 * Steps; |
3441 | 253 |
|
254 |
if Gear^.FrameTicks <= Steps then |
|
255 |
DeleteVisualGear(Gear) |
|
256 |
else |
|
257 |
dec(Gear^.FrameTicks, Steps) |
|
258 |
end; |
|
259 |
||
260 |
//////////////////////////////////////////////////////////////////////////////// |
|
261 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
262 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
263 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
264 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
265 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
266 |
Gear^.dX := Gear^.dX / (1.001 * Steps); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
267 |
Gear^.dY := Gear^.dY / (1.001 * Steps); |
3441 | 268 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
269 |
if (Gear^.FrameTicks <= Steps) or (round(Gear^.Y) < cWaterLine) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
270 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
271 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
272 |
dec(Gear^.FrameTicks, Steps) |
3441 | 273 |
end; |
274 |
||
275 |
//////////////////////////////////////////////////////////////////////////////// |
|
276 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
277 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
278 |
Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
279 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 280 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
281 |
if Gear^.FrameTicks <= Steps then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
282 |
if Gear^.Frame = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
283 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
284 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
285 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
286 |
if Random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
287 |
dec(Gear^.Frame); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
288 |
Gear^.FrameTicks:= cExplFrameTicks |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
289 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
290 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 291 |
end; |
292 |
||
293 |
//////////////////////////////////////////////////////////////////////////////// |
|
294 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
295 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
296 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 297 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
298 |
Gear^.scale:= Gear^.scale + 0.0025 * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
299 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
3441 | 300 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
301 |
if Gear^.alpha < 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
302 |
DeleteVisualGear(Gear) |
3441 | 303 |
end; |
304 |
||
305 |
//////////////////////////////////////////////////////////////////////////////// |
|
306 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
307 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
308 |
Gear^.X:= Gear^.X + (cWindSpeedf + Gear^.dX) * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
309 |
Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps; |
3441 | 310 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
311 |
Gear^.dX := Gear^.dX + (cWindSpeedf * 0.3 * Steps); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
312 |
//Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995); |
3441 | 313 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
314 |
if Gear^.FrameTicks <= Steps then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
315 |
if Gear^.Frame = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
316 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
317 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
318 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
319 |
if Random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
320 |
dec(Gear^.Frame); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
321 |
Gear^.FrameTicks:= cExplFrameTicks |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
322 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
323 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 324 |
end; |
325 |
||
326 |
//////////////////////////////////////////////////////////////////////////////// |
|
327 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
328 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
329 |
Gear^.X:= Gear^.X + (cWindSpeedf + (cWindSpeedf * 0.03 * Steps) + Gear^.dX) * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
330 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
3441 | 331 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
332 |
Gear^.dX := Gear^.dX - (Gear^.dX * 0.005 * Steps); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
333 |
Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * Steps); |
3441 | 334 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
335 |
if Gear^.FrameTicks <= Steps then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
336 |
if Gear^.Frame = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
337 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
338 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
339 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
340 |
dec(Gear^.Frame); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
341 |
Gear^.FrameTicks:= cExplFrameTicks |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
342 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
343 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 344 |
end; |
345 |
||
346 |
//////////////////////////////////////////////////////////////////////////////// |
|
347 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
348 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
349 |
if Gear^.FrameTicks <= Steps then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
350 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
351 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
352 |
dec(Gear^.FrameTicks, Steps); |
3441 | 353 |
end; |
354 |
||
355 |
//////////////////////////////////////////////////////////////////////////////// |
|
356 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
357 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
358 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
3441 | 359 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
360 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
361 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 362 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
363 |
if round(Gear^.Y) > cWaterLine then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
364 |
begin |
3441 | 365 |
DeleteVisualGear(Gear); |
366 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
367 |
end; |
|
368 |
end; |
|
369 |
||
370 |
//////////////////////////////////////////////////////////////////////////////// |
|
371 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
372 |
begin |
|
373 |
inc(Gear^.Timer, Steps); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
374 |
if Gear^.Timer >= Gear^.FrameTicks then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
375 |
DeleteVisualGear(Gear) |
3441 | 376 |
else |
377 |
begin |
|
378 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
379 |
Gear^.alpha := 1 - power(Gear^.Timer / 350, 4); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
380 |
if Gear^.alpha < 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
381 |
Gear^.alpha:= 0; |
3441 | 382 |
end; |
383 |
end; |
|
384 |
||
385 |
//////////////////////////////////////////////////////////////////////////////// |
|
386 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
387 |
begin |
|
388 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
389 |
||
390 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
391 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 392 |
|
393 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
394 |
||
395 |
if Gear^.FrameTicks <= Steps then |
|
396 |
DeleteVisualGear(Gear) |
|
397 |
else |
|
398 |
dec(Gear^.FrameTicks, Steps) |
|
399 |
end; |
|
400 |
||
401 |
//////////////////////////////////////////////////////////////////////////////// |
|
402 |
const cSorterWorkTime = 640; |
|
403 |
var thexchar: array[0..cMaxTeams] of |
|
404 |
record |
|
405 |
dy, ny, dw: LongInt; |
|
406 |
team: PTeam; |
|
407 |
SortFactor: QWord; |
|
408 |
end; |
|
409 |
currsorter: PVisualGear = nil; |
|
410 |
||
411 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
412 |
var i, t: LongInt; |
|
413 |
begin |
|
414 |
for t:= 1 to Steps do |
|
415 |
begin |
|
416 |
dec(Gear^.Timer); |
|
417 |
if (Gear^.Timer and 15) = 0 then |
|
418 |
for i:= 0 to Pred(TeamsCount) do |
|
419 |
with thexchar[i] do |
|
420 |
begin |
|
421 |
{$WARNINGS OFF} |
|
422 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div 640; |
|
423 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
424 |
{$WARNINGS ON} |
|
425 |
end; |
|
426 |
||
427 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
|
428 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
429 |
if currsorter = Gear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
430 |
currsorter:= nil; |
3441 | 431 |
DeleteVisualGear(Gear); |
432 |
exit |
|
433 |
end |
|
434 |
end |
|
435 |
end; |
|
436 |
||
437 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
438 |
var i: Longword; |
|
439 |
b: boolean; |
|
440 |
t: LongInt; |
|
441 |
begin |
|
442 |
Steps:= Steps; // avoid compiler hint |
|
443 |
for t:= 0 to Pred(TeamsCount) do |
|
444 |
with thexchar[t] do |
|
445 |
begin |
|
446 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
447 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
448 |
team:= TeamsArray[t]; |
|
449 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
450 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
451 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
452 |
end; |
|
453 |
||
454 |
if TeamsCount > 1 then |
|
455 |
repeat |
|
456 |
b:= true; |
|
457 |
for t:= 0 to TeamsCount - 2 do |
|
458 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
459 |
begin |
|
460 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
461 |
thexchar[t]:= thexchar[Succ(t)]; |
|
462 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
463 |
b:= false |
|
464 |
end |
|
465 |
until b; |
|
466 |
||
467 |
t:= - 4; |
|
468 |
for i:= 0 to Pred(TeamsCount) do |
|
469 |
with thexchar[i] do |
|
470 |
begin |
|
471 |
dec(t, team^.HealthTex^.h + 2); |
|
472 |
ny:= t; |
|
473 |
dy:= dy - ny |
|
474 |
end; |
|
475 |
||
476 |
Gear^.Timer:= cSorterWorkTime; |
|
477 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
478 |
currsorter:= Gear; |
|
479 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
480 |
end; |
|
481 |
||
482 |
//////////////////////////////////////////////////////////////////////////////// |
|
483 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
484 |
begin |
|
485 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
486 |
||
4365 | 487 |
if (Gear^.Hedgehog^.Gear <> nil) then |
3441 | 488 |
begin |
5151
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5121
diff
changeset
|
489 |
Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2 - Gear^.FrameTicks); |
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5121
diff
changeset
|
490 |
Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (16 + Gear^.Tex^.h); |
3441 | 491 |
end; |
492 |
||
493 |
if Gear^.Timer = 0 then |
|
494 |
begin |
|
4365 | 495 |
if Gear^.Hedgehog^.SpeechGear = Gear then |
496 |
Gear^.Hedgehog^.SpeechGear:= nil; |
|
3441 | 497 |
DeleteVisualGear(Gear) |
498 |
end; |
|
499 |
end; |
|
500 |
||
501 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
502 |
begin |
|
503 |
Steps:= Steps; // avoid compiler hint |
|
504 |
||
4365 | 505 |
with Gear^.Hedgehog^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
506 |
if SpeechGear <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
507 |
SpeechGear^.Timer:= 0; |
3441 | 508 |
|
4365 | 509 |
Gear^.Hedgehog^.SpeechGear:= Gear; |
3441 | 510 |
|
5186 | 511 |
Gear^.Timer:= max(LongInt(Length(Gear^.Text)) * 150, 3000); |
3441 | 512 |
|
513 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
514 |
||
515 |
case Gear^.FrameTicks of |
|
516 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
517 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
518 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
519 |
end; |
|
520 |
||
521 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
522 |
||
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
523 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h |
3441 | 524 |
end; |
525 |
||
526 |
//////////////////////////////////////////////////////////////////////////////// |
|
527 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
528 |
begin |
|
529 |
if Steps > Gear^.Timer then |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
530 |
DeleteVisualGear(Gear) |
3441 | 531 |
else |
532 |
begin |
|
533 |
dec(Gear^.Timer, Steps); |
|
534 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
5581 | 535 |
Gear^.X:= Gear^.X + Gear^.dX * Steps |
3441 | 536 |
end; |
537 |
end; |
|
538 |
||
539 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
540 |
begin |
|
4161 | 541 |
if round(Gear^.Y) - 10 < cWaterLine then |
3441 | 542 |
DeleteVisualGear(Gear) |
543 |
else |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
544 |
Gear^.Y:= Gear^.Y - 0.08 * Steps; |
3441 | 545 |
|
546 |
end; |
|
547 |
||
548 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
549 |
var s: shortstring; |
|
550 |
begin |
|
551 |
s:= ''; |
|
552 |
||
553 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
554 |
if Gear^.Hedgehog <> nil then |
4365 | 555 |
Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16) |
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
556 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
557 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 558 |
|
5578 | 559 |
Gear^.doStep:= @doStepHealthTagWork; |
5576 | 560 |
|
5596 | 561 |
if (round(Gear^.Y) > cWaterLine) and (Gear^.Frame = 0) then |
3441 | 562 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
563 |
||
4379
6cd6b77df8b8
No need for Extended data type just to draw some visual gears. It's a shame we have Math unit dependency
unC0Rr
parents:
4365
diff
changeset
|
564 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h; |
3441 | 565 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
566 |
if Steps > 1 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
567 |
Gear^.doStep(Gear, Steps-1); |
3441 | 568 |
end; |
569 |
||
570 |
//////////////////////////////////////////////////////////////////////////////// |
|
571 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
572 |
begin |
|
573 |
inc(Gear^.Timer, Steps ); |
|
574 |
if Gear^.Timer > 64 then |
|
575 |
begin |
|
3995
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
576 |
if Gear^.State = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
577 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
578 |
DeleteVisualGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
579 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
580 |
end; |
3441 | 581 |
dec(Gear^.State, Gear^.Timer div 65); |
582 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
583 |
end; |
|
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
584 |
Gear^.dX:= Gear^.dX + cWindSpeedf * Steps; |
3587 | 585 |
Gear^.X:= Gear^.X + Gear^.dX; |
3441 | 586 |
end; |
587 |
||
588 |
//////////////////////////////////////////////////////////////////////////////// |
|
589 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
590 |
begin |
|
591 |
inc(Gear^.Timer, Steps); |
|
592 |
if Gear^.Timer > 75 then |
|
593 |
begin |
|
594 |
inc(Gear^.State, Gear^.Timer div 76); |
|
595 |
Gear^.Timer:= Gear^.Timer mod 76; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
596 |
if Gear^.State > 5 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
597 |
DeleteVisualGear(Gear); |
3441 | 598 |
end; |
599 |
end; |
|
600 |
||
601 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
602 |
var i: LongWord; |
|
4473 | 603 |
gX,gY: LongInt; |
604 |
vg: PVisualGear; |
|
3441 | 605 |
begin |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
606 |
gX:= round(Gear^.X); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
607 |
gY:= round(Gear^.Y); |
4473 | 608 |
for i:= 0 to 31 do |
609 |
begin |
|
610 |
vg:= AddVisualGear(gX, gY, vgtFire); |
|
4475
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
611 |
if vg <> nil then |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
612 |
begin |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
613 |
vg^.State:= gstTmpFlag; |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
614 |
inc(vg^.FrameTicks, vg^.FrameTicks) |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
615 |
end |
4473 | 616 |
end; |
3590 | 617 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart); |
618 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart2); |
|
3441 | 619 |
Gear^.doStep:= @doStepExplosionWork; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
620 |
if Steps > 1 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
621 |
Gear^.doStep(Gear, Steps-1); |
3441 | 622 |
end; |
623 |
||
624 |
||
625 |
//////////////////////////////////////////////////////////////////////////////// |
|
626 |
procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
5855
74c621e12baa
I do believe the only thing that was *ever* wrong with camera shake was someone decided to use getRandom on something that had always been a visual effect anyway. Pretty sure WorldDx is in fact safe to modify.
nemo
parents:
5840
diff
changeset
|
627 |
var maxMovement: LongInt; |
3441 | 628 |
begin |
629 |
||
630 |
inc(Gear^.Timer, Steps); |
|
631 |
if (Gear^.Timer and 5) = 0 then |
|
632 |
begin |
|
633 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
634 |
ShakeCamera(maxMovement); |
|
635 |
end; |
|
5804
98192121dc69
Since shakes are still proving unsafe until camera is reworked, try a mild flash instead
nemo
parents:
5803
diff
changeset
|
636 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
637 |
if Gear^.Timer > 250 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
638 |
DeleteVisualGear(Gear); |
3441 | 639 |
end; |
640 |
||
641 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
642 |
var i: LongWord; |
|
4473 | 643 |
gX,gY: LongInt; |
644 |
vg: PVisualGear; |
|
3441 | 645 |
begin |
5855
74c621e12baa
I do believe the only thing that was *ever* wrong with camera shake was someone decided to use getRandom on something that had always been a visual effect anyway. Pretty sure WorldDx is in fact safe to modify.
nemo
parents:
5840
diff
changeset
|
646 |
//ScreenFade:= sfFromWhite; |
74c621e12baa
I do believe the only thing that was *ever* wrong with camera shake was someone decided to use getRandom on something that had always been a visual effect anyway. Pretty sure WorldDx is in fact safe to modify.
nemo
parents:
5840
diff
changeset
|
647 |
//ScreenFadeValue:= round(60 * zoom * zoom); |
74c621e12baa
I do believe the only thing that was *ever* wrong with camera shake was someone decided to use getRandom on something that had always been a visual effect anyway. Pretty sure WorldDx is in fact safe to modify.
nemo
parents:
5840
diff
changeset
|
648 |
//ScreenFadeSpeed:= 5; |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
649 |
gX:= round(Gear^.X); |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3592
diff
changeset
|
650 |
gY:= round(Gear^.Y); |
3441 | 651 |
AddVisualGear(gX, gY, vgtSmokeRing); |
4473 | 652 |
for i:= 0 to 46 do |
653 |
begin |
|
654 |
vg:= AddVisualGear(gX, gY, vgtFire); |
|
4475
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
655 |
if vg <> nil then |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
656 |
begin |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
657 |
vg^.State:= gstTmpFlag; |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
658 |
inc(vg^.FrameTicks, vg^.FrameTicks) |
54e78c40970b
rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents:
4473
diff
changeset
|
659 |
end |
4473 | 660 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
661 |
for i:= 0 to 15 do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
662 |
AddVisualGear(gX, gY, vgtExplPart); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
663 |
for i:= 0 to 15 do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
664 |
AddVisualGear(gX, gY, vgtExplPart2); |
3441 | 665 |
Gear^.doStep:= @doStepBigExplosionWork; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
666 |
if Steps > 1 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
667 |
Gear^.doStep(Gear, Steps-1); |
4034
634a8c8682de
add some phone rumbling to big explosions, airbomb and sinegun
koda
parents:
3995
diff
changeset
|
668 |
performRumble(); |
3441 | 669 |
end; |
3689 | 670 |
|
671 |
procedure doStepChunk(Gear: PVisualGear; Steps: Longword); |
|
672 |
begin |
|
673 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
674 |
||
675 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
676 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
677 |
||
678 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
679 |
||
5235
e30b06ffea3a
Skip droplets if plain splash is enabled, add a sanity check just in case.
nemo
parents:
5186
diff
changeset
|
680 |
if (round(Gear^.Y) > cWaterLine) and ((cReducedQuality and rqPlainSplash) = 0) then |
3689 | 681 |
begin |
3699 | 682 |
AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); |
3689 | 683 |
DeleteVisualGear(Gear); |
684 |
end |
|
685 |
end; |
|
4327 | 686 |
|
687 |
//////////////////////////////////////////////////////////////////////////////// |
|
688 |
procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
|
689 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
690 |
if Gear^.FrameTicks <= Steps then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
691 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
692 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
693 |
dec(Gear^.FrameTicks, Steps); |
4327 | 694 |
end; |
4420
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
695 |
|
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
696 |
//////////////////////////////////////////////////////////////////////////////// |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
697 |
procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
4452 | 698 |
var tmp: LongInt; |
4421 | 699 |
i: LongWord; |
4420
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
700 |
begin |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
701 |
with Gear^ do |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
702 |
if Frame <> 0 then |
4421 | 703 |
for i:= 1 to Steps do |
4420
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
704 |
begin |
4421 | 705 |
inc(FrameTicks); |
706 |
if (FrameTicks mod Frame) = 0 then |
|
707 |
begin |
|
708 |
tmp:= Gear^.Tint and $FF; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
709 |
if tdY >= 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
710 |
inc(tmp) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
711 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
712 |
dec(tmp); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
713 |
if tmp < round(dX) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
714 |
tdY:= 1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
715 |
if tmp > round(dY) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
716 |
tdY:= -1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
717 |
if tmp > 255 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
718 |
tmp := 255; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
719 |
if tmp < 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
720 |
tmp := 0; |
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5151
diff
changeset
|
721 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp) |
4421 | 722 |
end |
4420
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
723 |
end |
6be946bcd17a
Add a visual gear for drawing circles. Intent is to allow specifying areas on map for lua scripts (such as to indicate a location to go to). Could also be used to, say, circle a hog in CTF. Also add a "Critical" flag for visual gears so a gear flagges as such will always be created.
nemo
parents:
4379
diff
changeset
|
724 |
end; |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
725 |
|
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
726 |
//////////////////////////////////////////////////////////////////////////////// |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
727 |
procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword); |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
728 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
729 |
inc(Gear^.Timer, Steps); |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
730 |
|
6913 | 731 |
while Gear^.Timer >= 10 do |
732 |
begin |
|
733 |
dec(Gear^.Timer, 10); |
|
734 |
if WindBarWidth < Gear^.Tag then |
|
735 |
inc(WindBarWidth) |
|
736 |
else if WindBarWidth > Gear^.Tag then |
|
737 |
dec(WindBarWidth); |
|
738 |
end; |
|
739 |
if cWindspeedf > Gear^.dAngle then |
|
740 |
begin |
|
741 |
cWindspeedf := cWindspeedf - Gear^.Angle*Steps; |
|
742 |
if cWindspeedf < Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
743 |
end |
|
744 |
else if cWindspeedf < Gear^.dAngle then |
|
745 |
begin |
|
746 |
cWindspeedf := cWindspeedf + Gear^.Angle*Steps; |
|
747 |
if cWindspeedf > Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
748 |
end; |
|
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
749 |
|
6913 | 750 |
if (WindBarWidth = Gear^.Tag) and (cWindspeedf = Gear^.dAngle) then |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
751 |
DeleteVisualGear(Gear) |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
752 |
end; |
5562 | 753 |
//////////////////////////////////////////////////////////////////////////////// |
754 |
procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); |
|
755 |
begin |
|
756 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
757 |
Gear^.Y:= Gear^.Y - Gear^.dY * Steps; |
|
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
758 |
|
5562 | 759 |
if Gear^.FrameTicks <= Steps then |
760 |
DeleteVisualGear(Gear) |
|
761 |
else |
|
762 |
begin |
|
763 |
dec(Gear^.FrameTicks, Steps); |
|
764 |
if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then |
|
765 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500) |
|
766 |
end |
|
767 |
end; |
|
768 |