author | Matisumi |
Mon, 15 Apr 2013 19:25:19 +0200 | |
branch | 0.9.19 |
changeset 8890 | 8e463ab5639a |
parent 8204 | 9a6030d96273 |
child 8330 | aaefa587e277 |
child 9080 | 9b42757d7e71 |
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; |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
30 |
moved: boolean; |
3441 | 31 |
begin |
3641 | 32 |
if vobCount = 0 then exit; |
3611 | 33 |
|
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
|
34 |
sign:= 1; |
3441 | 35 |
with Gear^ do |
36 |
begin |
|
37 |
inc(FrameTicks, Steps); |
|
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
38 |
if not SuddenDeathDmg and (FrameTicks > vobFrameTicks) then |
3441 | 39 |
begin |
40 |
dec(FrameTicks, vobFrameTicks); |
|
41 |
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
|
42 |
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
|
43 |
Frame:= 0 |
4806
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
44 |
end |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
45 |
else if SuddenDeathDmg and (FrameTicks > vobSDFrameTicks) then |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
46 |
begin |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
47 |
dec(FrameTicks, vobSDFrameTicks); |
48c1a395f0a7
added flake configuration also in sudden death and SDClouds for underwater
Henek
parents:
4475
diff
changeset
|
48 |
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
|
49 |
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
|
50 |
Frame:= 0 |
3441 | 51 |
end; |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
else |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
56 |
Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps * Gear^.Scale; |
3441 | 57 |
Angle:= Angle + dAngle * Steps; |
4152
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
58 |
if Angle > 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
59 |
Angle:= Angle - 360 |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
60 |
else |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
61 |
if Angle < - 360 then |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
62 |
Angle:= Angle + 360; |
07008cb354f9
Prevent vgtFlake's rotation angle to grow too high in its absolute value
unc0rr
parents:
4034
diff
changeset
|
63 |
|
3441 | 64 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
and (Timer > 0) and (Timer-Steps > 0) then |
3441 | 69 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
70 |
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
|
71 |
sign := 1 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
72 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
tdX:= 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
77 |
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
|
78 |
sign := 1 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
79 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
tdY:= 0; |
3441 | 84 |
dec(Timer, Steps) |
85 |
end |
|
86 |
else |
|
87 |
begin |
|
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
88 |
moved:= false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
89 |
if round(X) < cLeftScreenBorder then |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
90 |
begin |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
91 |
X:= X + cScreenSpace; |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
92 |
moved:= true |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
93 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
94 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
95 |
if round(X) > cRightScreenBorder then |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
96 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
97 |
X:= X - cScreenSpace; |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
98 |
moved:= true |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
99 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
100 |
// if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? |
7206
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
101 |
if (Gear^.Layer = 2) and (round(Y) - 225 > LAND_HEIGHT) then |
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
102 |
begin |
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
103 |
X:= cLeftScreenBorder + random(cScreenSpace); |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
104 |
Y:= Y - (1024 + 250 + random(50)); // TODO - configure in theme (jellies for example could use limited range) |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
105 |
moved:= true |
7206
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
106 |
end |
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
107 |
else if (Gear^.Layer <> 2) and (round(Y) + 50 > LAND_HEIGHT) then |
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
108 |
begin |
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
109 |
X:= cLeftScreenBorder + random(cScreenSpace); |
7375
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
110 |
Y:= Y - (1024 + random(25)); |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
111 |
moved:= true |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
112 |
end; |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
113 |
if moved then |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
114 |
begin |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
115 |
Angle:= random(360); |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
116 |
dx:= 0.0000038654705 * random(10000); |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
117 |
dy:= 0.000003506096 * random(7000); |
16ae2e1c9005
Tell AI to avoid edges, especially ones over water (this does not include checking whether a knock could drown yet). Also make flakes pick a new random dx/dy on respawn to further reduce patterns. Also disable a couple of weapons for the particularly dumb AI levels, and disable switching for the dumbest.
nemo
parents:
7206
diff
changeset
|
118 |
if random(2) = 0 then dx := -dx |
7206
ce46b56ae9f5
Double sniper rifle damage (AI seems unaware of second shot, when playing). Spread out flakes along X when looping and add a little Y variation. This avoids noticeable patterns. Especially on the rarer close layer or dense flakes like rain (for Y)
nemo
parents:
6913
diff
changeset
|
119 |
end; |
3441 | 120 |
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
|
121 |
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
|
122 |
tdY:= 0 |
3441 | 123 |
end; |
124 |
end; |
|
125 |
||
126 |
end; |
|
127 |
||
128 |
//////////////////////////////////////////////////////////////////////////////// |
|
129 |
procedure doStepBeeTrace(Gear: PVisualGear; Steps: Longword); |
|
130 |
begin |
|
131 |
if Gear^.FrameTicks > Steps then |
|
132 |
dec(Gear^.FrameTicks, Steps) |
|
133 |
else |
|
134 |
DeleteVisualGear(Gear); |
|
135 |
end; |
|
136 |
||
137 |
//////////////////////////////////////////////////////////////////////////////// |
|
138 |
procedure doStepCloud(Gear: PVisualGear; Steps: Longword); |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
139 |
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
|
140 |
t: real; |
3441 | 141 |
begin |
6553
91365db8b82c
Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents:
6302
diff
changeset
|
142 |
Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX * Gear^.Scale) * Steps; |
3441 | 143 |
|
3592
0bcad5c38c9e
clouds: up-and-down-bouncing now without evil loop
sheepluva
parents:
3590
diff
changeset
|
144 |
// 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
|
145 |
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
|
146 |
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
|
147 |
if (s < 2048) then t := -t; |
3441 | 148 |
|
4161 | 149 |
Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t; |
3441 | 150 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
151 |
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
|
152 |
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
|
153 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
154 |
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
|
155 |
Gear^.X:= Gear^.X - cScreenSpace |
3441 | 156 |
end; |
157 |
||
158 |
//////////////////////////////////////////////////////////////////////////////// |
|
159 |
procedure doStepExpl(Gear: PVisualGear; Steps: Longword); |
|
7808 | 160 |
var s: LongInt; |
3441 | 161 |
begin |
7808 | 162 |
s:= min(Steps, cExplFrameTicks); |
3441 | 163 |
|
7808 | 164 |
Gear^.X:= Gear^.X + Gear^.dX * s; |
165 |
Gear^.Y:= Gear^.Y + Gear^.dY * s; |
|
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
|
166 |
//Gear^.dY:= Gear^.dY + cGravityf; |
3441 | 167 |
|
168 |
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
|
169 |
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
|
170 |
DeleteVisualGear(Gear) |
3441 | 171 |
else |
172 |
begin |
|
173 |
dec(Gear^.Frame); |
|
174 |
Gear^.FrameTicks:= cExplFrameTicks |
|
175 |
end |
|
176 |
else dec(Gear^.FrameTicks, Steps) |
|
177 |
end; |
|
178 |
||
179 |
//////////////////////////////////////////////////////////////////////////////// |
|
3704 | 180 |
procedure doStepNote(Gear: PVisualGear; Steps: Longword); |
181 |
begin |
|
182 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
183 |
||
184 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3706 | 185 |
Gear^.dY:= Gear^.dY + cGravityf * Steps / 2; |
3704 | 186 |
|
3706 | 187 |
Gear^.Angle:= Gear^.Angle + (Gear^.Frame + 1) * Steps / 10; |
188 |
while Gear^.Angle > cMaxAngle do |
|
189 |
Gear^.Angle:= Gear^.Angle - cMaxAngle; |
|
3704 | 190 |
|
191 |
if Gear^.FrameTicks <= Steps then |
|
192 |
DeleteVisualGear(Gear) |
|
193 |
else |
|
194 |
dec(Gear^.FrameTicks, Steps) |
|
195 |
end; |
|
196 |
||
197 |
//////////////////////////////////////////////////////////////////////////////// |
|
4279 | 198 |
procedure doStepLineTrail(Gear: PVisualGear; Steps: Longword); |
199 |
begin |
|
200 |
Steps := Steps; |
|
201 |
if Gear^.Timer <= Steps then |
|
202 |
DeleteVisualGear(Gear) |
|
203 |
else |
|
204 |
dec(Gear^.Timer, Steps) |
|
205 |
end; |
|
206 |
||
207 |
//////////////////////////////////////////////////////////////////////////////// |
|
3441 | 208 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
209 |
begin |
|
210 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
211 |
||
212 |
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
|
213 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 214 |
|
215 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
216 |
||
217 |
if Gear^.FrameTicks <= Steps then |
|
6128 | 218 |
begin |
219 |
DeleteVisualGear(Gear); |
|
220 |
exit |
|
221 |
end |
|
3441 | 222 |
else |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
223 |
dec(Gear^.FrameTicks, Steps); |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
224 |
|
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
225 |
if Gear^.FrameTicks < $FF then |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
226 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Gear^.FrameTicks |
3441 | 227 |
end; |
228 |
||
229 |
//////////////////////////////////////////////////////////////////////////////// |
|
230 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
3751 | 231 |
var vgt: PVisualGear; |
3441 | 232 |
begin |
233 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
234 |
||
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
|
235 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps); |
3751 | 236 |
if (Gear^.State and gstTmpFlag) = 0 then |
237 |
begin |
|
238 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
3764 | 239 |
if ((GameTicks mod 200) < Steps + 1) then |
3751 | 240 |
begin |
241 |
vgt:= AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtFire); |
|
242 |
if vgt <> nil then |
|
243 |
begin |
|
244 |
vgt^.dx:= 0; |
|
245 |
vgt^.dy:= 0; |
|
246 |
vgt^.State:= gstTmpFlag; |
|
247 |
end; |
|
248 |
end |
|
249 |
end |
|
250 |
else |
|
251 |
inc(Steps, Steps); |
|
3441 | 252 |
|
253 |
if Gear^.FrameTicks <= Steps then |
|
254 |
DeleteVisualGear(Gear) |
|
255 |
else |
|
256 |
dec(Gear^.FrameTicks, Steps) |
|
257 |
end; |
|
258 |
||
259 |
//////////////////////////////////////////////////////////////////////////////// |
|
260 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
261 |
begin |
|
262 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
263 |
||
264 |
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
|
265 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 266 |
|
267 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
268 |
||
269 |
if Gear^.FrameTicks <= Steps then |
|
270 |
DeleteVisualGear(Gear) |
|
271 |
else |
|
272 |
dec(Gear^.FrameTicks, Steps) |
|
273 |
end; |
|
274 |
||
275 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
276 |
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
|
277 |
Gear^.Y:= Gear^.Y - 0.02 * Steps; |
3441 | 278 |
|
279 |
if Gear^.FrameTicks <= Steps then |
|
280 |
DeleteVisualGear(Gear) |
|
281 |
else |
|
282 |
dec(Gear^.FrameTicks, Steps) |
|
283 |
end; |
|
284 |
||
285 |
//////////////////////////////////////////////////////////////////////////////// |
|
286 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
287 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
288 |
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
|
289 |
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
|
290 |
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
|
291 |
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
|
292 |
Gear^.dY := Gear^.dY / (1.001 * Steps); |
3441 | 293 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
294 |
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
|
295 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
296 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
297 |
dec(Gear^.FrameTicks, Steps) |
3441 | 298 |
end; |
299 |
||
300 |
//////////////////////////////////////////////////////////////////////////////// |
|
301 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
302 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
303 |
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
|
304 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 305 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
306 |
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
|
307 |
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
|
308 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
309 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
310 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
311 |
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
|
312 |
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
|
313 |
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
|
314 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
315 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 316 |
end; |
317 |
||
318 |
//////////////////////////////////////////////////////////////////////////////// |
|
319 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
320 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
321 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 322 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
323 |
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
|
324 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
3441 | 325 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
326 |
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
|
327 |
DeleteVisualGear(Gear) |
3441 | 328 |
end; |
329 |
||
330 |
//////////////////////////////////////////////////////////////////////////////// |
|
331 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
332 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
333 |
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
|
334 |
Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps; |
3441 | 335 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
336 |
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
|
337 |
//Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995); |
3441 | 338 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
339 |
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
|
340 |
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
|
341 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
342 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
343 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
344 |
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
|
345 |
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
|
346 |
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
|
347 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
348 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 349 |
end; |
350 |
||
351 |
//////////////////////////////////////////////////////////////////////////////// |
|
352 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
353 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
354 |
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
|
355 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
3441 | 356 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
357 |
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
|
358 |
Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * 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 |
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
|
361 |
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
|
362 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
363 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
364 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
365 |
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
|
366 |
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
|
367 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
368 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 369 |
end; |
370 |
||
371 |
//////////////////////////////////////////////////////////////////////////////// |
|
372 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
373 |
begin |
|
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^.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
|
375 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
376 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
377 |
dec(Gear^.FrameTicks, Steps); |
3441 | 378 |
end; |
379 |
||
380 |
//////////////////////////////////////////////////////////////////////////////// |
|
381 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
382 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
383 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
3441 | 384 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
385 |
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
|
386 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 387 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
388 |
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
|
389 |
begin |
3441 | 390 |
DeleteVisualGear(Gear); |
391 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
392 |
end; |
|
393 |
end; |
|
394 |
||
395 |
//////////////////////////////////////////////////////////////////////////////// |
|
396 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
397 |
begin |
|
398 |
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
|
399 |
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
|
400 |
DeleteVisualGear(Gear) |
3441 | 401 |
else |
402 |
begin |
|
403 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
404 |
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
|
405 |
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
|
406 |
Gear^.alpha:= 0; |
3441 | 407 |
end; |
408 |
end; |
|
409 |
||
410 |
//////////////////////////////////////////////////////////////////////////////// |
|
411 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
412 |
begin |
|
413 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
414 |
||
415 |
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
|
416 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 417 |
|
418 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
419 |
||
420 |
if Gear^.FrameTicks <= Steps then |
|
421 |
DeleteVisualGear(Gear) |
|
422 |
else |
|
423 |
dec(Gear^.FrameTicks, Steps) |
|
424 |
end; |
|
425 |
||
426 |
//////////////////////////////////////////////////////////////////////////////// |
|
427 |
const cSorterWorkTime = 640; |
|
428 |
var thexchar: array[0..cMaxTeams] of |
|
429 |
record |
|
430 |
dy, ny, dw: LongInt; |
|
431 |
team: PTeam; |
|
432 |
SortFactor: QWord; |
|
433 |
end; |
|
434 |
currsorter: PVisualGear = nil; |
|
435 |
||
436 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
437 |
var i, t: LongInt; |
|
438 |
begin |
|
7644 | 439 |
for t:= 1 to min(Steps, Gear^.Timer) do |
3441 | 440 |
begin |
441 |
dec(Gear^.Timer); |
|
442 |
if (Gear^.Timer and 15) = 0 then |
|
443 |
for i:= 0 to Pred(TeamsCount) do |
|
444 |
with thexchar[i] do |
|
445 |
begin |
|
446 |
{$WARNINGS OFF} |
|
7644 | 447 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div cSorterWorkTime; |
3441 | 448 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
449 |
{$WARNINGS ON} |
|
450 |
end; |
|
7644 | 451 |
end; |
3441 | 452 |
|
7644 | 453 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
454 |
begin |
|
455 |
if currsorter = Gear then |
|
456 |
currsorter:= nil; |
|
457 |
DeleteVisualGear(Gear); |
|
458 |
exit |
|
3441 | 459 |
end |
460 |
end; |
|
461 |
||
462 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
463 |
var i: Longword; |
|
464 |
b: boolean; |
|
465 |
t: LongInt; |
|
466 |
begin |
|
467 |
Steps:= Steps; // avoid compiler hint |
|
7644 | 468 |
|
3441 | 469 |
for t:= 0 to Pred(TeamsCount) do |
470 |
with thexchar[t] do |
|
471 |
begin |
|
472 |
team:= TeamsArray[t]; |
|
7644 | 473 |
dy:= team^.DrawHealthY; |
474 |
dw:= team^.TeamHealthBarWidth - team^.NewTeamHealthBarWidth; |
|
475 |
if team^.TeamHealth > 0 then |
|
476 |
begin |
|
477 |
SortFactor:= team^.Clan^.ClanHealth; |
|
478 |
SortFactor:= (SortFactor shl 3) + team^.Clan^.ClanIndex; |
|
479 |
SortFactor:= (SortFactor shl 30) + team^.TeamHealth; |
|
480 |
end |
|
481 |
else |
|
482 |
SortFactor:= 0; |
|
3441 | 483 |
end; |
484 |
||
485 |
if TeamsCount > 1 then |
|
486 |
repeat |
|
487 |
b:= true; |
|
488 |
for t:= 0 to TeamsCount - 2 do |
|
489 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
490 |
begin |
|
491 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
492 |
thexchar[t]:= thexchar[Succ(t)]; |
|
493 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
494 |
b:= false |
|
495 |
end |
|
496 |
until b; |
|
497 |
||
498 |
t:= - 4; |
|
499 |
for i:= 0 to Pred(TeamsCount) do |
|
7644 | 500 |
with thexchar[i] do |
501 |
if team^.TeamHealth > 0 then |
|
502 |
begin |
|
503 |
dec(t, team^.HealthTex^.h + 2); |
|
504 |
ny:= t; |
|
505 |
dy:= dy - ny |
|
506 |
end; |
|
3441 | 507 |
|
508 |
Gear^.Timer:= cSorterWorkTime; |
|
509 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
510 |
currsorter:= Gear; |
|
511 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
512 |
end; |
|
513 |
||
514 |
//////////////////////////////////////////////////////////////////////////////// |
|
515 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
516 |
begin |
|
517 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
518 |
||
4365 | 519 |
if (Gear^.Hedgehog^.Gear <> nil) then |
3441 | 520 |
begin |
5151
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5121
diff
changeset
|
521 |
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
|
522 |
Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (16 + Gear^.Tex^.h); |
3441 | 523 |
end; |
524 |
||
525 |
if Gear^.Timer = 0 then |
|
526 |
begin |
|
4365 | 527 |
if Gear^.Hedgehog^.SpeechGear = Gear then |
528 |
Gear^.Hedgehog^.SpeechGear:= nil; |
|
3441 | 529 |
DeleteVisualGear(Gear) |
530 |
end; |
|
531 |
end; |
|
532 |
||
533 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
534 |
begin |
|
535 |
Steps:= Steps; // avoid compiler hint |
|
536 |
||
4365 | 537 |
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
|
538 |
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
|
539 |
SpeechGear^.Timer:= 0; |
3441 | 540 |
|
4365 | 541 |
Gear^.Hedgehog^.SpeechGear:= Gear; |
3441 | 542 |
|
5186 | 543 |
Gear^.Timer:= max(LongInt(Length(Gear^.Text)) * 150, 3000); |
3441 | 544 |
|
545 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
546 |
||
547 |
case Gear^.FrameTicks of |
|
548 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
549 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
550 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
551 |
end; |
|
552 |
||
553 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
554 |
||
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
|
555 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h |
3441 | 556 |
end; |
557 |
||
558 |
//////////////////////////////////////////////////////////////////////////////// |
|
559 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
560 |
begin |
|
561 |
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
|
562 |
DeleteVisualGear(Gear) |
3441 | 563 |
else |
564 |
begin |
|
565 |
dec(Gear^.Timer, Steps); |
|
566 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
5581 | 567 |
Gear^.X:= Gear^.X + Gear^.dX * Steps |
3441 | 568 |
end; |
569 |
end; |
|
570 |
||
571 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
572 |
begin |
|
4161 | 573 |
if round(Gear^.Y) - 10 < cWaterLine then |
3441 | 574 |
DeleteVisualGear(Gear) |
575 |
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
|
576 |
Gear^.Y:= Gear^.Y - 0.08 * Steps; |
3441 | 577 |
|
578 |
end; |
|
579 |
||
580 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
581 |
var s: shortstring; |
|
582 |
begin |
|
583 |
s:= ''; |
|
584 |
||
585 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
586 |
if Gear^.Hedgehog <> nil then |
4365 | 587 |
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
|
588 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
589 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 590 |
|
5578 | 591 |
Gear^.doStep:= @doStepHealthTagWork; |
5576 | 592 |
|
5596 | 593 |
if (round(Gear^.Y) > cWaterLine) and (Gear^.Frame = 0) then |
3441 | 594 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
595 |
||
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
|
596 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h; |
3441 | 597 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
598 |
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
|
599 |
Gear^.doStep(Gear, Steps-1); |
3441 | 600 |
end; |
601 |
||
602 |
//////////////////////////////////////////////////////////////////////////////// |
|
603 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
604 |
begin |
|
605 |
inc(Gear^.Timer, Steps ); |
|
606 |
if Gear^.Timer > 64 then |
|
607 |
begin |
|
3995
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
608 |
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
|
609 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
610 |
DeleteVisualGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
611 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
612 |
end; |
3441 | 613 |
dec(Gear^.State, Gear^.Timer div 65); |
614 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
615 |
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
|
616 |
Gear^.dX:= Gear^.dX + cWindSpeedf * Steps; |
3587 | 617 |
Gear^.X:= Gear^.X + Gear^.dX; |
3441 | 618 |
end; |
619 |
||
620 |
//////////////////////////////////////////////////////////////////////////////// |
|
621 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
622 |
begin |
|
623 |
inc(Gear^.Timer, Steps); |
|
624 |
if Gear^.Timer > 75 then |
|
625 |
begin |
|
626 |
inc(Gear^.State, Gear^.Timer div 76); |
|
627 |
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
|
628 |
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
|
629 |
DeleteVisualGear(Gear); |
3441 | 630 |
end; |
631 |
end; |
|
632 |
||
633 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
634 |
var i: LongWord; |
|
4473 | 635 |
gX,gY: LongInt; |
636 |
vg: PVisualGear; |
|
3441 | 637 |
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
|
638 |
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
|
639 |
gY:= round(Gear^.Y); |
4473 | 640 |
for i:= 0 to 31 do |
641 |
begin |
|
642 |
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
|
643 |
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
|
644 |
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
|
645 |
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
|
646 |
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
|
647 |
end |
4473 | 648 |
end; |
3590 | 649 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart); |
650 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart2); |
|
3441 | 651 |
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
|
652 |
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
|
653 |
Gear^.doStep(Gear, Steps-1); |
3441 | 654 |
end; |
655 |
||
656 |
||
657 |
//////////////////////////////////////////////////////////////////////////////// |
|
658 |
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
|
659 |
var maxMovement: LongInt; |
3441 | 660 |
begin |
661 |
||
662 |
inc(Gear^.Timer, Steps); |
|
663 |
if (Gear^.Timer and 5) = 0 then |
|
664 |
begin |
|
665 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
666 |
ShakeCamera(maxMovement); |
|
667 |
end; |
|
5804
98192121dc69
Since shakes are still proving unsafe until camera is reworked, try a mild flash instead
nemo
parents:
5803
diff
changeset
|
668 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
669 |
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
|
670 |
DeleteVisualGear(Gear); |
3441 | 671 |
end; |
672 |
||
673 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
674 |
var i: LongWord; |
|
4473 | 675 |
gX,gY: LongInt; |
676 |
vg: PVisualGear; |
|
3441 | 677 |
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
|
678 |
//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
|
679 |
//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
|
680 |
//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
|
681 |
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
|
682 |
gY:= round(Gear^.Y); |
3441 | 683 |
AddVisualGear(gX, gY, vgtSmokeRing); |
4473 | 684 |
for i:= 0 to 46 do |
685 |
begin |
|
686 |
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
|
687 |
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
|
688 |
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
|
689 |
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
|
690 |
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
|
691 |
end |
4473 | 692 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
693 |
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
|
694 |
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
|
695 |
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
|
696 |
AddVisualGear(gX, gY, vgtExplPart2); |
3441 | 697 |
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
|
698 |
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
|
699 |
Gear^.doStep(Gear, Steps-1); |
8204 | 700 |
with mobileRecord do |
701 |
if (performRumble <> nil) and (not fastUntilLag) then |
|
702 |
performRumble(kSystemSoundID_Vibrate); |
|
3441 | 703 |
end; |
3689 | 704 |
|
705 |
procedure doStepChunk(Gear: PVisualGear; Steps: Longword); |
|
706 |
begin |
|
707 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
708 |
||
709 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
710 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
711 |
||
712 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
713 |
||
5235
e30b06ffea3a
Skip droplets if plain splash is enabled, add a sanity check just in case.
nemo
parents:
5186
diff
changeset
|
714 |
if (round(Gear^.Y) > cWaterLine) and ((cReducedQuality and rqPlainSplash) = 0) then |
3689 | 715 |
begin |
3699 | 716 |
AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); |
3689 | 717 |
DeleteVisualGear(Gear); |
718 |
end |
|
719 |
end; |
|
4327 | 720 |
|
721 |
//////////////////////////////////////////////////////////////////////////////// |
|
722 |
procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
|
723 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
724 |
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
|
725 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
726 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
727 |
dec(Gear^.FrameTicks, Steps); |
4327 | 728 |
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
|
729 |
|
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
|
730 |
//////////////////////////////////////////////////////////////////////////////// |
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
|
731 |
procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
4452 | 732 |
var tmp: LongInt; |
4421 | 733 |
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
|
734 |
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
|
735 |
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
|
736 |
if Frame <> 0 then |
4421 | 737 |
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
|
738 |
begin |
4421 | 739 |
inc(FrameTicks); |
740 |
if (FrameTicks mod Frame) = 0 then |
|
741 |
begin |
|
742 |
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
|
743 |
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
|
744 |
inc(tmp) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
745 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
746 |
dec(tmp); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
747 |
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
|
748 |
tdY:= 1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
749 |
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
|
750 |
tdY:= -1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
751 |
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
|
752 |
tmp := 255; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
753 |
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
|
754 |
tmp := 0; |
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5151
diff
changeset
|
755 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp) |
4421 | 756 |
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
|
757 |
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
|
758 |
end; |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
759 |
|
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
760 |
//////////////////////////////////////////////////////////////////////////////// |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
761 |
procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword); |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
762 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
763 |
inc(Gear^.Timer, Steps); |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
764 |
|
6913 | 765 |
while Gear^.Timer >= 10 do |
766 |
begin |
|
767 |
dec(Gear^.Timer, 10); |
|
768 |
if WindBarWidth < Gear^.Tag then |
|
769 |
inc(WindBarWidth) |
|
770 |
else if WindBarWidth > Gear^.Tag then |
|
771 |
dec(WindBarWidth); |
|
772 |
end; |
|
773 |
if cWindspeedf > Gear^.dAngle then |
|
774 |
begin |
|
775 |
cWindspeedf := cWindspeedf - Gear^.Angle*Steps; |
|
776 |
if cWindspeedf < Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
777 |
end |
|
778 |
else if cWindspeedf < Gear^.dAngle then |
|
779 |
begin |
|
780 |
cWindspeedf := cWindspeedf + Gear^.Angle*Steps; |
|
781 |
if cWindspeedf > Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
782 |
end; |
|
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
783 |
|
6913 | 784 |
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
|
785 |
DeleteVisualGear(Gear) |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
786 |
end; |
5562 | 787 |
//////////////////////////////////////////////////////////////////////////////// |
788 |
procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); |
|
789 |
begin |
|
790 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
791 |
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
|
792 |
|
5562 | 793 |
if Gear^.FrameTicks <= Steps then |
794 |
DeleteVisualGear(Gear) |
|
795 |
else |
|
796 |
begin |
|
797 |
dec(Gear^.FrameTicks, Steps); |
|
798 |
if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then |
|
799 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500) |
|
800 |
end |
|
801 |
end; |
|
802 |