author | unc0rr |
Tue, 15 Mar 2016 22:29:40 +0300 | |
branch | qmlfrontend |
changeset 11607 | f0dcdbb9b2fe |
parent 11553 | 5415e9d7436f |
child 11698 | e86feecadced |
child 11765 | 10860d4bca22 |
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); |
|
35 |
procedure makeHogsWorry(x, y: hwFloat; r: LongInt); |
|
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); |
|
50 |
procedure spawnBulletTrail(Bullet: PGear); |
|
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); |
|
11531 | 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); |
|
118 |
procedure doStepSineGunShotWork(Gear: PGear); |
|
119 |
procedure doStepSineGunShot(Gear: PGear); |
|
120 |
procedure doStepFlamethrowerWork(Gear: PGear); |
|
121 |
procedure doStepFlamethrower(Gear: PGear); |
|
122 |
procedure doStepLandGunWork(Gear: PGear); |
|
123 |
procedure doStepLandGun(Gear: PGear); |
|
124 |
procedure doStepPoisonCloud(Gear: PGear); |
|
125 |
procedure doStepHammer(Gear: PGear); |
|
126 |
procedure doStepHammerHitWork(Gear: PGear); |
|
127 |
procedure doStepHammerHit(Gear: PGear); |
|
128 |
procedure doStepResurrectorWork(Gear: PGear); |
|
129 |
procedure doStepResurrector(Gear: PGear); |
|
130 |
procedure doStepNapalmBomb(Gear: PGear); |
|
11468
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:
11391
diff
changeset
|
131 |
//procedure doStepStructure(Gear: PGear); |
9285 | 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); |
|
11468
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:
11391
diff
changeset
|
139 |
//procedure doStepCreeper(Gear: PGear); |
9285 | 140 |
procedure doStepKnife(Gear: PGear); |
141 |
||
142 |
var |
|
143 |
upd: Longword; |
|
144 |
snowLeft,snowRight: LongInt; |
|
145 |
||
146 |
implementation |
|
147 |
uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound |
|
148 |
, SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics |
|
149 |
, uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture, uCommands |
|
150 |
, uStore, uAI, uStats; |
|
5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset
|
151 |
|
3569 | 152 |
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); |
153 |
var |
|
154 |
dX, dY, sX, sY: hwFloat; |
|
155 |
i, steps: LongWord; |
|
156 |
caller: TGearStepProcedure; |
|
157 |
begin |
|
158 |
dX:= Gear^.dX; |
|
159 |
dY:= Gear^.dY; |
|
160 |
steps:= max(abs(hwRound(Gear^.X+dX)-hwRound(Gear^.X)), abs(hwRound(Gear^.Y+dY)-hwRound(Gear^.Y))); |
|
161 |
||
162 |
// Gear is still on the same Pixel it was before |
|
163 |
if steps < 1 then |
|
4578 | 164 |
begin |
3569 | 165 |
if onlyCheckIfChanged then |
4578 | 166 |
begin |
3569 | 167 |
Gear^.X := Gear^.X + dX; |
168 |
Gear^.Y := Gear^.Y + dY; |
|
169 |
EXIT; |
|
4578 | 170 |
end |
3569 | 171 |
else |
172 |
steps := 1; |
|
4578 | 173 |
end; |
3569 | 174 |
|
175 |
if steps > 1 then |
|
4578 | 176 |
begin |
3569 | 177 |
sX:= dX / steps; |
178 |
sY:= dY / steps; |
|
4578 | 179 |
end |
8795 | 180 |
|
3569 | 181 |
else |
4578 | 182 |
begin |
3569 | 183 |
sX:= dX; |
184 |
sY:= dY; |
|
4578 | 185 |
end; |
3569 | 186 |
|
187 |
caller:= Gear^.doStep; |
|
188 |
||
189 |
for i:= 1 to steps do |
|
4578 | 190 |
begin |
3569 | 191 |
Gear^.X := Gear^.X + sX; |
192 |
Gear^.Y := Gear^.Y + sY; |
|
193 |
step(Gear); |
|
194 |
if (Gear^.doStep <> caller) |
|
195 |
or ((Gear^.State and gstCollision) <> 0) |
|
196 |
or ((Gear^.State and gstMoving) = 0) then |
|
197 |
break; |
|
4578 | 198 |
end; |
3569 | 199 |
end; |
200 |
||
2647 | 201 |
procedure makeHogsWorry(x, y: hwFloat; r: LongInt); |
8795 | 202 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
203 |
gi: PGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
204 |
d: LongInt; |
2647 | 205 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
206 |
gi := GearsList; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
207 |
while gi <> nil do |
4578 | 208 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
209 |
if (gi^.Kind = gtHedgehog) then |
4578 | 210 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
211 |
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
|
212 |
if (d > 1) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) and (GetRandom(2) = 0) then |
4578 | 213 |
begin |
3143 | 214 |
if (CurrentHedgehog^.Gear = gi) then |
7053 | 215 |
PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) |
8795 | 216 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
217 |
else |
4578 | 218 |
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
|
219 |
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
|
220 |
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
|
221 |
gi^.dX.isNegative:= X<gi^.X; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
222 |
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
|
223 |
end; |
8795 | 224 |
|
3143 | 225 |
if d > r div 2 then |
8795 | 226 |
PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) |
3143 | 227 |
else |
7053 | 228 |
PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack); |
4578 | 229 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
230 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
231 |
end; |
8795 | 232 |
|
4578 | 233 |
gi := gi^.NextGear |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
234 |
end; |
2647 | 235 |
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
|
236 |
|
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
237 |
procedure HideHog(HH: PHedgehog); |
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
238 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
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
|
242 |
FollowGear:= nil; |
8795 | 243 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
244 |
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
|
245 |
lastGearByUID := nil; |
8795 | 246 |
|
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
247 |
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
|
248 |
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
|
249 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
250 |
Z := cHHZ; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
251 |
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
|
252 |
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
|
253 |
Message := Message and (not gmAttack); |
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
254 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
255 |
HH^.GearHidden:= HH^.Gear; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
256 |
HH^.Gear:= nil |
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
257 |
end; |
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
258 |
|
4 | 259 |
|
260 |
//////////////////////////////////////////////////////////////////////////////// |
|
261 |
procedure doStepDrowningGear(Gear: PGear); |
|
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
262 |
var i, d: LongInt; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
263 |
bubble: PVisualGear; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
264 |
begin |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
265 |
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
|
266 |
begin |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
267 |
d:= 2 * Gear^.Radius; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
268 |
for i:= (Gear^.Radius * Gear^.Radius) div 4 downto 0 do |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
269 |
begin |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
270 |
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
|
271 |
if bubble <> nil then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
272 |
bubble^.dY:= 0.1 + random(20)/10; |
10354 | 273 |
end; |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
274 |
DeleteGear(Gear); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
275 |
exit; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
276 |
end; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
277 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
278 |
AllInactive := false; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
279 |
dec(Gear^.Timer); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
280 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
281 |
Gear^.Y := Gear^.Y + cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
282 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
283 |
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
284 |
begin |
10494 | 285 |
if LongInt(leftX) + Gear^.Radius > hwRound(Gear^.X) then |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
286 |
Gear^.X := Gear^.X - cDrownSpeed |
10354 | 287 |
else |
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
288 |
Gear^.X := Gear^.X + cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
289 |
end |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
290 |
else |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
291 |
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
292 |
|
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
293 |
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
294 |
if ((not SuddenDeathDmg and (WaterOpacity < $FF)) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
295 |
or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
296 |
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
297 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
298 |
else if Random(12) = 0 then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
299 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
300 |
if (not SuddenDeathDmg and (WaterOpacity > $FE)) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
301 |
or (SuddenDeathDmg and (SDWaterOpacity > $FE)) |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
302 |
or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
303 |
DeleteGear(Gear); |
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset
|
304 |
end; |
4 | 305 |
|
306 |
//////////////////////////////////////////////////////////////////////////////// |
|
307 |
procedure doStepFallingGear(Gear: PGear); |
|
8795 | 308 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
309 |
isFalling: boolean; |
3020 | 310 |
//tmp: QWord; |
9526 | 311 |
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
|
312 |
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
|
313 |
land, xland: word; |
4 | 314 |
begin |
9526 | 315 |
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
|
316 |
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
|
317 |
gY:= hwRound(Gear^.Y); |
9557 | 318 |
if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and (Gear^.AdvBounce <> 0) and |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
319 |
((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, -1) <> 0)) then |
9526 | 320 |
begin |
321 |
Gear^.X:= tX; |
|
9809 | 322 |
Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2) |
9526 | 323 |
end; |
9473
a51a69094c24
partial implementation of non-infinite world (edge wrap/warp/bounce)
nemo
parents:
9470
diff
changeset
|
324 |
|
7627 | 325 |
// 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
|
326 |
if Gear^.dX.Round > 1 then |
7627 | 327 |
Gear^.dX.QWordValue:= 8589934592; |
9967
40750e72514b
keep velocity from fluttering between 2 and 3px / ms when falling...
nemo
parents:
9885
diff
changeset
|
328 |
if Gear^.dY.Round > 1 then |
7627 | 329 |
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
|
330 |
|
10354 | 331 |
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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
|
6450 | 337 |
Gear^.State := Gear^.State and (not gstCollision); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
338 |
collV := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
339 |
collH := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
340 |
tdX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
341 |
tdY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
342 |
|
3359 | 343 |
// 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
|
344 |
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
|
345 |
or (gX > max(LAND_WIDTH * 3 div 2, 6144)) then |
11389
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:
11342
diff
changeset
|
346 |
Gear^.Message := Gear^.Message or gmDestroy; |
3359 | 347 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
348 |
if Gear^.dY.isNegative then |
4578 | 349 |
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
|
350 |
land:= TestCollisionYwithGear(Gear, -1); |
9820 | 351 |
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
|
352 |
if land <> 0 then |
4578 | 353 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
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
|
360 |
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
|
361 |
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
|
362 |
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
|
363 |
else Gear^.dY := - Gear^.dY * cElastic |
4578 | 364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
end |
4578 | 370 |
end |
8795 | 371 |
else |
6498 | 372 |
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
|
373 |
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
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
isFalling := false; |
8795 | 378 |
if land and lfIce <> 0 then |
6498 | 379 |
Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) |
8795 | 380 |
else |
6498 | 381 |
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
|
382 |
|
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
|
383 |
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
|
384 |
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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
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
|
389 |
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
|
390 |
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
|
391 |
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
|
392 |
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
|
393 |
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
|
394 |
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
|
395 |
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
|
396 |
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
|
397 |
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
|
398 |
end |
4578 | 399 |
end; |
503 | 400 |
|
2989
b49d87499398
Add back sheepluva's 45° patch for some weapons. Rescale Tiy's latest icons to his specifications.
nemo
parents:
2983
diff
changeset
|
401 |
|
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
|
402 |
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
|
403 |
if xland <> 0 then |
4578 | 404 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
405 |
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
|
406 |
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
|
407 |
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
|
408 |
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
|
409 |
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
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
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
|
414 |
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
|
415 |
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
|
416 |
end |
4578 | 417 |
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
|
418 |
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
|
419 |
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
|
420 |
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
|
421 |
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
|
422 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
423 |
//if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then |
10015 | 424 |
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
|
425 |
(((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then |
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
|
426 |
//or ((xland 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
|
427 |
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
|
428 |
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
|
429 |
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
|
430 |
Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; |
9767 | 431 |
Gear^.dY := tdX*Gear^.Elasticity; |
432 |
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
|
433 |
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
|
434 |
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
|
435 |
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
|
436 |
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
|
437 |
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
|
438 |
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
|
439 |
|
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
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
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
|
449 |
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
|
450 |
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
|
451 |
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
|
452 |
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
|
453 |
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
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
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
|
458 |
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
|
459 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
460 |
isFalling := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
461 |
Gear^.AdvBounce := 10; |
4578 | 462 |
end; |
503 | 463 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
464 |
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
|
465 |
dec(Gear^.AdvBounce); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
466 |
|
11389
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:
11342
diff
changeset
|
467 |
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:
11342
diff
changeset
|
468 |
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:
11342
diff
changeset
|
469 |
Gear^.dY := Gear^.dY + cGravity; |
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:
11342
diff
changeset
|
470 |
if (GameFlags and gfMoreWind <> 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:
11342
diff
changeset
|
471 |
((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:
11342
diff
changeset
|
472 |
((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
|
473 |
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density |
9820 | 474 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
475 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
476 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
477 |
Gear^.Y := Gear^.Y + Gear^.dY; |
9479
167dea42d7d7
move border back a bit from left/right bounds, bee tweak
nemo
parents:
9477
diff
changeset
|
478 |
CheckGearDrowning(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
479 |
//if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and |
6498 | 480 |
if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then |
6450 | 481 |
Gear^.State := Gear^.State and (not gstMoving) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
482 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
483 |
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
|
484 |
|
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
|
485 |
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
|
486 |
Gear^.State := Gear^.State or gstCollision; |
10015 | 487 |
|
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
|
488 |
if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and |
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
|
489 |
((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
|
490 |
begin |
10508 | 491 |
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
|
492 |
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
|
493 |
else if (Gear^.nImpactSounds > 0) and |
7777 | 494 |
(Gear^.State and gstCollision <> 0) and |
495 |
(((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and |
|
496 |
(((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or |
|
8795 | 497 |
((Gear^.Radius >= 3) and |
7777 | 498 |
((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then |
5461 | 499 |
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true); |
4 | 500 |
end; |
501 |
||
502 |
//////////////////////////////////////////////////////////////////////////////// |
|
503 |
procedure doStepBomb(Gear: PGear); |
|
8795 | 504 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
505 |
i, x, y: LongInt; |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
506 |
dX, dY, gdX: hwFloat; |
3475 | 507 |
vg: PVisualGear; |
4 | 508 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
509 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
510 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
511 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
512 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
513 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
514 |
if Gear^.Timer = 1000 then // might need adjustments |
8795 | 515 |
case Gear^.Kind of |
11468
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:
11391
diff
changeset
|
516 |
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:
11391
diff
changeset
|
517 |
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:
11391
diff
changeset
|
518 |
gtWatermelon, |
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:
11391
diff
changeset
|
519 |
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
520 |
gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
521 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
522 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
523 |
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
|
524 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
525 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
526 |
if (Gear^.State and gstCollision) <> 0 then |
11468
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:
11391
diff
changeset
|
527 |
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
|
528 |
end; |
3004 | 529 |
|
3475 | 530 |
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
|
531 |
begin |
3475 | 532 |
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); |
533 |
if vg <> nil then |
|
534 |
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
|
535 |
end; |
3475 | 536 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
537 |
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
|
538 |
begin |
8795 | 539 |
case Gear^.Kind of |
11468
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:
11391
diff
changeset
|
540 |
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:
11391
diff
changeset
|
541 |
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
8795 | 542 |
gtClusterBomb: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
543 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
544 |
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
|
545 |
y := hwRound(Gear^.Y); |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
546 |
gdX:= Gear^.dX; |
11468
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:
11391
diff
changeset
|
547 |
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
|
548 |
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
|
549 |
begin |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
550 |
dX := rndSign(GetRandomf * _0_1) + gdX / 5; |
7001 | 551 |
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
|
552 |
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
|
553 |
end |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
554 |
end; |
8795 | 555 |
gtWatermelon: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
556 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
557 |
x := hwRound(Gear^.X); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
558 |
y := hwRound(Gear^.Y); |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
559 |
gdX:= Gear^.dX; |
11468
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:
11391
diff
changeset
|
560 |
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
|
561 |
for i:= 0 to 5 do |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
562 |
begin |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
563 |
dX := rndSign(GetRandomf * _0_1) + gdX / 5; |
7001 | 564 |
dY := (GetRandomf - _1_5) * _0_3; |
6120 | 565 |
FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75); |
566 |
FollowGear^.DirAngle := i * 60 |
|
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
567 |
end |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
568 |
end; |
8795 | 569 |
gtHellishBomb: |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
570 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
571 |
x := hwRound(Gear^.X); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
572 |
y := hwRound(Gear^.Y); |
11468
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:
11391
diff
changeset
|
573 |
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
|
574 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
575 |
for i:= 0 to 127 do |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
576 |
begin |
7001 | 577 |
dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1); |
578 |
dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1); |
|
6131 | 579 |
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
|
580 |
begin |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
581 |
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
|
582 |
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
|
583 |
end |
61c1161ee32f
Remove unnecessary assignments post-creation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset
|
584 |
else |
8795 | 585 |
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
|
586 |
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
|
587 |
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
|
588 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
589 |
end |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
590 |
end; |
3712 | 591 |
gtGasBomb: |
592 |
begin |
|
11468
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:
11391
diff
changeset
|
593 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
3712 | 594 |
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
|
595 |
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
|
596 |
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
|
597 |
y:= GetRandom(40); |
6120 | 598 |
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
|
599 |
end |
3712 | 600 |
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
|
601 |
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
|
602 |
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
|
603 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
604 |
end; |
6498 | 605 |
|
606 |
CalcRotationDirAngle(Gear); |
|
607 |
||
608 |
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
|
609 |
begin |
6498 | 610 |
|
611 |
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
|
612 |
begin |
6498 | 613 |
Gear^.nImpactSounds := 0; |
614 |
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
|
615 |
end; |
6498 | 616 |
|
617 |
if (GameTicks and $3F) = 0 then |
|
618 |
if (Gear^.State and gstCollision) = 0 then |
|
619 |
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
|
620 |
end; |
4 | 621 |
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
|
622 |
|
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
623 |
//////////////////////////////////////////////////////////////////////////////// |
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
624 |
procedure doStepMolotov(Gear: PGear); |
8795 | 625 |
var |
6472 | 626 |
s: Longword; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
627 |
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
|
628 |
dX, dY: hwFloat; |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
629 |
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
|
630 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
631 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
632 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
633 |
doStepFallingGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
634 |
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
|
635 |
|
5870 | 636 |
// 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
|
637 |
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
|
638 |
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
|
639 |
begin |
5873 | 640 |
// 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
|
641 |
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
|
642 |
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
|
643 |
else i:= 50; |
8795 | 644 |
|
5873 | 645 |
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
|
646 |
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
|
647 |
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
|
648 |
end; |
5870 | 649 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
650 |
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
|
651 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
652 |
PlaySound(sndMolotov); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
653 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
654 |
gY := hwRound(Gear^.Y); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
655 |
for i:= 0 to 4 do |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
656 |
begin |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
657 |
(*glass:= AddVisualGear(gx+random(7)-3, gy+random(5)-2, vgtEgg); |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
658 |
if glass <> nil then |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
659 |
begin |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
660 |
glass^.Frame:= 2; |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
661 |
glass^.Tint:= $41B83ED0 - i * $10081000; |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
662 |
glass^.dX:= 1/(10*(random(11)-5)); |
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
663 |
glass^.dY:= -1/(random(4)+5); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
664 |
end;*) |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
665 |
glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot); |
6131 | 666 |
if glass <> nil then |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
667 |
with glass^ do |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
668 |
begin |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
669 |
Frame:= 2; |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
670 |
Tint:= $41B83ED0 - i * $10081000; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
671 |
Angle:= random(360); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
672 |
dx:= 0.0000001; |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
673 |
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
|
674 |
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
|
675 |
dx := -dx; |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
676 |
FrameTicks:= 750; |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
677 |
State:= ord(sprEgg) |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
678 |
end; |
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset
|
679 |
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
|
680 |
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
|
681 |
begin |
7001 | 682 |
dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandomf + _1); |
683 |
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
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
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
|
688 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
689 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
690 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
691 |
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
|
692 |
end; |
4 | 693 |
|
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
|
694 |
//////////////////////////////////////////////////////////////////////////////// |
1279 | 695 |
|
78 | 696 |
procedure doStepCluster(Gear: PGear); |
697 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
698 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
699 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
700 |
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
|
701 |
begin |
11468
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:
11391
diff
changeset
|
702 |
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
|
703 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
704 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
705 |
end; |
1262 | 706 |
|
11468
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:
11391
diff
changeset
|
707 |
if (Gear^.Kind = gtMelonPiece) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
708 |
CalcRotationDirAngle(Gear) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
709 |
else if (GameTicks and $1F) = 0 then |
10352 | 710 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
78 | 711 |
end; |
712 |
||
4 | 713 |
//////////////////////////////////////////////////////////////////////////////// |
4168 | 714 |
procedure doStepShell(Gear: PGear); |
4 | 715 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
Gear^.dX := Gear^.dX + cWindSpeed; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
719 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
720 |
if (Gear^.State and gstCollision) <> 0 then |
4578 | 721 |
begin |
11468
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:
11391
diff
changeset
|
722 |
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
|
723 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
724 |
exit |
4578 | 725 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
726 |
if (GameTicks and $3F) = 0 then |
10352 | 727 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
95 | 728 |
end; |
729 |
||
4 | 730 |
//////////////////////////////////////////////////////////////////////////////// |
4578 | 731 |
procedure doStepSnowball(Gear: PGear); |
732 |
var kick, i: LongInt; |
|
733 |
particle: PVisualGear; |
|
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
734 |
gdX, gdY: hwFloat; |
4578 | 735 |
begin |
736 |
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
|
737 |
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
|
738 |
Gear^.dX := Gear^.dX + cWindSpeed; |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
739 |
gdX := Gear^.dX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
740 |
gdY := Gear^.dY; |
4578 | 741 |
doStepFallingGear(Gear); |
742 |
CalcRotationDirAngle(Gear); |
|
743 |
if (Gear^.State and gstCollision) <> 0 then |
|
744 |
begin |
|
11468
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:
11391
diff
changeset
|
745 |
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
|
746 |
Gear^.dX:= gdX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
747 |
Gear^.dY:= gdY; |
7621 | 748 |
AmmoShove(Gear, 0, kick); |
4578 | 749 |
for i:= 15 + kick div 10 downto 0 do |
750 |
begin |
|
751 |
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
|
752 |
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
|
753 |
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
4578 | 754 |
end; |
755 |
DeleteGear(Gear); |
|
756 |
exit |
|
757 |
end; |
|
758 |
if ((GameTicks and $1F) = 0) and (Random(3) = 0) then |
|
759 |
begin |
|
4582 | 760 |
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
|
761 |
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
|
762 |
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) |
4578 | 763 |
end |
764 |
end; |
|
765 |
||
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
|
766 |
//////////////////////////////////////////////////////////////////////////////// |
4611 | 767 |
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
|
768 |
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
|
769 |
move, draw, allpx, gun: Boolean; |
4611 | 770 |
s: PSDL_Surface; |
771 |
p: PLongwordArray; |
|
5693 | 772 |
lf: LongWord; |
4611 | 773 |
begin |
5695 | 774 |
inc(Gear^.Pos); |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
775 |
gun:= (Gear^.State and gstTmpFlag) <> 0; |
5024 | 776 |
move:= false; |
777 |
draw:= false; |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
778 |
if gun then |
5024 | 779 |
begin |
6450 | 780 |
Gear^.State:= Gear^.State and (not gstInvisible); |
5024 | 781 |
doStepFallingGear(Gear); |
782 |
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
|
783 |
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
|
784 |
draw:= true; |
5024 | 785 |
xx:= hwRound(Gear^.X); |
786 |
yy:= hwRound(Gear^.Y); |
|
9809 | 787 |
if draw and (WorldEdge = weWrap) and ((xx < LongInt(leftX) + 3) or (xx > LongInt(rightX) - 3)) then |
788 |
begin |
|
10015 | 789 |
if xx < LongInt(leftX) + 3 then |
9563 | 790 |
xx:= rightX-3 |
791 |
else xx:= leftX+3; |
|
792 |
Gear^.X:= int2hwFloat(xx) |
|
793 |
end |
|
5024 | 794 |
end |
795 |
else if GameTicks and $7 = 0 then |
|
4611 | 796 |
begin |
797 |
with Gear^ do |
|
798 |
begin |
|
6450 | 799 |
State:= State and (not gstInvisible); |
5355 | 800 |
X:= X + cWindSpeed * 3200 + dX; |
4611 | 801 |
Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results |
802 |
xx:= hwRound(X); |
|
803 |
yy:= hwRound(Y); |
|
804 |
if vobVelocity <> 0 then |
|
805 |
begin |
|
7649 | 806 |
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
|
807 |
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
|
808 |
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
|
809 |
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
|
810 |
DirAngle := DirAngle - 360; |
4611 | 811 |
end; |
7649 | 812 |
(* |
813 |
We aren't using frametick right now, so just a waste of cycles. |
|
4611 | 814 |
inc(Health, 8); |
5186 | 815 |
if longword(Health) > vobFrameTicks then |
4611 | 816 |
begin |
817 |
dec(Health, vobFrameTicks); |
|
818 |
inc(Timer); |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
819 |
if Timer = vobFramesCount then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
820 |
Timer:= 0 |
4611 | 821 |
end; |
7649 | 822 |
*) |
4611 | 823 |
// move back to cloud layer |
10354 | 824 |
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
|
825 |
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
|
826 |
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
|
827 |
move:=true |
10736
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset
|
828 |
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
|
829 |
move:=true |
4791 | 830 |
// 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
|
831 |
else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then |
4611 | 832 |
begin |
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset
|
833 |
lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); |
8602 | 834 |
if lf = 0 then lf:= lfObject; |
4791 | 835 |
// If there's room below keep falling |
836 |
if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then |
|
837 |
begin |
|
838 |
X:= X - cWindSpeed * 1600 - dX; |
|
839 |
end |
|
840 |
// If there's room below, on the sides, fill the gaps |
|
841 |
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 |
|
842 |
begin |
|
843 |
X:= X - _0_8 * hwSign(cWindSpeed); |
|
844 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
845 |
end |
|
846 |
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 |
|
847 |
begin |
|
848 |
X:= X - _0_8 * 2 * hwSign(cWindSpeed); |
|
849 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
850 |
end |
|
851 |
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 |
|
852 |
begin |
|
853 |
X:= X + _0_8 * hwSign(cWindSpeed); |
|
854 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
855 |
end |
|
856 |
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 |
|
857 |
begin |
|
858 |
X:= X + _0_8 * 2 * hwSign(cWindSpeed); |
|
859 |
Y:= Y - dY - cGravity * vobFallSpeed * 8; |
|
860 |
end |
|
4805
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset
|
861 |
// 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
|
862 |
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
|
863 |
then move:=true |
5024 | 864 |
else draw:= true |
865 |
end |
|
866 |
end |
|
867 |
end; |
|
6131 | 868 |
if draw then |
5024 | 869 |
with Gear^ do |
870 |
begin |
|
871 |
// we've collided with land. draw some stuff and get back into the clouds |
|
872 |
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
|
873 |
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
|
874 |
or (CurAmmoGear^.Kind <> gtRope)) then |
5024 | 875 |
begin |
876 |
////////////////////////////////// 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
|
877 |
if not gun then |
5024 | 878 |
begin |
879 |
dec(yy,3); |
|
880 |
dec(xx,1) |
|
881 |
end; |
|
882 |
s:= SpritesData[sprSnow].Surface; |
|
883 |
p:= s^.pixels; |
|
884 |
allpx:= true; |
|
885 |
for py:= 0 to Pred(s^.h) do |
|
886 |
begin |
|
887 |
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
|
888 |
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
|
889 |
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
|
890 |
if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then |
5024 | 891 |
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
|
892 |
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
|
893 |
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
|
894 |
if cReducedQuality and rqBlurryLand <> 0 then |
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
895 |
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
|
896 |
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
|
897 |
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
|
898 |
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
|
899 |
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
|
900 |
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
|
901 |
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
|
902 |
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
|
903 |
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
|
904 |
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
|
905 |
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
|
906 |
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
|
907 |
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
|
908 |
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
|
909 |
(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
|
910 |
(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
|
911 |
(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
|
912 |
else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]); |
5024 | 913 |
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
|
914 |
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
|
915 |
end; |
10131
4b4a043111f4
- pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10125
diff
changeset
|
916 |
p:= PLongWordArray(@(p^[s^.pitch shr 2])) |
5024 | 917 |
end; |
8795 | 918 |
|
919 |
// 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
|
920 |
//Land[py, px+1]:= lfBasic; |
8795 | 921 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
922 |
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
|
923 |
UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w), true) |
4791 | 924 |
else |
4611 | 925 |
begin |
5024 | 926 |
UpdateLandTexture( |
927 |
max(0, min(LAND_WIDTH, xx)), |
|
928 |
min(LAND_WIDTH - xx, Pred(s^.w)), |
|
929 |
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
|
930 |
min(LAND_HEIGHT - yy, Pred(s^.h)), false // could this be true without unnecessarily creating blanks? |
5024 | 931 |
); |
4791 | 932 |
end; |
5024 | 933 |
////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// |
4611 | 934 |
end |
5024 | 935 |
end; |
936 |
||
937 |
if move then |
|
938 |
begin |
|
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset
|
939 |
if gun then |
5024 | 940 |
begin |
941 |
DeleteGear(Gear); |
|
942 |
exit |
|
943 |
end; |
|
5695 | 944 |
Gear^.Pos:= 0; |
7721 | 945 |
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
|
946 |
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
|
947 |
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
|
948 |
else Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50)) - 1250); |
5413 | 949 |
Gear^.State:= Gear^.State or gstInvisible; |
4611 | 950 |
end |
951 |
end; |
|
952 |
||
4578 | 953 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 954 |
procedure doStepGrave(Gear: PGear); |
955 |
begin |
|
7394 | 956 |
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
|
957 |
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
|
958 |
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
|
959 |
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
|
960 |
end; |
7394 | 961 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
962 |
AllInactive := false; |
7394 | 963 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
964 |
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
|
965 |
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
|
966 |
Gear^.dY := _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
967 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
968 |
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
|
969 |
if TestCollisionY(Gear, 1) <> 0 then |
9820 | 970 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
971 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
972 |
if Gear^.dY > - _1div1024 then |
9820 | 973 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
974 |
Gear^.Active := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
975 |
exit |
9820 | 976 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
977 |
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
|
978 |
PlaySound(Gear^.ImpactSound) |
9820 | 979 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
980 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
981 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
982 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
983 |
Gear^.dY := Gear^.dY + cGravity |
4 | 984 |
end; |
985 |
||
986 |
//////////////////////////////////////////////////////////////////////////////// |
|
3080 | 987 |
procedure doStepBeeWork(Gear: PGear); |
8795 | 988 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
989 |
t: hwFloat; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
990 |
gX,gY,i: LongInt; |
6251 | 991 |
uw, nuw: boolean; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
992 |
flower: PVisualGear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
993 |
|
4 | 994 |
begin |
9473
a51a69094c24
partial implementation of non-infinite world (edge wrap/warp/bounce)
nemo
parents:
9470
diff
changeset
|
995 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
996 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
997 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
998 |
gY := hwRound(Gear^.Y); |
6251 | 999 |
uw := (Gear^.Tag <> 0); // was bee underwater last tick? |
10354 | 1000 |
nuw := CheckCoordInWater(gx, gy + Gear^.Radius); // is bee underwater now? |
6251 | 1001 |
|
1002 |
// if water entered or left |
|
1003 |
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
|
1004 |
begin |
10363 | 1005 |
if Gear^.Timer <> 5000 then |
1006 |
AddSplashForGear(Gear, false); |
|
7053 | 1007 |
StopSoundChan(Gear^.SoundChannel); |
6251 | 1008 |
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
|
1009 |
begin |
6251 | 1010 |
Gear^.SoundChannel := LoopSound(sndBeeWater); |
1011 |
Gear^.Tag := 1; |
|
1012 |
end |
|
1013 |
else |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1014 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1015 |
Gear^.SoundChannel := LoopSound(sndBee); |
6251 | 1016 |
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
|
1017 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1018 |
end; |
6251 | 1019 |
|
1020 |
||
1021 |
if Gear^.Timer = 0 then |
|
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1022 |
begin |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1023 |
// no "fuel"? just fall |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1024 |
doStepFallingGear(Gear); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1025 |
// if drowning, stop bee sound |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1026 |
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
|
1027 |
StopSoundChan(Gear^.SoundChannel); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1028 |
end |
6251 | 1029 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1030 |
begin |
11475 | 1031 |
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
|
1032 |
begin |
11475 | 1033 |
if (Gear^.Timer and $3F) = 0 then |
10352 | 1034 |
AddVisualGear(gX, gY, vgtBeeTrace); |
1035 |
||
11475 | 1036 |
Gear^.dX := Gear^.dX + _0_000064 * (Gear^.Target.X - gX); |
1037 |
Gear^.dY := Gear^.dY + _0_000064 * (Gear^.Target.Y - gY); |
|
6251 | 1038 |
// make sure new speed isn't higher than original one (which we stored in Friction variable) |
1039 |
t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); |
|
1040 |
Gear^.dX := Gear^.dX * t; |
|
1041 |
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
|
1042 |
end; |
6251 | 1043 |
|
1044 |
Gear^.X := Gear^.X + Gear^.dX; |
|
1045 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
1046 |
||
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1047 |
end; |
3591 | 1048 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1049 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1050 |
CheckCollision(Gear); |
6251 | 1051 |
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
|
1052 |
begin |
7053 | 1053 |
StopSoundChan(Gear^.SoundChannel); |
11468
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:
11391
diff
changeset
|
1054 |
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
|
1055 |
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
|
1056 |
begin |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1057 |
flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
6131 | 1058 |
if flower <> nil then |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1059 |
with flower^ do |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1060 |
begin |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1061 |
Scale:= 0.75; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1062 |
dx:= 0.001 * (random(200)); |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1063 |
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
|
1064 |
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
|
1065 |
dx := -dx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1066 |
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
|
1067 |
dy := -dy; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1068 |
FrameTicks:= random(250) + 250; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1069 |
State:= ord(sprTargetBee); |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1070 |
end; |
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
1071 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1072 |
DeleteGear(Gear); |
10135 | 1073 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1074 |
end; |
6251 | 1075 |
|
1076 |
if (Gear^.Timer > 0) then |
|
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1077 |
begin |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1078 |
dec(Gear^.Timer); |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1079 |
if Gear^.Timer = 0 then |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1080 |
begin |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1081 |
// 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
|
1082 |
Gear^.RenderTimer:= false; |
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset
|
1083 |
// bee can drown when timer reached 0 |
9954 | 1084 |
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
|
1085 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1086 |
end; |
4 | 1087 |
end; |
1088 |
||
3080 | 1089 |
procedure doStepBee(Gear: PGear); |
4 | 1090 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1091 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1092 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1093 |
Gear^.Y := Gear^.Y + Gear^.dY; |
11286 | 1094 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1095 |
Gear^.dY := Gear^.dY + cGravity; |
10363 | 1096 |
CheckGearDrowning(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1097 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1098 |
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
|
1099 |
begin |
11468
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:
11391
diff
changeset
|
1100 |
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
|
1101 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1102 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1103 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1104 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1105 |
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
|
1106 |
begin |
6450 | 1107 |
Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack); |
1108 |
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
|
1109 |
AttackBar:= 0; |
8795 | 1110 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1111 |
Gear^.SoundChannel := LoopSound(sndBee); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1112 |
Gear^.Timer := 5000; |
3591 | 1113 |
// save initial speed in otherwise unused Friction variable |
1114 |
Gear^.Friction := Distance(Gear^.dX, Gear^.dY); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1115 |
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
|
1116 |
end; |
4 | 1117 |
end; |
1118 |
||
1119 |
//////////////////////////////////////////////////////////////////////////////// |
|
876 | 1120 |
procedure doStepShotIdle(Gear: PGear); |
1121 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1122 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1123 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1124 |
if Gear^.Timer > 75 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1125 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1126 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1127 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1128 |
end |
876 | 1129 |
end; |
1130 |
||
4 | 1131 |
procedure doStepShotgunShot(Gear: PGear); |
8795 | 1132 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1133 |
i: LongWord; |
2828 | 1134 |
shell: PVisualGear; |
4 | 1135 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1136 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1137 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1138 |
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
|
1139 |
begin |
3454
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 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1143 |
PlaySound(sndShotgunFire); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1144 |
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1145 |
if shell <> 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
|
1146 |
begin |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset
|
1147 |
shell^.dX := gear^.dX.QWordValue / -17179869184; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset
|
1148 |
shell^.dY := gear^.dY.QWordValue / -17179869184; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1149 |
shell^.Frame := 0 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1150 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1151 |
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
|
1152 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1153 |
exit |
7564
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1154 |
end else |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1155 |
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
|
1156 |
begin |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1157 |
DeleteGear(Gear); |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1158 |
AfterAttack; |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1159 |
exit |
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset
|
1160 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1161 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1162 |
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
|
1163 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1164 |
i := 200; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1165 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1166 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1167 |
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
|
1168 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1169 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1170 |
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
|
1171 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1172 |
Gear^.X := Gear^.X + Gear^.dX * 8; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1173 |
Gear^.Y := Gear^.Y + Gear^.dY * 8; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1174 |
ShotgunShot(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1175 |
Gear^.doStep := @doStepShotIdle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1176 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1177 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1178 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1179 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1180 |
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
|
1181 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1182 |
Gear^.doStep := @doStepShotIdle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1183 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1184 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1185 |
dec(i) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1186 |
until i = 0; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1187 |
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
|
1188 |
Gear^.doStep := @doStepShotIdle |
4 | 1189 |
end; |
1190 |
||
1191 |
//////////////////////////////////////////////////////////////////////////////// |
|
5841 | 1192 |
procedure spawnBulletTrail(Bullet: PGear); |
1193 |
var oX, oY: hwFloat; |
|
1194 |
VGear: PVisualGear; |
|
1195 |
begin |
|
1196 |
if Bullet^.PortalCounter = 0 then |
|
1197 |
begin |
|
1198 |
ox:= CurrentHedgehog^.Gear^.X + Int2hwFloat(GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle)); |
|
1199 |
oy:= CurrentHedgehog^.Gear^.Y + Int2hwFloat(GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle)); |
|
1200 |
end |
|
1201 |
else |
|
1202 |
begin |
|
1203 |
ox:= Bullet^.Elasticity; |
|
1204 |
oy:= Bullet^.Friction; |
|
1205 |
end; |
|
1206 |
||
1207 |
// Bullet trail |
|
1208 |
VGear := AddVisualGear(hwRound(ox), hwRound(oy), vgtLineTrail); |
|
8795 | 1209 |
|
5841 | 1210 |
if VGear <> nil then |
1211 |
begin |
|
1212 |
VGear^.X:= hwFloat2Float(ox); |
|
1213 |
VGear^.Y:= hwFloat2Float(oy); |
|
1214 |
VGear^.dX:= hwFloat2Float(Bullet^.X); |
|
1215 |
VGear^.dY:= hwFloat2Float(Bullet^.Y); |
|
1216 |
||
1217 |
// reached edge of land. assume infinite beam. Extend it way out past camera |
|
1218 |
if (hwRound(Bullet^.X) and LAND_WIDTH_MASK <> 0) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1219 |
or (hwRound(Bullet^.Y) and LAND_HEIGHT_MASK <> 0) then |
5841 | 1220 |
// only extend if not under water |
10354 | 1221 |
if not CheckCoordInWater(hwRound(Bullet^.X), hwRound(Bullet^.Y)) then |
5841 | 1222 |
begin |
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
|
1223 |
VGear^.dX := VGear^.dX + max(LAND_WIDTH,4096) * (VGear^.dX - VGear^.X); |
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
|
1224 |
VGear^.dY := VGear^.dY + max(LAND_WIDTH,4096) * (VGear^.dY - VGear^.Y); |
5841 | 1225 |
end; |
1226 |
||
1227 |
VGear^.Timer := 200; |
|
1228 |
end; |
|
1229 |
end; |
|
1230 |
||
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1231 |
procedure doStepBulletWork(Gear: PGear); |
8795 | 1232 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1233 |
i, x, y: LongWord; |
9485
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1234 |
oX, oY, tX, tY, cX, cY: hwFloat; |
4327 | 1235 |
VGear: PVisualGear; |
38 | 1236 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1237 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1238 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1239 |
i := 80; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1240 |
oX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1241 |
oY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1242 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1243 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1244 |
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
|
1245 |
tX:= Gear^.X; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1246 |
tY:= Gear^.Y; |
9565 | 1247 |
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
|
1248 |
begin |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1249 |
cX:= Gear^.X; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1250 |
cY:= Gear^.Y; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1251 |
Gear^.X:= tX; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1252 |
Gear^.Y:= tY; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1253 |
SpawnBulletTrail(Gear); |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1254 |
Gear^.X:= cX; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1255 |
Gear^.Y:= cY; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1256 |
inc(Gear^.PortalCounter); |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1257 |
Gear^.Elasticity:= Gear^.X; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1258 |
Gear^.Friction:= Gear^.Y; |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1259 |
SpawnBulletTrail(Gear); |
3dee8a3b0406
add shotgun wrap, revert 100px offset. Problematic w/ things that rely on Land.
nemo
parents:
9479
diff
changeset
|
1260 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1261 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1262 |
y := hwRound(Gear^.Y); |
8795 | 1263 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1264 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) 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
|
1265 |
inc(Gear^.Damage); |
5841 | 1266 |
// let's interrupt before a collision to give portals a chance to catch the bullet |
9954 | 1267 |
if (Gear^.Damage = 1) and (Gear^.Tag = 0) and (not CheckLandValue(x, y, lfLandMask)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1268 |
begin |
5841 | 1269 |
Gear^.Tag := 1; |
1270 |
Gear^.Damage := 0; |
|
1271 |
Gear^.X := Gear^.X - Gear^.dX; |
|
1272 |
Gear^.Y := Gear^.Y - Gear^.dY; |
|
1273 |
CheckGearDrowning(Gear); |
|
1274 |
break; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1275 |
end |
5841 | 1276 |
else |
1277 |
Gear^.Tag := 0; |
|
1278 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1279 |
if Gear^.Damage > 5 then |
10125 | 1280 |
begin |
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
|
1281 |
if Gear^.AmmoType = amDEagle then |
11468
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:
11391
diff
changeset
|
1282 |
AmmoShove(Gear, Gear^.Boom, 20) |
10125 | 1283 |
else |
11468
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:
11391
diff
changeset
|
1284 |
AmmoShove(Gear, Gear^.Timer * Gear^.Boom div 100000, 20); |
10125 | 1285 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1286 |
CheckGearDrowning(Gear); |
8795 | 1287 |
dec(i) |
7204
522f165cd2e7
- Fix damage calculation in TestSniperRifle, aim a bit lower to compensate initial angle shift in sniper rifle. As a result, AI seems to never fail sniper rifle shots.
unc0rr
parents:
7195
diff
changeset
|
1288 |
until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0); |
522f165cd2e7
- Fix damage calculation in TestSniperRifle, aim a bit lower to compensate initial angle shift in sniper rifle. As a result, AI seems to never fail sniper rifle shots.
unc0rr
parents:
7195
diff
changeset
|
1289 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1290 |
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
|
1291 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1292 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1293 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1294 |
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
|
1295 |
end; |
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
|
1296 |
|
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
|
1297 |
if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Health > 0) then |
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
|
1298 |
begin |
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
|
1299 |
// draw bubbles |
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
|
1300 |
if (not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF)) then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1301 |
begin |
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
|
1302 |
for i:=(Gear^.Health * 4) downto 0 do |
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
|
1303 |
begin |
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
|
1304 |
if Random(6) = 0 then |
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
|
1305 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); |
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
|
1306 |
Gear^.X := Gear^.X + Gear^.dX; |
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
|
1307 |
Gear^.Y := Gear^.Y + Gear^.dY; |
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
|
1308 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1309 |
end; |
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
|
1310 |
// bullet dies underwater |
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
|
1311 |
Gear^.Health:= 0; |
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset
|
1312 |
end; |
1760 | 1313 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1314 |
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
|
1315 |
or (hwRound(Gear^.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
|
1316 |
or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1317 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1318 |
if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1319 |
cLaserSighting := false; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1320 |
if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and ((GameFlags and gfArtillery) = 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1321 |
cArtillery := false; |
8795 | 1322 |
|
4327 | 1323 |
// Bullet Hit |
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
|
1324 |
if ((Gear^.State and gstDrowning) = 0) and (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.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
|
1325 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1326 |
VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1327 |
if VGear <> nil then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1328 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1329 |
VGear^.Angle := DxDy2Angle(-Gear^.dX, Gear^.dY); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1330 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1331 |
end; |
8795 | 1332 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1333 |
spawnBulletTrail(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1334 |
Gear^.doStep := @doStepShotIdle |
4327 | 1335 |
end; |
37 | 1336 |
end; |
1337 |
||
559 | 1338 |
procedure doStepDEagleShot(Gear: PGear); |
1339 |
begin |
|
11550
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1340 |
Gear^.Data:= nil; |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1341 |
// remember who fired this |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1342 |
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:
11540
diff
changeset
|
1343 |
Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear); |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1344 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1345 |
PlaySound(sndGun); |
11553 | 1346 |
// 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 |
11552 | 1347 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
1348 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1349 |
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
|
1350 |
end; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1351 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1352 |
procedure doStepSniperRifleShot(Gear: PGear); |
8795 | 1353 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1354 |
HHGear: PGear; |
2828 | 1355 |
shell: PVisualGear; |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1356 |
begin |
11550
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1357 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1358 |
cArtillery := true; |
4365 | 1359 |
HHGear := Gear^.Hedgehog^.Gear; |
10174 | 1360 |
|
1361 |
if HHGear = nil then |
|
1362 |
begin |
|
1363 |
DeleteGear(gear); |
|
1364 |
exit |
|
1365 |
end; |
|
1366 |
||
11550
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1367 |
// remember who fired this |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1368 |
Gear^.Data:= Pointer(Gear^.Hedgehog^.Gear); |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
1369 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1370 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1371 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1372 |
if not cLaserSighting then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1373 |
// game does not have default laser sight. turn it on and give them a chance to aim |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1374 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1375 |
cLaserSighting := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1376 |
HHGear^.Message := 0; |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
1377 |
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
|
1378 |
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
|
1379 |
end; |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
1380 |
|
3894 | 1381 |
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
|
1382 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1383 |
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1384 |
if shell <> 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
|
1385 |
begin |
3593
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset
|
1386 |
shell^.dX := gear^.dX.QWordValue / -8589934592; |
ae50f63e4fa9
Remove hwFloat from VisualGears - they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset
|
1387 |
shell^.dY := gear^.dY.QWordValue / -8589934592; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1388 |
shell^.Frame := 1 |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1389 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1390 |
Gear^.State := Gear^.State or gstAnimation; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1391 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1392 |
Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1393 |
PlaySound(sndGun); |
11553 | 1394 |
// add 2 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles |
1395 |
Gear^.X := Gear^.X + Gear^.dX * 2; |
|
1396 |
Gear^.Y := Gear^.Y + Gear^.dY * 2; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1397 |
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
|
1398 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1399 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1400 |
if (GameTicks mod 32) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1401 |
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
|
1402 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1403 |
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
|
1404 |
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
|
1405 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1406 |
else |
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset
|
1407 |
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
|
1408 |
dec(HHGear^.Angle); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1409 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1410 |
if (TurnTimeLeft > 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1411 |
dec(TurnTimeLeft) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1412 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1413 |
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
|
1414 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1415 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1416 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1417 |
end; |
559 | 1418 |
end; |
1419 |
||
37 | 1420 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 1421 |
procedure doStepActionTimer(Gear: PGear); |
1422 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1423 |
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
|
1424 |
case Gear^.Kind of |
8795 | 1425 |
gtATStartGame: |
8679 | 1426 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1427 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1428 |
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
|
1429 |
begin |
5354 | 1430 |
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1431 |
end |
8679 | 1432 |
end; |
8795 | 1433 |
gtATFinishGame: |
8679 | 1434 |
begin |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1435 |
AllInactive := false; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1436 |
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
|
1437 |
begin |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1438 |
ScreenFade := sfToBlack; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1439 |
ScreenFadeValue := 0; |
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1440 |
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
|
1441 |
end; |
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1442 |
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
|
1443 |
begin |
7068 | 1444 |
SendIPC(_S'N'); |
1445 |
SendIPC(_S'q'); |
|
5368
a66d5141a3ba
fix build. seems like a indentation-related merge-oopsy dragged deleted code back in.
sheepluva
parents:
5366
diff
changeset
|
1446 |
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
|
1447 |
end |
8679 | 1448 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1449 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1450 |
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
|
1451 |
DeleteGear(Gear) |
4 | 1452 |
end; |
1453 |
||
1454 |
//////////////////////////////////////////////////////////////////////////////// |
|
1455 |
procedure doStepPickHammerWork(Gear: PGear); |
|
8795 | 1456 |
var |
4578 | 1457 |
i, ei, x, y: LongInt; |
4 | 1458 |
HHGear: PGear; |
1459 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1460 |
AllInactive := false; |
9487
fbe203c1d11e
couple more wrap calls. freezer still doesn't propagate properly. mostly due to
nemo
parents:
9485
diff
changeset
|
1461 |
WorldWrap(Gear); |
4365 | 1462 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1463 |
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
|
1464 |
if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1465 |
dec(TurnTimeLeft); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1466 |
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
|
1467 |
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
|
1468 |
or((HHGear^.State and gstHHDriven) =0) then |
4578 | 1469 |
begin |
7053 | 1470 |
StopSoundChan(Gear^.SoundChannel); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1471 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1472 |
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
|
1473 |
doStepHedgehogMoving(HHGear); // for gfInfAttack |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1474 |
exit |
4578 | 1475 |
end; |
1476 |
||
1477 |
x:= hwRound(Gear^.X); |
|
1478 |
y:= hwRound(Gear^.Y); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1479 |
if (Gear^.Timer mod 33) = 0 then |
4578 | 1480 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1481 |
HHGear^.State := HHGear^.State or gstNoDamage; |
11468
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:
11391
diff
changeset
|
1482 |
doMakeExplosion(x, y + 7, Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw); |
6450 | 1483 |
HHGear^.State := HHGear^.State and (not gstNoDamage) |
4578 | 1484 |
end; |
422 | 1485 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1486 |
if (Gear^.Timer mod 47) = 0 then |
4578 | 1487 |
begin |
1488 |
// 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 | 1489 |
if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then |
4578 | 1490 |
for i:= 0 to 1 do |
1491 |
AddVisualGear(x - 5 + Random(10), y + 12, vgtDust); |
|
1492 |
||
1493 |
i := x - Gear^.Radius - LongInt(GetRandom(2)); |
|
1494 |
ei := x + Gear^.Radius + LongInt(GetRandom(2)); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1495 |
while i <= ei do |
4578 | 1496 |
begin |
1497 |
DrawExplosion(i, y + 3, 3); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1498 |
inc(i, 1) |
4578 | 1499 |
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
|
1500 |
|
6314 | 1501 |
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), lfIndestructible) then |
4578 | 1502 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1503 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1504 |
Gear^.Y := Gear^.Y + _1_9; |
4578 | 1505 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1506 |
SetAllHHToActive; |
4578 | 1507 |
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
|
1508 |
if TestCollisionYwithGear(Gear, 1) <> 0 then |
4578 | 1509 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1510 |
Gear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1511 |
SetLittle(HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1512 |
HHGear^.dY := _0; |
4578 | 1513 |
end |
11020
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1514 |
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
|
1515 |
begin |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1516 |
Gear^.dY := cGravity; |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1517 |
HHGear^.dY := cGravity; |
2aa09da8f3ef
fix pickhammer collision when moving upwards, thanks to MK for reporting
sheepluva
parents:
10993
diff
changeset
|
1518 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1519 |
else |
4578 | 1520 |
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
|
1521 |
if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfLandMask) then |
6314 | 1522 |
begin |
1523 |
Gear^.dY := Gear^.dY + cGravity; |
|
1524 |
Gear^.Y := Gear^.Y + Gear^.dY |
|
1525 |
end; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1526 |
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
|
1527 |
Gear^.Timer := 1 |
4578 | 1528 |
end; |
4 | 1529 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1530 |
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
|
1531 |
if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfLandMask) then |
6314 | 1532 |
begin |
1533 |
HHGear^.X := Gear^.X; |
|
1534 |
HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius) |
|
1535 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1536 |
|
3894 | 1537 |
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
|
1538 |
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
|
1539 |
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
|
1540 |
else //there would be a mistake. |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1541 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1542 |
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
|
1543 |
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
|
1544 |
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
|
1545 |
Gear^.dX := - _0_3 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1546 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1547 |
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
|
1548 |
Gear^.dX := _0_3 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1549 |
else Gear^.dX := _0; |
4 | 1550 |
end; |
1551 |
||
1552 |
procedure doStepPickHammer(Gear: PGear); |
|
8795 | 1553 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1554 |
i, y: LongInt; |
4 | 1555 |
ar: TRangeArray; |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
1556 |
HHGear: PGear; |
4 | 1557 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1558 |
i := 0; |
4365 | 1559 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1560 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1561 |
y := hwRound(Gear^.Y) - cHHRadius * 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1562 |
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
|
1563 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1564 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1565 |
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1566 |
inc(y, 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1567 |
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
|
1568 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1569 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1570 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1571 |
Gear^.dY := HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1572 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1573 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1574 |
Gear^.SoundChannel := LoopSound(sndPickhammer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1575 |
doStepPickHammerWork(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1576 |
Gear^.doStep := @doStepPickHammerWork |
4 | 1577 |
end; |
1578 |
||
1579 |
//////////////////////////////////////////////////////////////////////////////// |
|
8795 | 1580 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1581 |
BTPrevAngle, BTSteps: LongInt; |
302 | 1582 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1583 |
procedure doStepBlowTorchWork(Gear: PGear); |
8795 | 1584 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1585 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1586 |
b: boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1587 |
prevX: LongInt; |
302 | 1588 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1589 |
AllInactive := false; |
9487
fbe203c1d11e
couple more wrap calls. freezer still doesn't propagate properly. mostly due to
nemo
parents:
9485
diff
changeset
|
1590 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1591 |
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
|
1592 |
if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1593 |
dec(TurnTimeLeft); |
8795 | 1594 |
|
9385 | 1595 |
if Gear^.Hedgehog^.Gear = nil then |
1596 |
begin |
|
1597 |
DeleteGear(Gear); |
|
1598 |
AfterAttack; |
|
1599 |
exit |
|
1600 |
end; |
|
1601 |
||
4365 | 1602 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1603 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1604 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1605 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1606 |
b := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1607 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1608 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
5706 | 1609 |
begin |
5722
3b7f2bfc8632
Keep blowtorch direction (doesn't actually fix the bug with hedgehog turning opposite direction)
unc0rr
parents:
5716
diff
changeset
|
1610 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1611 |
Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1612 |
BTPrevAngle := HHGear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1613 |
b := true |
5706 | 1614 |
end; |
1528 | 1615 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1616 |
if ((HHGear^.State and gstMoving) <> 0) then |
5706 | 1617 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1618 |
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
|
1619 |
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
|
1620 |
Gear^.Timer := 0 |
5706 | 1621 |
end; |
305 | 1622 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1623 |
if Gear^.Timer mod cHHStepTicks = 0 then |
5706 | 1624 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1625 |
b := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1626 |
if Gear^.dX.isNegative then |
3894 | 1627 |
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
|
1628 |
else |
3894 | 1629 |
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
|
1630 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1631 |
if ((HHGear^.State and gstMoving) = 0) then |
5706 | 1632 |
begin |
6450 | 1633 |
HHGear^.State := HHGear^.State and (not gstAttacking); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1634 |
prevX := hwRound(HHGear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1635 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1636 |
// why the call to HedgehogStep then a further increment of X? |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1637 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1638 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
3519 | 1639 |
lfIndestructible) then HedgehogStep(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1640 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1641 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1642 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
3519 | 1643 |
lfIndestructible) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1644 |
HHGear^.State := HHGear^.State or gstAttacking |
5706 | 1645 |
end; |
305 | 1646 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1647 |
inc(BTSteps); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1648 |
if BTSteps = 7 then |
5706 | 1649 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1650 |
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
|
1651 |
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then |
5706 | 1652 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1653 |
Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1654 |
Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
5706 | 1655 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1656 |
HHGear^.State := HHGear^.State or gstNoDamage; |
11468
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:
11391
diff
changeset
|
1657 |
AmmoShove(Gear, Gear^.Boom, 15); |
6450 | 1658 |
HHGear^.State := HHGear^.State and (not gstNoDamage) |
5706 | 1659 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1660 |
end; |
305 | 1661 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1662 |
if b then |
9385 | 1663 |
begin |
6278
654eed7c6b97
tweak DrawTunnel call of blowtorch. should fix issues with blowtorch going horizontal when it shouldn't
sheepluva
parents:
6251
diff
changeset
|
1664 |
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
|
1665 |
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
|
1666 |
((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
|
1667 |
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
|
1668 |
cHHStepTicks, cHHRadius * 2 + 7); |
9385 | 1669 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1670 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1671 |
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
|
1672 |
or ((HHGear^.Message and gmAttack) <> 0) then |
5706 | 1673 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1674 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1675 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1676 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1677 |
AfterAttack |
5706 | 1678 |
end |
302 | 1679 |
end; |
1680 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1681 |
procedure doStepBlowTorch(Gear: PGear); |
8795 | 1682 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1683 |
HHGear: PGear; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1684 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1685 |
BTPrevAngle := High(LongInt); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1686 |
BTSteps := 0; |
4365 | 1687 |
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
|
1688 |
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
|
1689 |
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
|
1690 |
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
|
1691 |
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
|
1692 |
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
|
1693 |
((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
|
1694 |
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
|
1695 |
cHHStepTicks, cHHRadius * 2 + 7); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1696 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1697 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1698 |
Gear^.doStep := @doStepBlowTorchWork |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1699 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
1700 |
|
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
|
1701 |
|
302 | 1702 |
//////////////////////////////////////////////////////////////////////////////// |
10 | 1703 |
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
|
1704 |
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
|
1705 |
dxdy: hwFloat; |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1706 |
dmg: LongWord; |
10 | 1707 |
begin |
9043 | 1708 |
if Gear^.Health = 0 then dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1709 |
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
|
1710 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1711 |
DeleteCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1712 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1713 |
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
|
1714 |
begin |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
1715 |
AddCI(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1716 |
Gear^.dX := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1717 |
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
|
1718 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1719 |
CalcRotationDirAngle(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1720 |
AllInactive := false |
7754 | 1721 |
end |
1722 |
else if (GameTicks and $3F) = 25 then |
|
1723 |
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
|
1724 |
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
|
1725 |
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
|
1726 |
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
|
1727 |
begin |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1728 |
dmg:= hwRound(dxdy * _50); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1729 |
inc(Gear^.Damage, dmg); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1730 |
ScriptCall('onGearDamage', Gear^.UID, dmg) |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
1731 |
end; |
8795 | 1732 |
|
6498 | 1733 |
if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then |
7754 | 1734 |
begin |
1735 |
vg:= AddVisualGear(hwRound(Gear^.X) - 4 + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke); |
|
1736 |
if vg <> nil then |
|
1737 |
vg^.Scale:= 0.5 |
|
1738 |
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
|
1739 |
|
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
|
1740 |
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
|
1741 |
begin |
11468
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:
11391
diff
changeset
|
1742 |
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
|
1743 |
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
|
1744 |
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
|
1745 |
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
|
1746 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1747 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1748 |
if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1749 |
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
|
1750 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1751 |
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
|
1752 |
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
|
1753 |
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
|
1754 |
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
|
1755 |
else // gstAttacking <> 0 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1756 |
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
|
1757 |
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
|
1758 |
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
|
1759 |
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
|
1760 |
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
|
1761 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1762 |
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
|
1763 |
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
|
1764 |
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
|
1765 |
begin |
11468
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:
11391
diff
changeset
|
1766 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
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
|
1767 |
DeleteGear(Gear) |
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
|
1768 |
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
|
1769 |
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
|
1770 |
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
|
1771 |
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
|
1772 |
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
|
1773 |
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
|
1774 |
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
|
1775 |
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
|
1776 |
Gear^.Damage := 0; |
6450 | 1777 |
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
|
1778 |
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
|
1779 |
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
|
1780 |
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
|
1781 |
dec(Gear^.Timer); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1782 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1783 |
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
|
1784 |
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
|
1785 |
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
|
1786 |
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
|
1787 |
Gear^.State := Gear^.State or gsttmpFlag; |
10 | 1788 |
end; |
57 | 1789 |
|
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
|
1790 |
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
|
1791 |
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
|
1792 |
targ, tmpG: PGear; |
10800 | 1793 |
trackSpeed, airFriction, tX, tY: hwFloat; |
10827 | 1794 |
isUnderwater: Boolean; |
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
|
1795 |
begin |
10827 | 1796 |
isUnderwater:= CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y) + Gear^.Radius); |
10800 | 1797 |
if Gear^.Pos > 0 then |
1798 |
begin |
|
1799 |
airFriction:= _1; |
|
10827 | 1800 |
if isUnderwater then |
1801 |
dec(airFriction.QWordValue,Gear^.Pos*2) |
|
1802 |
else |
|
1803 |
dec(airFriction.QWordValue,Gear^.Pos); |
|
10800 | 1804 |
Gear^.dX:= Gear^.dX*airFriction; |
1805 |
Gear^.dY:= Gear^.dY*airFriction |
|
1806 |
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
|
1807 |
doStepFallingGear(Gear); |
10806 | 1808 |
if (TurnTimeLeft = 0) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then |
1809 |
AllInactive := false; |
|
1810 |
||
1811 |
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
|
1812 |
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
|
1813 |
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
|
1814 |
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
|
1815 |
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
|
1816 |
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
|
1817 |
targ:= Gear^.Hedgehog^.Gear; |
10800 | 1818 |
if targ <> nil then |
1819 |
begin |
|
1820 |
tX:=Gear^.X-targ^.X; |
|
1821 |
tY:=Gear^.Y-targ^.Y; |
|
1822 |
// allow escaping - should maybe flag this too |
|
10802
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
1823 |
if (GameTicks > Gear^.FlightTime+10000) or |
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
1824 |
((tX.Round+tY.Round > Gear^.Angle*6) and |
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
1825 |
(hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then |
10800 | 1826 |
targ:= nil |
1827 |
end; |
|
1828 |
||
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
|
1829 |
// If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility) |
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
|
1830 |
// or mine is inactive due to lack of gsttmpflag or hunting is disabled due to seek radius of 0 |
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
|
1831 |
// then we aren't hunting |
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
|
1832 |
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
|
1833 |
((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
|
1834 |
(Gear^.State and gsttmpFlag = 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
|
1835 |
(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
|
1836 |
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
|
1837 |
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
|
1838 |
// 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
|
1839 |
(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
|
1840 |
((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
|
1841 |
(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
|
1842 |
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
|
1843 |
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
|
1844 |
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
|
1845 |
targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round |
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
|
1846 |
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
|
1847 |
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
|
1848 |
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
|
1849 |
for i:= 0 to cMaxHHIndex 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
|
1850 |
if Hedgehogs[i].Gear <> 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
|
1851 |
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
|
1852 |
tmpG:= Hedgehogs[i].Gear; |
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
|
1853 |
tX:=Gear^.X-tmpG^.X; |
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
|
1854 |
tY:=Gear^.Y-tmpG^.Y; |
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
|
1855 |
if (Gear^.Angle = $FFFFFFFF) or |
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
|
1856 |
((tX.Round+tY.Round < Gear^.Angle) and |
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
|
1857 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Angle))) 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
|
1858 |
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
|
1859 |
if targ <> nil then tmpDist:= Distance(tX,tY).Round; |
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
|
1860 |
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
|
1861 |
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
|
1862 |
if targ = nil then targDist:= Distance(tX,tY).Round |
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
|
1863 |
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
|
1864 |
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
|
1865 |
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
|
1866 |
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
|
1867 |
end |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1868 |
end; |
10802
089e43d01f74
Use the larger scaled airmine sprite originally intended, add some antidickery measures.
nemo
parents:
10800
diff
changeset
|
1869 |
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
|
1870 |
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
|
1871 |
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
|
1872 |
begin |
10799
658794118fd8
initialise trackSpeed, add nil check before resetting seek timer
nemo
parents:
10798
diff
changeset
|
1873 |
trackSpeed:= _0; |
10827 | 1874 |
if isUnderwater then |
1875 |
trackSpeed.QWordValue:= Gear^.Power div 2 |
|
1876 |
else |
|
1877 |
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
|
1878 |
if (Gear^.X < targ^.X) and (Gear^.dX < _0_1) then |
10822 | 1879 |
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
|
1880 |
else if (Gear^.X > targ^.X) and (Gear^.dX > -_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
|
1881 |
Gear^.dX:= Gear^.dX-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
|
1882 |
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
|
1883 |
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
|
1884 |
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
|
1885 |
Gear^.dY:= Gear^.dY-trackSpeed |
10800 | 1886 |
end |
1887 |
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
|
1888 |
|
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
|
1889 |
if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then |
10797 | 1890 |
begin |
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
|
1891 |
if ((Gear^.State and gstAttacking) = 0) 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
|
1892 |
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
|
1893 |
if ((GameTicks and $1F) = 0) 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
|
1894 |
begin |
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
|
1895 |
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
|
1896 |
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
|
1897 |
tX:=Gear^.X-targ^.X; |
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
|
1898 |
tY:=Gear^.Y-targ^.Y; |
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
|
1899 |
if (tX.Round+tY.Round < Gear^.Karma) and |
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
|
1900 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Karma)) 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
|
1901 |
Gear^.State := Gear^.State or gstAttacking |
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
|
1902 |
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
|
1903 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Karma, Gear^.Karma) <> 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
|
1904 |
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
|
1905 |
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
|
1906 |
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
|
1907 |
else // gstAttacking <> 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
|
1908 |
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
|
1909 |
AllInactive := false; |
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
|
1910 |
if (Gear^.Timer and $FF) = 0 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
|
1911 |
PlaySound(sndMineTick); |
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
|
1912 |
if Gear^.Timer = 0 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
|
1913 |
begin |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1914 |
// recheck |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1915 |
if targ <> nil then |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1916 |
begin |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1917 |
tX:=Gear^.X-targ^.X; |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1918 |
tY:=Gear^.Y-targ^.Y; |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1919 |
if (tX.Round+tY.Round < Gear^.Karma) and |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1920 |
(hwRound(hwSqr(tX) + hwSqr(tY)) < sqr(Gear^.Karma)) then |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1921 |
begin |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1922 |
Gear^.Hedgehog:= CurrentHedgehog; |
10993
fd172f166de4
Just to prevent airmines from stealing camera when they blow up... but really what is needed I think is forcing camera to stay on current hedgehog if you are the active player. either all the time, or at least if you are on rope/saucer.
nemo
parents:
10964
diff
changeset
|
1923 |
tmpG:= FollowGear; |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1924 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
10993
fd172f166de4
Just to prevent airmines from stealing camera when they blow up... but really what is needed I think is forcing camera to stay on current hedgehog if you are the active player. either all the time, or at least if you are on rope/saucer.
nemo
parents:
10964
diff
changeset
|
1925 |
FollowGear:= tmpG; |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1926 |
DeleteGear(Gear); |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1927 |
exit |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1928 |
end |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1929 |
end |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1930 |
else if (Gear^.Angle > 0) and (CheckGearNear(Gear, gtHedgehog, Gear^.Karma, Gear^.Karma) <> nil) then |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1931 |
begin |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1932 |
Gear^.Hedgehog:= CurrentHedgehog; |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1933 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Karma, Gear^.Hedgehog, EXPLAutoSound); |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1934 |
DeleteGear(Gear); |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1935 |
exit |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1936 |
end; |
10795
5672d43e8d88
fix pas2c (airbomb code: "not" statement in boolean expression was without parentheses)
sheepluva
parents:
10791
diff
changeset
|
1937 |
Gear^.State:= Gear^.State and (not gstAttacking); |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1938 |
Gear^.Timer:= Gear^.WDTimer |
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
|
1939 |
end; |
10952 | 1940 |
if Gear^.Timer > 0 then |
1941 |
dec(Gear^.Timer); |
|
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
|
1942 |
end |
10797 | 1943 |
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
|
1944 |
else // gsttmpFlag = 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
|
1945 |
if (TurnTimeLeft = 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
|
1946 |
or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime)) |
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
|
1947 |
or (CurrentHedgehog^.Gear = nil) then |
10791
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1948 |
begin |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1949 |
Gear^.FlightTime:= GameTicks; |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1950 |
Gear^.State := Gear^.State or gsttmpFlag |
0311c9fa7498
tweak a few params. still something wtf going on when on rope
nemo
parents:
10789
diff
changeset
|
1951 |
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
|
1952 |
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
|
1953 |
|
39 | 1954 |
//////////////////////////////////////////////////////////////////////////////// |
3714 | 1955 |
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
|
1956 |
var land: Word; |
3710 | 1957 |
begin |
3714 | 1958 |
// 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
|
1959 |
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
|
1960 |
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
|
1961 |
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
|
1962 |
if land = 0 then land:= TestCollisionYwithGear(Gear, 2); |
11305
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:
11286
diff
changeset
|
1963 |
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
|
1964 |
begin |
10964 | 1965 |
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
|
1966 |
begin |
3717 | 1967 |
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
|
1968 |
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
|
1969 |
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
|
1970 |
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
|
1971 |
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
|
1972 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1973 |
end |
3714 | 1974 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
1975 |
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
|
1976 |
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
|
1977 |
DeleteCI(Gear); |
3714 | 1978 |
doStepFallingGear(Gear); |
1979 |
AllInactive := false; |
|
1980 |
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
|
1981 |
end; |
3714 | 1982 |
|
3710 | 1983 |
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
|
1984 |
begin |
3710 | 1985 |
if ((Gear^.State and gstAttacking) = 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
|
1986 |
begin |
3710 | 1987 |
if ((GameTicks and $1F) = 0) then |
11468
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:
11391
diff
changeset
|
1988 |
// 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:
11391
diff
changeset
|
1989 |
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
|
1990 |
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
|
1991 |
end |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
1992 |
else // 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
|
1993 |
begin |
4880
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
1994 |
AllInactive := false; |
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
1995 |
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
|
1996 |
begin |
11468
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:
11391
diff
changeset
|
1997 |
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
|
1998 |
DeleteGear(Gear); |
07e9849c6a70
bugfix: fixing sticky mines calling AddGearCI when they shouldn't (allows jumping on them in midair)
sheepluva
parents:
4874
diff
changeset
|
1999 |
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
|
2000 |
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
|
2001 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2002 |
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
|
2003 |
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
|
2004 |
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
|
2005 |
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
|
2006 |
end |
3710 | 2007 |
else // gsttmpFlag = 0 |
10015 | 2008 |
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
|
2009 |
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
|
2010 |
Gear^.State := Gear^.State or gsttmpFlag; |
3710 | 2011 |
end; |
2012 |
||
2013 |
//////////////////////////////////////////////////////////////////////////////// |
|
39 | 2014 |
procedure doStepDynamite(Gear: PGear); |
11527
44e646598e6a
sparkles for dynamite at sheepy's request. he can tweak values if he wishes
nemo
parents:
11523
diff
changeset
|
2015 |
var VGear: PVisualGear; |
39 | 2016 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2017 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2018 |
AllInactive := false; |
11527
44e646598e6a
sparkles for dynamite at sheepy's request. he can tweak values if he wishes
nemo
parents:
11523
diff
changeset
|
2019 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2020 |
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
|
2021 |
inc(Gear^.Tag); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2022 |
if Gear^.Timer = 1000 then // might need better timing |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2023 |
makeHogsWorry(Gear^.X, Gear^.Y, 75); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2024 |
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
|
2025 |
begin |
11468
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:
11391
diff
changeset
|
2026 |
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
|
2027 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2028 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2029 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2030 |
dec(Gear^.Timer); |
39 | 2031 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2032 |
|
351 | 2033 |
/////////////////////////////////////////////////////////////////////////////// |
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
|
2034 |
|
566f967ec22f
White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents:
2939
diff
changeset
|
2035 |
procedure doStepRollingBarrel(Gear: PGear); |
8795 | 2036 |
var |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2037 |
i, dmg: LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2038 |
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
|
2039 |
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
|
2040 |
begin |
10490 | 2041 |
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
|
2042 |
SetLittle(Gear^.dY); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2043 |
Gear^.State := Gear^.State or gstAnimation; |
9954 | 2044 |
if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and (not gstFrozen); |
8795 | 2045 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2046 |
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
|
2047 |
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
|
2048 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2049 |
DeleteCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2050 |
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
|
2051 |
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
|
2052 |
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
|
2053 |
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
|
2054 |
begin |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2055 |
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
|
2056 |
begin |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2057 |
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
|
2058 |
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
|
2059 |
begin |
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2060 |
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
|
2061 |
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
|
2062 |
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
|
2063 |
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
|
2064 |
end; |
10679
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2065 |
dmg:= hwRound(dxdy * _50); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2066 |
inc(Gear^.Damage, dmg); |
5989c293955a
add a couple of onGearDamage callbacks to mine/barrel fall damage
nemo
parents:
10676
diff
changeset
|
2067 |
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
|
2068 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2069 |
CalcRotationDirAngle(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2070 |
//CheckGearDrowning(Gear) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2071 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2072 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2073 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2074 |
Gear^.State := Gear^.State or gsttmpFlag; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2075 |
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
|
2076 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2077 |
|
2944
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2078 |
(* |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2079 |
Attempt to make a barrel knock itself over an edge. Would need more checks to avoid issues like burn damage |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2080 |
begin |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2081 |
x:= hwRound(Gear^.X); |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2082 |
y:= hwRound(Gear^.Y); |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2083 |
if (((y+1) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2084 |
if (Land[y+1, x] = 0) then |
2944
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2085 |
begin |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2086 |
if (((y+1) and LAND_HEIGHT_MASK) = 0) and (((x+Gear^.Radius-2) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x+Gear^.Radius-2] = 0) then |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2087 |
Gear^.dX:= -_0_08 |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2088 |
else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2089 |
Gear^.dX:= _0_08; |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2090 |
end; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2091 |
if Gear^.dX.QWordValue = 0 then AddCI(Gear) |
2944
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2092 |
end; *) |
e8a891bf6660
Adjust fall damage again, zero out X/Y to avoid sinking/shivering barrels.
nemo
parents:
2941
diff
changeset
|
2093 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2094 |
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
|
2095 |
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
|
2096 |
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
|
2097 |
Gear^.dX := _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2098 |
|
5128
3c65326bb713
Check for 0 health to avoid div by 0. spotted by mikade.
nemo
parents:
5121
diff
changeset
|
2099 |
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
|
2100 |
if (cBarrelHealth div Gear^.Health) > 2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2101 |
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
|
2102 |
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
|
2103 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2104 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2105 |
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
|
2106 |
if 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
|
2107 |
doStepCase(Gear); |
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
|
2108 |
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
|
2109 |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2110 |
procedure doStepCase(Gear: PGear); |
8795 | 2111 |
var |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
2112 |
i, x, y: LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2113 |
k: TGearType; |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
2114 |
dX, dY: HWFloat; |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
2115 |
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
|
2116 |
sparkles: PVisualGear; |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
2117 |
gi: PGear; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2118 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2119 |
k := Gear^.Kind; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2120 |
|
3894 | 2121 |
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
|
2122 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2123 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2124 |
FreeActionsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2125 |
SetAllToActive; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2126 |
// something (hh, mine, etc...) could be on top of the case |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2127 |
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
|
2128 |
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
|
2129 |
Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2130 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2131 |
end; |
9954 | 2132 |
if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and (not gstFrozen); |
15 | 2133 |
|
8973 | 2134 |
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
|
2135 |
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
|
2136 |
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
|
2137 |
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
|
2138 |
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
|
2139 |
|
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
|
2140 |
DeleteGear(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
|
2141 |
// <-- delete 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
|
2142 |
|
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
|
2143 |
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
|
2144 |
begin |
11468
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:
11391
diff
changeset
|
2145 |
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
|
2146 |
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
|
2147 |
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
|
2148 |
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
|
2149 |
else if k = gtExplosives 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
|
2150 |
begin |
11468
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:
11391
diff
changeset
|
2151 |
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
|
2152 |
for i:= 0 to 31 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
|
2153 |
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
|
2154 |
dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1); |
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
|
2155 |
dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1); |
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
|
2156 |
AddGear(x, y, gtFlame, 0, dX, dY, 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
|
2157 |
AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 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
|
2158 |
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
|
2159 |
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
|
2160 |
exit |
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
|
2161 |
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
|
2162 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2163 |
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
|
2164 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2165 |
//if V > _0_03 then 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
|
2166 |
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
|
2167 |
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
|
2168 |
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
|
2169 |
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
|
2170 |
end |
8958
3818b38d72c0
simplify mine/explosive damage calc. clear dX in stable explosives. remove 0/4096 in trace routines.
nemo
parents:
8952
diff
changeset
|
2171 |
else Gear^.dX:= _0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2172 |
|
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
|
2173 |
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
|
2174 |
if (cBarrelHealth div Gear^.Health) > 2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2175 |
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
|
2176 |
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
|
2177 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2178 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2179 |
Gear^.Damage := 0; |
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
|
2180 |
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
|
2181 |
else |
8795 | 2182 |
begin |
7276 | 2183 |
if Gear^.Timer = 500 then |
2184 |
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
|
2185 |
(* 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
|
2186 |
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
|
2187 |
has its own complexities. *) |
7276 | 2188 |
// Abuse a couple of gear values to track origin |
7339 | 2189 |
Gear^.Angle:= hwRound(Gear^.Y); |
7276 | 2190 |
Gear^.Tag:= random(2); |
2191 |
inc(Gear^.Timer) |
|
2192 |
end; |
|
2193 |
if Gear^.Timer < 1833 then inc(Gear^.Timer); |
|
2194 |
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
|
2195 |
begin |
7339 | 2196 |
sparkles:= AddVisualGear(hwRound(Gear^.X), Gear^.Angle, vgtDust, 1); |
7276 | 2197 |
if sparkles <> nil then |
2198 |
begin |
|
2199 |
sparkles^.dX:= 0; |
|
2200 |
sparkles^.dY:= 0; |
|
2201 |
sparkles^.Angle:= 270; |
|
8795 | 2202 |
if Gear^.Tag = 1 then |
7276 | 2203 |
sparkles^.Tint:= $3744D7FF |
2204 |
else sparkles^.Tint:= $FAB22CFF |
|
2205 |
end; |
|
2206 |
end; |
|
8795 | 2207 |
if Gear^.Timer < 1000 then |
7283 | 2208 |
begin |
2209 |
AllInactive:= false; |
|
2210 |
exit |
|
2211 |
end |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2212 |
end; |
2911 | 2213 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2214 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2215 |
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
|
2216 |
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
|
2217 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2218 |
AllInactive := false; |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2219 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2220 |
Gear^.dY := Gear^.dY + cGravity; |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2221 |
|
9820 | 2222 |
if ((not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0)) or |
2223 |
(Gear^.dY.isNegative and (TestCollisionYwithGear(Gear, -1) <> 0)) then |
|
2224 |
Gear^.dY := _0 |
|
2225 |
else Gear^.Y := Gear^.Y + Gear^.dY; |
|
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2226 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2227 |
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
|
2228 |
SetAllHHToActive(false); |
7661
3046ad5b361e
fix for issue 376 (embedding barrels in ceiling)
sheepluva
parents:
7659
diff
changeset
|
2229 |
|
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
|
2230 |
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
|
2231 |
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
|
2232 |
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
|
2233 |
inc(Gear^.Damage, hwRound(Gear^.dY * _70)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2234 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2235 |
if Gear^.dY > _0_2 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2236 |
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
|
2237 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
8795 | 2238 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2239 |
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
|
2240 |
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
|
2241 |
Gear^.dY := _0 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2242 |
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
|
2243 |
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
|
2244 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2245 |
//if Gear^.dY > - _0_001 then Gear^.dY:= _0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2246 |
CheckGearDrowning(Gear); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2247 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2248 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2249 |
if (Gear^.dY.QWordValue = 0) then |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
2250 |
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
|
2251 |
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
|
2252 |
DeleteCI(Gear) |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
2253 |
end; |
49 | 2254 |
|
2255 |
//////////////////////////////////////////////////////////////////////////////// |
|
2460 | 2256 |
|
2257 |
procedure doStepTarget(Gear: PGear); |
|
2258 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2259 |
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
|
2260 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2261 |
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
|
2262 |
// 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
|
2263 |
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
|
2264 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2265 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2266 |
if (Gear^.Tag = 0) and (Gear^.Timer < 1000) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2267 |
inc(Gear^.Timer) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2268 |
else if Gear^.Tag = 1 then |
4808 | 2269 |
Gear^.Tag := 2 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2270 |
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
|
2271 |
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
|
2272 |
dec(Gear^.Timer) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2273 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2274 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2275 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2276 |
exit; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2277 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2278 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2279 |
doStepCase(Gear) |
2460 | 2280 |
end; |
2281 |
||
2282 |
//////////////////////////////////////////////////////////////////////////////// |
|
854 | 2283 |
procedure doStepIdle(Gear: PGear); |
2284 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2285 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2286 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2287 |
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
|
2288 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2289 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2290 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2291 |
end |
854 | 2292 |
end; |
2293 |
||
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
|
2294 |
//////////////////////////////////////////////////////////////////////////////// |
79 | 2295 |
procedure doStepShover(Gear: PGear); |
8795 | 2296 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2297 |
HHGear: PGear; |
79 | 2298 |
begin |
4365 | 2299 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2300 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2301 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2302 |
|
11468
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:
11391
diff
changeset
|
2303 |
AmmoShove(Gear, Gear^.Boom, 115); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2304 |
|
4182 | 2305 |
HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2306 |
Gear^.Timer := 250; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2307 |
Gear^.doStep := @doStepIdle |
79 | 2308 |
end; |
2309 |
||
2310 |
//////////////////////////////////////////////////////////////////////////////// |
|
925 | 2311 |
procedure doStepWhip(Gear: PGear); |
8795 | 2312 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2313 |
HHGear: PGear; |
925 | 2314 |
i: LongInt; |
2315 |
begin |
|
4365 | 2316 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2317 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2318 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2319 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2320 |
for i:= 0 to 3 do |
4578 | 2321 |
begin |
9723
31d10d684e90
whip: visual enhancements (hat'n'dust) as suggested by nemo
sheepluva
parents:
9721
diff
changeset
|
2322 |
AddVisualGear(hwRound(Gear^.X) + hwSign(Gear^.dX) * (10 + 6 * i), hwRound(Gear^.Y) + 12 + Random(6), vgtDust); |
11468
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:
11391
diff
changeset
|
2323 |
AmmoShove(Gear, Gear^.Boom, 25); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2324 |
Gear^.X := Gear^.X + Gear^.dX * 5 |
4578 | 2325 |
end; |
925 | 2326 |
|
4182 | 2327 |
HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving; |
2328 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2329 |
Gear^.Timer := 250; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2330 |
Gear^.doStep := @doStepIdle |
925 | 2331 |
end; |
2332 |
||
2333 |
//////////////////////////////////////////////////////////////////////////////// |
|
79 | 2334 |
procedure doStepFlame(Gear: PGear); |
8795 | 2335 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2336 |
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
|
2337 |
sticky: Boolean; |
3751 | 2338 |
vgt: PVisualGear; |
10591 | 2339 |
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
|
2340 |
landPixel: Word; |
79 | 2341 |
begin |
9477 | 2342 |
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
|
2343 |
if Gear^.FlightTime > 0 then dec(Gear^.FlightTime); |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2344 |
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
|
2345 |
if not sticky then AllInactive := false; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2346 |
|
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
|
2347 |
landPixel:= TestCollisionYwithGear(Gear, 1); |
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
|
2348 |
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
|
2349 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2350 |
AllInactive := false; |
3751 | 2351 |
|
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
|
2352 |
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
|
2353 |
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
|
2354 |
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
|
2355 |
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
|
2356 |
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
|
2357 |
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
|
2358 |
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
|
2359 |
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
|
2360 |
Gear^.dY.isNegative:= true; |
11468
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:
11391
diff
changeset
|
2361 |
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
|
2362 |
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
|
2363 |
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
|
2364 |
Gear^.Radius := 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
|
2365 |
end; |
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
|
2366 |
|
3751 | 2367 |
if ((GameTicks mod 100) = 0) then |
2368 |
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
|
2369 |
vgt:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire, gstTmpFlag); |
3751 | 2370 |
if vgt <> nil then |
2371 |
begin |
|
2372 |
vgt^.dx:= 0; |
|
2373 |
vgt^.dy:= 0; |
|
2374 |
vgt^.FrameTicks:= 1800 div (Gear^.Tag mod 3 + 2); |
|
2375 |
end; |
|
2376 |
end; |
|
2377 |
||
10591 | 2378 |
if (Gear^.dX.QWordValue > _2.QWordValue) |
2379 |
or (Gear^.dY.QWordValue > _2.QWordValue) |
|
2380 |
then |
|
2381 |
begin |
|
2382 |
// 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
|
2383 |
f:= _1_9 / Distance(Gear^.dX, Gear^.dY); |
10591 | 2384 |
Gear^.dX:= Gear^.dX * f; |
2385 |
Gear^.dY:= Gear^.dY * f; |
|
2386 |
end |
|
2387 |
else begin |
|
2388 |
if Gear^.dX.QWordValue > _0_01.QWordValue then |
|
2389 |
Gear^.dX := Gear^.dX * _0_995; |
|
2390 |
||
2391 |
Gear^.dY := Gear^.dY + cGravity; |
|
2392 |
// if sticky then Gear^.dY := Gear^.dY + cGravity; |
|
2393 |
||
2394 |
if Gear^.dY.QWordValue > _0_2.QWordValue then |
|
2395 |
Gear^.dY := Gear^.dY * _0_995; |
|
2396 |
||
2397 |
//if sticky then Gear^.X := Gear^.X + Gear^.dX else |
|
2398 |
Gear^.X := Gear^.X + Gear^.dX + cWindSpeed * 640; |
|
2399 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
2400 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2401 |
|
10354 | 2402 |
gX := hwRound(Gear^.X); |
2403 |
gY := hwRound(Gear^.Y); |
|
2404 |
||
2405 |
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
|
2406 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2407 |
for i:= 0 to 3 do |
10354 | 2408 |
AddVisualGear(gX - 8 + Random(16), gY - 8 + Random(16), vgtSteam); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2409 |
PlaySound(sndVaporize); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2410 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2411 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2412 |
end |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2413 |
end |
10015 | 2414 |
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
|
2415 |
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
|
2416 |
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
|
2417 |
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
|
2418 |
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
|
2419 |
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
|
2420 |
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
|
2421 |
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
|
2422 |
gY := hwRound(Gear^.Y) - 6; |
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
|
2423 |
DrawExplosion(gX, gY, 4); |
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
|
2424 |
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
|
2425 |
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
|
2426 |
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
|
2427 |
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
|
2428 |
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
|
2429 |
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
|
2430 |
end; |
9277
ad1ec7212ac7
reduce shove frequency (perf). reduce dX so that less time is spent sliding.
nemo
parents:
9251
diff
changeset
|
2431 |
if sticky and (GameTicks and $F = 0) then |
5024 | 2432 |
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
|
2433 |
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
|
2434 |
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
|
2435 |
tdY:= Gear^.dY; |
9277
ad1ec7212ac7
reduce shove frequency (perf). reduce dX so that less time is spent sliding.
nemo
parents:
9251
diff
changeset
|
2436 |
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
|
2437 |
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
|
2438 |
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
|
2439 |
Gear^.dY.isNegative:= true; |
11468
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:
11391
diff
changeset
|
2440 |
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
|
2441 |
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
|
2442 |
Gear^.dY:= tdY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2443 |
Gear^.Radius := 1 |
5024 | 2444 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2445 |
if Gear^.Timer > 0 then |
5024 | 2446 |
begin |
2475 | 2447 |
dec(Gear^.Timer); |
2448 |
inc(Gear^.Damage) |
|
5024 | 2449 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2450 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2451 |
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
|
2452 |
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
|
2453 |
gY := hwRound(Gear^.Y); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2454 |
// Standard fire |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2455 |
if not sticky then |
5024 | 2456 |
begin |
3640
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2457 |
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
|
2458 |
begin |
54676a34b9ad
Reduce calls to expensive operations in fire. Slightly alters fire behaviour, but should still be reasonable
nemo
parents:
3609
diff
changeset
|
2459 |
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
|
2460 |
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
|
2461 |
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
|
2462 |
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
|
2463 |
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
|
2464 |
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
|
2465 |
Gear^.dY.isNegative:= true; |
11468
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:
11391
diff
changeset
|
2466 |
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
|
2467 |
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
|
2468 |
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
|
2469 |
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
|
2470 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2471 |
else if ((GameTicks and $3) = 3) then |
11468
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:
11391
diff
changeset
|
2472 |
doMakeExplosion(gX, gY, Gear^.Boom * 4, Gear^.Hedgehog, 0);//, EXPLNoDamage); |
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset
|
2473 |
//DrawExplosion(gX, gY, 4); |
8795 | 2474 |
|
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
|
2475 |
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
|
2476 |
for i:= Random(2) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2477 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
8795 | 2478 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2479 |
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
|
2480 |
dec(Gear^.Health); |
9809 | 2481 |
Gear^.Timer := 450 - Gear^.Tag * 8 + LongInt(GetRandom(2)) |
5024 | 2482 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2483 |
else |
5024 | 2484 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2485 |
// Modified fire |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2486 |
if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then |
5024 | 2487 |
begin |
3143 | 2488 |
DrawExplosion(gX, gY, 4); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2489 |
|
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
|
2490 |
for i:= Random(3) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2491 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
5024 | 2492 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2493 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2494 |
// This one is interesting. I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom. |
9809 | 2495 |
Gear^.Timer := 100 - Gear^.Tag * 3 + LongInt(GetRandom(2)); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2496 |
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
|
2497 |
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
|
2498 |
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
|
2499 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2500 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2501 |
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
|
2502 |
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
|
2503 |
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
|
2504 |
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
|
2505 |
if not sticky then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2506 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2507 |
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
|
2508 |
for i:= Random(2) downto 0 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2509 |
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
|
2510 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2511 |
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
|
2512 |
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
|
2513 |
AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2514 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2515 |
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
|
2516 |
end; |
79 | 2517 |
end; |
82 | 2518 |
|
2519 |
//////////////////////////////////////////////////////////////////////////////// |
|
2520 |
procedure doStepFirePunchWork(Gear: PGear); |
|
8795 | 2521 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2522 |
HHGear: PGear; |
82 | 2523 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2524 |
AllInactive := false; |
3894 | 2525 |
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
|
2526 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2527 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2528 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2529 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2530 |
end; |
82 | 2531 |
|
4365 | 2532 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2533 |
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
|
2534 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2535 |
Gear^.Tag := hwRound(HHGear^.Y); |
10887 | 2536 |
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
|
2537 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2538 |
Gear^.Y := HHGear^.Y; |
11468
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:
11391
diff
changeset
|
2539 |
AmmoShove(Gear, Gear^.Boom, 40); |
6450 | 2540 |
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
|
2541 |
end; |
351 | 2542 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2543 |
HHGear^.dY := HHGear^.dY + cGravity; |
9824 | 2544 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
2545 |
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
|
2546 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2547 |
HHGear^.State := HHGear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2548 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2549 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2550 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2551 |
end; |
2089 | 2552 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2553 |
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
|
2554 |
lfIndestructible) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2555 |
HHGear^.Y := HHGear^.Y + HHGear^.dY |
82 | 2556 |
end; |
2557 |
||
2558 |
procedure doStepFirePunch(Gear: PGear); |
|
8795 | 2559 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2560 |
HHGear: PGear; |
82 | 2561 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2562 |
AllInactive := false; |
4365 | 2563 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2564 |
DeleteCI(HHGear); |
6156 | 2565 |
//HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; WTF? |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2566 |
HHGear^.dX := SignAs(cLittle, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2567 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2568 |
HHGear^.dY := - _0_3; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2569 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2570 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2571 |
Gear^.dX := SignAs(_0_45, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2572 |
Gear^.dY := - _0_9; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2573 |
Gear^.doStep := @doStepFirePunchWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2574 |
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
|
2575 |
|
7053 | 2576 |
PlaySoundV(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.voicepack) |
82 | 2577 |
end; |
2578 |
||
263 | 2579 |
//////////////////////////////////////////////////////////////////////////////// |
2580 |
||
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2581 |
procedure doStepParachuteWork(Gear: PGear); |
8795 | 2582 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2583 |
HHGear: PGear; |
211 | 2584 |
begin |
4365 | 2585 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2586 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2587 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2588 |
|
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
|
2589 |
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
|
2590 |
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
|
2591 |
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
|
2592 |
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
|
2593 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2594 |
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
|
2595 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2596 |
Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2597 |
SetLittle(dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2598 |
dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2599 |
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
|
2600 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2601 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2602 |
isCursorVisible := false; |
4372 | 2603 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2604 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2605 |
end; |
211 | 2606 |
|
4774 | 2607 |
HHGear^.X := HHGear^.X + cWindSpeed * 200; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2608 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2609 |
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
|
2610 |
HHGear^.X := HHGear^.X - cMaxWindSpeed * 80 |
8795 | 2611 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2612 |
else 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
|
2613 |
HHGear^.X := HHGear^.X + cMaxWindSpeed * 80; |
8795 | 2614 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2615 |
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
|
2616 |
HHGear^.Y := HHGear^.Y - cGravity * 40 |
8795 | 2617 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2618 |
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
|
2619 |
HHGear^.Y := HHGear^.Y + cGravity * 40; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2620 |
|
4774 | 2621 |
// don't drift into obstacles |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
2622 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0 then |
4774 | 2623 |
HHGear^.X := HHGear^.X - int2hwFloat(hwSign(HHGear^.dX)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2624 |
HHGear^.Y := HHGear^.Y + cGravity * 100; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2625 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2626 |
Gear^.Y := HHGear^.Y |
263 | 2627 |
end; |
211 | 2628 |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2629 |
procedure doStepParachute(Gear: PGear); |
8795 | 2630 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2631 |
HHGear: PGear; |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2632 |
begin |
4365 | 2633 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2634 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2635 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2636 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2637 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2638 |
|
11342
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11305
diff
changeset
|
2639 |
// 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:
11305
diff
changeset
|
2640 |
if (HHGear^.State and gstHHHJump) <> 0 then |
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11305
diff
changeset
|
2641 |
HHGear^.dX.isNegative := (not HHGear^.dX.isNegative); |
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11305
diff
changeset
|
2642 |
|
aa3f886c6298
fix hedgehog on parachute facing in wrong direction if parachute opens during double-jump
sheepluva
parents:
11305
diff
changeset
|
2643 |
HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked or gstMoving or gstHHJumping or gstHHHJump)); |
6450 | 2644 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2645 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2646 |
Gear^.doStep := @doStepParachuteWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2647 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2648 |
Gear^.Message := HHGear^.Message; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2649 |
doStepParachuteWork(Gear) |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2650 |
end; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
2651 |
|
263 | 2652 |
//////////////////////////////////////////////////////////////////////////////// |
2653 |
procedure doStepAirAttackWork(Gear: PGear); |
|
2654 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2655 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2656 |
Gear^.X := Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2657 |
|
11540 | 2658 |
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
|
2659 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2660 |
dec(Gear^.Health); |
8795 | 2661 |
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
|
2662 |
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
|
2663 |
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
|
2664 |
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
|
2665 |
3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed * Gear^.Tag, _0, Gear^.Timer + 1); |
4246
e5cb885492df
drillstrike! might require the drill patch to improve behavior
koda
parents:
4233
diff
changeset
|
2666 |
//4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed * |
e5cb885492df
drillstrike! might require the drill patch to improve behavior
koda
parents:
4233
diff
changeset
|
2667 |
// Gear^.Tag, _0, 5000); |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2668 |
end; |
11170
22d8835beb4d
Allow for arbitrary number of airstrike bombs and spacing.
nemo
parents:
11169
diff
changeset
|
2669 |
Gear^.dX := Gear^.dX + int2hwFloat(Gear^.Damage * Gear^.Tag); |
10512
25021aac078e
fix underwater-skipping bug and make air-strike missiles submersible when fired from within weSea
sheepluva
parents:
10510
diff
changeset
|
2670 |
if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then |
25021aac078e
fix underwater-skipping bug and make air-strike missiles submersible when fired from within weSea
sheepluva
parents:
10510
diff
changeset
|
2671 |
FollowGear^.State:= FollowGear^.State or gstSubmersible; |
7053 | 2672 |
StopSoundChan(Gear^.SoundChannel, 4000); |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2673 |
end; |
1124 | 2674 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2675 |
if (GameTicks and $3F) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2676 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2677 |
|
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
|
2678 |
if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -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
|
2679 |
begin |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
2680 |
// avoid to play forever (is this necessary?) |
7053 | 2681 |
StopSoundChan(Gear^.SoundChannel); |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
2682 |
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
|
2683 |
end; |
263 | 2684 |
end; |
2685 |
||
2686 |
procedure doStepAirAttack(Gear: PGear); |
|
2687 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2688 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2689 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2690 |
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
|
2691 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2692 |
Gear^.Tag := 1; |
5067
57101536cf86
fix for Issue 207: To far left for Napalm (and other weapons)
sheepluva
parents:
5063
diff
changeset
|
2693 |
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
|
2694 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2695 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2696 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2697 |
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
|
2698 |
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
|
2699 |
end; |
1507 | 2700 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2701 |
Gear^.Y := int2hwFloat(topY-300); |
11540 | 2702 |
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
|
2703 |
|
4778
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
2704 |
// 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
|
2705 |
if (Gear^.State = 2) then |
8795 | 2706 |
Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900 |
4778
1565a553d200
have napalm strike bombs explode right over the target
sheepluva
parents:
4774
diff
changeset
|
2707 |
// calcs for regular falling gears |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2708 |
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
|
2709 |
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
|
2710 |
cGravity) * Gear^.Tag; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2711 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2712 |
Gear^.doStep := @doStepAirAttackWork; |
4956
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
2713 |
Gear^.SoundChannel := LoopSound(sndPlane, 4000); |
48e1f9a04c28
usound: added function for loops with fade in and out
koda
parents:
4886
diff
changeset
|
2714 |
|
263 | 2715 |
end; |
2716 |
||
2717 |
//////////////////////////////////////////////////////////////////////////////// |
|
2718 |
||
2719 |
procedure doStepAirBomb(Gear: PGear); |
|
2720 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2721 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2722 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2723 |
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
|
2724 |
begin |
11468
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:
11391
diff
changeset
|
2725 |
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
|
2726 |
DeleteGear(Gear); |
9954 | 2727 |
{$IFNDEF PAS2C} |
8204 | 2728 |
with mobileRecord do |
2729 |
if (performRumble <> nil) and (not fastUntilLag) then |
|
2730 |
performRumble(kSystemSoundID_Vibrate); |
|
9954 | 2731 |
{$ENDIF} |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2732 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2733 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2734 |
if (GameTicks and $3F) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2735 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) |
211 | 2736 |
end; |
409 | 2737 |
|
2738 |
//////////////////////////////////////////////////////////////////////////////// |
|
2739 |
||
2740 |
procedure doStepGirder(Gear: PGear); |
|
8795 | 2741 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2742 |
HHGear: PGear; |
1915 | 2743 |
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
|
2744 |
rx: LongInt; |
9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9767
diff
changeset
|
2745 |
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
|
2746 |
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
|
2747 |
distFail: boolean; |
409 | 2748 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2749 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2750 |
|
4365 | 2751 |
HHGear := Gear^.Hedgehog^.Gear; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2752 |
tx := int2hwFloat(Gear^.Target.X); |
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2753 |
ty := int2hwFloat(Gear^.Target.Y); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2754 |
x := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2755 |
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
|
2756 |
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
|
2757 |
|
9768
08799c901a42
Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents:
9767
diff
changeset
|
2758 |
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
|
2759 |
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
|
2760 |
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
|
2761 |
|
11057
adb5ef54da54
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
sheepluva
parents:
11046
diff
changeset
|
2762 |
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
|
2763 |
( |
11057
adb5ef54da54
global variable for defining construction distance limit. value smaller 1 means no limit (wip)
sheepluva
parents:
11046
diff
changeset
|
2764 |
(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
|
2765 |
(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
|
2766 |
))); |
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
|
2767 |
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
|
2768 |
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
|
2769 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2770 |
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
|
2771 |
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
|
2772 |
begin |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2773 |
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
|
2774 |
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
|
2775 |
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
|
2776 |
end; |
6450 | 2777 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
2778 |
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
|
2779 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2780 |
isCursorVisible := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2781 |
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
|
2782 |
end |
8795 | 2783 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2784 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2785 |
PlaySound(sndPlaced); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2786 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2787 |
AfterAttack; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2788 |
end; |
1914 | 2789 |
|
6450 | 2790 |
HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked)); |
2791 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
|
409 | 2792 |
end; |
520 | 2793 |
|
2794 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 2795 |
procedure doStepTeleportAfter(Gear: PGear); |
8795 | 2796 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2797 |
HHGear: PGear; |
912 | 2798 |
begin |
4365 | 2799 |
HHGear := Gear^.Hedgehog^.Gear; |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2800 |
if HHGear <> nil then doStepHedgehogMoving(HHGear); |
7659 | 2801 |
// if not infattack mode wait for hedgehog finish falling to collect cases |
2802 |
if ((GameFlags and gfInfAttack) <> 0) |
|
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2803 |
or (HHGear = nil) |
7659 | 2804 |
or ((HHGear^.State and gstMoving) = 0) |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2805 |
or (HHGear^.Damage > 0) |
7659 | 2806 |
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
|
2807 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2808 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2809 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2810 |
end |
912 | 2811 |
end; |
2812 |
||
2813 |
procedure doStepTeleportAnim(Gear: PGear); |
|
525 | 2814 |
begin |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2815 |
if (Gear^.Hedgehog^.Gear = nil) or (Gear^.Hedgehog^.Gear^.Damage > 0) then |
7659 | 2816 |
begin |
2817 |
DeleteGear(Gear); |
|
2818 |
AfterAttack; |
|
2819 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2820 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2821 |
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
|
2822 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2823 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2824 |
inc(Gear^.Pos); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2825 |
if Gear^.Pos = 11 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2826 |
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
|
2827 |
end; |
525 | 2828 |
end; |
520 | 2829 |
|
2830 |
procedure doStepTeleport(Gear: PGear); |
|
8795 | 2831 |
var |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2832 |
lx, ty, y, oy: LongInt; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2833 |
HHGear : PGear; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2834 |
valid : Boolean; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2835 |
warn : PVisualGear; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2836 |
const |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2837 |
ytol = cHHRadius; |
520 | 2838 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2839 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2840 |
|
4365 | 2841 |
HHGear := Gear^.Hedgehog^.Gear; |
11070
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2842 |
if HHGear = nil then |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2843 |
begin |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2844 |
DeleteGear(Gear); |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2845 |
exit |
f9a03078dd4f
Add some HHGear nil checks to teleport. google bug #974
nemo
parents:
11057
diff
changeset
|
2846 |
end; |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2847 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2848 |
valid:= false; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2849 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2850 |
lx:= Gear^.Target.X - SpritesData[sprHHTelepMask].Width div 2; // left |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2851 |
ty:= Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2; // top |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2852 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2853 |
// remember original target location |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2854 |
oy:= Gear^.Target.Y; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2855 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2856 |
for y:= ty downto ty - ytol do |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2857 |
begin |
10897
8ea636ce120a
Add options to set colouring, behind existing land, and horizontal/vertical flipping to PlaceSprite
nemo
parents:
10895
diff
changeset
|
2858 |
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
|
2859 |
begin |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2860 |
valid:= true; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2861 |
break; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2862 |
end; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2863 |
dec(Gear^.Target.Y); |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2864 |
end; |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2865 |
|
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2866 |
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
|
2867 |
begin |
6450 | 2868 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
2869 |
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
|
2870 |
HHGear^.State := HHGear^.State or gstChooseTarget; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2871 |
isCursorVisible := true; |
10298
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2872 |
warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true); |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2873 |
if warn <> nil then |
7d5d93f9a515
make using the teleporter a bit less challenging
sheepluva
parents:
10286
diff
changeset
|
2874 |
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
|
2875 |
DeleteGear(Gear); |
7111b4a46b5c
fix for Issue 855: Failure to teleport rarely makes engine crash
sheepluva
parents:
10663
diff
changeset
|
2876 |
PlaySound(sndDenied); |
7111b4a46b5c
fix for Issue 855: Failure to teleport rarely makes engine crash
sheepluva
parents:
10663
diff
changeset
|
2877 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2878 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2879 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2880 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2881 |
DeleteCI(HHGear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2882 |
SetAllHHToActive; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2883 |
Gear^.doStep := @doStepTeleportAnim; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2884 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2885 |
// 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
|
2886 |
Gear^.dX := HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2887 |
// 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
|
2888 |
HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2889 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2890 |
Gear^.Y := HHGear^.Y; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2891 |
HHGear^.X := int2hwFloat(Gear^.Target.X); |
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2892 |
HHGear^.Y := int2hwFloat(Gear^.Target.Y); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2893 |
HHGear^.State := HHGear^.State or gstMoving; |
10547
cc439790ebae
fix for Issue 828: Manual placement animation is drawn twice
sheepluva
parents:
10545
diff
changeset
|
2894 |
if not Gear^.Hedgehog^.Unplaced then |
cc439790ebae
fix for Issue 828: Manual placement animation is drawn twice
sheepluva
parents:
10545
diff
changeset
|
2895 |
Gear^.State:= Gear^.State or gstAnimation; |
7659 | 2896 |
Gear^.Hedgehog^.Unplaced := false; |
2897 |
isCursorVisible := false; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
2898 |
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
|
2899 |
end; |
5612
2638dec1b323
This really should have been a TPoint for consistency
nemo
parents:
5606
diff
changeset
|
2900 |
Gear^.Target.X:= NoPointX |
520 | 2901 |
end; |
534 | 2902 |
|
2903 |
//////////////////////////////////////////////////////////////////////////////// |
|
2904 |
procedure doStepSwitcherWork(Gear: PGear); |
|
8795 | 2905 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2906 |
HHGear: PGear; |
7341
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
2907 |
hedgehog: PHedgehog; |
6992 | 2908 |
State: Longword; |
10494 | 2909 |
switchDir: Longword; |
534 | 2910 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2911 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2912 |
|
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2913 |
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
|
2914 |
begin |
7341
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
2915 |
hedgehog := Gear^.Hedgehog; |
6535
51a7e71ad317
It seems there's no need to copy gear's msg. Fixes bots getting stuck after hog switch.
unc0rr
parents:
6532
diff
changeset
|
2916 |
//Msg := Gear^.Message and (not gmSwitch); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2917 |
DeleteGear(Gear); |
7341
d70478d265ec
Fix crash when hedgehog dies while switching from it
unc0rr
parents:
7339
diff
changeset
|
2918 |
ApplyAmmoChanges(hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2919 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2920 |
HHGear := CurrentHedgehog^.Gear; |
4372 | 2921 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
6535
51a7e71ad317
It seems there's no need to copy gear's msg. Fixes bots getting stuck after hog switch.
unc0rr
parents:
6532
diff
changeset
|
2922 |
//HHGear^.Message := Msg; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2923 |
exit |
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; |
534 | 2925 |
|
3894 | 2926 |
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
|
2927 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2928 |
HHGear := CurrentHedgehog^.Gear; |
6450 | 2929 |
HHGear^.Message := HHGear^.Message and (not gmSwitch); |
2930 |
Gear^.Message := Gear^.Message and (not gmSwitch); |
|
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2931 |
|
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2932 |
// switching in reverse direction |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2933 |
if (Gear^.Message and gmPrecise) <> 0 then |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2934 |
begin |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2935 |
HHGear^.Message := HHGear^.Message and (not gmPrecise); |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2936 |
switchDir:= CurrentTeam^.HedgehogsNumber - 1; |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2937 |
end |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2938 |
else |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2939 |
switchDir:= 1; |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2940 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2941 |
State := HHGear^.State; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2942 |
HHGear^.State := 0; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
2943 |
HHGear^.Z := cHHZ; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2944 |
HHGear^.Active := false; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
2945 |
HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2946 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2947 |
PlaySound(sndSwitchHog); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2948 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2949 |
repeat |
10494 | 2950 |
CurrentTeam^.CurrHedgehog := (CurrentTeam^.CurrHedgehog + switchDir) mod CurrentTeam^.HedgehogsNumber; |
8795 | 2951 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and |
2952 |
(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and |
|
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
2953 |
(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen]=0); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2954 |
|
7270
93e92e82d5c8
Step 1. Add current hedgehog as top bit of bottom byte.
nemo
parents:
7268
diff
changeset
|
2955 |
SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]); |
8795 | 2956 |
AmmoMenuInvalidated:= true; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2957 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2958 |
HHGear := CurrentHedgehog^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2959 |
HHGear^.State := State; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2960 |
HHGear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2961 |
FollowGear := HHGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2962 |
HHGear^.Z := cCurrHHZ; |
10145
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2963 |
// restore precise key |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2964 |
if (switchDir <> 1) then |
67b255f839db
allow switching through hogs in reverse order with PRECISE+HOGSWITCH
sheepluva
parents:
10135
diff
changeset
|
2965 |
HHGear^.Message:= HHGear^.Message or gmPrecise; |
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset
|
2966 |
HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2967 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2968 |
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
|
2969 |
end; |
534 | 2970 |
end; |
2971 |
||
2972 |
procedure doStepSwitcher(Gear: PGear); |
|
8795 | 2973 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2974 |
HHGear: PGear; |
534 | 2975 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2976 |
Gear^.doStep := @doStepSwitcherWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2977 |
|
4365 | 2978 |
HHGear := Gear^.Hedgehog^.Gear; |
5358 | 2979 |
OnUsedAmmo(HHGear^.Hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2980 |
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
|
2981 |
begin |
6450 | 2982 |
State := State and (not gstAttacking); |
2983 |
Message := Message and (not gmAttack) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
2984 |
end |
534 | 2985 |
end; |
924 | 2986 |
|
2987 |
//////////////////////////////////////////////////////////////////////////////// |
|
2988 |
procedure doStepMortar(Gear: PGear); |
|
8795 | 2989 |
var |
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset
|
2990 |
dX, dY, gdX, gdY: hwFloat; |
924 | 2991 |
i: LongInt; |
2992 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2993 |
AllInactive := false; |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
2994 |
gdX := Gear^.dX; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
2995 |
gdY := Gear^.dY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2996 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2997 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
2998 |
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
|
2999 |
begin |
11468
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:
11391
diff
changeset
|
3000 |
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
|
3001 |
gdX.isNegative := not gdX.isNegative; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3002 |
gdY.isNegative := not gdY.isNegative; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3003 |
gdX:= gdX*_0_2; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3004 |
gdY:= gdY*_0_2; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3005 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3006 |
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
|
3007 |
begin |
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3008 |
dX := gdX + rndSign(GetRandomf) * _0_03; |
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset
|
3009 |
dY := gdY + rndSign(GetRandomf) * _0_03; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3010 |
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
|
3011 |
end; |
2376 | 3012 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3013 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3014 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3015 |
end; |
963 | 3016 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3017 |
if (GameTicks and $3F) = 0 then |
10352 | 3018 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
924 | 3019 |
end; |
984 | 3020 |
|
3021 |
//////////////////////////////////////////////////////////////////////////////// |
|
3022 |
procedure doStepKamikazeWork(Gear: PGear); |
|
8795 | 3023 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3024 |
i: LongWord; |
984 | 3025 |
HHGear: PGear; |
5866
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3026 |
sparkles: PVisualGear; |
5913 | 3027 |
hasWishes: boolean; |
984 | 3028 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3029 |
AllInactive := false; |
5913 | 3030 |
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
|
3031 |
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
|
3032 |
Gear^.AdvBounce:= 1; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3033 |
|
4365 | 3034 |
HHGear := Gear^.Hedgehog^.Gear; |
7958 | 3035 |
if HHGear = nil then |
3036 |
begin |
|
3037 |
DeleteGear(Gear); |
|
3038 |
exit |
|
3039 |
end; |
|
3040 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3041 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3042 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3043 |
|
3852 | 3044 |
Gear^.X := HHGear^.X; |
3045 |
Gear^.Y := HHGear^.Y; |
|
5913 | 3046 |
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
|
3047 |
begin |
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3048 |
sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1); |
6131 | 3049 |
if sparkles <> nil then |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3050 |
begin |
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3051 |
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
|
3052 |
sparkles^.Angle:= random(360); |
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset
|
3053 |
end |
5866
9017a0ff4201
aaaallways, I want to beeee with you, and make belieeeeve with you
nemo
parents:
5841
diff
changeset
|
3054 |
end; |
3852 | 3055 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3056 |
i := 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3057 |
repeat |
8795 | 3058 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3059 |
Gear^.X := Gear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3060 |
Gear^.Y := Gear^.Y + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3061 |
HHGear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3062 |
HHGear^.Y := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3063 |
|
10354 | 3064 |
// check for drowning |
3065 |
if CheckGearDrowning(HHGear) then |
|
3066 |
begin |
|
3067 |
AfterAttack; |
|
3068 |
DeleteGear(Gear); |
|
3069 |
exit; |
|
3070 |
end; |
|
3071 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3072 |
inc(Gear^.Damage, 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3073 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3074 |
// if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX)) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3075 |
// or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3076 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3077 |
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
|
3078 |
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
|
3079 |
or (Gear^.Damage > Gear^.Health); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3080 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3081 |
inc(upd); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3082 |
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
|
3083 |
begin |
5913 | 3084 |
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
|
3085 |
begin |
5913 | 3086 |
if Gear^.AdvBounce <> 0 then |
3087 |
Gear^.Pos := 3 |
|
3088 |
else |
|
3089 |
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
|
3090 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3091 |
|
11468
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:
11391
diff
changeset
|
3092 |
AmmoShove(Gear, Gear^.Boom, 40); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3093 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3094 |
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
|
3095 |
HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3096 |
HHGear^.dX, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3097 |
HHGear^.dY, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3098 |
20 + cHHRadius * 2, |
6130 | 3099 |
cHHRadius * 2 + 7); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3100 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3101 |
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
|
3102 |
end; |
984 | 3103 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3104 |
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
|
3105 |
begin |
11468
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:
11391
diff
changeset
|
3106 |
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
|
3107 |
if hasWishes then |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3108 |
for i:= 0 to 31 do |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3109 |
begin |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3110 |
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
|
3111 |
if sparkles <> nil then |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3112 |
with sparkles^ do |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3113 |
begin |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3114 |
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
|
3115 |
Angle:= random(360); |
6112
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3116 |
dx:= 0.001 * (random(200)); |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3117 |
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
|
3118 |
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
|
3119 |
dx := -dx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3120 |
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
|
3121 |
dy := -dy; |
6112
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3122 |
FrameTicks:= random(400) + 250 |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3123 |
end |
7839a2ae90ae
Restrict slipperiness to girders and bridges. Make girders more obviously ice.
nemo
parents:
6092
diff
changeset
|
3124 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3125 |
AfterAttack; |
7395 | 3126 |
HHGear^.Message:= HHGear^.Message or gmDestroy; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3127 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3128 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3129 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3130 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3131 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3132 |
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
|
3133 |
end |
984 | 3134 |
end; |
3135 |
||
987 | 3136 |
procedure doStepKamikazeIdle(Gear: PGear); |
3137 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3138 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3139 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3140 |
if Gear^.Timer = 0 then |
5922 | 3141 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3142 |
Gear^.Pos := 1; |
7053 | 3143 |
PlaySoundV(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3144 |
Gear^.doStep := @doStepKamikazeWork |
5922 | 3145 |
end |
987 | 3146 |
end; |
3147 |
||
984 | 3148 |
procedure doStepKamikaze(Gear: PGear); |
8795 | 3149 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3150 |
HHGear: PGear; |
984 | 3151 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3152 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3153 |
|
4365 | 3154 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3155 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3156 |
HHGear^.dX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3157 |
HHGear^.dY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3158 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3159 |
Gear^.dX := SignAs(_0_45, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3160 |
Gear^.dY := - _0_9; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3161 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3162 |
Gear^.Timer := 550; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3163 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3164 |
Gear^.doStep := @doStepKamikazeIdle |
984 | 3165 |
end; |
3166 |
||
1103 | 3167 |
//////////////////////////////////////////////////////////////////////////////// |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3168 |
|
1110 | 3169 |
procedure doStepCakeExpl(Gear: PGear); |
3170 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3171 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3172 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3173 |
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
|
3174 |
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
|
3175 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3176 |
|
11523 | 3177 |
InCinematicMode:= false; |
11468
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:
11391
diff
changeset
|
3178 |
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
|
3179 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3180 |
DeleteGear(Gear) |
1110 | 3181 |
end; |
3182 |
||
1109 | 3183 |
procedure doStepCakeDown(Gear: PGear); |
8795 | 3184 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3185 |
gi: PGear; |
11523 | 3186 |
dmg, dmgBase, partyEpicness, i: LongInt; |
6765 | 3187 |
fX, fY, tdX, tdY: hwFloat; |
11523 | 3188 |
sparkles: PVisualGear; |
1109 | 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 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3192 |
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
|
3193 |
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
|
3194 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3195 |
Gear^.Tag := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3196 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3197 |
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
|
3198 |
begin |
6765 | 3199 |
///////////// adapted from doMakeExplosion /////////////////////////// |
3200 |
//fX:= Gear^.X; |
|
3201 |
//fY:= Gear^.Y; |
|
3202 |
//fX.QWordValue:= fX.QWordValue and $FFFFFFFF00000000; |
|
3203 |
//fY.QWordValue:= fY.QWordValue and $FFFFFFFF00000000; |
|
3204 |
fX:= int2hwFloat(hwRound(Gear^.X)); |
|
3205 |
fY:= int2hwFloat(hwRound(Gear^.Y)); |
|
3206 |
dmgBase:= cakeDmg shl 1 + cHHRadius div 2; |
|
11523 | 3207 |
partyEpicness:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3208 |
gi := GearsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3209 |
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
|
3210 |
begin |
6765 | 3211 |
if gi^.Kind = gtHedgehog then |
3212 |
begin |
|
3213 |
dmg:= 0; |
|
3214 |
tdX:= gi^.X-fX; |
|
3215 |
tdY:= gi^.Y-fY; |
|
3216 |
if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
|
3217 |
dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius); |
|
3218 |
if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi); |
|
3219 |
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
|
3220 |
if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then |
11523 | 3221 |
begin |
3222 |
gi^.State := gi^.State or gstLoser; |
|
3223 |
// probably not too epic if hitting self too... |
|
3224 |
dec(partyEpicness, 45); |
|
3225 |
end |
|
6765 | 3226 |
else |
11523 | 3227 |
begin |
6765 | 3228 |
gi^.State := gi^.State or gstWinner; |
11523 | 3229 |
if CurrentHedgehog^.Gear = gi then |
3230 |
dec(partyEpicness, 45) |
|
3231 |
else |
|
3232 |
inc(partyEpicness); |
|
3233 |
end; |
|
6765 | 3234 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3235 |
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
|
3236 |
end; |
6765 | 3237 |
////////////////////////////////////////////////////////////////////// |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3238 |
Gear^.doStep := @doStepCakeExpl; |
11530 | 3239 |
if (partyEpicness > 6) and (abs(90 - abs(trunc(Gear^.DirAngle))) < 20) then |
11523 | 3240 |
begin |
3241 |
for i := 0 to (2 * partyEpicness) do |
|
3242 |
begin |
|
3243 |
sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg, 1); |
|
3244 |
if sparkles <> nil then |
|
3245 |
begin |
|
3246 |
sparkles^.dX:= 0.008 * (random(100) - 50); |
|
3247 |
sparkles^.dY:= -0.3 + 0.002 * (random(100) - 50); |
|
3248 |
sparkles^.Tint:= ((random(210)+45) shl 24) or ((random(210)+45) shl 16) or ((random(210)+45) shl 8) or $FF; |
|
3249 |
sparkles^.Angle:= random(360); |
|
3250 |
end |
|
3251 |
end; |
|
3252 |
InCinematicMode:= true; |
|
3253 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3254 |
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
|
3255 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3256 |
else dec(Gear^.Pos) |
1109 | 3257 |
end; |
3258 |
||
3259 |
||
11531 | 3260 |
procedure doStepCakeWalk(Gear: PGear); |
7370
d50b874e7ee8
Introduce uGearsHandlers.pas, for now only part of cake handlers is moved there
unc0rr
parents:
7341
diff
changeset
|
3261 |
var |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3262 |
tdx, tdy: hwFloat; |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3263 |
cakeData: PCakeData; |
1088 | 3264 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3265 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3266 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3267 |
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
|
3268 |
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
|
3269 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3270 |
|
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
|
3271 |
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
|
3272 |
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
|
3273 |
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
|
3274 |
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
|
3275 |
// This is not seconds, but at least it is *some* feedback |
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
|
3276 |
if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 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
|
3277 |
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
|
3278 |
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
|
3279 |
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
|
3280 |
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
|
3281 |
exit |
10875 | 3282 |
end |
3283 |
else if Gear^.Timer < 6000 then |
|
3284 |
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
|
3285 |
|
9969 | 3286 |
if not cakeStep(Gear) then Gear^.doStep:= @doStepCakeFall; |
1103 | 3287 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3288 |
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
|
3289 |
begin |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3290 |
cakeData:= PCakeData(Gear^.Data); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3291 |
with cakeData^ do |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3292 |
begin |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3293 |
CakeI := (CakeI + 1) mod cakeh; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3294 |
tdx := CakePoints[CakeI].x - Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3295 |
tdy := - CakePoints[CakeI].y + Gear^.Y; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3296 |
CakePoints[CakeI].x := Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3297 |
CakePoints[CakeI].y := Gear^.Y; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3298 |
Gear^.DirAngle := DxDy2Angle(tdx, tdy); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3299 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3300 |
end; |
1088 | 3301 |
end; |
1089 | 3302 |
|
1103 | 3303 |
procedure doStepCakeUp(Gear: PGear); |
8795 | 3304 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3305 |
i: Longword; |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3306 |
cakeData: PCakeData; |
1103 | 3307 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3308 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3309 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3310 |
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
|
3311 |
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
|
3312 |
exit; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3313 |
Gear^.Tag := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3314 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3315 |
if Gear^.Pos = 6 then |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3316 |
begin |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3317 |
cakeData:= PCakeData(Gear^.Data); |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3318 |
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
|
3319 |
begin |
10874
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3320 |
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
|
3321 |
begin |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3322 |
CakePoints[i].x := Gear^.X; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3323 |
CakePoints[i].y := Gear^.Y |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3324 |
end; |
059a6492176e
allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents:
10831
diff
changeset
|
3325 |
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
|
3326 |
end; |
11531 | 3327 |
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
|
3328 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3329 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3330 |
inc(Gear^.Pos) |
1103 | 3331 |
end; |
3332 |
||
1089 | 3333 |
procedure doStepCakeFall(Gear: PGear); |
3334 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3335 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3336 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3337 |
Gear^.dY := Gear^.dY + cGravity; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3338 |
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
|
3339 |
Gear^.doStep := @doStepCakeUp |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3340 |
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
|
3341 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3342 |
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
|
3343 |
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
|
3344 |
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
|
3345 |
end |
1089 | 3346 |
end; |
3347 |
||
3348 |
procedure doStepCake(Gear: PGear); |
|
3349 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3350 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3351 |
|
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
|
3352 |
Gear^.CollisionMask:= lfNotCurrentMask; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3353 |
|
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3354 |
Gear^.dY:= cMaxWindSpeed * 100; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3355 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3356 |
Gear^.doStep := @doStepCakeFall |
1089 | 3357 |
end; |
3358 |
||
1259 | 3359 |
//////////////////////////////////////////////////////////////////////////////// |
1284 | 3360 |
procedure doStepSeductionWork(Gear: PGear); |
5706 | 3361 |
var i: LongInt; |
7335 | 3362 |
hogs: PGearArrayS; |
1259 | 3363 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3364 |
AllInactive := false; |
5525 | 3365 |
hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius); |
7335 | 3366 |
if hogs.size > 0 then |
3367 |
begin |
|
3368 |
for i:= 0 to hogs.size - 1 do |
|
3369 |
with hogs.ar^[i]^ do |
|
10544 | 3370 |
if (hogs.ar^[i] <> CurrentHedgehog^.Gear) and (Hedgehog^.Effects[heFrozen] = 0) then |
7335 | 3371 |
begin |
3372 |
dX:= _50 * cGravity * (Gear^.X - X) / _25; |
|
3373 |
dY:= -_450 * cGravity; |
|
3374 |
Active:= true; |
|
3375 |
end |
|
10545 | 3376 |
else if Hedgehog^.Effects[heFrozen] > 255 then |
3377 |
Hedgehog^.Effects[heFrozen]:= 255 |
|
5525 | 3378 |
end ; |
3379 |
AfterAttack; |
|
3380 |
DeleteGear(Gear); |
|
3381 |
(* |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3382 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3383 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3384 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3385 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3386 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3387 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3388 |
if (Land[y, x] <> 0) then |
4578 | 3389 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3390 |
Gear^.dX.isNegative := not Gear^.dX.isNegative; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3391 |
Gear^.dY.isNegative := not Gear^.dY.isNegative; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3392 |
Gear^.dX := Gear^.dX * _1_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3393 |
Gear^.dY := Gear^.dY * _1_5 - _0_3; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3394 |
AmmoShove(Gear, 0, 40); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3395 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3396 |
DeleteGear(Gear) |
4578 | 3397 |
end |
3398 |
else |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3399 |
else |
4578 | 3400 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3401 |
AfterAttack; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3402 |
DeleteGear(Gear) |
5525 | 3403 |
end*) |
1286 | 3404 |
end; |
3405 |
||
3406 |
procedure doStepSeductionWear(Gear: PGear); |
|
5562 | 3407 |
var heart: PVisualGear; |
1286 | 3408 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3409 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3410 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3411 |
if Gear^.Timer > 250 then |
5562 | 3412 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3413 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3414 |
inc(Gear^.Pos); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3415 |
if Gear^.Pos = 5 then |
7053 | 3416 |
PlaySoundV(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack) |
5562 | 3417 |
end; |
3418 |
||
6131 | 3419 |
if (Gear^.Pos = 14) and (RealTicks and $3 = 0) then |
5562 | 3420 |
begin |
3421 |
heart:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); |
|
6131 | 3422 |
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
|
3423 |
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
|
3424 |
begin |
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
3425 |
dx:= 0.001 * (random(200)); |
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
3426 |
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
|
3427 |
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
|
3428 |
dx := -dx; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3429 |
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
|
3430 |
dy := -dy; |
5564
4f42009237df
For mikade's sake, use old dx/dy/frametick as default, so health crosses move the same
nemo
parents:
5563
diff
changeset
|
3431 |
FrameTicks:= random(750) + 1000; |
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset
|
3432 |
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
|
3433 |
end; |
5562 | 3434 |
end; |
3435 |
||
3436 |
if Gear^.Pos = 15 then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3437 |
Gear^.doStep := @doStepSeductionWork |
1259 | 3438 |
end; |
1284 | 3439 |
|
3440 |
procedure doStepSeduction(Gear: PGear); |
|
3441 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3442 |
AllInactive := false; |
5525 | 3443 |
//DeleteCI(Gear^.Hedgehog^.Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3444 |
Gear^.doStep := @doStepSeductionWear |
1284 | 3445 |
end; |
1298 | 3446 |
|
3447 |
//////////////////////////////////////////////////////////////////////////////// |
|
3448 |
procedure doStepWaterUp(Gear: PGear); |
|
8795 | 3449 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3450 |
i: LongWord; |
1298 | 3451 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3452 |
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
|
3453 |
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
|
3454 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3455 |
DeleteGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3456 |
exit |
4153
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
3457 |
end; |
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
3458 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3459 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3460 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3461 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3462 |
if Gear^.Timer = 17 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3463 |
Gear^.Timer := 0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3464 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3465 |
exit; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3466 |
|
10359 | 3467 |
if (WorldEdge = weSea) and (playWidth > cMinPlayWidth) then |
10354 | 3468 |
begin |
3469 |
inc(leftX); |
|
3470 |
dec(rightX); |
|
3471 |
dec(playWidth, 2); |
|
3472 |
for i:= 0 to LAND_HEIGHT - 1 do |
|
3473 |
begin |
|
3474 |
Land[i, leftX] := 0; |
|
3475 |
Land[i, rightX] := 0; |
|
3476 |
end; |
|
3477 |
end; |
|
3478 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3479 |
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
|
3480 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3481 |
dec(cWaterLine); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3482 |
for i:= 0 to LAND_WIDTH - 1 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3483 |
Land[cWaterLine, i] := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3484 |
SetAllToActive |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3485 |
end; |
1298 | 3486 |
|
4153
6bd94e4c5d65
2 more variables to control water rise and health loss during sudden death.
henek
parents:
4135
diff
changeset
|
3487 |
dec(Gear^.Tag); |
1298 | 3488 |
end; |
1573 | 3489 |
|
3490 |
//////////////////////////////////////////////////////////////////////////////// |
|
1590 | 3491 |
procedure doStepDrillDrilling(Gear: PGear); |
8795 | 3492 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3493 |
t: PGearArray; |
8795 | 3494 |
tempColl: Word; |
1573 | 3495 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3496 |
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
|
3497 |
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
|
3498 |
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
|
3499 |
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
|
3500 |
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
|
3501 |
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
|
3502 |
|
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
|
3503 |
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
|
3504 |
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
|
3505 |
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
|
3506 |
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
|
3507 |
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
|
3508 |
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
|
3509 |
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
|
3510 |
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
|
3511 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3512 |
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
|
3513 |
|
8564 | 3514 |
tempColl:= Gear^.CollisionMask; |
3515 |
Gear^.CollisionMask:= $007F; |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
3516 |
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
|
3517 |
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
|
3518 |
else t := nil; |
8564 | 3519 |
Gear^.CollisionMask:= tempColl; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3520 |
//fixes drill not exploding when touching HH bug |
8795 | 3521 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3522 |
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
|
3523 |
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
|
3524 |
// 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
|
3525 |
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
|
3526 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3527 |
//out of time or exited ground |
7053 | 3528 |
StopSoundChan(Gear^.SoundChannel); |
11468
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:
11391
diff
changeset
|
3529 |
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
|
3530 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3531 |
exit |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
3532 |
end |
8795 | 3533 |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
3534 |
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
|
3535 |
begin |
7053 | 3536 |
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
|
3537 |
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
|
3538 |
Gear^.AdvBounce:= 50; |
4758
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
3539 |
Gear^.doStep := @doStepDrill |
73aef6a577ba
drill strike falling instead of exploding when exiting ground
Henek
parents:
4708
diff
changeset
|
3540 |
end; |
1590 | 3541 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3542 |
dec(Gear^.Timer); |
1573 | 3543 |
end; |
3544 |
||
3545 |
procedure doStepDrill(Gear: PGear); |
|
8795 | 3546 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3547 |
t: PGearArray; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3548 |
oldX, oldY, oldDx, oldDy: hwFloat; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3549 |
t2: hwFloat; |
1573 | 3550 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3551 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3552 |
|
11391 | 3553 |
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
|
3554 |
Gear^.dX := Gear^.dX + cWindSpeed; |
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
3555 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3556 |
oldDx := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3557 |
oldDy := Gear^.dY; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3558 |
oldX := Gear^.X; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3559 |
oldY := Gear^.Y; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3560 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3561 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3562 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3563 |
if (GameTicks and $3F) = 0 then |
10352 | 3564 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3565 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3566 |
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
|
3567 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3568 |
//hit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3569 |
Gear^.dX := oldDx; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3570 |
Gear^.dY := oldDy; |
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3571 |
Gear^.X := oldX; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3572 |
Gear^.Y := oldY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3573 |
|
8795 | 3574 |
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
|
3575 |
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
|
3576 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3577 |
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
|
3578 |
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
|
3579 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3580 |
//hit the ground not the HH |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3581 |
t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3582 |
Gear^.dX := Gear^.dX * t2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3583 |
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
|
3584 |
end |
8795 | 3585 |
|
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
|
3586 |
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
|
3587 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3588 |
//explode right on contact with HH |
11468
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:
11391
diff
changeset
|
3589 |
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
|
3590 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3591 |
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
|
3592 |
end; |
2376 | 3593 |
|
10038
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3594 |
Gear^.X:= Gear^.X+Gear^.dX*4; |
0a5e651d494c
Fix uGearsHandlersMess.pas changes lost in merge r1c02143bfe9c.
sheepluva
parents:
10011
diff
changeset
|
3595 |
Gear^.Y:= Gear^.Y+Gear^.dY*4; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3596 |
Gear^.SoundChannel := LoopSound(sndDrillRocket); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3597 |
Gear^.doStep := @doStepDrillDrilling; |
8795 | 3598 |
|
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
|
3599 |
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
|
3600 |
gear^.RenderTimer:= true; |
6761 | 3601 |
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
|
3602 |
end |
6761 | 3603 |
else if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Tag <> 0) then |
3604 |
begin |
|
8795 | 3605 |
if Gear^.Timer > 0 then |
7325 | 3606 |
dec(Gear^.Timer) |
3607 |
else |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3608 |
begin |
11468
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:
11391
diff
changeset
|
3609 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
6761 | 3610 |
DeleteGear(Gear); |
3611 |
end |
|
3612 |
end; |
|
1590 | 3613 |
end; |
1601 | 3614 |
|
1633 | 3615 |
//////////////////////////////////////////////////////////////////////////////// |
1601 | 3616 |
procedure doStepBallgunWork(Gear: PGear); |
8795 | 3617 |
var |
7296 | 3618 |
HHGear, ball: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3619 |
rx, ry: hwFloat; |
3143 | 3620 |
gX, gY: LongInt; |
1601 | 3621 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3622 |
AllInactive := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3623 |
dec(Gear^.Timer); |
4365 | 3624 |
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
|
3625 |
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
|
3626 |
begin |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
3627 |
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
|
3628 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
3629 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3630 |
HedgehogChAngle(HHGear); |
3484 | 3631 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
3632 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3633 |
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
|
3634 |
begin |
7001 | 3635 |
rx := rndSign(getRandomf * _0_1); |
3636 |
ry := rndSign(getRandomf * _0_1); |
|
2376 | 3637 |
|
7296 | 3638 |
ball:= AddGear(gx, gy, gtBall, 0, SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0); |
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
|
3639 |
ball^.CollisionMask:= lfNotCurrentMask; |
2376 | 3640 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3641 |
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
|
3642 |
end; |
1601 | 3643 |
|
7195
9e6e8e5a4c2e
Check for gstHHDriven instead of damage check, so ballgun stops when turn ends in multiattack mode
unc0rr
parents:
7170
diff
changeset
|
3644 |
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
|
3645 |
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
|
3646 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3647 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3648 |
AfterAttack |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3649 |
end |
1601 | 3650 |
end; |
3651 |
||
3652 |
procedure doStepBallgun(Gear: PGear); |
|
8795 | 3653 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3654 |
HHGear: PGear; |
1601 | 3655 |
begin |
4365 | 3656 |
HHGear := Gear^.Hedgehog^.Gear; |
6450 | 3657 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown)); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3658 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3659 |
Gear^.doStep := @doStepBallgunWork |
1633 | 3660 |
end; |
1689 | 3661 |
|
1696 | 3662 |
//////////////////////////////////////////////////////////////////////////////// |
1689 | 3663 |
procedure doStepRCPlaneWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3664 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3665 |
const cAngleSpeed = 3; |
8795 | 3666 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3667 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3668 |
i: LongInt; |
10110
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
3669 |
dX, dY : hwFloat; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3670 |
fChanged: boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3671 |
trueAngle: Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
3672 |
t: PGear; |
1689 | 3673 |
begin |
10110
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
3674 |
if WorldWrap(Gear) then |
a7aed2eea727
simplify rc-plane's angle-adjustment-after-wrap code
sheepluva
parents:
10108
diff
changeset
|
3675 |
begin |
10112
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
3676 |
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
|
3677 |
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
|
3678 |
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
|
3679 |
begin |
275ad81e4718
fix indentation of previous commit and simplify rc-plane's angle-fix after portal code
sheepluva
parents:
10110
diff
changeset
|
3680 |
// 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
|
3681 |
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
|
3682 |
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
|
3683 |
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
|
3684 |
end; |
9477 | 3685 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3686 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3687 |
|
4365 | 3688 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3689 |
FollowGear := Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3690 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3691 |
if Gear^.Timer > 0 then |
11152
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3692 |
begin |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3693 |
if Gear^.Timer = 1 then |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3694 |
begin |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3695 |
StopSoundChan(Gear^.SoundChannel); |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3696 |
Gear^.SoundChannel:= -1; |
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3697 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3698 |
dec(Gear^.Timer); |
11152
3ac7f6d43200
stop rc plane prop/engine sound when out of fuel
sheepluva
parents:
11070
diff
changeset
|
3699 |
end; |
4886 | 3700 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3701 |
fChanged := false; |
9559 | 3702 |
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
|
3703 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3704 |
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
|
3705 |
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
|
3706 |
dec(Gear^.Angle) |
6785 | 3707 |
else if Gear^.Angle < 2048 then |
3708 |
inc(Gear^.Angle) |
|
3709 |
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
|
3710 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3711 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3712 |
begin |
3894 | 3713 |
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
|
3714 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3715 |
fChanged := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3716 |
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
|
3717 |
end; |
1689 | 3718 |
|
3894 | 3719 |
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
|
3720 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3721 |
fChanged := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3722 |
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
|
3723 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3724 |
end; |
1689 | 3725 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3726 |
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
|
3727 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3728 |
Gear^.dX.isNegative := (Gear^.Angle > 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3729 |
if Gear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3730 |
trueAngle := 4096 - Gear^.Angle |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3731 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3732 |
trueAngle := Gear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3733 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3734 |
Gear^.dX := SignAs(AngleSin(trueAngle), Gear^.dX) * _0_25; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3735 |
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
|
3736 |
end; |
1689 | 3737 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3738 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3739 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3740 |
|
4808 | 3741 |
if (GameTicks and $FF) = 0 then |
3742 |
if Gear^.Timer < 3500 then |
|
3743 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace) |
|
3744 |
else |
|
3745 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
|
3746 |
||
9559 | 3747 |
if (HHGear <> nil) and ((HHGear^.Message and gmAttack) <> 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
|
3748 |
begin |
6450 | 3749 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
4808 | 3750 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY * |
3751 |
_0_5, 0); |
|
3752 |
dec(Gear^.Health) |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3753 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3754 |
|
9559 | 3755 |
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
|
3756 |
begin |
4808 | 3757 |
Gear^.State := Gear^.State or gsttmpFlag; |
3758 |
PauseMusic; |
|
3759 |
playSound(sndRideOfTheValkyries); |
|
11519
aab4767d9a50
adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
sheepluva
parents:
11475
diff
changeset
|
3760 |
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
|
3761 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3762 |
|
4808 | 3763 |
// pickup bonuses |
3764 |
t := CheckGearNear(Gear, gtCase, 36, 36); |
|
10234 | 3765 |
if (t <> nil) and (HHGear <> nil) then |
4808 | 3766 |
PickUp(HHGear, t); |
3767 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3768 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3769 |
|
4808 | 3770 |
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
|
3771 |
begin |
11519
aab4767d9a50
adding a "cinematic mode" - currently: black bars on bottom/top. triggered by rcplane when pressing enter
sheepluva
parents:
11475
diff
changeset
|
3772 |
inCinematicMode:= false; |
7053 | 3773 |
StopSoundChan(Gear^.SoundChannel); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3774 |
StopSound(sndRideOfTheValkyries); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3775 |
ResumeMusic; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3776 |
|
4808 | 3777 |
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
|
3778 |
begin |
11468
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:
11391
diff
changeset
|
3779 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); |
5228 | 3780 |
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
|
3781 |
begin |
7001 | 3782 |
dX := AngleCos(i * 64) * _0_5 * (GetRandomf + _1); |
3783 |
dY := AngleSin(i * 64) * _0_5 * (GetRandomf + _1); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3784 |
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
|
3785 |
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
|
3786 |
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
|
3787 |
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
|
3788 |
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
|
3789 |
end; |
1713 | 3790 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3791 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3792 |
CurAmmoGear := nil; |
5016
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
3793 |
if (GameFlags and gfInfAttack) = 0 then |
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
3794 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3795 |
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
|
3796 |
TagTurnTimeLeft:= TurnTimeLeft; |
8795 | 3797 |
|
5016
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
3798 |
TurnTimeLeft:= 14 * 125; |
9347d82a26cc
added game mode Tag Team, mostly untested, please test :)
Henek
parents:
5013
diff
changeset
|
3799 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3800 |
|
10510 | 3801 |
if HHGear <> nil then |
10234 | 3802 |
HHGear^.Message := 0; |
6450 | 3803 |
ParseCommand('/taunt ' + #1, true) |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3804 |
end |
1689 | 3805 |
end; |
3806 |
||
3807 |
procedure doStepRCPlane(Gear: PGear); |
|
8795 | 3808 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3809 |
HHGear: PGear; |
1689 | 3810 |
begin |
4365 | 3811 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3812 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3813 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3814 |
Gear^.Angle := HHGear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3815 |
Gear^.Tag := hwSign(HHGear^.dX); |
8795 | 3816 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3817 |
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
|
3818 |
Gear^.Angle := 4096 - Gear^.Angle; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3819 |
Gear^.doStep := @doStepRCPlaneWork |
1712 | 3820 |
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
|
3821 |
|
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
|
3822 |
//////////////////////////////////////////////////////////////////////////////// |
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
|
3823 |
procedure doStepJetpackWork(Gear: PGear); |
8795 | 3824 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3825 |
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
|
3826 |
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
|
3827 |
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
|
3828 |
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
|
3829 |
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
|
3830 |
begin |
10354 | 3831 |
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
|
3832 |
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
|
3833 |
dec(Gear^.Pos); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3834 |
AllInactive := false; |
4365 | 3835 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3836 |
//dec(Gear^.Timer); |
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
|
3837 |
move := _0_2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3838 |
fuel := 50; |
3894 | 3839 |
(*if (HHGear^.Message and gmPrecise) <> 0 then |
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
|
3840 |
begin |
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
|
3841 |
move:= _0_02; |
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
|
3842 |
fuel:= 5; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
3843 |
end;*) |
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
|
3844 |
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
|
3845 |
HedgehogChAngle(HHGear) |
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
|
3846 |
else if Gear^.Health > 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
|
3847 |
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
|
3848 |
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
|
3849 |
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
|
3850 |
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
|
3851 |
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
|
3852 |
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
|
3853 |
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
|
3854 |
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
|
3855 |
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
|
3856 |
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
|
3857 |
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
|
3858 |
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
|
3859 |
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
|
3860 |
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
|
3861 |
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
|
3862 |
else HHGear^.dY := HHGear^.dY - move; |
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
|
3863 |
end; |
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
|
3864 |
dec(Gear^.Health, fuel); |
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
|
3865 |
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
|
3866 |
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
|
3867 |
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
|
3868 |
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
|
3869 |
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
|
3870 |
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
|
3871 |
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
|
3872 |
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
|
3873 |
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
|
3874 |
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
|
3875 |
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
|
3876 |
bubble := AddVisualGear(hwRound(HHGear^.X)+random(8), hwRound(HHGear^.Y) - 8 + random(16), vgtBubble); |
6131 | 3877 |
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
|
3878 |
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
|
3879 |
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
|
3880 |
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
|
3881 |
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
|
3882 |
bubble^.X := bubble^.X + 28; |
4187 | 3883 |
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
|
3884 |
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
|
3885 |
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
|
3886 |
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
|
3887 |
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
|
3888 |
end; |
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
|
3889 |
dec(Gear^.Health, fuel div 5); |
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
|
3890 |
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
|
3891 |
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
|
3892 |
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
|
3893 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
3894 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3895 |
// erases them all at once :-/ |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3896 |
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
|
3897 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3898 |
Gear^.Timer := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3899 |
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
|
3900 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3901 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3902 |
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
|
3903 |
Gear^.Health := 0; |
8795 | 3904 |
|
4260
472fd2fc1f31
Also switch saucer from updating every N ticks to updating as-needed.
nemo
parents:
4258
diff
changeset
|
3905 |
i:= Gear^.Health div 20; |
8795 | 3906 |
|
4262
154253f77b03
ok... combine a tick check with texture percentage check. this should be a lot less frequent
nemo
parents:
4260
diff
changeset
|
3907 |
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
|
3908 |
begin |
4260
472fd2fc1f31
Also switch saucer from updating every N ticks to updating as-needed.
nemo
parents:
4258
diff
changeset
|
3909 |
Gear^.Damage:= i; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3910 |
//AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate); |
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
|
3911 |
FreeAndNilTexture(Gear^.Tex); |
10123 | 3912 |
Gear^.Tex := RenderStringTex(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
|
3913 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
3914 |
|
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
|
3915 |
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
|
3916 |
(HHGear^.Message and gmPrecise = 0) then |
6450 | 3917 |
Gear^.State := Gear^.State and (not gsttmpFlag); |
8795 | 3918 |
|
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
|
3919 |
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
|
3920 |
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
|
3921 |
HHGear^.State := HHGear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3922 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3923 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3924 |
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
|
3925 |
|
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3926 |
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
|
3927 |
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
|
3928 |
HHGear^.dY.isNegative:= false; |
8795 | 3929 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3930 |
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
|
3931 |
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
|
3932 |
doStepHedgehogMoving(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3933 |
|
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
|
3934 |
if // (Gear^.Health = 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
|
3935 |
(HHGear^.Damage <> 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
|
3936 |
//or CheckGearDrowning(HHGear) |
10354 | 3937 |
// drown if too deep under water |
8990 | 3938 |
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
|
3939 |
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
|
3940 |
// 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
|
3941 |
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
|
3942 |
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
|
3943 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3944 |
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
|
3945 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3946 |
Message := 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3947 |
Active := true; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3948 |
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
|
3949 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3950 |
DeleteGear(Gear); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3951 |
isCursorVisible := false; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3952 |
ApplyAmmoChanges(HHGear^.Hedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3953 |
// if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3954 |
|
2619 | 3955 |
// Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3956 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3957 |
//AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', cWhiteColor, capgrpAmmostate); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3958 |
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
|
3959 |
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
|
3960 |
|
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
|
3961 |
procedure doStepJetpack(Gear: PGear); |
8795 | 3962 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3963 |
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
|
3964 |
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
|
3965 |
Gear^.Pos:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3966 |
Gear^.doStep := @doStepJetpackWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3967 |
|
4365 | 3968 |
HHGear := Gear^.Hedgehog^.Gear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3969 |
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
|
3970 |
AfterAttack; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3971 |
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
|
3972 |
begin |
6450 | 3973 |
State := State and (not gstAttacking); |
3974 |
Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)); |
|
8795 | 3975 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3976 |
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
|
3977 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3978 |
Gear^.State := Gear^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3979 |
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
|
3980 |
end |
2301 | 3981 |
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
|
3982 |
end; |
2983 | 3983 |
|
3984 |
//////////////////////////////////////////////////////////////////////////////// |
|
3149 | 3985 |
procedure doStepBirdyDisappear(Gear: PGear); |
2983 | 3986 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3987 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3988 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3989 |
if Gear^.Timer < 2000 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3990 |
inc(Gear^.Timer, 1) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3991 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
3992 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3993 |
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
|
3994 |
end; |
2983 | 3995 |
end; |
3996 |
||
3997 |
procedure doStepBirdyFly(Gear: PGear); |
|
8795 | 3998 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
3999 |
HHGear: PGear; |
3161 | 4000 |
fuel, i: LongInt; |
2983 | 4001 |
move: hwFloat; |
4002 |
begin |
|
6154 | 4003 |
HHGear := Gear^.Hedgehog^.Gear; |
8795 | 4004 |
if HHGear = nil then |
6154 | 4005 |
begin |
9698 | 4006 |
Gear^.Timer := 0; |
4007 |
Gear^.State := Gear^.State or gstAnimation or gstTmpFlag; |
|
4008 |
Gear^.Timer := 0; |
|
4009 |
Gear^.doStep := @doStepBirdyDisappear; |
|
4010 |
CurAmmoGear := nil; |
|
4011 |
isCursorVisible := false; |
|
4012 |
AfterAttack; |
|
6154 | 4013 |
exit |
4014 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4015 |
|
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
|
4016 |
move := _0_2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4017 |
fuel := 50; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4018 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4019 |
if Gear^.Pos > 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4020 |
dec(Gear^.Pos, 1) |
3894 | 4021 |
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
|
4022 |
Gear^.Pos := 500; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4023 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4024 |
if HHGear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4025 |
Gear^.Tag := -1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4026 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4027 |
Gear^.Tag := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4028 |
|
3894 | 4029 |
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
|
4030 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4031 |
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
|
4032 |
or (HHGear^.Y > -_256) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4033 |
HHGear^.dY := HHGear^.dY - move; |
8795 | 4034 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4035 |
dec(Gear^.Health, fuel); |
3894 | 4036 |
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
|
4037 |
end; |
8795 | 4038 |
|
3894 | 4039 |
if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true; |
4040 |
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
|
4041 |
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
|
4042 |
HHGear^.dX := HHGear^.dX + (move * _0_1); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4043 |
dec(Gear^.Health, fuel div 5); |
3894 | 4044 |
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
|
4045 |
end; |
2983 | 4046 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4047 |
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
|
4048 |
Gear^.Health := 0; |
8795 | 4049 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4050 |
if ((GameTicks and $FF) = 0) and (Gear^.Health < 500) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4051 |
for i:= ((500-Gear^.Health) div 250) downto 0 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4052 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4053 |
|
3894 | 4054 |
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
|
4055 |
begin |
6450 | 4056 |
HHGear^.Message := HHGear^.Message and (not gmAttack); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4057 |
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
|
4058 |
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
|
4059 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + 32, gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0); |
3123 | 4060 |
PlaySound(sndBirdyLay); |
3115 | 4061 |
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
|
4062 |
end; |
3115 | 4063 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4064 |
|
6131 | 4065 |
if HHGear^.Message and (gmUp or gmPrecise or gmLeft or gmRight) <> 0 then |
6450 | 4066 |
Gear^.State := Gear^.State and (not gsttmpFlag); |
8795 | 4067 |
|
6450 | 4068 |
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
|
4069 |
HHGear^.State := HHGear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4070 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4071 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4072 |
Gear^.Y := HHGear^.Y - int2hwFloat(32); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4073 |
// 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
|
4074 |
// this is probably not needed anymore |
cdd3d8c723ec
Update changelog, comment on possibly redundant lines in GSHandlers
nemo
parents:
6314
diff
changeset
|
4075 |
if not CurrentTeam^.ExtDriven then FollowGear := HHGear; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4076 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4077 |
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
|
4078 |
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
|
4079 |
doStepHedgehogMoving(HHGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4080 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4081 |
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
|
4082 |
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
|
4083 |
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
|
4084 |
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
|
4085 |
// 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
|
4086 |
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
|
4087 |
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
|
4088 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4089 |
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
|
4090 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4091 |
Message := 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4092 |
Active := true; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4093 |
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
|
4094 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4095 |
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
|
4096 |
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
|
4097 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4098 |
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
|
4099 |
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
|
4100 |
end; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4101 |
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
|
4102 |
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
|
4103 |
CurAmmoGear := nil; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4104 |
isCursorVisible := false; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4105 |
AfterAttack; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4106 |
end |
2983 | 4107 |
end; |
4108 |
||
4109 |
procedure doStepBirdyDescend(Gear: PGear); |
|
8795 | 4110 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4111 |
HHGear: PGear; |
2983 | 4112 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4113 |
if Gear^.Timer > 0 then |
9698 | 4114 |
dec(Gear^.Timer, 1); |
4115 |
||
4116 |
HHGear := Gear^.Hedgehog^.Gear; |
|
4117 |
if HHGear = nil then |
|
4118 |
begin |
|
4119 |
Gear^.Timer := 0; |
|
4120 |
Gear^.State := Gear^.State or gstAnimation or gstTmpFlag; |
|
4121 |
Gear^.Timer := 0; |
|
4122 |
Gear^.doStep := @doStepBirdyDisappear; |
|
4123 |
CurAmmoGear := nil; |
|
4124 |
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
|
4125 |
AfterAttack; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4126 |
exit |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4127 |
end; |
9698 | 4128 |
|
6450 | 4129 |
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
|
4130 |
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
|
4131 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4132 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4133 |
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
|
4134 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4135 |
else if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4136 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4137 |
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
|
4138 |
HHGear^.dY := -_0_2 |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4139 |
end |
2983 | 4140 |
end; |
4141 |
||
3149 | 4142 |
procedure doStepBirdyAppear(Gear: PGear); |
4143 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4144 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4145 |
if Gear^.Timer < 2000 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4146 |
inc(Gear^.Timer, 1) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4147 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4148 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4149 |
Gear^.Timer := 500; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4150 |
Gear^.dX := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4151 |
Gear^.dY := _0; |
6450 | 4152 |
Gear^.State := Gear^.State and (not gstAnimation); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4153 |
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
|
4154 |
end |
3149 | 4155 |
end; |
4156 |
||
2983 | 4157 |
procedure doStepBirdy(Gear: PGear); |
8795 | 4158 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4159 |
HHGear: PGear; |
2983 | 4160 |
begin |
6450 | 4161 |
gear^.State := gear^.State or gstAnimation and (not gstTmpFlag); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4162 |
Gear^.doStep := @doStepBirdyAppear; |
8795 | 4163 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4164 |
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
|
4165 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4166 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4167 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4168 |
end; |
2995 | 4169 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4170 |
HHGear := CurrentHedgehog^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4171 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4172 |
if HHGear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4173 |
Gear^.Tag := -1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4174 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4175 |
Gear^.Tag := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4176 |
Gear^.Pos := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4177 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4178 |
FollowGear := HHGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4179 |
with HHGear^ do |
5706 | 4180 |
begin |
6450 | 4181 |
State := State and (not gstAttacking); |
4182 |
Message := Message and (not (gmAttack or gmUp or gmPrecise or gmLeft or gmRight)) |
|
5706 | 4183 |
end |
2983 | 4184 |
end; |
3032 | 4185 |
|
4186 |
//////////////////////////////////////////////////////////////////////////////// |
|
3065 | 4187 |
procedure doStepEggWork(Gear: PGear); |
8795 | 4188 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4189 |
vg: PVisualGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4190 |
i: LongInt; |
3065 | 4191 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4192 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4193 |
Gear^.dX := Gear^.dX; |
3115 | 4194 |
doStepFallingGear(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4195 |
// CheckGearDrowning(Gear); // already checked for in doStepFallingGear |
3115 | 4196 |
CalcRotationDirAngle(Gear); |
4197 |
||
4198 |
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
|
4199 |
begin |
11468
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:
11391
diff
changeset
|
4200 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLPoisoned, $C0E0FFE0); |
3115 | 4201 |
PlaySound(sndEggBreak); |
4202 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4203 |
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
|
4204 |
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
|
4205 |
vg^.Frame := 2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4206 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4207 |
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
|
4208 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4209 |
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
|
4210 |
vgtDust); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4211 |
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
|
4212 |
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
|
4213 |
end; |
3115 | 4214 |
|
4215 |
DeleteGear(Gear); |
|
4216 |
exit |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4217 |
end; |
3065 | 4218 |
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
|
4219 |
|
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
|
4220 |
//////////////////////////////////////////////////////////////////////////////// |
3428 | 4221 |
procedure doPortalColorSwitch(); |
4790 | 4222 |
var CurWeapon: PAmmo; |
3428 | 4223 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4224 |
if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and ((CurrentHedgehog^.Gear^.Message and gmSwitch) <> 0) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4225 |
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
|
4226 |
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
|
4227 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4228 |
CurrentHedgehog^.Gear^.Message := CurrentHedgehog^.Gear^.Message and (not gmSwitch); |
8795 | 4229 |
|
6924 | 4230 |
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
|
4231 |
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
|
4232 |
CurWeapon^.Pos := 0 |
8795 | 4233 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4234 |
else |
4790 | 4235 |
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
|
4236 |
end; |
3428 | 4237 |
end; |
4238 |
||
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
|
4239 |
procedure doStepPortal(Gear: PGear); |
8795 | 4240 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4241 |
iterator, conPortal: PGear; |
5594 | 4242 |
s, r, nx, ny, ox, oy, poffs, noffs, pspeed, nspeed, |
4243 |
resetx, resety, resetdx, resetdy: hwFloat; |
|
4244 |
sx, sy, rh, resetr: LongInt; |
|
4245 |
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
|
4246 |
begin |
3428 | 4247 |
doPortalColorSwitch(); |
4248 |
||
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
|
4249 |
// 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
|
4250 |
if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] <= lfAllObjMask) |
10905 | 4251 |
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
|
4252 |
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
|
4253 |
or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team) |
10354 | 4254 |
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
|
4255 |
begin |
3428 | 4256 |
deleteGear(Gear); |
4257 |
EXIT; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4258 |
end; |
3428 | 4259 |
|
4260 |
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
|
4261 |
or (Gear^.Health < 1) then |
3428 | 4262 |
dec(Gear^.Timer); |
4263 |
||
4264 |
if Gear^.Timer < 10000 then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4265 |
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
|
4266 |
|
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
|
4267 |
// 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
|
4268 |
if (Gear^.LinkedGear = nil) then |
3428 | 4269 |
exit; |
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4270 |
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
|
4271 |
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
|
4272 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4273 |
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
|
4274 |
|
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
|
4275 |
// check all gears for stuff to port through |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4276 |
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
|
4277 |
while true do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4278 |
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
|
4279 |
|
3571 | 4280 |
// 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
|
4281 |
if iterator = nil then |
3571 | 4282 |
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
|
4283 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4284 |
iterator := iterator^.NextGear; |
3571 | 4285 |
|
4286 |
// 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
|
4287 |
if iterator = nil then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4288 |
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
|
4289 |
|
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
|
4290 |
// 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
|
4291 |
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
|
4292 |
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
|
4293 |
continue; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4294 |
|
3428 | 4295 |
// don't port hogs on rope |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4296 |
// 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
|
4297 |
// 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
|
4298 |
|
3571 | 4299 |
// 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
|
4300 |
if (iterator^.Radius > Gear^.Radius) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4301 |
continue; |
3571 | 4302 |
|
4303 |
// 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
|
4304 |
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
|
4305 |
|
3571 | 4306 |
// too far away? |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4307 |
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
|
4308 |
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
|
4309 |
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
|
4310 |
or (iterator^.Y > Gear^.Y + r) then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4311 |
continue; |
5044 | 4312 |
|
10490 | 4313 |
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
|
4314 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4315 |
// 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
|
4316 |
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
|
4317 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4318 |
if Gear^.Y < iterator^.Y then |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4319 |
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
|
4320 |
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
|
4321 |
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
|
4322 |
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
|
4323 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4324 |
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
|
4325 |
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
|
4326 |
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
|
4327 |
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
|
4328 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4329 |
// 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
|
4330 |
iscake:= (iterator^.Kind = gtCake); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4331 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4332 |
// 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
|
4333 |
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
|
4334 |
begin |
6452 | 4335 |
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
|
4336 |
continue; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4337 |
end |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4338 |
else |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
4339 |
if not ((Gear^.dX*ox + Gear^.dY*oy).isNegative) then |
3571 | 4340 |
continue; |
4341 |
||
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4342 |
isbullet:= (iterator^.Kind in [gtShotgunShot, gtDEagleShot, gtSniperRifleShot, gtSineGunShot]); |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4343 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4344 |
r:= int2hwFloat(iterator^.Radius); |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4345 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4346 |
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
|
4347 |
begin |
3571 | 4348 |
// wow! good candidate there, let's see if the distance and direction is okay! |
4349 |
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
|
4350 |
begin |
8900
b77fd3c2eec5
whoops, unbreak build. how come that cmake doesn't stop anymore on engine build error?
sheepluva
parents:
8898
diff
changeset
|
4351 |
s := Distance(iterator^.dX, iterator^.dY); |
8898 | 4352 |
// if the resulting distance is 0 skip this gear |
4353 |
if s.QWordValue = 0 then |
|
4354 |
continue; |
|
8900
b77fd3c2eec5
whoops, unbreak build. how come that cmake doesn't stop anymore on engine build error?
sheepluva
parents:
8898
diff
changeset
|
4355 |
s := r / s; |
3571 | 4356 |
ox:= iterator^.X + s * iterator^.dX; |
4357 |
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
|
4358 |
end |
3571 | 4359 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4360 |
begin |
3571 | 4361 |
ox:= iterator^.X; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4362 |
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
|
4363 |
end; |
3571 | 4364 |
|
3578 | 4365 |
if (hwRound(Distance(Gear^.X-ox,Gear^.Y-oy)) > Gear^.Radius + 1 ) then |
3571 | 4366 |
continue; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4367 |
end; |
3571 | 4368 |
|
11551 | 4369 |
if (iterator^.Kind = gtDEagleShot) or (iterator^.Kind = gtSniperRifleShot) then |
11550
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
4370 |
begin |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
4371 |
// draw bullet trail |
5841 | 4372 |
spawnBulletTrail(iterator); |
11550
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
4373 |
// 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:
11540
diff
changeset
|
4374 |
iterator^.Data:= nil; |
881231c1ba46
disallow bullets to hit the hedgehog that fired them (unless bounced/wrapped/portal'd)
sheepluva
parents:
11540
diff
changeset
|
4375 |
end; |
5841 | 4376 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4377 |
// calc gear offset in portal vector direction |
3571 | 4378 |
ox := (iterator^.X - Gear^.X); |
4379 |
oy := (iterator^.Y - Gear^.Y); |
|
4380 |
poffs:= (Gear^.dX * ox + Gear^.dY * oy); |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4381 |
|
5841 | 4382 |
if not isBullet and poffs.isNegative then |
4383 |
continue; |
|
4384 |
||
4385 |
// only port bullets close to the portal |
|
6450 | 4386 |
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
|
4387 |
continue; |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4388 |
|
4076 | 4389 |
// |
4390 |
// gears that make it till here will definately be ported |
|
4391 |
// |
|
5594 | 4392 |
// (but old position/movement vector might be restored in case there's |
4393 |
// not enough space on the other side) |
|
4394 |
// |
|
4395 |
||
4396 |
resetr := iterator^.Radius; |
|
4397 |
resetx := iterator^.X; |
|
4398 |
resety := iterator^.Y; |
|
4399 |
resetdx := iterator^.dX; |
|
4400 |
resetdy := iterator^.dY; |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4401 |
|
3578 | 4402 |
// create a normal of the portal vector, but ... |
4403 |
nx := Gear^.dY; |
|
3570 | 4404 |
ny := Gear^.dX; |
3578 | 4405 |
// ... decide where the top is based on the hog's direction when firing the portal |
4406 |
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
|
4407 |
nx.isNegative := (not nx.isNegative) |
3578 | 4408 |
else |
3570 | 4409 |
ny.isNegative := not ny.isNegative; |
3578 | 4410 |
|
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4411 |
// calc gear offset in portal normal vector direction |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4412 |
noffs:= (nx * ox + ny * oy); |
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4413 |
|
7721 | 4414 |
if isBullet and (noffs.Round >= Longword(Gear^.Radius)) then |
5841 | 4415 |
continue; |
4416 |
||
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4417 |
// 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
|
4418 |
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
|
4419 |
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
|
4420 |
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
|
4421 |
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
|
4422 |
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
|
4423 |
continue; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4424 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4425 |
// 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
|
4426 |
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
|
4427 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4428 |
pspeed:= (Gear^.dX * iterator^.dX + Gear^.dY * iterator^.dY); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4429 |
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
|
4430 |
end |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4431 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4432 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4433 |
pspeed:= hwAbs(cGravity * oy); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4434 |
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
|
4435 |
end; |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4436 |
|
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4437 |
// creating normal vector of connected (exit) portal |
3578 | 4438 |
nx := conPortal^.dY; |
3570 | 4439 |
ny := conPortal^.dX; |
3578 | 4440 |
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
|
4441 |
nx.isNegative := (not nx.isNegative) |
3578 | 4442 |
else |
3570 | 4443 |
ny.isNegative := not ny.isNegative; |
3578 | 4444 |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4445 |
// inverse cake's normal movement direction, |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4446 |
// 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
|
4447 |
//if iscake then nspeed.isNegative:= not nspeed.isNegative; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4448 |
|
3571 | 4449 |
//AddFileLog('poffs:'+cstr(poffs)+' noffs:'+cstr(noffs)+' pspeed:'+cstr(pspeed)+' nspeed:'+cstr(nspeed)); |
3578 | 4450 |
iterator^.dX := -pspeed * conPortal^.dX + nspeed * nx; |
4451 |
iterator^.dY := -pspeed * conPortal^.dY + nspeed * ny; |
|
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4452 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4453 |
// 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
|
4454 |
// still respecting the movement direction |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4455 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4456 |
// 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
|
4457 |
// 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
|
4458 |
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
|
4459 |
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
|
4460 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4461 |
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
|
4462 |
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
|
4463 |
poffs:= ox; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4464 |
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
|
4465 |
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
|
4466 |
noffs:= noffs * s * (nspeed / pspeed); |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4467 |
|
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4468 |
// 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
|
4469 |
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
|
4470 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4471 |
s := hwAbs(noffs) + r - int2hwFloat(Gear^.Radius); |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4472 |
if s > _0 then |
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4473 |
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
|
4474 |
end; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4475 |
|
3571 | 4476 |
iterator^.X := conPortal^.X + poffs * conPortal^.dX + noffs * nx; |
4477 |
iterator^.Y := conPortal^.Y + poffs * conPortal^.dY + noffs * ny; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4478 |
|
6450 | 4479 |
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
|
4480 |
begin |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4481 |
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
|
4482 |
end; |
4092
bf13068194b3
more portal tweaks (closer exit position, cake stuff, etc)
sheepluva
parents:
4076
diff
changeset
|
4483 |
|
5594 | 4484 |
// see if the space on the exit side actually is enough |
4485 |
||
4486 |
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
|
4487 |
begin |
5594 | 4488 |
// TestCollisionXwithXYShift requires a hwFloat for xShift |
4489 |
ox.QWordValue := _1.QWordValue; |
|
4490 |
ox.isNegative := not iterator^.dX.isNegative; |
|
4491 |
||
4492 |
sx := hwSign(iterator^.dX); |
|
4493 |
sy := hwSign(iterator^.dY); |
|
4494 |
||
4495 |
if iterator^.Radius > 1 then |
|
4496 |
iterator^.Radius := iterator^.Radius - 1; |
|
4497 |
||
4498 |
// 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
|
4499 |
isCollision := (TestCollisionY(iterator, sy) <> 0) or (TestCollisionX(iterator, sx) <> 0); |
5594 | 4500 |
|
4501 |
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
|
4502 |
begin |
5594 | 4503 |
// check center area (with half the radius so that the |
4504 |
// the square check won't check more pixels than we want to) |
|
4505 |
iterator^.Radius := 1 + resetr div 2; |
|
4506 |
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
|
4507 |
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
|
4508 |
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
|
4509 |
end; |
5594 | 4510 |
|
4511 |
iterator^.Radius := resetr; |
|
4512 |
||
4513 |
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
|
4514 |
begin |
5594 | 4515 |
// collision! oh crap! go back! |
4516 |
iterator^.X := resetx; |
|
4517 |
iterator^.Y := resety; |
|
4518 |
iterator^.dX := resetdx; |
|
4519 |
iterator^.dY := resetdy; |
|
4520 |
continue; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4521 |
end; |
5594 | 4522 |
end; |
4523 |
||
4524 |
// |
|
4525 |
// You're now officially portaled! |
|
4526 |
// |
|
4527 |
||
4528 |
// 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
|
4529 |
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
|
4530 |
iterator^.PortalCounter:= 33 |
5940 | 4531 |
else |
4532 |
begin |
|
4533 |
inc(iterator^.PortalCounter); |
|
7658 | 4534 |
iterator^.Active:= true; |
7992 | 4535 |
iterator^.State:= iterator^.State and (not gstHHHJump) or gstMoving; |
5940 | 4536 |
end; |
5594 | 4537 |
|
6785 | 4538 |
// is it worth adding an arcsin table? Just how often would we end up doing something like this? |
6787 | 4539 |
// SYNCED ANGLE UPDATE |
6785 | 4540 |
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
|
4541 |
iterator^.Angle:= (1024 + vector2Angle(iterator^.dX, iterator^.dY) mod 4096) |
6787 | 4542 |
// VISUAL USE OF ANGLE ONLY |
4543 |
else if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtKamikaze) and (CurAmmoGear^.Hedgehog = iterator^.Hedgehog) then |
|
4544 |
begin |
|
4545 |
iterator^.Angle:= DxDy2AttackAngle(iterator^.dX, iterator^.dY); |
|
4546 |
iterator^.Angle:= 2048-iterator^.Angle; |
|
6786 | 4547 |
if iterator^.dX.isNegative then iterator^.Angle:= 4096-iterator^.Angle; |
6785 | 4548 |
end; |
4549 |
||
6555 | 4550 |
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
|
4551 |
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
|
4552 |
and (CurAmmoGear <> nil) |
9539 | 4553 |
and (CurAmmoGear^.Kind = gtRope) |
4554 |
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
|
4555 |
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
|
4556 |
|
8795 | 4557 |
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
|
4558 |
and (iterator^.Kind <> gtFlake) then |
4050
8e4f4b72c132
various portal tweaks, also: nemo's gear jiggling is back
sheepluva
parents:
4047
diff
changeset
|
4559 |
FollowGear := iterator; |
5594 | 4560 |
|
5841 | 4561 |
// store X/Y values of exit for net bullet trail |
4562 |
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
|
4563 |
begin |
5841 | 4564 |
iterator^.Elasticity:= iterator^.X; |
4565 |
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
|
4566 |
end; |
5841 | 4567 |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4568 |
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
|
4569 |
dec(Gear^.Health); |
3571 | 4570 |
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
|
4571 |
end; |
3350 | 4572 |
|
6490 | 4573 |
|
3428 | 4574 |
|
4575 |
procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); |
|
4790 | 4576 |
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
|
4577 |
CurWeapon: PAmmo; |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
4578 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4579 |
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
|
4580 |
with CurrentHedgehog^ do |
3428 | 4581 |
begin |
6924 | 4582 |
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
|
4583 |
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
|
4584 |
begin |
4790 | 4585 |
if not destroyGear then |
4586 |
begin |
|
4587 |
// switch color of ball to opposite of oldPortal |
|
4588 |
if (oldPortal^.Tag and 2) = 0 then |
|
4589 |
CurWeapon^.Pos:= 1 |
|
4590 |
else |
|
4591 |
CurWeapon^.Pos:= 0; |
|
4592 |
end; |
|
4593 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4594 |
// make the ball visible |
4790 | 4595 |
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
|
4596 |
end |
3428 | 4597 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4598 |
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
|
4599 |
oldPortal^.Timer:= 0; |
3428 | 4600 |
end; |
4601 |
||
6490 | 4602 |
procedure doStepMovingPortal_real(Gear: PGear); |
8795 | 4603 |
var |
6490 | 4604 |
x, y, tx, ty: LongInt; |
4605 |
s: hwFloat; |
|
3428 | 4606 |
begin |
9477 | 4607 |
WorldWrap(Gear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4608 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4609 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4610 |
tx := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4611 |
ty := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4612 |
// avoid compiler hints |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4613 |
|
7309 | 4614 |
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
|
4615 |
begin |
3569 | 4616 |
Gear^.State := Gear^.State or gstCollision; |
6450 | 4617 |
Gear^.State := Gear^.State and (not gstMoving); |
8795 | 4618 |
|
7310 | 4619 |
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
|
4620 |
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
|
4621 |
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
|
4622 |
begin |
3428 | 4623 |
loadNewPortalBall(Gear, true); |
4624 |
EXIT; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4625 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4626 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4627 |
// making a normalized normal vector |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4628 |
s := _1/DistanceI(tx,ty); |
3562 | 4629 |
Gear^.dX := s * ty; |
4630 |
Gear^.dY := -s * tx; |
|
4631 |
||
4632 |
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
|
4633 |
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
|
4634 |
Gear^.DirAngle := 180-Gear^.DirAngle; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4635 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4636 |
if ((Gear^.LinkedGear = nil) |
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4637 |
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
|
4638 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4639 |
loadNewPortalBall(Gear, false); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4640 |
inc(Gear^.Tag); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4641 |
Gear^.doStep := @doStepPortal; |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
4642 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4643 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4644 |
loadNewPortalBall(Gear, true); |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
4645 |
end |
8795 | 4646 |
|
10354 | 4647 |
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
|
4648 |
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
|
4649 |
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
|
4650 |
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
|
4651 |
loadNewPortalBall(Gear, true); |
3428 | 4652 |
end; |
4653 |
||
3569 | 4654 |
procedure doStepMovingPortal(Gear: PGear); |
4655 |
begin |
|
4656 |
doPortalColorSwitch(); |
|
4657 |
doStepPerPixel(Gear, @doStepMovingPortal_real, true); |
|
8795 | 4658 |
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
|
4659 |
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
|
4660 |
deleteGear(Gear); |
3569 | 4661 |
end; |
4662 |
||
3428 | 4663 |
procedure doStepPortalShot(newPortal: PGear); |
8795 | 4664 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4665 |
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
|
4666 |
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
|
4667 |
CurWeapon: PAmmo; |
3428 | 4668 |
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
|
4669 |
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
|
4670 |
|
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
|
4671 |
// 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
|
4672 |
// 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
|
4673 |
// (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
|
4674 |
// to the scaler) |
3562 | 4675 |
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
|
4676 |
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
|
4677 |
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
|
4678 |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4679 |
newPortal^.LinkedGear := nil; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4680 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4681 |
if CurrentHedgehog <> nil then |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6452
diff
changeset
|
4682 |
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
|
4683 |
begin |
6924 | 4684 |
CurWeapon:= GetCurAmmoEntry(CurrentHedgehog^); |
3578 | 4685 |
// let's save the HH's dX's direction so we can decide where the "top" of the portal hole |
4686 |
newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative; |
|
4687 |
// when doing a backjump the dx is the opposite of the facing direction |
|
6450 | 4688 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then |
3578 | 4689 |
newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative; |
4690 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4691 |
// make portal gun look unloaded |
4790 | 4692 |
if (CurWeapon <> nil) and (CurAmmoType = amPortalGun) then |
4693 |
CurWeapon^.Timer := CurWeapon^.Timer or 2; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4694 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4695 |
iterator := GearsList; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4696 |
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
|
4697 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4698 |
if (iterator^.Kind = gtPortal) then |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
4699 |
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
|
4700 |
begin |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
4701 |
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
|
4702 |
begin |
3468
c7b80bdbc384
* make portals delete each other only indirectly (by setting timer to 0)
sheepluva
parents:
3462
diff
changeset
|
4703 |
iterator^.Timer:= 0; |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
4704 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4705 |
else |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
4706 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4707 |
// 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
|
4708 |
newPortal^.LinkedGear := iterator; |
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
4709 |
iterator^.LinkedGear := newPortal; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4710 |
iterator^.Health := newPortal^.Health; |
6556
faa47a7e614a
Allow multiple portals, so long as the team hasn't changed...
nemo
parents:
6555
diff
changeset
|
4711 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4712 |
end; |
3480
c4c3f3512404
Prevent all portal loops the guaranteed way, at least until sheepluva's tests yield something reliable.
nemo
parents:
3476
diff
changeset
|
4713 |
iterator^.PortalCounter:= 0; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4714 |
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
|
4715 |
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
|
4716 |
|
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
|
4717 |
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
|
4718 |
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
|
4719 |
// 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
|
4720 |
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
|
4721 |
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
|
4722 |
begin |
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
|
4723 |
if not (iterator^.Kind in [gtPortal, gtAirAttack, gtKnife]) 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
|
4724 |
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
|
4725 |
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
|
4726 |
iterator^.Active:= true; |
7992 | 4727 |
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
|
4728 |
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
|
4729 |
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
|
4730 |
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
|
4731 |
//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
|
4732 |
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
|
4733 |
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
|
4734 |
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
|
4735 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4736 |
end; |
6450 | 4737 |
newPortal^.State := newPortal^.State and (not gstCollision); |
3569 | 4738 |
newPortal^.State := newPortal^.State or gstMoving; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4739 |
newPortal^.doStep := @doStepMovingPortal; |
3388
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
4740 |
end; |
ab9352a4ddcc
Fix portal graphic name, continuing work on portal movement
nemo
parents:
3384
diff
changeset
|
4741 |
|
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
|
4742 |
//////////////////////////////////////////////////////////////////////////////// |
3350 | 4743 |
procedure doStepPiano(Gear: PGear); |
8795 | 4744 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4745 |
r0, r1: LongInt; |
3728 | 4746 |
odY: hwFloat; |
3350 | 4747 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4748 |
AllInactive := false; |
8795 | 4749 |
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
|
4750 |
((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
|
4751 |
begin |
8795 | 4752 |
case CurrentHedgehog^.Gear^.MsgParam of |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4753 |
0: PlaySound(sndPiano0); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4754 |
1: PlaySound(sndPiano1); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4755 |
2: PlaySound(sndPiano2); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4756 |
3: PlaySound(sndPiano3); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4757 |
4: PlaySound(sndPiano4); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4758 |
5: PlaySound(sndPiano5); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4759 |
6: PlaySound(sndPiano6); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4760 |
7: PlaySound(sndPiano7); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4761 |
else PlaySound(sndPiano8); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4762 |
end; |
3704 | 4763 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtNote); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4764 |
CurrentHedgehog^.Gear^.MsgParam := 0; |
6450 | 4765 |
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
|
4766 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4767 |
|
3728 | 4768 |
if (*((Gear^.Pos = 3) and ((GameFlags and gfSolidLand) <> 0)) or*) (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
|
4769 |
begin |
3728 | 4770 |
Gear^.dY := Gear^.dY + cGravity * 2; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4771 |
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
|
4772 |
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
|
4773 |
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
|
4774 |
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
|
4775 |
OnUsedAmmo(CurrentHedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4776 |
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
|
4777 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4778 |
// 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
|
4779 |
CurrentHedgehog^.Gear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4780 |
CurrentHedgehog^.Gear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4781 |
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
|
4782 |
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
|
4783 |
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
|
4784 |
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
|
4785 |
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
|
4786 |
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
|
4787 |
ResumeMusic |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4788 |
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
|
4789 |
exit |
3351 | 4790 |
end; |
4791 |
||
3728 | 4792 |
odY:= Gear^.dY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4793 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4794 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4795 |
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
|
4796 |
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
|
4797 |
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
|
4798 |
OnUsedAmmo(CurrentHedgehog^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4799 |
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
|
4800 |
begin |
3419
b66a1b597f88
Add drown-the-playing-hog check for case of piano falling off the landscape.
nemo
parents:
3417
diff
changeset
|
4801 |
// 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
|
4802 |
CurrentHedgehog^.Gear^.Active := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4803 |
CurrentHedgehog^.Gear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4804 |
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
|
4805 |
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
|
4806 |
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
|
4807 |
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
|
4808 |
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
|
4809 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4810 |
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
|
4811 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4812 |
else if (Gear^.State and gstCollision) <> 0 then |
3399 | 4813 |
begin |
11468
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:
11391
diff
changeset
|
4814 |
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:
11391
diff
changeset
|
4815 |
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:
11391
diff
changeset
|
4816 |
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:
11391
diff
changeset
|
4817 |
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:
11391
diff
changeset
|
4818 |
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
|
4819 |
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
|
4820 |
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
|
4821 |
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
|
4822 |
Gear^.Pos := Gear^.Pos + 1; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4823 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4824 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4825 |
Gear^.dY := Gear^.dY + cGravity * 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4826 |
// let it fall faster so itdoesn't take too long for the whole attack |
3382 | 4827 |
end; |
3384 | 4828 |
|
4829 |
||
4830 |
//////////////////////////////////////////////////////////////////////////////// |
|
4831 |
procedure doStepSineGunShotWork(Gear: PGear); |
|
8795 | 4832 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4833 |
x, y, rX, rY, t, tmp, initHealth: LongInt; |
3384 | 4834 |
oX, oY, ldX, ldY, sdX, sdY, sine, lx, ly, amp: hwFloat; |
10657 | 4835 |
justCollided, justBounced: boolean; |
3384 | 4836 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4837 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4838 |
initHealth := Gear^.Health; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4839 |
lX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4840 |
lY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4841 |
ldX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4842 |
ldY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4843 |
sdy := _0_5/Distance(Gear^.dX,Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4844 |
ldX := ldX * sdy; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4845 |
ldY := ldY * sdy; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4846 |
sdY := hwAbs(ldX) + hwAbs(ldY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4847 |
sdX := _1 - hwAbs(ldX/sdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4848 |
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
|
4849 |
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
|
4850 |
sdY := -sdY; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4851 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4852 |
// initial angle depends on current GameTicks |
7745 | 4853 |
t := getRandom(4096); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4854 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4855 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4856 |
// 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
|
4857 |
justCollided := false; |
10657 | 4858 |
// this variable is just to ensure we don't run in infinite loop due to precision errors |
4859 |
justBounced:= false; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4860 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4861 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4862 |
lX := lX + ldX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4863 |
lY := lY + ldY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4864 |
oX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4865 |
oY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4866 |
rX := hwRound(oX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4867 |
rY := hwRound(oY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4868 |
tmp := t mod 4096; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4869 |
amp := _128 * (_1 - hwSqr(int2hwFloat(Gear^.Health)/initHealth)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4870 |
sine := amp * AngleSin(tmp mod 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4871 |
sine.isNegative := (tmp < 2048); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4872 |
Gear^.X := lX + (sine * sdX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4873 |
Gear^.Y := ly + (sine * sdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4874 |
Gear^.dX := Gear^.X - oX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4875 |
Gear^.dY := Gear^.Y - oY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4876 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4877 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4878 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4879 |
|
10652 | 4880 |
if WorldEdge = weWrap then |
4881 |
begin |
|
4882 |
if x > LongInt(rightX) then |
|
10659 | 4883 |
repeat |
4884 |
dec(x, playWidth); |
|
4885 |
dec(rx, playWidth); |
|
10652 | 4886 |
until x <= LongInt(rightX) |
4887 |
else if x < LongInt(leftX) then |
|
10659 | 4888 |
repeat |
4889 |
inc(x, playWidth); |
|
4890 |
inc(rx, playWidth); |
|
10652 | 4891 |
until x >= LongInt(leftX); |
10657 | 4892 |
end |
4893 |
else if (WorldEdge = weBounce) then |
|
4894 |
begin |
|
4895 |
if (not justBounced) and ((x > LongInt(rightX)) or (x < LongInt(leftX))) then |
|
4896 |
begin |
|
4897 |
// reflect |
|
4898 |
lX:= lX - ldX + ((oX - lX) * 2); |
|
4899 |
lY:= lY - ldY; |
|
4900 |
Gear^.X:= oX; |
|
4901 |
Gear^.Y:= oY; |
|
4902 |
ldX.isNegative:= (not ldX.isNegative); |
|
4903 |
sdX.isNegative:= (not sdX.isNegative); |
|
4904 |
justBounced:= true; |
|
4905 |
continue; |
|
4906 |
end |
|
4907 |
else |
|
4908 |
justBounced:= false; |
|
10652 | 4909 |
end; |
4910 |
||
10657 | 4911 |
|
4912 |
inc(t,Gear^.Health div 313); |
|
4913 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4914 |
// if borders are on, stop outside land array |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4915 |
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
|
4916 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4917 |
Gear^.Damage := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4918 |
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
|
4919 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4920 |
else |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4921 |
begin |
10372 | 4922 |
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
|
4923 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4924 |
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
|
4925 |
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
|
4926 |
begin |
10118 | 4927 |
if ((GameFlags and gfSolidLand) <> 0) and (Land[y, x] > 255) then |
4928 |
Gear^.Damage := initHealth |
|
4929 |
else if justCollided then |
|
4930 |
begin |
|
4931 |
Gear^.Damage := initHealth; |
|
4932 |
end |
|
4933 |
else |
|
4934 |
begin |
|
4935 |
inc(Gear^.Damage,3); |
|
4936 |
justCollided := true; |
|
4937 |
end; |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4938 |
end |
3384 | 4939 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4940 |
justCollided := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4941 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4942 |
// kick nearby hogs, dig tunnel and add some fire |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4943 |
// if at least 5 collisions occured |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4944 |
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
|
4945 |
begin |
10118 | 4946 |
if ((GameFlags and gfSolidLand) = 0) then |
4947 |
begin |
|
4948 |
DrawExplosion(rX,rY,Gear^.Radius); |
|
4949 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4950 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4951 |
// kick nearby hogs |
11468
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:
11391
diff
changeset
|
4952 |
AmmoShove(Gear, Gear^.Boom, 50); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4953 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4954 |
dec(Gear^.Health, Gear^.Damage); |
10118 | 4955 |
|
4956 |
// explode when impacting on solid land/borders |
|
4957 |
if Gear^.Damage >= initHealth then |
|
4958 |
begin |
|
4959 |
// add some random offset to angles |
|
4960 |
tmp := getRandom(256); |
|
4961 |
// spawn some flames |
|
4962 |
for t:= 0 to 3 do |
|
4963 |
begin |
|
4964 |
if not isZero(Gear^.dX) then rX := rx - hwSign(Gear^.dX); |
|
4965 |
if not isZero(Gear^.dY) then rY := ry - hwSign(Gear^.dY); |
|
4966 |
lX := AngleCos(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
4967 |
lY := AngleSin(tmp + t * 512) * _0_25 * (GetRandomf + _1); |
|
4968 |
AddGear(rX, rY, gtFlame, 0, lX, lY, 0); |
|
4969 |
AddGear(rX, rY, gtFlame, 0, lX, -lY, 0); |
|
4970 |
end; |
|
4971 |
end |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4972 |
// add some fire to the tunnel |
10118 | 4973 |
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
|
4974 |
begin |
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
4975 |
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
|
4976 |
AddGear(x - Gear^.Radius + tmp, y - GetRandom(Gear^.Radius + 1), gtFlame, gsttmpFlag, _0, _0, 0) |
10118 | 4977 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4978 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4979 |
|
10118 | 4980 |
Gear^.Damage := 0; |
4981 |
||
7391
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
4982 |
if random(100) = 0 then |
8795 | 4983 |
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
|
4984 |
end |
10118 | 4985 |
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
|
4986 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4987 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4988 |
dec(Gear^.Health); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4989 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
4990 |
// 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
|
4991 |
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
|
4992 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4993 |
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
|
4994 |
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
|
4995 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4996 |
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
|
4997 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
4998 |
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
|
4999 |
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
|
5000 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5001 |
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
|
5002 |
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
|
5003 |
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
|
5004 |
end |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5005 |
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
|
5006 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5007 |
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
|
5008 |
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
|
5009 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5010 |
until (Gear^.Health <= 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5011 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5012 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5013 |
AfterAttack; |
3384 | 5014 |
end; |
5015 |
||
5016 |
procedure doStepSineGunShot(Gear: PGear); |
|
7745 | 5017 |
var |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5018 |
HHGear: PGear; |
3384 | 5019 |
begin |
8795 | 5020 |
PlaySound(sndSineGun); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5021 |
|
11551 | 5022 |
if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then |
5023 |
begin |
|
5024 |
HHGear := Gear^.Hedgehog^.Gear; |
|
5025 |
// push the shooting Hedgehog back |
|
5026 |
Gear^.dX.isNegative := not Gear^.dX.isNegative; |
|
5027 |
Gear^.dY.isNegative := not Gear^.dY.isNegative; |
|
5028 |
HHGear^.dX := Gear^.dX; |
|
5029 |
HHGear^.dY := Gear^.dY; |
|
5030 |
AmmoShove(Gear, 0, 80); |
|
5031 |
Gear^.dX.isNegative := not Gear^.dX.isNegative; |
|
5032 |
Gear^.dY.isNegative := not Gear^.dY.isNegative; |
|
5033 |
end; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
5034 |
|
4034
634a8c8682de
add some phone rumbling to big explosions, airbomb and sinegun
koda
parents:
4026
diff
changeset
|
5035 |
Gear^.doStep := @doStepSineGunShotWork; |
9954 | 5036 |
{$IFNDEF PAS2C} |
8204 | 5037 |
with mobileRecord do |
5038 |
if (performRumble <> nil) and (not fastUntilLag) then |
|
5039 |
performRumble(kSystemSoundID_Vibrate); |
|
9954 | 5040 |
{$ENDIF} |
3384 | 5041 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5042 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5043 |
//////////////////////////////////////////////////////////////////////////////// |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5044 |
procedure doStepFlamethrowerWork(Gear: PGear); |
8795 | 5045 |
var |
7281 | 5046 |
HHGear, flame: PGear; |
3485 | 5047 |
rx, ry, speed: hwFloat; |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5048 |
i, gX, gY: LongInt; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5049 |
begin |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5050 |
AllInactive := false; |
4365 | 5051 |
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
|
5052 |
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
|
5053 |
begin |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5054 |
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
|
5055 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5056 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5057 |
HedgehogChAngle(HHGear); |
3484 | 5058 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
5059 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
8795 | 5060 |
|
3485 | 5061 |
if (GameTicks and $FF) = 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5062 |
begin |
3894 | 5063 |
if (HHGear^.Message and gmRight) <> 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5064 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5065 |
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
|
5066 |
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
|
5067 |
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
|
5068 |
dec(Gear^.Tag); |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5069 |
end |
3894 | 5070 |
else if (HHGear^.Message and gmLeft) <> 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5071 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5072 |
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
|
5073 |
dec(Gear^.Tag) |
8795 | 5074 |
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
|
5075 |
inc(Gear^.Tag); |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5076 |
end |
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5077 |
end; |
8795 | 5078 |
|
3485 | 5079 |
dec(Gear^.Timer); |
5080 |
if Gear^.Timer = 0 then |
|
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5081 |
begin |
3485 | 5082 |
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
|
5083 |
if (Gear^.Health mod 5) = 0 then |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5084 |
begin |
7001 | 5085 |
rx := rndSign(getRandomf * _0_1); |
5086 |
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
|
5087 |
speed := _0_5 * (_10 / Gear^.Tag); |
8795 | 5088 |
|
7281 | 5089 |
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
|
5090 |
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
|
5091 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
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
|
5092 |
flame^.CollisionMask:= lfNotCurrentMask; |
10589
98ea597e5cd9
expose FlightTime to lua, disable in-air flame harming moving hogs ☹ aaaand override that in ClimbHome ☺
nemo
parents:
10586
diff
changeset
|
5093 |
//flame^.FlightTime:= 500; use the default huge value to avoid sticky flame suddenly being damaging as opposed to other flames |
8795 | 5094 |
|
6131 | 5095 |
if (Gear^.Health mod 30) = 0 then |
7281 | 5096 |
begin |
5097 |
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
|
5098 |
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
|
5099 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
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
|
5100 |
flame^.CollisionMask:= lfNotCurrentMask; |
10589
98ea597e5cd9
expose FlightTime to lua, disable in-air flame harming moving hogs ☹ aaaand override that in ClimbHome ☺
nemo
parents:
10586
diff
changeset
|
5101 |
//flame^.FlightTime:= 500; |
7281 | 5102 |
end |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5103 |
end; |
3485 | 5104 |
Gear^.Timer:= Gear^.Tag |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5105 |
end; |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5106 |
|
7539 | 5107 |
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
|
5108 |
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
|
5109 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5110 |
DeleteGear(Gear); |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5111 |
AfterAttack |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5112 |
end |
3485 | 5113 |
else |
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5114 |
begin |
4256 | 5115 |
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
|
5116 |
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
|
5117 |
begin |
4258 | 5118 |
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
|
5119 |
FreeAndNilTexture(Gear^.Tex); |
10123 | 5120 |
Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + |
5121 |
'%'), cWhiteColor, fntSmall) |
|
4254
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5122 |
end |
47515c926984
only update flamethrower texture when the percentage changes
nemo
parents:
4246
diff
changeset
|
5123 |
end |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5124 |
end; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5125 |
|
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5126 |
procedure doStepFlamethrower(Gear: PGear); |
8795 | 5127 |
var |
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5128 |
HHGear: PGear; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5129 |
begin |
4365 | 5130 |
HHGear := Gear^.Hedgehog^.Gear; |
6450 | 5131 |
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
|
5132 |
HHGear^.State := HHGear^.State or gstNotKickable; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5133 |
Gear^.doStep := @doStepFlamethrowerWork |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5134 |
end; |
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset
|
5135 |
|
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
|
5136 |
//////////////////////////////////////////////////////////////////////////////// |
5024 | 5137 |
procedure doStepLandGunWork(Gear: PGear); |
8795 | 5138 |
var |
7281 | 5139 |
HHGear, land: PGear; |
5024 | 5140 |
rx, ry, speed: hwFloat; |
5141 |
i, gX, gY: LongInt; |
|
5142 |
begin |
|
5143 |
AllInactive := false; |
|
5144 |
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
|
5145 |
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
|
5146 |
begin |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5147 |
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
|
5148 |
exit |
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5149 |
end; |
5024 | 5150 |
HedgehogChAngle(HHGear); |
5151 |
gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle); |
|
5152 |
gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle); |
|
8795 | 5153 |
|
5024 | 5154 |
if (GameTicks and $FF) = 0 then |
5155 |
begin |
|
5156 |
if (HHGear^.Message and gmRight) <> 0 then |
|
5157 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5158 |
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
|
5159 |
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
|
5160 |
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
|
5161 |
dec(Gear^.Tag); |
5024 | 5162 |
end |
5163 |
else if (HHGear^.Message and gmLeft) <> 0 then |
|
5164 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5165 |
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
|
5166 |
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
|
5167 |
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
|
5168 |
inc(Gear^.Tag); |
5024 | 5169 |
end |
5170 |
end; |
|
8795 | 5171 |
|
5024 | 5172 |
dec(Gear^.Timer); |
5173 |
if Gear^.Timer = 0 then |
|
5174 |
begin |
|
5175 |
dec(Gear^.Health); |
|
5480 | 5176 |
|
7001 | 5177 |
rx := rndSign(getRandomf * _0_1); |
5178 |
ry := rndSign(getRandomf * _0_1); |
|
5480 | 5179 |
speed := (_3 / Gear^.Tag); |
5180 |
||
8795 | 5181 |
land:= AddGear(gx, gy, gtFlake, gstTmpFlag, |
5182 |
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
|
5183 |
AngleCos(HHGear^.Angle) * ( - speed) + ry, 0); |
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
|
5184 |
land^.CollisionMask:= lfNotCurrentMask; |
8795 | 5185 |
|
5024 | 5186 |
Gear^.Timer:= Gear^.Tag |
5187 |
end; |
|
5188 |
||
7539 | 5189 |
if (Gear^.Health = 0) or ((HHGear^.State and gstHHDriven) = 0) or ((HHGear^.Message and gmAttack) <> 0) then |
5024 | 5190 |
begin |
6450 | 5191 |
HHGear^.Message:= HHGear^.Message and (not gmAttack); |
10831
19d056c10bbd
Clear flag set by gear on gear deletion. Also added a few more nil checks on HHGear
nemo
parents:
10827
diff
changeset
|
5192 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
5024 | 5193 |
DeleteGear(Gear); |
5194 |
AfterAttack |
|
5195 |
end |
|
5196 |
else |
|
5197 |
begin |
|
5198 |
i:= Gear^.Health div 10; |
|
5199 |
if (i <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
5200 |
begin |
|
5201 |
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
|
5202 |
FreeAndNilTexture(Gear^.Tex); |
10123 | 5203 |
Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(i) + |
5204 |
'%'), cWhiteColor, fntSmall) |
|
5024 | 5205 |
end |
5206 |
end |
|
5207 |
end; |
|
5208 |
||
5209 |
procedure doStepLandGun(Gear: PGear); |
|
8795 | 5210 |
var |
5024 | 5211 |
HHGear: PGear; |
5212 |
begin |
|
5213 |
HHGear := Gear^.Hedgehog^.Gear; |
|
6450 | 5214 |
HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown or gmLeft or gmRight or gmAttack)); |
5024 | 5215 |
HHGear^.State := HHGear^.State or gstNotKickable; |
5216 |
Gear^.doStep := @doStepLandGunWork |
|
5217 |
end; |
|
5218 |
||
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
|
5219 |
//////////////////////////////////////////////////////////////////////////////// |
3712 | 5220 |
procedure doStepPoisonCloud(Gear: PGear); |
5221 |
begin |
|
11236 | 5222 |
// don't bounce |
5223 |
if WorldEdge <> weBounce then |
|
5224 |
WorldWrap(Gear); |
|
3712 | 5225 |
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
|
5226 |
begin |
3712 | 5227 |
DeleteGear(Gear); |
5228 |
exit |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5229 |
end; |
3712 | 5230 |
dec(Gear^.Timer); |
5231 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
5232 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
3713 | 5233 |
Gear^.dX := Gear^.dX + cWindSpeed / 4; |
3712 | 5234 |
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
|
5235 |
if (GameTicks and $FF) = 0 then |
11468
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:
11391
diff
changeset
|
5236 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx or EXPLNoDamage or EXPLDoNotTouchAny or EXPLPoisoned); |
9817 | 5237 |
if Gear^.State and gstTmpFlag = 0 then |
5238 |
AllInactive:= false; |
|
3717 | 5239 |
end; |
5240 |
||
5241 |
//////////////////////////////////////////////////////////////////////////////// |
|
5242 |
procedure doStepHammer(Gear: PGear); |
|
3720 | 5243 |
var HHGear, tmp, tmp2: PGear; |
3717 | 5244 |
t: PGearArray; |
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
|
5245 |
i, dmg, d: LongInt; |
3717 | 5246 |
begin |
4365 | 5247 |
HHGear:= Gear^.Hedgehog^.Gear; |
3717 | 5248 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
5249 |
DeleteCI(HHGear); |
|
11044
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5250 |
SetLittle(HHGear^.dY); |
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5251 |
HHGear^.dY.IsNegative:= true; |
c3d76daae637
this should prevent hogs from hovering in air after using hammer
sheepluva
parents:
11042
diff
changeset
|
5252 |
HHGear^.State:= HHGear^.State or gstMoving; |
3717 | 5253 |
|
5254 |
t:= CheckGearsCollision(Gear); |
|
3720 | 5255 |
|
5256 |
for i:= 5 downto 0 do |
|
5257 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
|
5258 |
||
3717 | 5259 |
i:= t^.Count; |
5260 |
while i > 0 do |
|
5261 |
begin |
|
5262 |
dec(i); |
|
5263 |
tmp:= t^.ar[i]; |
|
5264 |
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
|
5265 |
if (tmp^.Kind = gtHedgehog) or (tmp^.Kind = gtMine) or (tmp^.Kind = gtExplosives) then |
3717 | 5266 |
begin |
11042 | 5267 |
dmg:= 0; |
3717 | 5268 |
//tmp^.State:= tmp^.State or gstFlatened; |
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
|
5269 |
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
|
5270 |
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
|
5271 |
// 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
|
5272 |
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
|
5273 |
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
|
5274 |
begin |
11277
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11236
diff
changeset
|
5275 |
// always rounding down |
11468
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:
11391
diff
changeset
|
5276 |
dmg:= dmg div Gear^.Boom; |
11277
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11236
diff
changeset
|
5277 |
|
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11236
diff
changeset
|
5278 |
if dmg > 0 then |
d63ef6afabe3
make hammer non-lethal again (as requested by unC0Rr)
sheepluva
parents:
11236
diff
changeset
|
5279 |
ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown); |
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
|
5280 |
end; |
11468
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:
11391
diff
changeset
|
5281 |
tmp^.dY:= _0_03 * Gear^.Boom |
11042 | 5282 |
end; |
5283 |
||
5284 |
if (tmp^.Kind <> gtHedgehog) or (dmg > 0) or (tmp^.Health > tmp^.Damage) then |
|
5285 |
begin |
|
5286 |
//DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); |
|
5287 |
tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); |
|
5288 |
tmp2^.LinkedGear:= tmp; |
|
5289 |
SetAllToActive |
|
5290 |
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
|
5291 |
end; |
3717 | 5292 |
end; |
5293 |
||
6450 | 5294 |
HHGear^.State:= HHGear^.State and (not gstNoDamage); |
3717 | 5295 |
Gear^.Timer:= 250; |
5296 |
Gear^.doStep:= @doStepIdle |
|
5297 |
end; |
|
3720 | 5298 |
|
5299 |
procedure doStepHammerHitWork(Gear: PGear); |
|
8795 | 5300 |
var |
5628 | 5301 |
i, j, ei: LongInt; |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5302 |
HitGear: PGear; |
3720 | 5303 |
begin |
5304 |
AllInactive := false; |
|
7272
71df899c4163
Second part of the change. Make collision check use the new mask bit.
nemo
parents:
7270
diff
changeset
|
5305 |
HitGear := Gear^.LinkedGear; |
3720 | 5306 |
dec(Gear^.Timer); |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5307 |
if (HitGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then |
5628 | 5308 |
begin |
3720 | 5309 |
DeleteGear(Gear); |
5310 |
exit |
|
5628 | 5311 |
end; |
3720 | 5312 |
|
5313 |
if (Gear^.Timer mod 5) = 0 then |
|
5628 | 5314 |
begin |
3720 | 5315 |
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
5316 |
||
5628 | 5317 |
i := hwRound(Gear^.X) - HitGear^.Radius + 2; |
5318 |
ei := hwRound(Gear^.X) + HitGear^.Radius - 2; |
|
5319 |
for j := 1 to 4 do DrawExplosion(i - GetRandom(5), hwRound(Gear^.Y) + 6*j, 3); |
|
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
6002
diff
changeset
|
5320 |
for j := 1 to 4 do DrawExplosion(ei + LongInt(GetRandom(5)), hwRound(Gear^.Y) + 6*j, 3); |
3720 | 5321 |
while i <= ei do |
5628 | 5322 |
begin |
5323 |
for j := 1 to 11 do DrawExplosion(i, hwRound(Gear^.Y) + 3*j, 3); |
|
3720 | 5324 |
inc(i, 1) |
5628 | 5325 |
end; |
3720 | 5326 |
|
5327 |
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
|
5328 |
, lfIndestructible) then |
|
5628 | 5329 |
begin |
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5330 |
//Gear^.X := Gear^.X + Gear^.dX; |
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5331 |
Gear^.Y := Gear^.Y + _1_9 |
5628 | 5332 |
end; |
3720 | 5333 |
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
|
5334 |
if TestCollisionYwithGear(Gear, 1) <> 0 then |
5628 | 5335 |
begin |
3720 | 5336 |
Gear^.dY := _0; |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5337 |
SetLittle(HitGear^.dX); |
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5338 |
HitGear^.dY := _0; |
5628 | 5339 |
end |
3720 | 5340 |
else |
5628 | 5341 |
begin |
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5342 |
//Gear^.dY := Gear^.dY + cGravity; |
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5343 |
//Gear^.Y := Gear^.Y + Gear^.dY; |
10354 | 5344 |
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
|
5345 |
Gear^.Timer := 1 |
5628 | 5346 |
end; |
3720 | 5347 |
|
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5348 |
//Gear^.X := Gear^.X + HitGear^.dX; |
5624
b6f70f6335ee
Allow hammer to bash mines/barrels too, increase escape time to 3s
nemo
parents:
5612
diff
changeset
|
5349 |
HitGear^.X := Gear^.X; |
8634
5dcb1dc9e01b
fix portal/hammer interaction, ban freezer from portal
nemo
parents:
8632
diff
changeset
|
5350 |
HitGear^.Y := Gear^.Y; |
5628 | 5351 |
SetLittle(HitGear^.dY); |
5352 |
HitGear^.Active:= true; |
|
3720 | 5353 |
end; |
5354 |
||
5355 |
procedure doStepHammerHit(Gear: PGear); |
|
8795 | 5356 |
var |
3720 | 5357 |
i, y: LongInt; |
5358 |
ar: TRangeArray; |
|
5359 |
HHGear: PGear; |
|
5360 |
begin |
|
5361 |
i := 0; |
|
4365 | 5362 |
HHGear := Gear^.Hedgehog^.Gear; |
3720 | 5363 |
|
5364 |
y := hwRound(Gear^.Y) - cHHRadius * 2; |
|
5365 |
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
|
5366 |
begin |
3720 | 5367 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
5368 |
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
5369 |
inc(y, 2); |
|
5370 |
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
|
5371 |
end; |
3720 | 5372 |
|
5373 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
|
5374 |
Gear^.dY := HHGear^.dY; |
|
5375 |
DeleteCI(HHGear); |
|
5376 |
||
5377 |
doStepHammerHitWork(Gear); |
|
3821 | 5378 |
Gear^.doStep := @doStepHammerHitWork |
3720 | 5379 |
end; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5380 |
|
4293
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
5381 |
//////////////////////////////////////////////////////////////////////////////// |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5382 |
procedure doStepResurrectorWork(Gear: PGear); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5383 |
var |
7335 | 5384 |
graves: PGearArrayS; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5385 |
resgear: PGear; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5386 |
hh: PHedgehog; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5387 |
i: LongInt; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5388 |
begin |
4184
bc2b88eea8c4
fix stray offset in resurrector, make resurrector use time
nemo
parents:
4182
diff
changeset
|
5389 |
if (TurnTimeLeft > 0) then |
bc2b88eea8c4
fix stray offset in resurrector, make resurrector use time
nemo
parents:
4182
diff
changeset
|
5390 |
dec(TurnTimeLeft); |
bc2b88eea8c4
fix stray offset in resurrector, make resurrector use time
nemo
parents:
4182
diff
changeset
|
5391 |
|
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5392 |
AllInactive := false; |
4365 | 5393 |
hh := Gear^.Hedgehog; |
4387 | 5394 |
|
5395 |
// no, you can't do that here |
|
5396 |
{DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy - |
|
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5397 |
cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); |
4387 | 5398 |
} |
4018
7f2c71638466
burp can always remove this if he doesn't like it. just making it a bit more interesting.
nemo
parents:
4017
diff
changeset
|
5399 |
(*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, |
7f2c71638466
burp can always remove this if he doesn't like it. just making it a bit more interesting.
nemo
parents:
4017
diff
changeset
|
5400 |
$FF);*) |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5401 |
|
6131 | 5402 |
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
|
5403 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5404 |
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
|
5405 |
exit; |
8795 | 5406 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5407 |
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
|
5408 |
exit; |
4017
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
5409 |
|
6131 | 5410 |
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
|
5411 |
begin |
4023
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
5412 |
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
|
5413 |
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
|
5414 |
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
|
5415 |
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
|
5416 |
|
4184
bc2b88eea8c4
fix stray offset in resurrector, make resurrector use time
nemo
parents:
4182
diff
changeset
|
5417 |
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
|
5418 |
|
7335 | 5419 |
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
|
5420 |
begin |
7053 | 5421 |
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
|
5422 |
Gear^.Timer := 250; |
3f605cca9215
Resurrector weapon: do not make it end turn, add description,
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3971
diff
changeset
|
5423 |
Gear^.doStep := @doStepIdle; |
3f605cca9215
Resurrector weapon: do not make it end turn, add description,
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3971
diff
changeset
|
5424 |
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
|
5425 |
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
|
5426 |
|
6131 | 5427 |
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
|
5428 |
begin |
7721 | 5429 |
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
|
5430 |
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
|
5431 |
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
|
5432 |
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
|
5433 |
RenderHealth(hh^); |
7399 | 5434 |
RecountTeamHealth(hh^.Team); |
7335 | 5435 |
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
|
5436 |
inc(Gear^.Tag) |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5437 |
{-for i:= 0 to High(graves) do begin |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5438 |
if hh^.Gear^.Health > 0 then begin |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5439 |
dec(hh^.Gear^.Health); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5440 |
inc(graves[i]^.Health); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5441 |
end; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5442 |
end; -} |
8795 | 5443 |
end |
5444 |
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
|
5445 |
begin |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5446 |
// now really resurrect the hogs with the hp saved in the graves |
7335 | 5447 |
for i:= 0 to graves.size - 1 do |
5448 |
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
|
5449 |
begin |
11203 | 5450 |
resgear := AddGear(hwRound(graves.ar^[i]^.X), hwRound(graves.ar^[i]^.Y), gtHedgehog, gstWait, _0, _0, 0,graves.ar^[i]^.Pos); |
7335 | 5451 |
resgear^.Hedgehog := graves.ar^[i]^.Hedgehog; |
5452 |
resgear^.Health := graves.ar^[i]^.Health; |
|
5453 |
PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := resgear; |
|
7394 | 5454 |
graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy; |
7399 | 5455 |
graves.ar^[i]^.Active:= true; |
4372 | 5456 |
RenderHealth(resgear^.Hedgehog^); |
5457 |
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
|
5458 |
resgear^.Hedgehog^.Effects[heResurrected]:= 1; |
4874 | 5459 |
// only make hat-less hedgehogs look like zombies, preserve existing hats |
7394 | 5460 |
|
4372 | 5461 |
if resgear^.Hedgehog^.Hat = 'NoHat' then |
7754 | 5462 |
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
|
5463 |
end; |
4023
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
5464 |
|
8de77872ef21
Resurrector: Levitate hog + show cross
Tobias Neumann <mail@tobias-neumann.eu>
parents:
4021
diff
changeset
|
5465 |
hh^.Gear^.dY := _0; |
4045 | 5466 |
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
|
5467 |
doStepHedgehogMoving(hh^.Gear); |
7053 | 5468 |
StopSoundChan(Gear^.SoundChannel); |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5469 |
Gear^.Timer := 250; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5470 |
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
|
5471 |
end |
4017
048bcb8c72ae
Kill off hog immediately on using up health, use more common formatting, call render less often
nemo
parents:
4005
diff
changeset
|
5472 |
//if hh^.Gear^.Health = 0 then doStepHedgehogFree(hh^.Gear); |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5473 |
end; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5474 |
|
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5475 |
procedure doStepResurrector(Gear: PGear); |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5476 |
var |
7335 | 5477 |
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
|
5478 |
hh: PHedgehog; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5479 |
i: LongInt; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5480 |
begin |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5481 |
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
|
5482 |
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
|
5483 |
|
7335 | 5484 |
if graves.size > 0 then |
5485 |
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
|
5486 |
hh := Gear^.Hedgehog; |
7335 | 5487 |
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
|
5488 |
begin |
7335 | 5489 |
PHedgehog(graves.ar^[i]^.Hedgehog)^.Gear := nil; |
5490 |
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
|
5491 |
end; |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5492 |
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
|
5493 |
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
|
5494 |
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
|
5495 |
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
|
5496 |
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
|
5497 |
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
|
5498 |
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
|
5499 |
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
|
5500 |
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
|
5501 |
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
|
5502 |
inc(Gear^.Tag) |
8795 | 5503 |
end |
5504 |
end |
|
5505 |
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
|
5506 |
begin |
7053 | 5507 |
StopSoundChan(Gear^.SoundChannel); |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5508 |
Gear^.Timer := 250; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5509 |
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
|
5510 |
end |
3963
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5511 |
end; |
6090d2a2472e
New Weapon: Resurrector (TODO: ammo icon + sprites)
Tobias Neumann <mail@tobias-neumann.eu>
parents:
3959
diff
changeset
|
5512 |
|
4293
d79ffcdd77df
makes drill attack drills weaker and not affected by wind
Henek
parents:
4282
diff
changeset
|
5513 |
//////////////////////////////////////////////////////////////////////////////// |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5514 |
procedure doStepNapalmBomb(Gear: PGear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5515 |
var |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5516 |
i, gX, gY: LongInt; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5517 |
dX, dY: hwFloat; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5518 |
begin |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5519 |
AllInactive := false; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5520 |
doStepFallingGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5521 |
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
|
5522 |
begin |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
5523 |
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
|
5524 |
gX := hwRound(Gear^.X); |
8795 | 5525 |
gY := hwRound(Gear^.Y); |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5526 |
for i:= 0 to 10 do |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5527 |
begin |
7001 | 5528 |
dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandomf + _1); |
5529 |
dY := AngleSin(i * 8) * _0_5 * (GetRandomf + _1); |
|
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5530 |
AddGear(gX, gY, gtFlame, 0, dX, dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5531 |
AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5532 |
AddGear(gX, gY, gtFlame, 0, -dX, dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5533 |
AddGear(gX, gY, gtFlame, 0, -dX, -dY, 0); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5534 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5535 |
DeleteGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5536 |
exit |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5537 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5538 |
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
|
5539 |
begin |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
5540 |
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
|
5541 |
for i:= -19 to 19 do |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5542 |
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
|
5543 |
DeleteGear(Gear); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5544 |
exit |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5545 |
end; |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5546 |
if (GameTicks and $3F) = 0 then |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5547 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5548 |
dec(Gear^.Timer) |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5549 |
end; |
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5550 |
|
11468
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:
11391
diff
changeset
|
5551 |
(* |
4313
0690067bc5ff
made napalm use napalmbombs instead of just dropping fire
Henek
parents:
4301
diff
changeset
|
5552 |
//////////////////////////////////////////////////////////////////////////////// |
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5553 |
procedure doStepStructure(Gear: PGear); |
8795 | 5554 |
var |
6491 | 5555 |
x, y: LongInt; |
6472 | 5556 |
HH: PHedgehog; |
5557 |
t: PGear; |
|
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5558 |
begin |
6472 | 5559 |
HH:= Gear^.Hedgehog; |
5560 |
||
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
|
5561 |
if (Gear^.State and gstMoving) <> 0 then |
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
|
5562 |
begin |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
5563 |
AddCI(Gear); |
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
|
5564 |
Gear^.dX:= _0; |
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
|
5565 |
Gear^.dY:= _0; |
6450 | 5566 |
Gear^.State:= Gear^.State and (not gstMoving); |
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
|
5567 |
end; |
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
|
5568 |
|
6472 | 5569 |
dec(Gear^.Health, Gear^.Damage); |
5570 |
Gear^.Damage:= 0; |
|
8795 | 5571 |
|
6472 | 5572 |
if Gear^.Pos = 1 then |
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5573 |
begin |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
5574 |
AddCI(Gear); |
6472 | 5575 |
AfterAttack; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5576 |
if Gear = CurAmmoGear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5577 |
CurAmmoGear:= nil; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5578 |
if HH^.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
|
5579 |
HideHog(HH); |
6472 | 5580 |
Gear^.Pos:= 2 |
5581 |
end; |
|
8795 | 5582 |
|
6472 | 5583 |
if Gear^.Pos = 2 then |
5584 |
begin |
|
5585 |
if ((GameTicks mod 100) = 0) and (Gear^.Timer < 1000) then |
|
5279 | 5586 |
begin |
6472 | 5587 |
if (Gear^.Timer mod 10) = 0 then |
5588 |
begin |
|
5589 |
DeleteCI(Gear); |
|
5590 |
Gear^.Y:= Gear^.Y - _0_5; |
|
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
5591 |
AddCI(Gear); |
6472 | 5592 |
end; |
5593 |
inc(Gear^.Timer); |
|
5279 | 5594 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5595 |
if Gear^.Tag <= TotalRounds then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5596 |
Gear^.Pos:= 3; |
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5597 |
end; |
8795 | 5598 |
|
6472 | 5599 |
if Gear^.Pos = 3 then |
5600 |
if Gear^.Timer < 1000 then |
|
5601 |
begin |
|
5602 |
if (Gear^.Timer mod 10) = 0 then |
|
5603 |
begin |
|
5604 |
DeleteCI(Gear); |
|
5605 |
Gear^.Y:= Gear^.Y - _0_5; |
|
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
5606 |
AddCI(Gear); |
6472 | 5607 |
end; |
5608 |
inc(Gear^.Timer); |
|
5609 |
end |
|
5610 |
else |
|
5279 | 5611 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5612 |
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
|
5613 |
RestoreHog(HH); |
6472 | 5614 |
Gear^.Pos:= 4; |
5279 | 5615 |
end; |
8795 | 5616 |
|
6472 | 5617 |
if Gear^.Pos = 4 then |
6473 | 5618 |
if ((GameTicks mod 1000) = 0) and ((GameFlags and gfInvulnerable) = 0) then |
6472 | 5619 |
begin |
5620 |
t:= GearsList; |
|
5621 |
while t <> nil do |
|
5622 |
begin |
|
5623 |
if (t^.Kind = gtHedgehog) and (t^.Hedgehog^.Team^.Clan = HH^.Team^.Clan) then |
|
9685
7d925e82e572
Tweak trophyrace to work better w/ skip (probably, needs testing), drop Invulnerable in favour of effects - heInvulnerable is already in effects,
nemo
parents:
9565
diff
changeset
|
5624 |
t^.Hedgehog^.Effects[heInvulnerable]:= 1; |
6472 | 5625 |
t:= t^.NextGear; |
5626 |
end; |
|
5627 |
end; |
|
8795 | 5628 |
|
5279 | 5629 |
if Gear^.Health <= 0 then |
5630 |
begin |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5631 |
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
|
5632 |
RestoreHog(HH); |
8795 | 5633 |
|
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5634 |
x := hwRound(Gear^.X); |
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5635 |
y := hwRound(Gear^.Y); |
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5636 |
|
5279 | 5637 |
DeleteCI(Gear); |
4881
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5638 |
DeleteGear(Gear); |
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5639 |
|
35e6269227b6
still in developement take on adding structures, working hiding of hogs and ejecting them later.
Henek
parents:
4880
diff
changeset
|
5640 |
doMakeExplosion(x, y, 50, CurrentHedgehog, EXPLAutoSound); |
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
|
5641 |
end; |
5013 | 5642 |
end; |
11468
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:
11391
diff
changeset
|
5643 |
*) |
5013 | 5644 |
|
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
|
5645 |
//////////////////////////////////////////////////////////////////////////////// |
5706 | 5646 |
(* |
8795 | 5647 |
TARDIS needs |
5706 | 5648 |
Warp in. Pos = 1 |
5649 |
Pause. Pos = 2 |
|
5650 |
Hide gear (TARDIS hedgehog was nil) |
|
5651 |
Warp out. Pos = 3 |
|
5652 |
... idle active for some time period ... Pos = 4 |
|
5653 |
Warp in. Pos = 1 |
|
5654 |
Pause. Pos = 2 |
|
5655 |
Restore gear (TARDIS hedgehog was not nil) |
|
5656 |
Warp out. Pos = 3 |
|
5657 |
*) |
|
5658 |
||
5659 |
procedure doStepTardisWarp(Gear: PGear); |
|
5660 |
var HH: PHedgehog; |
|
5661 |
i,j,cnt: LongWord; |
|
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
|
5662 |
begin |
5706 | 5663 |
HH:= Gear^.Hedgehog; |
5664 |
if Gear^.Pos = 2 then |
|
5665 |
begin |
|
7053 | 5666 |
StopSoundChan(Gear^.SoundChannel); |
5706 | 5667 |
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
|
5668 |
begin |
5715
59a8dd33f274
Restore gear ASAP, add denied sound for illegal activation without wasting ammo.
nemo
parents:
5710
diff
changeset
|
5669 |
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
|
5670 |
begin |
5935 | 5671 |
AfterAttack; |
5706 | 5672 |
if Gear = CurAmmoGear then CurAmmoGear := nil; |
8795 | 5673 |
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
|
5674 |
((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
|
5675 |
HideHog(HH) |
5706 | 5676 |
end |
5738 | 5677 |
//else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then |
5678 |
else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then |
|
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset
|
5679 |
RestoreHog(HH) |
5706 | 5680 |
end; |
5681 |
||
5971 | 5682 |
inc(Gear^.Timer); |
5706 | 5683 |
if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then |
5684 |
begin |
|
5728 | 5685 |
Gear^.SoundChannel := LoopSound(sndTardis); |
5686 |
Gear^.Pos:= 3 |
|
5687 |
end |
|
5706 | 5688 |
end; |
5689 |
||
6131 | 5690 |
if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then |
5935 | 5691 |
begin |
5692 |
inc(Gear^.Power); |
|
8795 | 5693 |
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
|
5694 |
(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
|
5695 |
((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
|
5696 |
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
|
5697 |
begin |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5698 |
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
|
5699 |
Tag:= 2; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5700 |
Timer:= 0; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5701 |
Pos:= 0 |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5702 |
end |
5935 | 5703 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5704 |
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
|
5705 |
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
|
5706 |
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
|
5707 |
Gear^.Pos:= 2; |
5706 | 5708 |
if (Gear^.Pos = 3) and (Gear^.Power = 0) then |
5709 |
begin |
|
7053 | 5710 |
StopSoundChan(Gear^.SoundChannel); |
5710 | 5711 |
if HH^.GearHidden = nil then |
5712 |
begin |
|
5713 |
DeleteGear(Gear); |
|
5714 |
exit |
|
5715 |
end; |
|
5706 | 5716 |
Gear^.Pos:= 4; |
5717 |
// 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
|
5718 |
Gear^.Timer:= GetRandom(cHedgehogTurnTime*TeamsCount)+cHedgehogTurnTime |
5706 | 5719 |
end; |
5720 |
||
5721 |
if (Gear^.Pos = 4) then |
|
5722 |
begin |
|
5723 |
cnt:= 0; |
|
5724 |
for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do |
|
9470 | 5725 |
with HH^.Team^.Clan^.Teams[j]^ do |
5726 |
for i:= 0 to Pred(HedgehogsNumber) do |
|
5727 |
if (Hedgehogs[i].Gear <> nil) |
|
5728 |
and ((Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
|
5729 |
and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage) then |
|
5730 |
inc(cnt); |
|
5706 | 5731 |
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
|
5732 |
begin |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5733 |
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
|
5734 |
FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true); |
8795 | 5735 |
|
6131 | 5736 |
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
|
5737 |
begin |
5738 | 5738 |
Gear^.X:= HH^.GearHidden^.X; |
5739 |
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
|
5740 |
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
|
5741 |
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
|
5742 |
|
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
|
5743 |
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
|
5744 |
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
|
5745 |
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
|
5746 |
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
|
5747 |
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
|
5748 |
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
|
5749 |
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
|
5750 |
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
|
5751 |
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
|
5752 |
Gear^.Power:= 0; |
5706 | 5753 |
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
|
5754 |
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
|
5755 |
else if (CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan) then dec(Gear^.Timer) |
5706 | 5756 |
end; |
5757 |
||
5758 |
end; |
|
5759 |
||
5760 |
procedure doStepTardis(Gear: PGear); |
|
5761 |
var i,j,cnt: LongWord; |
|
5762 |
HH: PHedgehog; |
|
5763 |
begin |
|
5764 |
(* |
|
5765 |
Conditions for not activating. |
|
5766 |
1. Hog is last of his clan |
|
5767 |
2. Sudden Death is in play |
|
5768 |
3. Hog is a king |
|
5769 |
*) |
|
5770 |
HH:= Gear^.Hedgehog; |
|
6131 | 5771 |
if HH^.Gear <> nil then |
5706 | 5772 |
if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then |
5773 |
begin |
|
6131 | 5774 |
if HH^.Gear <> nil then |
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
|
5775 |
begin |
6450 | 5776 |
HH^.Gear^.Message := HH^.Gear^.Message and (not gmAttack); |
5777 |
HH^.Gear^.State:= HH^.Gear^.State and (not gstAttacking); |
|
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
|
5778 |
end; |
5715
59a8dd33f274
Restore gear ASAP, add denied sound for illegal activation without wasting ammo.
nemo
parents:
5710
diff
changeset
|
5779 |
PlaySound(sndDenied); |
5706 | 5780 |
DeleteGear(gear); |
5781 |
exit |
|
5782 |
end; |
|
5783 |
cnt:= 0; |
|
5784 |
for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do |
|
5785 |
for i:= 0 to Pred(HH^.Team^.Clan^.Teams[j]^.HedgehogsNumber) do |
|
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5786 |
if (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear <> nil) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5787 |
and ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5788 |
and (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset
|
5789 |
inc(cnt); |
5706 | 5790 |
if cnt < 2 then |
5791 |
begin |
|
6131 | 5792 |
if HH^.Gear <> nil then |
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
|
5793 |
begin |
6450 | 5794 |
HH^.Gear^.Message := HH^.Gear^.Message and (not gmAttack); |
5795 |
HH^.Gear^.State:= HH^.Gear^.State and (not gstAttacking); |
|
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
|
5796 |
end; |
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
|
5797 |
PlaySound(sndDenied); |
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
|
5798 |
DeleteGear(gear); |
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
|
5799 |
exit |
5706 | 5800 |
end; |
5728 | 5801 |
Gear^.SoundChannel := LoopSound(sndTardis); |
5706 | 5802 |
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
|
5803 |
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
|
5804 |
|
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
|
5805 |
//////////////////////////////////////////////////////////////////////////////// |
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
|
5806 |
|
7007 | 5807 |
(* |
5808 |
WIP. The ice gun will have the following effects. It has been proposed by sheepluva that it take the appearance of a large freezer |
|
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
|
5809 |
spewing ice cubes. The cubes will be visual gears only. The scatter from them and the impact snow dust should help hide imprecisions in things like the GearsNear effect. |
7007 | 5810 |
For now we assume a "ray" like a deagle projected out from the gun. |
8795 | 5811 |
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 | 5812 |
* 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
|
5813 |
* 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. |
11191 | 5814 |
* When fired at a hog (land and $00FF <> 0), while the hog is targetted, the hog's state is set to frozen. |
5815 |
As long as the gun is on the hog, a frozen hog sprite creeps up from the feet to the head. |
|
5816 |
If the effect is interrupted before reaching the top, the freezing state is cleared. |
|
5817 |
A frozen hog will animate differently. |
|
5818 |
To be decided, but possibly in a similar fashion to a grave when it comes to explosions. |
|
5819 |
The hog might (possibly) not be damaged by explosions. |
|
5820 |
This might make freezing potentially useful for friendlies in a bad position. |
|
5821 |
It might be better to allow damage though. |
|
5822 |
A frozen hog stays frozen for a certain number of turns. |
|
5823 |
Each turn the frozen overlay becomes fainter, until it fades and the hog animates normally again. |
|
7007 | 5824 |
*) |
8548 | 5825 |
|
5826 |
||
5827 |
procedure updateFuel(Gear: PGear); |
|
8795 | 5828 |
var |
8548 | 5829 |
t:LongInt; |
5830 |
begin |
|
5831 |
t:= Gear^.Health div 10; |
|
5832 |
if (t <> Gear^.Damage) and ((GameTicks and $3F) = 0) then |
|
5833 |
begin |
|
5834 |
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
|
5835 |
FreeAndNilTexture(Gear^.Tex); |
10123 | 5836 |
Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ansistring(': ' + inttostr(t) + |
5837 |
'%'), cWhiteColor, fntSmall) |
|
8548 | 5838 |
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
|
5839 |
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
|
5840 |
begin |
9072 | 5841 |
StopSoundChan(Gear^.SoundChannel); |
5842 |
Gear^.SoundChannel:= -1; |
|
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
|
5843 |
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
|
5844 |
end |
10015 | 5845 |
else |
9072 | 5846 |
begin |
5847 |
if Gear^.SoundChannel = -1 then |
|
5848 |
Gear^.SoundChannel := LoopSound(sndIceBeam); |
|
5849 |
if GameTicks mod 10 = 0 then dec(Gear^.Health) |
|
5850 |
end |
|
8548 | 5851 |
end; |
5852 |
||
5853 |
||
5854 |
procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
|
8773 | 5855 |
// var |
5856 |
// iter:PGear; |
|
8548 | 5857 |
begin |
5858 |
with Gear^ do |
|
5859 |
begin |
|
5860 |
dX:= newX; |
|
5861 |
dY:= newY; |
|
5862 |
Pos:= 0; |
|
5863 |
Target.X:= NoPointX; |
|
5864 |
LastDamage:= nil; |
|
5865 |
X:= Hedgehog^.Gear^.X; |
|
5866 |
Y:= Hedgehog^.Gear^.Y; |
|
5867 |
end; |
|
5868 |
end; |
|
5869 |
||
7007 | 5870 |
procedure doStepIceGun(Gear: PGear); |
9145 | 5871 |
const iceWaitCollision = 0; |
5872 |
const iceCollideWithGround = 1; |
|
8773 | 5873 |
//const iceWaitNextTarget:Longint = 2; |
5874 |
//const iceCollideWithHog:Longint = 4; |
|
9145 | 5875 |
const iceCollideWithWater = 5; |
8773 | 5876 |
//const waterFreezingTime:Longint = 500; |
9145 | 5877 |
const groundFreezingTime = 1000; |
8601
7668f92734b8
Make refactoring. Remove DrawIce function
Urbertar@gmail.com
parents:
8599
diff
changeset
|
5878 |
const iceRadius = 32; |
8602 | 5879 |
const iceHeight = 40; |
7716 | 5880 |
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
|
5881 |
HHGear, iter: PGear; |
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5882 |
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
|
5883 |
ndX, ndY: hwFloat; |
9137
d987230b85ed
fixed all engine compilation hints and notes (that I could see)
sheepluva
parents:
9080
diff
changeset
|
5884 |
i, t, gX, gY: LongInt; |
7335 | 5885 |
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
|
5886 |
vg: PVisualGear; |
7007 | 5887 |
begin |
7093 | 5888 |
HHGear := Gear^.Hedgehog^.Gear; |
9356 | 5889 |
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 | 5890 |
begin |
9072 | 5891 |
StopSoundChan(Gear^.SoundChannel); |
7093 | 5892 |
DeleteGear(Gear); |
5893 |
AfterAttack; |
|
5894 |
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
|
5895 |
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
|
5896 |
updateFuel(Gear); |
8548 | 5897 |
|
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
|
5898 |
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
|
5899 |
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
|
5900 |
HedgehogChAngle(HHGear); |
7093 | 5901 |
ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5902 |
ndY:= -AngleCos(HHGear^.Angle) * _4; |
|
8795 | 5903 |
if (ndX <> dX) or (ndY <> dY) or |
5904 |
((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
|
10582 | 5905 |
(Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0)) and |
5906 |
(not CheckCoordInWater(Target.X, Target.Y))) 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
|
5907 |
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
|
5908 |
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
|
5909 |
Timer := iceWaitCollision; |
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
|
5910 |
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
|
5911 |
else |
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
|
5912 |
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
|
5913 |
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
|
5914 |
Y:= Y + dY; |
7093 | 5915 |
gX:= hwRound(X); |
8795 | 5916 |
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
|
5917 |
if Target.X = NoPointX then t:= hwRound(hwSqr(X-HHGear^.X)+hwSqr(Y-HHGear^.Y)); |
8548 | 5918 |
|
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
|
5919 |
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
|
5920 |
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
|
5921 |
CheckCollision(Gear); |
8548 | 5922 |
if (State and gstCollision) <> 0 then |
5923 |
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
|
5924 |
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
|
5925 |
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
|
5926 |
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
|
5927 |
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
|
5928 |
end |
8795 | 5929 |
end |
10582 | 5930 |
else if CheckCoordInWater(Target.X, Target.Y) or |
5931 |
((Target.X and LAND_WIDTH_MASK = 0) and |
|
5932 |
(Target.Y and LAND_HEIGHT_MASK = 0) and |
|
5933 |
(Land[Target.Y, Target.X] = lfIce) and |
|
5934 |
((Target.Y+iceHeight+5 > cWaterLine) or |
|
5935 |
((WorldEdge = weSea) and |
|
5936 |
((Target.X+iceHeight+5 > LongInt(rightX)) or |
|
5937 |
(Target.X-iceHeight-5 < LongInt(leftX))))) |
|
5938 |
) then |
|
8602 | 5939 |
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
|
5940 |
if Timer = iceWaitCollision then |
8602 | 5941 |
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
|
5942 |
Timer := iceCollideWithWater; |
8795 | 5943 |
Power := GameTicks; |
8602 | 5944 |
end; |
8548 | 5945 |
end; |
5946 |
||
7098
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
5947 |
if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
8602 | 5948 |
begin |
7098
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
5949 |
X:= HHGear^.X; |
f8c453ade379
Minor tweaks to freezer, mostly to simplify current state to laptop
nemo
parents:
7093
diff
changeset
|
5950 |
Y:= HHGear^.Y |
8602 | 5951 |
end; |
8548 | 5952 |
|
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
|
5953 |
if (Timer = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then |
8795 | 5954 |
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
|
5955 |
FillRoundInLandFT(target.x, target.y, iceRadius, icePixel); |
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5956 |
landRect.x := min(max(target.x - iceRadius, 0), LAND_WIDTH - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5957 |
landRect.y := min(max(target.y - iceRadius, 0), LAND_HEIGHT - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5958 |
landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5959 |
landRect.h := min(2*iceRadius, LAND_HEIGHT - landRect.y - 1); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
5960 |
UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
10015 | 5961 |
|
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
|
5962 |
// 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
|
5963 |
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
|
5964 |
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
|
5965 |
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
|
5966 |
if (iter^.State and gstFrozen = 0) and |
10015 | 5967 |
((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and |
5968 |
(abs(LongInt(iter^.X.Round) - target.x) + abs(LongInt(iter^.Y.Round) - target.y) + 2 < 2 * iceRadius) |
|
9954 | 5969 |
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
|
5970 |
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
|
5971 |
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
|
5972 |
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
|
5973 |
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
|
5974 |
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
|
5975 |
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
|
5976 |
i:= random(100) + 155; |
9145 | 5977 |
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
|
5978 |
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
|
5979 |
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
|
5980 |
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
|
5981 |
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
|
5982 |
end; |
9077
e8d9d94c122f
Waddaya think. Add it for iced up water and mines/cases/explosives
nemo
parents:
9076
diff
changeset
|
5983 |
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
|
5984 |
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
|
5985 |
begin |
9251 | 5986 |
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
|
5987 |
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
|
5988 |
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
|
5989 |
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
|
5990 |
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
|
5991 |
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
|
5992 |
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
|
5993 |
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
|
5994 |
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
|
5995 |
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
|
5996 |
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
|
5997 |
DeleteCI(iter); |
9251 | 5998 |
iter^.State:= iter^.State or gstFrozen; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
5999 |
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
|
6000 |
end |
9045
6561c42399d3
sheepluva suggestion for frozen barrel behaviour. untested.
nemo
parents:
9043
diff
changeset
|
6001 |
else // gtExplosives |
9251 | 6002 |
begin |
6003 |
iter^.State:= iter^.State or gstFrozen; |
|
9045
6561c42399d3
sheepluva suggestion for frozen barrel behaviour. untested.
nemo
parents:
9043
diff
changeset
|
6004 |
iter^.Health:= iter^.Health + cBarrelHealth |
9251 | 6005 |
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
|
6006 |
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
|
6007 |
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
|
6008 |
end; |
8795 | 6009 |
|
8783
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6010 |
// FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
f1231a48fc48
Remove some duplicating code from uLandGraphics.pas
Urbertar
parents:
8773
diff
changeset
|
6011 |
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
|
6012 |
Timer := iceWaitCollision; |
8602 | 6013 |
end; |
6014 |
||
10411 | 6015 |
if (Timer = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime div 2) then |
8795 | 6016 |
begin |
9077
e8d9d94c122f
Waddaya think. Add it for iced up water and mines/cases/explosives
nemo
parents:
9076
diff
changeset
|
6017 |
PlaySound(sndHogFreeze); |
10582 | 6018 |
if CheckCoordInWater(Target.X, Target.Y) then |
6019 |
DrawIceBreak(Target.X, Target.Y, iceRadius, iceHeight) |
|
6020 |
else if Target.Y+iceHeight+5 > cWaterLine then |
|
6021 |
DrawIceBreak(Target.X, Target.Y+iceHeight+5, iceRadius, iceHeight) |
|
6022 |
else if Target.X+iceHeight+5 > LongInt(rightX) then |
|
6023 |
DrawIceBreak(Target.X+iceHeight+5, Target.Y, iceRadius, iceHeight) |
|
6024 |
else |
|
6025 |
DrawIceBreak(Target.X-iceHeight-5, Target.Y, iceRadius, iceHeight); |
|
8795 | 6026 |
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
|
6027 |
Timer := iceWaitCollision; |
8602 | 6028 |
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
|
6029 |
(* |
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
|
6030 |
Any ideas for something that would look good here? |
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
|
6031 |
if (Target.X <> NoPointX) and ((Timer = iceCollideWithGround) or (Timer = iceCollideWithWater)) and (GameTicks mod max((groundFreezingTime-((GameTicks - Power)*2)),2) = 0) then //and CheckLandValue(Target.X, Target.Y, lfIce) 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
|
6032 |
begin |
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
|
6033 |
vg:= AddVisualGear(Target.X+random(20)-10, Target.Y+random(40)-10, vgtDust, 1); |
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
|
6034 |
if vg <> nil 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
|
6035 |
begin |
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
|
6036 |
i:= random(100) + 155; |
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
|
6037 |
vg^.Tint:= IceColor or $FF; |
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
|
6038 |
vg^.Angle:= random(360); |
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
|
6039 |
vg^.dx:= 0.001 * random(80); |
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
|
6040 |
vg^.dy:= 0.001 * random(80) |
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
|
6041 |
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
|
6042 |
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
|
6043 |
*) |
8548 | 6044 |
|
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset
|
6045 |
// freeze nearby hogs |
8560 | 6046 |
hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
7335 | 6047 |
if hogs.size > 0 then |
6048 |
for i:= 0 to hogs.size - 1 do |
|
6049 |
if hogs.ar^[i] <> HHGear then |
|
8795 | 6050 |
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
|
6051 |
begin |
8565 | 6052 |
hogs.ar^[i]^.Active:= true; |
6053 |
if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] < 256 then |
|
6054 |
hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] := hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] + 1 |
|
6055 |
else if hogs.ar^[i]^.Hedgehog^.Effects[heFrozen] = 256 then |
|
9073 | 6056 |
begin |
9059 | 6057 |
hogs.ar^[i]^.Hedgehog^.Effects[heFrozen]:= 200000-1;//cHedgehogTurnTime + cReadyDelay |
9073 | 6058 |
PlaySound(sndHogFreeze); |
6059 |
end; |
|
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
6060 |
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
|
6061 |
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
|
6062 |
end |
10582 | 6063 |
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
|
6064 |
(((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
|
6065 |
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
|
6066 |
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
|
6067 |
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
|
6068 |
Target.Y:= gY; |
7093 | 6069 |
X:= HHGear^.X; |
6070 |
Y:= HHGear^.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
|
6071 |
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
|
6072 |
if (gX > max(LAND_WIDTH,4096)*2) or |
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
|
6073 |
(gX < -max(LAND_WIDTH,4096)) or |
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
|
6074 |
(gY < -max(LAND_HEIGHT,4096)) or |
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
|
6075 |
(gY > max(LAND_HEIGHT,4096)+512) then |
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
|
6076 |
begin |
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
|
6077 |
//X:= HHGear^.X; |
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
|
6078 |
//Y:= HHGear^.Y |
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
|
6079 |
Target.X:= gX; |
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
|
6080 |
Target.Y:= gY; |
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
|
6081 |
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
|
6082 |
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
|
6083 |
end; |
7007 | 6084 |
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
|
6085 |
|
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
|
6086 |
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
|
6087 |
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
|
6088 |
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
|
6089 |
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
|
6090 |
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
|
6091 |
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
|
6092 |
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
|
6093 |
if Gear^.Pos = posCaseUtility then |
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
|
6094 |
a:= GetUtility(Gear^.Hedgehog) |
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
|
6095 |
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
|
6096 |
a:= GetAmmo(Gear^.Hedgehog); |
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
|
6097 |
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
|
6098 |
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
|
6099 |
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
|
6100 |
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
|
6101 |
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
|
6102 |
AddRandomness(CheckSum); |
9954 | 6103 |
if gi^.Kind = gtGenericFaller then 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
|
6104 |
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
|
6105 |
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
|
6106 |
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
|
6107 |
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
|
6108 |
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
|
6109 |
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
|
6110 |
|
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
|
6111 |
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
|
6112 |
begin |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6113 |
if Gear^.Timer < $FFFFFFFF then |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6114 |
if Gear^.Timer > 0 then |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6115 |
dec(Gear^.Timer) |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6116 |
else |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6117 |
begin |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6118 |
DeleteGear(Gear); |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6119 |
exit |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7400
diff
changeset
|
6120 |
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
|
6121 |
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
|
6122 |
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
|
6123 |
doStepFallingGear(Gear); |
8370 | 6124 |
if (Gear^.State and gstInvisible <> 0) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < LongInt(leftX)) or (hwRound(Gear^.X) > LongInt(rightX)) or (hwRound(Gear^.Y) < LongInt(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
|
6125 |
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
|
6126 |
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
|
6127 |
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
|
6128 |
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
|
6129 |
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
|
6130 |
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
|
6131 |
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
|
6132 |
end; |
11468
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:
11391
diff
changeset
|
6133 |
(* |
7627 | 6134 |
procedure doStepCreeper(Gear: PGear); |
6135 |
var hogs: PGearArrayS; |
|
6136 |
HHGear: PGear; |
|
6137 |
tdX: hwFloat; |
|
6138 |
dir: LongInt; |
|
6139 |
begin |
|
6140 |
doStepFallingGear(Gear); |
|
6141 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
|
6142 |
// creeper sleep phase |
|
6143 |
if (Gear^.Hedgehog = nil) and (Gear^.Timer > 0) then exit; |
|
6144 |
||
6145 |
if Gear^.Hedgehog <> nil then HHGear:= Gear^.Hedgehog^.Gear |
|
6146 |
else HHGear:= nil; |
|
6147 |
||
6148 |
// creeper boom phase |
|
6149 |
if (Gear^.State and gstTmpFlag <> 0) then |
|
6150 |
begin |
|
6151 |
if (Gear^.Timer = 0) then |
|
6152 |
begin |
|
6153 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 300, CurrentHedgehog, EXPLAutoSound); |
|
6154 |
DeleteGear(Gear) |
|
6155 |
end; |
|
6156 |
// ssssss he essssscaped |
|
8795 | 6157 |
if (Gear^.Timer > 250) and ((HHGear = nil) or |
7627 | 6158 |
(((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) > 180) and |
6159 |
(Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > _180))) then |
|
6160 |
begin |
|
6161 |
Gear^.State:= Gear^.State and (not gstTmpFlag); |
|
6162 |
Gear^.Timer:= 0 |
|
6163 |
end; |
|
6164 |
exit |
|
6165 |
end; |
|
6166 |
||
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6167 |
// Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target |
8795 | 6168 |
if (HHGear = nil) or (Gear^.Timer = 0) or |
7627 | 6169 |
(((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) > Gear^.Angle) and |
6170 |
(Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle))) |
|
6171 |
then |
|
6172 |
begin |
|
6173 |
hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Angle); |
|
6174 |
if hogs.size > 1 then |
|
6175 |
Gear^.Hedgehog:= hogs.ar^[GetRandom(hogs.size)]^.Hedgehog |
|
6176 |
else if hogs.size = 1 then Gear^.Hedgehog:= hogs.ar^[0]^.Hedgehog |
|
6177 |
else Gear^.Hedgehog:= nil; |
|
6178 |
if Gear^.Hedgehog <> nil then Gear^.Timer:= 5000; |
|
6179 |
exit |
|
6180 |
end; |
|
6181 |
||
6182 |
// we have a target. move the creeper. |
|
6183 |
if HHGear <> nil then |
|
6184 |
begin |
|
6185 |
// GOTCHA |
|
6186 |
if ((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) < 50) and |
|
6187 |
(Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) < _50) then |
|
6188 |
begin |
|
6189 |
// hisssssssssss |
|
6190 |
Gear^.State:= Gear^.State or gstTmpFlag; |
|
6191 |
Gear^.Timer:= 1500; |
|
6192 |
exit |
|
6193 |
end; |
|
6194 |
if (Gear^.State and gstMoving <> 0) then |
|
6195 |
begin |
|
6196 |
Gear^.dY:= _0; |
|
6197 |
Gear^.dX:= _0; |
|
6198 |
end |
|
6199 |
else if (GameTicks and $FF = 0) then |
|
6200 |
begin |
|
6201 |
tdX:= HHGear^.X-Gear^.X; |
|
6202 |
dir:= hwSign(tdX); |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6203 |
if TestCollisionX(Gear, dir) = 0 then |
7627 | 6204 |
Gear^.X:= Gear^.X + signAs(_1,tdX); |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6205 |
if TestCollisionXwithXYShift(Gear, signAs(_10,tdX), 0, dir) <> 0 then |
7627 | 6206 |
begin |
6207 |
Gear^.dX:= SignAs(_0_15, tdX); |
|
6208 |
Gear^.dY:= -_0_3; |
|
6209 |
Gear^.State:= Gear^.State or gstMoving |
|
6210 |
end |
|
6211 |
end; |
|
6212 |
end; |
|
6213 |
end; |
|
11468
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:
11391
diff
changeset
|
6214 |
*) |
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6215 |
//////////////////////////////////////////////////////////////////////////////// |
7754 | 6216 |
procedure doStepKnife(Gear: PGear); |
8370 | 6217 |
//var ox, oy: LongInt; |
6218 |
// la: hwFloat; |
|
6219 |
var a: real; |
|
7754 | 6220 |
begin |
6221 |
// Gear is shrunk so it can actually escape the hog without carving into the terrain |
|
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
|
6222 |
if (Gear^.Radius = 4) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 7; |
7872
ab6db9e07c4d
Allow cleavers to be knocked loose by explosions. Probabilities might need tweaking.
nemo
parents:
7864
diff
changeset
|
6223 |
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
|
6224 |
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
|
6225 |
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
|
6226 |
Gear^.Damage:= 0; |
7759 | 6227 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
7754 | 6228 |
if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then |
6229 |
begin |
|
6230 |
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
|
6231 |
Gear^.Radius:= 7; |
7754 | 6232 |
// used for damage and impact calc. needs balancing I think |
11468
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:
11391
diff
changeset
|
6233 |
Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*Gear^.Boom/10000)); |
7754 | 6234 |
doStepFallingGear(Gear); |
6235 |
AllInactive := false; |
|
7864
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6236 |
a:= Gear^.DirAngle; |
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6237 |
CalcRotationDirAngle(Gear); |
667b7583c389
double cleaver rotation speed, also make spin direction dX dependent.
nemo
parents:
7829
diff
changeset
|
6238 |
Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation |
7754 | 6239 |
end |
7759 | 6240 |
else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then |
7754 | 6241 |
begin |
8370 | 6242 |
(*ox:= 0; oy:= 0; |
7758
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6243 |
if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1; |
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6244 |
if TestCollisionXwithGear(Gear, 1) <> 0 then ox:= 1; |
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6245 |
if TestCollisionXwithGear(Gear, -1) <> 0 then ox:= -1; |
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6246 |
if TestCollisionYwithGear(Gear, 1) <> 0 then oy:= 1; |
7754 | 6247 |
if Gear^.Health > 0 then |
6248 |
PlaySound(sndRopeAttach); |
|
8370 | 6249 |
|
7758
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6250 |
la:= _10000; |
7754 | 6251 |
if (ox <> 0) or (oy <> 0) then |
6252 |
la:= CalcSlopeNearGear(Gear, ox, oy); |
|
7758
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6253 |
if la = _10000 then |
7754 | 6254 |
begin |
6255 |
// debug for when we couldn't get an angle |
|
6256 |
//AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); |
|
7758
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6257 |
*) |
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
|
6258 |
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
|
6259 |
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
|
6260 |
((not Gear^.dX.isNegative) and (not Gear^.dY.isNegative)) then Gear^.DirAngle:= Gear^.DirAngle-90; |
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6261 |
// end |
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6262 |
// else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent? |
a225cc45513e
Remove slot overcrowding, disable angle detection which isn't doing what I want.
nemo
parents:
7754
diff
changeset
|
6263 |
// AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle))); |
7754 | 6264 |
Gear^.dX:= _0; |
6265 |
Gear^.dY:= _0; |
|
6266 |
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
|
6267 |
Gear^.Radius:= 16; |
7754 | 6268 |
if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0); |
6269 |
Gear^.Health:= 0; |
|
7759 | 6270 |
Gear^.Timer:= 500; |
9291
15f7bb217b66
Make add/delete consistent (this has bugged me for so long)
nemo
parents:
9289
diff
changeset
|
6271 |
AddCI(Gear) |
7754 | 6272 |
end |
6273 |
else if GameTicks and $3F = 0 then |
|
6274 |
begin |
|
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset
|
6275 |
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
|
6276 |
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
|
6277 |
and (TestCollisionXwithGear(Gear,-1) = 0) |
7754 | 6278 |
and (TestCollisionYwithGear(Gear, 1) = 0) then Gear^.State:= Gear^.State and (not gstCollision) or gstMoving; |
6279 |
end |
|
6280 |
end; |
|
6281 |
(* |
|
6282 |
This didn't end up getting used, but, who knows, might be reasonable for javellin or something |
|
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6283 |
// Make the knife initial angle based on the hog attack angle, or is that too hard? |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6284 |
procedure doStepKnife(Gear: PGear); |
8795 | 6285 |
var t, |
7733 | 6286 |
gx, gy, ga, // gear x,y,angle |
6287 |
lx, ly, la, // land x,y,angle |
|
6288 |
ox, oy, // x,y offset |
|
6289 |
w, h, // wXh of clip area |
|
6290 |
tx, ty // tip position in sprite |
|
6291 |
: LongInt; |
|
6292 |
surf: PSDL_Surface; |
|
6293 |
s: hwFloat; |
|
6294 |
||
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6295 |
begin |
7733 | 6296 |
Gear^.dY := Gear^.dY + cGravity; |
6297 |
if (GameFlags and gfMoreWind) <> 0 then |
|
6298 |
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density; |
|
6299 |
Gear^.X := Gear^.X + Gear^.dX; |
|
6300 |
Gear^.Y := Gear^.Y + Gear^.dY; |
|
6301 |
CheckGearDrowning(Gear); |
|
6302 |
gx:= hwRound(Gear^.X); |
|
6303 |
gy:= hwRound(Gear^.Y); |
|
6304 |
if Gear^.State and gstDrowning <> 0 then exit; |
|
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6305 |
with Gear^ do |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6306 |
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
|
6307 |
if CheckLandValue(gx, gy, lfLandMask) then |
7733 | 6308 |
begin |
8795 | 6309 |
t:= Angle + hwRound((hwAbs(dX)+hwAbs(dY)) * _10); |
7733 | 6310 |
|
6311 |
if t < 0 then inc(t, 4096) |
|
6312 |
else if 4095 < t then dec(t, 4096); |
|
6313 |
Angle:= t; |
|
6314 |
||
6315 |
DirAngle:= Angle / 4096 * 360 |
|
6316 |
end |
|
6317 |
else |
|
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6318 |
begin |
7733 | 6319 |
//This is the set of postions for the knife. |
6320 |
//Using FlipSurface and copyToXY the knife can be written to the LandPixels at 32 positions, and an appropriate line drawn in Land. |
|
6321 |
t:= Angle mod 1024; |
|
6322 |
case t div 128 of |
|
6323 |
0: begin |
|
6324 |
ox:= 2; oy:= 5; |
|
6325 |
w := 25; h:= 5; |
|
6326 |
tx:= 0; ty:= 2 |
|
6327 |
end; |
|
6328 |
1: begin |
|
6329 |
ox:= 2; oy:= 15; |
|
6330 |
w:= 24; h:= 8; |
|
6331 |
tx:= 0; ty:= 7 |
|
6332 |
end; |
|
6333 |
2: begin |
|
6334 |
ox:= 2; oy:= 27; |
|
6335 |
w:= 23; h:= 12; |
|
6336 |
tx:= -12; ty:= -5 |
|
6337 |
end; |
|
6338 |
3: begin |
|
6339 |
ox:= 2; oy:= 43; |
|
6340 |
w:= 21; h:= 15; |
|
6341 |
tx:= 0; ty:= 14 |
|
6342 |
end; |
|
6343 |
4: begin |
|
6344 |
ox:= 29; oy:= 8; |
|
6345 |
w:= 19; h:= 19; |
|
8795 | 6346 |
tx:= 0; ty:= 17 |
7733 | 6347 |
end; |
6348 |
5: begin |
|
6349 |
ox:= 29; oy:= 32; |
|
6350 |
w:= 15; h:= 21; |
|
6351 |
tx:= 0; ty:= 20 |
|
6352 |
end; |
|
6353 |
6: begin |
|
6354 |
ox:= 51; oy:= 3; |
|
6355 |
w:= 11; h:= 23; |
|
8795 | 6356 |
tx:= 0; ty:= 22 |
7733 | 6357 |
end; |
6358 |
7: begin |
|
6359 |
ox:= 51; oy:= 34; |
|
6360 |
w:= 7; h:= 24; |
|
6361 |
tx:= 0; ty:= 23 |
|
6362 |
end |
|
6363 |
end; |
|
8795 | 6364 |
|
7733 | 6365 |
surf:= SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, RMask, GMask, BMask, AMask); |
6366 |
copyToXYFromRect(SpritesData[sprKnife].Surface, surf, ox, oy, w, h, 0, 0); |
|
6367 |
// try to make the knife hit point first |
|
6368 |
lx := 0; |
|
6369 |
ly := 0; |
|
6370 |
if CalcSlopeTangent(Gear, gx, gy, lx, ly, 255) then |
|
6371 |
begin |
|
6372 |
la:= vector2Angle(int2hwFloat(lx), int2hwFloat(ly)); |
|
6373 |
ga:= vector2Angle(dX, dY); |
|
7734 | 6374 |
AddFileLog('la: '+inttostr(la)+' ga: '+inttostr(ga)+' Angle: '+inttostr(Angle)); |
7733 | 6375 |
// change to 0 to 4096 forced by LongWord in Gear |
6376 |
if la < 0 then la:= 4096+la; |
|
6377 |
if ga < 0 then ga:= 4096+ga; |
|
7734 | 6378 |
if ((Angle > ga) and (Angle < la)) or ((Angle < ga) and (Angle > la)) then |
7733 | 6379 |
begin |
6380 |
if Angle >= 2048 then dec(Angle, 2048) |
|
6381 |
else if Angle < 2048 then inc(Angle, 2048) |
|
7734 | 6382 |
end; |
6383 |
AddFileLog('la: '+inttostr(la)+' ga: '+inttostr(ga)+' Angle: '+inttostr(Angle)) |
|
7733 | 6384 |
end; |
6385 |
case Angle div 1024 of |
|
8795 | 6386 |
0: begin |
7733 | 6387 |
flipSurface(surf, true); |
6388 |
flipSurface(surf, true); |
|
7739 | 6389 |
BlitImageAndGenerateCollisionInfo(gx-(w-tx), gy-(h-ty), w, surf) |
7733 | 6390 |
end; |
6391 |
1: begin |
|
6392 |
flipSurface(surf, false); |
|
7734 | 6393 |
BlitImageAndGenerateCollisionInfo(gx-(w-tx), gy-ty, w, surf) |
7733 | 6394 |
end; |
6395 |
2: begin // knife was actually drawn facing this way... |
|
7734 | 6396 |
BlitImageAndGenerateCollisionInfo(gx-tx, gy-ty, w, surf) |
7733 | 6397 |
end; |
6398 |
3: begin |
|
6399 |
flipSurface(surf, true); |
|
7739 | 6400 |
BlitImageAndGenerateCollisionInfo(gx-tx, gy-(h-ty), w, surf) |
7733 | 6401 |
end |
6402 |
end; |
|
6403 |
SDL_FreeSurface(surf); |
|
6404 |
// this needs to calculate actual width/height + land clipping since update texture doesn't. |
|
6405 |
// i.e. this will crash if you fire near sides of map, but until I get the blit right, not going to put real values |
|
6406 |
UpdateLandTexture(hwRound(X)-32, 64, hwRound(Y)-32, 64, true); |
|
7730
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6407 |
DeleteGear(Gear); |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6408 |
exit |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6409 |
end |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6410 |
end; |
2013733f9ca9
A bit more on the knife. Also add missing files to CMakeLists
nemo
parents:
7729
diff
changeset
|
6411 |
end; |
7754 | 6412 |
*) |
9285 | 6413 |
|
6414 |
end. |