author | Medo <smaxein@googlemail.com> |
Sun, 12 Aug 2012 22:21:09 +0200 | |
changeset 7479 | c8c552ee3acb |
parent 7375 | 16ae2e1c9005 |
child 7644 | ed7fecd0f5fd |
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); |
|
160 |
begin |
|
161 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
162 |
||
163 |
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
|
164 |
//Gear^.dY:= Gear^.dY + cGravityf; |
3441 | 165 |
|
166 |
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
|
167 |
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
|
168 |
DeleteVisualGear(Gear) |
3441 | 169 |
else |
170 |
begin |
|
171 |
dec(Gear^.Frame); |
|
172 |
Gear^.FrameTicks:= cExplFrameTicks |
|
173 |
end |
|
174 |
else dec(Gear^.FrameTicks, Steps) |
|
175 |
end; |
|
176 |
||
177 |
//////////////////////////////////////////////////////////////////////////////// |
|
3704 | 178 |
procedure doStepNote(Gear: PVisualGear; Steps: Longword); |
179 |
begin |
|
180 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
181 |
||
182 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
3706 | 183 |
Gear^.dY:= Gear^.dY + cGravityf * Steps / 2; |
3704 | 184 |
|
3706 | 185 |
Gear^.Angle:= Gear^.Angle + (Gear^.Frame + 1) * Steps / 10; |
186 |
while Gear^.Angle > cMaxAngle do |
|
187 |
Gear^.Angle:= Gear^.Angle - cMaxAngle; |
|
3704 | 188 |
|
189 |
if Gear^.FrameTicks <= Steps then |
|
190 |
DeleteVisualGear(Gear) |
|
191 |
else |
|
192 |
dec(Gear^.FrameTicks, Steps) |
|
193 |
end; |
|
194 |
||
195 |
//////////////////////////////////////////////////////////////////////////////// |
|
4279 | 196 |
procedure doStepLineTrail(Gear: PVisualGear; Steps: Longword); |
197 |
begin |
|
198 |
Steps := Steps; |
|
199 |
if Gear^.Timer <= Steps then |
|
200 |
DeleteVisualGear(Gear) |
|
201 |
else |
|
202 |
dec(Gear^.Timer, Steps) |
|
203 |
end; |
|
204 |
||
205 |
//////////////////////////////////////////////////////////////////////////////// |
|
3441 | 206 |
procedure doStepEgg(Gear: PVisualGear; Steps: Longword); |
207 |
begin |
|
208 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
209 |
||
210 |
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
|
211 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 212 |
|
213 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
214 |
||
215 |
if Gear^.FrameTicks <= Steps then |
|
6128 | 216 |
begin |
217 |
DeleteVisualGear(Gear); |
|
218 |
exit |
|
219 |
end |
|
3441 | 220 |
else |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
221 |
dec(Gear^.FrameTicks, Steps); |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
222 |
|
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
223 |
if Gear^.FrameTicks < $FF then |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5855
diff
changeset
|
224 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Gear^.FrameTicks |
3441 | 225 |
end; |
226 |
||
227 |
//////////////////////////////////////////////////////////////////////////////// |
|
228 |
procedure doStepFire(Gear: PVisualGear; Steps: Longword); |
|
3751 | 229 |
var vgt: PVisualGear; |
3441 | 230 |
begin |
231 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
232 |
||
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
|
233 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps); |
3751 | 234 |
if (Gear^.State and gstTmpFlag) = 0 then |
235 |
begin |
|
236 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
3764 | 237 |
if ((GameTicks mod 200) < Steps + 1) then |
3751 | 238 |
begin |
239 |
vgt:= AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtFire); |
|
240 |
if vgt <> nil then |
|
241 |
begin |
|
242 |
vgt^.dx:= 0; |
|
243 |
vgt^.dy:= 0; |
|
244 |
vgt^.State:= gstTmpFlag; |
|
245 |
end; |
|
246 |
end |
|
247 |
end |
|
248 |
else |
|
249 |
inc(Steps, Steps); |
|
3441 | 250 |
|
251 |
if Gear^.FrameTicks <= Steps then |
|
252 |
DeleteVisualGear(Gear) |
|
253 |
else |
|
254 |
dec(Gear^.FrameTicks, Steps) |
|
255 |
end; |
|
256 |
||
257 |
//////////////////////////////////////////////////////////////////////////////// |
|
258 |
procedure doStepShell(Gear: PVisualGear; Steps: Longword); |
|
259 |
begin |
|
260 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
261 |
||
262 |
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
|
263 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 264 |
|
265 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
266 |
||
267 |
if Gear^.FrameTicks <= Steps then |
|
268 |
DeleteVisualGear(Gear) |
|
269 |
else |
|
270 |
dec(Gear^.FrameTicks, Steps) |
|
271 |
end; |
|
272 |
||
273 |
procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword); |
|
274 |
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
|
275 |
Gear^.Y:= Gear^.Y - 0.02 * Steps; |
3441 | 276 |
|
277 |
if Gear^.FrameTicks <= Steps then |
|
278 |
DeleteVisualGear(Gear) |
|
279 |
else |
|
280 |
dec(Gear^.FrameTicks, Steps) |
|
281 |
end; |
|
282 |
||
283 |
//////////////////////////////////////////////////////////////////////////////// |
|
284 |
procedure doStepBubble(Gear: PVisualGear; Steps: Longword); |
|
285 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
286 |
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
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
Gear^.dY := Gear^.dY / (1.001 * Steps); |
3441 | 291 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
292 |
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
|
293 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
294 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
295 |
dec(Gear^.FrameTicks, Steps) |
3441 | 296 |
end; |
297 |
||
298 |
//////////////////////////////////////////////////////////////////////////////// |
|
299 |
procedure doStepSteam(Gear: PVisualGear; Steps: Longword); |
|
300 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
301 |
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
|
302 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 303 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
304 |
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
|
305 |
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
|
306 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
307 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
308 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
313 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 314 |
end; |
315 |
||
316 |
//////////////////////////////////////////////////////////////////////////////// |
|
317 |
procedure doStepAmmo(Gear: PVisualGear; Steps: Longword); |
|
318 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
319 |
Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps; |
3441 | 320 |
|
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^.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
|
322 |
Gear^.alpha:= Gear^.alpha - 0.0015 * Steps; |
3441 | 323 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
324 |
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
|
325 |
DeleteVisualGear(Gear) |
3441 | 326 |
end; |
327 |
||
328 |
//////////////////////////////////////////////////////////////////////////////// |
|
329 |
procedure doStepSmoke(Gear: PVisualGear; Steps: Longword); |
|
330 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
331 |
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
|
332 |
Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps; |
3441 | 333 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
334 |
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
|
335 |
//Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995); |
3441 | 336 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
337 |
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
|
338 |
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
|
339 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
340 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
341 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
342 |
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
|
343 |
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
|
344 |
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
|
345 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
346 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 347 |
end; |
348 |
||
349 |
//////////////////////////////////////////////////////////////////////////////// |
|
350 |
procedure doStepDust(Gear: PVisualGear; Steps: Longword); |
|
351 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
352 |
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
|
353 |
Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps; |
3441 | 354 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
355 |
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
|
356 |
Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * Steps); |
3441 | 357 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
358 |
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
|
359 |
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
|
360 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
361 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
362 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
363 |
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
|
364 |
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
|
365 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
366 |
else dec(Gear^.FrameTicks, Steps) |
3441 | 367 |
end; |
368 |
||
369 |
//////////////////////////////////////////////////////////////////////////////// |
|
370 |
procedure doStepSplash(Gear: PVisualGear; Steps: Longword); |
|
371 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
372 |
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
|
373 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
374 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
375 |
dec(Gear^.FrameTicks, Steps); |
3441 | 376 |
end; |
377 |
||
378 |
//////////////////////////////////////////////////////////////////////////////// |
|
379 |
procedure doStepDroplet(Gear: PVisualGear; Steps: Longword); |
|
380 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
381 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
3441 | 382 |
|
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^.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
|
384 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 385 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
386 |
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
|
387 |
begin |
3441 | 388 |
DeleteVisualGear(Gear); |
389 |
PlaySound(TSound(ord(sndDroplet1) + Random(3))); |
|
390 |
end; |
|
391 |
end; |
|
392 |
||
393 |
//////////////////////////////////////////////////////////////////////////////// |
|
394 |
procedure doStepSmokeRing(Gear: PVisualGear; Steps: Longword); |
|
395 |
begin |
|
396 |
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
|
397 |
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
|
398 |
DeleteVisualGear(Gear) |
3441 | 399 |
else |
400 |
begin |
|
401 |
Gear^.scale := 1.25 * (-power(2, -10 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4; |
|
402 |
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
|
403 |
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
|
404 |
Gear^.alpha:= 0; |
3441 | 405 |
end; |
406 |
end; |
|
407 |
||
408 |
//////////////////////////////////////////////////////////////////////////////// |
|
409 |
procedure doStepFeather(Gear: PVisualGear; Steps: Longword); |
|
410 |
begin |
|
411 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
412 |
||
413 |
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
|
414 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
3441 | 415 |
|
416 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
417 |
||
418 |
if Gear^.FrameTicks <= Steps then |
|
419 |
DeleteVisualGear(Gear) |
|
420 |
else |
|
421 |
dec(Gear^.FrameTicks, Steps) |
|
422 |
end; |
|
423 |
||
424 |
//////////////////////////////////////////////////////////////////////////////// |
|
425 |
const cSorterWorkTime = 640; |
|
426 |
var thexchar: array[0..cMaxTeams] of |
|
427 |
record |
|
428 |
dy, ny, dw: LongInt; |
|
429 |
team: PTeam; |
|
430 |
SortFactor: QWord; |
|
431 |
end; |
|
432 |
currsorter: PVisualGear = nil; |
|
433 |
||
434 |
procedure doStepTeamHealthSorterWork(Gear: PVisualGear; Steps: Longword); |
|
435 |
var i, t: LongInt; |
|
436 |
begin |
|
437 |
for t:= 1 to Steps do |
|
438 |
begin |
|
439 |
dec(Gear^.Timer); |
|
440 |
if (Gear^.Timer and 15) = 0 then |
|
441 |
for i:= 0 to Pred(TeamsCount) do |
|
442 |
with thexchar[i] do |
|
443 |
begin |
|
444 |
{$WARNINGS OFF} |
|
445 |
team^.DrawHealthY:= ny + dy * LongInt(Gear^.Timer) div 640; |
|
446 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * LongInt(Gear^.Timer) div cSorterWorkTime; |
|
447 |
{$WARNINGS ON} |
|
448 |
end; |
|
449 |
||
450 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
|
451 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
452 |
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
|
453 |
currsorter:= nil; |
3441 | 454 |
DeleteVisualGear(Gear); |
455 |
exit |
|
456 |
end |
|
457 |
end |
|
458 |
end; |
|
459 |
||
460 |
procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword); |
|
461 |
var i: Longword; |
|
462 |
b: boolean; |
|
463 |
t: LongInt; |
|
464 |
begin |
|
465 |
Steps:= Steps; // avoid compiler hint |
|
466 |
for t:= 0 to Pred(TeamsCount) do |
|
467 |
with thexchar[t] do |
|
468 |
begin |
|
469 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
470 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
471 |
team:= TeamsArray[t]; |
|
472 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
473 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
474 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
475 |
end; |
|
476 |
||
477 |
if TeamsCount > 1 then |
|
478 |
repeat |
|
479 |
b:= true; |
|
480 |
for t:= 0 to TeamsCount - 2 do |
|
481 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
482 |
begin |
|
483 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
484 |
thexchar[t]:= thexchar[Succ(t)]; |
|
485 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
486 |
b:= false |
|
487 |
end |
|
488 |
until b; |
|
489 |
||
490 |
t:= - 4; |
|
491 |
for i:= 0 to Pred(TeamsCount) do |
|
492 |
with thexchar[i] do |
|
493 |
begin |
|
494 |
dec(t, team^.HealthTex^.h + 2); |
|
495 |
ny:= t; |
|
496 |
dy:= dy - ny |
|
497 |
end; |
|
498 |
||
499 |
Gear^.Timer:= cSorterWorkTime; |
|
500 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
501 |
currsorter:= Gear; |
|
502 |
//doStepTeamHealthSorterWork(Gear, Steps) |
|
503 |
end; |
|
504 |
||
505 |
//////////////////////////////////////////////////////////////////////////////// |
|
506 |
procedure doStepSpeechBubbleWork(Gear: PVisualGear; Steps: Longword); |
|
507 |
begin |
|
508 |
if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0; |
|
509 |
||
4365 | 510 |
if (Gear^.Hedgehog^.Gear <> nil) then |
3441 | 511 |
begin |
5151
cbadb9fa52fc
An experiment - make bazooka AI use float instead of hwFloat - should be as accurate, but faster.
nemo
parents:
5121
diff
changeset
|
512 |
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
|
513 |
Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (16 + Gear^.Tex^.h); |
3441 | 514 |
end; |
515 |
||
516 |
if Gear^.Timer = 0 then |
|
517 |
begin |
|
4365 | 518 |
if Gear^.Hedgehog^.SpeechGear = Gear then |
519 |
Gear^.Hedgehog^.SpeechGear:= nil; |
|
3441 | 520 |
DeleteVisualGear(Gear) |
521 |
end; |
|
522 |
end; |
|
523 |
||
524 |
procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); |
|
525 |
begin |
|
526 |
Steps:= Steps; // avoid compiler hint |
|
527 |
||
4365 | 528 |
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
|
529 |
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
|
530 |
SpeechGear^.Timer:= 0; |
3441 | 531 |
|
4365 | 532 |
Gear^.Hedgehog^.SpeechGear:= Gear; |
3441 | 533 |
|
5186 | 534 |
Gear^.Timer:= max(LongInt(Length(Gear^.Text)) * 150, 3000); |
3441 | 535 |
|
536 |
Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16); |
|
537 |
||
538 |
case Gear^.FrameTicks of |
|
539 |
1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28; |
|
540 |
2: Gear^.FrameTicks:= SpritesData[sprThoughtTail].Width-20; |
|
541 |
3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10; |
|
542 |
end; |
|
543 |
||
544 |
Gear^.doStep:= @doStepSpeechBubbleWork; |
|
545 |
||
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
|
546 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h |
3441 | 547 |
end; |
548 |
||
549 |
//////////////////////////////////////////////////////////////////////////////// |
|
550 |
procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword); |
|
551 |
begin |
|
552 |
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
|
553 |
DeleteVisualGear(Gear) |
3441 | 554 |
else |
555 |
begin |
|
556 |
dec(Gear^.Timer, Steps); |
|
557 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
5581 | 558 |
Gear^.X:= Gear^.X + Gear^.dX * Steps |
3441 | 559 |
end; |
560 |
end; |
|
561 |
||
562 |
procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword); |
|
563 |
begin |
|
4161 | 564 |
if round(Gear^.Y) - 10 < cWaterLine then |
3441 | 565 |
DeleteVisualGear(Gear) |
566 |
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
|
567 |
Gear^.Y:= Gear^.Y - 0.08 * Steps; |
3441 | 568 |
|
569 |
end; |
|
570 |
||
571 |
procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword); |
|
572 |
var s: shortstring; |
|
573 |
begin |
|
574 |
s:= ''; |
|
575 |
||
576 |
str(Gear^.State, s); |
|
3459
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
577 |
if Gear^.Hedgehog <> nil then |
4365 | 578 |
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
|
579 |
else |
c552aa44108d
hey sheepluva, how about just this? lets you have an anonymous one too.
nemo
parents:
3443
diff
changeset
|
580 |
Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16); |
3441 | 581 |
|
5578 | 582 |
Gear^.doStep:= @doStepHealthTagWork; |
5576 | 583 |
|
5596 | 584 |
if (round(Gear^.Y) > cWaterLine) and (Gear^.Frame = 0) then |
3441 | 585 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
586 |
||
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
|
587 |
Gear^.Y:= Gear^.Y - Gear^.Tex^.h; |
3441 | 588 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
589 |
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
|
590 |
Gear^.doStep(Gear, Steps-1); |
3441 | 591 |
end; |
592 |
||
593 |
//////////////////////////////////////////////////////////////////////////////// |
|
594 |
procedure doStepSmokeTrace(Gear: PVisualGear; Steps: Longword); |
|
595 |
begin |
|
596 |
inc(Gear^.Timer, Steps ); |
|
597 |
if Gear^.Timer > 64 then |
|
598 |
begin |
|
3995
360332f8785f
SmokeTrace: animation got aborted before last animation frame was displayed
sheepluva
parents:
3994
diff
changeset
|
599 |
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
|
600 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
601 |
DeleteVisualGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
602 |
exit; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
603 |
end; |
3441 | 604 |
dec(Gear^.State, Gear^.Timer div 65); |
605 |
Gear^.Timer:= Gear^.Timer mod 65; |
|
606 |
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
|
607 |
Gear^.dX:= Gear^.dX + cWindSpeedf * Steps; |
3587 | 608 |
Gear^.X:= Gear^.X + Gear^.dX; |
3441 | 609 |
end; |
610 |
||
611 |
//////////////////////////////////////////////////////////////////////////////// |
|
612 |
procedure doStepExplosionWork(Gear: PVisualGear; Steps: Longword); |
|
613 |
begin |
|
614 |
inc(Gear^.Timer, Steps); |
|
615 |
if Gear^.Timer > 75 then |
|
616 |
begin |
|
617 |
inc(Gear^.State, Gear^.Timer div 76); |
|
618 |
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
|
619 |
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
|
620 |
DeleteVisualGear(Gear); |
3441 | 621 |
end; |
622 |
end; |
|
623 |
||
624 |
procedure doStepExplosion(Gear: PVisualGear; Steps: Longword); |
|
625 |
var i: LongWord; |
|
4473 | 626 |
gX,gY: LongInt; |
627 |
vg: PVisualGear; |
|
3441 | 628 |
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
|
629 |
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
|
630 |
gY:= round(Gear^.Y); |
4473 | 631 |
for i:= 0 to 31 do |
632 |
begin |
|
633 |
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
|
634 |
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
|
635 |
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
|
636 |
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
|
637 |
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
|
638 |
end |
4473 | 639 |
end; |
3590 | 640 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart); |
641 |
for i:= 0 to 8 do AddVisualGear(gX, gY, vgtExplPart2); |
|
3441 | 642 |
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
|
643 |
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
|
644 |
Gear^.doStep(Gear, Steps-1); |
3441 | 645 |
end; |
646 |
||
647 |
||
648 |
//////////////////////////////////////////////////////////////////////////////// |
|
649 |
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
|
650 |
var maxMovement: LongInt; |
3441 | 651 |
begin |
652 |
||
653 |
inc(Gear^.Timer, Steps); |
|
654 |
if (Gear^.Timer and 5) = 0 then |
|
655 |
begin |
|
656 |
maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250)); |
|
657 |
ShakeCamera(maxMovement); |
|
658 |
end; |
|
5804
98192121dc69
Since shakes are still proving unsafe until camera is reworked, try a mild flash instead
nemo
parents:
5803
diff
changeset
|
659 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
660 |
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
|
661 |
DeleteVisualGear(Gear); |
3441 | 662 |
end; |
663 |
||
664 |
procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword); |
|
665 |
var i: LongWord; |
|
4473 | 666 |
gX,gY: LongInt; |
667 |
vg: PVisualGear; |
|
3441 | 668 |
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
|
669 |
//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
|
670 |
//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
|
671 |
//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
|
672 |
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
|
673 |
gY:= round(Gear^.Y); |
3441 | 674 |
AddVisualGear(gX, gY, vgtSmokeRing); |
4473 | 675 |
for i:= 0 to 46 do |
676 |
begin |
|
677 |
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
|
678 |
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
|
679 |
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
|
680 |
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
|
681 |
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
|
682 |
end |
4473 | 683 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
AddVisualGear(gX, gY, vgtExplPart2); |
3441 | 688 |
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
|
689 |
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
|
690 |
Gear^.doStep(Gear, Steps-1); |
4034
634a8c8682de
add some phone rumbling to big explosions, airbomb and sinegun
koda
parents:
3995
diff
changeset
|
691 |
performRumble(); |
3441 | 692 |
end; |
3689 | 693 |
|
694 |
procedure doStepChunk(Gear: PVisualGear; Steps: Longword); |
|
695 |
begin |
|
696 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
697 |
||
698 |
Gear^.Y:= Gear^.Y + Gear^.dY * Steps; |
|
699 |
Gear^.dY:= Gear^.dY + cGravityf * Steps; |
|
700 |
||
701 |
Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; |
|
702 |
||
5235
e30b06ffea3a
Skip droplets if plain splash is enabled, add a sanity check just in case.
nemo
parents:
5186
diff
changeset
|
703 |
if (round(Gear^.Y) > cWaterLine) and ((cReducedQuality and rqPlainSplash) = 0) then |
3689 | 704 |
begin |
3699 | 705 |
AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); |
3689 | 706 |
DeleteVisualGear(Gear); |
707 |
end |
|
708 |
end; |
|
4327 | 709 |
|
710 |
//////////////////////////////////////////////////////////////////////////////// |
|
711 |
procedure doStepBulletHit(Gear: PVisualGear; Steps: Longword); |
|
712 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
713 |
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
|
714 |
DeleteVisualGear(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
715 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
716 |
dec(Gear^.FrameTicks, Steps); |
4327 | 717 |
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
|
718 |
|
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
|
719 |
//////////////////////////////////////////////////////////////////////////////// |
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
|
720 |
procedure doStepCircle(Gear: PVisualGear; Steps: Longword); |
4452 | 721 |
var tmp: LongInt; |
4421 | 722 |
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
|
723 |
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
|
724 |
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
|
725 |
if Frame <> 0 then |
4421 | 726 |
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
|
727 |
begin |
4421 | 728 |
inc(FrameTicks); |
729 |
if (FrameTicks mod Frame) = 0 then |
|
730 |
begin |
|
731 |
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
|
732 |
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
|
733 |
inc(tmp) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
734 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
735 |
dec(tmp); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
736 |
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
|
737 |
tdY:= 1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
738 |
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
|
739 |
tdY:= -1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
740 |
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
|
741 |
tmp := 255; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
742 |
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
|
743 |
tmp := 0; |
5179
8d64dcb566ea
Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents:
5151
diff
changeset
|
744 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp) |
4421 | 745 |
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
|
746 |
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
|
747 |
end; |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
748 |
|
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
749 |
//////////////////////////////////////////////////////////////////////////////// |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
750 |
procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword); |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
751 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6553
diff
changeset
|
752 |
inc(Gear^.Timer, Steps); |
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
753 |
|
6913 | 754 |
while Gear^.Timer >= 10 do |
755 |
begin |
|
756 |
dec(Gear^.Timer, 10); |
|
757 |
if WindBarWidth < Gear^.Tag then |
|
758 |
inc(WindBarWidth) |
|
759 |
else if WindBarWidth > Gear^.Tag then |
|
760 |
dec(WindBarWidth); |
|
761 |
end; |
|
762 |
if cWindspeedf > Gear^.dAngle then |
|
763 |
begin |
|
764 |
cWindspeedf := cWindspeedf - Gear^.Angle*Steps; |
|
765 |
if cWindspeedf < Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
766 |
end |
|
767 |
else if cWindspeedf < Gear^.dAngle then |
|
768 |
begin |
|
769 |
cWindspeedf := cWindspeedf + Gear^.Angle*Steps; |
|
770 |
if cWindspeedf > Gear^.dAngle then cWindspeedf:= Gear^.dAngle; |
|
771 |
end; |
|
5357
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
772 |
|
6913 | 773 |
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
|
774 |
DeleteVisualGear(Gear) |
ec36f3d53f3c
Tiny optimization: convert smooth wind indicator change gear into visual gear
unc0rr
parents:
5236
diff
changeset
|
775 |
end; |
5562 | 776 |
//////////////////////////////////////////////////////////////////////////////// |
777 |
procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword); |
|
778 |
begin |
|
779 |
Gear^.X:= Gear^.X + Gear^.dX * Steps; |
|
780 |
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
|
781 |
|
5562 | 782 |
if Gear^.FrameTicks <= Steps then |
783 |
DeleteVisualGear(Gear) |
|
784 |
else |
|
785 |
begin |
|
786 |
dec(Gear^.FrameTicks, Steps); |
|
787 |
if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then |
|
788 |
Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500) |
|
789 |
end |
|
790 |
end; |
|
791 |