author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 11 Jun 2019 16:02:29 +0200 | |
changeset 15139 | 0e0b5fc1674e |
parent 15056 | a9873c81b5e6 |
child 15150 | d47122a0e4b4 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10040
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
4 | 17 |
*) |
18 |
||
5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
19 |
(* |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
20 |
* This file contains the step handlers for gears. |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
21 |
* |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
22 |
* Important: Since gears change the course of the game, calculations that |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
23 |
* lead to different results for different clients/players/machines |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
24 |
* should NOT occur! |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
25 |
* Use safe functions and data types! (e.g. GetRandom() and hwFloat) |
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
26 |
*) |
10015 | 27 |
|
9285 | 28 |
{$INCLUDE "options.inc"} |
29 |
||
30 |
unit uGearsHandlersMess; |
|
31 |
interface |
|
32 |
uses uTypes, uFloat; |
|
33 |
||
34 |
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); |
|
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
35 |
procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType); |
9285 | 36 |
procedure HideHog(HH: PHedgehog); |
37 |
procedure doStepDrowningGear(Gear: PGear); |
|
38 |
procedure doStepFallingGear(Gear: PGear); |
|
39 |
procedure doStepBomb(Gear: PGear); |
|
40 |
procedure doStepMolotov(Gear: PGear); |
|
41 |
procedure doStepCluster(Gear: PGear); |
|
42 |
procedure doStepShell(Gear: PGear); |
|
43 |
procedure doStepSnowball(Gear: PGear); |
|
44 |
procedure doStepSnowflake(Gear: PGear); |
|
45 |
procedure doStepGrave(Gear: PGear); |
|
46 |
procedure doStepBeeWork(Gear: PGear); |
|
47 |
procedure doStepBee(Gear: PGear); |
|
48 |
procedure doStepShotIdle(Gear: PGear); |
|
49 |
procedure doStepShotgunShot(Gear: PGear); |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
50 |
procedure spawnBulletTrail(Bullet: PGear; bulletX, bulletY: hwFloat; fadeIn: Boolean); |
9285 | 51 |
procedure doStepBulletWork(Gear: PGear); |
52 |
procedure doStepDEagleShot(Gear: PGear); |
|
53 |
procedure doStepSniperRifleShot(Gear: PGear); |
|
54 |
procedure doStepActionTimer(Gear: PGear); |
|
55 |
procedure doStepPickHammerWork(Gear: PGear); |
|
56 |
procedure doStepPickHammer(Gear: PGear); |
|
57 |
procedure doStepBlowTorchWork(Gear: PGear); |
|
58 |
procedure doStepBlowTorch(Gear: PGear); |
|
59 |
procedure doStepMine(Gear: PGear); |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
60 |
procedure doStepAirMine(Gear: PGear); |
9285 | 61 |
procedure doStepSMine(Gear: PGear); |
62 |
procedure doStepDynamite(Gear: PGear); |
|
63 |
procedure doStepRollingBarrel(Gear: PGear); |
|
64 |
procedure doStepCase(Gear: PGear); |
|
65 |
procedure doStepTarget(Gear: PGear); |
|
66 |
procedure doStepIdle(Gear: PGear); |
|
67 |
procedure doStepShover(Gear: PGear); |
|
68 |
procedure doStepWhip(Gear: PGear); |
|
69 |
procedure doStepFlame(Gear: PGear); |
|
70 |
procedure doStepFirePunchWork(Gear: PGear); |
|
71 |
procedure doStepFirePunch(Gear: PGear); |
|
72 |
procedure doStepParachuteWork(Gear: PGear); |
|
73 |
procedure doStepParachute(Gear: PGear); |
|
74 |
procedure doStepAirAttackWork(Gear: PGear); |
|
75 |
procedure doStepAirAttack(Gear: PGear); |
|
76 |
procedure doStepAirBomb(Gear: PGear); |
|
77 |
procedure doStepGirder(Gear: PGear); |
|
78 |
procedure doStepTeleportAfter(Gear: PGear); |
|
79 |
procedure doStepTeleportAnim(Gear: PGear); |
|
80 |
procedure doStepTeleport(Gear: PGear); |
|
81 |
procedure doStepSwitcherWork(Gear: PGear); |
|
82 |
procedure doStepSwitcher(Gear: PGear); |
|
83 |
procedure doStepMortar(Gear: PGear); |
|
84 |
procedure doStepKamikazeWork(Gear: PGear); |
|
85 |
procedure doStepKamikazeIdle(Gear: PGear); |
|
86 |
procedure doStepKamikaze(Gear: PGear); |
|
87 |
procedure doStepCakeExpl(Gear: PGear); |
|
88 |
procedure doStepCakeDown(Gear: PGear); |
|
11536 | 89 |
procedure doStepCakeWalk(Gear: PGear); |
9285 | 90 |
procedure doStepCakeUp(Gear: PGear); |
91 |
procedure doStepCakeFall(Gear: PGear); |
|
92 |
procedure doStepCake(Gear: PGear); |
|
93 |
procedure doStepSeductionWork(Gear: PGear); |
|
94 |
procedure doStepSeductionWear(Gear: PGear); |
|
95 |
procedure doStepSeduction(Gear: PGear); |
|
96 |
procedure doStepWaterUp(Gear: PGear); |
|
97 |
procedure doStepDrillDrilling(Gear: PGear); |
|
98 |
procedure doStepDrill(Gear: PGear); |
|
99 |
procedure doStepBallgunWork(Gear: PGear); |
|
100 |
procedure doStepBallgun(Gear: PGear); |
|
101 |
procedure doStepRCPlaneWork(Gear: PGear); |
|
102 |
procedure doStepRCPlane(Gear: PGear); |
|
103 |
procedure doStepJetpackWork(Gear: PGear); |
|
104 |
procedure doStepJetpack(Gear: PGear); |
|
105 |
procedure doStepBirdyDisappear(Gear: PGear); |
|
106 |
procedure doStepBirdyFly(Gear: PGear); |
|
107 |
procedure doStepBirdyDescend(Gear: PGear); |
|
108 |
procedure doStepBirdyAppear(Gear: PGear); |
|
109 |
procedure doStepBirdy(Gear: PGear); |
|
110 |
procedure doStepEggWork(Gear: PGear); |
|
111 |
procedure doPortalColorSwitch(); |
|
112 |
procedure doStepPortal(Gear: PGear); |
|
113 |
procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
|
114 |
procedure doStepMovingPortal_real(Gear: PGear); |
|
115 |
procedure doStepMovingPortal(Gear: PGear); |
|
116 |
procedure doStepPortalShot(newPortal: PGear); |
|
117 |
procedure doStepPiano(Gear: PGear); |
|
14571
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
118 |
procedure doStepPianoWork(Gear: PGear); |
9285 | 119 |
procedure doStepSineGunShotWork(Gear: PGear); |
120 |
procedure doStepSineGunShot(Gear: PGear); |
|
121 |
procedure doStepFlamethrowerWork(Gear: PGear); |
|
122 |
procedure doStepFlamethrower(Gear: PGear); |
|
123 |
procedure doStepLandGunWork(Gear: PGear); |
|
124 |
procedure doStepLandGun(Gear: PGear); |
|
125 |
procedure doStepPoisonCloud(Gear: PGear); |
|
126 |
procedure doStepHammer(Gear: PGear); |
|
127 |
procedure doStepHammerHitWork(Gear: PGear); |
|
128 |
procedure doStepHammerHit(Gear: PGear); |
|
129 |
procedure doStepResurrectorWork(Gear: PGear); |
|
130 |
procedure doStepResurrector(Gear: PGear); |
|
131 |
procedure doStepNapalmBomb(Gear: PGear); |
|
132 |
procedure doStepTardisWarp(Gear: PGear); |
|
133 |
procedure doStepTardis(Gear: PGear); |
|
134 |
procedure updateFuel(Gear: PGear); |
|
135 |
procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
|
136 |
procedure doStepIceGun(Gear: PGear); |
|
137 |
procedure doStepAddAmmo(Gear: PGear); |
|
138 |
procedure doStepGenericFaller(Gear: PGear); |
|
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
139 |
procedure doStepCreeper(Gear: PGear); |
9285 | 140 |
procedure doStepKnife(Gear: PGear); |
12903 | 141 |
procedure doStepMinigunWork(Gear: PGear); |
142 |
procedure doStepMinigun(Gear: PGear); |
|
143 |
procedure doStepMinigunBullet(Gear: PGear); |
|
9285 | 144 |
|
145 |
var |
|
146 |
upd: Longword; |
|
147 |
snowLeft,snowRight: LongInt; |
|
148 |
||
149 |
implementation |
|
150 |
uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound |
|
151 |
, SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics |
|
12828
e2e372449c19
Remove unused uCommands from uGearsHandlersMess
Wuzzy <Wuzzy2@mail.ru>
parents:
12825
diff
changeset
|
152 |
, uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
153 |
, uStore, uAI, uStats, uLocale; |
5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
154 |
|
3569 | 155 |
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); |
156 |
var |
|
157 |
dX, dY, sX, sY: hwFloat; |
|
158 |
i, steps: LongWord; |
|
159 |
caller: TGearStepProcedure; |
|
160 |
begin |
|
161 |
dX:= Gear^.dX; |
|
162 |
dY:= Gear^.dY; |
|
163 |
steps:= max(abs(hwRound(Gear^.X+dX)-hwRound(Gear^.X)), abs(hwRound(Gear^.Y+dY)-hwRound(Gear^.Y))); |
|
164 |
||
165 |
// Gear is still on the same Pixel it was before |
|
166 |
if steps < 1 then |
|
4578 | 167 |
begin |
3569 | 168 |
if onlyCheckIfChanged then |
4578 | 169 |
begin |
3569 | 170 |
Gear^.X := Gear^.X + dX; |
171 |
Gear^.Y := Gear^.Y + dY; |
|
172 |
EXIT; |
|
4578 | 173 |
end |
3569 | 174 |
else |
175 |
steps := 1; |
|
4578 | 176 |
end; |
3569 | 177 |
|
178 |
if steps > 1 then |
|
4578 | 179 |
begin |
3569 | 180 |
sX:= dX / steps; |
181 |
sY:= dY / steps; |
|
4578 | 182 |
end |
8795 | 183 |
|
3569 | 184 |
else |
4578 | 185 |
begin |
3569 | 186 |
sX:= dX; |
187 |
sY:= dY; |
|
4578 | 188 |
end; |
3569 | 189 |
|
190 |
caller:= Gear^.doStep; |
|
191 |
||
192 |
for i:= 1 to steps do |
|
4578 | 193 |
begin |
3569 | 194 |
Gear^.X := Gear^.X + sX; |
195 |
Gear^.Y := Gear^.Y + sY; |
|
196 |
step(Gear); |
|
197 |
if (Gear^.doStep <> caller) |
|
198 |
or ((Gear^.State and gstCollision) <> 0) |
|
199 |
or ((Gear^.State and gstMoving) = 0) then |
|
200 |
break; |
|
4578 | 201 |
end; |
3569 | 202 |
end; |
203 |
||
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
204 |
procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType); |
8795 | 205 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
206 |
gi: PGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
207 |
d: LongInt; |
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
208 |
grenadeTaunt: boolean; |
2647 | 209 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
210 |
gi := GearsList; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
211 |
while gi <> nil do |
4578 | 212 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
213 |
if (gi^.Kind = gtHedgehog) then |
4578 | 214 |
begin |
12810 | 215 |
d := r - hwRound(Distance(gi^.X - x, gi^.Y - y)); |
10011
ead5e4b21671
Add check for gear kind of hedgehog on invulnerability effect. This probably fixes bug #766, is similar to change in previous r2a1483d91977 and was introduced by r7d925e82e572
nemo
parents:
9998
diff
changeset
|
216 |
if (d > 1) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) and (GetRandom(2) = 0) then |
4578 | 217 |
begin |
3143 | 218 |
if (CurrentHedgehog^.Gear = gi) then |
14024
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
219 |
if (CurrentHedgehog^.Gear^.FlightTime = 0) then |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
220 |
case random(4) of |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
221 |
0: PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack); |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
222 |
1: PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack); |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
223 |
2: PlaySoundV(sndRunAway, gi^.Hedgehog^.Team^.voicepack); |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
224 |
3: PlaySoundV(sndRunAway, gi^.Hedgehog^.Team^.voicepack); |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
225 |
end |
14019 | 226 |
else |
14024
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
227 |
if random(4) = 0 then |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
228 |
PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack) |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
229 |
else |
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14019
diff
changeset
|
230 |
PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) |
8795 | 231 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
232 |
else |
4578 | 233 |
begin |
8632
b5ed76d2a1f9
Make hogs thaw only on enemy turns, make timebox counter decrement only on your turn, adjust knock for frozen hogs, increase damage on frozen hogs, make freezer fuel only reduce when not adjusting angle.
nemo
parents:
8628
diff
changeset
|
234 |
if ((gi^.State and gstMoving) = 0) and (gi^.Hedgehog^.Effects[heFrozen] = 0) then |
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
235 |
begin |
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
236 |
gi^.dX.isNegative:= X<gi^.X; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
237 |
gi^.State := gi^.State or gstLoser; |
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
238 |
end; |
8795 | 239 |
|
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
240 |
grenadeTaunt:= false; |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
241 |
if (gearType = gtGrenade) then |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
242 |
grenadeTaunt:= random(2) = 0; |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
243 |
|
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
244 |
if grenadeTaunt then |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
245 |
PlaySoundV(sndGrenade, gi^.Hedgehog^.Team^.voicepack) |
3143 | 246 |
else |
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
247 |
if d > r div 2 then |
14019 | 248 |
if random(3) = 0 then |
249 |
PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack) |
|
250 |
else |
|
251 |
PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) |
|
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
252 |
else |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
253 |
PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack); |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
254 |
|
4578 | 255 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
256 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
257 |
end; |
8795 | 258 |
|
4578 | 259 |
gi := gi^.NextGear |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
260 |
end; |
2647 | 261 |
end; |
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
262 |
|
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
263 |
procedure HideHog(HH: PHedgehog); |
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
264 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
265 |
ScriptCall('onHogHide', HH^.Gear^.Uid); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
266 |
DeleteCI(HH^.Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
267 |
if FollowGear = HH^.Gear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
268 |
FollowGear:= nil; |
8795 | 269 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
270 |
if lastGearByUID = HH^.Gear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
271 |
lastGearByUID := nil; |
8795 | 272 |
|
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
273 |
HH^.Gear^.Message:= HH^.Gear^.Message or gmRemoveFromList; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
274 |
with HH^.Gear^ do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
275 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
276 |
Z := cHHZ; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
277 |
HH^.Gear^.Active:= false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
278 |
State:= State and (not (gstHHDriven or gstAttacking or gstAttacked)); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
279 |
Message := Message and (not gmAttack); |
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
280 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
281 |
HH^.GearHidden:= HH^.Gear; |
13145
e330feceb662
Hide team bar if all hedgehogs in it are hidden or dead
Wuzzy <Wuzzy2@mail.ru>
parents:
13101
diff
changeset
|
282 |
HH^.Gear:= nil; |
e330feceb662
Hide team bar if all hedgehogs in it are hidden or dead
Wuzzy <Wuzzy2@mail.ru>
parents:
13101
diff
changeset
|
283 |
AddVisualGear(0, 0, vgtTeamHealthSorter); |
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
284 |
end; |
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
285 |
|
4 | 286 |
|
287 |
//////////////////////////////////////////////////////////////////////////////// |
|
288 |
procedure doStepDrowningGear(Gear: PGear); |
|
12719
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
289 |
var i, d, bubbleX, bubbleY: LongInt; |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
290 |
bubble: PVisualGear; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
291 |
begin |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
292 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
293 |
begin |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
294 |
d:= 2 * Gear^.Radius; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
295 |
for i:= (Gear^.Radius * Gear^.Radius) div 4 downto 0 do |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
296 |
begin |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
297 |
bubble := AddVisualGear(hwRound(Gear^.X) - Gear^.Radius + random(d), hwRound(Gear^.Y) - Gear^.Radius + random(d), vgtBubble); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
298 |
if bubble <> nil then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
299 |
bubble^.dY:= 0.1 + random(20)/10; |
10354 | 300 |
end; |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
301 |
DeleteGear(Gear); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
302 |
exit; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
303 |
end; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
304 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
305 |
AllInactive := false; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
306 |
dec(Gear^.Timer); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
307 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
308 |
Gear^.Y := Gear^.Y + cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
309 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
310 |
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
311 |
begin |
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
312 |
if leftX + Gear^.Radius > hwRound(Gear^.X) then |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
313 |
Gear^.X := Gear^.X - cDrownSpeed |
10354 | 314 |
else |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
315 |
Gear^.X := Gear^.X + cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
316 |
end |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
317 |
else |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
318 |
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
319 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
320 |
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
12719
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
321 |
if (Gear^.Kind = gtHedgehog) and (Gear^.dX.isNegative) then |
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
322 |
bubbleX:= hwRound(Gear^.X) - Gear^.Radius |
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
323 |
else |
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
324 |
bubbleX:= hwRound(Gear^.X) + Gear^.Radius; |
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
325 |
bubbleY:= hwRound(Gear^.Y) - Gear^.Radius; |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
326 |
if ((not SuddenDeathDmg and (WaterOpacity < $FF)) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
327 |
or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
328 |
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
12719
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
329 |
AddVisualGear(bubbleX, bubbleY, vgtBubble) |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
330 |
else if Random(12) = 0 then |
12719
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12717
diff
changeset
|
331 |
AddVisualGear(bubbleX, bubbleY, vgtBubble); |
13742
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
332 |
// Insta-delete gear and skip drowning animation if water is 100% opaque |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
333 |
if (not SuddenDeathDmg and (WaterOpacity > $FE)) |
13742
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
334 |
or (SuddenDeathDmg and (SDWaterOpacity > $FE)) then |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
335 |
begin |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
336 |
// Teleport gear to a suitable position for the damage tag in the water |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
337 |
if (WorldEdge = weSea) and (hwRound(Gear^.X) - Gear^.Radius < leftX) then |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
338 |
begin |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
339 |
if (hwRound(Gear^.X) - Gear^.Radius > leftX - 90) then |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
340 |
Gear^.X := Gear^.X - _90 |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
341 |
end |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
342 |
else if (WorldEdge = weSea) and (hwRound(Gear^.X) + Gear^.Radius > rightX) then |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
343 |
begin |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
344 |
if (hwRound(Gear^.X) - Gear^.Radius < rightX + 90) then |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
345 |
Gear^.X := Gear^.X + _90 |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
346 |
end |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
347 |
else |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
348 |
Gear^.Y := int2hwFloat(Gear^.Radius + cWaterLine + cVisibleWater); |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
349 |
DeleteGear(Gear); |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
350 |
exit; |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
351 |
end; |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
352 |
// Delete normally if gear is outside of visible range |
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13656
diff
changeset
|
353 |
if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
354 |
DeleteGear(Gear); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
355 |
end; |
4 | 356 |
|
357 |
//////////////////////////////////////////////////////////////////////////////// |
|
358 |
procedure doStepFallingGear(Gear: PGear); |
|
8795 | 359 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
360 |
isFalling: boolean; |
9526 | 361 |
tX, tdX, tdY: hwFloat; |
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
362 |
collV, collH, gX, gY: LongInt; |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
363 |
land, xland: word; |
4 | 364 |
begin |
9526 | 365 |
tX:= Gear^.X; |
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
366 |
gX:= hwRound(Gear^.X); |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
367 |
gY:= hwRound(Gear^.Y); |
13615
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
368 |
Gear^.State := Gear^.State and (not gstCollision); |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
369 |
|
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
370 |
// World wrap |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
371 |
if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
372 |
((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0)) then |
9526 | 373 |
begin |
13615
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
374 |
// Collision with land that *just* behind the other side of the world wrap edge |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
375 |
if (not Gear^.Sticky) then |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
376 |
begin |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
377 |
Gear^.X:= tX; |
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
378 |
Gear^.dX.isNegative:= (gX > leftX + Gear^.Radius*2); |
13615
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
379 |
Gear^.dX := Gear^.dX * Gear^.Friction; |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
380 |
end; |
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13614
diff
changeset
|
381 |
Gear^.State := Gear^.State or gstCollision; |
9526 | 382 |
end; |
9473
a51a69094c24
partial implementation of non-infinite world (edge wrap/warp/bounce)
nemo
parents:
9470
diff
changeset
|
383 |
|
7627 | 384 |
// clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems. |
9967
40750e72514b
keep velocity from fluttering between 2 and 3px / ms when falling...
nemo
parents:
9885
diff
changeset
|
385 |
if Gear^.dX.Round > 1 then |
7627 | 386 |
Gear^.dX.QWordValue:= 8589934592; |
9967
40750e72514b
keep velocity from fluttering between 2 and 3px / ms when falling...
nemo
parents:
9885
diff
changeset
|
387 |
if Gear^.dY.Round > 1 then |
7627 | 388 |
Gear^.dY.QWordValue:= 8589934592; |
8838
aa2ffd427f6a
strip PAS2C, old WEB symbols and outdated pas2c sources from default branch, all c-related development is done on the webgl branch
koda
parents:
8822
diff
changeset
|
389 |
|
10354 | 390 |
if (Gear^.State and gstSubmersible <> 0) and CheckCoordInWater(gX, gY) then |
8992
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset
|
391 |
begin |
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset
|
392 |
Gear^.dX:= Gear^.dX * _0_999; |
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset
|
393 |
Gear^.dY:= Gear^.dY * _0_999 |
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset
|
394 |
end; |
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset
|
395 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
396 |
collV := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
397 |
collH := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
398 |
tdX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
399 |
tdY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
400 |
|
3359 | 401 |
// might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips) |
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
402 |
if (gX < min(LAND_WIDTH div -2, -2048)) |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
403 |
or (gX > max(LAND_WIDTH * 3 div 2, 6144)) then |
11394
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
404 |
Gear^.Message := Gear^.Message or gmDestroy; |
3359 | 405 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
406 |
if Gear^.dY.isNegative then |
4578 | 407 |
begin |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
408 |
land:= TestCollisionYwithGear(Gear, -1); |
9820 | 409 |
isFalling := land = 0; |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
410 |
if land <> 0 then |
4578 | 411 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
412 |
collV := -1; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
413 |
if land and lfIce <> 0 then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
414 |
Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
415 |
else Gear^.dX := Gear^.dX * Gear^.Friction; |
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
416 |
if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
417 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
418 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
419 |
Gear^.State := Gear^.State or gstCollision |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
420 |
end |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
421 |
else Gear^.dY := - Gear^.dY * cElastic |
4578 | 422 |
end |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
423 |
else if Gear^.AdvBounce = 1 then |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
424 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
425 |
land:= TestCollisionYwithGear(Gear, 1); |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
426 |
if land <> 0 then collV := 1 |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
427 |
end |
4578 | 428 |
end |
8795 | 429 |
else |
6498 | 430 |
begin // Gear^.dY.isNegative is false |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
431 |
land:= TestCollisionYwithGear(Gear, 1); |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
432 |
if land <> 0 then |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
433 |
begin |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
434 |
collV := 1; |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
435 |
isFalling := false; |
8795 | 436 |
if land and lfIce <> 0 then |
6498 | 437 |
Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
8795 | 438 |
else |
6498 | 439 |
Gear^.dX := Gear^.dX * Gear^.Friction; |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
440 |
|
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
441 |
if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
442 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
443 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
444 |
Gear^.State := Gear^.State or gstCollision |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
445 |
end |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
446 |
else Gear^.dY := - Gear^.dY * cElastic |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
447 |
end |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
448 |
else |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
449 |
begin |
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
450 |
isFalling := true; |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
451 |
if Gear^.AdvBounce = 1 then |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
452 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
453 |
land:= TestCollisionYwithGear(Gear, -1); |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
454 |
if land <> 0 then collV := -1 |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
455 |
end |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
456 |
end |
4578 | 457 |
end; |
503 | 458 |
|
2989
b49d87499398
Add back sheepluva's 45° patch for some weapons. Rescale Tiy's latest icons to his specifications.
nemo
parents:
2983
diff
changeset
|
459 |
|
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
460 |
xland:= TestCollisionXwithGear(Gear, hwSign(Gear^.dX)); |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
461 |
if xland <> 0 then |
4578 | 462 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
463 |
collH := hwSign(Gear^.dX); |
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
464 |
if (Gear^.AdvBounce = 0) or (xland and lfBouncy = 0) then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
465 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
466 |
Gear^.dX := - Gear^.dX * Gear^.Elasticity; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
467 |
Gear^.dY := Gear^.dY * Gear^.Elasticity; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
468 |
Gear^.State := Gear^.State or gstCollision |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
469 |
end |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
470 |
else |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
471 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
472 |
Gear^.dX := - Gear^.dX * cElastic; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
473 |
Gear^.dY := Gear^.dY * cElastic |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
474 |
end |
4578 | 475 |
end |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
476 |
else if Gear^.AdvBounce = 1 then |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
477 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
478 |
xland:= TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)); |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
479 |
if xland <> 0 then collH := -hwSign(Gear^.dX) |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
480 |
end; |
10015 | 481 |
if (collV <> 0) and (collH <> 0) and |
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
482 |
(((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
483 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
484 |
if (xland or land) and lfBouncy = 0 then |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
485 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
486 |
Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; |
9767 | 487 |
Gear^.dY := tdX*Gear^.Elasticity; |
488 |
Gear^.State := Gear^.State or gstCollision |
|
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
489 |
end |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
490 |
else |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
491 |
begin |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
492 |
Gear^.dX := tdY*cElastic*Gear^.Friction; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
493 |
Gear^.dY := tdX*cElastic |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
494 |
end; |
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
495 |
|
10895
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
496 |
Gear^.dX.isNegative:= tdX.isNegative; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
497 |
Gear^.dY.isNegative:= tdY.isNegative; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
498 |
if (collV > 0) and (collH > 0) and (not tdX.isNegative) and (not tdY.isNegative) then |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
499 |
begin |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
500 |
Gear^.dX.isNegative := true; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
501 |
Gear^.dY.isNegative := true |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
502 |
end |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
503 |
else if (collV > 0) and (collH < 0) and (tdX.isNegative or tdY.isNegative) then |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
504 |
begin |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
505 |
Gear^.dY.isNegative := not tdY.isNegative; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
506 |
if not tdY.isNegative then Gear^.dX.isNegative := false |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
507 |
end |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
508 |
else if (collV < 0) and (collH > 0) and (not tdX.isNegative) then |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
509 |
begin |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
510 |
Gear^.dX.isNegative := true; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
511 |
Gear^.dY.isNegative := false |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
512 |
end |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
513 |
else if (collV < 0) and (collH < 0) and tdX.isNegative and tdY.isNegative then |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
514 |
Gear^.dX.isNegative := false; |
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
515 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
516 |
isFalling := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
517 |
Gear^.AdvBounce := 10; |
4578 | 518 |
end; |
503 | 519 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
520 |
if Gear^.AdvBounce > 1 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
521 |
dec(Gear^.AdvBounce); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
522 |
|
11394
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
523 |
if isFalling and (Gear^.State and gstNoGravity = 0) then |
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
524 |
begin |
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
525 |
Gear^.dY := Gear^.dY + cGravity; |
12698
2592c6ea6008
wind blowing around mines off-turn was too annoying.
nemo
parents:
12697
diff
changeset
|
526 |
if (GameFlags and gfMoreWind <> 0) and (TurnTimeLeft > 0) and |
11394
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
527 |
((xland or land) = 0) and |
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for no-gravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11337
diff
changeset
|
528 |
((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
529 |
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density |
9820 | 530 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
531 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
532 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
533 |
Gear^.Y := Gear^.Y + Gear^.dY; |
9479
167dea42d7d7
move border back a bit from left/right bounds, bee tweak
nemo
parents:
9477
diff
changeset
|
534 |
CheckGearDrowning(Gear); |
6498 | 535 |
if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then |
6450 | 536 |
Gear^.State := Gear^.State and (not gstMoving) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
537 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
538 |
Gear^.State := Gear^.State or gstMoving; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
539 |
|
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
540 |
if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
541 |
Gear^.State := Gear^.State or gstCollision; |
10015 | 542 |
|
14579
6e5cda26f676
Tweak bounce effects of some gears
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
543 |
if ((xland or land) and lfBouncy <> 0) and |
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
544 |
((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then |
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
545 |
begin |
10508 | 546 |
AddBounceEffectForGear(Gear); |
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset
|
547 |
end |
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset
|
548 |
else if (Gear^.nImpactSounds > 0) and |
7777 | 549 |
(Gear^.State and gstCollision <> 0) and |
550 |
(((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and |
|
551 |
(((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or |
|
8795 | 552 |
((Gear^.Radius >= 3) and |
7777 | 553 |
((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then |
5461 | 554 |
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true); |
4 | 555 |
end; |
556 |
||
557 |
//////////////////////////////////////////////////////////////////////////////// |
|
558 |
procedure doStepBomb(Gear: PGear); |
|
8795 | 559 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
560 |
i, x, y: LongInt; |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
561 |
dX, dY, gdX: hwFloat; |
3475 | 562 |
vg: PVisualGear; |
4 | 563 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
564 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
565 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
566 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
567 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
568 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
569 |
if Gear^.Timer = 1000 then // might need adjustments |
8795 | 570 |
case Gear^.Kind of |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
571 |
gtGrenade, |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
572 |
gtClusterBomb, |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
573 |
gtWatermelon, |
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
574 |
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom, Gear^.Kind); |
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
575 |
gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50, Gear^.Kind); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
576 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
577 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
578 |
if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
579 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
580 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
581 |
if (Gear^.State and gstCollision) <> 0 then |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
582 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx); |
7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset
|
583 |
end; |
3004 | 584 |
|
3475 | 585 |
if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
586 |
begin |
3475 | 587 |
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); |
588 |
if vg <> nil then |
|
589 |
vg^.Tint:= $FFC0C000; |
|
7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset
|
590 |
end; |
3475 | 591 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
592 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
593 |
begin |
8795 | 594 |
case Gear^.Kind of |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
595 |
gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
596 |
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
8795 | 597 |
gtClusterBomb: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
598 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
599 |
x := hwRound(Gear^.X); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
600 |
y := hwRound(Gear^.Y); |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
601 |
gdX:= Gear^.dX; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
602 |
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
603 |
for i:= 0 to 4 do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
604 |
begin |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
605 |
dX := rndSign(GetRandomf * _0_1) + gdX / 5; |
7001 | 606 |
dY := (GetRandomf - _3) * _0_08; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
607 |
FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
608 |
end |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
609 |
end; |
8795 | 610 |
gtWatermelon: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
611 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
612 |
x := hwRound(Gear^.X); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
613 |
y := hwRound(Gear^.Y); |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
614 |
gdX:= Gear^.dX; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
615 |
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
616 |
for i:= 0 to 5 do |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
617 |
begin |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
618 |
dX := rndSign(GetRandomf * _0_1) + gdX / 5; |
7001 | 619 |
dY := (GetRandomf - _1_5) * _0_3; |
6120 | 620 |
FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75); |
621 |
FollowGear^.DirAngle := i * 60 |
|
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
622 |
end |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
623 |
end; |
8795 | 624 |
gtHellishBomb: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
625 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
626 |
x := hwRound(Gear^.X); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
627 |
y := hwRound(Gear^.Y); |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
628 |
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
629 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
630 |
for i:= 0 to 127 do |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
631 |
begin |
7001 | 632 |
dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1); |
633 |
dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1); |
|
6131 | 634 |
if i mod 2 = 0 then |
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
635 |
begin |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
636 |
AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
637 |
AddGear(x, y, gtFlame, 0, dX, -dY, 0) |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
638 |
end |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
639 |
else |
8795 | 640 |
begin |
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
641 |
AddGear(x, y, gtFlame, 0, dX, dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
642 |
AddGear(x, y, gtFlame, gstTmpFlag, dX, -dY, 0) |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
643 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
644 |
end |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
645 |
end; |
3712 | 646 |
gtGasBomb: |
647 |
begin |
|
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
648 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3712 | 649 |
for i:= 0 to 2 do |
4160
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset
|
650 |
begin |
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset
|
651 |
x:= GetRandom(60); |
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset
|
652 |
y:= GetRandom(40); |
6120 | 653 |
FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0); |
4160
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset
|
654 |
end |
3712 | 655 |
end; |
7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset
|
656 |
end; |
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset
|
657 |
DeleteGear(Gear); |
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset
|
658 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
659 |
end; |
6498 | 660 |
|
661 |
CalcRotationDirAngle(Gear); |
|
662 |
||
663 |
if Gear^.Kind = gtHellishBomb then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
664 |
begin |
6498 | 665 |
|
666 |
if Gear^.Timer = 3000 then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
667 |
begin |
6498 | 668 |
Gear^.nImpactSounds := 0; |
669 |
PlaySound(sndHellish); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
670 |
end; |
6498 | 671 |
|
672 |
if (GameTicks and $3F) = 0 then |
|
673 |
if (Gear^.State and gstCollision) = 0 then |
|
674 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
675 |
end; |
4 | 676 |
end; |
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
677 |
|
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
678 |
//////////////////////////////////////////////////////////////////////////////// |
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
679 |
procedure doStepMolotov(Gear: PGear); |
8795 | 680 |
var |
6472 | 681 |
s: Longword; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
682 |
i, gX, gY: LongInt; |
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
683 |
dX, dY: hwFloat; |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
684 |
smoke, glass: PVisualGear; |
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
685 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
686 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
687 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
688 |
doStepFallingGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
689 |
CalcRotationDirAngle(Gear); |
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
690 |
|
5870 | 691 |
// let's add some smoke depending on speed |
8906
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset
|
692 |
s:= max(32,152 - round((abs(hwFloat2FLoat(Gear^.dX))+abs(hwFloat2Float(Gear^.dY)))*120))+random(10); |
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
6002
diff
changeset
|
693 |
if (GameTicks mod s) = 0 then |
5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5870
diff
changeset
|
694 |
begin |
5873 | 695 |
// adjust angle to match the texture |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
696 |
if Gear^.dX.isNegative then |
8906
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset
|
697 |
i:= 130 |
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset
|
698 |
else i:= 50; |
8795 | 699 |
|
5873 | 700 |
smoke:= AddVisualGear(hwRound(Gear^.X)-round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)-round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
701 |
if smoke <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
702 |
smoke^.Scale:= 0.75; |
5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5870
diff
changeset
|
703 |
end; |
5870 | 704 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
705 |
if (Gear^.State and gstCollision) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
706 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
707 |
PlaySound(sndMolotov); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
708 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
709 |
gY := hwRound(Gear^.Y); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
710 |
for i:= 0 to 4 do |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
711 |
begin |
15056 | 712 |
glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtEgg); |
6131 | 713 |
if glass <> nil then |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
714 |
with glass^ do |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
715 |
begin |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
716 |
Frame:= 2; |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
717 |
Tint:= $41B83ED0 - i * $10081000; |
15056 | 718 |
dX:= dX + hwFloat2Float(Gear^.dX) / 2; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
719 |
Angle:= random(360); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
720 |
FrameTicks:= 750; |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
721 |
State:= ord(sprEgg) |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
722 |
end; |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
723 |
end; |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
724 |
for i:= 0 to 24 do |
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
725 |
begin |
7001 | 726 |
dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandomf + _1); |
727 |
dY := AngleSin(i * 8) * _0_5 * (GetRandomf + _1); |
|
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
728 |
AddGear(gX, gY, gtFlame, gstTmpFlag, dX, dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
729 |
AddGear(gX, gY, gtFlame, gstTmpFlag, dX,-dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
730 |
AddGear(gX, gY, gtFlame, gstTmpFlag,-dX, dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
731 |
AddGear(gX, gY, gtFlame, gstTmpFlag,-dX,-dY, 0); |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
732 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
733 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
734 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
735 |
end; |
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
736 |
end; |
4 | 737 |
|
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
738 |
//////////////////////////////////////////////////////////////////////////////// |
1279 | 739 |
|
78 | 740 |
procedure doStepCluster(Gear: PGear); |
741 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
742 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
743 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
744 |
if (Gear^.State and gstCollision) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
745 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
746 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
747 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
748 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
749 |
end; |
1262 | 750 |
|
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
751 |
if (Gear^.Kind = gtMelonPiece) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
752 |
CalcRotationDirAngle(Gear) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
753 |
else if (GameTicks and $1F) = 0 then |
10352 | 754 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
78 | 755 |
end; |
756 |
||
4 | 757 |
//////////////////////////////////////////////////////////////////////////////// |
4168 | 758 |
procedure doStepShell(Gear: PGear); |
4 | 759 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
760 |
AllInactive := false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
761 |
if (GameFlags and gfMoreWind) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
762 |
Gear^.dX := Gear^.dX + cWindSpeed; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
763 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
764 |
if (Gear^.State and gstCollision) <> 0 then |
4578 | 765 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
766 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
767 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
768 |
exit |
4578 | 769 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
770 |
if (GameTicks and $3F) = 0 then |
10352 | 771 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
95 | 772 |
end; |
773 |
||
4 | 774 |
//////////////////////////////////////////////////////////////////////////////// |
4578 | 775 |
procedure doStepSnowball(Gear: PGear); |
776 |
var kick, i: LongInt; |
|
777 |
particle: PVisualGear; |
|
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
778 |
gdX, gdY: hwFloat; |
4578 | 779 |
begin |
780 |
AllInactive := false; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
781 |
if (GameFlags and gfMoreWind) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
782 |
Gear^.dX := Gear^.dX + cWindSpeed; |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
783 |
gdX := Gear^.dX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
784 |
gdY := Gear^.dY; |
4578 | 785 |
doStepFallingGear(Gear); |
786 |
CalcRotationDirAngle(Gear); |
|
787 |
if (Gear^.State and gstCollision) <> 0 then |
|
788 |
begin |
|
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
789 |
kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * Gear^.Boom / 10000); |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
790 |
Gear^.dX:= gdX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
791 |
Gear^.dY:= gdY; |
7621 | 792 |
AmmoShove(Gear, 0, kick); |
4578 | 793 |
for i:= 15 + kick div 10 downto 0 do |
794 |
begin |
|
795 |
particle := AddVisualGear(hwRound(Gear^.X) + Random(25), hwRound(Gear^.Y) + Random(25), vgtDust); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
796 |
if particle <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
797 |
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
4578 | 798 |
end; |
799 |
DeleteGear(Gear); |
|
800 |
exit |
|
801 |
end; |
|
802 |
if ((GameTicks and $1F) = 0) and (Random(3) = 0) then |
|
803 |
begin |
|
4582 | 804 |
particle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
805 |
if particle <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
806 |
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
4578 | 807 |
end |
808 |
end; |
|
809 |
||
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
810 |
//////////////////////////////////////////////////////////////////////////////// |
4611 | 811 |
procedure doStepSnowflake(Gear: PGear); |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
812 |
var xx, yy, px, py, rx, ry, lx, ly: LongInt; |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
813 |
move, draw, allpx, gun: Boolean; |
4611 | 814 |
s: PSDL_Surface; |
815 |
p: PLongwordArray; |
|
5693 | 816 |
lf: LongWord; |
4611 | 817 |
begin |
5695 | 818 |
inc(Gear^.Pos); |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
819 |
gun:= (Gear^.State and gstTmpFlag) <> 0; |
5024 | 820 |
move:= false; |
821 |
draw:= false; |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
822 |
if gun then |
5024 | 823 |
begin |
6450 | 824 |
Gear^.State:= Gear^.State and (not gstInvisible); |
5024 | 825 |
doStepFallingGear(Gear); |
826 |
CheckCollision(Gear); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
827 |
if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
828 |
draw:= true; |
5024 | 829 |
xx:= hwRound(Gear^.X); |
830 |
yy:= hwRound(Gear^.Y); |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
831 |
if draw and (WorldEdge = weWrap) and ((xx < leftX + 3) or (xx > rightX - 3)) then |
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
832 |
begin |
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
833 |
if xx < leftX + 3 then |
9563 | 834 |
xx:= rightX-3 |
835 |
else xx:= leftX+3; |
|
836 |
Gear^.X:= int2hwFloat(xx) |
|
837 |
end |
|
5024 | 838 |
end |
839 |
else if GameTicks and $7 = 0 then |
|
4611 | 840 |
begin |
841 |
with Gear^ do |
|
842 |
begin |
|
6450 | 843 |
State:= State and (not gstInvisible); |
5355 | 844 |
X:= X + cWindSpeed * 3200 + dX; |
4611 | 845 |
Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results |
846 |
xx:= hwRound(X); |
|
847 |
yy:= hwRound(Y); |
|
848 |
if vobVelocity <> 0 then |
|
849 |
begin |
|
7649 | 850 |
DirAngle := DirAngle + (Damage / 1000); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
851 |
if DirAngle < 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
852 |
DirAngle := DirAngle + 360 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
853 |
else if 360 < DirAngle then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
854 |
DirAngle := DirAngle - 360; |
4611 | 855 |
end; |
856 |
// move back to cloud layer |
|
10354 | 857 |
if CheckCoordInWater(xx, yy) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
858 |
move:= true |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7468
diff
changeset
|
859 |
else if (xx > snowRight) or (xx < snowLeft) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
860 |
move:=true |
10736
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
861 |
else if (cGravity < _0) and (yy < LAND_HEIGHT-1200) then |
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
862 |
move:=true |
4791 | 863 |
// Solid pixel encountered |
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7468
diff
changeset
|
864 |
else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
4611 | 865 |
begin |
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset
|
866 |
lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); |
8602 | 867 |
if lf = 0 then lf:= lfObject; |
4791 | 868 |
// If there's room below keep falling |
869 |
if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
|
870 |
begin |
|
871 |
X:= X - cWindSpeed * 1600 - dX; |
|
872 |
end |
|
873 |
// If there's room below, on the sides, fill the gaps |
|
874 |
else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx-(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx-(1*hwSign(cWindSpeed)))] = 0) then |
|
875 |
begin |
|
876 |
X:= X - _0_8 * hwSign(cWindSpeed); |
|
877 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
878 |
end |
|
879 |
else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx-(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx-(2*hwSign(cWindSpeed)))] = 0) then |
|
880 |
begin |
|
881 |
X:= X - _0_8 * 2 * hwSign(cWindSpeed); |
|
882 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
883 |
end |
|
884 |
else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx+(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx+(1*hwSign(cWindSpeed)))] = 0) then |
|
885 |
begin |
|
886 |
X:= X + _0_8 * hwSign(cWindSpeed); |
|
887 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
888 |
end |
|
889 |
else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx+(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx+(2*hwSign(cWindSpeed)))] = 0) then |
|
890 |
begin |
|
891 |
X:= X + _0_8 * 2 * hwSign(cWindSpeed); |
|
892 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
893 |
end |
|
4805
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset
|
894 |
// if there's an hog/object below do nothing |
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset
|
895 |
else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy+1, xx] and $FF) <> 0)) |
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset
|
896 |
then move:=true |
5024 | 897 |
else draw:= true |
898 |
end |
|
899 |
end |
|
900 |
end; |
|
6131 | 901 |
if draw then |
5024 | 902 |
with Gear^ do |
903 |
begin |
|
904 |
// we've collided with land. draw some stuff and get back into the clouds |
|
905 |
move:= true; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
906 |
if (Pos > 20) and ((CurAmmoGear = nil) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
907 |
or (CurAmmoGear^.Kind <> gtRope)) then |
5024 | 908 |
begin |
909 |
////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
910 |
if not gun then |
5024 | 911 |
begin |
912 |
dec(yy,3); |
|
913 |
dec(xx,1) |
|
914 |
end; |
|
915 |
s:= SpritesData[sprSnow].Surface; |
|
916 |
p:= s^.pixels; |
|
917 |
allpx:= true; |
|
918 |
for py:= 0 to Pred(s^.h) do |
|
919 |
begin |
|
920 |
for px:= 0 to Pred(s^.w) do |
|
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
921 |
begin |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
922 |
lx:=xx + px; ly:=yy + py; |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
923 |
if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then |
5024 | 924 |
begin |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
925 |
rx:= lx; |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
926 |
ry:= ly; |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
927 |
if cReducedQuality and rqBlurryLand <> 0 then |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
928 |
begin |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
929 |
rx:= rx div 2;ry:= ry div 2; |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
930 |
end; |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
931 |
if Land[yy + py, xx + px] <= lfAllObjMask then |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
932 |
if gun then |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
933 |
begin |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
934 |
LandDirty[yy div 32, xx div 32]:= 1; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
935 |
if LandPixels[ry, rx] = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
936 |
Land[ly, lx]:= lfDamaged or lfObject |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
937 |
else Land[ly, lx]:= lfDamaged or lfBasic |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
938 |
end |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
939 |
else Land[ly, lx]:= lf; |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
940 |
if gun then |
10645
b8c73bacb31e
Fix in-flight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset
|
941 |
LandPixels[ry, rx]:= (Gear^.Tint shr 24 shl RShift) or |
b8c73bacb31e
Fix in-flight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset
|
942 |
(Gear^.Tint shr 16 and $FF shl GShift) or |
b8c73bacb31e
Fix in-flight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset
|
943 |
(Gear^.Tint shr 8 and $FF shl BShift) or |
b8c73bacb31e
Fix in-flight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset
|
944 |
(p^[px] and AMask) |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
945 |
else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]); |
5024 | 946 |
end |
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
947 |
else allpx:= false |
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
948 |
end; |
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10125
diff
changeset
|
949 |
p:= PLongWordArray(@(p^[s^.pitch shr 2])) |
5024 | 950 |
end; |
8795 | 951 |
|
952 |
// Why is this here. For one thing, there's no test on +1 being safe. |
|
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset
|
953 |
//Land[py, px+1]:= lfBasic; |
8795 | 954 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
955 |
if allpx then |
7170
84ac6c6d2d8e
Only create textures for non-empty LandPixel chunks. This should save a fair amount of memory, especially on smaller maps, and eliminate a number of draws
nemo
parents:
7168
diff
changeset
|
956 |
UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w), true) |
4791 | 957 |
else |
4611 | 958 |
begin |
5024 | 959 |
UpdateLandTexture( |
960 |
max(0, min(LAND_WIDTH, xx)), |
|
961 |
min(LAND_WIDTH - xx, Pred(s^.w)), |
|
962 |
max(0, min(LAND_WIDTH, yy)), |
|
7170
84ac6c6d2d8e
Only create textures for non-empty LandPixel chunks. This should save a fair amount of memory, especially on smaller maps, and eliminate a number of draws
nemo
parents:
7168
diff
changeset
|
963 |
min(LAND_HEIGHT - yy, Pred(s^.h)), false // could this be true without unnecessarily creating blanks? |
5024 | 964 |
); |
4791 | 965 |
end; |
5024 | 966 |
////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// |
4611 | 967 |
end |
5024 | 968 |
end; |
969 |
||
970 |
if move then |
|
971 |
begin |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
972 |
if gun then |
5024 | 973 |
begin |
974 |
DeleteGear(Gear); |
|
975 |
exit |
|
976 |
end; |
|
5695 | 977 |
Gear^.Pos:= 0; |
7721 | 978 |
Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft); |
10736
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
979 |
if (cGravity < _0) and (yy < LAND_HEIGHT-1200) then |
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
980 |
Gear^.Y:= int2hwFloat(LAND_HEIGHT - 50 - LongInt(GetRandom(50))) |
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
981 |
else Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50)) - 1250); |
5413 | 982 |
Gear^.State:= Gear^.State or gstInvisible; |
4611 | 983 |
end |
984 |
end; |
|
985 |
||
4578 | 986 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 987 |
procedure doStepGrave(Gear: PGear); |
988 |
begin |
|
7394 | 989 |
if (Gear^.Message and gmDestroy) <> 0 then |
7393
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset
|
990 |
begin |
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset
|
991 |
DeleteGear(Gear); |
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset
|
992 |
exit |
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset
|
993 |
end; |
7394 | 994 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
995 |
AllInactive := false; |
7394 | 996 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
997 |
if Gear^.dY.isNegative then |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
998 |
if TestCollisionY(Gear, -1) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
999 |
Gear^.dY := _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1000 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1001 |
if not Gear^.dY.isNegative then |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
1002 |
if TestCollisionY(Gear, 1) <> 0 then |
9820 | 1003 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1004 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1005 |
if Gear^.dY > - _1div1024 then |
9820 | 1006 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1007 |
Gear^.Active := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1008 |
exit |
9820 | 1009 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1010 |
else if Gear^.dY < - _0_03 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1011 |
PlaySound(Gear^.ImpactSound) |
9820 | 1012 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1013 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1014 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1015 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1016 |
Gear^.dY := Gear^.dY + cGravity |
4 | 1017 |
end; |
1018 |
||
1019 |
//////////////////////////////////////////////////////////////////////////////// |
|
3080 | 1020 |
procedure doStepBeeWork(Gear: PGear); |
8795 | 1021 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1022 |
t: hwFloat; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1023 |
gX,gY,i: LongInt; |
14519
5ac181cb2396
Fix bee targeting fail across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14403
diff
changeset
|
1024 |
uw, nuw, wrapped: boolean; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1025 |
flower: PVisualGear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1026 |
|
4 | 1027 |
begin |
14519
5ac181cb2396
Fix bee targeting fail across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14403
diff
changeset
|
1028 |
wrapped:= WorldWrap(Gear); |
5ac181cb2396
Fix bee targeting fail across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14403
diff
changeset
|
1029 |
if wrapped then |
5ac181cb2396
Fix bee targeting fail across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14403
diff
changeset
|
1030 |
HomingWrap(Gear); |
5ac181cb2396
Fix bee targeting fail across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14403
diff
changeset
|
1031 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1032 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1033 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1034 |
gY := hwRound(Gear^.Y); |
6251 | 1035 |
uw := (Gear^.Tag <> 0); // was bee underwater last tick? |
10354 | 1036 |
nuw := CheckCoordInWater(gx, gy + Gear^.Radius); // is bee underwater now? |
6251 | 1037 |
|
1038 |
// if water entered or left |
|
1039 |
if nuw <> uw then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1040 |
begin |
10363 | 1041 |
if Gear^.Timer <> 5000 then |
1042 |
AddSplashForGear(Gear, false); |
|
7053 | 1043 |
StopSoundChan(Gear^.SoundChannel); |
6251 | 1044 |
if nuw then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1045 |
begin |
6251 | 1046 |
Gear^.SoundChannel := LoopSound(sndBeeWater); |
1047 |
Gear^.Tag := 1; |
|
1048 |
end |
|
1049 |
else |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1050 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1051 |
Gear^.SoundChannel := LoopSound(sndBee); |
6251 | 1052 |
Gear^.Tag := 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1053 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1054 |
end; |
6251 | 1055 |
|
1056 |
||
1057 |
if Gear^.Timer = 0 then |
|
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1058 |
begin |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
1059 |
// no energy? just fall |
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1060 |
doStepFallingGear(Gear); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1061 |
// if drowning, stop bee sound |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1062 |
if (Gear^.State and gstDrowning) <> 0 then |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1063 |
StopSoundChan(Gear^.SoundChannel); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1064 |
end |
6251 | 1065 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1066 |
begin |
11480 | 1067 |
if (Gear^.Timer and $F) = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1068 |
begin |
11480 | 1069 |
if (Gear^.Timer and $3F) = 0 then |
10352 | 1070 |
AddVisualGear(gX, gY, vgtBeeTrace); |
1071 |
||
11480 | 1072 |
Gear^.dX := Gear^.dX + _0_000064 * (Gear^.Target.X - gX); |
1073 |
Gear^.dY := Gear^.dY + _0_000064 * (Gear^.Target.Y - gY); |
|
6251 | 1074 |
// make sure new speed isn't higher than original one (which we stored in Friction variable) |
1075 |
t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
|
1076 |
Gear^.dX := Gear^.dX * t; |
|
1077 |
Gear^.dY := Gear^.dY * t; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1078 |
end; |
6251 | 1079 |
|
1080 |
Gear^.X := Gear^.X + Gear^.dX; |
|
1081 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
1082 |
||
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1083 |
end; |
3591 | 1084 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1085 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1086 |
CheckCollision(Gear); |
6251 | 1087 |
if ((Gear^.State and gstCollision) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1088 |
begin |
7053 | 1089 |
StopSoundChan(Gear^.SoundChannel); |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
1090 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1091 |
for i:= 0 to 31 do |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1092 |
begin |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1093 |
flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
6131 | 1094 |
if flower <> nil then |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1095 |
with flower^ do |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1096 |
begin |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1097 |
Scale:= 0.75; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1098 |
dx:= 0.001 * (random(200)); |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1099 |
dy:= 0.001 * (random(200)); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1100 |
if random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1101 |
dx := -dx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1102 |
if random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1103 |
dy := -dy; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1104 |
FrameTicks:= random(250) + 250; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1105 |
State:= ord(sprTargetBee); |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1106 |
end; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1107 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1108 |
DeleteGear(Gear); |
10135 | 1109 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1110 |
end; |
6251 | 1111 |
|
1112 |
if (Gear^.Timer > 0) then |
|
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1113 |
begin |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1114 |
dec(Gear^.Timer); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1115 |
if Gear^.Timer = 0 then |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1116 |
begin |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1117 |
// no need to display remaining time anymore |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1118 |
Gear^.RenderTimer:= false; |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1119 |
// bee can drown when timer reached 0 |
9954 | 1120 |
Gear^.State:= Gear^.State and (not gstSubmersible); |
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1121 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1122 |
end; |
4 | 1123 |
end; |
1124 |
||
3080 | 1125 |
procedure doStepBee(Gear: PGear); |
4 | 1126 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1127 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1128 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1129 |
Gear^.Y := Gear^.Y + Gear^.dY; |
11290 | 1130 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1131 |
Gear^.dY := Gear^.dY + cGravity; |
10363 | 1132 |
CheckGearDrowning(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1133 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1134 |
if (Gear^.State and gstCollision) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1135 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
1136 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1137 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1138 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1139 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1140 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1141 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1142 |
begin |
6450 | 1143 |
Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack); |
1144 |
Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and (not gstAttacking); |
|
4135
5be798ecafdc
This should make bee and other targetted things behave more reliably in infinite attack mode. Blocks switching of weps if a target point is active.
nemo
parents:
4104
diff
changeset
|
1145 |
AttackBar:= 0; |
8795 | 1146 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1147 |
Gear^.SoundChannel := LoopSound(sndBee); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1148 |
Gear^.Timer := 5000; |
3591 | 1149 |
// save initial speed in otherwise unused Friction variable |
1150 |
Gear^.Friction := Distance(Gear^.dX, Gear^.dY); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1151 |
Gear^.doStep := @doStepBeeWork |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1152 |
end; |
4 | 1153 |
end; |
1154 |
||
1155 |
//////////////////////////////////////////////////////////////////////////////// |
|
876 | 1156 |
procedure doStepShotIdle(Gear: PGear); |
1157 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1158 |
AllInactive := false; |
13157 | 1159 |
if (Gear^.Kind <> gtMinigunBullet) then |
1160 |
begin |
|
1161 |
inc(Gear^.Timer); |
|
1162 |
if Gear^.Timer > 75 then |
|
1163 |
begin |
|
1164 |
DeleteGear(Gear); |
|
1165 |
AfterAttack |
|
1166 |
end |
|
1167 |
end |
|
1168 |
else |
|
14561 | 1169 |
DeleteGear(Gear); |
876 | 1170 |
end; |
1171 |
||
13152
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1172 |
procedure CreateShellForGear(Gear: PGear; startFrame: Longword); |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1173 |
var |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1174 |
shell: PVisualGear; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1175 |
begin |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1176 |
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1177 |
if shell <> nil then |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1178 |
begin |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1179 |
shell^.dX := gear^.dX.QWordValue / -17179869184; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1180 |
if (gear^.dX.isNegative) then |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1181 |
shell^.dX := -shell^.dX; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1182 |
shell^.dY := gear^.dY.QWordValue / -17179869184; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1183 |
shell^.Frame := startFrame; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1184 |
end; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1185 |
end; |
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1186 |
|
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1187 |
function ShotgunLineHitHelp(Gear: PGear; oX, oY, tX, tY: hwFloat): Boolean; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1188 |
var i: LongInt; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1189 |
Collisions: PGearArray; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1190 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1191 |
ShotgunLineHitHelp := false; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1192 |
Collisions := CheckAllGearsLineCollision(Gear, oX, oY, tX, tY); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1193 |
i := Collisions^.Count; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1194 |
while i > 0 do |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1195 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1196 |
dec(i); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1197 |
if Collisions^.ar[i]^.Kind in |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1198 |
[gtMine, gtSMine, gtAirMine, gtKnife, gtCase, gtTarget, gtExplosives] then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1199 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1200 |
Gear^.X := Collisions^.ar[i]^.X; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1201 |
Gear^.Y := Collisions^.ar[i]^.Y; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1202 |
ShotgunShot(Gear); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1203 |
Gear^.doStep := @doStepShotIdle; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1204 |
ShotgunLineHitHelp := true; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1205 |
exit; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1206 |
end; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1207 |
end; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1208 |
end; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1209 |
|
4 | 1210 |
procedure doStepShotgunShot(Gear: PGear); |
8795 | 1211 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1212 |
i: LongWord; |
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1213 |
oX, oY, tmpX, tmpY: hwFloat; |
4 | 1214 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1215 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1216 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1217 |
if ((Gear^.State and gstAnimation) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1218 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1219 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1220 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1221 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1222 |
PlaySound(sndShotgunFire); |
13152
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1223 |
CreateShellForGear(Gear, 0); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1224 |
Gear^.State := Gear^.State or gstAnimation |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1225 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1226 |
exit |
7564
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1227 |
end else |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1228 |
if(Gear^.Hedgehog^.Gear = nil) or ((Gear^.Hedgehog^.Gear^.State and gstMoving) <> 0) then |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1229 |
begin |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1230 |
DeleteGear(Gear); |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1231 |
AfterAttack; |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1232 |
exit |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1233 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1234 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1235 |
inc(Gear^.Timer); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1236 |
|
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1237 |
i := 100; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1238 |
oX := Gear^.X; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1239 |
oY := Gear^.Y; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1240 |
repeat |
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1241 |
if Gear^.Tag = 0 then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1242 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1243 |
Gear^.X := Gear^.X + Gear^.dX; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1244 |
Gear^.Y := Gear^.Y + Gear^.dY; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1245 |
end; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1246 |
|
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1247 |
tmpX := Gear^.X; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1248 |
tmpY := Gear^.Y; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1249 |
if (Gear^.PortalCounter < 30) and WorldWrap(Gear) then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1250 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1251 |
inc(Gear^.PortalCounter); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1252 |
if ShotgunLineHitHelp(Gear, oX, oY, tmpX, tmpY) then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1253 |
exit; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1254 |
oX := Gear^.X; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1255 |
oY := Gear^.Y; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1256 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1257 |
CheckCollision(Gear); |
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1258 |
|
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1259 |
if ((Gear^.State and gstCollision) <> 0) then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1260 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1261 |
if Gear^.Tag = 0 then |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1262 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1263 |
//Try to align the shot with the land to give portals a chance to catch it |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1264 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1265 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1266 |
Gear^.Tag := 1 |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1267 |
end |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1268 |
else |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1269 |
begin |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1270 |
Gear^.X := Gear^.X + Gear^.dX * 6; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1271 |
Gear^.Y := Gear^.Y + Gear^.dY * 6; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1272 |
ShotgunShot(Gear); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1273 |
Gear^.doStep := @doStepShotIdle; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1274 |
end; |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1275 |
exit |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1276 |
end |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1277 |
else |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1278 |
Gear^.Tag := 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1279 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1280 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1281 |
if (Gear^.State and gstDrowning) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1282 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1283 |
Gear^.doStep := @doStepShotIdle; |
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1284 |
break; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1285 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1286 |
dec(i) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1287 |
until i = 0; |
13412
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1288 |
|
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1289 |
ShotgunLineHitHelp(Gear, oX, oY, Gear^.X, Gear^.Y); |
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13411
diff
changeset
|
1290 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1291 |
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1292 |
Gear^.doStep := @doStepShotIdle |
4 | 1293 |
end; |
1294 |
||
1295 |
//////////////////////////////////////////////////////////////////////////////// |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1296 |
procedure spawnBulletTrail(Bullet: PGear; bulletX, bulletY: hwFloat; fadeIn: Boolean); |
5841 | 1297 |
var oX, oY: hwFloat; |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1298 |
fromX, fromY, toX, toY, dX, dY, bLength, stepLength: real; |
5841 | 1299 |
VGear: PVisualGear; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1300 |
i, steps: LongWord; |
5841 | 1301 |
begin |
1302 |
if Bullet^.PortalCounter = 0 then |
|
1303 |
begin |
|
1304 |
ox:= CurrentHedgehog^.Gear^.X + Int2hwFloat(GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle)); |
|
1305 |
oy:= CurrentHedgehog^.Gear^.Y + Int2hwFloat(GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle)); |
|
1306 |
end |
|
1307 |
else |
|
1308 |
begin |
|
1309 |
ox:= Bullet^.Elasticity; |
|
1310 |
oy:= Bullet^.Friction; |
|
1311 |
end; |
|
1312 |
||
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1313 |
fromX:= hwFloat2Float(ox); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1314 |
fromY:= hwFloat2Float(oy); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1315 |
toX:= hwFloat2Float(bulletX); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1316 |
toY:= hwFloat2Float(bulletY); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1317 |
|
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1318 |
dX:= toX - fromX; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1319 |
dY:= toY - fromY; |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1320 |
bLength:= sqrt(dX * dX + dY * dY); |
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1321 |
dX:= dX / bLength; |
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1322 |
dY:= dY / bLength; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1323 |
|
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1324 |
if fadeIn then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1325 |
begin |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1326 |
steps:= 10; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1327 |
stepLength:= 12; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1328 |
fromX:= fromX + dX * 45; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1329 |
fromY:= fromY + dY * 45; |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1330 |
bLength:= bLength - 45; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1331 |
end |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1332 |
else steps:= 1; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1333 |
|
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1334 |
for i:= 0 to steps - 1 do |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1335 |
begin |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1336 |
if i < steps - 1 then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1337 |
begin |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1338 |
toX:= fromX + dX * minD(stepLength, bLength); |
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1339 |
toY:= fromY + dY * minD(stepLength, bLength); |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1340 |
end |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1341 |
else if steps > 1 then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1342 |
begin |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1343 |
toX:= fromX + dX * bLength; |
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1344 |
toY:= fromY + dY * bLength; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1345 |
end; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1346 |
|
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1347 |
if bLength > 0 then |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1348 |
begin |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1349 |
VGear := AddVisualGear(round(fromX), round(fromY), vgtLineTrail); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1350 |
if VGear <> nil then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1351 |
begin |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1352 |
VGear^.X:= fromX; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1353 |
VGear^.Y:= fromY; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1354 |
VGear^.dX:= toX; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1355 |
VGear^.dY:= toY; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1356 |
VGear^.Tint:= $FFFFFF00 or ($FF * (i + 1) div (steps)); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1357 |
|
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1358 |
// reached edge of land. assume infinite beam. Extend it way out past camera |
13326
23ade5604f8d
Fix bullet trails overlapping when the pass through wrap or bounce world edge
alfadur
parents:
13323
diff
changeset
|
1359 |
if ((round(toX) and LAND_WIDTH_MASK <> 0) and (not (WorldEdge in [weBounce, weWrap]))) |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1360 |
or (round(toY) and LAND_HEIGHT_MASK <> 0) then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1361 |
// only extend if not under water |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1362 |
if not CheckCoordInWater(round(toX), round(toY)) then |
5841 | 1363 |
begin |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1364 |
VGear^.dX := VGear^.dX + max(LAND_WIDTH,4096) * (VGear^.dX - VGear^.X); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1365 |
VGear^.dY := VGear^.dY + max(LAND_WIDTH,4096) * (VGear^.dY - VGear^.Y); |
5841 | 1366 |
end; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1367 |
VGear^.Timer := 200; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1368 |
end; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1369 |
end; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1370 |
|
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1371 |
if i < steps - 1 then |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1372 |
begin |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1373 |
fromX:= toX; |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1374 |
fromY:= toY; |
13346
0c3f612edc19
Partial fix of Pas2C parsing problems (part 1: uGearsHandlersMess)
Wuzzy <Wuzzy2@mail.ru>
parents:
13328
diff
changeset
|
1375 |
bLength:= bLength - stepLength; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1376 |
end |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1377 |
end; |
5841 | 1378 |
end; |
1379 |
||
12903 | 1380 |
procedure LineShoveHelp(Gear: PGear; oX, oY, tX, tY, dX, dY: hwFloat; count: LongWord); |
1381 |
var dmg,power: LongInt; |
|
1382 |
begin |
|
13408
9c9d29be9e00
make all bullets function similar to machinegun bullets (can hit/shove objects without checkin)
nemo
parents:
13407
diff
changeset
|
1383 |
if hwSqr(tX - oX) + hwSqr(tY - oY) > _0_25 then |
12903 | 1384 |
begin |
1385 |
if (Gear^.AmmoType = amDEagle) or (Gear^.AmmoType = amMinigun) then |
|
1386 |
dmg:= Gear^.Boom |
|
1387 |
else |
|
1388 |
dmg:= Gear^.Timer * Gear^.Boom div 100000; |
|
1389 |
if (Gear^.AmmoType = amMinigun) then |
|
1390 |
power:= 10 |
|
1391 |
else |
|
1392 |
power:= 20; |
|
1393 |
AmmoShoveLine(Gear, dmg, power, oX, oY, tX, tY); |
|
1394 |
end; |
|
1395 |
if Gear^.Damage > 0 then |
|
1396 |
begin |
|
1397 |
DrawTunnel(oX, oY, dX, dY, count, 1); |
|
1398 |
dec(Gear^.Health, Gear^.Damage); |
|
1399 |
Gear^.Damage := 0 |
|
1400 |
end; |
|
1401 |
end; |
|
1402 |
||
13386 | 1403 |
procedure CheckBulletDrowningHelp(Bullet: PGear); |
1404 |
var dX, dY: hwFloat; |
|
1405 |
begin |
|
1406 |
dX := Bullet^.dX; |
|
1407 |
dY := Bullet^.dY; |
|
1408 |
CheckGearDrowning(Bullet); |
|
1409 |
if (dX <> Bullet^.dX) or (dY <> Bullet^.dY) then |
|
1410 |
begin |
|
1411 |
SpawnBulletTrail(Bullet, Bullet^.X, Bullet^.Y, Bullet^.FlightTime = 0); |
|
1412 |
Bullet^.Elasticity := Bullet^.X; |
|
1413 |
Bullet^.Friction := Bullet^.Y; |
|
1414 |
Inc(Bullet^.PortalCounter); |
|
1415 |
Bullet^.FlightTime:= 1; |
|
1416 |
end; |
|
1417 |
end; |
|
1418 |
||
13413 | 1419 |
procedure CreateBubblesForBullet(Gear: PGear); |
1420 |
var i, iInit: LongWord; |
|
1421 |
begin |
|
14289 | 1422 |
iInit:= 0; |
13413 | 1423 |
if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Health > 0) then |
1424 |
begin |
|
1425 |
// draw bubbles |
|
1426 |
if (not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF)) then |
|
1427 |
begin |
|
1428 |
case Gear^.Kind of |
|
1429 |
gtMinigunBullet: iInit:= Gear^.Health * 100; |
|
1430 |
gtDEagleShot, gtSniperRifleShot: iInit:= Gear^.Health * 4 |
|
1431 |
end; |
|
1432 |
for i:=iInit downto 0 do |
|
1433 |
begin |
|
1434 |
if Random(6) = 0 then |
|
1435 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); |
|
1436 |
Gear^.X := Gear^.X + Gear^.dX; |
|
1437 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
1438 |
end; |
|
1439 |
end; |
|
1440 |
// bullet dies underwater |
|
1441 |
Gear^.Health:= 0; |
|
1442 |
end; |
|
1443 |
end; |
|
1444 |
||
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1445 |
procedure doStepBulletWork(Gear: PGear); |
8795 | 1446 |
var |
12382
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1447 |
i, x, y, iInit: LongWord; |
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1448 |
oX, oY, tX, tY, tDx, tDy: hwFloat; |
4327 | 1449 |
VGear: PVisualGear; |
12903 | 1450 |
LandFlags: Word; |
1451 |
isDigging: Boolean; |
|
1452 |
isDead: Boolean; |
|
38 | 1453 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1454 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1455 |
inc(Gear^.Timer); |
12903 | 1456 |
iInit := 100; |
12382
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1457 |
i := iInit; |
12903 | 1458 |
isDigging := false; |
1459 |
isDead := false; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1460 |
oX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1461 |
oY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1462 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1463 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1464 |
Gear^.Y := Gear^.Y + Gear^.dY; |
9485
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1465 |
tX:= Gear^.X; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1466 |
tY:= Gear^.Y; |
12382
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1467 |
tDx:= Gear^.dX; |
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1468 |
tDy:= Gear^.dY; |
9565 | 1469 |
if (Gear^.PortalCounter < 30) and WorldWrap(Gear) then |
9485
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1470 |
begin |
12903 | 1471 |
LineShoveHelp(Gear, oX, oY, tX, tY, tDx, tDy, iInit + 2 - i); |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1472 |
SpawnBulletTrail(Gear, tX, tY, Gear^.FlightTime = 0); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1473 |
Gear^.FlightTime:= 1; |
12382
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1474 |
iInit:= i; |
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1475 |
oX:= Gear^.X; |
efa13b925cd8
Fix bullets being reflected too early on bouncy world edge border while digging land
alfadur
parents:
12311
diff
changeset
|
1476 |
oY:= Gear^.Y; |
9485
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1477 |
inc(Gear^.PortalCounter); |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1478 |
Gear^.Elasticity:= Gear^.X; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1479 |
Gear^.Friction:= Gear^.Y; |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1480 |
SpawnBulletTrail(Gear, Gear^.X, Gear^.Y, false); |
13323
9071600f7b22
Fix minigun bullets hitting shooter when it hits hog on other side of world wrap
alfadur
parents:
13290
diff
changeset
|
1481 |
|
9071600f7b22
Fix minigun bullets hitting shooter when it hits hog on other side of world wrap
alfadur
parents:
13290
diff
changeset
|
1482 |
// bullets can now hurt the hog that fired them |
9071600f7b22
Fix minigun bullets hitting shooter when it hits hog on other side of world wrap
alfadur
parents:
13290
diff
changeset
|
1483 |
if WorldEdge <> weSea then Gear^.Data:= nil; |
9485
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1484 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1485 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1486 |
y := hwRound(Gear^.Y); |
8795 | 1487 |
|
12903 | 1488 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
1489 |
begin |
|
1490 |
LandFlags:= Land[y, x]; |
|
1491 |
if LandFlags <> 0 then inc(Gear^.Damage); |
|
1492 |
isDigging:= (LandFlags and lfLandMask) <> 0; |
|
1493 |
end; |
|
1494 |
// let's interrupt before a collision with land to give portals a chance to catch the bullet |
|
1495 |
if isDigging and (Gear^.Tag = 0) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1496 |
begin |
5841 | 1497 |
Gear^.Tag := 1; |
12903 | 1498 |
dec(Gear^.Damage); |
5841 | 1499 |
Gear^.X := Gear^.X - Gear^.dX; |
1500 |
Gear^.Y := Gear^.Y - Gear^.dY; |
|
13386 | 1501 |
CheckBulletDrowningHelp(Gear); |
5841 | 1502 |
break; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1503 |
end |
12903 | 1504 |
else if (not isDigging) then |
5841 | 1505 |
Gear^.Tag := 0; |
1506 |
||
12903 | 1507 |
//Shove static gears to remove the mask and stop damaging the bullet |
1508 |
if (not isDigging) and (Gear^.Damage > 5) and (Gear^.Kind <> gtMinigunBullet) then |
|
1509 |
begin |
|
1510 |
LineShoveHelp(Gear, oX, oY, tX, tY, tDx, tDy, iInit + 2 - i); |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1511 |
SpawnBulletTrail(Gear, tX, tY, Gear^.FlightTime = 0); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1512 |
Gear^.FlightTime:= 1; |
12903 | 1513 |
iInit:= i; |
1514 |
oX:= Gear^.X; |
|
1515 |
oY:= Gear^.Y; |
|
10125 | 1516 |
end; |
12903 | 1517 |
|
13386 | 1518 |
CheckBulletDrowningHelp(Gear); |
12903 | 1519 |
case Gear^.Kind of |
13362
030b085b182f
real droplet fix - default density is fine - also add back in the underwater bullet trails
nemo
parents:
13346
diff
changeset
|
1520 |
gtMinigunBullet: isDead:= isDigging or ((Gear^.State and gstDrowning) <> 0); |
030b085b182f
real droplet fix - default density is fine - also add back in the underwater bullet trails
nemo
parents:
13346
diff
changeset
|
1521 |
gtDEagleShot, gtSniperRifleShot: isDead:= (Gear^.Damage >= Gear^.Health) or ((Gear^.State and gstDrowning) <> 0) |
12903 | 1522 |
end; |
8795 | 1523 |
dec(i) |
13362
030b085b182f
real droplet fix - default density is fine - also add back in the underwater bullet trails
nemo
parents:
13346
diff
changeset
|
1524 |
until (i = 0) or (isDead); |
12903 | 1525 |
|
1526 |
LineShoveHelp(Gear, oX, oY, Gear^.X, Gear^.Y, |
|
1527 |
Gear^.dX, Gear^.dY, iInit + 2 - i); |
|
10650
7f23971bd9db
fix some old code that assumes that a bullet under water is always outside land array - which is wrong (e.g. during sudden-death in previous releases, also weSea now)
sheepluva
parents:
10645
diff
changeset
|
1528 |
|
13413 | 1529 |
CreateBubblesForBullet(Gear); |
1530 |
||
1531 |
x := hwRound(Gear^.X); |
|
1532 |
y := hwRound(Gear^.Y); |
|
1533 |
if (isDead) or (x and LAND_WIDTH_MASK <> 0) or (y and LAND_HEIGHT_MASK <> 0) then |
|
1534 |
begin |
|
1535 |
if (Gear^.Kind = gtSniperRifleShot) then |
|
1536 |
cLaserSightingSniper := false; |
|
1537 |
if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and (CurrentHedgehog^.Effects[heArtillery] = 2) then |
|
1538 |
CurrentHedgehog^.Effects[heArtillery]:= 0; |
|
1539 |
||
1540 |
// Bullet Hit |
|
1541 |
if ((Gear^.State and gstDrowning) = 0) and (x and LAND_WIDTH_MASK = 0) and (y and LAND_HEIGHT_MASK = 0) then |
|
1542 |
begin |
|
1543 |
if Gear^.Kind = gtMinigunBullet then |
|
10650
7f23971bd9db
fix some old code that assumes that a bullet under water is always outside land array - which is wrong (e.g. during sudden-death in previous releases, also weSea now)
sheepluva
parents:
10645
diff
changeset
|
1544 |
begin |
13413 | 1545 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, |
14060
82956b3ba2ab
prevent minigun bullet land impacts from pushing hedgehogs
alfadur
parents:
14045
diff
changeset
|
1546 |
Gear^.Hedgehog, (EXPLNoDamage or EXPLDoNotTouchHH){ or EXPLDontDraw or EXPLNoGfx}); |
13413 | 1547 |
VGear := AddVisualGear(hwRound(Gear^.X + Gear^.dX * 5), hwRound(Gear^.Y + Gear^.dY * 5), vgtBulletHit); |
1548 |
end |
|
1549 |
else |
|
1550 |
VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit); |
|
1551 |
||
1552 |
if VGear <> nil then |
|
1553 |
begin |
|
1554 |
VGear^.Angle := DxDy2Angle(-Gear^.dX, Gear^.dY); |
|
10650
7f23971bd9db
fix some old code that assumes that a bullet under water is always outside land array - which is wrong (e.g. during sudden-death in previous releases, also weSea now)
sheepluva
parents:
10645
diff
changeset
|
1555 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1556 |
end; |
13413 | 1557 |
|
1558 |
spawnBulletTrail(Gear, Gear^.X, Gear^.Y, Gear^.FlightTime = 0); |
|
1559 |
Gear^.FlightTime:= 1; |
|
1560 |
if Gear^.Kind = gtMinigunBullet then |
|
1561 |
ClearHitOrderLeq(Gear^.Tag); |
|
1562 |
||
1563 |
if (worldEdge = weSea) and (Gear^.Kind = gtMinigunBullet) |
|
1564 |
and Gear^.Y.isNegative and Gear^.dY.isNegative |
|
1565 |
and (Gear^.Health > 0) and (not isZero(Gear^.dX)) then |
|
1566 |
begin |
|
1567 |
if Gear^.dX.isNegative then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1568 |
begin |
13413 | 1569 |
|
1570 |
Gear^.X:= int2hwFloat(-1); |
|
1571 |
iInit:= x - leftX; |
|
1572 |
end |
|
1573 |
else |
|
1574 |
begin |
|
1575 |
Gear^.X:= int2hwFloat(LAND_WIDTH); |
|
1576 |
iInit:= rightX - x - 1; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1577 |
end; |
13413 | 1578 |
Gear^.Y:= Gear^.Y + Gear^.dY * hwAbs(int2hwFloat(iInit) / Gear^.dX); |
1579 |
CheckGearDrowning(Gear); |
|
1580 |
CreateBubblesForBullet(Gear); |
|
1581 |
end; |
|
1582 |
Gear^.doStep := @doStepShotIdle |
|
1583 |
end; |
|
37 | 1584 |
end; |
1585 |
||
559 | 1586 |
procedure doStepDEagleShot(Gear: PGear); |
1587 |
begin |
|
11555
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1588 |
Gear^.Data:= nil; |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1589 |
// remember who fired this |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1590 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1591 |
Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear); |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1592 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1593 |
PlaySound(sndGun); |
13408
9c9d29be9e00
make all bullets function similar to machinegun bullets (can hit/shove objects without checkin)
nemo
parents:
13407
diff
changeset
|
1594 |
ClearHitOrder(); |
11558 | 1595 |
// add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles |
11557 | 1596 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
1597 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1598 |
Gear^.FlightTime := 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1599 |
Gear^.doStep := @doStepBulletWork |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1600 |
end; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1601 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1602 |
procedure doStepSniperRifleShot(Gear: PGear); |
12903 | 1603 |
var HHGear: PGear; |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1604 |
begin |
11555
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1605 |
|
4365 | 1606 |
HHGear := Gear^.Hedgehog^.Gear; |
13101
d78e65c66573
Add hedgehog effect heArtillery, allows to set per-hedgehog artillery mode
Wuzzy <Wuzzy2@mail.ru>
parents:
13063
diff
changeset
|
1607 |
if (Gear^.Hedgehog^.Effects[heArtillery] <> 1) then |
d78e65c66573
Add hedgehog effect heArtillery, allows to set per-hedgehog artillery mode
Wuzzy <Wuzzy2@mail.ru>
parents:
13063
diff
changeset
|
1608 |
Gear^.Hedgehog^.Effects[heArtillery]:= 2; |
10174 | 1609 |
|
1610 |
if HHGear = nil then |
|
1611 |
begin |
|
1612 |
DeleteGear(gear); |
|
1613 |
exit |
|
1614 |
end; |
|
1615 |
||
11555
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1616 |
// remember who fired this |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1617 |
Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear); |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
1618 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1619 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1620 |
HedgehogChAngle(HHGear); |
12311
cdd884397760
Fix sniper rifle disabling laser sight utility after shooting
Wuzzy <almikes@aol.com>
parents:
12305
diff
changeset
|
1621 |
if cLaserSightingSniper = false then |
cdd884397760
Fix sniper rifle disabling laser sight utility after shooting
Wuzzy <almikes@aol.com>
parents:
12305
diff
changeset
|
1622 |
// Turn sniper's laser sight on and give it a chance to aim |
cdd884397760
Fix sniper rifle disabling laser sight utility after shooting
Wuzzy <almikes@aol.com>
parents:
12305
diff
changeset
|
1623 |
begin |
cdd884397760
Fix sniper rifle disabling laser sight utility after shooting
Wuzzy <almikes@aol.com>
parents:
12305
diff
changeset
|
1624 |
cLaserSightingSniper := true; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1625 |
HHGear^.Message := 0; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
1626 |
if (HHGear^.Angle >= 32) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1627 |
dec(HHGear^.Angle,32) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1628 |
end; |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
1629 |
|
3894 | 1630 |
if (HHGear^.Message and gmAttack) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1631 |
begin |
13152
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
1632 |
CreateShellForGear(Gear, 1); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1633 |
Gear^.State := Gear^.State or gstAnimation; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1634 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1635 |
Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1636 |
PlaySound(sndGun); |
13408
9c9d29be9e00
make all bullets function similar to machinegun bullets (can hit/shove objects without checkin)
nemo
parents:
13407
diff
changeset
|
1637 |
ClearHitOrder(); |
11558 | 1638 |
// add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles |
1639 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
|
1640 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
1641 |
Gear^.FlightTime := 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1642 |
Gear^.doStep := @doStepBulletWork; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1643 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1644 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1645 |
if (GameTicks mod 32) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1646 |
if (GameTicks mod 4096) < 2048 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1647 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1648 |
if (HHGear^.Angle + 1 <= cMaxAngle) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1649 |
inc(HHGear^.Angle) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1650 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1651 |
else |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
1652 |
if (HHGear^.Angle >= 1) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1653 |
dec(HHGear^.Angle); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1654 |
|
11923
9da78300c5d0
Fix sniper rifle making timer gray all the time
Wuzzy <almikes@aol.com>
parents:
11920
diff
changeset
|
1655 |
if (TurnTimeLeft = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1656 |
begin |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
1657 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1658 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1659 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1660 |
end; |
559 | 1661 |
end; |
1662 |
||
37 | 1663 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 1664 |
procedure doStepActionTimer(Gear: PGear); |
1665 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1666 |
dec(Gear^.Timer); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1667 |
case Gear^.Kind of |
8795 | 1668 |
gtATStartGame: |
8679 | 1669 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1670 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1671 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1672 |
begin |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
1673 |
AddCaption(GetEventString(eidRoundStart), capcolDefault, capgrpGameState); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1674 |
end |
8679 | 1675 |
end; |
8795 | 1676 |
gtATFinishGame: |
8679 | 1677 |
begin |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1678 |
AllInactive := false; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1679 |
if Gear^.Timer = 1000 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1680 |
begin |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1681 |
ScreenFade := sfToBlack; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1682 |
ScreenFadeValue := 0; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1683 |
ScreenFadeSpeed := 1; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1684 |
end; |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1685 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1686 |
begin |
7068 | 1687 |
SendIPC(_S'N'); |
1688 |
SendIPC(_S'q'); |
|
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1689 |
GameState := gsExit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1690 |
end |
8679 | 1691 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1692 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1693 |
if Gear^.Timer = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1694 |
DeleteGear(Gear) |
4 | 1695 |
end; |
1696 |
||
1697 |
//////////////////////////////////////////////////////////////////////////////// |
|
1698 |
procedure doStepPickHammerWork(Gear: PGear); |
|
8795 | 1699 |
var |
4578 | 1700 |
i, ei, x, y: LongInt; |
4 | 1701 |
HHGear: PGear; |
1702 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1703 |
AllInactive := false; |
9487
fbe203c1d11e
couple more wrap calls. freezer still doesn't propagate properly. mostly due to
nemo
parents:
9485
diff
changeset
|
1704 |
WorldWrap(Gear); |
4365 | 1705 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1706 |
dec(Gear^.Timer); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1707 |
if (TurnTimeLeft = 0) or (Gear^.Timer = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1708 |
or((Gear^.Message and gmDestroy) <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1709 |
or((HHGear^.State and gstHHDriven) =0) then |
4578 | 1710 |
begin |
7053 | 1711 |
StopSoundChan(Gear^.SoundChannel); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1712 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1713 |
AfterAttack; |
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset
|
1714 |
doStepHedgehogMoving(HHGear); // for gfInfAttack |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1715 |
exit |
4578 | 1716 |
end; |
1717 |
||
1718 |
x:= hwRound(Gear^.X); |
|
1719 |
y:= hwRound(Gear^.Y); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1720 |
if (Gear^.Timer mod 33) = 0 then |
4578 | 1721 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1722 |
HHGear^.State := HHGear^.State or gstNoDamage; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
1723 |
doMakeExplosion(x, y + 7, Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw); |
6450 | 1724 |
HHGear^.State := HHGear^.State and (not gstNoDamage) |
4578 | 1725 |
end; |
422 | 1726 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1727 |
if (Gear^.Timer mod 47) = 0 then |
4578 | 1728 |
begin |
1729 |
// ok. this was an attempt to turn off dust if not actually drilling land. I have no idea why it isn't working as expected |
|
6131 | 1730 |
if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then |
4578 | 1731 |
for i:= 0 to 1 do |
1732 |
AddVisualGear(x - 5 + Random(10), y + 12, vgtDust); |
|
1733 |
||
1734 |
i := x - Gear^.Radius - LongInt(GetRandom(2)); |
|
1735 |
ei := x + Gear^.Radius + LongInt(GetRandom(2)); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1736 |
while i <= ei do |
4578 | 1737 |
begin |
13609
73b096e1d895
Fix hammer/pickhammer not digging land with gfSolidLand on
Wuzzy <Wuzzy2@mail.ru>
parents:
13608
diff
changeset
|
1738 |
doMakeExplosion(i, y + 3, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1739 |
inc(i, 1) |
4578 | 1740 |
end; |
2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset
|
1741 |
|
6314 | 1742 |
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), lfIndestructible) then |
4578 | 1743 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1744 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1745 |
Gear^.Y := Gear^.Y + _1_9; |
4578 | 1746 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1747 |
SetAllHHToActive; |
4578 | 1748 |
end; |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
1749 |
if TestCollisionYwithGear(Gear, 1) <> 0 then |
4578 | 1750 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1751 |
Gear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1752 |
SetLittle(HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1753 |
HHGear^.dY := _0; |
4578 | 1754 |
end |
11020
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1755 |
else if Gear^.dY.isNegative and (TestCollisionYwithGear(HHGear, -1) <> 0) then |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1756 |
begin |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1757 |
Gear^.dY := cGravity; |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1758 |
HHGear^.dY := cGravity; |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1759 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1760 |
else |
4578 | 1761 |
begin |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
1762 |
if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfLandMask) then |
6314 | 1763 |
begin |
1764 |
Gear^.dY := Gear^.dY + cGravity; |
|
1765 |
Gear^.Y := Gear^.Y + Gear^.dY |
|
1766 |
end; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1767 |
if hwRound(Gear^.Y) > cWaterLine then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1768 |
Gear^.Timer := 1 |
4578 | 1769 |
end; |
4 | 1770 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1771 |
Gear^.X := Gear^.X + HHGear^.dX; |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
1772 |
if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfLandMask) then |
6314 | 1773 |
begin |
1774 |
HHGear^.X := Gear^.X; |
|
1775 |
HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius) |
|
1776 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1777 |
|
3894 | 1778 |
if (Gear^.Message and gmAttack) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1779 |
if (Gear^.State and gsttmpFlag) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1780 |
Gear^.Timer := 1 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1781 |
else //there would be a mistake. |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1782 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1783 |
if (Gear^.State and gsttmpFlag) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1784 |
Gear^.State := Gear^.State or gsttmpFlag; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1785 |
if ((Gear^.Message and gmLeft) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1786 |
Gear^.dX := - _0_3 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1787 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1788 |
if ((Gear^.Message and gmRight) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1789 |
Gear^.dX := _0_3 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1790 |
else Gear^.dX := _0; |
4 | 1791 |
end; |
1792 |
||
1793 |
procedure doStepPickHammer(Gear: PGear); |
|
8795 | 1794 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1795 |
i, y: LongInt; |
4 | 1796 |
ar: TRangeArray; |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
1797 |
HHGear: PGear; |
4 | 1798 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1799 |
i := 0; |
4365 | 1800 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1801 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1802 |
y := hwRound(Gear^.Y) - cHHRadius * 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1803 |
while y < hwRound(Gear^.Y) do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1804 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1805 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1806 |
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1807 |
inc(y, 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1808 |
inc(i) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1809 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1810 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1811 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1812 |
Gear^.dY := HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1813 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1814 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1815 |
Gear^.SoundChannel := LoopSound(sndPickhammer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1816 |
doStepPickHammerWork(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1817 |
Gear^.doStep := @doStepPickHammerWork |
4 | 1818 |
end; |
1819 |
||
1820 |
//////////////////////////////////////////////////////////////////////////////// |
|
8795 | 1821 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1822 |
BTPrevAngle, BTSteps: LongInt; |
302 | 1823 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1824 |
procedure doStepBlowTorchWork(Gear: PGear); |
8795 | 1825 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1826 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1827 |
b: boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1828 |
prevX: LongInt; |
302 | 1829 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1830 |
AllInactive := false; |
14342 | 1831 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1832 |
dec(Gear^.Timer); |
8795 | 1833 |
|
9385 | 1834 |
if Gear^.Hedgehog^.Gear = nil then |
1835 |
begin |
|
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
1836 |
StopSoundChan(Gear^.SoundChannel); |
9385 | 1837 |
DeleteGear(Gear); |
1838 |
AfterAttack; |
|
1839 |
exit |
|
1840 |
end; |
|
1841 |
||
4365 | 1842 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1843 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1844 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1845 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1846 |
b := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1847 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1848 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
5706 | 1849 |
begin |
5722
3b7f2bfc8632
Keep blowtorch direction (doesn't actually fix the bug with hedgehog turning opposite direction)
unc0rr
parents:
5716
diff
changeset
|
1850 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1851 |
Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1852 |
BTPrevAngle := HHGear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1853 |
b := true |
5706 | 1854 |
end; |
1528 | 1855 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1856 |
if ((HHGear^.State and gstMoving) <> 0) then |
5706 | 1857 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1858 |
doStepHedgehogMoving(HHGear); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1859 |
if (HHGear^.State and gstHHDriven) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1860 |
Gear^.Timer := 0 |
5706 | 1861 |
end; |
305 | 1862 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1863 |
if Gear^.Timer mod cHHStepTicks = 0 then |
5706 | 1864 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1865 |
b := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1866 |
if Gear^.dX.isNegative then |
3894 | 1867 |
HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1868 |
else |
3894 | 1869 |
HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1870 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1871 |
if ((HHGear^.State and gstMoving) = 0) then |
5706 | 1872 |
begin |
6450 | 1873 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1874 |
prevX := hwRound(HHGear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1875 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1876 |
// why the call to HedgehogStep then a further increment of X? |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1877 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1878 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
3519 | 1879 |
lfIndestructible) then HedgehogStep(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1880 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1881 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1882 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
3519 | 1883 |
lfIndestructible) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1884 |
HHGear^.State := HHGear^.State or gstAttacking |
5706 | 1885 |
end; |
305 | 1886 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1887 |
inc(BTSteps); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1888 |
if BTSteps = 7 then |
5706 | 1889 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1890 |
BTSteps := 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1891 |
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then |
5706 | 1892 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1893 |
Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1894 |
Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
5706 | 1895 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1896 |
HHGear^.State := HHGear^.State or gstNoDamage; |
14342 | 1897 |
AmmoShove(Gear, Gear^.Boom, 15); |
6450 | 1898 |
HHGear^.State := HHGear^.State and (not gstNoDamage) |
5706 | 1899 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1900 |
end; |
305 | 1901 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1902 |
if b then |
9385 | 1903 |
begin |
6278
654eed7c6b97
tweak DrawTunnel call of blowtorch. should fix issues with blowtorch going horizontal when it shouldn't
sheepluva
parents:
6251
diff
changeset
|
1904 |
DrawTunnel(HHGear^.X + Gear^.dX * cHHRadius, |
654eed7c6b97
tweak DrawTunnel call of blowtorch. should fix issues with blowtorch going horizontal when it shouldn't
sheepluva
parents:
6251
diff
changeset
|
1905 |
HHGear^.Y + Gear^.dY * cHHRadius - _1 - |
654eed7c6b97
tweak DrawTunnel call of blowtorch. should fix issues with blowtorch going horizontal when it shouldn't
sheepluva
parents:
6251
diff
changeset
|
1906 |
((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1907 |
Gear^.dX, Gear^.dY, |
6278
654eed7c6b97
tweak DrawTunnel call of blowtorch. should fix issues with blowtorch going horizontal when it shouldn't
sheepluva
parents:
6251
diff
changeset
|
1908 |
cHHStepTicks, cHHRadius * 2 + 7); |
9385 | 1909 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1910 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1911 |
if (TurnTimeLeft = 0) or (Gear^.Timer = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1912 |
or ((HHGear^.Message and gmAttack) <> 0) then |
5706 | 1913 |
begin |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
1914 |
StopSoundChan(Gear^.SoundChannel); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1915 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1916 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1917 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1918 |
AfterAttack |
5706 | 1919 |
end |
302 | 1920 |
end; |
1921 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1922 |
procedure doStepBlowTorch(Gear: PGear); |
8795 | 1923 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1924 |
HHGear: PGear; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1925 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1926 |
BTPrevAngle := High(LongInt); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1927 |
BTSteps := 0; |
4365 | 1928 |
HHGear := Gear^.Hedgehog^.Gear; |
8617
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1929 |
HedgehogChAngle(HHGear); |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1930 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1931 |
Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1932 |
DrawTunnel(HHGear^.X, |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1933 |
HHGear^.Y + Gear^.dY * cHHRadius - _1 - |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1934 |
((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1935 |
Gear^.dX, Gear^.dY, |
e7bea88096d2
So. A while ago, while trying to prevent hogs blowtorching getting turned around, unc0rr altered the old range of blowtorch from 1/8th of 180° up or down, to a 4° gain in upwards and a -4° loss in downwards. He also made it so that starting tunnels could fail to erase sufficient terrain, trapping hogs. Here are a couple of workarounds to more closely approximate old behaviour (do some initial erasure, adjust min/max angles)
nemo
parents:
8612
diff
changeset
|
1936 |
cHHStepTicks, cHHRadius * 2 + 7); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1937 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1938 |
HHGear^.State := HHGear^.State or gstNotKickable; |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
1939 |
Gear^.SoundChannel := LoopSound(sndBlowTorch); |
14342 | 1940 |
Gear^.doStep := @doStepBlowTorchWork |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1941 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1942 |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
1943 |
|
302 | 1944 |
//////////////////////////////////////////////////////////////////////////////// |
10 | 1945 |
procedure doStepMine(Gear: PGear); |
5690
f6e0c5bd8020
Allow vgtSmoke to scale. Scale it down 50% for mines, so smoke doesn't seem so oversized
nemo
parents:
5688
diff
changeset
|
1946 |
var vg: PVisualGear; |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
1947 |
dxdy: hwFloat; |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1948 |
dmg: LongWord; |
10 | 1949 |
begin |
9043 | 1950 |
if Gear^.Health = 0 then dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); |
14755
ab7bf5036314
Render mine timer if gear info is active
Wuzzy <Wuzzy2@mail.ru>
parents:
14754
diff
changeset
|
1951 |
Gear^.RenderTimer:= ((Gear^.State and gstFrozen) = 0) and ((Gear^.State and gstAttacking) = 0) and (Gear^.Health <> 0); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1952 |
if (Gear^.State and gstMoving) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1953 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1954 |
DeleteCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1955 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1956 |
if (Gear^.State and gstMoving) = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1957 |
begin |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
1958 |
AddCI(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1959 |
Gear^.dX := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1960 |
Gear^.dY := _0 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1961 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1962 |
CalcRotationDirAngle(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1963 |
AllInactive := false |
7754 | 1964 |
end |
1965 |
else if (GameTicks and $3F) = 25 then |
|
1966 |
doStepFallingGear(Gear); |
|
4966
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1967 |
if (Gear^.Health = 0) then |
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1968 |
begin |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
1969 |
if (dxdy > _0_4) and (Gear^.State and gstCollision <> 0) then |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1970 |
begin |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1971 |
dmg:= hwRound(dxdy * _50); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1972 |
inc(Gear^.Damage, dmg); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1973 |
ScriptCall('onGearDamage', Gear^.UID, dmg) |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1974 |
end; |
8795 | 1975 |
|
6498 | 1976 |
if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
7754 | 1977 |
begin |
1978 |
vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
|
1979 |
if vg <> nil then |
|
1980 |
vg^.Scale:= 0.5 |
|
1981 |
end; |
|
4966
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1982 |
|
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1983 |
if (Gear^.Damage > 35) then |
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1984 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
1985 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
4966
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1986 |
DeleteGear(Gear); |
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1987 |
exit |
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1988 |
end |
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
1989 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1990 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1991 |
if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1992 |
if ((Gear^.State and gstAttacking) = 0) then |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
1993 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1994 |
if ((GameTicks and $1F) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1995 |
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1996 |
Gear^.State := Gear^.State or gstAttacking |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
1997 |
end |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
1998 |
else // gstAttacking <> 0 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1999 |
begin |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2000 |
AllInactive := false; |
12176
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2001 |
// tag of 1 means this mine has a random timer |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2002 |
if (Gear^.Tag = 1) and (Gear^.Timer = 0) then |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2003 |
begin |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2004 |
if (GameTicks mod 2 = 0) then GetRandom(2); |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2005 |
if (GameTicks mod 3 = 0) then GetRandom(2); |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2006 |
Gear^.Timer:= GetRandom(51) * 100; |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2007 |
Gear^.Tag:= 0; |
115867d77982
Add back accidental removal of random mines
Wuzzy <almikes@aol.com>
parents:
12174
diff
changeset
|
2008 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2009 |
if (Gear^.Timer and $FF) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2010 |
PlaySound(sndMineTick); |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2011 |
if Gear^.Timer = 0 then |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2012 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2013 |
if ((Gear^.State and gstWait) <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2014 |
or (cMineDudPercent = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2015 |
or (getRandom(100) > cMineDudPercent) then |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2016 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2017 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
14559 | 2018 |
DeleteGear(Gear); |
14561 | 2019 |
exit // redundant but we've had too many delete gear bugs |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2020 |
end |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2021 |
else |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2022 |
begin |
5690
f6e0c5bd8020
Allow vgtSmoke to scale. Scale it down 50% for mines, so smoke doesn't seem so oversized
nemo
parents:
5688
diff
changeset
|
2023 |
vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2024 |
if vg <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2025 |
vg^.Scale:= 0.5; |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2026 |
PlaySound(sndVaporize); |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2027 |
Gear^.Health := 0; |
4966
fa612a614317
make defective mines explode if they take enough damage, add missing interface line for koda's new uSound fade
nemo
parents:
4956
diff
changeset
|
2028 |
Gear^.Damage := 0; |
6450 | 2029 |
Gear^.State := Gear^.State and (not gstAttacking) |
4224
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2030 |
end; |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2031 |
exit |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2032 |
end; |
99c6d87df131
No point in leaving hogs at 0, since shotgun triggers death anyway. Also, add some audio cues to extra damage / time
nemo
parents:
4187
diff
changeset
|
2033 |
dec(Gear^.Timer); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2034 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2035 |
else // gsttmpFlag = 0 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2036 |
if (TurnTimeLeft = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2037 |
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2038 |
or (Gear^.Hedgehog^.Gear = nil) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2039 |
Gear^.State := Gear^.State or gsttmpFlag; |
10 | 2040 |
end; |
57 | 2041 |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2042 |
procedure doStepAirMine(Gear: PGear); |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2043 |
var i,t,targDist,tmpDist: LongWord; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2044 |
targ, tmpG: PGear; |
12810 | 2045 |
trackSpeed, airFriction, tX, tY: hwFloat; |
10827 | 2046 |
isUnderwater: Boolean; |
14207 | 2047 |
sparkle: PVisualGear; |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2048 |
begin |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2049 |
targ:= nil; |
14755
ab7bf5036314
Render mine timer if gear info is active
Wuzzy <Wuzzy2@mail.ru>
parents:
14754
diff
changeset
|
2050 |
Gear^.RenderTimer:= ((Gear^.State and gstFrozen) = 0) and ((Gear^.State and gstAttacking) = 0); |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2051 |
if (Gear^.State and gstFrozen) <> 0 then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2052 |
begin |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2053 |
if Gear^.Damage > 0 then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2054 |
begin |
14348
2221c418026a
Pixel-perfect removal of exploding frozen air mines
Wuzzy <Wuzzy2@mail.ru>
parents:
14347
diff
changeset
|
2055 |
// Normal, damaging explosion |
2221c418026a
Pixel-perfect removal of exploding frozen air mines
Wuzzy <Wuzzy2@mail.ru>
parents:
14347
diff
changeset
|
2056 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
14349
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2057 |
if ((Gear^.State and gstNoGravity) <> 0) then |
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2058 |
// Remove land created by frozen air mine sprite pixel-perfectly |
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2059 |
EraseLand( |
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2060 |
hwRound(Gear^.X) - SpritesData[sprFrozenAirMine].Width div 2, |
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2061 |
hwRound(Gear^.Y) - SpritesData[sprFrozenAirMine].Height div 2, |
e3e06b216e00
Frozen air mines: Don't erase land if gstNoGravity state is off
Wuzzy <Wuzzy2@mail.ru>
parents:
14348
diff
changeset
|
2062 |
sprFrozenAirMine, 0, 0, false, false, false, false); |
14559 | 2063 |
DeleteGear(Gear); |
14561 | 2064 |
exit |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2065 |
end; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2066 |
doStepFallingGear(Gear); |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2067 |
exit |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2068 |
end; |
10827 | 2069 |
isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); |
10800 | 2070 |
if Gear^.Pos > 0 then |
2071 |
begin |
|
2072 |
airFriction:= _1; |
|
10827 | 2073 |
if isUnderwater then |
2074 |
dec(airFriction.QWordValue,Gear^.Pos*2) |
|
2075 |
else |
|
2076 |
dec(airFriction.QWordValue,Gear^.Pos); |
|
10800 | 2077 |
Gear^.dX:= Gear^.dX*airFriction; |
2078 |
Gear^.dY:= Gear^.dY*airFriction |
|
2079 |
end; |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2080 |
doStepFallingGear(Gear); |
10806 | 2081 |
if (TurnTimeLeft = 0) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then |
2082 |
AllInactive := false; |
|
2083 |
||
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2084 |
// Disable targeting if airmine is not active yet |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2085 |
if ((Gear^.State and gsttmpFlag) = 0) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2086 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2087 |
if (TurnTimeLeft = 0) |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2088 |
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2089 |
or (CurrentHedgehog^.Gear = nil) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2090 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2091 |
Gear^.FlightTime:= GameTicks; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2092 |
Gear^.State := Gear^.State or gsttmpFlag; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2093 |
Gear^.Hedgehog := nil; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2094 |
end; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2095 |
exit; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2096 |
end; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2097 |
|
14205 | 2098 |
//Disable targeting while the airmine is stunned |
2099 |
if Gear^.Tag <> 0 then |
|
2100 |
begin |
|
14207 | 2101 |
if ((Gear^.FlightTime and $FF) = 0) then |
2102 |
begin |
|
2103 |
sparkle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); |
|
2104 |
if sparkle <> nil then |
|
2105 |
begin |
|
2106 |
sparkle^.dX:= 0.004 * (random(100) - 50); |
|
2107 |
sparkle^.dY:= -0.05 + 0.004 * (random(100) - 50); |
|
2108 |
sparkle^.Tint:= $D5CD8CFF; |
|
2109 |
sparkle^.Angle:= random(360); |
|
2110 |
end; |
|
2111 |
end; |
|
2112 |
||
14205 | 2113 |
dec(Gear^.FlightTime); |
2114 |
if Gear^.FlightTime = 0 then |
|
14209 | 2115 |
begin |
14205 | 2116 |
Gear^.Tag:= 0; |
14209 | 2117 |
Gear^.Hedgehog:= nil; |
2118 |
Gear^.State:= Gear^.State and (not gstAttacking); |
|
2119 |
Gear^.Timer:= Gear^.WDTimer |
|
2120 |
end; |
|
14205 | 2121 |
exit |
2122 |
end; |
|
2123 |
||
10806 | 2124 |
if (TurnTimeLeft = 0) or (Gear^.Angle = 0) or (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.Gear = nil) then |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2125 |
begin |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2126 |
Gear^.Hedgehog:= nil; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2127 |
targ:= nil; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2128 |
end |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2129 |
else if Gear^.Hedgehog <> nil then |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2130 |
targ:= Gear^.Hedgehog^.Gear; |
10800 | 2131 |
if targ <> nil then |
2132 |
begin |
|
12810 | 2133 |
tX:=Gear^.X-targ^.X; |
2134 |
tY:=Gear^.Y-targ^.Y; |
|
10800 | 2135 |
// allow escaping - should maybe flag this too |
14070 | 2136 |
if (GameTicks > Gear^.FlightTime + 10000) or |
14084 | 2137 |
(not ((tX.Round + tY.Round < Gear^.Angle * 9) and |
14070 | 2138 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle * 6)))) |
2139 |
then |
|
10800 | 2140 |
targ:= nil |
2141 |
end; |
|
2142 |
||
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2143 |
// If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility) |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2144 |
// or hunting is disabled due to seek radius of 0 then we aren't hunting |
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2145 |
if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or |
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2146 |
((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or |
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2147 |
(Gear^.Angle = 0) then |
10818
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10815
diff
changeset
|
2148 |
gear^.State:= gear^.State and (not gstChooseTarget) |
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2149 |
else if |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2150 |
// todo, allow not finding new target, set timeout on target retention |
10807
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2151 |
(Gear^.State and gstAttacking = 0) and |
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2152 |
((GameTicks and $FF) = 17) and |
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2153 |
(GameTicks > Gear^.FlightTime) then // recheck hunted hog |
66cde98f8cbe
Make the various mine states a bit clearer (inactive, active but not in seek mode, seek mode, chasing target)
nemo
parents:
10806
diff
changeset
|
2154 |
begin |
10818
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10815
diff
changeset
|
2155 |
gear^.State:= gear^.State or gstChooseTarget; |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2156 |
if targ <> nil then |
12810 | 2157 |
targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2158 |
else targDist:= 0; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2159 |
for t:= 0 to Pred(TeamsCount) do |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2160 |
with TeamsArray[t]^ do |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2161 |
for i:= 0 to cMaxHHIndex do |
14703 | 2162 |
if (Hedgehogs[i].Gear <> nil) and (Hedgehogs[i].Effects[heFrozen] = 0) then |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2163 |
begin |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2164 |
tmpG:= Hedgehogs[i].Gear; |
12810 | 2165 |
tX:=Gear^.X-tmpG^.X; |
2166 |
tY:=Gear^.Y-tmpG^.Y; |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2167 |
if (Gear^.Angle = $FFFFFFFF) or |
12810 | 2168 |
((tX.Round+tY.Round < Gear^.Angle) and |
2169 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle))) then |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2170 |
begin |
12810 | 2171 |
if targ <> nil then tmpDist:= Distance(tX,tY).Round; |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2172 |
if (targ = nil) or (tmpDist < targDist) then |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2173 |
begin |
12810 | 2174 |
if targ = nil then targDist:= Distance(tX,tY).Round |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2175 |
else targDist:= tmpDist; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2176 |
Gear^.Hedgehog:= @Hedgehogs[i]; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2177 |
targ:= tmpG; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2178 |
end |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2179 |
end |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2180 |
end; |
10802
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
2181 |
if targ <> nil then Gear^.FlightTime:= GameTicks + 5000 |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2182 |
end; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2183 |
if targ <> nil then |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2184 |
begin |
10799
658794118fd8
initialise trackSpeed, add nil check before resetting seek timer
nemo
parents:
10798
diff
changeset
|
2185 |
trackSpeed:= _0; |
10827 | 2186 |
if isUnderwater then |
2187 |
trackSpeed.QWordValue:= Gear^.Power div 2 |
|
2188 |
else |
|
2189 |
trackSpeed.QWordValue:= Gear^.Power; |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2190 |
if (Gear^.X < targ^.X) and (Gear^.dX < _0_1) then |
12811 | 2191 |
if (WorldEdge = weWrap) and ((targ^.X - Gear^.X) > ((Gear^.X - int2hwFloat(LeftX)) + (int2hwFloat(RightX) - targ^.X))) then |
2192 |
Gear^.dX:= Gear^.dX-trackSpeed |
|
2193 |
else |
|
2194 |
Gear^.dX:= Gear^.dX+trackSpeed // please leave as an add. I like the effect |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2195 |
else if (Gear^.X > targ^.X) and (Gear^.dX > -_0_1) then |
12811 | 2196 |
if (WorldEdge = weWrap) and ((Gear^.X - targ^.X) > ((targ^.X - int2hwFloat(LeftX)) + (int2hwFloat(RightX) - Gear^.X))) then |
2197 |
Gear^.dX:= Gear^.dX+trackSpeed |
|
2198 |
else |
|
2199 |
Gear^.dX:= Gear^.dX-trackSpeed; |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2200 |
if (Gear^.Y < targ^.Y) and (Gear^.dY < _0_1) then |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2201 |
Gear^.dY:= Gear^.dY+trackSpeed |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2202 |
else if (Gear^.Y > targ^.Y) and (Gear^.dY > -_0_1) then |
10802
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
2203 |
Gear^.dY:= Gear^.dY-trackSpeed |
10800 | 2204 |
end |
2205 |
else Gear^.Hedgehog:= nil; |
|
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2206 |
|
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2207 |
if ((Gear^.State and gstAttacking) = 0) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2208 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2209 |
if ((GameTicks and $1F) = 0) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2210 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2211 |
if targ <> nil then |
10794
ace862eda192
radius and sprite drawing tweaks to match the still temporary sprite. also a begin/end sheepluva suggested
nemo
parents:
10791
diff
changeset
|
2212 |
begin |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2213 |
tX:=Gear^.X-targ^.X; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2214 |
tY:=Gear^.Y-targ^.Y; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2215 |
if (tX.Round+tY.Round < Gear^.Boom) and |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2216 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Boom)) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2217 |
Gear^.State := Gear^.State or gstAttacking |
10794
ace862eda192
radius and sprite drawing tweaks to match the still temporary sprite. also a begin/end sheepluva suggested
nemo
parents:
10791
diff
changeset
|
2218 |
end |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2219 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Boom, Gear^.Boom) <> nil) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2220 |
Gear^.State := Gear^.State or gstAttacking |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2221 |
end |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2222 |
end |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2223 |
else // gstAttacking <> 0 |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2224 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2225 |
AllInactive := false; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2226 |
if (Gear^.Timer and $FF) = 0 then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2227 |
PlaySound(sndMineTick); |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2228 |
if Gear^.Timer = 0 then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2229 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2230 |
// recheck |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2231 |
if targ <> nil then |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2232 |
begin |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2233 |
tX:=Gear^.X-targ^.X; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2234 |
tY:=Gear^.Y-targ^.Y; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2235 |
if (tX.Round+tY.Round < Gear^.Boom) and |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2236 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Boom)) then |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2237 |
begin |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2238 |
Gear^.Hedgehog:= CurrentHedgehog; |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2239 |
tmpG:= FollowGear; |
13404 | 2240 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2241 |
FollowGear:= tmpG; |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2242 |
DeleteGear(Gear); |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2243 |
exit |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2244 |
end |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2245 |
end |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2246 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Boom, Gear^.Boom) <> nil) then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2247 |
begin |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2248 |
Gear^.Hedgehog:= CurrentHedgehog; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2249 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2250 |
DeleteGear(Gear); |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2251 |
exit |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2252 |
end; |
14753
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2253 |
Gear^.State:= Gear^.State and (not gstAttacking); |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2254 |
Gear^.Timer:= Gear^.WDTimer |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2255 |
end; |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2256 |
if Gear^.Timer > 0 then |
2ad6f0555e61
Fix air mine not colliding with crates initially (bug 679)
Wuzzy <Wuzzy2@mail.ru>
parents:
14747
diff
changeset
|
2257 |
dec(Gear^.Timer); |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
2258 |
end |
10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2259 |
end; |
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset
|
2260 |
|
39 | 2261 |
//////////////////////////////////////////////////////////////////////////////// |
3714 | 2262 |
procedure doStepSMine(Gear: PGear); |
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
2263 |
var land: Word; |
3710 | 2264 |
begin |
3714 | 2265 |
// TODO: do real calculation? |
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
2266 |
land:= TestCollisionXwithGear(Gear, 2); |
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
2267 |
if land = 0 then land:= TestCollisionYwithGear(Gear,-2); |
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
2268 |
if land = 0 then land:= TestCollisionXwithGear(Gear,-2); |
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset
|
2269 |
if land = 0 then land:= TestCollisionYwithGear(Gear, 2); |
11304
a20f416c91ec
fix bug reported by S.D.: throwing a sticking mine into a bouncy pit never ends turn. see also http://hedgewars.org/node/6350
sheepluva
parents:
11290
diff
changeset
|
2270 |
if (land <> 0) and ((land and lfBouncy = 0) or ((Gear^.State and gstMoving) = 0)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2271 |
begin |
10964 | 2272 |
if ((Gear^.State and gstMoving) <> 0) or (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2273 |
begin |
3717 | 2274 |
PlaySound(sndRopeAttach); |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2275 |
Gear^.dX:= _0; |
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2276 |
Gear^.dY:= _0; |
10164
0570d4b22187
AI doesn't skip till action on the map stops (mostly dedicated to highlander) + various small tweaks
unc0rr
parents:
10145
diff
changeset
|
2277 |
Gear^.State:= Gear^.State and (not gstMoving); |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2278 |
AddCI(Gear); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2279 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2280 |
end |
3714 | 2281 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2282 |
begin |
10164
0570d4b22187
AI doesn't skip till action on the map stops (mostly dedicated to highlander) + various small tweaks
unc0rr
parents:
10145
diff
changeset
|
2283 |
Gear^.State:= Gear^.State or gstMoving; |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2284 |
DeleteCI(Gear); |
3714 | 2285 |
doStepFallingGear(Gear); |
2286 |
AllInactive := false; |
|
2287 |
CalcRotationDirAngle(Gear); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2288 |
end; |
3714 | 2289 |
|
14763
bc0e86b0347b
Don't show SMine timer if drowning
Wuzzy <Wuzzy2@mail.ru>
parents:
14755
diff
changeset
|
2290 |
Gear^.RenderTimer:= (Gear^.State and (gstFrozen or gstAttacking or gstDrowning) = 0); |
3710 | 2291 |
if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2292 |
begin |
12304
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
2293 |
if ((Gear^.State and gstAttacking) = 0) and ((Gear^.State and gstFrozen) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2294 |
begin |
3710 | 2295 |
if ((GameTicks and $1F) = 0) then |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2296 |
// FIXME - values taken from mine. use a gear val and set both to same |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2297 |
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2298 |
Gear^.State := Gear^.State or gstAttacking |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2299 |
end |
12304
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
2300 |
else if (Gear^.State and gstFrozen) = 0 then // gstAttacking <> 0 |
9742
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2301 |
begin |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2302 |
AllInactive := false; |
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2303 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2304 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2305 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2306 |
DeleteGear(Gear); |
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
2307 |
exit |
9742
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2308 |
end |
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2309 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2310 |
if (Gear^.Timer and $FF) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2311 |
PlaySound(sndMineTick); |
9742
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2312 |
dec(Gear^.Timer); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2313 |
end |
9742
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2314 |
end |
3710 | 2315 |
else // gsttmpFlag = 0 |
10015 | 2316 |
if ((GameFlags and gfInfAttack = 0) and ((TurnTimeLeft = 0) or (Gear^.Hedgehog^.Gear = nil))) |
9742
419e5c651870
Remove turntimeleft/hog gear check from smine if infinite attack is enabled. just use the flightime for that.
nemo
parents:
9731
diff
changeset
|
2317 |
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2318 |
Gear^.State := Gear^.State or gsttmpFlag; |
3710 | 2319 |
end; |
2320 |
||
2321 |
//////////////////////////////////////////////////////////////////////////////// |
|
39 | 2322 |
procedure doStepDynamite(Gear: PGear); |
2323 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2324 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2325 |
AllInactive := false; |
11532
44e646598e6a
sparkles for dynamite at sheepy's request. he can tweak values if he wishes
nemo
parents:
11528
diff
changeset
|
2326 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2327 |
if Gear^.Timer mod 166 = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2328 |
inc(Gear^.Tag); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2329 |
if Gear^.Timer = 1000 then // might need better timing |
14016
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset
|
2330 |
makeHogsWorry(Gear^.X, Gear^.Y, 75, Gear^.Kind); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2331 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2332 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2333 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2334 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2335 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2336 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2337 |
dec(Gear^.Timer); |
39 | 2338 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2339 |
|
351 | 2340 |
/////////////////////////////////////////////////////////////////////////////// |
2941
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2341 |
|
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2342 |
procedure doStepRollingBarrel(Gear: PGear); |
8795 | 2343 |
var |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2344 |
i, dmg: LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2345 |
particle: PVisualGear; |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2346 |
dxdy: hwFloat; |
2941
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2347 |
begin |
10490 | 2348 |
if (Gear^.dX.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2349 |
SetLittle(Gear^.dY); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2350 |
Gear^.State := Gear^.State or gstAnimation; |
9954 | 2351 |
if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and (not gstFrozen); |
8795 | 2352 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2353 |
if ((Gear^.dX.QWordValue <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2354 |
or (Gear^.dY.QWordValue <> 0)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2355 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2356 |
DeleteCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2357 |
AllInactive := false; |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2358 |
dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2359 |
doStepFallingGear(Gear); |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2360 |
if (Gear^.State and gstCollision <> 0) and(dxdy > _0_4) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2361 |
begin |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2362 |
if (TestCollisionYwithGear(Gear, 1) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2363 |
begin |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2364 |
Gear^.State := Gear^.State or gsttmpFlag; |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2365 |
for i:= min(12, hwRound(dxdy*_10)) downto 0 do |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2366 |
begin |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2367 |
particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust); |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2368 |
if particle <> nil then |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2369 |
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2370 |
end |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2371 |
end; |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2372 |
dmg:= hwRound(dxdy * _50); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2373 |
inc(Gear^.Damage, dmg); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2374 |
ScriptCall('onGearDamage', Gear^.UID, dmg) |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2375 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2376 |
CalcRotationDirAngle(Gear); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2377 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2378 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2379 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2380 |
Gear^.State := Gear^.State or gsttmpFlag; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2381 |
AddCI(Gear) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2382 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2383 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2384 |
if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2385 |
Gear^.dY := _0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2386 |
if hwAbs(Gear^.dX) < _0_001 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2387 |
Gear^.dX := _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2388 |
|
5128
3c65326bb713
Check for 0 health to avoid div by 0. spotted by mikade.
nemo
parents:
5121
diff
changeset
|
2389 |
if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2390 |
if (cBarrelHealth div Gear^.Health) > 2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2391 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
2941
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2392 |
else |
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2393 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2394 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2395 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2396 |
Gear^.Damage := 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2397 |
if Gear^.Health <= 0 then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2398 |
doStepCase(Gear) |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2399 |
else |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2400 |
// health texture (FlightTime = health when the last texture was generated) |
15033
20c80919d97d
Fix health case/barrel health texture being sometimes not created
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
2401 |
if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2402 |
begin |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2403 |
Gear^.FlightTime:= Gear^.Health; |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2404 |
FreeAndNilTexture(Gear^.Tex); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2405 |
Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2406 |
end; |
2941
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2407 |
end; |
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2408 |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2409 |
procedure doStepCase(Gear: PGear); |
8795 | 2410 |
var |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
2411 |
i, x, y: LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2412 |
k: TGearType; |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
2413 |
dX, dY: HWFloat; |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
2414 |
hog: PHedgehog; |
7168
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2415 |
sparkles: PVisualGear; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2416 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2417 |
k := Gear^.Kind; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2418 |
|
3894 | 2419 |
if (Gear^.Message and gmDestroy) > 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2420 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2421 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2422 |
FreeActionsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2423 |
SetAllToActive; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2424 |
// something (hh, mine, etc...) could be on top of the case |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2425 |
with CurrentHedgehog^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2426 |
if Gear <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2427 |
Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2428 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2429 |
end; |
9954 | 2430 |
if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and (not gstFrozen); |
15 | 2431 |
|
8973 | 2432 |
if ((k <> gtExplosives) and (Gear^.Damage > 0)) or ((k = gtExplosives) and (Gear^.Health<=0)) then |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2433 |
begin |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2434 |
x := hwRound(Gear^.X); |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2435 |
y := hwRound(Gear^.Y); |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2436 |
hog:= Gear^.Hedgehog; |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2437 |
|
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2438 |
if k = gtCase then |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2439 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2440 |
doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2441 |
for i:= 0 to 63 do |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2442 |
AddGear(x, y, gtFlame, 0, _0, _0, 0); |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2443 |
end |
12573
494d3e1c4810
Don't play “missed” taunt if a target has been hit
Wuzzy <almikes@aol.com>
parents:
12382
diff
changeset
|
2444 |
else if k = gtTarget then |
494d3e1c4810
Don't play “missed” taunt if a target has been hit
Wuzzy <almikes@aol.com>
parents:
12382
diff
changeset
|
2445 |
uStats.TargetHit() |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2446 |
else if k = gtExplosives then |
14561 | 2447 |
begin |
2448 |
doMakeExplosion(x, y, Gear^.Boom, hog, EXPLAutoSound); |
|
2449 |
for i:= 0 to 31 do |
|
2450 |
begin |
|
2451 |
dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1); |
|
2452 |
dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1); |
|
2453 |
AddGear(x, y, gtFlame, 0, dX, dY, 0); |
|
2454 |
AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 0); |
|
2455 |
end |
|
2456 |
end; |
|
14559 | 2457 |
DeleteGear(Gear); |
14561 | 2458 |
exit |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2459 |
end; |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2460 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2461 |
if k = gtExplosives then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2462 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2463 |
if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then |
8962
9780e79619ed
So. This at least should make the math more accurate, even if it still doesn't appear to resolve prob w/ AI attacks
nemo
parents:
8958
diff
changeset
|
2464 |
begin |
9780e79619ed
So. This at least should make the math more accurate, even if it still doesn't appear to resolve prob w/ AI attacks
nemo
parents:
8958
diff
changeset
|
2465 |
Gear^.doStep := @doStepRollingBarrel; |
9780e79619ed
So. This at least should make the math more accurate, even if it still doesn't appear to resolve prob w/ AI attacks
nemo
parents:
8958
diff
changeset
|
2466 |
exit; |
9780e79619ed
So. This at least should make the math more accurate, even if it still doesn't appear to resolve prob w/ AI attacks
nemo
parents:
8958
diff
changeset
|
2467 |
end |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2468 |
else Gear^.dX:= _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2469 |
|
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2470 |
if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2471 |
if (cBarrelHealth div Gear^.Health) > 2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2472 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
8971
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2473 |
else |
fcb29a13b1b1
Adjust barrel damage so AI can actually bat to explode them. Fix state flag check. Remove unneeded dmgMod var. Cancel dX for low dX barrel tracing.
nemo
parents:
8962
diff
changeset
|
2474 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2475 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2476 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2477 |
Gear^.Damage := 0; |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2478 |
// health texture (FlightTime = health when the last texture was generated) |
15033
20c80919d97d
Fix health case/barrel health texture being sometimes not created
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
2479 |
if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2480 |
begin |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2481 |
Gear^.FlightTime:= Gear^.Health; |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2482 |
FreeAndNilTexture(Gear^.Tex); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2483 |
Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2484 |
end; |
7168
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2485 |
end |
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2486 |
else |
8795 | 2487 |
begin |
14754
533ac9774279
Add key to display extra gear info tags
Wuzzy <Wuzzy2@mail.ru>
parents:
14753
diff
changeset
|
2488 |
// health texture for health crate |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2489 |
if (k = gtCase) and ((Gear^.Pos and posCaseHealth) <> 0) then |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2490 |
begin |
14754
533ac9774279
Add key to display extra gear info tags
Wuzzy <Wuzzy2@mail.ru>
parents:
14753
diff
changeset
|
2491 |
if ((Gear^.State and gstFrozen) = 0) then |
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2492 |
begin |
14764 | 2493 |
// Karma=2: Always hide health |
2494 |
if (Gear^.Karma = 2) then |
|
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2495 |
i:= 0 |
14764 | 2496 |
// Karma=1: Hide health in game, but show in demo |
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2497 |
else if (Gear^.Karma = 1) then |
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2498 |
if (GameType in [gmtDemo, gmtRecord]) then |
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2499 |
i:= 1 |
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2500 |
else |
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2501 |
i:= 0 |
14764 | 2502 |
// Always show health (default) |
2503 |
else |
|
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2504 |
i:= 1; |
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2505 |
if i = 1 then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2506 |
begin |
15033
20c80919d97d
Fix health case/barrel health texture being sometimes not created
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
2507 |
if (Gear^.Health <> Gear^.FlightTime) or (Gear^.Tex = nil) then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2508 |
begin |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2509 |
Gear^.FlightTime:= Gear^.Health; |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2510 |
FreeAndNilTexture(Gear^.Tex); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2511 |
Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16) |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2512 |
end |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2513 |
end |
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2514 |
else |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2515 |
begin |
15033
20c80919d97d
Fix health case/barrel health texture being sometimes not created
Wuzzy <Wuzzy2@mail.ru>
parents:
14998
diff
changeset
|
2516 |
if (Gear^.FlightTime <> $ffffffff) or (Gear^.Tex = nil) then |
14960
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2517 |
begin |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2518 |
Gear^.FlightTime:= $ffffffff; |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2519 |
FreeAndNilTexture(Gear^.Tex); |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2520 |
Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16) |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2521 |
end |
088c1d319612
if at all possible, don't regenerate arbitrary number of health textures each tick
alfadur
parents:
14942
diff
changeset
|
2522 |
end |
14766
1b82538970ca
Fix health crate health display not respecting Karma value properly
Wuzzy <Wuzzy2@mail.ru>
parents:
14764
diff
changeset
|
2523 |
end; |
14754
533ac9774279
Add key to display extra gear info tags
Wuzzy <Wuzzy2@mail.ru>
parents:
14753
diff
changeset
|
2524 |
end; |
7276 | 2525 |
if Gear^.Timer = 500 then |
2526 |
begin |
|
7168
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2527 |
(* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up |
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2528 |
voices. Reinforcements voices is heard for active team, not team-to-be. Either that or change crate spawn from end of turn to start, although that |
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2529 |
has its own complexities. *) |
7276 | 2530 |
// Abuse a couple of gear values to track origin |
7339 | 2531 |
Gear^.Angle:= hwRound(Gear^.Y); |
7276 | 2532 |
Gear^.Tag:= random(2); |
2533 |
inc(Gear^.Timer) |
|
2534 |
end; |
|
2535 |
if Gear^.Timer < 1833 then inc(Gear^.Timer); |
|
2536 |
if Gear^.Timer = 1000 then |
|
7168
8defaabce92e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
nemo
parents:
7128
diff
changeset
|
2537 |
begin |
7339 | 2538 |
sparkles:= AddVisualGear(hwRound(Gear^.X), Gear^.Angle, vgtDust, 1); |
7276 | 2539 |
if sparkles <> nil then |
2540 |
begin |
|
2541 |
sparkles^.dX:= 0; |
|
2542 |
sparkles^.dY:= 0; |
|
2543 |
sparkles^.Angle:= 270; |
|
8795 | 2544 |
if Gear^.Tag = 1 then |
7276 | 2545 |
sparkles^.Tint:= $3744D7FF |
2546 |
else sparkles^.Tint:= $FAB22CFF |
|
2547 |
end; |
|
2548 |
end; |
|
8795 | 2549 |
if Gear^.Timer < 1000 then |
7283 | 2550 |
begin |
2551 |
AllInactive:= false; |
|
2552 |
exit |
|
2553 |
end |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2554 |
end; |
2911 | 2555 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2556 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2557 |
if (Gear^.dY.QWordValue <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2558 |
or (TestCollisionYwithGear(Gear, 1) = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2559 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2560 |
AllInactive := false; |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2561 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2562 |
Gear^.dY := Gear^.dY + cGravity; |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2563 |
|
9820 | 2564 |
if ((not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0)) or |
2565 |
(Gear^.dY.isNegative and (TestCollisionYwithGear(Gear, -1) <> 0)) then |
|
2566 |
Gear^.dY := _0 |
|
2567 |
else Gear^.Y := Gear^.Y + Gear^.dY; |
|
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2568 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2569 |
if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then |
8579
d18bc19d780a
graphics tweak. flag a couple more overeager setall HH
nemo
parents:
8578
diff
changeset
|
2570 |
SetAllHHToActive(false); |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2571 |
|
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
2572 |
if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2573 |
begin |
3473
f80431269806
Increase minimum threshold for barrel damage to reduce likelihood of blowing one up on jumping out, increase damage to compensate (may need tweaking). Only apply dX for collision w/ kick if barrel is rolling.
nemo
parents:
3471
diff
changeset
|
2574 |
if (Gear^.dY > _0_2) and (k = gtExplosives) then |
f80431269806
Increase minimum threshold for barrel damage to reduce likelihood of blowing one up on jumping out, increase damage to compensate (may need tweaking). Only apply dX for collision w/ kick if barrel is rolling.
nemo
parents:
3471
diff
changeset
|
2575 |
inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2576 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2577 |
if Gear^.dY > _0_2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2578 |
for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2579 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
8795 | 2580 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2581 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2582 |
if Gear^.dY > - _0_001 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2583 |
Gear^.dY := _0 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2584 |
else if Gear^.dY < - _0_03 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2585 |
PlaySound(Gear^.ImpactSound); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2586 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2587 |
CheckGearDrowning(Gear); |
14942
896707084562
Don't render health crate and barrel health when drowning
Wuzzy <Wuzzy2@mail.ru>
parents:
14941
diff
changeset
|
2588 |
if ((Gear^.State and gstDrowning) <> 0) then |
896707084562
Don't render health crate and barrel health when drowning
Wuzzy <Wuzzy2@mail.ru>
parents:
14941
diff
changeset
|
2589 |
Gear^.RenderHealth:= false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2590 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2591 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2592 |
if (Gear^.dY.QWordValue = 0) then |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2593 |
AddCI(Gear) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2594 |
else if (Gear^.dY.QWordValue <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2595 |
DeleteCI(Gear) |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2596 |
end; |
49 | 2597 |
|
2598 |
//////////////////////////////////////////////////////////////////////////////// |
|
2460 | 2599 |
|
2600 |
procedure doStepTarget(Gear: PGear); |
|
2601 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2602 |
if (Gear^.Timer = 0) and (Gear^.Tag = 0) then |
9724
b3fefde4cff7
fixing position of spawning sparkles of target gears by applying a filthy workaround for a filthy bug in the filthy filthy doStepCase handler.
sheepluva
parents:
9723
diff
changeset
|
2603 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2604 |
PlaySound(sndWarp); |
9724
b3fefde4cff7
fixing position of spawning sparkles of target gears by applying a filthy workaround for a filthy bug in the filthy filthy doStepCase handler.
sheepluva
parents:
9723
diff
changeset
|
2605 |
// workaround: save spawn Y for doStepCase (which is a mess atm) |
b3fefde4cff7
fixing position of spawning sparkles of target gears by applying a filthy workaround for a filthy bug in the filthy filthy doStepCase handler.
sheepluva
parents:
9723
diff
changeset
|
2606 |
Gear^.Angle:= hwRound(Gear^.Y); |
b3fefde4cff7
fixing position of spawning sparkles of target gears by applying a filthy workaround for a filthy bug in the filthy filthy doStepCase handler.
sheepluva
parents:
9723
diff
changeset
|
2607 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2608 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2609 |
if (Gear^.Tag = 0) and (Gear^.Timer < 1000) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2610 |
inc(Gear^.Timer) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2611 |
else if Gear^.Tag = 1 then |
4808 | 2612 |
Gear^.Tag := 2 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2613 |
else if Gear^.Tag = 2 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2614 |
if Gear^.Timer > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2615 |
dec(Gear^.Timer) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2616 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2617 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2618 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2619 |
exit; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2620 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2621 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2622 |
doStepCase(Gear) |
2460 | 2623 |
end; |
2624 |
||
2625 |
//////////////////////////////////////////////////////////////////////////////// |
|
854 | 2626 |
procedure doStepIdle(Gear: PGear); |
2627 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2628 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2629 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2630 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2631 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2632 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2633 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2634 |
end |
854 | 2635 |
end; |
2636 |
||
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
2637 |
//////////////////////////////////////////////////////////////////////////////// |
79 | 2638 |
procedure doStepShover(Gear: PGear); |
8795 | 2639 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2640 |
HHGear: PGear; |
79 | 2641 |
begin |
12124 | 2642 |
dec(Gear^.Timer); |
2643 |
if Gear^.Timer = 0 then |
|
2644 |
begin |
|
2645 |
inc(Gear^.Tag); |
|
14014
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2646 |
Gear^.Timer := 50; |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2647 |
if Gear^.Tag = 3 then |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2648 |
begin |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2649 |
ClearHitOrder(); |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2650 |
RefillProximityCache(Gear, 100); |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2651 |
end; |
12833 | 2652 |
end; |
2653 |
||
2654 |
if Gear^.Tag = 3 then |
|
12124 | 2655 |
begin |
2656 |
HHGear := Gear^.Hedgehog^.Gear; |
|
2657 |
HHGear^.State := HHGear^.State or gstNoDamage; |
|
2658 |
DeleteCI(HHGear); |
|
2659 |
||
14014
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2660 |
AmmoShoveCache(Gear, Gear^.Boom, 115); |
12124 | 2661 |
|
2662 |
HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving; |
|
12833 | 2663 |
end |
2664 |
else if Gear^.Tag = 4 then |
|
2665 |
begin |
|
14014
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2666 |
ClearHitOrder(); |
d203bb36225f
and finally make the bat hit moving gears for completeness
alfadur
parents:
14013
diff
changeset
|
2667 |
ClearProximityCache(); |
12124 | 2668 |
Gear^.Timer := 250; |
2669 |
Gear^.doStep := @doStepIdle |
|
2670 |
end |
|
79 | 2671 |
end; |
2672 |
||
2673 |
//////////////////////////////////////////////////////////////////////////////// |
|
925 | 2674 |
procedure doStepWhip(Gear: PGear); |
8795 | 2675 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2676 |
HHGear: PGear; |
925 | 2677 |
i: LongInt; |
2678 |
begin |
|
4365 | 2679 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2680 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2681 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2682 |
|
14013 | 2683 |
ClearHitOrder(); |
2684 |
RefillProximityCache(Gear, 100); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2685 |
for i:= 0 to 3 do |
4578 | 2686 |
begin |
9723
31d10d684e90
whip: visual enhancements (hat'n'dust) as suggested by nemo
sheepluva
parents:
9721
diff
changeset
|
2687 |
AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust); |
14013 | 2688 |
AmmoShoveCache(Gear, Gear^.Boom, 25); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2689 |
Gear^.X := Gear^.X + Gear^.dX * 5 |
4578 | 2690 |
end; |
925 | 2691 |
|
14013 | 2692 |
ClearHitOrder(); |
2693 |
ClearProximityCache(); |
|
4182 | 2694 |
HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving; |
2695 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2696 |
Gear^.Timer := 250; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2697 |
Gear^.doStep := @doStepIdle |
925 | 2698 |
end; |
2699 |
||
2700 |
//////////////////////////////////////////////////////////////////////////////// |
|
79 | 2701 |
procedure doStepFlame(Gear: PGear); |
8795 | 2702 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2703 |
gX,gY,i: LongInt; |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2704 |
sticky: Boolean; |
3751 | 2705 |
vgt: PVisualGear; |
10591 | 2706 |
tdX,tdY, f: HWFloat; |
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2707 |
landPixel: Word; |
79 | 2708 |
begin |
9477 | 2709 |
WorldWrap(Gear); |
10586
dbb77726f0c6
add a half-second flighttime delay to flamethrower flames so they can leave the "barrel" of the flamethrower without burning the hog
nemo
parents:
10582
diff
changeset
|
2710 |
if Gear^.FlightTime > 0 then dec(Gear^.FlightTime); |
14998 | 2711 |
// There are 2 flame types: normal and sticky |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2712 |
sticky:= (Gear^.State and gsttmpFlag) <> 0; |
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2713 |
if not sticky then AllInactive := false; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2714 |
|
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2715 |
landPixel:= TestCollisionYwithGear(Gear, 1); |
14998 | 2716 |
// Flame is in mid-air |
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2717 |
if landPixel = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2718 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2719 |
AllInactive := false; |
3751 | 2720 |
|
14998 | 2721 |
// Deals damage in mid-air if FlightTime = 0. |
2722 |
// Otherwise, flame is harmless in mid-air. |
|
2723 |
// Intended for use with scripts. |
|
10586
dbb77726f0c6
add a half-second flighttime delay to flamethrower flames so they can leave the "barrel" of the flamethrower without burning the hog
nemo
parents:
10582
diff
changeset
|
2724 |
if (GameTicks and $F = 0) and (Gear^.FlightTime = 0) then |
10578
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2725 |
begin |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2726 |
Gear^.Radius := 7; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2727 |
tdX:= Gear^.dX; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2728 |
tdY:= Gear^.dY; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2729 |
Gear^.dX.QWordValue:= 120000000; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2730 |
Gear^.dY.QWordValue:= 429496730; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2731 |
Gear^.dX.isNegative:= getrandom(2)<>1; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2732 |
Gear^.dY.isNegative:= true; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2733 |
AmmoShove(Gear, Gear^.Boom, 125); |
10578
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2734 |
Gear^.dX:= tdX; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2735 |
Gear^.dY:= tdY; |
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2736 |
Gear^.Radius := 1 |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
2737 |
end; |
10578
814acf1511be
duplicate the ammoshove block into the falling fire area - this will make falling flames take out hogs in saucers, on rope, etc. no more dodging your own napalm strike by taking to the skies...
nemo
parents:
10547
diff
changeset
|
2738 |
|
3751 | 2739 |
if ((GameTicks mod 100) = 0) then |
2740 |
begin |
|
4443
d393b9ccd328
Add an extra pass in FindPlace for AI resurrection mode to try to make it unwinnable, add DeleteGear, DeleteVisualGear, AddVisualGear, GetVisualGearValues, SetVisualGearValues to Lua
nemo
parents:
4405
diff
changeset
|
2741 |
vgt:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire, gstTmpFlag); |
3751 | 2742 |
if vgt <> nil then |
2743 |
begin |
|
2744 |
vgt^.dx:= 0; |
|
2745 |
vgt^.dy:= 0; |
|
2746 |
vgt^.FrameTicks:= 1800 div (Gear^.Tag mod 3 + 2); |
|
2747 |
end; |
|
2748 |
end; |
|
2749 |
||
10591 | 2750 |
if (Gear^.dX.QWordValue > _2.QWordValue) |
2751 |
or (Gear^.dY.QWordValue > _2.QWordValue) |
|
2752 |
then |
|
2753 |
begin |
|
2754 |
// norm speed vector to length of 2 for fire particles to keep flying in the same direction |
|
10642
8fdfa2b77d83
Normalize to length of _1_9 to avoid endless normalization leading to fire particles floating midair indefinitely
unc0rr
parents:
10634
diff
changeset
|
2755 |
f:= _1_9 / Distance(Gear^.dX, Gear^.dY); |
10591 | 2756 |
Gear^.dX:= Gear^.dX * f; |
2757 |
Gear^.dY:= Gear^.dY * f; |
|
2758 |
end |
|
2759 |
else begin |
|
14998 | 2760 |
// Gravity and wind |
10591 | 2761 |
if Gear^.dX.QWordValue > _0_01.QWordValue then |
2762 |
Gear^.dX := Gear^.dX * _0_995; |
|
2763 |
||
2764 |
Gear^.dY := Gear^.dY + cGravity; |
|
2765 |
||
2766 |
if Gear^.dY.QWordValue > _0_2.QWordValue then |
|
2767 |
Gear^.dY := Gear^.dY * _0_995; |
|
2768 |
||
2769 |
Gear^.X := Gear^.X + Gear^.dX + cWindSpeed * 640; |
|
2770 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
2771 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2772 |
|
10354 | 2773 |
gX := hwRound(Gear^.X); |
2774 |
gY := hwRound(Gear^.Y); |
|
2775 |
||
14998 | 2776 |
// Extinguish in water |
10354 | 2777 |
if CheckCoordInWater(gX, gY) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2778 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2779 |
for i:= 0 to 3 do |
10354 | 2780 |
AddVisualGear(gX - 8 + Random(16), gY - 8 + Random(16), vgtSteam); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2781 |
PlaySound(sndVaporize); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2782 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2783 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2784 |
end |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2785 |
end |
14998 | 2786 |
// Flame is on terrain |
10015 | 2787 |
else |
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2788 |
begin |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2789 |
if (Gear^.Timer = 1) and (GameTicks and $3 = 0) then |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2790 |
begin |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2791 |
Gear^.Y:= Gear^.Y+_6; |
14998 | 2792 |
// Extinguish on ice |
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2793 |
if (landPixel and lfIce <> 0) or (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2794 |
begin |
10379
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2795 |
gX := hwRound(Gear^.X); |
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2796 |
gY := hwRound(Gear^.Y) - 6; |
13571
acc69f506914
Use wrap-aware doMakeExplosion instead of DrawExplosion in uHandlersMess
Wuzzy <Wuzzy2@mail.ru>
parents:
13469
diff
changeset
|
2797 |
doMakeExplosion(gX, gY, 4, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx); |
9362
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2798 |
PlaySound(sndVaporize); |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2799 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSteam); |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2800 |
DeleteGear(Gear); |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2801 |
exit |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2802 |
end; |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2803 |
Gear^.Y:= Gear^.Y-_6 |
c9fdf8a3baf0
crude ice check that probably works well enough in most cases (so far there's just one ucollisions that returns a land pixel - might want to extend that)
nemo
parents:
9356
diff
changeset
|
2804 |
end; |
14998 | 2805 |
// Sticky flame damage |
9277
ad1ec7212ac7
reduce shove frequency (perf). reduce dX so that less time is spent sliding.
nemo
parents:
9251
diff
changeset
|
2806 |
if sticky and (GameTicks and $F = 0) then |
5024 | 2807 |
begin |
3603
b6b1989744ef
Grid the landscape, and shortcircuit checks on the collision array if there are no nearby checked in collisions to be collided with. This is a big win for fire's ammoshove in particular. Also add a +2 that seemed missing in the check, and update fire accordingly.
nemo
parents:
3594
diff
changeset
|
2808 |
Gear^.Radius := 7; |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2809 |
tdX:= Gear^.dX; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2810 |
tdY:= Gear^.dY; |
9277
ad1ec7212ac7
reduce shove frequency (perf). reduce dX so that less time is spent sliding.
nemo
parents:
9251
diff
changeset
|
2811 |
Gear^.dX.QWordValue:= 120000000; |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2812 |
Gear^.dY.QWordValue:= 429496730; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2813 |
Gear^.dX.isNegative:= getrandom(2)<>1; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2814 |
Gear^.dY.isNegative:= true; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2815 |
AmmoShove(Gear, Gear^.Boom, 125); |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2816 |
Gear^.dX:= tdX; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2817 |
Gear^.dY:= tdY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2818 |
Gear^.Radius := 1 |
5024 | 2819 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2820 |
if Gear^.Timer > 0 then |
5024 | 2821 |
begin |
2475 | 2822 |
dec(Gear^.Timer); |
2823 |
inc(Gear^.Damage) |
|
5024 | 2824 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2825 |
else |
14998 | 2826 |
// Flame burn-down handling |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2827 |
begin |
10379
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2828 |
gX := hwRound(Gear^.X); |
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2829 |
gY := hwRound(Gear^.Y); |
14998 | 2830 |
// Normal flame: Burns down quickly and must be destroyed before the turn ends |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2831 |
if not sticky then |
5024 | 2832 |
begin |
14998 | 2833 |
// Deal damage |
3640
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2834 |
if ((GameTicks and $1) = 0) then |
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2835 |
begin |
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2836 |
Gear^.Radius := 7; |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2837 |
tdX:= Gear^.dX; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2838 |
tdY:= Gear^.dY; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2839 |
Gear^.dX.QWordValue:= 214748365; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2840 |
Gear^.dY.QWordValue:= 429496730; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2841 |
Gear^.dX.isNegative:= getrandom(2)<>1; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2842 |
Gear^.dY.isNegative:= true; |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
2843 |
AmmoShove(Gear, Gear^.Boom * 3, 100); |
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2844 |
Gear^.dX:= tdX; |
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset
|
2845 |
Gear^.dY:= tdY; |
3640
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2846 |
Gear^.Radius := 1; |
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2847 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2848 |
else if ((GameTicks and $3) = 3) then |
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
2849 |
doMakeExplosion(gX, gY, Gear^.Boom * 4, Gear^.Hedgehog, 0); |
8795 | 2850 |
|
3096
9330eead14fa
Remove Distance from flake kick, reduce calls to Random() in flame replacing w/ checks on game tick and a little randomness.
nemo
parents:
3094
diff
changeset
|
2851 |
if ((GameTicks and $7) = 0) and (Random(2) = 0) then |
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7416
diff
changeset
|
2852 |
for i:= Random(2) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2853 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
8795 | 2854 |
|
14998 | 2855 |
// Flame burn-out due to time |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2856 |
if Gear^.Health > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2857 |
dec(Gear^.Health); |
14998 | 2858 |
|
2859 |
// Calculate time for next flame update with a bit of random jitter |
|
9809 | 2860 |
Gear^.Timer := 450 - Gear^.Tag * 8 + LongInt(GetRandom(2)) |
5024 | 2861 |
end |
14998 | 2862 |
// Sticky flame: Burns down slowly and persists between turns |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2863 |
else |
5024 | 2864 |
begin |
14998 | 2865 |
// Destroy land very slowly (low chance this gets called) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2866 |
if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then |
5024 | 2867 |
begin |
13571
acc69f506914
Use wrap-aware doMakeExplosion instead of DrawExplosion in uHandlersMess
Wuzzy <Wuzzy2@mail.ru>
parents:
13469
diff
changeset
|
2868 |
doMakeExplosion(gX, gY, 4, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2869 |
|
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7416
diff
changeset
|
2870 |
for i:= Random(3) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2871 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
5024 | 2872 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2873 |
|
14998 | 2874 |
// Calculate time for next flame update with a bit of random jitter |
9809 | 2875 |
Gear^.Timer := 100 - Gear^.Tag * 3 + LongInt(GetRandom(2)); |
14998 | 2876 |
|
2877 |
// Flame burn-out due to time |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2878 |
if (Gear^.Damage > 3000+Gear^.Tag*1500) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2879 |
Gear^.Health := 0 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2880 |
end |
2424
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
2881 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2882 |
end; |
14998 | 2883 |
// This kills the flame |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2884 |
if Gear^.Health = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2885 |
begin |
10379
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2886 |
gX := hwRound(Gear^.X); |
caa5b40e405b
I a recent commit I caused flames to use uninitialized values. that lead to fire burning slow and desyncs. this commit fixes/reverts this
sheepluva
parents:
10372
diff
changeset
|
2887 |
gY := hwRound(Gear^.Y); |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2888 |
if not sticky then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2889 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2890 |
if ((GameTicks and $3) = 0) and (Random(1) = 0) then |
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7416
diff
changeset
|
2891 |
for i:= Random(2) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2892 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2893 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2894 |
else |
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7416
diff
changeset
|
2895 |
for i:= Random(3) downto 0 do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2896 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2897 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2898 |
DeleteGear(Gear) |
14559 | 2899 |
end |
79 | 2900 |
end; |
82 | 2901 |
|
2902 |
//////////////////////////////////////////////////////////////////////////////// |
|
2903 |
procedure doStepFirePunchWork(Gear: PGear); |
|
8795 | 2904 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2905 |
HHGear: PGear; |
82 | 2906 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2907 |
AllInactive := false; |
3894 | 2908 |
if ((Gear^.Message and gmDestroy) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2909 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2910 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2911 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2912 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2913 |
end; |
82 | 2914 |
|
4365 | 2915 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2916 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2917 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2918 |
Gear^.Tag := hwRound(HHGear^.Y); |
10887 | 2919 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4+2, 2); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2920 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2921 |
Gear^.Y := HHGear^.Y; |
14011
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2922 |
AmmoShoveCache(Gear, Gear^.Boom, 40); |
6450 | 2923 |
HHGear^.State := HHGear^.State and (not gstNoDamage) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2924 |
end; |
351 | 2925 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2926 |
HHGear^.dY := HHGear^.dY + cGravity; |
9824 | 2927 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
2928 |
if not (HHGear^.dY.isNegative) or (Gear^.Timer = 0) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2929 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2930 |
HHGear^.State := HHGear^.State or gstMoving; |
14010
31bdb759d98b
prevent firepunch from hitting the same gear multiple times
alfadur
parents:
14003
diff
changeset
|
2931 |
ClearHitOrder(); |
14011
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2932 |
ClearProximityCache(); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2933 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2934 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2935 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2936 |
end; |
2089 | 2937 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2938 |
if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)), |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2939 |
lfIndestructible) then |
14011
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2940 |
HHGear^.Y := HHGear^.Y + HHGear^.dY; |
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2941 |
|
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2942 |
if (Gear^.Timer mod 200) = 0 then |
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2943 |
RefillProximityCache(Gear, 300); |
82 | 2944 |
end; |
2945 |
||
2946 |
procedure doStepFirePunch(Gear: PGear); |
|
8795 | 2947 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2948 |
HHGear: PGear; |
82 | 2949 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2950 |
AllInactive := false; |
4365 | 2951 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2952 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2953 |
HHGear^.dX := SignAs(cLittle, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2954 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2955 |
HHGear^.dY := - _0_3; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2956 |
|
14010
31bdb759d98b
prevent firepunch from hitting the same gear multiple times
alfadur
parents:
14003
diff
changeset
|
2957 |
ClearHitOrder(); |
14011
105793e575d6
make firepunch hit moving gears (airmines are not amused)
alfadur
parents:
14010
diff
changeset
|
2958 |
RefillProximityCache(Gear, 300); |
14010
31bdb759d98b
prevent firepunch from hitting the same gear multiple times
alfadur
parents:
14003
diff
changeset
|
2959 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2960 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2961 |
Gear^.dX := SignAs(_0_45, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2962 |
Gear^.dY := - _0_9; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2963 |
Gear^.doStep := @doStepFirePunchWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2964 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2965 |
|
7053 | 2966 |
PlaySoundV(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.voicepack) |
82 | 2967 |
end; |
2968 |
||
263 | 2969 |
//////////////////////////////////////////////////////////////////////////////// |
2970 |
||
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2971 |
procedure doStepParachuteWork(Gear: PGear); |
8795 | 2972 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2973 |
HHGear: PGear; |
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
2974 |
deltaX: hwFloat; |
211 | 2975 |
begin |
4365 | 2976 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2977 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2978 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2979 |
|
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
2980 |
if (TestCollisionYwithGear(HHGear, 1) <> 0) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2981 |
or ((HHGear^.State and gstHHDriven) = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2982 |
or CheckGearDrowning(HHGear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2983 |
or ((Gear^.Message and gmAttack) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2984 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2985 |
with HHGear^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2986 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2987 |
Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2988 |
SetLittle(dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2989 |
dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2990 |
State := State or gstMoving; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2991 |
end; |
13961
2568fa516733
Fix hog can drop more than 2 s. mines if first one was dropped from utility, then stop using that utility
Wuzzy <Wuzzy2@mail.ru>
parents:
13882
diff
changeset
|
2992 |
if (GetAmmoEntry(HHGear^.Hedgehog^, amParachute)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
12825
4c1c468725ff
Fix desync when dropping weapon from parachute or jetpack
Wuzzy <Wuzzy2@mail.ru>
parents:
12820
diff
changeset
|
2993 |
HHGear^.Hedgehog^.CurAmmoType:= amParachute; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2994 |
isCursorVisible := false; |
4372 | 2995 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
14559 | 2996 |
DeleteGear(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2997 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2998 |
end; |
211 | 2999 |
|
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3000 |
deltaX:= _0; |
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3001 |
deltaX:= deltaX + cWindSpeed * 200; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3002 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3003 |
if (Gear^.Message and gmLeft) <> 0 then |
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3004 |
deltaX := deltaX - cMaxWindSpeed * 80 |
8795 | 3005 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3006 |
else if (Gear^.Message and gmRight) <> 0 then |
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3007 |
deltaX := deltaX + cMaxWindSpeed * 80; |
8795 | 3008 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3009 |
if (Gear^.Message and gmUp) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3010 |
HHGear^.Y := HHGear^.Y - cGravity * 40 |
8795 | 3011 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3012 |
else if (Gear^.Message and gmDown) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3013 |
HHGear^.Y := HHGear^.Y + cGravity * 40; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3014 |
|
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3015 |
HHGear^.X := HHGear^.X + deltaX; |
4774 | 3016 |
// don't drift into obstacles |
14941
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3017 |
if TestCollisionXwithGear(HHGear, hwSign(deltaX)) <> 0 then |
d6a8ef85cf53
Fix parachute moving hog very fast or making it stuck when bumping into wall while facing the opposite direction (bug 742)
Wuzzy <Wuzzy2@mail.ru>
parents:
14883
diff
changeset
|
3018 |
HHGear^.X := HHGear^.X - int2hwFloat(hwSign(deltaX)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3019 |
HHGear^.Y := HHGear^.Y + cGravity * 100; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3020 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3021 |
Gear^.Y := HHGear^.Y |
263 | 3022 |
end; |
211 | 3023 |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
3024 |
procedure doStepParachute(Gear: PGear); |
8795 | 3025 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3026 |
HHGear: PGear; |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
3027 |
begin |
4365 | 3028 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3029 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3030 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3031 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3032 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3033 |
|
11337
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11304
diff
changeset
|
3034 |
// make sure hog doesn't end up facing in wrong direction due to high jump |
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11304
diff
changeset
|
3035 |
if (HHGear^.State and gstHHHJump) <> 0 then |
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11304
diff
changeset
|
3036 |
HHGear^.dX.isNegative := (not HHGear^.dX.isNegative); |
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11304
diff
changeset
|
3037 |
|
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11304
diff
changeset
|
3038 |
HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked or gstMoving or gstHHJumping or gstHHHJump)); |
6450 | 3039 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3040 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3041 |
Gear^.doStep := @doStepParachuteWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3042 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3043 |
Gear^.Message := HHGear^.Message; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3044 |
doStepParachuteWork(Gear) |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
3045 |
end; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
3046 |
|
263 | 3047 |
//////////////////////////////////////////////////////////////////////////////// |
3048 |
procedure doStepAirAttackWork(Gear: PGear); |
|
3049 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3050 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3051 |
Gear^.X := Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3052 |
|
11545 | 3053 |
if (Gear^.Health > 0) and (not (Gear^.X < Gear^.dX)) and (Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3054 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3055 |
dec(Gear^.Health); |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3056 |
if (WorldEdge = weBounce) and (((Gear^.Tag = 1) and (hwRound(Gear^.X) > rightX)) or ((Gear^.Tag = -1) and (hwRound(Gear^.X) < leftX))) then |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3057 |
begin |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3058 |
// Don't spawn missile if it would end up inside bounce world edge of the opposite side |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3059 |
PlaySound(sndVaporize); |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3060 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmoke); |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3061 |
end |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3062 |
else |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3063 |
begin |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3064 |
// Spawn missile |
8795 | 3065 |
case Gear^.State of |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3066 |
0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3067 |
1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3068 |
2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3069 |
3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed * Gear^.Tag, _0, Gear^.Timer + 1); |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3070 |
end; |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3071 |
Gear^.dX := Gear^.dX + int2hwFloat(Gear^.Damage * Gear^.Tag); |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3072 |
if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3073 |
FollowGear^.State:= FollowGear^.State or gstSubmersible; |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3074 |
end; |
7053 | 3075 |
StopSoundChan(Gear^.SoundChannel, 4000); |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3076 |
end; |
1124 | 3077 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3078 |
if (GameTicks and $3F) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3079 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3080 |
|
14747
2e8213c0951f
Fix air attack placement in HedgeEditor/Construction Mode
Wuzzy <Wuzzy2@mail.ru>
parents:
14740
diff
changeset
|
3081 |
if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -2048) or ((Gear^.Message and gmDestroy) > 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3082 |
begin |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
3083 |
// avoid to play forever (is this necessary?) |
7053 | 3084 |
StopSoundChan(Gear^.SoundChannel); |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
3085 |
DeleteGear(Gear) |
14559 | 3086 |
end |
263 | 3087 |
end; |
3088 |
||
3089 |
procedure doStepAirAttack(Gear: PGear); |
|
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3090 |
var valid: boolean; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3091 |
HHGear: PGear; |
263 | 3092 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3093 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3094 |
|
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3095 |
valid:= true; |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3096 |
// Bounce world edge restrictions ... |
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3097 |
if (WorldEdge = weBounce) then |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3098 |
// If plane flies right, deny placement inside the right bounce side |
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3099 |
if (Gear^.X.QWordValue = 0) and (Gear^.Target.X > rightX) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3100 |
valid:= false |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3101 |
// If plane flies left, deny placement inside the left bounce side |
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3102 |
else if (Gear^.X.QWordValue <> 0) and (Gear^.Target.X < leftX) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3103 |
valid:= false |
14573
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3104 |
// Deny placement of high targets. This serves as a buffer to further |
e26fa5ea2bf6
Air attack: Don't spawn missile if it would end up inside bounce world edge of other side
Wuzzy <Wuzzy2@mail.ru>
parents:
14572
diff
changeset
|
3105 |
// reduce potentially weird bouncy gear behaviour |
14572
5de4d470dafe
Tweak height limit of air attack in bounce edge maps
Wuzzy <Wuzzy2@mail.ru>
parents:
14571
diff
changeset
|
3106 |
else if (Gear^.Target.Y < (topY - 50)) then |
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3107 |
valid:= false; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3108 |
|
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3109 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3110 |
HHGear:= Gear^.Hedgehog^.Gear; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3111 |
|
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3112 |
if (not valid) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3113 |
begin |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3114 |
if (HHGear <> nil) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3115 |
begin |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3116 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3117 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3118 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3119 |
isCursorVisible := true; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3120 |
end; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3121 |
DeleteGear(Gear); |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3122 |
PlaySound(sndDenied); |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3123 |
exit; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3124 |
end; |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3125 |
|
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3126 |
if (HHGear <> nil) then |
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3127 |
PlaySoundV(sndIncoming, Gear^.Hedgehog^.Team^.voicepack); |
14740
2d859d34e6f6
Fix turn end if placing air attack in bouncy world edge map was denied
Wuzzy <Wuzzy2@mail.ru>
parents:
14737
diff
changeset
|
3128 |
AfterAttack; |
2d859d34e6f6
Fix turn end if placing air attack in bouncy world edge map was denied
Wuzzy <Wuzzy2@mail.ru>
parents:
14737
diff
changeset
|
3129 |
CurAmmoGear := nil; |
14570
833ab5b359e5
Deny air attack in bounce world edge if target is in "impossible" position
Wuzzy <Wuzzy2@mail.ru>
parents:
14565
diff
changeset
|
3130 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3131 |
if Gear^.X.QWordValue = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3132 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3133 |
Gear^.Tag := 1; |
5067
57101536cf86
fix for Issue 207: To far left for Napalm (and other weapons)
sheepluva
parents:
5063
diff
changeset
|
3134 |
Gear^.X := -_2048; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3135 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3136 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3137 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3138 |
Gear^.Tag := -1; |
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
3139 |
Gear^.X := int2hwFloat(max(LAND_WIDTH,4096) + 2048); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3140 |
end; |
1507 | 3141 |
|
14572
5de4d470dafe
Tweak height limit of air attack in bounce edge maps
Wuzzy <Wuzzy2@mail.ru>
parents:
14571
diff
changeset
|
3142 |
Gear^.Y := int2hwFloat(topY - 300); |
11545 | 3143 |
Gear^.dX := int2hwFloat(Gear^.Target.X) - int2hwFloat(Gear^.Tag * (Gear^.Health-1) * Gear^.Damage) / 2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3144 |
|
4778
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
3145 |
// calcs for Napalm Strike, so that it will hit the target (without wind at least :P) |
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
3146 |
if (Gear^.State = 2) then |
8795 | 3147 |
Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
4778
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
3148 |
// calcs for regular falling gears |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3149 |
else if (int2hwFloat(Gear^.Target.Y) - Gear^.Y > _0) then |
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3150 |
Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(Gear^.Target.Y) - Gear^.Y) * 2 / |
4778
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
3151 |
cGravity) * Gear^.Tag; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3152 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3153 |
Gear^.doStep := @doStepAirAttackWork; |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
3154 |
Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
3155 |
|
263 | 3156 |
end; |
3157 |
||
3158 |
//////////////////////////////////////////////////////////////////////////////// |
|
3159 |
||
3160 |
procedure doStepAirBomb(Gear: PGear); |
|
3161 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3162 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3163 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3164 |
if (Gear^.State and gstCollision) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3165 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
3166 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
9954 | 3167 |
{$IFNDEF PAS2C} |
8204 | 3168 |
with mobileRecord do |
3169 |
if (performRumble <> nil) and (not fastUntilLag) then |
|
3170 |
performRumble(kSystemSoundID_Vibrate); |
|
9954 | 3171 |
{$ENDIF} |
14559 | 3172 |
DeleteGear(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3173 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3174 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3175 |
if (GameTicks and $3F) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3176 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) |
211 | 3177 |
end; |
409 | 3178 |
|
3179 |
//////////////////////////////////////////////////////////////////////////////// |
|
3180 |
||
3181 |
procedure doStepGirder(Gear: PGear); |
|
8795 | 3182 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3183 |
HHGear: PGear; |
1915 | 3184 |
x, y, tx, ty: hwFloat; |
9505
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9487
diff
changeset
|
3185 |
rx: LongInt; |
9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9767
diff
changeset
|
3186 |
LandFlags: Word; |
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3187 |
warn: PVisualGear; |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3188 |
distFail: boolean; |
409 | 3189 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3190 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3191 |
|
4365 | 3192 |
HHGear := Gear^.Hedgehog^.Gear; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3193 |
tx := int2hwFloat(Gear^.Target.X); |
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3194 |
ty := int2hwFloat(Gear^.Target.Y); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3195 |
x := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3196 |
y := HHGear^.Y; |
9505
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9487
diff
changeset
|
3197 |
rx:= hwRound(x); |
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9487
diff
changeset
|
3198 |
|
9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9767
diff
changeset
|
3199 |
LandFlags:= 0; |
9811
66a7959869f0
make rubber bouncy even in winter. was considering icy as well but, one, evil, two, would prob want ice sprite like girder
nemo
parents:
9809
diff
changeset
|
3200 |
if Gear^.AmmoType = amRubber then LandFlags:= lfBouncy |
66a7959869f0
make rubber bouncy even in winter. was considering icy as well but, one, evil, two, would prob want ice sprite like girder
nemo
parents:
9809
diff
changeset
|
3201 |
else if cIce then LandFlags:= lfIce; |
9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9767
diff
changeset
|
3202 |
|
11057
adb5ef54da54
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
sheepluva
parents:
11046
diff
changeset
|
3203 |
distFail:= (cBuildMaxDist > 0) and ((hwRound(Distance(tx - x, ty - y)) > cBuildMaxDist) and ((WorldEdge <> weWrap) or |
9505
56e0cca99e20
Allow girder construction to wrap. Makes wrapping w/ large bodies of water a bit more interesting.
nemo
parents:
9487
diff
changeset
|
3204 |
( |
11057
adb5ef54da54
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
sheepluva
parents:
11046
diff
changeset
|
3205 |
(hwRound(Distance(tx - int2hwFloat(rightX+(rx-leftX)), ty - y)) > cBuildMaxDist) and |
adb5ef54da54
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
sheepluva
parents:
11046
diff
changeset
|
3206 |
(hwRound(Distance(tx - int2hwFloat(leftX-(rightX-rx)), ty - y)) > cBuildMaxDist) |
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3207 |
))); |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3208 |
if distFail |
10286
1940e937fc08
fix TryPlaceOnLand's ambiguity/messup wrt to making terrain indestructible (had boolean parameter for indestructible AND landflags parameters that could contain lfIndestructibly)
sheepluva
parents:
10253
diff
changeset
|
3209 |
or (not TryPlaceOnLand(Gear^.Target.X - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Width div 2, Gear^.Target.Y - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Height div 2, Ammoz[Gear^.AmmoType].PosSprite, Gear^.State, true, LandFlags)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3210 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3211 |
PlaySound(sndDenied); |
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3212 |
if not distFail then |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3213 |
begin |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3214 |
warn:= AddVisualGear(Gear^.Target.X, Gear^.Target.Y, vgtNoPlaceWarn, 0, true); |
10251
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3215 |
if warn <> nil then |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3216 |
warn^.Tex := GetPlaceCollisionTex(Gear^.Target.X - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Width div 2, Gear^.Target.Y - SpritesData[Ammoz[Gear^.AmmoType].PosSprite].Height div 2, Ammoz[Gear^.AmmoType].PosSprite, Gear^.State); |
a3b42e81803c
collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents:
10234
diff
changeset
|
3217 |
end; |
6450 | 3218 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3219 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
|
10818
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10815
diff
changeset
|
3220 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3221 |
isCursorVisible := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3222 |
DeleteGear(Gear) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3223 |
end |
8795 | 3224 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3225 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3226 |
PlaySound(sndPlaced); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3227 |
DeleteGear(Gear); |
14559 | 3228 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3229 |
end; |
1914 | 3230 |
|
6450 | 3231 |
HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked)); |
3232 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
|
409 | 3233 |
end; |
520 | 3234 |
|
3235 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 3236 |
procedure doStepTeleportAfter(Gear: PGear); |
8795 | 3237 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3238 |
HHGear: PGear; |
912 | 3239 |
begin |
4365 | 3240 |
HHGear := Gear^.Hedgehog^.Gear; |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3241 |
if HHGear <> nil then doStepHedgehogMoving(HHGear); |
7659 | 3242 |
// if not infattack mode wait for hedgehog finish falling to collect cases |
3243 |
if ((GameFlags and gfInfAttack) <> 0) |
|
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3244 |
or (HHGear = nil) |
7659 | 3245 |
or ((HHGear^.State and gstMoving) = 0) |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3246 |
or (HHGear^.Damage > 0) |
7659 | 3247 |
or ((HHGear^.State and gstDrowning) = 1) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3248 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3249 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3250 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3251 |
end |
912 | 3252 |
end; |
3253 |
||
3254 |
procedure doStepTeleportAnim(Gear: PGear); |
|
525 | 3255 |
begin |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3256 |
if (Gear^.Hedgehog^.Gear = nil) or (Gear^.Hedgehog^.Gear^.Damage > 0) then |
7659 | 3257 |
begin |
3258 |
DeleteGear(Gear); |
|
3259 |
AfterAttack; |
|
14561 | 3260 |
exit |
7659 | 3261 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3262 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3263 |
if Gear^.Timer = 65 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3264 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3265 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3266 |
inc(Gear^.Pos); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3267 |
if Gear^.Pos = 11 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3268 |
Gear^.doStep := @doStepTeleportAfter |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3269 |
end; |
525 | 3270 |
end; |
520 | 3271 |
|
3272 |
procedure doStepTeleport(Gear: PGear); |
|
8795 | 3273 |
var |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3274 |
lx, ty, y, oy: LongInt; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3275 |
HHGear : PGear; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3276 |
valid : Boolean; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3277 |
warn : PVisualGear; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3278 |
const |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3279 |
ytol = cHHRadius; |
520 | 3280 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3281 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3282 |
|
4365 | 3283 |
HHGear := Gear^.Hedgehog^.Gear; |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3284 |
if HHGear = nil then |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3285 |
begin |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3286 |
DeleteGear(Gear); |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3287 |
exit |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
3288 |
end; |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3289 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3290 |
valid:= false; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3291 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3292 |
lx:= Gear^.Target.X - SpritesData[sprHHTelepMask].Width div 2; // left |
12794
28782e03b8f0
Fix CheckWorldWrap not correctly checking for bounce edge. Also fix teleport @ bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12769
diff
changeset
|
3293 |
if WorldEdge <> weBounce then |
28782e03b8f0
Fix CheckWorldWrap not correctly checking for bounce edge. Also fix teleport @ bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12769
diff
changeset
|
3294 |
lx:= CalcWorldWrap(lx, SpritesData[sprHHTelepMask].Width div 2); // Take world edge into account |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3295 |
ty:= Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2; // top |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3296 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3297 |
// remember original target location |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3298 |
oy:= Gear^.Target.Y; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3299 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3300 |
for y:= ty downto ty - ytol do |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3301 |
begin |
10897
8ea636ce120a
Add options to set colouring, behind existing land, and horizontal/vertical flipping to PlaceSprite
nemo
parents:
10895
diff
changeset
|
3302 |
if TryPlaceOnLand(lx, y, sprHHTelepMask, 0, false, not hasBorder, false, false, false, false, 0, $FFFFFFFF) then |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3303 |
begin |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3304 |
valid:= true; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3305 |
break; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3306 |
end; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3307 |
dec(Gear^.Target.Y); |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3308 |
end; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3309 |
|
12794
28782e03b8f0
Fix CheckWorldWrap not correctly checking for bounce edge. Also fix teleport @ bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12769
diff
changeset
|
3310 |
if (WorldEdge = weBounce) and ((Gear^.Target.X < LeftX) or (Gear^.Target.X > RightX)) then |
28782e03b8f0
Fix CheckWorldWrap not correctly checking for bounce edge. Also fix teleport @ bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12769
diff
changeset
|
3311 |
valid:= false; |
28782e03b8f0
Fix CheckWorldWrap not correctly checking for bounce edge. Also fix teleport @ bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12769
diff
changeset
|
3312 |
|
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3313 |
if not valid then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3314 |
begin |
6450 | 3315 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3316 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
|
10818
f642a28cab0c
Add placement of airmines in engine outside of hog proximity. Has a bug, only protecting 1st team. Also fix a spelling error and rename gstHHChooseTarget to gstChooseTarget
nemo
parents:
10815
diff
changeset
|
3317 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3318 |
isCursorVisible := true; |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3319 |
warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true); |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3320 |
if warn <> nil then |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
3321 |
warn^.Tex := GetPlaceCollisionTex(lx, ty, sprHHTelepMask, 0); |
10676
7111b4a46b5c
fix for Issue 855: Failure to teleport rarely makes engine crash
sheepluva
parents:
10663
diff
changeset
|
3322 |
DeleteGear(Gear); |
7111b4a46b5c
fix for Issue 855: Failure to teleport rarely makes engine crash
sheepluva
parents:
10663
diff
changeset
|
3323 |
PlaySound(sndDenied); |
7111b4a46b5c
fix for Issue 855: Failure to teleport rarely makes engine crash
sheepluva
parents:
10663
diff
changeset
|
3324 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3325 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3326 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3327 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3328 |
DeleteCI(HHGear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3329 |
SetAllHHToActive; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3330 |
Gear^.doStep := @doStepTeleportAnim; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3331 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3332 |
// copy old HH position and direction to Gear (because we need them for drawing the vanishing hog) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3333 |
Gear^.dX := HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3334 |
// retrieve the cursor direction (it was previously copied to X so it doesn't get lost) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3335 |
HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3336 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3337 |
Gear^.Y := HHGear^.Y; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3338 |
HHGear^.X := int2hwFloat(Gear^.Target.X); |
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3339 |
HHGear^.Y := int2hwFloat(Gear^.Target.Y); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3340 |
HHGear^.State := HHGear^.State or gstMoving; |
10547
cc439790ebae
fix for Issue 828: Manual placement animation is drawn twice
sheepluva
parents:
10545
diff
changeset
|
3341 |
if not Gear^.Hedgehog^.Unplaced then |
cc439790ebae
fix for Issue 828: Manual placement animation is drawn twice
sheepluva
parents:
10545
diff
changeset
|
3342 |
Gear^.State:= Gear^.State or gstAnimation; |
7659 | 3343 |
Gear^.Hedgehog^.Unplaced := false; |
3344 |
isCursorVisible := false; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3345 |
playSound(sndWarp) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3346 |
end; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
3347 |
Gear^.Target.X:= NoPointX |
520 | 3348 |
end; |
534 | 3349 |
|
3350 |
//////////////////////////////////////////////////////////////////////////////// |
|
3351 |
procedure doStepSwitcherWork(Gear: PGear); |
|
8795 | 3352 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3353 |
HHGear: PGear; |
7341
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
3354 |
hedgehog: PHedgehog; |
6992 | 3355 |
State: Longword; |
10494 | 3356 |
switchDir: Longword; |
14981 | 3357 |
oldUid: Longword; |
534 | 3358 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3359 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3360 |
|
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3361 |
if ((Gear^.Message and (not (gmSwitch or gmPrecise))) <> 0) or (TurnTimeLeft = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3362 |
begin |
7341
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
3363 |
hedgehog := Gear^.Hedgehog; |
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
3364 |
ApplyAmmoChanges(hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3365 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3366 |
HHGear := CurrentHedgehog^.Gear; |
4372 | 3367 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
14559 | 3368 |
DeleteGear(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3369 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3370 |
end; |
534 | 3371 |
|
15139
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3372 |
HHGear := CurrentHedgehog^.Gear; |
3894 | 3373 |
if (Gear^.Message and gmSwitch) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3374 |
begin |
14981 | 3375 |
oldUid:= HHGear^.uid; |
6450 | 3376 |
HHGear^.Message := HHGear^.Message and (not gmSwitch); |
3377 |
Gear^.Message := Gear^.Message and (not gmSwitch); |
|
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3378 |
|
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3379 |
// switching in reverse direction |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3380 |
if (Gear^.Message and gmPrecise) <> 0 then |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3381 |
begin |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3382 |
HHGear^.Message := HHGear^.Message and (not gmPrecise); |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3383 |
switchDir:= CurrentTeam^.HedgehogsNumber - 1; |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3384 |
end |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3385 |
else |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3386 |
switchDir:= 1; |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3387 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3388 |
State := HHGear^.State; |
15139
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3389 |
if (HHGear^.State and gstMoving) = 0 then |
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3390 |
HHGear^.Active := false; |
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3391 |
HHGear^.State := HHGear^.State and gstMoving; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
3392 |
HHGear^.Z := cHHZ; |
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
3393 |
HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3394 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3395 |
PlaySound(sndSwitchHog); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3396 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3397 |
repeat |
10494 | 3398 |
CurrentTeam^.CurrHedgehog := (CurrentTeam^.CurrHedgehog + switchDir) mod CurrentTeam^.HedgehogsNumber; |
8795 | 3399 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and |
3400 |
(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and |
|
12684
6f05a02d43b2
Fix player being able to switch to dying hog
Wuzzy <almikes@aol.com>
parents:
12681
diff
changeset
|
3401 |
(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Health > 0) and |
6f05a02d43b2
Fix player being able to switch to dying hog
Wuzzy <almikes@aol.com>
parents:
12681
diff
changeset
|
3402 |
((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.State and gstHHDeath) = 0) and |
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
3403 |
(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen]=0); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3404 |
|
7270
93e92e82d5c8
Step 1. Add current hedgehog as top bit of bottom byte.
nemo
parents:
7268
diff
changeset
|
3405 |
SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); |
8795 | 3406 |
AmmoMenuInvalidated:= true; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3407 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3408 |
HHGear := CurrentHedgehog^.Gear; |
14981 | 3409 |
ScriptCall('onHogSwitch', oldUid); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3410 |
HHGear^.State := State; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3411 |
HHGear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3412 |
FollowGear := HHGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3413 |
HHGear^.Z := cCurrHHZ; |
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3414 |
// restore precise key |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3415 |
if (switchDir <> 1) then |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
3416 |
HHGear^.Message:= HHGear^.Message or gmPrecise; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
3417 |
HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList; |
15139
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3418 |
end; |
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3419 |
doStepHedgehogMoving(HHGear); |
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3420 |
Gear^.X := HHGear^.X; |
0e0b5fc1674e
Fix floating hog when switching to moving hog
Wuzzy <Wuzzy2@mail.ru>
parents:
15056
diff
changeset
|
3421 |
Gear^.Y := HHGear^.Y |
534 | 3422 |
end; |
3423 |
||
3424 |
procedure doStepSwitcher(Gear: PGear); |
|
8795 | 3425 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3426 |
HHGear: PGear; |
534 | 3427 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3428 |
Gear^.doStep := @doStepSwitcherWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3429 |
|
4365 | 3430 |
HHGear := Gear^.Hedgehog^.Gear; |
5358 | 3431 |
OnUsedAmmo(HHGear^.Hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3432 |
with HHGear^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3433 |
begin |
6450 | 3434 |
State := State and (not gstAttacking); |
13796
096cc009e0b8
Clear gmSwitch before activating switcher
Wuzzy <Wuzzy2@mail.ru>
parents:
13779
diff
changeset
|
3435 |
Message := Message and (not (gmAttack or gmSwitch)) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3436 |
end |
534 | 3437 |
end; |
924 | 3438 |
|
3439 |
//////////////////////////////////////////////////////////////////////////////// |
|
3440 |
procedure doStepMortar(Gear: PGear); |
|
8795 | 3441 |
var |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
3442 |
dX, dY, gdX, gdY: hwFloat; |
924 | 3443 |
i: LongInt; |
3444 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3445 |
AllInactive := false; |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3446 |
gdX := Gear^.dX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3447 |
gdY := Gear^.dY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3448 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3449 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3450 |
if (Gear^.State and gstCollision) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3451 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
3452 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3453 |
gdX.isNegative := not gdX.isNegative; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3454 |
gdY.isNegative := not gdY.isNegative; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3455 |
gdX:= gdX*_0_2; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3456 |
gdY:= gdY*_0_2; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3457 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3458 |
for i:= 0 to 4 do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3459 |
begin |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3460 |
dX := gdX + rndSign(GetRandomf) * _0_03; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3461 |
dY := gdY + rndSign(GetRandomf) * _0_03; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3462 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3463 |
end; |
2376 | 3464 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3465 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3466 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3467 |
end; |
963 | 3468 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3469 |
if (GameTicks and $3F) = 0 then |
10352 | 3470 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
924 | 3471 |
end; |
984 | 3472 |
|
3473 |
//////////////////////////////////////////////////////////////////////////////// |
|
3474 |
procedure doStepKamikazeWork(Gear: PGear); |
|
8795 | 3475 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3476 |
i: LongWord; |
984 | 3477 |
HHGear: PGear; |
5866
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3478 |
sparkles: PVisualGear; |
5913 | 3479 |
hasWishes: boolean; |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
3480 |
s: ansistring; |
984 | 3481 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3482 |
AllInactive := false; |
5913 | 3483 |
hasWishes:= ((Gear^.Message and (gmPrecise or gmSwitch)) = (gmPrecise or gmSwitch)); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3484 |
if hasWishes then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3485 |
Gear^.AdvBounce:= 1; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3486 |
|
4365 | 3487 |
HHGear := Gear^.Hedgehog^.Gear; |
7958 | 3488 |
if HHGear = nil then |
3489 |
begin |
|
14012 | 3490 |
ClearHitOrder(); |
3491 |
ClearProximityCache(); |
|
7958 | 3492 |
DeleteGear(Gear); |
3493 |
exit |
|
3494 |
end; |
|
3495 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3496 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3497 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3498 |
|
3852 | 3499 |
Gear^.X := HHGear^.X; |
3500 |
Gear^.Y := HHGear^.Y; |
|
5913 | 3501 |
if (GameTicks mod 2 = 0) and hasWishes then |
5866
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3502 |
begin |
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3503 |
sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); |
6131 | 3504 |
if sparkles <> nil then |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3505 |
begin |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3506 |
sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
3507 |
sparkles^.Angle:= random(360); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3508 |
end |
5866
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3509 |
end; |
3852 | 3510 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3511 |
i := 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3512 |
repeat |
8795 | 3513 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3514 |
Gear^.X := Gear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3515 |
Gear^.Y := Gear^.Y + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3516 |
HHGear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3517 |
HHGear^.Y := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3518 |
|
10354 | 3519 |
// check for drowning |
3520 |
if CheckGearDrowning(HHGear) then |
|
3521 |
begin |
|
3522 |
AfterAttack; |
|
14012 | 3523 |
ClearHitOrder(); |
3524 |
ClearProximityCache(); |
|
10354 | 3525 |
DeleteGear(Gear); |
3526 |
exit; |
|
3527 |
end; |
|
3528 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3529 |
inc(Gear^.Damage, 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3530 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3531 |
dec(i) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3532 |
until (i = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3533 |
or (Gear^.Damage > Gear^.Health); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3534 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3535 |
inc(upd); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3536 |
if upd > 3 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3537 |
begin |
5913 | 3538 |
if Gear^.Health < 1500 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3539 |
begin |
5913 | 3540 |
if Gear^.AdvBounce <> 0 then |
3541 |
Gear^.Pos := 3 |
|
3542 |
else |
|
3543 |
Gear^.Pos := 2; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3544 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3545 |
|
14012 | 3546 |
AmmoShoveCache(Gear, Gear^.Boom, 40); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3547 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3548 |
DrawTunnel(HHGear^.X - HHGear^.dX * 10, |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3549 |
HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3550 |
HHGear^.dX, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3551 |
HHGear^.dY, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3552 |
20 + cHHRadius * 2, |
6130 | 3553 |
cHHRadius * 2 + 7); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3554 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3555 |
upd := 0 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3556 |
end; |
984 | 3557 |
|
14012 | 3558 |
inc(Gear^.Timer); |
3559 |
if (Gear^.Timer mod 100) = 0 then |
|
3560 |
RefillProximityCache(Gear, 300); |
|
3561 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3562 |
if Gear^.Health < Gear^.Damage then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3563 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
3564 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
6112
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3565 |
if hasWishes then |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3566 |
for i:= 0 to 31 do |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3567 |
begin |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3568 |
sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3569 |
if sparkles <> nil then |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3570 |
with sparkles^ do |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3571 |
begin |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3572 |
Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
3573 |
Angle:= random(360); |
6112
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3574 |
dx:= 0.001 * (random(200)); |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3575 |
dy:= 0.001 * (random(200)); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3576 |
if random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3577 |
dx := -dx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3578 |
if random(2) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3579 |
dy := -dy; |
6112
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3580 |
FrameTicks:= random(400) + 250 |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3581 |
end |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3582 |
end; |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
3583 |
s:= ansistring(Gear^.Hedgehog^.Name); |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
3584 |
AddCaption(FormatA(GetEventString(eidKamikaze), s), capcolDefault, capgrpMessage); |
12297
93434ab299a0
Take sacrifices into account for the “Stupid” taunt
Wuzzy <almikes@aol.com>
parents:
12282
diff
changeset
|
3585 |
uStats.HedgehogSacrificed(Gear^.Hedgehog); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3586 |
AfterAttack; |
7395 | 3587 |
HHGear^.Message:= HHGear^.Message or gmDestroy; |
14012 | 3588 |
ClearHitOrder(); |
3589 |
ClearProximityCache(); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3590 |
DeleteGear(Gear); |
12842 | 3591 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3592 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3593 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3594 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3595 |
Gear^.Damage := 0 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3596 |
end |
984 | 3597 |
end; |
3598 |
||
987 | 3599 |
procedure doStepKamikazeIdle(Gear: PGear); |
3600 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3601 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3602 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3603 |
if Gear^.Timer = 0 then |
5922 | 3604 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3605 |
Gear^.Pos := 1; |
7053 | 3606 |
PlaySoundV(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); |
14012 | 3607 |
ClearHitOrder(); |
3608 |
RefillProximityCache(Gear, 300); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3609 |
Gear^.doStep := @doStepKamikazeWork |
5922 | 3610 |
end |
987 | 3611 |
end; |
3612 |
||
984 | 3613 |
procedure doStepKamikaze(Gear: PGear); |
8795 | 3614 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3615 |
HHGear: PGear; |
984 | 3616 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3617 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3618 |
|
4365 | 3619 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3620 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3621 |
HHGear^.dX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3622 |
HHGear^.dY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3623 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3624 |
Gear^.dX := SignAs(_0_45, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3625 |
Gear^.dY := - _0_9; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3626 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3627 |
Gear^.Timer := 550; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3628 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3629 |
Gear^.doStep := @doStepKamikazeIdle |
984 | 3630 |
end; |
3631 |
||
1103 | 3632 |
//////////////////////////////////////////////////////////////////////////////// |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3633 |
|
1110 | 3634 |
procedure doStepCakeExpl(Gear: PGear); |
12750
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3635 |
var gi: PGear; |
1110 | 3636 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3637 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3638 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3639 |
inc(Gear^.Tag); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3640 |
if Gear^.Tag < 2250 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3641 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3642 |
|
11528 | 3643 |
InCinematicMode:= false; |
12750
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3644 |
gi := GearsList; |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3645 |
while gi <> nil do |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3646 |
begin |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3647 |
if gi^.Kind = gtHedgehog then |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3648 |
gi^.State := gi^.State and (not gstLoser); |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3649 |
gi:= gi^.NextGear; |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3650 |
end; |
c162995831d8
Fix cake party face not working across wrap world border
Wuzzy <Wuzzy2@mail.ru>
parents:
12749
diff
changeset
|
3651 |
|
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
3652 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3653 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3654 |
DeleteGear(Gear) |
1110 | 3655 |
end; |
3656 |
||
1109 | 3657 |
procedure doStepCakeDown(Gear: PGear); |
8795 | 3658 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3659 |
gi: PGear; |
11528 | 3660 |
dmg, dmgBase, partyEpicness, i: LongInt; |
12811 | 3661 |
fX, fY, tdX, tdY: hwFloat; |
11528 | 3662 |
sparkles: PVisualGear; |
1109 | 3663 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3664 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3665 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3666 |
inc(Gear^.Tag); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3667 |
if Gear^.Tag < 100 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3668 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3669 |
Gear^.Tag := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3670 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3671 |
if Gear^.Pos = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3672 |
begin |
6765 | 3673 |
///////////// adapted from doMakeExplosion /////////////////////////// |
3674 |
fX:= int2hwFloat(hwRound(Gear^.X)); |
|
3675 |
fY:= int2hwFloat(hwRound(Gear^.Y)); |
|
12751
e1395ba033e8
Use Gear^.Boom to calculate cake party faces
Wuzzy <Wuzzy2@mail.ru>
parents:
12750
diff
changeset
|
3676 |
dmgBase:= Gear^.Boom shl 1 + cHHRadius div 2; |
11528 | 3677 |
partyEpicness:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3678 |
gi := GearsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3679 |
while gi <> nil do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3680 |
begin |
6765 | 3681 |
if gi^.Kind = gtHedgehog then |
3682 |
begin |
|
3683 |
dmg:= 0; |
|
12811 | 3684 |
tdX:= gi^.X-fX; |
3685 |
tdY:= gi^.Y-fY; |
|
3686 |
if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
|
3687 |
dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius); |
|
12751
e1395ba033e8
Use Gear^.Boom to calculate cake party faces
Wuzzy <Wuzzy2@mail.ru>
parents:
12750
diff
changeset
|
3688 |
if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, Gear^.Boom), gi); |
6765 | 3689 |
if (dmg > 1) then |
10011
ead5e4b21671
Add check for gear kind of hedgehog on invulnerability effect. This probably fixes bug #766, is similar to change in previous r2a1483d91977 and was introduced by r7d925e82e572
nemo
parents:
9998
diff
changeset
|
3690 |
if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then |
11528 | 3691 |
begin |
3692 |
gi^.State := gi^.State or gstLoser; |
|
3693 |
// probably not too epic if hitting self too... |
|
3694 |
dec(partyEpicness, 45); |
|
3695 |
end |
|
6765 | 3696 |
else |
11528 | 3697 |
begin |
6765 | 3698 |
gi^.State := gi^.State or gstWinner; |
11528 | 3699 |
if CurrentHedgehog^.Gear = gi then |
3700 |
dec(partyEpicness, 45) |
|
3701 |
else |
|
3702 |
inc(partyEpicness); |
|
3703 |
end; |
|
6765 | 3704 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3705 |
gi := gi^.NextGear |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3706 |
end; |
6765 | 3707 |
////////////////////////////////////////////////////////////////////// |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3708 |
Gear^.doStep := @doStepCakeExpl; |
11535 | 3709 |
if (partyEpicness > 6) and (abs(90 - abs(trunc(Gear^.DirAngle))) < 20) then |
11528 | 3710 |
begin |
3711 |
for i := 0 to (2 * partyEpicness) do |
|
3712 |
begin |
|
3713 |
sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg, 1); |
|
3714 |
if sparkles <> nil then |
|
3715 |
begin |
|
3716 |
sparkles^.dX:= 0.008 * (random(100) - 50); |
|
3717 |
sparkles^.dY:= -0.3 + 0.002 * (random(100) - 50); |
|
3718 |
sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; |
|
3719 |
sparkles^.Angle:= random(360); |
|
3720 |
end |
|
3721 |
end; |
|
3722 |
InCinematicMode:= true; |
|
3723 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3724 |
PlaySound(sndCake) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3725 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3726 |
else dec(Gear^.Pos) |
1109 | 3727 |
end; |
3728 |
||
3729 |
||
11536 | 3730 |
procedure doStepCakeWalk(Gear: PGear); |
7370
d50b874e7ee8
Introduce uGearsHandlers.pas, for now only part of cake handlers is moved there
unc0rr
parents:
7341
diff
changeset
|
3731 |
var |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3732 |
tdx, tdy: hwFloat; |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3733 |
cakeData: PCakeData; |
13613
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3734 |
i: Longword; |
1088 | 3735 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3736 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3737 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3738 |
inc(Gear^.Tag); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3739 |
if Gear^.Tag < 7 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3740 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3741 |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3742 |
dec(Gear^.Health); |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3743 |
Gear^.Timer := Gear^.Health*10; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3744 |
if Gear^.Health mod 100 = 0 then |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3745 |
Gear^.PortalCounter:= 0; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3746 |
// This is not seconds, but at least it is *some* feedback |
12646
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3747 |
if (Gear^.Health <= 0) or ((Gear^.Message and gmAttack) <> 0) then |
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3748 |
begin |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3749 |
FollowGear := Gear; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3750 |
Gear^.RenderTimer := false; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3751 |
Gear^.doStep := @doStepCakeDown; |
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3752 |
exit |
10875 | 3753 |
end |
3754 |
else if Gear^.Timer < 6000 then |
|
3755 |
Gear^.RenderTimer:= true; |
|
7416
2f2f78fc65a3
AI uses cake! Known issues: AI could damage itself for no reason, could let cake go looping in a hole with exit closed by AI hog.
unc0rr
parents:
7408
diff
changeset
|
3756 |
|
9969 | 3757 |
if not cakeStep(Gear) then Gear^.doStep:= @doStepCakeFall; |
1103 | 3758 |
|
13619
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3759 |
// Cake passed world edge. |
13612
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3760 |
if (Gear^.Karma = 1) then |
13619
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3761 |
(* This code is not ideal, but at least not horribly broken. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3762 |
The cake tries to reach the other side and continue to walk, |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3763 |
but there are some exceptions. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3764 |
This code is called *after* the X coordinate have been wrapped. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3765 |
Depending on terrain on the other side, the cake does this: |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3766 |
* Cake collides horizontally (even by 1 pixel): Turn around |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3767 |
* Cake does not see walkable ground above or below: Fall |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3768 |
* Otherwise: Walk normally |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3769 |
*) |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3770 |
begin |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3771 |
// Update coordinates |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3772 |
tdx:=Gear^.X; |
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
3773 |
if (hwRound(Gear^.X) < leftX) then |
13619
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3774 |
Gear^.X:= Gear^.X + int2hwfloat(rightX - leftX) |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3775 |
else Gear^.X:= Gear^.X - int2hwfloat(rightX - leftX); |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3776 |
|
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3777 |
Gear^.Tag:= 0; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3778 |
if ((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0)) then |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3779 |
// Cake collided horizontally, turn around. Prevents cake from being stuck in infinite loop. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3780 |
// This can also happen if the terrain is just a slight slope. :-( |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3781 |
begin |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3782 |
Gear^.X := tdx; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3783 |
Gear^.Karma := 3; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3784 |
end |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3785 |
else |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3786 |
begin |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3787 |
// Check if cake has something to walk on the other side. If not, make it drop. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3788 |
// There is nothing for the cake to stand on. |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3789 |
if (TestCollisionYwithGear(Gear, 1) = 0) and (TestCollisionYwithGear(Gear, -1) = 0) then |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3790 |
Gear^.doStep:= @doStepCakeFall; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3791 |
Gear^.Karma := 4; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3792 |
end; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3793 |
end; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3794 |
// Cake bounced! |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3795 |
if (Gear^.Karma = 2) or (Gear^.Karma = 3) then |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3796 |
begin |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3797 |
// Turn cake around |
13612
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3798 |
Gear^.dX.isNegative := (not Gear^.dX.isNegative); |
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3799 |
Gear^.WDTimer := 0; |
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3800 |
Gear^.Angle := (LongInt(Gear^.Angle) + 2) and 3; |
13613
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3801 |
|
13614
13f68f3e7153
Add bounce effect to cake when it touches bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13613
diff
changeset
|
3802 |
// Bounce effect |
14579
6e5cda26f676
Tweak bounce effects of some gears
Wuzzy <Wuzzy2@mail.ru>
parents:
14577
diff
changeset
|
3803 |
if (Gear^.Karma = 2) then |
13614
13f68f3e7153
Add bounce effect to cake when it touches bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13613
diff
changeset
|
3804 |
AddBounceEffectForGear(Gear, 0.55); |
13f68f3e7153
Add bounce effect to cake when it touches bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13613
diff
changeset
|
3805 |
|
13619
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3806 |
Gear^.Tag:= 0; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3807 |
Gear^.Karma := 4; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3808 |
end; |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3809 |
if (Gear^.Karma = 4) then |
c9642782778b
Fix cake walking through land when reaching wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13618
diff
changeset
|
3810 |
begin |
13613
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3811 |
// Reset CakePoints to fix cake angle |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3812 |
cakeData:= PCakeData(Gear^.Data); |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3813 |
with cakeData^ do |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3814 |
begin |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3815 |
for i:= 0 to Pred(cakeh) do |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3816 |
begin |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3817 |
CakePoints[i].x := Gear^.X; |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3818 |
CakePoints[i].y := Gear^.Y; |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3819 |
end; |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3820 |
CakeI:= 0; |
92b87845beeb
Fix cake rotation angle after bounce from bounce edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13612
diff
changeset
|
3821 |
end; |
13612
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3822 |
Gear^.Karma := 0; |
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3823 |
end; |
212036414957
Make cake bounce off bounce edge, stop cake at wrap edge to prevent other bug
Wuzzy <Wuzzy2@mail.ru>
parents:
13610
diff
changeset
|
3824 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3825 |
if Gear^.Tag = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3826 |
begin |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3827 |
cakeData:= PCakeData(Gear^.Data); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3828 |
with cakeData^ do |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3829 |
begin |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3830 |
CakeI := (CakeI + 1) mod cakeh; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3831 |
tdx := CakePoints[CakeI].x - Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3832 |
tdy := - CakePoints[CakeI].y + Gear^.Y; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3833 |
CakePoints[CakeI].x := Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3834 |
CakePoints[CakeI].y := Gear^.Y; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3835 |
Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3836 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3837 |
end; |
1088 | 3838 |
end; |
1089 | 3839 |
|
1103 | 3840 |
procedure doStepCakeUp(Gear: PGear); |
8795 | 3841 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3842 |
i: Longword; |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3843 |
cakeData: PCakeData; |
1103 | 3844 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3845 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3846 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3847 |
inc(Gear^.Tag); |
12646
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3848 |
// Animation delay. Skipped if cake only dropped a very short distance. |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3849 |
if (Gear^.Tag < 100) and (Gear^.FlightTime > 1) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3850 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3851 |
Gear^.Tag := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3852 |
|
12646
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3853 |
if (Gear^.Pos = 6) or (Gear^.FlightTime <= 1) then |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3854 |
begin |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3855 |
Gear^.Pos := 6; |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3856 |
cakeData:= PCakeData(Gear^.Data); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3857 |
with cakeData^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3858 |
begin |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3859 |
for i:= 0 to Pred(cakeh) do |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3860 |
begin |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3861 |
CakePoints[i].x := Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3862 |
CakePoints[i].y := Gear^.Y |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3863 |
end; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3864 |
CakeI := 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3865 |
end; |
12646
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3866 |
(* This is called frequently if the cake is completely stuck. |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3867 |
With this a stuck cake takes equally long to explode then |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3868 |
a normal cake. Removing this code just makes the cake walking |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3869 |
for a few seconds longer. *) |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3870 |
if (Gear^.FlightTime <= 1) and (Gear^.Health > 2) then |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3871 |
dec(Gear^.Health); |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3872 |
Gear^.FlightTime := 0; |
11536 | 3873 |
Gear^.doStep := @doStepCakeWalk |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3874 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3875 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3876 |
inc(Gear^.Pos) |
1103 | 3877 |
end; |
3878 |
||
1089 | 3879 |
procedure doStepCakeFall(Gear: PGear); |
3880 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3881 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3882 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3883 |
Gear^.dY := Gear^.dY + cGravity; |
12646
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3884 |
// FlightTime remembers the drop time |
f30b70976577
Fix cake taking >200s to explode when it's completely stuck and can't move (bug 194)
Wuzzy <almikes@aol.com>
parents:
12626
diff
changeset
|
3885 |
inc(Gear^.FlightTime); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3886 |
if TestCollisionYwithGear(Gear, 1) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3887 |
Gear^.doStep := @doStepCakeUp |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3888 |
else |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
3889 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3890 |
Gear^.Y := Gear^.Y + Gear^.dY; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3891 |
if CheckGearDrowning(Gear) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3892 |
AfterAttack |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
3893 |
end |
1089 | 3894 |
end; |
3895 |
||
3896 |
procedure doStepCake(Gear: PGear); |
|
3897 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3898 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3899 |
|
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
3900 |
Gear^.CollisionMask:= lfNotCurHogCrate; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3901 |
|
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3902 |
Gear^.dY:= cMaxWindSpeed * 100; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3903 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3904 |
Gear^.doStep := @doStepCakeFall |
1089 | 3905 |
end; |
3906 |
||
1259 | 3907 |
//////////////////////////////////////////////////////////////////////////////// |
1284 | 3908 |
procedure doStepSeductionWork(Gear: PGear); |
5706 | 3909 |
var i: LongInt; |
7335 | 3910 |
hogs: PGearArrayS; |
13999
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3911 |
HHGear: PGear; |
1259 | 3912 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3913 |
AllInactive := false; |
13999
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3914 |
|
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3915 |
HHGear := Gear^.Hedgehog^.Gear; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3916 |
if (HHGear <> nil) and ((HHGear^.State and gstHHDriven) = 0) then |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3917 |
begin |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3918 |
StopSound(sndYoohoo); |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3919 |
AfterAttack; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3920 |
DeleteGear(Gear); |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3921 |
exit; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3922 |
end; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3923 |
|
5525 | 3924 |
hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); |
7335 | 3925 |
if hogs.size > 0 then |
3926 |
begin |
|
3927 |
for i:= 0 to hogs.size - 1 do |
|
3928 |
with hogs.ar^[i]^ do |
|
10544 | 3929 |
if (hogs.ar^[i] <> CurrentHedgehog^.Gear) and (Hedgehog^.Effects[heFrozen] = 0) then |
7335 | 3930 |
begin |
12748
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3931 |
if (WorldEdge <> weWrap) or (not (hwAbs(Gear^.X - X) > int2hwFloat(Gear^.Radius))) then |
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3932 |
dX:= _50 * cGravity * (Gear^.X - X) / _25 |
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3933 |
else if (not (hwAbs(Gear^.X + int2hwFloat(RightX-LeftX) - X) > int2hwFloat(Gear^.Radius))) then |
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3934 |
dX:= _50 * cGravity * ((Gear^.X + int2hwFloat(RightX-LeftX)) - X) / _25 |
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3935 |
else |
f45ffb4cf1e1
Make GearsNear and CheckGearNear check gears across wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
12742
diff
changeset
|
3936 |
dX:= _50 * cGravity * ((Gear^.X - int2hwFloat(RightX-LeftX)) - X) / _25; |
13063
004f4f7dc9d4
Enemy hogs should at least try to get to you in low gravity
nemo
parents:
12994
diff
changeset
|
3937 |
dY:= -_450 * cMaxWindSpeed * 2; |
7335 | 3938 |
Active:= true; |
3939 |
end |
|
10545 | 3940 |
else if Hedgehog^.Effects[heFrozen] > 255 then |
3941 |
Hedgehog^.Effects[heFrozen]:= 255 |
|
5525 | 3942 |
end ; |
13999
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3943 |
AfterAttack; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3944 |
DeleteGear(Gear); |
1286 | 3945 |
end; |
3946 |
||
3947 |
procedure doStepSeductionWear(Gear: PGear); |
|
5562 | 3948 |
var heart: PVisualGear; |
13999
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3949 |
HHGear: PGear; |
1286 | 3950 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3951 |
AllInactive := false; |
13999
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3952 |
|
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3953 |
HHGear := Gear^.Hedgehog^.Gear; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3954 |
if (HHGear <> nil) and ((HHGear^.State and gstHHDriven) = 0) then |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3955 |
begin |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3956 |
StopSound(sndYoohoo); |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3957 |
AfterAttack; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3958 |
DeleteGear(Gear); |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3959 |
exit; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3960 |
end; |
996ef4c5d064
Fix seduction not stopping if hog took damage before attack was complete
Wuzzy <Wuzzy2@mail.ru>
parents:
13990
diff
changeset
|
3961 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3962 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3963 |
if Gear^.Timer > 250 then |
5562 | 3964 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3965 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3966 |
inc(Gear^.Pos); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3967 |
if Gear^.Pos = 5 then |
11703
e86feecadced
Fix issue 12: “Yoohoo” sound for seduction is missing
sheepluva
parents:
11558
diff
changeset
|
3968 |
PlaySound(sndYoohoo); |
14825
183677a07c8d
Separate Yoohoo.ogg into "Yoohoo" voice and kiss sound
Wuzzy <Wuzzy2@mail.ru>
parents:
14766
diff
changeset
|
3969 |
if Gear^.Pos = 14 then |
183677a07c8d
Separate Yoohoo.ogg into "Yoohoo" voice and kiss sound
Wuzzy <Wuzzy2@mail.ru>
parents:
14766
diff
changeset
|
3970 |
PlaySound(sndKiss); |
5562 | 3971 |
end; |
3972 |
||
11863 | 3973 |
|
3974 |
// note: use GameTicks, not RealTicks, otherwise amount can vary greatly |
|
11865
0abbe6f1e4f2
increase heart count in seduction effect. FPS are overrated anyway
sheepluva
parents:
11863
diff
changeset
|
3975 |
if (Gear^.Pos = 14) and (GameTicks and $1 = 0) then |
5562 | 3976 |
begin |
3977 |
heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
|
6131 | 3978 |
if heart <> nil then |
5564
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
3979 |
with heart^ do |
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
3980 |
begin |
11863 | 3981 |
|
3982 |
// randomize speed in both directions |
|
3983 |
dx:= 0.001 * (random(201)); |
|
3984 |
dy:= 0.001 * (random(201)); |
|
3985 |
||
3986 |
// half of hearts go down |
|
3987 |
if random(2) = 0 then |
|
3988 |
begin |
|
3989 |
// create a pointy shape |
|
3990 |
if 0.2 < dx + dy then |
|
3991 |
begin |
|
3992 |
dy:= 0.2 - dy; |
|
3993 |
dx:= 0.2 - dx; |
|
3994 |
end; |
|
3995 |
// sin bulge it out a little to avoid corners on the side |
|
3996 |
dx:= dx + (dx/0.2) * ((0.2 * sin(pi * ((0.2 - dy) / 0.4))) - (0.2 - dy)); |
|
3997 |
// change sign |
|
3998 |
dy:= -dy; |
|
3999 |
end |
|
4000 |
else // shape hearts on top into 2 arcs |
|
4001 |
dy:= dy * (0.3 + 0.7 * sin(pi * dx / 0.2)); |
|
4002 |
||
4003 |
// half of the hearts go left |
|
4004 |
if random(2) = 0 then |
|
4005 |
dx := -dx; |
|
5564
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
4006 |
FrameTicks:= random(750) + 1000; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
4007 |
State:= ord(sprSeduction) |
5564
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
4008 |
end; |
5562 | 4009 |
end; |
4010 |
||
4011 |
if Gear^.Pos = 15 then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4012 |
Gear^.doStep := @doStepSeductionWork |
1259 | 4013 |
end; |
1284 | 4014 |
|
4015 |
procedure doStepSeduction(Gear: PGear); |
|
4016 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4017 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4018 |
Gear^.doStep := @doStepSeductionWear |
1284 | 4019 |
end; |
1298 | 4020 |
|
4021 |
//////////////////////////////////////////////////////////////////////////////// |
|
4022 |
procedure doStepWaterUp(Gear: PGear); |
|
8795 | 4023 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4024 |
i: LongWord; |
1298 | 4025 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4026 |
if (Gear^.Tag = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4027 |
or (cWaterLine = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4028 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4029 |
DeleteGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4030 |
exit |
4153
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
4031 |
end; |
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
4032 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4033 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4034 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4035 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4036 |
if Gear^.Timer = 17 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4037 |
Gear^.Timer := 0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4038 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4039 |
exit; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4040 |
|
10359 | 4041 |
if (WorldEdge = weSea) and (playWidth > cMinPlayWidth) then |
10354 | 4042 |
begin |
4043 |
inc(leftX); |
|
4044 |
dec(rightX); |
|
4045 |
dec(playWidth, 2); |
|
4046 |
for i:= 0 to LAND_HEIGHT - 1 do |
|
4047 |
begin |
|
4048 |
Land[i, leftX] := 0; |
|
4049 |
Land[i, rightX] := 0; |
|
4050 |
end; |
|
4051 |
end; |
|
4052 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4053 |
if cWaterLine > 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4054 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4055 |
dec(cWaterLine); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4056 |
for i:= 0 to LAND_WIDTH - 1 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4057 |
Land[cWaterLine, i] := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4058 |
SetAllToActive |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4059 |
end; |
1298 | 4060 |
|
4153
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
4061 |
dec(Gear^.Tag); |
1298 | 4062 |
end; |
1573 | 4063 |
|
4064 |
//////////////////////////////////////////////////////////////////////////////// |
|
1590 | 4065 |
procedure doStepDrillDrilling(Gear: PGear); |
8795 | 4066 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4067 |
t: PGearArray; |
8795 | 4068 |
tempColl: Word; |
1573 | 4069 |
begin |
13629
6a06904c7bb8
Fix drill rocket exploding when digging at bounce/wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13619
diff
changeset
|
4070 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4071 |
AllInactive := false; |
8822
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4072 |
if (Gear^.Timer > 0) and (Gear^.Timer mod 10 <> 0) then |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4073 |
begin |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4074 |
dec(Gear^.Timer); |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4075 |
exit; |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4076 |
end; |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4077 |
|
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4078 |
DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6); |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4079 |
Gear^.X := Gear^.X + Gear^.dX; |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4080 |
Gear^.Y := Gear^.Y + Gear^.dY; |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4081 |
if (Gear^.Timer mod 30) = 0 then |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4082 |
AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust); |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4083 |
if (CheckGearDrowning(Gear)) then |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4084 |
begin |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4085 |
StopSoundChan(Gear^.SoundChannel); |
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4086 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4087 |
end; |
8822
fc9877ff7f1a
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
nemo
parents:
8814
diff
changeset
|
4088 |
|
8564 | 4089 |
tempColl:= Gear^.CollisionMask; |
13469
7b4643ff60ea
Refactor collision mask checks, remove hardcoded numbers
Wuzzy <Wuzzy2@mail.ru>
parents:
13468
diff
changeset
|
4090 |
Gear^.CollisionMask:= lfObjMask; |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
4091 |
if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) <> 0) or (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) <> 0) or (GameTicks > Gear^.FlightTime) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4092 |
t := CheckGearsCollision(Gear) |
6532
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4093 |
else t := nil; |
8564 | 4094 |
Gear^.CollisionMask:= tempColl; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4095 |
//fixes drill not exploding when touching HH bug |
8795 | 4096 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4097 |
if (Gear^.Timer = 0) or ((t <> nil) and (t^.Count <> 0)) |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
4098 |
or ( ((Gear^.State and gsttmpFlag) = 0) and (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0)) |
3509
d72c2219595d
Make land types flagged (to allow stacking future attributes such as indestructible ice, but also for a damaged flag)
nemo
parents:
3505
diff
changeset
|
4099 |
// CheckLandValue returns true if the type isn't matched |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4100 |
or (not CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y), lfIndestructible)) then |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
4101 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4102 |
//out of time or exited ground |
7053 | 4103 |
StopSoundChan(Gear^.SoundChannel); |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
4104 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4105 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4106 |
exit |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
4107 |
end |
8795 | 4108 |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
4109 |
else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0) then |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
4110 |
begin |
7053 | 4111 |
StopSoundChan(Gear^.SoundChannel); |
4867
e604ee83e34f
let players set timer of drill strike. yes. drill strike :3 the timer starts to tick on first impact
sheepluva
parents:
4837
diff
changeset
|
4112 |
Gear^.Tag := 1; |
10895
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset
|
4113 |
Gear^.AdvBounce:= 50; |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
4114 |
Gear^.doStep := @doStepDrill |
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
4115 |
end; |
1590 | 4116 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4117 |
dec(Gear^.Timer); |
1573 | 4118 |
end; |
4119 |
||
4120 |
procedure doStepDrill(Gear: PGear); |
|
8795 | 4121 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4122 |
t: PGearArray; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4123 |
oldX, oldY, oldDx, oldDy: hwFloat; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4124 |
t2: hwFloat; |
1573 | 4125 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4126 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4127 |
|
11396 | 4128 |
if (Gear^.State and gsttmpFlag = 0) and (GameFlags and gfMoreWind = 0) then |
4293
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
4129 |
Gear^.dX := Gear^.dX + cWindSpeed; |
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
4130 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4131 |
oldDx := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4132 |
oldDy := Gear^.dY; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4133 |
oldX := Gear^.X; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4134 |
oldY := Gear^.Y; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4135 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4136 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4137 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4138 |
if (GameTicks and $3F) = 0 then |
10352 | 4139 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4140 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4141 |
if ((Gear^.State and gstCollision) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4142 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4143 |
//hit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4144 |
Gear^.dX := oldDx; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4145 |
Gear^.dY := oldDy; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4146 |
Gear^.X := oldX; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4147 |
Gear^.Y := oldY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4148 |
|
8795 | 4149 |
if GameTicks > Gear^.FlightTime then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4150 |
t := CheckGearsCollision(Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4151 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4152 |
t := nil; |
6532
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4153 |
if (t = nil) or (t^.Count = 0) then |
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4154 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4155 |
//hit the ground not the HH |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4156 |
t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4157 |
Gear^.dX := Gear^.dX * t2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4158 |
Gear^.dY := Gear^.dY * t2; |
6532
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4159 |
end |
8795 | 4160 |
|
6532
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4161 |
else if (t <> nil) then |
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4162 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4163 |
//explode right on contact with HH |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
4164 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4165 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4166 |
exit; |
6532
76d63e00002f
Little tweak to reduce noob fail. Delay drill rocket explosion by 250ms after spawn in Attack. Unless you drop it straight down w/ no power, it should not explode immediately in your face.
nemo
parents:
6507
diff
changeset
|
4167 |
end; |
2376 | 4168 |
|
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4169 |
Gear^.X:= Gear^.X+Gear^.dX*4; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
4170 |
Gear^.Y:= Gear^.Y+Gear^.dY*4; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4171 |
Gear^.SoundChannel := LoopSound(sndDrillRocket); |
15043 | 4172 |
Gear^.Pos:= 1; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4173 |
Gear^.doStep := @doStepDrillDrilling; |
8795 | 4174 |
|
4867
e604ee83e34f
let players set timer of drill strike. yes. drill strike :3 the timer starts to tick on first impact
sheepluva
parents:
4837
diff
changeset
|
4175 |
if (Gear^.State and gsttmpFlag) <> 0 then |
e604ee83e34f
let players set timer of drill strike. yes. drill strike :3 the timer starts to tick on first impact
sheepluva
parents:
4837
diff
changeset
|
4176 |
gear^.RenderTimer:= true; |
6761 | 4177 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4178 |
end |
6761 | 4179 |
else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then |
4180 |
begin |
|
8795 | 4181 |
if Gear^.Timer > 0 then |
7325 | 4182 |
dec(Gear^.Timer) |
4183 |
else |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4184 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
4185 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
6761 | 4186 |
DeleteGear(Gear); |
4187 |
end |
|
4188 |
end; |
|
1590 | 4189 |
end; |
1601 | 4190 |
|
1633 | 4191 |
//////////////////////////////////////////////////////////////////////////////// |
1601 | 4192 |
procedure doStepBallgunWork(Gear: PGear); |
8795 | 4193 |
var |
7296 | 4194 |
HHGear, ball: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4195 |
rx, ry: hwFloat; |
3143 | 4196 |
gX, gY: LongInt; |
1601 | 4197 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4198 |
AllInactive := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4199 |
dec(Gear^.Timer); |
4365 | 4200 |
HHGear := Gear^.Hedgehog^.Gear; |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4201 |
if HHGear = nil then |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4202 |
begin |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4203 |
DeleteGear(gear); |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4204 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4205 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4206 |
HedgehogChAngle(HHGear); |
3484 | 4207 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
4208 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4209 |
if (Gear^.Timer mod 100) = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4210 |
begin |
7001 | 4211 |
rx := rndSign(getRandomf * _0_1); |
4212 |
ry := rndSign(getRandomf * _0_1); |
|
2376 | 4213 |
|
7296 | 4214 |
ball:= AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
4215 |
ball^.CollisionMask:= lfNotCurHogCrate; |
2376 | 4216 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4217 |
PlaySound(sndGun); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4218 |
end; |
1601 | 4219 |
|
7195
9e6e8e5a4c2e
Check for gstHHDriven instead of damage check, so ballgun stops when turn ends in multiattack mode
unc0rr
parents:
7170
diff
changeset
|
4220 |
if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4221 |
begin |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4222 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4223 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4224 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4225 |
end |
1601 | 4226 |
end; |
4227 |
||
4228 |
procedure doStepBallgun(Gear: PGear); |
|
8795 | 4229 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4230 |
HHGear: PGear; |
1601 | 4231 |
begin |
4365 | 4232 |
HHGear := Gear^.Hedgehog^.Gear; |
6450 | 4233 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4234 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4235 |
Gear^.doStep := @doStepBallgunWork |
1633 | 4236 |
end; |
1689 | 4237 |
|
1696 | 4238 |
//////////////////////////////////////////////////////////////////////////////// |
1689 | 4239 |
procedure doStepRCPlaneWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4240 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4241 |
const cAngleSpeed = 3; |
8795 | 4242 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4243 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4244 |
i: LongInt; |
12994
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4245 |
s: ansistring; |
10110
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
4246 |
dX, dY : hwFloat; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4247 |
fChanged: boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4248 |
trueAngle: Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
4249 |
t: PGear; |
1689 | 4250 |
begin |
10110
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
4251 |
if WorldWrap(Gear) then |
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
4252 |
begin |
10112
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4253 |
if (WorldEdge = weBounce) then // mirror |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4254 |
Gear^.Angle:= 4096 - Gear^.Angle |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4255 |
else if (WorldEdge = weSea) then // rotate 90 degree |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4256 |
begin |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4257 |
// sea-wrapped gears move upwards, so let's mirror angle if needed |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4258 |
if Gear^.Angle < 2048 then |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4259 |
Gear^.Angle:= 4096 - Gear^.Angle; |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4260 |
Gear^.Angle:= (Gear^.Angle + 1024) mod 4096; |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
4261 |
end; |
9477 | 4262 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4263 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4264 |
|
4365 | 4265 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4266 |
FollowGear := Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4267 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4268 |
if Gear^.Timer > 0 then |
11152
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4269 |
begin |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4270 |
if Gear^.Timer = 1 then |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4271 |
begin |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4272 |
StopSoundChan(Gear^.SoundChannel); |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4273 |
Gear^.SoundChannel:= -1; |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4274 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4275 |
dec(Gear^.Timer); |
11152
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
4276 |
end; |
4886 | 4277 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4278 |
fChanged := false; |
9559 | 4279 |
if (HHGear = nil) or ((HHGear^.State and gstHHDriven) = 0) or (Gear^.Timer = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4280 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4281 |
fChanged := true; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4282 |
if Gear^.Angle > 2048 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4283 |
dec(Gear^.Angle) |
6785 | 4284 |
else if Gear^.Angle < 2048 then |
4285 |
inc(Gear^.Angle) |
|
4286 |
else fChanged := false |
|
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4287 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4288 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4289 |
begin |
3894 | 4290 |
if ((Gear^.Message and gmLeft) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4291 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4292 |
fChanged := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4293 |
Gear^.Angle := (Gear^.Angle + (4096 - cAngleSpeed)) mod 4096 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4294 |
end; |
1689 | 4295 |
|
3894 | 4296 |
if ((Gear^.Message and gmRight) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4297 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4298 |
fChanged := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4299 |
Gear^.Angle := (Gear^.Angle + cAngleSpeed) mod 4096 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4300 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4301 |
end; |
1689 | 4302 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4303 |
if fChanged then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4304 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4305 |
Gear^.dX.isNegative := (Gear^.Angle > 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4306 |
if Gear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4307 |
trueAngle := 4096 - Gear^.Angle |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4308 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4309 |
trueAngle := Gear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4310 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4311 |
Gear^.dX := SignAs(AngleSin(trueAngle), Gear^.dX) * _0_25; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4312 |
Gear^.dY := AngleCos(trueAngle) * -_0_25; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4313 |
end; |
1689 | 4314 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4315 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4316 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4317 |
|
4808 | 4318 |
if (GameTicks and $FF) = 0 then |
4319 |
if Gear^.Timer < 3500 then |
|
4320 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace) |
|
4321 |
else |
|
4322 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
|
4323 |
||
12994
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4324 |
if (HHGear <> nil) and ((HHGear^.Message and gmAttack) <> 0) then |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4325 |
begin |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4326 |
if (Gear^.Health) <> 0 then |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4327 |
begin |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4328 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4329 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY * |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4330 |
_0_5, 0); |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4331 |
dec(Gear^.Health) |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4332 |
end; |
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4333 |
s:= ansistring(inttostr(Gear^.Health)); |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
4334 |
AddCaption(formatA(trmsg[sidRemaining], s), capcolDefault, capgrpAmmostate); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4335 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4336 |
|
9559 | 4337 |
if (HHGear <> nil) and ((HHGear^.Message and gmLJump) <> 0) and ((Gear^.State and gsttmpFlag) = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4338 |
begin |
4808 | 4339 |
Gear^.State := Gear^.State or gsttmpFlag; |
13980
350adfa0e896
Refactor usage of sndRideOfTheValkyries, now can play if music is on and sound is off
Wuzzy <Wuzzy2@mail.ru>
parents:
13979
diff
changeset
|
4340 |
PlayMusicSound(sndRideOfTheValkyries); |
11524
aab4767d9a50
adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
sheepluva
parents:
11480
diff
changeset
|
4341 |
inCinematicMode:= true; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4342 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4343 |
|
4808 | 4344 |
// pickup bonuses |
4345 |
t := CheckGearNear(Gear, gtCase, 36, 36); |
|
10234 | 4346 |
if (t <> nil) and (HHGear <> nil) then |
4808 | 4347 |
PickUp(HHGear, t); |
4348 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4349 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4350 |
|
4808 | 4351 |
if ((Gear^.State and gstCollision) <> 0) or CheckGearDrowning(Gear) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4352 |
begin |
11524
aab4767d9a50
adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
sheepluva
parents:
11480
diff
changeset
|
4353 |
inCinematicMode:= false; |
7053 | 4354 |
StopSoundChan(Gear^.SoundChannel); |
13980
350adfa0e896
Refactor usage of sndRideOfTheValkyries, now can play if music is on and sound is off
Wuzzy <Wuzzy2@mail.ru>
parents:
13979
diff
changeset
|
4355 |
StopMusicSound(sndRideOfTheValkyries); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4356 |
|
4808 | 4357 |
if ((Gear^.State and gstCollision) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4358 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
4359 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
5228 | 4360 |
for i:= 0 to 15 do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4361 |
begin |
7001 | 4362 |
dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1); |
4363 |
dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4364 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4365 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4366 |
end; |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
4367 |
if HHGear <> nil then HHGear^.State := HHGear^.State and (not gstNotKickable); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4368 |
DeleteGear(Gear) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4369 |
end; |
1713 | 4370 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4371 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4372 |
CurAmmoGear := nil; |
5016
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
4373 |
if (GameFlags and gfInfAttack) = 0 then |
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
4374 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4375 |
if TagTurnTimeLeft = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4376 |
TagTurnTimeLeft:= TurnTimeLeft; |
8795 | 4377 |
|
5016
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
4378 |
TurnTimeLeft:= 14 * 125; |
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
4379 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4380 |
|
10510 | 4381 |
if HHGear <> nil then |
12820
92218a06c9ff
Don't send taunt message for automatically happening taunt animation
unc0rr
parents:
12811
diff
changeset
|
4382 |
begin |
10234 | 4383 |
HHGear^.Message := 0; |
12820
92218a06c9ff
Don't send taunt message for automatically happening taunt animation
unc0rr
parents:
12811
diff
changeset
|
4384 |
PlayTaunt(1) |
92218a06c9ff
Don't send taunt message for automatically happening taunt animation
unc0rr
parents:
12811
diff
changeset
|
4385 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4386 |
end |
1689 | 4387 |
end; |
4388 |
||
4389 |
procedure doStepRCPlane(Gear: PGear); |
|
8795 | 4390 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4391 |
HHGear: PGear; |
1689 | 4392 |
begin |
4365 | 4393 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4394 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4395 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4396 |
Gear^.Angle := HHGear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4397 |
Gear^.Tag := hwSign(HHGear^.dX); |
8795 | 4398 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4399 |
if HHGear^.dX.isNegative then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4400 |
Gear^.Angle := 4096 - Gear^.Angle; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4401 |
Gear^.doStep := @doStepRCPlaneWork |
1712 | 4402 |
end; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4403 |
|
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
4404 |
//////////////////////////////////////////////////////////////////////////////// |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4405 |
procedure doStepJetpackWork(Gear: PGear); |
8795 | 4406 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4407 |
HHGear: PGear; |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4408 |
fuel, i: LongInt; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4409 |
move: hwFloat; |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4410 |
isUnderwater: Boolean; |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4411 |
bubble: PVisualGear; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4412 |
begin |
10354 | 4413 |
isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4414 |
if Gear^.Pos > 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4415 |
dec(Gear^.Pos); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4416 |
AllInactive := false; |
4365 | 4417 |
HHGear := Gear^.Hedgehog^.Gear; |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4418 |
move := _0_2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4419 |
fuel := 50; |
8987
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4420 |
if HHGear^.Message and gmPrecise <> 0 then |
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4421 |
HedgehogChAngle(HHGear) |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4422 |
else if (Gear^.Health > 0) or (Gear^.Health = JETPACK_FUEL_INFINITE) then |
8987
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4423 |
begin |
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4424 |
if HHGear^.Message and gmUp <> 0 then |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4425 |
begin |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4426 |
if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4427 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4428 |
if isUnderwater then |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4429 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4430 |
HHGear^.dY := HHGear^.dY - (move * _0_7); |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4431 |
for i:= random(10)+10 downto 0 do |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4432 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4433 |
bubble := AddVisualGear(hwRound(HHGear^.X) - 8 + random(16), hwRound(HHGear^.Y) + 16 + random(8), vgtBubble); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4434 |
if bubble <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4435 |
bubble^.dY:= random(20)/10+0.1; |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4436 |
end |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4437 |
end |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4438 |
else |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4439 |
begin |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4440 |
PlaySound(sndJetpackBoost); |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4441 |
HHGear^.dY := HHGear^.dY - move; |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4442 |
end |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4443 |
end; |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4444 |
if Gear^.Health <> JETPACK_FUEL_INFINITE then |
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4445 |
dec(Gear^.Health, fuel); |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4446 |
Gear^.MsgParam := Gear^.MsgParam or gmUp; |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4447 |
Gear^.Timer := GameTicks |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4448 |
end; |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4449 |
move.isNegative := (HHGear^.Message and gmLeft) <> 0; |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4450 |
if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4451 |
begin |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4452 |
HHGear^.dX := HHGear^.dX + (move * _0_1); |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4453 |
if isUnderwater then |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4454 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4455 |
for i:= random(5)+5 downto 0 do |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4456 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4457 |
bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble); |
6131 | 4458 |
if bubble <> nil then |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4459 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4460 |
bubble^.dX:= (random(10)/10 + 0.02) * -1; |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4461 |
if (move.isNegative) then |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4462 |
begin |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4463 |
bubble^.X := bubble^.X + 28; |
4187 | 4464 |
bubble^.dX:= bubble^.dX * (-1) |
3909
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4465 |
end |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4466 |
else bubble^.X := bubble^.X - 28; |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4467 |
end; |
4ba25a3d15af
remove windspeed from bubbles, remove initial dY from bubbles, apply dY/dX to bubbles, correct offsets on flying saucer flame graphics, add bubbles when flying saucer thrusts underwater, make flying saucer sink more slowly underwater
nemo
parents:
3907
diff
changeset
|
4468 |
end |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4469 |
end |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4470 |
else PlaySound(sndJetpackBoost); |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4471 |
if Gear^.Health <> JETPACK_FUEL_INFINITE then |
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4472 |
dec(Gear^.Health, fuel div 5); |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4473 |
Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight)); |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4474 |
Gear^.Timer := GameTicks |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4475 |
end |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4476 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
4477 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4478 |
// erases them all at once :-/ |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4479 |
if (Gear^.Timer <> 0) and (GameTicks - Gear^.Timer > 250) then |
4262
154253f77b03
ok... combine a tick check with texture percentage check. this should be a lot less frequent
nemo
parents:
4260
diff
changeset
|
4480 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4481 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4482 |
Gear^.MsgParam := 0 |
4262
154253f77b03
ok... combine a tick check with texture percentage check. this should be a lot less frequent
nemo
parents:
4260
diff
changeset
|
4483 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4484 |
|
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4485 |
if (Gear^.Health < 0) and (Gear^.Health <> JETPACK_FUEL_INFINITE) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4486 |
Gear^.Health := 0; |
8795 | 4487 |
|
4260
472fd2fc1f31
Also switch saucer from updating every N ticks to updating as-needed.
nemo
parents:
4258
diff
changeset
|
4488 |
i:= Gear^.Health div 20; |
8795 | 4489 |
|
4262
154253f77b03
ok... combine a tick check with texture percentage check. this should be a lot less frequent
nemo
parents:
4260
diff
changeset
|
4490 |
if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4491 |
begin |
4260
472fd2fc1f31
Also switch saucer from updating every N ticks to updating as-needed.
nemo
parents:
4258
diff
changeset
|
4492 |
Gear^.Damage:= i; |
10634
35d059bd0932
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents:
10597
diff
changeset
|
4493 |
FreeAndNilTexture(Gear^.Tex); |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4494 |
if Gear^.Health <> JETPACK_FUEL_INFINITE then |
13882 | 4495 |
Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))), cWhiteColor, fntSmall) |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4496 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
4497 |
|
8987
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4498 |
if (HHGear^.Message and (gmAttack or gmUp or gmLeft or gmRight) <> 0) and |
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4499 |
(HHGear^.Message and gmPrecise = 0) then |
6450 | 4500 |
Gear^.State := Gear^.State and (not gsttmpFlag); |
8795 | 4501 |
|
8987
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4502 |
if HHGear^.Message and gmPrecise = 0 then |
47cf32305d99
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
nemo
parents:
8973
diff
changeset
|
4503 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmLeft or gmRight)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4504 |
HHGear^.State := HHGear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4505 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4506 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4507 |
Gear^.Y := HHGear^.Y; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4508 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4509 |
if not isUnderWater and hasBorder and ((HHGear^.X < _0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4510 |
or (hwRound(HHGear^.X) > LAND_WIDTH)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4511 |
HHGear^.dY.isNegative:= false; |
8795 | 4512 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4513 |
if ((Gear^.State and gsttmpFlag) = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4514 |
or (HHGear^.dY < _0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4515 |
doStepHedgehogMoving(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4516 |
|
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
4517 |
if |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4518 |
(HHGear^.Damage <> 0) |
10354 | 4519 |
// drown if too deep under water |
8990 | 4520 |
or (cWaterLine + cVisibleWater * 4 < hwRound(HHGear^.Y)) |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4521 |
or (TurnTimeLeft = 0) |
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4522 |
// allow brief ground touches - to be fair on this, might need another counter |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
4523 |
or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and (TestCollisionYwithGear(HHGear, 1) <> 0)) |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4524 |
or ((Gear^.Message and gmAttack) <> 0) then |
4233
b4ad20bfe310
make weapons on rope/parachute/UFO inherit momentum of the hog. needs testing of course
nemo
parents:
4224
diff
changeset
|
4525 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4526 |
with HHGear^ do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4527 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4528 |
Message := 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4529 |
Active := true; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4530 |
State := State or gstMoving |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4531 |
end; |
13961
2568fa516733
Fix hog can drop more than 2 s. mines if first one was dropped from utility, then stop using that utility
Wuzzy <Wuzzy2@mail.ru>
parents:
13882
diff
changeset
|
4532 |
if (GetAmmoEntry(HHGear^.Hedgehog^, amJetpack)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and (HHGear^.Hedgehog^.MultiShootAttacks = 0) then |
12825
4c1c468725ff
Fix desync when dropping weapon from parachute or jetpack
Wuzzy <Wuzzy2@mail.ru>
parents:
12820
diff
changeset
|
4533 |
HHGear^.Hedgehog^.CurAmmoType:= amJetpack; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4534 |
isCursorVisible := false; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4535 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
14559 | 4536 |
DeleteGear(Gear); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4537 |
end |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4538 |
end; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4539 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4540 |
procedure doStepJetpack(Gear: PGear); |
8795 | 4541 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4542 |
HHGear: PGear; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4543 |
begin |
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset
|
4544 |
Gear^.Pos:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4545 |
Gear^.doStep := @doStepJetpackWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4546 |
|
4365 | 4547 |
HHGear := Gear^.Hedgehog^.Gear; |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4548 |
|
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4549 |
PlaySound(sndJetpackLaunch); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4550 |
FollowGear := HHGear; |
3965
09eea558ba83
Call OnUsedAmmo *after* doing the normal CurAmmoType stuff so CurAmmoType actually points to the right bloody weapon
nemo
parents:
3963
diff
changeset
|
4551 |
AfterAttack; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4552 |
with HHGear^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4553 |
begin |
6450 | 4554 |
State := State and (not gstAttacking); |
4555 |
Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)); |
|
8795 | 4556 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4557 |
if (dY < _0_1) and (dY > -_0_1) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4558 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4559 |
Gear^.State := Gear^.State or gsttmpFlag; |
13286 | 4560 |
dX := SignAs(_0, dX); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4561 |
dY := dY - _0_2 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4562 |
end |
2301 | 4563 |
end |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
4564 |
end; |
2983 | 4565 |
|
4566 |
//////////////////////////////////////////////////////////////////////////////// |
|
3149 | 4567 |
procedure doStepBirdyDisappear(Gear: PGear); |
2983 | 4568 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4569 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4570 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4571 |
if Gear^.Timer < 2000 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4572 |
inc(Gear^.Timer, 1) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4573 |
else |
14559 | 4574 |
DeleteGear(Gear) |
2983 | 4575 |
end; |
4576 |
||
4577 |
procedure doStepBirdyFly(Gear: PGear); |
|
8795 | 4578 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4579 |
HHGear: PGear; |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4580 |
energy, i: LongInt; |
2983 | 4581 |
move: hwFloat; |
12994
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4582 |
s: ansistring; |
2983 | 4583 |
begin |
6154 | 4584 |
HHGear := Gear^.Hedgehog^.Gear; |
8795 | 4585 |
if HHGear = nil then |
6154 | 4586 |
begin |
9698 | 4587 |
Gear^.Timer := 0; |
4588 |
Gear^.State := Gear^.State or gstAnimation or gstTmpFlag; |
|
4589 |
Gear^.Timer := 0; |
|
4590 |
Gear^.doStep := @doStepBirdyDisappear; |
|
4591 |
CurAmmoGear := nil; |
|
4592 |
isCursorVisible := false; |
|
4593 |
AfterAttack; |
|
6154 | 4594 |
exit |
4595 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4596 |
|
3915
c05855146440
Correct bug in flight ceiling for birdy as well, increase clip on velocity to 1.9 (shouldn't cause problems with most collision checks still), apply clip to both + and -
nemo
parents:
3909
diff
changeset
|
4597 |
move := _0_2; |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4598 |
energy:= 50; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4599 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4600 |
if Gear^.Pos > 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4601 |
dec(Gear^.Pos, 1) |
3894 | 4602 |
else if (HHGear^.Message and (gmLeft or gmRight or gmUp)) <> 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4603 |
Gear^.Pos := 500; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4604 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4605 |
if HHGear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4606 |
Gear^.Tag := -1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4607 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4608 |
Gear^.Tag := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4609 |
|
3894 | 4610 |
if (HHGear^.Message and gmUp) <> 0 then |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4611 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4612 |
if (not HHGear^.dY.isNegative) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4613 |
or (HHGear^.Y > -_256) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4614 |
HHGear^.dY := HHGear^.dY - move; |
8795 | 4615 |
|
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4616 |
if (Gear^.Health <> BIRDY_ENERGY_INFINITE) then |
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4617 |
dec(Gear^.Health, energy); |
3894 | 4618 |
Gear^.MsgParam := Gear^.MsgParam or gmUp; |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4619 |
end; |
8795 | 4620 |
|
3894 | 4621 |
if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true; |
4622 |
if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then |
|
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4623 |
begin |
3915
c05855146440
Correct bug in flight ceiling for birdy as well, increase clip on velocity to 1.9 (shouldn't cause problems with most collision checks still), apply clip to both + and -
nemo
parents:
3909
diff
changeset
|
4624 |
HHGear^.dX := HHGear^.dX + (move * _0_1); |
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4625 |
if (Gear^.Health <> BIRDY_ENERGY_INFINITE) then |
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4626 |
dec(Gear^.Health, energy div 5); |
3894 | 4627 |
Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight)); |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4628 |
end; |
2983 | 4629 |
|
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4630 |
if (Gear^.Health < 0) and (Gear^.Health <> BIRDY_ENERGY_INFINITE) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4631 |
Gear^.Health := 0; |
8795 | 4632 |
|
13598
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13577
diff
changeset
|
4633 |
if ((GameTicks and $FF) = 0) and (Gear^.Health < 500) and (Gear^.Health <> BIRDY_ENERGY_INFINITE) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4634 |
for i:= ((500-Gear^.Health) div 250) downto 0 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4635 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4636 |
|
3894 | 4637 |
if (HHGear^.Message and gmAttack <> 0) then |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4638 |
begin |
6450 | 4639 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4640 |
if Gear^.FlightTime > 0 then |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4641 |
begin |
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4642 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + 32, gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0); |
3123 | 4643 |
PlaySound(sndBirdyLay); |
3115 | 4644 |
dec(Gear^.FlightTime) |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4645 |
end; |
12994
c08c53624c0f
Show remaining ammo when using Birdy egg or RC Plane bomb
Wuzzy <Wuzzy2@mail.ru>
parents:
12919
diff
changeset
|
4646 |
s:= ansistring(inttostr(Gear^.FlightTime)); |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
4647 |
AddCaption(formatA(trmsg[sidRemaining], s), capcolDefault, capgrpAmmostate); |
3115 | 4648 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4649 |
|
6131 | 4650 |
if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then |
6450 | 4651 |
Gear^.State := Gear^.State and (not gsttmpFlag); |
8795 | 4652 |
|
6450 | 4653 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4654 |
HHGear^.State := HHGear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4655 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4656 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4657 |
Gear^.Y := HHGear^.Y - int2hwFloat(32); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4658 |
// For some reason I need to reapply followgear here, something else grabs it otherwise. |
6325
cdd3d8c723ec
Update changelog, comment on possibly redundant lines in GSHandlers
nemo
parents:
6314
diff
changeset
|
4659 |
// this is probably not needed anymore |
cdd3d8c723ec
Update changelog, comment on possibly redundant lines in GSHandlers
nemo
parents:
6314
diff
changeset
|
4660 |
if not CurrentTeam^.ExtDriven then FollowGear := HHGear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4661 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4662 |
if ((Gear^.State and gsttmpFlag) = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4663 |
or (HHGear^.dY < _0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4664 |
doStepHedgehogMoving(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4665 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4666 |
if (Gear^.Health = 0) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4667 |
or (HHGear^.Damage <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4668 |
or CheckGearDrowning(HHGear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4669 |
or (TurnTimeLeft = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4670 |
// allow brief ground touches - to be fair on this, might need another counter |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4671 |
or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and (TestCollisionYwithGear(HHGear, 1) <> 0)) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4672 |
or ((Gear^.Message and gmAttack) <> 0) then |
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset
|
4673 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4674 |
with HHGear^ do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4675 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4676 |
Message := 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4677 |
Active := true; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4678 |
State := State or gstMoving |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4679 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4680 |
Gear^.State := Gear^.State or gstAnimation or gstTmpFlag; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4681 |
if HHGear^.dY < _0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4682 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4683 |
Gear^.dX := HHGear^.dX; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4684 |
Gear^.dY := HHGear^.dY; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4685 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4686 |
Gear^.Timer := 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4687 |
Gear^.doStep := @doStepBirdyDisappear; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4688 |
CurAmmoGear := nil; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4689 |
isCursorVisible := false; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4690 |
AfterAttack; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4691 |
end |
2983 | 4692 |
end; |
4693 |
||
4694 |
procedure doStepBirdyDescend(Gear: PGear); |
|
8795 | 4695 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4696 |
HHGear: PGear; |
2983 | 4697 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4698 |
if Gear^.Timer > 0 then |
9698 | 4699 |
dec(Gear^.Timer, 1); |
4700 |
||
4701 |
HHGear := Gear^.Hedgehog^.Gear; |
|
12649
59b46e6f36ff
Fix Birdy descending into water if hog took damage before it got picked up (bug 160)
Wuzzy <almikes@aol.com>
parents:
12646
diff
changeset
|
4702 |
if (HHGear = nil) or ((HHGear^.State and gstHHDriven) = 0) then |
59b46e6f36ff
Fix Birdy descending into water if hog took damage before it got picked up (bug 160)
Wuzzy <almikes@aol.com>
parents:
12646
diff
changeset
|
4703 |
begin |
59b46e6f36ff
Fix Birdy descending into water if hog took damage before it got picked up (bug 160)
Wuzzy <almikes@aol.com>
parents:
12646
diff
changeset
|
4704 |
Gear^.Hedgehog := nil; |
9698 | 4705 |
Gear^.Timer := 0; |
4706 |
Gear^.State := Gear^.State or gstAnimation or gstTmpFlag; |
|
4707 |
Gear^.doStep := @doStepBirdyDisappear; |
|
4708 |
CurAmmoGear := nil; |
|
4709 |
isCursorVisible := false; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4710 |
AfterAttack; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4711 |
exit |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4712 |
end; |
9698 | 4713 |
|
6450 | 4714 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4715 |
if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4716 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4717 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4718 |
Gear^.Y := Gear^.Y + _0_1 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4719 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4720 |
else if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4721 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4722 |
Gear^.doStep := @doStepBirdyFly; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4723 |
HHGear^.dY := -_0_2 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4724 |
end |
2983 | 4725 |
end; |
4726 |
||
3149 | 4727 |
procedure doStepBirdyAppear(Gear: PGear); |
4728 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4729 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4730 |
if Gear^.Timer < 2000 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4731 |
inc(Gear^.Timer, 1) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4732 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4733 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4734 |
Gear^.Timer := 500; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4735 |
Gear^.dX := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4736 |
Gear^.dY := _0; |
6450 | 4737 |
Gear^.State := Gear^.State and (not gstAnimation); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4738 |
Gear^.doStep := @doStepBirdyDescend; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4739 |
end |
3149 | 4740 |
end; |
4741 |
||
2983 | 4742 |
procedure doStepBirdy(Gear: PGear); |
8795 | 4743 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4744 |
HHGear: PGear; |
2983 | 4745 |
begin |
6450 | 4746 |
gear^.State := gear^.State or gstAnimation and (not gstTmpFlag); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4747 |
Gear^.doStep := @doStepBirdyAppear; |
8795 | 4748 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4749 |
if CurrentHedgehog = nil then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4750 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4751 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4752 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4753 |
end; |
2995 | 4754 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4755 |
HHGear := CurrentHedgehog^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4756 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4757 |
if HHGear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4758 |
Gear^.Tag := -1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4759 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4760 |
Gear^.Tag := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4761 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4762 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4763 |
FollowGear := HHGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4764 |
with HHGear^ do |
5706 | 4765 |
begin |
6450 | 4766 |
State := State and (not gstAttacking); |
4767 |
Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)) |
|
5706 | 4768 |
end |
2983 | 4769 |
end; |
3032 | 4770 |
|
4771 |
//////////////////////////////////////////////////////////////////////////////// |
|
3065 | 4772 |
procedure doStepEggWork(Gear: PGear); |
8795 | 4773 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4774 |
vg: PVisualGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4775 |
i: LongInt; |
3065 | 4776 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4777 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4778 |
Gear^.dX := Gear^.dX; |
3115 | 4779 |
doStepFallingGear(Gear); |
4780 |
CalcRotationDirAngle(Gear); |
|
4781 |
||
4782 |
if (Gear^.State and gstCollision) <> 0 then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4783 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
4784 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0); |
3115 | 4785 |
PlaySound(sndEggBreak); |
4786 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4787 |
vg := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4788 |
if vg <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4789 |
vg^.Frame := 2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4790 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4791 |
for i:= 10 downto 0 do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4792 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4793 |
vg := AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 3 + Random(6), |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4794 |
vgtDust); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4795 |
if vg <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4796 |
vg^.dX := vg^.dX + (Gear^.dX.QWordValue / 21474836480); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4797 |
end; |
3115 | 4798 |
|
4799 |
DeleteGear(Gear); |
|
4800 |
exit |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4801 |
end; |
3065 | 4802 |
end; |
3342
b4f01613dcd7
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
nemo
parents:
3320
diff
changeset
|
4803 |
|
3401
d5d31d16eccc
add a part of my landslide vector collision and use if for the portal gun DirAngle, not flawless yet
sheepluva
parents:
3399
diff
changeset
|
4804 |
//////////////////////////////////////////////////////////////////////////////// |
3428 | 4805 |
procedure doPortalColorSwitch(); |
4790 | 4806 |
var CurWeapon: PAmmo; |
3428 | 4807 |
begin |
14125
7bb0e27910aa
Fix portal color being switchable after losing control
Wuzzy <Wuzzy2@mail.ru>
parents:
14084
diff
changeset
|
4808 |
if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.State and gstHHDriven) <> 0) and ((CurrentHedgehog^.Gear^.Message and gmSwitch) <> 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4809 |
with CurrentHedgehog^ do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4810 |
if (CurAmmoType = amPortalGun) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4811 |
begin |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
4812 |
PlaySound(sndPortalSwitch); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4813 |
CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch); |
8795 | 4814 |
|
6924 | 4815 |
CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4816 |
if CurWeapon^.Pos <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4817 |
CurWeapon^.Pos := 0 |
8795 | 4818 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4819 |
else |
4790 | 4820 |
CurWeapon^.Pos := 1; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4821 |
end; |
3428 | 4822 |
end; |
4823 |
||
3342
b4f01613dcd7
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
nemo
parents:
3320
diff
changeset
|
4824 |
procedure doStepPortal(Gear: PGear); |
8795 | 4825 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4826 |
iterator, conPortal: PGear; |
5594 | 4827 |
s, r, nx, ny, ox, oy, poffs, noffs, pspeed, nspeed, |
4828 |
resetx, resety, resetdx, resetdy: hwFloat; |
|
4829 |
sx, sy, rh, resetr: LongInt; |
|
4830 |
hasdxy, isbullet, iscake, isCollision: Boolean; |
|
3342
b4f01613dcd7
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
nemo
parents:
3320
diff
changeset
|
4831 |
begin |
3428 | 4832 |
doPortalColorSwitch(); |
4833 |
||
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4834 |
// destroy portal if ground it was attached too is gone |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
4835 |
if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] <= lfAllObjMask) |
10905 | 4836 |
or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and lfBouncy <> 0) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4837 |
or (Gear^.Timer < 1) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4838 |
or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) |
10354 | 4839 |
or CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4840 |
begin |
3428 | 4841 |
deleteGear(Gear); |
4842 |
EXIT; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4843 |
end; |
3428 | 4844 |
|
4845 |
if (TurnTimeLeft < 1) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4846 |
or (Gear^.Health < 1) then |
3428 | 4847 |
dec(Gear^.Timer); |
4848 |
||
4849 |
if Gear^.Timer < 10000 then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4850 |
gear^.RenderTimer := true; |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4851 |
|
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4852 |
// abort if there is no other portal connected to this one |
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4853 |
if (Gear^.LinkedGear = nil) then |
3428 | 4854 |
exit; |
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4855 |
if ((Gear^.LinkedGear^.Tag and 1) = 0) then // or if it's still moving; |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4856 |
exit; |
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4857 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4858 |
conPortal := Gear^.LinkedGear; |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4859 |
|
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4860 |
// check all gears for stuff to port through |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4861 |
iterator := nil; |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4862 |
while true do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4863 |
begin |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4864 |
|
3571 | 4865 |
// iterate through GearsList |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4866 |
if iterator = nil then |
3571 | 4867 |
iterator := GearsList |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4868 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4869 |
iterator := iterator^.NextGear; |
3571 | 4870 |
|
4871 |
// end of list? |
|
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4872 |
if iterator = nil then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4873 |
break; |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4874 |
|
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4875 |
// don't port portals or other gear that wouldn't make sense |
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
4876 |
if (iterator^.Kind in [gtPortal, gtRope, gtAirAttack, gtIceGun]) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4877 |
or (iterator^.PortalCounter > 32) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4878 |
continue; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4879 |
|
3428 | 4880 |
// don't port hogs on rope |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4881 |
// TODO: this will also prevent hogs while falling after rope use from |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4882 |
// falling through portals... fix that! |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4883 |
|
3571 | 4884 |
// check if gear fits through portal |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4885 |
if (iterator^.Radius > Gear^.Radius) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4886 |
continue; |
3571 | 4887 |
|
4888 |
// this is the max range we accept incoming gears in |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4889 |
r := Int2hwFloat(iterator^.Radius+Gear^.Radius); |
3422
41ae3c48faa0
* some changes/cleanups to portal, still much to do :/ * reverted nemo's temporary loop fix * notice: small loops possible again, so take care :P, bigger onces should be interrupted
sheepluva
parents:
3419
diff
changeset
|
4890 |
|
3571 | 4891 |
// too far away? |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4892 |
if (iterator^.X < Gear^.X - r) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4893 |
or (iterator^.X > Gear^.X + r) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4894 |
or (iterator^.Y < Gear^.Y - r) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4895 |
or (iterator^.Y > Gear^.Y + r) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4896 |
continue; |
5044 | 4897 |
|
10490 | 4898 |
hasdxy := (((iterator^.dX.QWordValue <> 0) or (iterator^.dY.QWordValue <> 0)) or ((iterator^.State and gstMoving) = 0)); |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4899 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4900 |
// in case the object is not moving, let's asume it's falling towards the portal |
4038
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4901 |
if not hasdxy then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4902 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4903 |
if Gear^.Y < iterator^.Y then |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4904 |
continue; |
4038
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4905 |
ox:= Gear^.X - iterator^.X; |
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4906 |
oy:= Gear^.Y - iterator^.Y; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4907 |
end |
4038
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4908 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4909 |
begin |
4038
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4910 |
ox:= iterator^.dX; |
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4911 |
oy:= iterator^.dY; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4912 |
end; |
4038
8972dd38bbad
potential fix for Issue #86: 'Objects behind a portal will sometimes go through the portal.' please test
sheepluva
parents:
4036
diff
changeset
|
4913 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4914 |
// cake will need extra treatment... it's so delicious and moist! |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4915 |
iscake:= (iterator^.Kind = gtCake); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4916 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4917 |
// won't port stuff that does not move towards the front/portal entrance |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4918 |
if iscake then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4919 |
begin |
6452 | 4920 |
if not (((iterator^.X - Gear^.X)*ox + (iterator^.Y - Gear^.Y)*oy).isNegative) then |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4921 |
continue; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4922 |
end |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4923 |
else |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
4924 |
if not ((Gear^.dX*ox + Gear^.dY*oy).isNegative) then |
3571 | 4925 |
continue; |
4926 |
||
12903 | 4927 |
isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot, gtMinigunBullet]); |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4928 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4929 |
r:= int2hwFloat(iterator^.Radius); |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4930 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4931 |
if not (isbullet or iscake) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4932 |
begin |
3571 | 4933 |
// wow! good candidate there, let's see if the distance and direction is okay! |
4934 |
if hasdxy then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4935 |
begin |
8900
b77fd3c2eec5
whoops, unbreak build. how come that cmake doesn't stop anymore on engine build error?
sheepluva
parents:
8898
diff
changeset
|
4936 |
s := Distance(iterator^.dX, iterator^.dY); |
8898 | 4937 |
// if the resulting distance is 0 skip this gear |
4938 |
if s.QWordValue = 0 then |
|
4939 |
continue; |
|
8900
b77fd3c2eec5
whoops, unbreak build. how come that cmake doesn't stop anymore on engine build error?
sheepluva
parents:
8898
diff
changeset
|
4940 |
s := r / s; |
3571 | 4941 |
ox:= iterator^.X + s * iterator^.dX; |
4942 |
oy:= iterator^.Y + s * iterator^.dY; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4943 |
end |
3571 | 4944 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4945 |
begin |
3571 | 4946 |
ox:= iterator^.X; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4947 |
oy:= iterator^.Y + r; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4948 |
end; |
3571 | 4949 |
|
3578 | 4950 |
if (hwRound(Distance(Gear^.X-ox,Gear^.Y-oy)) > Gear^.Radius + 1 ) then |
3571 | 4951 |
continue; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4952 |
end; |
3571 | 4953 |
|
12903 | 4954 |
if (iterator^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet]) then |
11555
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
4955 |
begin |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
4956 |
// draw bullet trail |
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
4957 |
spawnBulletTrail(iterator, iterator^.X, iterator^.Y, iterator^.FlightTime = 0); |
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
4958 |
iterator^.FlightTime := 1; |
11555
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
4959 |
// the bullet can now hurt the hog that fired it |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
4960 |
iterator^.Data:= nil; |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11545
diff
changeset
|
4961 |
end; |
5841 | 4962 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4963 |
// calc gear offset in portal vector direction |
3571 | 4964 |
ox := (iterator^.X - Gear^.X); |
4965 |
oy := (iterator^.Y - Gear^.Y); |
|
4966 |
poffs:= (Gear^.dX * ox + Gear^.dY * oy); |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4967 |
|
5841 | 4968 |
if not isBullet and poffs.isNegative then |
4969 |
continue; |
|
4970 |
||
4971 |
// only port bullets close to the portal |
|
6450 | 4972 |
if isBullet and (not (hwAbs(poffs) < _3)) then |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4973 |
continue; |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4974 |
|
4076 | 4975 |
// |
4976 |
// gears that make it till here will definately be ported |
|
4977 |
// |
|
5594 | 4978 |
// (but old position/movement vector might be restored in case there's |
4979 |
// not enough space on the other side) |
|
4980 |
// |
|
4981 |
||
4982 |
resetr := iterator^.Radius; |
|
4983 |
resetx := iterator^.X; |
|
4984 |
resety := iterator^.Y; |
|
4985 |
resetdx := iterator^.dX; |
|
4986 |
resetdy := iterator^.dY; |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4987 |
|
3578 | 4988 |
// create a normal of the portal vector, but ... |
4989 |
nx := Gear^.dY; |
|
3570 | 4990 |
ny := Gear^.dX; |
3578 | 4991 |
// ... decide where the top is based on the hog's direction when firing the portal |
4992 |
if Gear^.Elasticity.isNegative then |
|
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
4993 |
nx.isNegative := (not nx.isNegative) |
3578 | 4994 |
else |
3570 | 4995 |
ny.isNegative := not ny.isNegative; |
3578 | 4996 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4997 |
// calc gear offset in portal normal vector direction |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4998 |
noffs:= (nx * ox + ny * oy); |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4999 |
|
7721 | 5000 |
if isBullet and (noffs.Round >= Longword(Gear^.Radius)) then |
5841 | 5001 |
continue; |
5002 |
||
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5003 |
// avoid gravity related loops of not really moving gear |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5004 |
if not (iscake or isbullet) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5005 |
and (Gear^.dY.isNegative) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5006 |
and (conPortal^.dY.isNegative) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5007 |
and ((iterator^.dX.QWordValue + iterator^.dY.QWordValue) < _0_08.QWordValue) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5008 |
and (iterator^.PortalCounter > 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5009 |
continue; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
5010 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
5011 |
// calc gear speed along to the vector and the normal vector of the portal |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5012 |
if hasdxy then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5013 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5014 |
pspeed:= (Gear^.dX * iterator^.dX + Gear^.dY * iterator^.dY); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5015 |
nspeed:= (nx * iterator^.dX + ny * iterator^.dY); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5016 |
end |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5017 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5018 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5019 |
pspeed:= hwAbs(cGravity * oy); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5020 |
nspeed:= _0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5021 |
end; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
5022 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
5023 |
// creating normal vector of connected (exit) portal |
3578 | 5024 |
nx := conPortal^.dY; |
3570 | 5025 |
ny := conPortal^.dX; |
3578 | 5026 |
if conPortal^.Elasticity.isNegative then |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
5027 |
nx.isNegative := (not nx.isNegative) |
3578 | 5028 |
else |
3570 | 5029 |
ny.isNegative := not ny.isNegative; |
3578 | 5030 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5031 |
// inverse cake's normal movement direction, |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5032 |
// as if it just walked through a hole |
5750
6bbf7aee2cdf
Reenable a bunch of old portal play stuff, like dropping grenade into portal on hog, jumping through portal w/ hog on other end, collecting crate w/ portal etc. Also add cooldown to cake/portal interaction. It may still not do what you expect, but it probably shouldn't spin in place.
nemo
parents:
5748
diff
changeset
|
5033 |
//if iscake then nspeed.isNegative:= not nspeed.isNegative; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5034 |
|
3571 | 5035 |
//AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3578 | 5036 |
iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
5037 |
iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5038 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5039 |
// make the gear's exit position close to the portal while |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5040 |
// still respecting the movement direction |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5041 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5042 |
// determine the distance (in exit vector direction) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5043 |
// that we want the gear at |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5044 |
if iscake then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5045 |
ox:= (r - _0_7) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5046 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5047 |
ox:= (r * _1_5); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5048 |
s:= ox / poffs; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5049 |
poffs:= ox; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5050 |
if (nspeed.QWordValue <> 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5051 |
and (pspeed > _0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5052 |
noffs:= noffs * s * (nspeed / pspeed); |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5053 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5054 |
// move stuff with high normal offset closer to the portal's center |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5055 |
if not isbullet then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5056 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5057 |
s := hwAbs(noffs) + r - int2hwFloat(Gear^.Radius); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5058 |
if s > _0 then |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5059 |
noffs:= noffs - SignAs(s,noffs) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5060 |
end; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5061 |
|
3571 | 5062 |
iterator^.X := conPortal^.X + poffs * conPortal^.dX + noffs * nx; |
5063 |
iterator^.Y := conPortal^.Y + poffs * conPortal^.dY + noffs * ny; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5064 |
|
6450 | 5065 |
if not hasdxy and (not (conPortal^.dY.isNegative)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5066 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5067 |
iterator^.dY:= iterator^.dY + hwAbs(cGravity * (iterator^.Y - conPortal^.Y)) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5068 |
end; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
5069 |
|
5594 | 5070 |
// see if the space on the exit side actually is enough |
5071 |
||
5072 |
if not (isBullet or isCake) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5073 |
begin |
5594 | 5074 |
// TestCollisionXwithXYShift requires a hwFloat for xShift |
5075 |
ox.QWordValue := _1.QWordValue; |
|
5076 |
ox.isNegative := not iterator^.dX.isNegative; |
|
5077 |
||
5078 |
sx := hwSign(iterator^.dX); |
|
5079 |
sy := hwSign(iterator^.dY); |
|
5080 |
||
5081 |
if iterator^.Radius > 1 then |
|
5082 |
iterator^.Radius := iterator^.Radius - 1; |
|
5083 |
||
5084 |
// check front |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
5085 |
isCollision := (TestCollisionY(iterator, sy) <> 0) or (TestCollisionX(iterator, sx) <> 0); |
5594 | 5086 |
|
5087 |
if not isCollision then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5088 |
begin |
5594 | 5089 |
// check center area (with half the radius so that the |
5090 |
// the square check won't check more pixels than we want to) |
|
5091 |
iterator^.Radius := 1 + resetr div 2; |
|
5092 |
rh := resetr div 4; |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
5093 |
isCollision := (TestCollisionYwithXYShift(iterator, 0, -sy * rh, sy, false) <> 0) |
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
5094 |
or (TestCollisionXwithXYShift(iterator, ox * rh, 0, sx, false) <> 0); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5095 |
end; |
5594 | 5096 |
|
5097 |
iterator^.Radius := resetr; |
|
5098 |
||
5099 |
if isCollision then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5100 |
begin |
5594 | 5101 |
// collision! oh crap! go back! |
5102 |
iterator^.X := resetx; |
|
5103 |
iterator^.Y := resety; |
|
5104 |
iterator^.dX := resetdx; |
|
5105 |
iterator^.dY := resetdy; |
|
5106 |
continue; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5107 |
end; |
5594 | 5108 |
end; |
5109 |
||
14206 | 5110 |
if iterator^.Kind = gtKamikaze then |
5111 |
RefillProximityCache(iterator, 300); |
|
5112 |
||
5594 | 5113 |
// |
5114 |
// You're now officially portaled! |
|
5115 |
// |
|
5116 |
||
5117 |
// Until loops are reliably broken |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5118 |
if iscake then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5119 |
iterator^.PortalCounter:= 33 |
5940 | 5120 |
else |
5121 |
begin |
|
5122 |
inc(iterator^.PortalCounter); |
|
7658 | 5123 |
iterator^.Active:= true; |
7992 | 5124 |
iterator^.State:= iterator^.State and (not gstHHHJump) or gstMoving; |
5940 | 5125 |
end; |
5594 | 5126 |
|
6785 | 5127 |
// is it worth adding an arcsin table? Just how often would we end up doing something like this? |
6787 | 5128 |
// SYNCED ANGLE UPDATE |
6785 | 5129 |
if iterator^.Kind = gtRCPlane then |
10112
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
5130 |
iterator^.Angle:= (1024 + vector2Angle(iterator^.dX, iterator^.dY) mod 4096) |
6787 | 5131 |
// VISUAL USE OF ANGLE ONLY |
5132 |
else if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtKamikaze) and (CurAmmoGear^.Hedgehog = iterator^.Hedgehog) then |
|
5133 |
begin |
|
5134 |
iterator^.Angle:= DxDy2AttackAngle(iterator^.dX, iterator^.dY); |
|
5135 |
iterator^.Angle:= 2048-iterator^.Angle; |
|
6786 | 5136 |
if iterator^.dX.isNegative then iterator^.Angle:= 4096-iterator^.Angle; |
6785 | 5137 |
end; |
5138 |
||
6555 | 5139 |
if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5140 |
and (iterator = CurrentHedgehog^.Gear) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5141 |
and (CurAmmoGear <> nil) |
9539 | 5142 |
and (CurAmmoGear^.Kind = gtRope) |
5143 |
and (CurAmmoGear^.Elasticity <> _0) then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5144 |
CurAmmoGear^.PortalCounter:= 1; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5145 |
|
8795 | 5146 |
if not isbullet and (iterator^.State and gstInvisible = 0) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5147 |
and (iterator^.Kind <> gtFlake) then |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
5148 |
FollowGear := iterator; |
5594 | 5149 |
|
5841 | 5150 |
// store X/Y values of exit for net bullet trail |
5151 |
if isbullet then |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5152 |
begin |
5841 | 5153 |
iterator^.Elasticity:= iterator^.X; |
5154 |
iterator^.Friction := iterator^.Y; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5155 |
end; |
5841 | 5156 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5157 |
if Gear^.Health > 1 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5158 |
dec(Gear^.Health); |
3571 | 5159 |
end; |
3342
b4f01613dcd7
Some initial stubs for portal just so Tiy will quit nagging. Also let folks know what approximation of physics I plan to try, here.
nemo
parents:
3320
diff
changeset
|
5160 |
end; |
3350 | 5161 |
|
6490 | 5162 |
|
3428 | 5163 |
|
5164 |
procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
|
4790 | 5165 |
var |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5166 |
CurWeapon: PAmmo; |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
5167 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5168 |
if CurrentHedgehog <> nil then |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5169 |
with CurrentHedgehog^ do |
3428 | 5170 |
begin |
6924 | 5171 |
CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5172 |
if (CurAmmoType = amPortalGun) then |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5173 |
begin |
4790 | 5174 |
if not destroyGear then |
5175 |
begin |
|
5176 |
// switch color of ball to opposite of oldPortal |
|
5177 |
if (oldPortal^.Tag and 2) = 0 then |
|
5178 |
CurWeapon^.Pos:= 1 |
|
5179 |
else |
|
5180 |
CurWeapon^.Pos:= 0; |
|
5181 |
end; |
|
5182 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5183 |
// make the ball visible |
4790 | 5184 |
CurWeapon^.Timer := 0; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5185 |
end |
3428 | 5186 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5187 |
if destroyGear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5188 |
oldPortal^.Timer:= 0; |
3428 | 5189 |
end; |
5190 |
||
6490 | 5191 |
procedure doStepMovingPortal_real(Gear: PGear); |
8795 | 5192 |
var |
6490 | 5193 |
x, y, tx, ty: LongInt; |
5194 |
s: hwFloat; |
|
3428 | 5195 |
begin |
9477 | 5196 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5197 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5198 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5199 |
tx := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5200 |
ty := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5201 |
// avoid compiler hints |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5202 |
|
7309 | 5203 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > 255) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5204 |
begin |
3569 | 5205 |
Gear^.State := Gear^.State or gstCollision; |
6450 | 5206 |
Gear^.State := Gear^.State and (not gstMoving); |
8795 | 5207 |
|
7310 | 5208 |
if (Land[y, x] and lfBouncy <> 0) |
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7416
diff
changeset
|
5209 |
or (not CalcSlopeTangent(Gear, x, y, tx, ty, 255)) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5210 |
or (DistanceI(tx,ty) < _12) then // reject shots at too irregular terrain |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5211 |
begin |
3428 | 5212 |
loadNewPortalBall(Gear, true); |
5213 |
EXIT; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5214 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5215 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5216 |
// making a normalized normal vector |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5217 |
s := _1/DistanceI(tx,ty); |
3562 | 5218 |
Gear^.dX := s * ty; |
5219 |
Gear^.dY := -s * tx; |
|
5220 |
||
5221 |
Gear^.DirAngle := DxDy2Angle(-Gear^.dY,Gear^.dX); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5222 |
if not Gear^.dX.isNegative then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5223 |
Gear^.DirAngle := 180-Gear^.DirAngle; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5224 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5225 |
if ((Gear^.LinkedGear = nil) |
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5226 |
or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5227 |
begin |
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
5228 |
PlaySound(sndPortalOpen); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5229 |
loadNewPortalBall(Gear, false); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5230 |
inc(Gear^.Tag); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5231 |
Gear^.doStep := @doStepPortal; |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
5232 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5233 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5234 |
loadNewPortalBall(Gear, true); |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
5235 |
end |
8795 | 5236 |
|
10354 | 5237 |
else if CheckCoordInWater(x, y) |
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
5238 |
or (y < -max(LAND_WIDTH,4096)) |
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
5239 |
or (x > 2*max(LAND_WIDTH,4096)) |
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset
|
5240 |
or (x < -max(LAND_WIDTH,4096)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5241 |
loadNewPortalBall(Gear, true); |
3428 | 5242 |
end; |
5243 |
||
3569 | 5244 |
procedure doStepMovingPortal(Gear: PGear); |
5245 |
begin |
|
5246 |
doPortalColorSwitch(); |
|
5247 |
doStepPerPixel(Gear, @doStepMovingPortal_real, true); |
|
8795 | 5248 |
if (Gear^.Timer < 1) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5249 |
or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5250 |
deleteGear(Gear); |
3569 | 5251 |
end; |
5252 |
||
3428 | 5253 |
procedure doStepPortalShot(newPortal: PGear); |
8795 | 5254 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5255 |
iterator: PGear; |
3560
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5256 |
s: hwFloat; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset
|
5257 |
CurWeapon: PAmmo; |
3428 | 5258 |
begin |
3560
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5259 |
s:= Distance (newPortal^.dX, newPortal^.dY); |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5260 |
|
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5261 |
// Adds the hog speed (only that part in/directly against shot direction) |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5262 |
// to the shot speed (which we triple previously btw) |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5263 |
// (This is done my projecting the hog movement vector onto the shot movement vector and then adding the resulting length |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5264 |
// to the scaler) |
3562 | 5265 |
s := (_2 * s + (newPortal^.dX * CurrentHedgehog^.Gear^.dX + newPortal^.dY * CurrentHedgehog^.Gear^.dY ) / s) / s; |
3560
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5266 |
newPortal^.dX := newPortal^.dX * s; |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5267 |
newPortal^.dY := newPortal^.dY * s; |
3e51dad04026
portal: make shot 2 times faster, add hog movement speed to shot speed (only the part in shot direction, so that aiming is not messed up)
sheepluva
parents:
3552
diff
changeset
|
5268 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5269 |
newPortal^.LinkedGear := nil; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5270 |
|
11916
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
5271 |
PlaySound(sndPortalShot); |
6145efcff302
Add sounds for blowtorch, invuln., f. saucer, lasersight, portal gun
Wuzzy <almikes@aol.com>
parents:
11865
diff
changeset
|
5272 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5273 |
if CurrentHedgehog <> nil then |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
5274 |
with CurrentHedgehog^ do |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5275 |
begin |
6924 | 5276 |
CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
3578 | 5277 |
// let's save the HH's dX's direction so we can decide where the "top" of the portal hole |
5278 |
newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative; |
|
5279 |
// when doing a backjump the dx is the opposite of the facing direction |
|
13101
d78e65c66573
Add hedgehog effect heArtillery, allows to set per-hedgehog artillery mode
Wuzzy <Wuzzy2@mail.ru>
parents:
13063
diff
changeset
|
5280 |
if ((Gear^.State and gstHHHJump) <> 0) and (Effects[heArtillery] = 0) then |
3578 | 5281 |
newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative; |
5282 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5283 |
// make portal gun look unloaded |
4790 | 5284 |
if (CurWeapon <> nil) and (CurAmmoType = amPortalGun) then |
5285 |
CurWeapon^.Timer := CurWeapon^.Timer or 2; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5286 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5287 |
iterator := GearsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5288 |
while iterator <> nil do |
7581
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5289 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5290 |
if (iterator^.Kind = gtPortal) then |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5291 |
if (iterator <> newPortal) and (iterator^.Timer > 0) and (iterator^.Hedgehog = CurrentHedgehog) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5292 |
begin |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5293 |
if ((iterator^.Tag and 2) = (newPortal^.Tag and 2)) then |
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5294 |
begin |
3468
c7b80bdbc384
* make portals delete each other only indirectly (by setting timer to 0)
sheepluva
parents:
3462
diff
changeset
|
5295 |
iterator^.Timer:= 0; |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5296 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5297 |
else |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5298 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5299 |
// link portals with each other |
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5300 |
newPortal^.LinkedGear := iterator; |
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5301 |
iterator^.LinkedGear := newPortal; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5302 |
iterator^.Health := newPortal^.Health; |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
5303 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5304 |
end; |
3480
c4c3f3512404
Prevent all portal loops the guaranteed way, at least until sheepluva's tests yield something reliable.
nemo
parents:
3476
diff
changeset
|
5305 |
iterator^.PortalCounter:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5306 |
iterator := iterator^.NextGear |
7581
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5307 |
end; |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5308 |
|
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5309 |
if newPortal^.LinkedGear <> nil then |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5310 |
begin |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5311 |
// This jiggles gears, to ensure a portal connection just placed under a gear takes effect. |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5312 |
iterator:= GearsList; |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5313 |
while iterator <> nil do |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5314 |
begin |
12681
2e6dcd97f085
No longer jiggle sticky mines if using portable portal device
Wuzzy <almikes@aol.com>
parents:
12677
diff
changeset
|
5315 |
if not (iterator^.Kind in [gtPortal, gtAirAttack, gtKnife, gtSMine]) and ((iterator^.Hedgehog <> CurrentHedgehog) |
7581
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5316 |
or ((iterator^.Message and gmAllStoppable) = 0)) then |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5317 |
begin |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5318 |
iterator^.Active:= true; |
7992 | 5319 |
if iterator^.dY.QWordValue = 0 then |
7581
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5320 |
iterator^.dY.isNegative:= false; |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5321 |
iterator^.State:= iterator^.State or gstMoving; |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5322 |
DeleteCI(iterator); |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5323 |
//inc(iterator^.dY.QWordValue,10); |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5324 |
end; |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5325 |
iterator:= iterator^.NextGear |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5326 |
end |
ea509b70e03d
move this section back to the connection code, and add an exclusion for air attack. probably should play a few portal games just in case
nemo
parents:
7564
diff
changeset
|
5327 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5328 |
end; |
6450 | 5329 |
newPortal^.State := newPortal^.State and (not gstCollision); |
3569 | 5330 |
newPortal^.State := newPortal^.State or gstMoving; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5331 |
newPortal^.doStep := @doStepMovingPortal; |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
5332 |
end; |
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
5333 |
|
14571
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5334 |
procedure doStepPiano(Gear: PGear); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5335 |
var valid: boolean; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5336 |
HHGear: PGear; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5337 |
begin |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5338 |
AllInactive := false; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5339 |
valid := true; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5340 |
|
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5341 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5342 |
HHGear := Gear^.Hedgehog^.Gear; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5343 |
|
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5344 |
if (WorldEdge = weBounce) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5345 |
if (hwRound(Gear^.X) - Gear^.Radius < leftX) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5346 |
valid := false |
14737
52916435d9b1
Fix right limit of piano placement in bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14703
diff
changeset
|
5347 |
else if (hwRound(Gear^.X) + Gear^.Radius > rightX) then |
14571
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5348 |
valid := false; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5349 |
|
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5350 |
if (not valid) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5351 |
begin |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5352 |
if (HHGear <> nil) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5353 |
begin |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5354 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5355 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5356 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5357 |
isCursorVisible := true; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5358 |
end; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5359 |
DeleteGear(Gear); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5360 |
PlaySound(sndDenied); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5361 |
exit; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5362 |
end; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5363 |
|
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5364 |
isCursorVisible := false; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5365 |
if (HHGear <> nil) then |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5366 |
begin |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5367 |
PlaySoundV(sndIncoming, Gear^.Hedgehog^.Team^.voicepack); |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5368 |
// Tuck the hedgehog away until the piano attack is completed |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5369 |
Gear^.Hedgehog^.Unplaced:= true; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5370 |
HHGear^.X:= _0; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5371 |
HHGear^.Y:= _0; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5372 |
end; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5373 |
|
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5374 |
PauseMusic; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5375 |
Gear^.doStep:= @doStepPianoWork; |
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5376 |
end; |
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
5377 |
//////////////////////////////////////////////////////////////////////////////// |
14571
85921db6f7c3
Disallow placement of piano beyond bounce world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
14570
diff
changeset
|
5378 |
procedure doStepPianoWork(Gear: PGear); |
8795 | 5379 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5380 |
r0, r1: LongInt; |
3728 | 5381 |
odY: hwFloat; |
3350 | 5382 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5383 |
AllInactive := false; |
13983
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5384 |
// Play piano notes with slot keys |
8795 | 5385 |
if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5386 |
((CurrentHedgehog^.Gear^.Message and gmSlot) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5387 |
begin |
13983
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5388 |
// Piano notes are played if sound OR music (or both) is enabled |
8795 | 5389 |
case CurrentHedgehog^.Gear^.MsgParam of |
13983
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5390 |
0: PlaySound(sndPiano0, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5391 |
1: PlaySound(sndPiano1, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5392 |
2: PlaySound(sndPiano2, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5393 |
3: PlaySound(sndPiano3, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5394 |
4: PlaySound(sndPiano4, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5395 |
5: PlaySound(sndPiano5, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5396 |
6: PlaySound(sndPiano6, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5397 |
7: PlaySound(sndPiano7, false, false, true); |
3ae88a9f9dca
If u play Piano, you can now hear the notes if sound effects OR music is enabled
Wuzzy <Wuzzy2@mail.ru>
parents:
13980
diff
changeset
|
5398 |
8: PlaySound(sndPiano8, false, false, true); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5399 |
end; |
3704 | 5400 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5401 |
CurrentHedgehog^.Gear^.MsgParam := 0; |
6450 | 5402 |
CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSlot); |
6304
3036c242b19d
Set CurrentAmmoGear on piano (should fix notes again). Also disable focus on current hog if unplaced.
nemo
parents:
6278
diff
changeset
|
5403 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5404 |
|
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
5405 |
if (Gear^.Pos = 5) then |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5406 |
begin |
3728 | 5407 |
Gear^.dY := Gear^.dY + cGravity * 2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5408 |
Gear^.Y := Gear^.Y + Gear^.dY; |
6803
0e70f3ea3bf8
bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
nemo
parents:
6792
diff
changeset
|
5409 |
if CheckGearDrowning(Gear) then |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5410 |
begin |
6803
0e70f3ea3bf8
bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
nemo
parents:
6792
diff
changeset
|
5411 |
Gear^.Y:= Gear^.Y + _50; |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5412 |
OnUsedAmmo(CurrentHedgehog^); |
12297
93434ab299a0
Take sacrifices into account for the “Stupid” taunt
Wuzzy <almikes@aol.com>
parents:
12282
diff
changeset
|
5413 |
uStats.HedgehogSacrificed(CurrentHedgehog); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5414 |
if CurrentHedgehog^.Gear <> nil then |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5415 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5416 |
// Drown the hedgehog. Could also just delete it, but hey, this gets a caption |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5417 |
CurrentHedgehog^.Gear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5418 |
CurrentHedgehog^.Gear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5419 |
CurrentHedgehog^.Gear^.Y := int2hwFloat(cWaterLine+cVisibleWater)+_128; |
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset
|
5420 |
CurrentHedgehog^.Unplaced := false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5421 |
if TagTurnTimeLeft = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5422 |
TagTurnTimeLeft:= TurnTimeLeft; |
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset
|
5423 |
TurnTimeLeft:= 0 |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5424 |
end; |
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5425 |
ResumeMusic |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5426 |
end; |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5427 |
exit |
3351 | 5428 |
end; |
5429 |
||
3728 | 5430 |
odY:= Gear^.dY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5431 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5432 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5433 |
if (Gear^.State and gstDrowning) <> 0 then |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5434 |
begin |
6803
0e70f3ea3bf8
bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
nemo
parents:
6792
diff
changeset
|
5435 |
Gear^.Y:= Gear^.Y + _50; |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5436 |
OnUsedAmmo(CurrentHedgehog^); |
12297
93434ab299a0
Take sacrifices into account for the “Stupid” taunt
Wuzzy <almikes@aol.com>
parents:
12282
diff
changeset
|
5437 |
uStats.HedgehogSacrificed(CurrentHedgehog); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5438 |
if CurrentHedgehog^.Gear <> nil then |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5439 |
begin |
3419
b66a1b597f88
Add drown-the-playing-hog check for case of piano falling off the landscape.
nemo
parents:
3417
diff
changeset
|
5440 |
// Drown the hedgehog. Could also just delete it, but hey, this gets a caption |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5441 |
CurrentHedgehog^.Gear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5442 |
CurrentHedgehog^.Gear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5443 |
CurrentHedgehog^.Gear^.Y := int2hwFloat(cWaterLine+cVisibleWater)+_128; |
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset
|
5444 |
CurrentHedgehog^.Unplaced := false; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5445 |
if TagTurnTimeLeft = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5446 |
TagTurnTimeLeft:= TurnTimeLeft; |
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset
|
5447 |
TurnTimeLeft:= 0 |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5448 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5449 |
ResumeMusic |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5450 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5451 |
else if (Gear^.State and gstCollision) <> 0 then |
3399 | 5452 |
begin |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5453 |
r0 := GetRandom(Gear^.Boom div 4 + 1); |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5454 |
r1 := GetRandom(Gear^.Boom div 4 + 1); |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5455 |
doMakeExplosion(hwRound(Gear^.X) - 30 - r0, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r1, Gear^.Hedgehog, 0); |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5456 |
doMakeExplosion(hwRound(Gear^.X) + 30 + r1, hwRound(Gear^.Y) + 40, Gear^.Boom div 2 + r0, Gear^.Hedgehog, 0); |
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5457 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom + r0, Gear^.Hedgehog, EXPLAutoSound); |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5458 |
for r0:= 0 to 4 do |
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5459 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote); |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
5460 |
Gear^.dY := cGravity * 2 - odY; |
6305
5f7480c2a08d
Set default water colours in greyscale mode in case the theme does not define them, decrement piano weapon on use
nemo
parents:
6304
diff
changeset
|
5461 |
Gear^.Pos := Gear^.Pos + 1; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5462 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5463 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5464 |
Gear^.dY := Gear^.dY + cGravity * 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5465 |
// let it fall faster so itdoesn't take too long for the whole attack |
3382 | 5466 |
end; |
3384 | 5467 |
|
5468 |
||
5469 |
//////////////////////////////////////////////////////////////////////////////// |
|
5470 |
procedure doStepSineGunShotWork(Gear: PGear); |
|
8795 | 5471 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5472 |
x, y, rX, rY, t, tmp, initHealth: LongInt; |
3384 | 5473 |
oX, oY, ldX, ldY, sdX, sdY, sine, lx, ly, amp: hwFloat; |
10657 | 5474 |
justCollided, justBounced: boolean; |
3384 | 5475 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5476 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5477 |
initHealth := Gear^.Health; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5478 |
lX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5479 |
lY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5480 |
ldX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5481 |
ldY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5482 |
sdy := _0_5/Distance(Gear^.dX,Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5483 |
ldX := ldX * sdy; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5484 |
ldY := ldY * sdy; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5485 |
sdY := hwAbs(ldX) + hwAbs(ldY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5486 |
sdX := _1 - hwAbs(ldX/sdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5487 |
sdY := _1 - hwAbs(ldY/sdY); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5488 |
if (ldX.isNegative = ldY.isNegative) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5489 |
sdY := -sdY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5490 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5491 |
// initial angle depends on current GameTicks |
7745 | 5492 |
t := getRandom(4096); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5493 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5494 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5495 |
// used for a work-around detection of area that is within land array, but outside borders |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5496 |
justCollided := false; |
10657 | 5497 |
// this variable is just to ensure we don't run in infinite loop due to precision errors |
5498 |
justBounced:= false; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5499 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5500 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5501 |
lX := lX + ldX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5502 |
lY := lY + ldY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5503 |
oX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5504 |
oY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5505 |
rX := hwRound(oX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5506 |
rY := hwRound(oY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5507 |
tmp := t mod 4096; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5508 |
amp := _128 * (_1 - hwSqr(int2hwFloat(Gear^.Health)/initHealth)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5509 |
sine := amp * AngleSin(tmp mod 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5510 |
sine.isNegative := (tmp < 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5511 |
Gear^.X := lX + (sine * sdX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5512 |
Gear^.Y := ly + (sine * sdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5513 |
Gear^.dX := Gear^.X - oX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5514 |
Gear^.dY := Gear^.Y - oY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5515 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5516 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5517 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5518 |
|
10652 | 5519 |
if WorldEdge = weWrap then |
5520 |
begin |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
5521 |
if x > rightX then |
10659 | 5522 |
repeat |
5523 |
dec(x, playWidth); |
|
5524 |
dec(rx, playWidth); |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
5525 |
until x <= rightX |
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
5526 |
else if x < leftX then |
10659 | 5527 |
repeat |
5528 |
inc(x, playWidth); |
|
5529 |
inc(rx, playWidth); |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
5530 |
until x >= leftX; |
10657 | 5531 |
end |
5532 |
else if (WorldEdge = weBounce) then |
|
5533 |
begin |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
5534 |
if (not justBounced) and ((x > rightX) or (x < leftX)) then |
10657 | 5535 |
begin |
5536 |
// reflect |
|
5537 |
lX:= lX - ldX + ((oX - lX) * 2); |
|
5538 |
lY:= lY - ldY; |
|
5539 |
Gear^.X:= oX; |
|
5540 |
Gear^.Y:= oY; |
|
5541 |
ldX.isNegative:= (not ldX.isNegative); |
|
5542 |
sdX.isNegative:= (not sdX.isNegative); |
|
5543 |
justBounced:= true; |
|
5544 |
continue; |
|
5545 |
end |
|
5546 |
else |
|
5547 |
justBounced:= false; |
|
10652 | 5548 |
end; |
5549 |
||
10657 | 5550 |
|
5551 |
inc(t,Gear^.Health div 313); |
|
5552 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5553 |
// if borders are on, stop outside land array |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5554 |
if hasBorder and (((x and LAND_WIDTH_MASK) <> 0) or ((y and LAND_HEIGHT_MASK) <> 0)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5555 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5556 |
Gear^.Damage := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5557 |
Gear^.Health := 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5558 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5559 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5560 |
begin |
10372 | 5561 |
if (not CheckCoordInWater(rX, rY)) or (not CheckCoordInWater(x, y)) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5562 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5563 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5564 |
and (Land[y, x] <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5565 |
begin |
10118 | 5566 |
if ((GameFlags and gfSolidLand) <> 0) and (Land[y, x] > 255) then |
5567 |
Gear^.Damage := initHealth |
|
5568 |
else if justCollided then |
|
5569 |
begin |
|
5570 |
Gear^.Damage := initHealth; |
|
5571 |
end |
|
5572 |
else |
|
5573 |
begin |
|
5574 |
inc(Gear^.Damage,3); |
|
5575 |
justCollided := true; |
|
5576 |
end; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5577 |
end |
3384 | 5578 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5579 |
justCollided := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5580 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5581 |
// kick nearby hogs, dig tunnel and add some fire |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5582 |
// if at least 5 collisions occured |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5583 |
if Gear^.Damage > 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5584 |
begin |
10118 | 5585 |
if ((GameFlags and gfSolidLand) = 0) then |
5586 |
begin |
|
13571
acc69f506914
Use wrap-aware doMakeExplosion instead of DrawExplosion in uHandlersMess
Wuzzy <Wuzzy2@mail.ru>
parents:
13469
diff
changeset
|
5587 |
doMakeExplosion(rX,rY,Gear^.Radius, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx); |
10118 | 5588 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5589 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5590 |
// kick nearby hogs |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5591 |
AmmoShove(Gear, Gear^.Boom, 50); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5592 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5593 |
dec(Gear^.Health, Gear^.Damage); |
10118 | 5594 |
|
5595 |
// explode when impacting on solid land/borders |
|
5596 |
if Gear^.Damage >= initHealth then |
|
5597 |
begin |
|
5598 |
// add some random offset to angles |
|
5599 |
tmp := getRandom(256); |
|
5600 |
// spawn some flames |
|
5601 |
for t:= 0 to 3 do |
|
5602 |
begin |
|
5603 |
if not isZero(Gear^.dX) then rX := rx - hwSign(Gear^.dX); |
|
5604 |
if not isZero(Gear^.dY) then rY := ry - hwSign(Gear^.dY); |
|
5605 |
lX := AngleCos(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
5606 |
lY := AngleSin(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
5607 |
AddGear(rX, rY, gtFlame, 0, lX, lY, 0); |
|
5608 |
AddGear(rX, rY, gtFlame, 0, lX, -lY, 0); |
|
5609 |
end; |
|
5610 |
end |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5611 |
// add some fire to the tunnel |
10118 | 5612 |
else if getRandom(6) = 0 then |
7391
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
5613 |
begin |
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
5614 |
tmp:= GetRandom(2 * Gear^.Radius); |
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
5615 |
AddGear(x - Gear^.Radius + tmp, y - GetRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0) |
10118 | 5616 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5617 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5618 |
|
10118 | 5619 |
Gear^.Damage := 0; |
5620 |
||
7391
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
5621 |
if random(100) = 0 then |
8795 | 5622 |
AddVisualGear(x, y, vgtSmokeTrace); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5623 |
end |
10118 | 5624 |
else dec(Gear^.Health, 5); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5625 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5626 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5627 |
dec(Gear^.Health); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5628 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5629 |
// decrease bullet size towards the end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5630 |
if (Gear^.Radius > 4) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5631 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5632 |
if (Gear^.Health <= (initHealth div 3)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5633 |
dec(Gear^.Radius) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5634 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5635 |
else if (Gear^.Radius > 3) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5636 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5637 |
if (Gear^.Health <= (initHealth div 4)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5638 |
dec(Gear^.Radius) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5639 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5640 |
else if (Gear^.Radius > 2) then begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5641 |
if (Gear^.Health <= (initHealth div 5)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5642 |
dec(Gear^.Radius) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5643 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5644 |
else if (Gear^.Radius > 1) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5645 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5646 |
if (Gear^.Health <= (initHealth div 6)) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5647 |
dec(Gear^.Radius) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5648 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5649 |
until (Gear^.Health <= 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5650 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5651 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5652 |
AfterAttack; |
3384 | 5653 |
end; |
5654 |
||
5655 |
procedure doStepSineGunShot(Gear: PGear); |
|
7745 | 5656 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5657 |
HHGear: PGear; |
3384 | 5658 |
begin |
8795 | 5659 |
PlaySound(sndSineGun); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5660 |
|
11556 | 5661 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
5662 |
begin |
|
5663 |
HHGear := Gear^.Hedgehog^.Gear; |
|
5664 |
// push the shooting Hedgehog back |
|
5665 |
Gear^.dX.isNegative := not Gear^.dX.isNegative; |
|
5666 |
Gear^.dY.isNegative := not Gear^.dY.isNegative; |
|
5667 |
HHGear^.dX := Gear^.dX; |
|
5668 |
HHGear^.dY := Gear^.dY; |
|
13779
506cca5a48cb
Fix sinegun dealing 1 damage when shooting straight up. Reduces sine gun knockback strength by 1.25%
alfadur
parents:
13763
diff
changeset
|
5669 |
AmmoShove(Gear, 0, 79); |
11556 | 5670 |
Gear^.dX.isNegative := not Gear^.dX.isNegative; |
5671 |
Gear^.dY.isNegative := not Gear^.dY.isNegative; |
|
5672 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5673 |
|
4034
634a8c8682de
add some phone rumbling to big explosions, airbomb and sinegun
koda
parents:
4026
diff
changeset
|
5674 |
Gear^.doStep := @doStepSineGunShotWork; |
9954 | 5675 |
{$IFNDEF PAS2C} |
8204 | 5676 |
with mobileRecord do |
5677 |
if (performRumble <> nil) and (not fastUntilLag) then |
|
5678 |
performRumble(kSystemSoundID_Vibrate); |
|
9954 | 5679 |
{$ENDIF} |
3384 | 5680 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5681 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5682 |
//////////////////////////////////////////////////////////////////////////////// |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5683 |
procedure doStepFlamethrowerWork(Gear: PGear); |
8795 | 5684 |
var |
7281 | 5685 |
HHGear, flame: PGear; |
3485 | 5686 |
rx, ry, speed: hwFloat; |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5687 |
i, gX, gY: LongInt; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5688 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5689 |
AllInactive := false; |
4365 | 5690 |
HHGear := Gear^.Hedgehog^.Gear; |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5691 |
if HHGear = nil then |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5692 |
begin |
13988 | 5693 |
StopSoundChan(Gear^.SoundChannel, 300); |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5694 |
DeleteGear(gear); |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5695 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5696 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5697 |
HedgehogChAngle(HHGear); |
3484 | 5698 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
5699 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
8795 | 5700 |
|
3485 | 5701 |
if (GameTicks and $FF) = 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5702 |
begin |
3894 | 5703 |
if (HHGear^.Message and gmRight) <> 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5704 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5705 |
if HHGear^.dX.isNegative and (Gear^.Tag < 20) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5706 |
inc(Gear^.Tag) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5707 |
else if Gear^.Tag > 5 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5708 |
dec(Gear^.Tag); |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5709 |
end |
3894 | 5710 |
else if (HHGear^.Message and gmLeft) <> 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5711 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5712 |
if HHGear^.dX.isNegative and (Gear^.Tag > 5) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5713 |
dec(Gear^.Tag) |
8795 | 5714 |
else if Gear^.Tag < 20 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5715 |
inc(Gear^.Tag); |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5716 |
end |
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5717 |
end; |
8795 | 5718 |
|
3485 | 5719 |
dec(Gear^.Timer); |
5720 |
if Gear^.Timer = 0 then |
|
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5721 |
begin |
3485 | 5722 |
dec(Gear^.Health); |
5417
c56a6be662bf
try to tweak flamethrower a bit to do more damage with fire changes. An optimal firepit test dealt 68.
nemo
parents:
5415
diff
changeset
|
5723 |
if (Gear^.Health mod 5) = 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5724 |
begin |
7001 | 5725 |
rx := rndSign(getRandomf * _0_1); |
5726 |
ry := rndSign(getRandomf * _0_1); |
|
5417
c56a6be662bf
try to tweak flamethrower a bit to do more damage with fire changes. An optimal firepit test dealt 68.
nemo
parents:
5415
diff
changeset
|
5727 |
speed := _0_5 * (_10 / Gear^.Tag); |
8795 | 5728 |
|
7281 | 5729 |
flame:= AddGear(gx, gy, gtFlame, gstTmpFlag, |
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
5730 |
SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
5731 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
5732 |
flame^.CollisionMask:= lfNotCurHogCrate; |
8795 | 5733 |
|
6131 | 5734 |
if (Gear^.Health mod 30) = 0 then |
7281 | 5735 |
begin |
5736 |
flame:= AddGear(gx, gy, gtFlame, 0, |
|
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
5737 |
SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
5738 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
5739 |
flame^.CollisionMask:= lfNotCurHogCrate; |
7281 | 5740 |
end |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5741 |
end; |
3485 | 5742 |
Gear^.Timer:= Gear^.Tag |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5743 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5744 |
|
7539 | 5745 |
if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5746 |
begin |
14003
23fb123bd70c
Clear gmLeft/gmRight after using landspray/flamethrower to prevent accidental walking
Wuzzy <Wuzzy2@mail.ru>
parents:
14001
diff
changeset
|
5747 |
HHGear^.Message:= HHGear^.Message and (not (gmAttack or gmLeft or gmRight)); |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5748 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
13988 | 5749 |
StopSoundChan(Gear^.SoundChannel, 300); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5750 |
DeleteGear(Gear); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5751 |
AfterAttack |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5752 |
end |
3485 | 5753 |
else |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5754 |
begin |
4256 | 5755 |
i:= Gear^.Health div 5; |
4262
154253f77b03
ok... combine a tick check with texture percentage check. this should be a lot less frequent
nemo
parents:
4260
diff
changeset
|
5756 |
if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5757 |
begin |
4258 | 5758 |
Gear^.Damage:= i; |
10634
35d059bd0932
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents:
10597
diff
changeset
|
5759 |
FreeAndNilTexture(Gear^.Tex); |
13882 | 5760 |
Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))), |
13645
cb0191394133
Use full string for sidFuel and avoid string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents:
13629
diff
changeset
|
5761 |
cWhiteColor, fntSmall) |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5762 |
end |
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5763 |
end |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5764 |
end; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5765 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5766 |
procedure doStepFlamethrower(Gear: PGear); |
8795 | 5767 |
var |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5768 |
HHGear: PGear; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5769 |
begin |
4365 | 5770 |
HHGear := Gear^.Hedgehog^.Gear; |
6450 | 5771 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight)); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5772 |
HHGear^.State := HHGear^.State or gstNotKickable; |
14637
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5773 |
(* NOTE: Flamethrower sound is supposed to start instantly (no fade in), |
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5774 |
but this would cause the game volume to screw up because of a bug in SDL_mixer: |
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5775 |
https://bugzilla.libsdl.org/show_bug.cgi?id=4205 |
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5776 |
As workaround, a tiny fade-in delay was added. |
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5777 |
FIXME: Remove the fade-in delay argument when the SDL bug has been fixed. *) |
5132548cdb77
Add workaround around an SDL_mixer bug that screws up volume after using flamethrower (bug 721)
Wuzzy <Wuzzy2@mail.ru>
parents:
14621
diff
changeset
|
5778 |
Gear^.SoundChannel := LoopSound(sndFlamethrower, 20); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5779 |
Gear^.doStep := @doStepFlamethrowerWork |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5780 |
end; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5781 |
|
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
5782 |
//////////////////////////////////////////////////////////////////////////////// |
5024 | 5783 |
procedure doStepLandGunWork(Gear: PGear); |
8795 | 5784 |
var |
7281 | 5785 |
HHGear, land: PGear; |
5024 | 5786 |
rx, ry, speed: hwFloat; |
5787 |
i, gX, gY: LongInt; |
|
5788 |
begin |
|
5789 |
AllInactive := false; |
|
5790 |
HHGear := Gear^.Hedgehog^.Gear; |
|
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5791 |
if HHGear = nil then |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5792 |
begin |
13990 | 5793 |
StopSoundChan(gear^.SoundChannel); |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5794 |
DeleteGear(gear); |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5795 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5796 |
end; |
5024 | 5797 |
HedgehogChAngle(HHGear); |
5798 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
|
5799 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
8795 | 5800 |
|
5024 | 5801 |
if (GameTicks and $FF) = 0 then |
5802 |
begin |
|
5803 |
if (HHGear^.Message and gmRight) <> 0 then |
|
5804 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5805 |
if HHGear^.dX.isNegative and (Gear^.Tag < 20) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5806 |
inc(Gear^.Tag) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5807 |
else if Gear^.Tag > 5 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5808 |
dec(Gear^.Tag); |
5024 | 5809 |
end |
5810 |
else if (HHGear^.Message and gmLeft) <> 0 then |
|
5811 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5812 |
if HHGear^.dX.isNegative and (Gear^.Tag > 5) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5813 |
dec(Gear^.Tag) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5814 |
else if Gear^.Tag < 20 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5815 |
inc(Gear^.Tag); |
5024 | 5816 |
end |
5817 |
end; |
|
8795 | 5818 |
|
5024 | 5819 |
dec(Gear^.Timer); |
5820 |
if Gear^.Timer = 0 then |
|
5821 |
begin |
|
5822 |
dec(Gear^.Health); |
|
5480 | 5823 |
|
7001 | 5824 |
rx := rndSign(getRandomf * _0_1); |
5825 |
ry := rndSign(getRandomf * _0_1); |
|
5480 | 5826 |
speed := (_3 / Gear^.Tag); |
5827 |
||
8795 | 5828 |
land:= AddGear(gx, gy, gtFlake, gstTmpFlag, |
5829 |
SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx, |
|
6126
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
5830 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
5831 |
land^.CollisionMask:= lfNotCurHogCrate; |
8795 | 5832 |
|
5024 | 5833 |
Gear^.Timer:= Gear^.Tag |
5834 |
end; |
|
5835 |
||
7539 | 5836 |
if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
5024 | 5837 |
begin |
14003
23fb123bd70c
Clear gmLeft/gmRight after using landspray/flamethrower to prevent accidental walking
Wuzzy <Wuzzy2@mail.ru>
parents:
14001
diff
changeset
|
5838 |
HHGear^.Message:= HHGear^.Message and (not (gmAttack or gmLeft or gmRight)); |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5839 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
13990 | 5840 |
StopSoundChan(gear^.SoundChannel); |
5024 | 5841 |
DeleteGear(Gear); |
5842 |
AfterAttack |
|
5843 |
end |
|
5844 |
else |
|
5845 |
begin |
|
5846 |
i:= Gear^.Health div 10; |
|
5847 |
if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
5848 |
begin |
|
5849 |
Gear^.Damage:= i; |
|
10634
35d059bd0932
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents:
10597
diff
changeset
|
5850 |
FreeAndNilTexture(Gear^.Tex); |
13882 | 5851 |
Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(i))), |
13645
cb0191394133
Use full string for sidFuel and avoid string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents:
13629
diff
changeset
|
5852 |
cWhiteColor, fntSmall) |
5024 | 5853 |
end |
5854 |
end |
|
5855 |
end; |
|
5856 |
||
5857 |
procedure doStepLandGun(Gear: PGear); |
|
8795 | 5858 |
var |
5024 | 5859 |
HHGear: PGear; |
5860 |
begin |
|
5861 |
HHGear := Gear^.Hedgehog^.Gear; |
|
6450 | 5862 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight or gmAttack)); |
5024 | 5863 |
HHGear^.State := HHGear^.State or gstNotKickable; |
13990 | 5864 |
Gear^.SoundChannel := LoopSound(sndLandGun); |
5024 | 5865 |
Gear^.doStep := @doStepLandGunWork |
5866 |
end; |
|
5867 |
||
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
5868 |
//////////////////////////////////////////////////////////////////////////////// |
3712 | 5869 |
procedure doStepPoisonCloud(Gear: PGear); |
5870 |
begin |
|
11240 | 5871 |
// don't bounce |
5872 |
if WorldEdge <> weBounce then |
|
5873 |
WorldWrap(Gear); |
|
3712 | 5874 |
if Gear^.Timer = 0 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5875 |
begin |
3712 | 5876 |
DeleteGear(Gear); |
5877 |
exit |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5878 |
end; |
3712 | 5879 |
dec(Gear^.Timer); |
5880 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
5881 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
3713 | 5882 |
Gear^.dX := Gear^.dX + cWindSpeed / 4; |
3712 | 5883 |
Gear^.dY := Gear^.dY + cGravity / 100; |
5340
6963e37f2dd2
- Allow snow to drop a bit outside the map, where it already is allowed to spawn
unc0rr
parents:
5336
diff
changeset
|
5884 |
if (GameTicks and $FF) = 0 then |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5885 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned); |
9817 | 5886 |
if Gear^.State and gstTmpFlag = 0 then |
5887 |
AllInactive:= false; |
|
3717 | 5888 |
end; |
5889 |
||
5890 |
//////////////////////////////////////////////////////////////////////////////// |
|
5891 |
procedure doStepHammer(Gear: PGear); |
|
3720 | 5892 |
var HHGear, tmp, tmp2: PGear; |
3717 | 5893 |
t: PGearArray; |
12626 | 5894 |
i, dmg: LongInt; |
3717 | 5895 |
begin |
4365 | 5896 |
HHGear:= Gear^.Hedgehog^.Gear; |
3717 | 5897 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
5898 |
DeleteCI(HHGear); |
|
11044
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5899 |
SetLittle(HHGear^.dY); |
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5900 |
HHGear^.dY.IsNegative:= true; |
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5901 |
HHGear^.State:= HHGear^.State or gstMoving; |
3717 | 5902 |
|
5903 |
t:= CheckGearsCollision(Gear); |
|
3720 | 5904 |
|
5905 |
for i:= 5 downto 0 do |
|
5906 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
|
5907 |
||
3717 | 5908 |
i:= t^.Count; |
5909 |
while i > 0 do |
|
5910 |
begin |
|
5911 |
dec(i); |
|
5912 |
tmp:= t^.ar[i]; |
|
5913 |
if (tmp^.State and gstNoDamage) = 0 then |
|
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5914 |
if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then |
3717 | 5915 |
begin |
11042 | 5916 |
dmg:= 0; |
10011
ead5e4b21671
Add check for gear kind of hedgehog on invulnerability effect. This probably fixes bug #766, is similar to change in previous r2a1483d91977 and was introduced by r7d925e82e572
nemo
parents:
9998
diff
changeset
|
5917 |
if (tmp^.Kind <> gtHedgehog) or (tmp^.Hedgehog^.Effects[heInvulnerable] = 0) then |
11039
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5918 |
begin |
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5919 |
// base damage on remaining health |
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5920 |
dmg:= (tmp^.Health - tmp^.Damage); |
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5921 |
if dmg > 0 then |
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5922 |
begin |
11282
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11240
diff
changeset
|
5923 |
// always rounding down |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
5924 |
dmg:= dmg div Gear^.Boom; |
11282
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11240
diff
changeset
|
5925 |
|
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11240
diff
changeset
|
5926 |
if dmg > 0 then |
14045
128fbd36eee4
Stop using dsUnknown, replace with concrete damage sources
Wuzzy <Wuzzy2@mail.ru>
parents:
14024
diff
changeset
|
5927 |
ApplyDamage(tmp, CurrentHedgehog, dmg, dsHammer); |
11039
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5928 |
end; |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
5929 |
tmp^.dY:= _0_03 * Gear^.Boom |
11042 | 5930 |
end; |
5931 |
||
5932 |
if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then |
|
5933 |
begin |
|
5934 |
tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); |
|
5935 |
tmp2^.LinkedGear:= tmp; |
|
5936 |
SetAllToActive |
|
5937 |
end; |
|
11039
cd4b0851b060
Hammer changes/fixes: honor extra-damage (Issue 975), round up damage, do correct damage when being spammed in infinite-attack mode
sheepluva
parents:
11020
diff
changeset
|
5938 |
end; |
3717 | 5939 |
end; |
5940 |
||
6450 | 5941 |
HHGear^.State:= HHGear^.State and (not gstNoDamage); |
3717 | 5942 |
Gear^.Timer:= 250; |
5943 |
Gear^.doStep:= @doStepIdle |
|
5944 |
end; |
|
3720 | 5945 |
|
5946 |
procedure doStepHammerHitWork(Gear: PGear); |
|
8795 | 5947 |
var |
5628 | 5948 |
i, j, ei: LongInt; |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5949 |
HitGear: PGear; |
3720 | 5950 |
begin |
5951 |
AllInactive := false; |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5952 |
HitGear := Gear^.LinkedGear; |
3720 | 5953 |
dec(Gear^.Timer); |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5954 |
if (HitGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then |
5628 | 5955 |
begin |
3720 | 5956 |
DeleteGear(Gear); |
5957 |
exit |
|
5628 | 5958 |
end; |
3720 | 5959 |
|
5960 |
if (Gear^.Timer mod 5) = 0 then |
|
5628 | 5961 |
begin |
3720 | 5962 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
5963 |
||
5628 | 5964 |
i := hwRound(Gear^.X) - HitGear^.Radius + 2; |
5965 |
ei := hwRound(Gear^.X) + HitGear^.Radius - 2; |
|
13609
73b096e1d895
Fix hammer/pickhammer not digging land with gfSolidLand on
Wuzzy <Wuzzy2@mail.ru>
parents:
13608
diff
changeset
|
5966 |
for j := 1 to 4 do doMakeExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw); |
73b096e1d895
Fix hammer/pickhammer not digging land with gfSolidLand on
Wuzzy <Wuzzy2@mail.ru>
parents:
13608
diff
changeset
|
5967 |
for j := 1 to 4 do doMakeExplosion(ei + LongInt(GetRandom(5)), hwRound(Gear^.Y) + 6*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw); |
3720 | 5968 |
while i <= ei do |
5628 | 5969 |
begin |
13609
73b096e1d895
Fix hammer/pickhammer not digging land with gfSolidLand on
Wuzzy <Wuzzy2@mail.ru>
parents:
13608
diff
changeset
|
5970 |
for j := 1 to 11 do doMakeExplosion(i, hwRound(Gear^.Y) + 3*j, 3, Gear^.Hedgehog, EXPLNoDamage or EXPLDoNotTouchAny or EXPLNoGfx or EXPLForceDraw); |
3720 | 5971 |
inc(i, 1) |
5628 | 5972 |
end; |
3720 | 5973 |
|
5974 |
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
|
13608 | 5975 |
, lfIndestructible) then |
5976 |
begin |
|
5977 |
Gear^.Y := Gear^.Y + _1_9 |
|
5978 |
end; |
|
3720 | 5979 |
end; |
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset
|
5980 |
if TestCollisionYwithGear(Gear, 1) <> 0 then |
5628 | 5981 |
begin |
3720 | 5982 |
Gear^.dY := _0; |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5983 |
SetLittle(HitGear^.dX); |
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5984 |
HitGear^.dY := _0; |
5628 | 5985 |
end |
3720 | 5986 |
else |
5628 | 5987 |
begin |
10354 | 5988 |
if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5989 |
Gear^.Timer := 1 |
5628 | 5990 |
end; |
3720 | 5991 |
|
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5992 |
HitGear^.X := Gear^.X; |
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5993 |
HitGear^.Y := Gear^.Y; |
5628 | 5994 |
SetLittle(HitGear^.dY); |
5995 |
HitGear^.Active:= true; |
|
3720 | 5996 |
end; |
5997 |
||
5998 |
procedure doStepHammerHit(Gear: PGear); |
|
8795 | 5999 |
var |
3720 | 6000 |
i, y: LongInt; |
6001 |
ar: TRangeArray; |
|
6002 |
HHGear: PGear; |
|
6003 |
begin |
|
6004 |
i := 0; |
|
4365 | 6005 |
HHGear := Gear^.Hedgehog^.Gear; |
3720 | 6006 |
|
6007 |
y := hwRound(Gear^.Y) - cHHRadius * 2; |
|
6008 |
while y < hwRound(Gear^.Y) do |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6009 |
begin |
3720 | 6010 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
6011 |
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
6012 |
inc(y, 2); |
|
6013 |
inc(i) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6014 |
end; |
3720 | 6015 |
|
6016 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
|
6017 |
Gear^.dY := HHGear^.dY; |
|
6018 |
DeleteCI(HHGear); |
|
6019 |
||
6020 |
doStepHammerHitWork(Gear); |
|
3821 | 6021 |
Gear^.doStep := @doStepHammerHitWork |
3720 | 6022 |
end; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6023 |
|
4293
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
6024 |
//////////////////////////////////////////////////////////////////////////////// |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6025 |
procedure doStepResurrectorWork(Gear: PGear); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6026 |
var |
7335 | 6027 |
graves: PGearArrayS; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6028 |
resgear: PGear; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6029 |
hh: PHedgehog; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6030 |
i: LongInt; |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6031 |
s: ansistring; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6032 |
begin |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6033 |
AllInactive := false; |
4365 | 6034 |
hh := Gear^.Hedgehog; |
4387 | 6035 |
|
6131 | 6036 |
if ((Gear^.Message and gmUp) <> 0) then |
4017
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
6037 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6038 |
if (GameTicks and $F) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6039 |
exit; |
8795 | 6040 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6041 |
else if (GameTicks and $1FF) <> 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6042 |
exit; |
4017
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
6043 |
|
6131 | 6044 |
if Gear^.Power < 45 then |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6045 |
begin |
4023
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
6046 |
inc(Gear^.Power); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6047 |
if TestCollisionYwithGear(hh^.Gear, -1) = 0 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6048 |
hh^.Gear^.Y := hh^.Gear^.Y - _1; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6049 |
end; |
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6050 |
|
4184
bc2b88eea8c4
fix stray offset in resurrector, make resurrector use time
nemo
parents:
4182
diff
changeset
|
6051 |
graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); |
4024
1ffb84b3823d
Resurrector: respect modified Gear position for resurrection range circle
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4023
diff
changeset
|
6052 |
|
7335 | 6053 |
if graves.size = 0 then |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6054 |
begin |
7053 | 6055 |
StopSoundChan(Gear^.SoundChannel); |
3975
3f605cca9215
Resurrector weapon: do not make it end turn, add description,
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3971
diff
changeset
|
6056 |
Gear^.Timer := 250; |
3f605cca9215
Resurrector weapon: do not make it end turn, add description,
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3971
diff
changeset
|
6057 |
Gear^.doStep := @doStepIdle; |
3f605cca9215
Resurrector weapon: do not make it end turn, add description,
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3971
diff
changeset
|
6058 |
exit; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6059 |
end; |
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6060 |
|
6131 | 6061 |
if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6062 |
begin |
7721 | 6063 |
if LongInt(graves.size) <= Gear^.Tag then Gear^.Tag:= 0; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6064 |
dec(hh^.Gear^.Health); |
4017
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
6065 |
if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then |
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
6066 |
hh^.Gear^.Damage:= 1; |
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
6067 |
RenderHealth(hh^); |
7399 | 6068 |
RecountTeamHealth(hh^.Team); |
7335 | 6069 |
inc(graves.ar^[Gear^.Tag]^.Health); |
4265
039b08012887
distribute health evenly amongst graves instead of randomly - avoid situation where a grave stays dead
nemo
parents:
4262
diff
changeset
|
6070 |
inc(Gear^.Tag) |
8795 | 6071 |
end |
6072 |
else |
|
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6073 |
begin |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6074 |
// now really resurrect the hogs with the hp saved in the graves |
7335 | 6075 |
for i:= 0 to graves.size - 1 do |
6076 |
if graves.ar^[i]^.Health > 0 then |
|
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6077 |
begin |
11207 | 6078 |
resgear := AddGear(hwRound(graves.ar^[i]^.X), hwRound(graves.ar^[i]^.Y), gtHedgehog, gstWait, _0, _0, 0,graves.ar^[i]^.Pos); |
7335 | 6079 |
resgear^.Hedgehog := graves.ar^[i]^.Hedgehog; |
6080 |
resgear^.Health := graves.ar^[i]^.Health; |
|
6081 |
PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := resgear; |
|
7394 | 6082 |
graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy; |
7399 | 6083 |
graves.ar^[i]^.Active:= true; |
4372 | 6084 |
RenderHealth(resgear^.Hedgehog^); |
6085 |
RecountTeamHealth(resgear^.Hedgehog^.Team); |
|
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6086 |
resgear^.Hedgehog^.Effects[heResurrected]:= 1; |
14403
87562a68c41f
Fix some King Mode bugs causing minions not always being properly killed
Wuzzy <Wuzzy2@mail.ru>
parents:
14363
diff
changeset
|
6087 |
if resgear^.Hedgehog^.King then |
87562a68c41f
Fix some King Mode bugs causing minions not always being properly killed
Wuzzy <Wuzzy2@mail.ru>
parents:
14363
diff
changeset
|
6088 |
resgear^.Hedgehog^.Team^.hasKing:= true; |
13763
b1177e9c9ee9
Fix player rankings getting confused if a clan was revived
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
6089 |
{ Reviving a hog implies its clan is now alive, too. } |
b1177e9c9ee9
Fix player rankings getting confused if a clan was revived
Wuzzy <Wuzzy2@mail.ru>
parents:
13742
diff
changeset
|
6090 |
resgear^.Hedgehog^.Team^.Clan^.DeathLogged:= false; |
14621
4638aa2ea8f2
Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents:
14579
diff
changeset
|
6091 |
if (not resgear^.Hedgehog^.Team^.Passive) then |
4638aa2ea8f2
Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents:
14579
diff
changeset
|
6092 |
resgear^.Hedgehog^.Team^.Clan^.Passive:= false; |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6093 |
s:= ansistring(resgear^.Hedgehog^.Name); |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
6094 |
AddCaption(FormatA(GetEventString(eidResurrected), s), capcolDefault, capgrpMessage); |
4874 | 6095 |
// only make hat-less hedgehogs look like zombies, preserve existing hats |
7394 | 6096 |
|
4372 | 6097 |
if resgear^.Hedgehog^.Hat = 'NoHat' then |
7754 | 6098 |
LoadHedgehogHat(resgear^.Hedgehog^, 'Reserved/Zombie'); |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6099 |
end; |
4023
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
6100 |
|
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
6101 |
hh^.Gear^.dY := _0; |
4045 | 6102 |
hh^.Gear^.dX := _0; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6103 |
doStepHedgehogMoving(hh^.Gear); |
7053 | 6104 |
StopSoundChan(Gear^.SoundChannel); |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6105 |
Gear^.Timer := 250; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6106 |
Gear^.doStep := @doStepIdle; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6107 |
end |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6108 |
end; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6109 |
|
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6110 |
procedure doStepResurrector(Gear: PGear); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6111 |
var |
7335 | 6112 |
graves: PGearArrayS; |
8730
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6113 |
hh: PHedgehog; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6114 |
i: LongInt; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6115 |
begin |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6116 |
AllInactive := false; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6117 |
graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); |
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6118 |
|
7335 | 6119 |
if graves.size > 0 then |
6120 |
begin |
|
8730
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6121 |
hh := Gear^.Hedgehog; |
7335 | 6122 |
for i:= 0 to graves.size - 1 do |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6123 |
begin |
7335 | 6124 |
PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := nil; |
6125 |
graves.ar^[i]^.Health := 0; |
|
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6126 |
end; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6127 |
Gear^.doStep := @doStepResurrectorWork; |
8730
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6128 |
if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6129 |
begin |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6130 |
if LongInt(graves.size) <= Gear^.Tag then Gear^.Tag:= 0; |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6131 |
dec(hh^.Gear^.Health); |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6132 |
if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6133 |
hh^.Gear^.Damage:= 1; |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6134 |
RenderHealth(hh^); |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6135 |
RecountTeamHealth(hh^.Team); |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6136 |
inc(graves.ar^[Gear^.Tag]^.Health); |
b39f433f8ab4
at vatten's request. make resurrection always resurrect at least 1 hp out of kindness to noobs who can't be bothered to read tooltips
nemo
parents:
8727
diff
changeset
|
6137 |
inc(Gear^.Tag) |
8795 | 6138 |
end |
6139 |
end |
|
6140 |
else |
|
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6141 |
begin |
7053 | 6142 |
StopSoundChan(Gear^.SoundChannel); |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6143 |
Gear^.Timer := 250; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6144 |
Gear^.doStep := @doStepIdle; |
4044
de7170e51cc6
Check for collision with surfaces above when levitating hog, use more typical drawing syntax for the resurrector wep, restore typical indentation
nemo
parents:
4038
diff
changeset
|
6145 |
end |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6146 |
end; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
6147 |
|
4293
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
6148 |
//////////////////////////////////////////////////////////////////////////////// |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6149 |
procedure doStepNapalmBomb(Gear: PGear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6150 |
var |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6151 |
i, gX, gY: LongInt; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6152 |
dX, dY: hwFloat; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6153 |
begin |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6154 |
AllInactive := false; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6155 |
doStepFallingGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6156 |
if (Gear^.Timer > 0) and ((Gear^.State and gstCollision) <> 0) then |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6157 |
begin |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
6158 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear^.Hedgehog, EXPLAutoSound); |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6159 |
gX := hwRound(Gear^.X); |
8795 | 6160 |
gY := hwRound(Gear^.Y); |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6161 |
for i:= 0 to 10 do |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6162 |
begin |
7001 | 6163 |
dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandomf + _1); |
6164 |
dY := AngleSin(i * 8) * _0_5 * (GetRandomf + _1); |
|
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6165 |
AddGear(gX, gY, gtFlame, 0, dX, dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6166 |
AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6167 |
AddGear(gX, gY, gtFlame, 0, -dX, dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6168 |
AddGear(gX, gY, gtFlame, 0, -dX, -dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6169 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6170 |
DeleteGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6171 |
exit |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6172 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6173 |
if (Gear^.Timer = 0) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6174 |
begin |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
6175 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, Gear^.Hedgehog, EXPLAutoSound); |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6176 |
for i:= -19 to 19 do |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6177 |
FollowGear := AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6178 |
DeleteGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6179 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6180 |
end; |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6181 |
if (GameTicks and $3F) = 0 then |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6182 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6183 |
dec(Gear^.Timer) |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6184 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
6185 |
|
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
6186 |
//////////////////////////////////////////////////////////////////////////////// |
5706 | 6187 |
(* |
8795 | 6188 |
TARDIS needs |
5706 | 6189 |
Warp in. Pos = 1 |
6190 |
Pause. Pos = 2 |
|
6191 |
Hide gear (TARDIS hedgehog was nil) |
|
6192 |
Warp out. Pos = 3 |
|
6193 |
... idle active for some time period ... Pos = 4 |
|
6194 |
Warp in. Pos = 1 |
|
6195 |
Pause. Pos = 2 |
|
6196 |
Restore gear (TARDIS hedgehog was not nil) |
|
6197 |
Warp out. Pos = 3 |
|
6198 |
*) |
|
6199 |
||
6200 |
procedure doStepTardisWarp(Gear: PGear); |
|
6201 |
var HH: PHedgehog; |
|
6202 |
i,j,cnt: LongWord; |
|
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6203 |
s: ansistring; |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6204 |
begin |
5706 | 6205 |
HH:= Gear^.Hedgehog; |
6206 |
if Gear^.Pos = 2 then |
|
6207 |
begin |
|
7053 | 6208 |
StopSoundChan(Gear^.SoundChannel); |
12677
c98179b00740
Fix short sound breakdown shortly after using time box
Wuzzy <almikes@aol.com>
parents:
12661
diff
changeset
|
6209 |
Gear^.SoundChannel:= -1; |
5706 | 6210 |
if (Gear^.Timer = 0) then |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6211 |
begin |
5715
59a8dd33f274
Restore gear ASAP, add denied sound for illegal activation without wasting ammo.
nemo
parents:
5710
diff
changeset
|
6212 |
if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible = 0) then |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6213 |
begin |
5935 | 6214 |
AfterAttack; |
5706 | 6215 |
if Gear = CurAmmoGear then CurAmmoGear := nil; |
8795 | 6216 |
if (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and |
5977
0b1bfdd95310
Disable a bit of code from revision 4 that I'm pretty sure is not hit anymore, or we'd end up with plenty of doubled graves at a minimum. Also, clear gstWinner/gstLoser along with gstWait - still need to figure out why exactly those aren't rendering anymore though.
nemo
parents:
5972
diff
changeset
|
6217 |
((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then |
0b1bfdd95310
Disable a bit of code from revision 4 that I'm pretty sure is not hit anymore, or we'd end up with plenty of doubled graves at a minimum. Also, clear gstWinner/gstLoser along with gstWait - still need to figure out why exactly those aren't rendering anymore though.
nemo
parents:
5972
diff
changeset
|
6218 |
HideHog(HH) |
5706 | 6219 |
end |
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
6220 |
else if (HH^.GearHidden <> nil) then |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6221 |
begin |
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6222 |
RestoreHog(HH); |
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6223 |
s:= ansistring(HH^.Name); |
13647
3d14950641a4
Refactor text color variable names, export 2 color values to Lua
Wuzzy <Wuzzy2@mail.ru>
parents:
13645
diff
changeset
|
6224 |
AddCaption(FormatA(GetEventString(eidTimeTravelEnd), s), capcolDefault, capgrpMessage) |
12174
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12125
diff
changeset
|
6225 |
end |
5706 | 6226 |
end; |
6227 |
||
5971 | 6228 |
inc(Gear^.Timer); |
5706 | 6229 |
if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then |
6230 |
begin |
|
5728 | 6231 |
Gear^.SoundChannel := LoopSound(sndTardis); |
6232 |
Gear^.Pos:= 3 |
|
6233 |
end |
|
5706 | 6234 |
end; |
6235 |
||
6131 | 6236 |
if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then |
5935 | 6237 |
begin |
6238 |
inc(Gear^.Power); |
|
8795 | 6239 |
if (Gear^.Power = 172) and (HH^.Gear <> nil) and |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6240 |
(HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6241 |
((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6242 |
with HH^.Gear^ do |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6243 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6244 |
State:= State or gstAnimation; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6245 |
Tag:= 2; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6246 |
Timer:= 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6247 |
Pos:= 0 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6248 |
end |
5935 | 6249 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6250 |
if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6251 |
dec(Gear^.Power); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6252 |
if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6253 |
Gear^.Pos:= 2; |
5706 | 6254 |
if (Gear^.Pos = 3) and (Gear^.Power = 0) then |
6255 |
begin |
|
7053 | 6256 |
StopSoundChan(Gear^.SoundChannel); |
12677
c98179b00740
Fix short sound breakdown shortly after using time box
Wuzzy <almikes@aol.com>
parents:
12661
diff
changeset
|
6257 |
Gear^.SoundChannel:= -1; |
5710 | 6258 |
if HH^.GearHidden = nil then |
6259 |
begin |
|
6260 |
DeleteGear(Gear); |
|
6261 |
exit |
|
6262 |
end; |
|
5706 | 6263 |
Gear^.Pos:= 4; |
6264 |
// This condition might need tweaking |
|
8632
b5ed76d2a1f9
Make hogs thaw only on enemy turns, make timebox counter decrement only on your turn, adjust knock for frozen hogs, increase damage on frozen hogs, make freezer fuel only reduce when not adjusting angle.
nemo
parents:
8628
diff
changeset
|
6265 |
Gear^.Timer:= GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime |
5706 | 6266 |
end; |
6267 |
||
6268 |
if (Gear^.Pos = 4) then |
|
6269 |
begin |
|
6270 |
cnt:= 0; |
|
6271 |
for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do |
|
9470 | 6272 |
with HH^.Team^.Clan^.Teams[j]^ do |
6273 |
for i:= 0 to Pred(HedgehogsNumber) do |
|
6274 |
if (Hedgehogs[i].Gear <> nil) |
|
6275 |
and ((Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
|
6276 |
and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage) then |
|
6277 |
inc(cnt); |
|
5706 | 6278 |
if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6279 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6280 |
if HH^.GearHidden <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
6281 |
FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); |
8795 | 6282 |
|
6131 | 6283 |
if HH^.GearHidden <> nil then |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6284 |
begin |
5738 | 6285 |
Gear^.X:= HH^.GearHidden^.X; |
6286 |
Gear^.Y:= HH^.GearHidden^.Y; |
|
7092
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6287 |
end; |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6288 |
Gear^.Timer:= 0; |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6289 |
|
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6290 |
if (HH^.GearHidden <> nil) and (cnt = 0) then // do an emergency jump back in this case. the team needs you! |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6291 |
begin |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6292 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplosion); |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6293 |
Gear^.Pos:= 2; |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6294 |
Gear^.Power:= 255; |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6295 |
end |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6296 |
else begin |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6297 |
Gear^.SoundChannel := LoopSound(sndTardis); |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6298 |
Gear^.Pos:= 1; |
c9ca770fd7fc
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
nemo
parents:
7068
diff
changeset
|
6299 |
Gear^.Power:= 0; |
5706 | 6300 |
end |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6301 |
end |
8632
b5ed76d2a1f9
Make hogs thaw only on enemy turns, make timebox counter decrement only on your turn, adjust knock for frozen hogs, increase damage on frozen hogs, make freezer fuel only reduce when not adjusting angle.
nemo
parents:
8628
diff
changeset
|
6302 |
else if (CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan) then dec(Gear^.Timer) |
5706 | 6303 |
end; |
6304 |
||
6305 |
end; |
|
6306 |
||
6307 |
procedure doStepTardis(Gear: PGear); |
|
12717
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6308 |
var HH: PHedgehog; |
5706 | 6309 |
begin |
6310 |
HH:= Gear^.Hedgehog; |
|
12717
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6311 |
if (not CanUseTardis(HH^.Gear)) then |
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6312 |
begin |
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6313 |
HH^.Gear^.Message := HH^.Gear^.Message and (not gmAttack); |
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6314 |
HH^.Gear^.State:= HH^.Gear^.State and (not gstAttacking); |
5715
59a8dd33f274
Restore gear ASAP, add denied sound for illegal activation without wasting ammo.
nemo
parents:
5710
diff
changeset
|
6315 |
PlaySound(sndDenied); |
12717
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6316 |
DeleteGear(Gear); |
5706 | 6317 |
exit |
12717
31f7e0a31736
AI player checks if it can use tardis before selecting it
Wuzzy <almikes@aol.com>
parents:
12705
diff
changeset
|
6318 |
end; |
5728 | 6319 |
Gear^.SoundChannel := LoopSound(sndTardis); |
5706 | 6320 |
Gear^.doStep:= @doStepTardisWarp |
5197
9fa96377a69c
Basic TARDIS implementation. Still needs proper animation, and probably a check to force reappearance on death of last team mate
nemo
parents:
5186
diff
changeset
|
6321 |
end; |
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
6322 |
|
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
6323 |
//////////////////////////////////////////////////////////////////////////////// |
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset
|
6324 |
|
7007 | 6325 |
(* |
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
6326 |
The ice gun has the following effects: |
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
6327 |
A "ray" like a deagle is projected out from the gun. |
8795 | 6328 |
All these effects assume the ray's angle is not changed and that the target type was unchanged over a number of ticks. This is a simplifying assumption for "gun was applying freezing effect to the same target". |
7007 | 6329 |
* When fired at water a layer of ice textured land is added above the water. |
8751
4609823efc94
More flagging of Land values. Also use less than for tests of non-terrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset
|
6330 |
* When fired at non-ice land (land and lfLandMask and not lfIce) the land is overlaid with a thin layer of ice textured land around that point (say, 1 or 2px into land, 1px above). For attractiveness, a slope would probably be needed. |
11195 | 6331 |
* When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. |
6332 |
As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. |
|
6333 |
If the effect is interrupted before reaching the top, the freezing state is cleared. |
|
6334 |
A frozen hog will animate differently. |
|
14577
34e810295d08
Remove a bunch of dead out-commented code
Wuzzy <Wuzzy2@mail.ru>
parents:
14575
diff
changeset
|
6335 |
Frozen hogs take less damage and are harder to push. |
11195 | 6336 |
This might make freezing potentially useful for friendlies in a bad position. |
6337 |
A frozen hog stays frozen for a certain number of turns. |
|
6338 |
Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again. |
|
7007 | 6339 |
*) |
8548 | 6340 |
|
6341 |
||
6342 |
procedure updateFuel(Gear: PGear); |
|
8795 | 6343 |
var |
8548 | 6344 |
t:LongInt; |
6345 |
begin |
|
6346 |
t:= Gear^.Health div 10; |
|
6347 |
if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
6348 |
begin |
|
6349 |
Gear^.Damage:= t; |
|
10634
35d059bd0932
Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents:
10597
diff
changeset
|
6350 |
FreeAndNilTexture(Gear^.Tex); |
13882 | 6351 |
Gear^.Tex := RenderStringTex(FormatA(trmsg[sidFuel], ansistring(inttostr(t))), |
13645
cb0191394133
Use full string for sidFuel and avoid string concatenation
Wuzzy <Wuzzy2@mail.ru>
parents:
13629
diff
changeset
|
6352 |
cWhiteColor, fntSmall) |
8548 | 6353 |
end; |
8934
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6354 |
if Gear^.Message and (gmUp or gmDown) <> 0 then |
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6355 |
begin |
13989 | 6356 |
if (Gear^.Tag <> 2) then |
6357 |
begin |
|
6358 |
StopSoundChan(Gear^.SoundChannel); |
|
6359 |
Gear^.SoundChannel:= LoopSound(sndIceBeamIdle); |
|
6360 |
Gear^.Tag:= 2; |
|
6361 |
end; |
|
8934
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6362 |
if GameTicks mod 40 = 0 then dec(Gear^.Health) |
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6363 |
end |
10015 | 6364 |
else |
9072 | 6365 |
begin |
13989 | 6366 |
if (Gear^.Tag <> 1) then |
6367 |
begin |
|
6368 |
StopSoundChan(Gear^.SoundChannel); |
|
6369 |
Gear^.SoundChannel:= LoopSound(sndIceBeam); |
|
6370 |
Gear^.Tag:= 1; |
|
6371 |
end; |
|
9072 | 6372 |
if GameTicks mod 10 = 0 then dec(Gear^.Health) |
6373 |
end |
|
8548 | 6374 |
end; |
6375 |
||
6376 |
||
6377 |
procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
|
6378 |
begin |
|
6379 |
with Gear^ do |
|
6380 |
begin |
|
6381 |
dX:= newX; |
|
6382 |
dY:= newY; |
|
6383 |
Pos:= 0; |
|
6384 |
Target.X:= NoPointX; |
|
6385 |
LastDamage:= nil; |
|
6386 |
X:= Hedgehog^.Gear^.X; |
|
6387 |
Y:= Hedgehog^.Gear^.Y; |
|
6388 |
end; |
|
6389 |
end; |
|
6390 |
||
7007 | 6391 |
procedure doStepIceGun(Gear: PGear); |
9145 | 6392 |
const iceWaitCollision = 0; |
6393 |
const iceCollideWithGround = 1; |
|
6394 |
const iceCollideWithWater = 5; |
|
6395 |
const groundFreezingTime = 1000; |
|
8601
7668f92734b8
Make refactoring. Remove DrawIce function
Urbertar@gmail.com
parents:
8599
diff
changeset
|
6396 |
const iceRadius = 32; |
8602 | 6397 |
const iceHeight = 40; |
7716 | 6398 |
var |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6399 |
HHGear, iter: PGear; |
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6400 |
landRect: TSDL_Rect; |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6401 |
ndX, ndY: hwFloat; |
9137
d987230b85ed
fixed all engine compilation hints and notes (that I could see)
sheepluva
parents:
9080
diff
changeset
|
6402 |
i, t, gX, gY: LongInt; |
7335 | 6403 |
hogs: PGearArrayS; |
8934
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6404 |
vg: PVisualGear; |
7007 | 6405 |
begin |
7093 | 6406 |
HHGear := Gear^.Hedgehog^.Gear; |
9356 | 6407 |
if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or ((HHGear^.State and gstHHDriven) = 0) or (HHGear^.dX.QWordValue > 4294967) then |
7093 | 6408 |
begin |
9072 | 6409 |
StopSoundChan(Gear^.SoundChannel); |
7093 | 6410 |
DeleteGear(Gear); |
6411 |
AfterAttack; |
|
6412 |
exit |
|
8934
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6413 |
end; |
a4ec39eac0be
So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
nemo
parents:
8924
diff
changeset
|
6414 |
updateFuel(Gear); |
14575
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6415 |
if (WorldEdge <> weBounce) then |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6416 |
if WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.Target.X = NoPointX) then |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6417 |
// Use FlightTime to count number of times the gear has world-wrapped |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6418 |
inc(Gear^.FlightTime); |
8548 | 6419 |
|
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6420 |
with Gear^ do |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6421 |
begin |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6422 |
HedgehogChAngle(HHGear); |
7093 | 6423 |
ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
6424 |
ndY:= -AngleCos(HHGear^.Angle) * _4; |
|
13979
4d0c80f7aa32
Fix freezer ray extending with low fuel usage when firing straight up/down while holding up/down key
Wuzzy <Wuzzy2@mail.ru>
parents:
13961
diff
changeset
|
6425 |
if (ndX <> dX) or (ndY <> dY) or (Gear^.Message and (gmUp or gmDown) <> 0) or |
13404 | 6426 |
(((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
10582 | 6427 |
(Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0)) and |
14575
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6428 |
(not CheckCoordInWater(Target.X, Target.Y))) and (CheckGearNear(gtAirMine, int2hwFloat(Target.X),int2hwFloat(Target.Y), Gear^.Radius*3, Gear^.Radius*3) = nil) and |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6429 |
(not ((WorldEdge = weBounce) and ((Target.X > rightX) or (Target.X < leftX))))) then |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6430 |
begin |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6431 |
updateTarget(Gear, ndX, ndY); |
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6432 |
Timer := iceWaitCollision; |
13577
a71e6856ffab
Fix freeze ray not working through wrap world edge; add DrawLineWrapped
Wuzzy <Wuzzy2@mail.ru>
parents:
13571
diff
changeset
|
6433 |
FlightTime := 0; |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6434 |
end |
14565
45c6c12c12e2
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
Wuzzy <Wuzzy2@mail.ru>
parents:
14562
diff
changeset
|
6435 |
// Extend ice beam, unless it is far outside he map boundaries |
45c6c12c12e2
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
Wuzzy <Wuzzy2@mail.ru>
parents:
14562
diff
changeset
|
6436 |
else if (not ((hwRound(X + dX) > max(LAND_WIDTH,4096)*2) or |
45c6c12c12e2
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
Wuzzy <Wuzzy2@mail.ru>
parents:
14562
diff
changeset
|
6437 |
(hwRound(X + dX) < -max(LAND_WIDTH,4096)*2) or |
45c6c12c12e2
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
Wuzzy <Wuzzy2@mail.ru>
parents:
14562
diff
changeset
|
6438 |
(hwRound(Y + dY) < -max(LAND_HEIGHT,4096)*2) or |
45c6c12c12e2
Fix wrong ice beam angle if it goes diagonally up out of map thru world wrap (bug 718)
Wuzzy <Wuzzy2@mail.ru>
parents:
14562
diff
changeset
|
6439 |
(hwRound(Y + dY) > max(LAND_HEIGHT,4096)+512))) then |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6440 |
begin |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6441 |
X:= X + dX; |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6442 |
Y:= Y + dY; |
7093 | 6443 |
gX:= hwRound(X); |
8795 | 6444 |
gY:= hwRound(Y); |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6445 |
if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
8548 | 6446 |
|
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6447 |
if Target.X <> NoPointX then |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6448 |
begin |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6449 |
CheckCollision(Gear); |
13409
8ce83caec236
Make mine active/hunting glow a bit more obvious. Add frozen sprite, increase ice beam mine "hit" radius a bit
nemo
parents:
13408
diff
changeset
|
6450 |
if ((State and gstCollision) <> 0) or (CheckGearNear(gtAirMine, int2hwFloat(Target.X),int2hwFloat(Target.Y), Gear^.Radius*4, Gear^.Radius*4) <> nil) then |
8548 | 6451 |
begin |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6452 |
if Timer = iceWaitCollision then |
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6453 |
begin |
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6454 |
Timer := iceCollideWithGround; |
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6455 |
Power := GameTicks; |
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6456 |
end |
8795 | 6457 |
end |
10582 | 6458 |
else if CheckCoordInWater(Target.X, Target.Y) or |
6459 |
((Target.X and LAND_WIDTH_MASK = 0) and |
|
6460 |
(Target.Y and LAND_HEIGHT_MASK = 0) and |
|
6461 |
(Land[Target.Y, Target.X] = lfIce) and |
|
6462 |
((Target.Y+iceHeight+5 > cWaterLine) or |
|
6463 |
((WorldEdge = weSea) and |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
6464 |
((Target.X+iceHeight+5 > rightX) or |
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
6465 |
(Target.X-iceHeight-5 < leftX)))) |
10582 | 6466 |
) then |
8602 | 6467 |
begin |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6468 |
if Timer = iceWaitCollision then |
8602 | 6469 |
begin |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6470 |
Timer := iceCollideWithWater; |
8795 | 6471 |
Power := GameTicks; |
8602 | 6472 |
end; |
8548 | 6473 |
end; |
6474 |
||
7098
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
6475 |
if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
8602 | 6476 |
begin |
7098
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
6477 |
X:= HHGear^.X; |
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
6478 |
Y:= HHGear^.Y |
8602 | 6479 |
end; |
8548 | 6480 |
|
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6481 |
if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then |
8795 | 6482 |
begin |
9885
34e8880f1f0a
missed this in the merge. rejected the uGearsHandlersMess changes thinking they were all desyncing, but there was the function rename from uLandGraphics
nemo
parents:
9881
diff
changeset
|
6483 |
FillRoundInLandFT(target.x, target.y, iceRadius, icePixel); |
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6484 |
landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6485 |
landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6486 |
landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6487 |
landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6488 |
UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
10015 | 6489 |
|
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6490 |
// Freeze nearby mines/explosives/cases too |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6491 |
iter := GearsList; |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6492 |
while iter <> nil do |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6493 |
begin |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6494 |
if (iter^.State and gstFrozen = 0) and |
13404 | 6495 |
((iter^.Kind = gtExplosives) or (iter^.Kind = gtAirMine) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine) or (iter^.Kind = gtSMine)) and |
14352
1dcc37b6913e
Fix freezer failing to freeze gears with negative coordinate
Wuzzy <Wuzzy2@mail.ru>
parents:
14351
diff
changeset
|
6496 |
(abs(hwRound(iter^.X) - target.x) + abs(hwRound(iter^.Y) - target.y) + 2 < 2 * iceRadius) |
9954 | 6497 |
and (Distance(iter^.X - int2hwFloat(target.x), iter^.Y - int2hwFloat(target.y)) < int2hwFloat(iceRadius * 2)) then |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6498 |
begin |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6499 |
for t:= 0 to 5 do |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6500 |
begin |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6501 |
vg:= AddVisualGear(hwRound(iter^.X)+random(4)-8, hwRound(iter^.Y)+random(8), vgtDust, 1); |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6502 |
if vg <> nil then |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6503 |
begin |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6504 |
i:= random(100) + 155; |
9145 | 6505 |
vg^.Tint:= (i shl 24) or (i shl 16) or ($FF shl 8) or (random(200) + 55); |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6506 |
vg^.Angle:= random(360); |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6507 |
vg^.dx:= 0.001 * random(80); |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6508 |
vg^.dy:= 0.001 * random(80) |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6509 |
end |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6510 |
end; |
9077
e8d9d94c122f
Waddaya think. Add it for iced up water and mines/cases/explosives
nemo
parents:
9076
diff
changeset
|
6511 |
PlaySound(sndHogFreeze); |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6512 |
if iter^.Kind = gtMine then // dud mine block |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6513 |
begin |
9251 | 6514 |
iter^.State:= iter^.State or gstFrozen; |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6515 |
vg:= AddVisualGear(hwRound(iter^.X) - 4 + Random(8), hwRound(iter^.Y) - 4 - Random(4), vgtSmoke); |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6516 |
if vg <> nil then |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6517 |
vg^.Scale:= 0.5; |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6518 |
PlaySound(sndVaporize); |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6519 |
iter^.Health := 0; |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6520 |
iter^.Damage := 0; |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6521 |
iter^.State := iter^.State and (not gstAttacking) |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6522 |
end |
12305
6486a012987e
Make sticky mines fall off the map when frozen
Wuzzy <almikes@aol.com>
parents:
12304
diff
changeset
|
6523 |
else if iter^.Kind = gtSMine then // disabe sticky mine and drop it into the water |
12304
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6524 |
begin |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6525 |
iter^.State:= iter^.State or gstFrozen; |
12305
6486a012987e
Make sticky mines fall off the map when frozen
Wuzzy <almikes@aol.com>
parents:
12304
diff
changeset
|
6526 |
iter^.CollisionMask:= 0; |
12304
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6527 |
vg:= AddVisualGear(hwRound(iter^.X) - 2 + Random(4), hwRound(iter^.Y) - 2 - Random(2), vgtSmoke); |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6528 |
if vg <> nil then |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6529 |
vg^.Scale:= 0.4; |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6530 |
PlaySound(sndVaporize); |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6531 |
iter^.State := iter^.State and (not gstAttacking) |
6b25d117a904
Freezer allows to freeze sticky mines (currently only disables them)
Wuzzy <almikes@aol.com>
parents:
12297
diff
changeset
|
6532 |
end |
9041
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6533 |
else if iter^.Kind = gtCase then |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6534 |
begin |
aefe46d64dd9
Make frozen crates uncollectable, add some tinting to frozen items. Suggestions needed for what should happen to explosives
nemo
parents:
9026
diff
changeset
|
6535 |
DeleteCI(iter); |
9251 | 6536 |
iter^.State:= iter^.State or gstFrozen; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
6537 |
AddCI(iter) |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6538 |
end |
13404 | 6539 |
else if iter^.Kind = gtAirMine then |
6540 |
begin |
|
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6541 |
iter^.Damage:= 0; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6542 |
iter^.State:= iter^.State or gstFrozen; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6543 |
if (hwRound(iter^.X) < RightX-16) and (hwRound(iter^.X) > LeftX+16) and |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6544 |
(hwRound(iter^.Y) > topY+16) and (hwRound(iter^.Y) < LAND_HEIGHT-16) then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6545 |
begin |
14351
22c91ac48d38
Do not call AddCI when air mine is frozen without creating land
Wuzzy <Wuzzy2@mail.ru>
parents:
14349
diff
changeset
|
6546 |
AddCI(iter); |
14561 | 6547 |
iter^.X:= int2hwFloat(min(RightX-16,max(hwRound(iter^.X), LeftX+16))); |
6548 |
iter^.Y:= int2hwFloat(min(LAND_HEIGHT-16,max(hwRound(iter^.Y),TopY+16))); |
|
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6549 |
ForcePlaceOnLand(hwRound(iter^.X)-16, hwRound(iter^.Y)-16, sprFrozenAirMine, 0, lfIce, $FFFFFFFF, false, false, false); |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6550 |
iter^.State:= iter^.State or gstInvisible |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6551 |
end |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6552 |
else |
14561 | 6553 |
begin |
6554 |
updateTarget(Gear, ndX, ndY); |
|
6555 |
FlightTime := 0; |
|
6556 |
Timer := iceWaitCollision; |
|
6557 |
Power := GameTicks; |
|
14363
1f87c7c2b151
Make sad Pas2C happy again (add missing parenthesis around a "not")
Wuzzy <Wuzzy2@mail.ru>
parents:
14352
diff
changeset
|
6558 |
iter^.State:= iter^.State and (not gstNoGravity) |
14561 | 6559 |
end |
13404 | 6560 |
end |
9045
6561c42399d3
sheepluva suggestion for frozen barrel behaviour. untested.
nemo
parents:
9043
diff
changeset
|
6561 |
else // gtExplosives |
9251 | 6562 |
begin |
6563 |
iter^.State:= iter^.State or gstFrozen; |
|
9045
6561c42399d3
sheepluva suggestion for frozen barrel behaviour. untested.
nemo
parents:
9043
diff
changeset
|
6564 |
iter^.Health:= iter^.Health + cBarrelHealth |
9251 | 6565 |
end |
9026
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6566 |
end; |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6567 |
iter:= iter^.NextGear |
f6074540bab2
Add gstFrozen state to mines/gears in range on frozen land creation, and set the mines to dud state. gstFrozen does nothing yet. Visually or otherwise.
nemo
parents:
8993
diff
changeset
|
6568 |
end; |
8795 | 6569 |
|
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6570 |
SetAllHHToActive; |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6571 |
Timer := iceWaitCollision; |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6572 |
Power:= GameTicks |
8602 | 6573 |
end; |
6574 |
||
10411 | 6575 |
if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime div 2) then |
8795 | 6576 |
begin |
9077
e8d9d94c122f
Waddaya think. Add it for iced up water and mines/cases/explosives
nemo
parents:
9076
diff
changeset
|
6577 |
PlaySound(sndHogFreeze); |
10582 | 6578 |
if CheckCoordInWater(Target.X, Target.Y) then |
6579 |
DrawIceBreak(Target.X, Target.Y, iceRadius, iceHeight) |
|
6580 |
else if Target.Y+iceHeight+5 > cWaterLine then |
|
6581 |
DrawIceBreak(Target.X, Target.Y+iceHeight+5, iceRadius, iceHeight) |
|
14287
6015b74eea55
overall, using LongInt for leftX/rightX results in fewer casts, since most comparisons are against ints.
nemo
parents:
14209
diff
changeset
|
6582 |
else if Target.X+iceHeight+5 > rightX then |
10582 | 6583 |
DrawIceBreak(Target.X+iceHeight+5, Target.Y, iceRadius, iceHeight) |
6584 |
else |
|
6585 |
DrawIceBreak(Target.X-iceHeight-5, Target.Y, iceRadius, iceHeight); |
|
8795 | 6586 |
SetAllHHToActive; |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6587 |
Timer := iceWaitCollision; |
8602 | 6588 |
end; |
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset
|
6589 |
// freeze nearby hogs |
8560 | 6590 |
hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
7335 | 6591 |
if hogs.size > 0 then |
6592 |
for i:= 0 to hogs.size - 1 do |
|
6593 |
if hogs.ar^[i] <> HHGear then |
|
8795 | 6594 |
if GameTicks mod 5 = 0 then |
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
6595 |
begin |
8565 | 6596 |
hogs.ar^[i]^.Active:= true; |
6597 |
if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] < 256 then |
|
6598 |
hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] := hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] + 1 |
|
6599 |
else if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] = 256 then |
|
9073 | 6600 |
begin |
9059 | 6601 |
hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 200000-1;//cHedgehogTurnTime + cReadyDelay |
9073 | 6602 |
PlaySound(sndHogFreeze); |
6603 |
end; |
|
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
6604 |
end; |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6605 |
inc(Pos) |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6606 |
end |
10582 | 6607 |
else if (t > 400) and (CheckCoordInWater(gX, gY) or |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6608 |
(((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0)) |
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset
|
6609 |
and (Land[gY, gX] <> 0))) then |
8812
fdac638c6f9a
oups. reused same variable twice. my bad. You know, maybe somewhere in uVariables or uGearsList should define what we use Gear variables for in each gear
nemo
parents:
8795
diff
changeset
|
6610 |
begin |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6611 |
Target.X:= gX; |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6612 |
Target.Y:= gY; |
7093 | 6613 |
X:= HHGear^.X; |
6614 |
Y:= HHGear^.Y |
|
13404 | 6615 |
end |
14575
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6616 |
else if (WorldEdge = weBounce) and ((gX > rightX) or (gX < leftX)) then |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6617 |
begin |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6618 |
Target.X:= gX; |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6619 |
Target.Y:= gY; |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6620 |
X:= HHGear^.X; |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6621 |
Y:= HHGear^.Y |
0da43a3d5500
Properly stop freezeray at bounce edge (instead of restarting the ray over and over again)
Wuzzy <Wuzzy2@mail.ru>
parents:
14573
diff
changeset
|
6622 |
end |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6623 |
else |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6624 |
begin |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6625 |
iter:= CheckGearNear(Gear, gtAirMine, Gear^.Radius*2, Gear^.Radius*2); |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6626 |
if (iter <> nil) and (iter^.State <> gstFrozen) then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6627 |
begin |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6628 |
Target.X:= gX; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6629 |
Target.Y:= gY; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6630 |
X:= HHGear^.X; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6631 |
Y:= HHGear^.Y |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6632 |
end |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6633 |
end; |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6634 |
end |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
7007
diff
changeset
|
6635 |
end; |
7007 | 6636 |
end; |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6637 |
|
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6638 |
procedure doStepAddAmmo(Gear: PGear); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6639 |
var a: TAmmoType; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6640 |
gi: PGear; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6641 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6642 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6643 |
else |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6644 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6645 |
CheckSum:= CheckSum xor GameTicks; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6646 |
gi := GearsList; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6647 |
while gi <> nil do |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6648 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6649 |
with gi^ do CheckSum:= CheckSum xor X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6650 |
AddRandomness(CheckSum); |
13219
9c81e34f1933
gtGenericFaller: Use Tag=1 to allow gtGenericFaller to be displaced randomly. Otherwise it is left alone
Wuzzy <Wuzzy2@mail.ru>
parents:
13166
diff
changeset
|
6651 |
if (gi^.Kind = gtGenericFaller) and (gi^.Tag = 1) then |
9c81e34f1933
gtGenericFaller: Use Tag=1 to allow gtGenericFaller to be displaced randomly. Otherwise it is left alone
Wuzzy <Wuzzy2@mail.ru>
parents:
13166
diff
changeset
|
6652 |
gi^.State:= gi^.State and (not gstTmpFlag); |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6653 |
gi := gi^.NextGear |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6654 |
end; |
13290 | 6655 |
if Gear^.Pos = posCaseUtility then |
6656 |
a:= GetUtility(Gear^.Hedgehog) |
|
6657 |
else a:= GetAmmo(Gear^.Hedgehog); |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6658 |
AddPickup(Gear^.Hedgehog^, a, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y)); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6659 |
DeleteGear(Gear) |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6660 |
end; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6661 |
end; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6662 |
|
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6663 |
procedure doStepGenericFaller(Gear: PGear); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6664 |
begin |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6665 |
if Gear^.Timer < $FFFFFFFF then |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6666 |
if Gear^.Timer > 0 then |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6667 |
dec(Gear^.Timer) |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6668 |
else |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6669 |
begin |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6670 |
DeleteGear(Gear); |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6671 |
exit |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6672 |
end; |
8030
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6673 |
if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6674 |
begin |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6675 |
doStepFallingGear(Gear); |
14291 | 6676 |
if (Gear^.Tag = 1) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX) or (hwRound(Gear^.Y) < topY) then |
8030
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6677 |
begin |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6678 |
Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX); |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6679 |
Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY); |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6680 |
Gear^.dX:= _90-(GetRandomf*_360); |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6681 |
Gear^.dY:= _90-(GetRandomf*_360) |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6682 |
end; |
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
6683 |
end |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7370
diff
changeset
|
6684 |
end; |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6685 |
|
13856
f01798038c2e
Rename amDuck and related symbols to amCreeper, gtCreeper, etc.
Wuzzy <Wuzzy2@mail.ru>
parents:
13855
diff
changeset
|
6686 |
// TODO: Finish creeper implementation |
7627 | 6687 |
procedure doStepCreeper(Gear: PGear); |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6688 |
var i,t,targDist,tmpDist: LongWord; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6689 |
targ, tmpG: PGear; |
13618
d6b79a080a3e
Remove unused variables of creeper handler
Wuzzy <Wuzzy2@mail.ru>
parents:
13615
diff
changeset
|
6690 |
tX, tY: hwFloat; |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6691 |
vg: PVisualGear; |
7627 | 6692 |
begin |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6693 |
targ:= nil; |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6694 |
doStepFallingGear(Gear); |
14346
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6695 |
if (Gear^.State and gstFrozen) <> 0 then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6696 |
begin |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6697 |
if Gear^.Damage > 0 then |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6698 |
begin |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6699 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6700 |
DeleteGear(Gear) |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6701 |
end; |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6702 |
exit |
d5317635f368
fix bounds check, make out of bounds air mines fall since there's no land to check them into
nemo
parents:
14345
diff
changeset
|
6703 |
end; |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6704 |
if (TurnTimeLeft = 0) or (Gear^.Angle = 0) or (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.Gear = nil) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6705 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6706 |
Gear^.Hedgehog:= nil; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6707 |
targ:= nil; |
7627 | 6708 |
end |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6709 |
else if Gear^.Hedgehog <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6710 |
targ:= Gear^.Hedgehog^.Gear; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6711 |
if (targ <> nil) and ((GameTicks and $3F) = 0) and (TestCollisionYKick(Gear, 1) <> 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6712 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6713 |
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6714 |
if vg <> nil then vg^.Tint:= $FF0000FF; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6715 |
if (Gear^.X < targ^.X) then // need to add collision checks to avoid walking off edges or getting too close to obstacles where jumping is needed |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6716 |
if (WorldEdge = weWrap) and ((targ^.X - Gear^.X) > ((Gear^.X - int2hwFloat(LeftX)) + (int2hwFloat(RightX) - targ^.X))) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6717 |
Gear^.dX:= -cLittle |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6718 |
else |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6719 |
Gear^.dX:= cLittle |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6720 |
else if (Gear^.X > targ^.X) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6721 |
if (WorldEdge = weWrap) and ((Gear^.X - targ^.X) > ((targ^.X - int2hwFloat(LeftX)) + (int2hwFloat(RightX) - Gear^.X))) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6722 |
Gear^.dX:= cLittle |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6723 |
else |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6724 |
Gear^.dX:= -cLittle; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6725 |
if (GetRandom(30) = 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6726 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6727 |
Gear^.dY := -_0_15; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6728 |
Gear^.dX:= SignAs(_0_15, Gear^.dX); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6729 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6730 |
MakeHedgehogsStep(Gear); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6731 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6732 |
if (TurnTimeLeft = 0) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6733 |
AllInactive := false; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6734 |
|
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6735 |
if targ <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6736 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6737 |
tX:=Gear^.X-targ^.X; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6738 |
tY:=Gear^.Y-targ^.Y; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6739 |
// allow escaping - should maybe flag this too |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6740 |
if (GameTicks > Gear^.FlightTime+10000) or |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6741 |
((tX.Round+tY.Round > Gear^.Angle*6) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6742 |
(hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6743 |
targ:= nil |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6744 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6745 |
|
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6746 |
// If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility) |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6747 |
// or mine is inactive due to lack of gsttmpflag or hunting is disabled due to seek radius of 0 |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6748 |
// then we aren't hunting |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6749 |
if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6750 |
((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6751 |
(Gear^.State and gsttmpFlag = 0) or |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6752 |
(Gear^.Angle = 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6753 |
gear^.State:= gear^.State and (not gstChooseTarget) |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6754 |
else if |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6755 |
// todo, allow not finding new target, set timeout on target retention |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6756 |
(Gear^.State and gstAttacking = 0) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6757 |
((GameTicks and $FF) = 17) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6758 |
(GameTicks > Gear^.FlightTime) then // recheck hunted hog |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6759 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6760 |
gear^.State:= gear^.State or gstChooseTarget; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6761 |
if targ <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6762 |
targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6763 |
else targDist:= 0; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6764 |
for t:= 0 to Pred(TeamsCount) do |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6765 |
with TeamsArray[t]^ do |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6766 |
for i:= 0 to cMaxHHIndex do |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6767 |
if Hedgehogs[i].Gear <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6768 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6769 |
tmpG:= Hedgehogs[i].Gear; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6770 |
tX:=Gear^.X-tmpG^.X; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6771 |
tY:=Gear^.Y-tmpG^.Y; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6772 |
if (Gear^.Angle = $FFFFFFFF) or |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6773 |
((tX.Round+tY.Round < Gear^.Angle) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6774 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle))) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6775 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6776 |
if targ <> nil then tmpDist:= Distance(tX,tY).Round; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6777 |
if (targ = nil) or (tmpDist < targDist) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6778 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6779 |
if targ = nil then targDist:= Distance(tX,tY).Round |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6780 |
else targDist:= tmpDist; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6781 |
Gear^.Hedgehog:= @Hedgehogs[i]; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6782 |
targ:= tmpG; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6783 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6784 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6785 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6786 |
if targ <> nil then Gear^.FlightTime:= GameTicks + 5000 |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6787 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6788 |
|
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6789 |
if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6790 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6791 |
if ((Gear^.State and gstAttacking) = 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6792 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6793 |
if ((GameTicks and $1F) = 0) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6794 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6795 |
if targ <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6796 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6797 |
tX:=Gear^.X-targ^.X; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6798 |
tY:=Gear^.Y-targ^.Y; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6799 |
if (tX.Round+tY.Round < Gear^.Boom) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6800 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Boom)) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6801 |
Gear^.State := Gear^.State or gstAttacking |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6802 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6803 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Boom, Gear^.Boom) <> nil) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6804 |
Gear^.State := Gear^.State or gstAttacking |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6805 |
end |
7627 | 6806 |
end |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6807 |
else // gstAttacking <> 0 |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6808 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6809 |
AllInactive := false; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6810 |
if (Gear^.Timer and $1FF) = 0 then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6811 |
PlaySound(sndVaporize); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6812 |
if Gear^.Timer = 0 then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6813 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6814 |
// recheck |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6815 |
if targ <> nil then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6816 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6817 |
tX:=Gear^.X-targ^.X; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6818 |
tY:=Gear^.Y-targ^.Y; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6819 |
if (tX.Round+tY.Round < Gear^.Boom) and |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6820 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Boom)) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6821 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6822 |
Gear^.Hedgehog:= CurrentHedgehog; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6823 |
tmpG:= FollowGear; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6824 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6825 |
FollowGear:= tmpG; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6826 |
DeleteGear(Gear); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6827 |
exit |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6828 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6829 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6830 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Boom, Gear^.Boom) <> nil) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6831 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6832 |
Gear^.Hedgehog:= CurrentHedgehog; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6833 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6834 |
DeleteGear(Gear); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6835 |
exit |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6836 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6837 |
Gear^.State:= Gear^.State and (not gstAttacking); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6838 |
Gear^.Timer:= Gear^.WDTimer |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6839 |
end; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6840 |
if Gear^.Timer > 0 then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6841 |
dec(Gear^.Timer); |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6842 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6843 |
end |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6844 |
else // gsttmpFlag = 0 |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6845 |
if (TurnTimeLeft = 0) |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6846 |
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6847 |
or (CurrentHedgehog^.Gear = nil) then |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6848 |
begin |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6849 |
Gear^.FlightTime:= GameTicks; |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6850 |
Gear^.State := Gear^.State or gsttmpFlag |
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6851 |
end |
7627 | 6852 |
end; |
13610
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13609
diff
changeset
|
6853 |
|
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6854 |
//////////////////////////////////////////////////////////////////////////////// |
7754 | 6855 |
procedure doStepKnife(Gear: PGear); |
8370 | 6856 |
var a: real; |
7754 | 6857 |
begin |
6858 |
// Gear is shrunk so it can actually escape the hog without carving into the terrain |
|
13469
7b4643ff60ea
Refactor collision mask checks, remove hardcoded numbers
Wuzzy <Wuzzy2@mail.ru>
parents:
13468
diff
changeset
|
6859 |
if (Gear^.Radius = 4) and (Gear^.CollisionMask = lfAll) then Gear^.Radius:= 7; |
7872
ab6db9e07c4d
Allow cleavers to be knocked loose by explosions. Probabilities might need tweaking.
nemo
parents:
7864
diff
changeset
|
6860 |
if Gear^.Damage > 100 then Gear^.CollisionMask:= 0 |
7874
c8aba48f38dc
Arbitrarily tweaked to not firepunch loose, and to increase chance of bazooka doing it to about 20%
nemo
parents:
7872
diff
changeset
|
6861 |
else if Gear^.Damage > 30 then |
c8aba48f38dc
Arbitrarily tweaked to not firepunch loose, and to increase chance of bazooka doing it to about 20%
nemo
parents:
7872
diff
changeset
|
6862 |
if GetRandom(max(4,18-Gear^.Damage div 10)) < 3 then Gear^.CollisionMask:= 0; |
7872
ab6db9e07c4d
Allow cleavers to be knocked loose by explosions. Probabilities might need tweaking.
nemo
parents:
7864
diff
changeset
|
6863 |
Gear^.Damage:= 0; |
7759 | 6864 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
7754 | 6865 |
if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then |
6866 |
begin |
|
6867 |
DeleteCI(Gear); |
|
8494
53b91a602955
Cleaver tweaks based on feedback. Nerf damage, shrink radius. This means cleaver will embed into ground quite a bit further.
nemo
parents:
8413
diff
changeset
|
6868 |
Gear^.Radius:= 7; |
7754 | 6869 |
// used for damage and impact calc. needs balancing I think |
11473
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11396
diff
changeset
|
6870 |
Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*Gear^.Boom/10000)); |
7754 | 6871 |
doStepFallingGear(Gear); |
6872 |
AllInactive := false; |
|
7864
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6873 |
a:= Gear^.DirAngle; |
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6874 |
CalcRotationDirAngle(Gear); |
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6875 |
Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation |
7754 | 6876 |
end |
7759 | 6877 |
else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then |
7754 | 6878 |
begin |
11770
10860d4bca22
Add sound effects for: cleaver impact, air mine impact, using extra time
Wuzzy <almikes@aol.com>
parents:
11558
diff
changeset
|
6879 |
if Gear^.Health > 0 then |
10860d4bca22
Add sound effects for: cleaver impact, air mine impact, using extra time
Wuzzy <almikes@aol.com>
parents:
11558
diff
changeset
|
6880 |
PlaySound(Gear^.ImpactSound); |
10860d4bca22
Add sound effects for: cleaver impact, air mine impact, using extra time
Wuzzy <almikes@aol.com>
parents:
11558
diff
changeset
|
6881 |
|
7784
cf6261f7fdb5
Disable jiggling of cleavers 'cause it just looks odd. Adding a constraint based on proximity to portal is an option too, this was just easier.
nemo
parents:
7777
diff
changeset
|
6882 |
Gear^.DirAngle:= DxDy2Angle(Gear^.dX, Gear^.dY) + (random(30)-15); |
7758
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6883 |
if (Gear^.dX.isNegative and Gear^.dY.isNegative) or |
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6884 |
((not Gear^.dX.isNegative) and (not Gear^.dY.isNegative)) then Gear^.DirAngle:= Gear^.DirAngle-90; |
7754 | 6885 |
Gear^.dX:= _0; |
6886 |
Gear^.dY:= _0; |
|
6887 |
Gear^.State:= Gear^.State and (not gstMoving) or gstCollision; |
|
8494
53b91a602955
Cleaver tweaks based on feedback. Nerf damage, shrink radius. This means cleaver will embed into ground quite a bit further.
nemo
parents:
8413
diff
changeset
|
6888 |
Gear^.Radius:= 16; |
7754 | 6889 |
if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0); |
6890 |
Gear^.Health:= 0; |
|
7759 | 6891 |
Gear^.Timer:= 500; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
6892 |
AddCI(Gear) |
7754 | 6893 |
end |
6894 |
else if GameTicks and $3F = 0 then |
|
6895 |
begin |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6896 |
if (TestCollisionYwithGear(Gear,-1) = 0) |
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6897 |
and (TestCollisionXwithGear(Gear, 1) = 0) |
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6898 |
and (TestCollisionXwithGear(Gear,-1) = 0) |
7754 | 6899 |
and (TestCollisionYwithGear(Gear, 1) = 0) then Gear^.State:= Gear^.State and (not gstCollision) or gstMoving; |
6900 |
end |
|
6901 |
end; |
|
12197 | 6902 |
|
6903 |
//////////////////////////////////////////////////////////////////////////////// |
|
12903 | 6904 |
procedure doStepMinigunWork(Gear: PGear); |
6905 |
var HHGear: PGear; |
|
6906 |
bullet: PGear; |
|
6907 |
rx, ry: hwFloat; |
|
6908 |
gX, gY: LongInt; |
|
6909 |
begin |
|
6910 |
AllInactive:= false; |
|
6911 |
HHGear := Gear^.Hedgehog^.Gear; |
|
6912 |
if HHGear = nil then |
|
6913 |
begin |
|
6914 |
ClearHitOrder(); |
|
6915 |
DeleteGear(gear); |
|
6916 |
exit |
|
6917 |
end; |
|
6918 |
||
6919 |
HedgehogChAngle(HHGear); |
|
6920 |
||
6921 |
dec(Gear^.Timer); |
|
6922 |
if (Gear^.Timer mod 50) = 0 then |
|
6923 |
begin |
|
6924 |
Gear^.Tag := ((Gear^.Tag - 1) and 1) + 2; |
|
6925 |
||
6926 |
gX := hwRound(Gear^.X) + GetLaunchX(amMinigun, hwSign(HHGear^.dX), HHGear^.Angle); |
|
6927 |
gY := hwRound(Gear^.Y) + GetLaunchY(amMinigun, HHGear^.Angle); |
|
6928 |
rx := rndSign(getRandomf * _0_2); |
|
6929 |
ry := rndSign(getRandomf * _0_2); |
|
6930 |
||
6931 |
bullet:= AddGear(gx, gy, gtMinigunBullet, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
|
13468
f1d349a52bc7
Refactor: lfCurrentHog→lfCurHogCrate, lfNotCurrentMask→lfNotCurHogCrate
Wuzzy <Wuzzy2@mail.ru>
parents:
13413
diff
changeset
|
6932 |
bullet^.CollisionMask:= lfNotCurHogCrate; |
12903 | 6933 |
bullet^.WDTimer := Gear^.WDTimer; |
6934 |
Inc(Gear^.WDTimer); |
|
6935 |
||
13152
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13145
diff
changeset
|
6936 |
CreateShellForGear(Gear, Gear^.Tag and 1); |
12903 | 6937 |
end; |
6938 |
||
6939 |
if (Gear^.Timer = 0) or ((HHGear^.State and gstHHDriven) = 0) then |
|
6940 |
begin |
|
13328 | 6941 |
if (HHGear^.State and gstHHDriven) = 0 then |
6942 |
StopSound(sndMinigun); |
|
12903 | 6943 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
6944 |
ClearHitOrder(); |
|
6945 |
DeleteGear(Gear); |
|
6946 |
AfterAttack |
|
6947 |
end |
|
6948 |
end; |
|
6949 |
||
6950 |
procedure doStepMinigun(Gear: PGear); |
|
6951 |
var HHGear: PGear; |
|
6952 |
begin |
|
6953 |
dec(Gear^.Timer); |
|
6954 |
if (Gear^.Timer mod 100) = 0 then |
|
6955 |
Gear^.Tag := (Gear^.Tag + 1) and 1; |
|
6956 |
||
6957 |
if Gear^.Timer = 0 then |
|
6958 |
begin |
|
6959 |
Gear^.Tag := 2; |
|
6960 |
HHGear := Gear^.Hedgehog^.Gear; |
|
6961 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown)); |
|
6962 |
HHGear^.State := HHGear^.State or gstNotKickable; |
|
6963 |
||
13159
44351ea57b71
Minigun: Move attack timer to Karma to make gear type more Lua-friendly
Wuzzy <Wuzzy2@mail.ru>
parents:
13158
diff
changeset
|
6964 |
Gear^.Timer := Gear^.Karma; |
12903 | 6965 |
Gear^.WDTimer := 0; // Order of the next bullet; |
6966 |
ClearHitOrder(); |
|
6967 |
Gear^.doStep := @doStepMinigunWork |
|
6968 |
end; |
|
6969 |
end; |
|
6970 |
||
6971 |
//////////////////////////////////////////////////////////////////////////////// |
|
6972 |
||
6973 |
procedure doStepMinigunBullet(Gear: PGear); |
|
6974 |
begin |
|
6975 |
Gear^.Data:= nil; |
|
6976 |
// remember who fired this |
|
6977 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
|
6978 |
Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear); |
|
6979 |
||
6980 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
|
6981 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
13156
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13152
diff
changeset
|
6982 |
Gear^.FlightTime := 0; |
12903 | 6983 |
Gear^.doStep := @doStepBulletWork |
6984 |
end; |
|
6985 |
||
9285 | 6986 |
end. |