author | unc0rr |
Wed, 09 Sep 2009 14:04:06 +0000 | |
changeset 2362 | ef4abaf2d5cc |
parent 2333 | f53a208e9637 |
child 2363 | 5304fa032d9b |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1689 | 3 |
* Copyright (c) 2004-2009 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 |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
19 |
unit uGears; |
|
20 |
interface |
|
351 | 21 |
uses SDLh, uConsts, uFloat; |
4 | 22 |
{$INCLUDE options.inc} |
23 |
const AllInactive: boolean = false; |
|
868 | 24 |
PrvInactive: boolean = false; |
4 | 25 |
|
26 |
type PGear = ^TGear; |
|
1259 | 27 |
TGearStepProcedure = procedure (Gear: PGear); |
28 |
TGear = record |
|
29 |
NextGear, PrevGear: PGear; |
|
30 |
Active: Boolean; |
|
1849 | 31 |
Invulnerable: Boolean; |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
32 |
RenderTimer: Boolean; |
1259 | 33 |
Ammo : PAmmo; |
34 |
State : Longword; |
|
35 |
X : hwFloat; |
|
36 |
Y : hwFloat; |
|
37 |
dX: hwFloat; |
|
38 |
dY: hwFloat; |
|
39 |
Kind: TGearType; |
|
40 |
Pos: Longword; |
|
41 |
doStep: TGearStepProcedure; |
|
42 |
Radius: LongInt; |
|
43 |
Angle, Power : Longword; |
|
44 |
DirAngle: real; |
|
45 |
Timer : LongWord; |
|
46 |
Elasticity: hwFloat; |
|
47 |
Friction : hwFloat; |
|
48 |
Message, MsgParam : Longword; |
|
49 |
Hedgehog: pointer; |
|
2135
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
50 |
Health, Damage, Karma: LongInt; |
1259 | 51 |
CollisionIndex: LongInt; |
52 |
Tag: LongInt; |
|
53 |
Tex: PTexture; |
|
54 |
Z: Longword; |
|
55 |
IntersectGear: PGear; |
|
56 |
TriggerId: Longword; |
|
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2031
diff
changeset
|
57 |
uid: Longword |
1259 | 58 |
end; |
4 | 59 |
|
371 | 60 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
4 | 61 |
procedure ProcessGears; |
1849 | 62 |
procedure ResetUtilities; |
2017 | 63 |
procedure ApplyDamage(Gear: PGear; Damage: Longword); |
4 | 64 |
procedure SetAllToActive; |
65 |
procedure SetAllHHToActive; |
|
956 | 66 |
procedure DrawGears; |
4 | 67 |
procedure FreeGearsList; |
10 | 68 |
procedure AddMiscGears; |
4 | 69 |
procedure AssignHHCoords; |
294 | 70 |
procedure InsertGearToList(Gear: PGear); |
71 |
procedure RemoveGearFromList(Gear: PGear); |
|
4 | 72 |
|
73 |
var CurAmmoGear: PGear = nil; |
|
68 | 74 |
GearsList: PGear = nil; |
307 | 75 |
KilledHHs: Longword = 0; |
2017 | 76 |
SuddenDeathDmg: Boolean = false; |
77 |
SpeechType: Longword = 1; |
|
78 |
SpeechText: shortstring; |
|
70 | 79 |
|
4 | 80 |
implementation |
81 | 81 |
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, |
1906 | 82 |
uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, |
2152 | 83 |
{$IFDEF GLES11} |
1906 | 84 |
gles11, |
85 |
{$ELSE} |
|
86 |
GL, |
|
87 |
{$ENDIF} |
|
1259 | 88 |
uStats, uVisualGears; |
789 | 89 |
|
1207
ceaab010269e
Some adjusting... it still doesn't solve problem fully
unc0rr
parents:
1200
diff
changeset
|
90 |
const MAXROPEPOINTS = 384; |
68 | 91 |
var RopePoints: record |
4 | 92 |
Count: Longword; |
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
775
diff
changeset
|
93 |
HookAngle: GLfloat; |
789 | 94 |
ar: array[0..MAXROPEPOINTS] of record |
351 | 95 |
X, Y: hwFloat; |
96 |
dLen: hwFloat; |
|
4 | 97 |
b: boolean; |
98 |
end; |
|
2362 | 99 |
rounded: array[0..MAXROPEPOINTS] of TVertex2i; |
100 |
end; |
|
4 | 101 |
|
1515 | 102 |
procedure DeleteGear(Gear: PGear); forward; |
371 | 103 |
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
104 |
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
|
1433 | 105 |
//procedure AmmoFlameWork(Ammo: PGear); forward; |
371 | 106 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward; |
15 | 107 |
procedure SpawnBoxOfSmth; forward; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
24
diff
changeset
|
108 |
procedure AfterAttack; forward; |
1515 | 109 |
procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); forward; |
302 | 110 |
procedure HedgehogStep(Gear: PGear); forward; |
1528 | 111 |
procedure doStepHedgehogMoving(Gear: PGear); forward; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
112 |
procedure HedgehogChAngle(Gear: PGear); forward; |
506 | 113 |
procedure ShotgunShot(Gear: PGear); forward; |
1689 | 114 |
procedure PickUp(HH, Gear: PGear); forward; |
1964 | 115 |
procedure HHSetWeapon(Gear: PGear); forward; |
116 |
||
4 | 117 |
|
118 |
{$INCLUDE GSHandlers.inc} |
|
119 |
{$INCLUDE HHHandlers.inc} |
|
120 |
||
121 |
const doStepHandlers: array[TGearType] of TGearStepProcedure = ( |
|
1259 | 122 |
@doStepBomb, |
123 |
@doStepHedgehog, |
|
124 |
@doStepGrenade, |
|
125 |
@doStepHealthTag, |
|
126 |
@doStepGrave, |
|
127 |
@doStepUFO, |
|
128 |
@doStepShotgunShot, |
|
129 |
@doStepPickHammer, |
|
130 |
@doStepRope, |
|
131 |
@doStepSmokeTrace, |
|
132 |
@doStepExplosion, |
|
133 |
@doStepMine, |
|
134 |
@doStepCase, |
|
135 |
@doStepDEagleShot, |
|
136 |
@doStepDynamite, |
|
137 |
@doStepBomb, |
|
138 |
@doStepCluster, |
|
139 |
@doStepShover, |
|
140 |
@doStepFlame, |
|
141 |
@doStepFirePunch, |
|
142 |
@doStepActionTimer, |
|
143 |
@doStepActionTimer, |
|
144 |
@doStepActionTimer, |
|
145 |
@doStepParachute, |
|
146 |
@doStepAirAttack, |
|
147 |
@doStepAirBomb, |
|
148 |
@doStepBlowTorch, |
|
149 |
@doStepGirder, |
|
150 |
@doStepTeleport, |
|
151 |
@doStepSwitcher, |
|
152 |
@doStepCase, |
|
153 |
@doStepMortar, |
|
154 |
@doStepWhip, |
|
155 |
@doStepKamikaze, |
|
156 |
@doStepCake, |
|
1261 | 157 |
@doStepSeduction, |
1279 | 158 |
@doStepWatermelon, |
1263 | 159 |
@doStepCluster, |
160 |
@doStepBomb, |
|
1298 | 161 |
@doStepSmokeTrace, |
1573 | 162 |
@doStepWaterUp, |
1601 | 163 |
@doStepDrill, |
164 |
@doStepBallgun, |
|
1689 | 165 |
@doStepBomb, |
2017 | 166 |
@doStepRCPlane, |
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:
2168
diff
changeset
|
167 |
@doStepSniperRifleShot, |
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:
2168
diff
changeset
|
168 |
@doStepJetpack |
1259 | 169 |
); |
4 | 170 |
|
294 | 171 |
procedure InsertGearToList(Gear: PGear); |
803 | 172 |
var tmp, ptmp: PGear; |
294 | 173 |
begin |
174 |
if GearsList = nil then |
|
1505 | 175 |
GearsList:= Gear |
176 |
else begin |
|
177 |
tmp:= GearsList; |
|
178 |
ptmp:= GearsList; |
|
179 |
while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do |
|
180 |
begin |
|
181 |
ptmp:= tmp; |
|
182 |
tmp:= tmp^.NextGear |
|
183 |
end; |
|
294 | 184 |
|
1505 | 185 |
if ptmp <> nil then |
186 |
begin |
|
187 |
Gear^.NextGear:= ptmp^.NextGear; |
|
188 |
Gear^.PrevGear:= ptmp; |
|
189 |
if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear; |
|
190 |
ptmp^.NextGear:= Gear |
|
191 |
end |
|
192 |
else GearsList:= Gear |
|
193 |
end |
|
294 | 194 |
end; |
195 |
||
196 |
procedure RemoveGearFromList(Gear: PGear); |
|
197 |
begin |
|
351 | 198 |
if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
1505 | 199 |
if Gear^.PrevGear <> nil then |
200 |
Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
201 |
else |
|
202 |
GearsList:= Gear^.NextGear |
|
294 | 203 |
end; |
204 |
||
371 | 205 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
79 | 206 |
const Counter: Longword = 0; |
351 | 207 |
var Result: PGear; |
4 | 208 |
begin |
79 | 209 |
inc(Counter); |
1495 | 210 |
{$IFDEF DEBUGFILE} |
1503 | 211 |
AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |
1495 | 212 |
{$ENDIF} |
213 |
||
4 | 214 |
New(Result); |
215 |
FillChar(Result^, sizeof(TGear), 0); |
|
498 | 216 |
Result^.X:= int2hwFloat(X); |
217 |
Result^.Y:= int2hwFloat(Y); |
|
351 | 218 |
Result^.Kind := Kind; |
219 |
Result^.State:= State; |
|
220 |
Result^.Active:= true; |
|
221 |
Result^.dX:= dX; |
|
222 |
Result^.dY:= dY; |
|
223 |
Result^.doStep:= doStepHandlers[Kind]; |
|
511 | 224 |
Result^.CollisionIndex:= -1; |
351 | 225 |
Result^.Timer:= Timer; |
1270 | 226 |
Result^.Z:= cUsualZ; |
1503 | 227 |
Result^.uid:= Counter; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
503
diff
changeset
|
228 |
|
4 | 229 |
if CurrentTeam <> nil then |
1505 | 230 |
begin |
231 |
Result^.Hedgehog:= CurrentHedgehog; |
|
232 |
Result^.IntersectGear:= CurrentHedgehog^.Gear |
|
233 |
end; |
|
802
ed5450a89b96
Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
789
diff
changeset
|
234 |
|
4 | 235 |
case Kind of |
915 | 236 |
gtAmmo_Bomb, |
237 |
gtClusterBomb: begin |
|
351 | 238 |
Result^.Radius:= 4; |
239 |
Result^.Elasticity:= _0_6; |
|
997 | 240 |
Result^.Friction:= _0_96; |
2302 | 241 |
Result^.RenderTimer:= true; |
242 |
if Result^.Timer = 0 then Result^.Timer:= 3000 |
|
4 | 243 |
end; |
1261 | 244 |
gtWatermelon: begin |
245 |
Result^.Radius:= 4; |
|
246 |
Result^.Elasticity:= _0_8; |
|
247 |
Result^.Friction:= _0_995; |
|
2302 | 248 |
Result^.RenderTimer:= true; |
249 |
if Result^.Timer = 0 then Result^.Timer:= 3000 |
|
1261 | 250 |
end; |
4 | 251 |
gtHedgehog: begin |
351 | 252 |
Result^.Radius:= cHHRadius; |
253 |
Result^.Elasticity:= _0_35; |
|
254 |
Result^.Friction:= _0_999; |
|
255 |
Result^.Angle:= cMaxAngle div 2; |
|
256 |
Result^.Z:= cHHZ; |
|
4 | 257 |
end; |
2317 | 258 |
gtAmmo_Grenade: begin // bazooka |
351 | 259 |
Result^.Radius:= 4; |
4 | 260 |
end; |
261 |
gtHealthTag: begin |
|
351 | 262 |
Result^.Timer:= 1500; |
2017 | 263 |
Result^.Z:= 2002; |
264 |
end; |
|
4 | 265 |
gtGrave: begin |
351 | 266 |
Result^.Radius:= 10; |
267 |
Result^.Elasticity:= _0_6; |
|
4 | 268 |
end; |
269 |
gtUFO: begin |
|
351 | 270 |
Result^.Radius:= 5; |
271 |
Result^.Timer:= 500; |
|
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
272 |
Result^.RenderTimer:= true; |
351 | 273 |
Result^.Elasticity:= _0_9 |
4 | 274 |
end; |
275 |
gtShotgunShot: begin |
|
351 | 276 |
Result^.Timer:= 900; |
277 |
Result^.Radius:= 2 |
|
4 | 278 |
end; |
279 |
gtPickHammer: begin |
|
351 | 280 |
Result^.Radius:= 10; |
281 |
Result^.Timer:= 4000 |
|
4 | 282 |
end; |
1263 | 283 |
gtSmokeTrace, |
284 |
gtEvilTrace: begin |
|
498 | 285 |
Result^.X:= Result^.X - _16; |
286 |
Result^.Y:= Result^.Y - _16; |
|
1270 | 287 |
Result^.State:= 8; |
288 |
Result^.Z:= cSmokeZ |
|
4 | 289 |
end; |
290 |
gtRope: begin |
|
351 | 291 |
Result^.Radius:= 3; |
498 | 292 |
Result^.Friction:= _450; |
4 | 293 |
RopePoints.Count:= 0; |
294 |
end; |
|
9 | 295 |
gtExplosion: begin |
1012 | 296 |
Result^.X:= Result^.X; |
297 |
Result^.Y:= Result^.Y; |
|
9 | 298 |
end; |
10 | 299 |
gtMine: begin |
503 | 300 |
Result^.State:= Result^.State or gstMoving; |
915 | 301 |
Result^.Radius:= 2; |
351 | 302 |
Result^.Elasticity:= _0_55; |
303 |
Result^.Friction:= _0_995; |
|
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2028
diff
changeset
|
304 |
if cMinesTime < 0 then |
2121 | 305 |
Result^.Timer:= getrandom(4)*1000 |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2028
diff
changeset
|
306 |
else |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2028
diff
changeset
|
307 |
Result^.Timer:= cMinesTime*1; |
10 | 308 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
309 |
gtCase: begin |
351 | 310 |
Result^.Radius:= 16; |
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
311 |
Result^.Elasticity:= _0_3 |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
10
diff
changeset
|
312 |
end; |
37 | 313 |
gtDEagleShot: begin |
351 | 314 |
Result^.Radius:= 1; |
315 |
Result^.Health:= 50 |
|
37 | 316 |
end; |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
317 |
gtSniperRifleShot: begin |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
318 |
Result^.Radius:= 1; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
319 |
Result^.Health:= 50 |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
320 |
end; |
39 | 321 |
gtDynamite: begin |
351 | 322 |
Result^.Radius:= 3; |
323 |
Result^.Elasticity:= _0_55; |
|
324 |
Result^.Friction:= _0_03; |
|
325 |
Result^.Timer:= 5000; |
|
39 | 326 |
end; |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
327 |
gtCluster: begin |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
328 |
Result^.Radius:= 2; |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
329 |
Result^.RenderTimer:= true |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
330 |
end; |
878 | 331 |
gtShover: Result^.Radius:= 20; |
79 | 332 |
gtFlame: begin |
1586 | 333 |
Result^.Tag:= Counter mod 32; |
351 | 334 |
Result^.Radius:= 1; |
1586 | 335 |
Result^.Health:= 5; |
1555 | 336 |
if (Result^.dY.QWordValue = 0) and (Result^.dX.QWordValue = 0) then |
337 |
begin |
|
338 |
Result^.dY:= (getrandom - _0_8) * _0_03; |
|
339 |
Result^.dX:= (getrandom - _0_5) * _0_4 |
|
340 |
end |
|
79 | 341 |
end; |
82 | 342 |
gtFirePunch: begin |
351 | 343 |
Result^.Radius:= 15; |
344 |
Result^.Tag:= Y |
|
82 | 345 |
end; |
302 | 346 |
gtAirBomb: begin |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
347 |
Result^.Radius:= 5; |
302 | 348 |
end; |
349 |
gtBlowTorch: begin |
|
511 | 350 |
Result^.Radius:= cHHRadius + cBlowTorchC; |
2208
7d1a084d11ab
disable timers on a few silly items, trying out a timer on cake
nemo
parents:
2204
diff
changeset
|
351 |
Result^.Timer:= 7500 |
302 | 352 |
end; |
540 | 353 |
gtSwitcher: begin |
354 |
Result^.Z:= cCurrHHZ |
|
355 |
end; |
|
593 | 356 |
gtTarget: begin |
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
357 |
Result^.Radius:= 16; |
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
595
diff
changeset
|
358 |
Result^.Elasticity:= _0_3 |
593 | 359 |
end; |
924 | 360 |
gtMortar: begin |
994 | 361 |
Result^.Radius:= 4; |
924 | 362 |
Result^.Elasticity:= _0_2; |
363 |
Result^.Friction:= _0_08 |
|
364 |
end; |
|
925 | 365 |
gtWhip: Result^.Radius:= 20; |
984 | 366 |
gtKamikaze: begin |
367 |
Result^.Health:= 2048; |
|
368 |
Result^.Radius:= 20 |
|
369 |
end; |
|
1089 | 370 |
gtCake: begin |
1261 | 371 |
Result^.Health:= 2048; |
1103 | 372 |
Result^.Radius:= 7; |
1109 | 373 |
Result^.Z:= cOnHHZ; |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
374 |
Result^.RenderTimer:= true; |
1089 | 375 |
if hwSign(dX) > 0 then Result^.Angle:= 1 else Result^.Angle:= 3 |
376 |
end; |
|
1263 | 377 |
gtHellishBomb: begin |
378 |
Result^.Radius:= 4; |
|
379 |
Result^.Elasticity:= _0_5; |
|
380 |
Result^.Friction:= _0_96; |
|
2302 | 381 |
Result^.RenderTimer:= true; |
382 |
Result^.Timer:= 5000 |
|
1263 | 383 |
end; |
1573 | 384 |
gtDrill: begin |
385 |
Result^.Timer:= 5000; |
|
2208
7d1a084d11ab
disable timers on a few silly items, trying out a timer on cake
nemo
parents:
2204
diff
changeset
|
386 |
Result^.Radius:= 4 |
1573 | 387 |
end; |
1601 | 388 |
gtBall: begin |
389 |
Result^.Radius:= 5; |
|
390 |
Result^.Tag:= random(8); |
|
391 |
Result^.Timer:= 5000; |
|
392 |
Result^.Elasticity:= _0_7; |
|
393 |
Result^.Friction:= _0_995; |
|
394 |
end; |
|
395 |
gtBallgun: begin |
|
396 |
Result^.Timer:= 5001; |
|
397 |
end; |
|
1689 | 398 |
gtRCPlane: begin |
399 |
Result^.Timer:= 15000; |
|
400 |
Result^.Health:= 3; |
|
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
401 |
Result^.Radius:= 8 |
1689 | 402 |
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:
2168
diff
changeset
|
403 |
gtJetpack: 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:
2168
diff
changeset
|
404 |
Result^.Health:= 2000; |
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:
2168
diff
changeset
|
405 |
end; |
4 | 406 |
end; |
351 | 407 |
InsertGearToList(Result); |
408 |
AddGear:= Result |
|
4 | 409 |
end; |
410 |
||
1515 | 411 |
procedure DeleteGear(Gear: PGear); |
48 | 412 |
var team: PTeam; |
1515 | 413 |
t: Longword; |
4 | 414 |
begin |
503 | 415 |
DeleteCI(Gear); |
762 | 416 |
|
417 |
if Gear^.Tex <> nil then |
|
1495 | 418 |
begin |
419 |
FreeTexture(Gear^.Tex); |
|
420 |
Gear^.Tex:= nil |
|
421 |
end; |
|
762 | 422 |
|
351 | 423 |
if Gear^.Kind = gtHedgehog then |
2079 | 424 |
if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |
1495 | 425 |
begin |
426 |
Gear^.Message:= gm_Destroy; |
|
427 |
CurAmmoGear^.Message:= gm_Destroy; |
|
428 |
exit |
|
429 |
end |
|
430 |
else |
|
431 |
begin |
|
2076
aa3263e57b8f
increase # of mines to 50, limit max depth of drowning damage tag
nemo
parents:
2074
diff
changeset
|
432 |
if (hwRound(Gear^.Y) >= cWaterLine) then |
1495 | 433 |
begin |
434 |
t:= max(Gear^.Damage, Gear^.Health); |
|
435 |
Gear^.Damage:= t; |
|
2076
aa3263e57b8f
increase # of mines to 50, limit max depth of drowning damage tag
nemo
parents:
2074
diff
changeset
|
436 |
AddGear(hwRound(Gear^.X), min(hwRound(Gear^.Y),cWaterLine+cVisibleWater+32), gtHealthTag, t, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
1495 | 437 |
uStats.HedgehogDamaged(Gear) |
438 |
end; |
|
1515 | 439 |
|
1495 | 440 |
team:= PHedgehog(Gear^.Hedgehog)^.Team; |
441 |
if CurrentHedgehog^.Gear = Gear then |
|
442 |
FreeActionsList; // to avoid ThinkThread on drawned gear |
|
1515 | 443 |
|
1495 | 444 |
PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
445 |
inc(KilledHHs); |
|
1515 | 446 |
RecountTeamHealth(team) |
1495 | 447 |
end; |
448 |
{$IFDEF DEBUGFILE} |
|
1503 | 449 |
with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |
1495 | 450 |
{$ENDIF} |
451 |
||
595
5ee863f2f568
Triggers PoC: targets are spawned right after the previous damaged
unc0rr
parents:
593
diff
changeset
|
452 |
if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId); |
82 | 453 |
if CurAmmoGear = Gear then CurAmmoGear:= nil; |
4 | 454 |
if FollowGear = Gear then FollowGear:= nil; |
294 | 455 |
RemoveGearFromList(Gear); |
1515 | 456 |
Dispose(Gear) |
4 | 457 |
end; |
458 |
||
459 |
function CheckNoDamage: boolean; // returns TRUE in case of no damaged hhs |
|
460 |
var Gear: PGear; |
|
1849 | 461 |
dmg: LongInt; |
4 | 462 |
begin |
351 | 463 |
CheckNoDamage:= true; |
4 | 464 |
Gear:= GearsList; |
465 |
while Gear <> nil do |
|
867 | 466 |
begin |
467 |
if Gear^.Kind = gtHedgehog then |
|
1861 | 468 |
begin |
2135
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
469 |
if (not isInMultiShoot) then inc(Gear^.Damage, Gear^.Karma); |
1849 | 470 |
if (Gear^.Damage <> 0) and |
471 |
(not Gear^.Invulnerable) then |
|
1861 | 472 |
begin |
473 |
CheckNoDamage:= false; |
|
474 |
uStats.HedgehogDamaged(Gear); |
|
475 |
dmg:= Gear^.Damage; |
|
476 |
if Gear^.Health < dmg then |
|
477 |
Gear^.Health:= 0 |
|
478 |
else |
|
479 |
dec(Gear^.Health, dmg); |
|
351 | 480 |
|
2017 | 481 |
if (PHedgehog(Gear^.Hedgehog)^.Team = CurrentTeam) and |
2135
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
482 |
(Gear^.Damage <> Gear^.Karma) and |
2017 | 483 |
not SuddenDeathDmg then |
484 |
Gear^.State:= Gear^.State or gstLoser; |
|
485 |
||
1861 | 486 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) - cHHRadius - 12, |
487 |
gtHealthTag, dmg, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
|
867 | 488 |
|
1861 | 489 |
RenderHealth(PHedgehog(Gear^.Hedgehog)^); |
490 |
RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team); |
|
1505 | 491 |
|
1861 | 492 |
end; |
2135
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
493 |
if (not isInMultiShoot) then Gear^.Karma:= 0; |
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
494 |
Gear^.Damage:= 0 |
1861 | 495 |
end; |
867 | 496 |
Gear:= Gear^.NextGear |
497 |
end; |
|
2017 | 498 |
SuddenDeathDmg:= false; |
4 | 499 |
end; |
500 |
||
1054 | 501 |
procedure HealthMachine; |
502 |
var Gear: PGear; |
|
503 |
begin |
|
504 |
Gear:= GearsList; |
|
505 |
||
506 |
while Gear <> nil do |
|
507 |
begin |
|
508 |
if Gear^.Kind = gtHedgehog then |
|
509 |
Gear^.Damage:= min(cHealthDecrease, Gear^.Health - 1); |
|
510 |
||
511 |
Gear:= Gear^.NextGear |
|
512 |
end; |
|
513 |
end; |
|
514 |
||
4 | 515 |
procedure ProcessGears; |
614 | 516 |
const delay: LongWord = 0; |
1797 | 517 |
step: (stDelay, stChDmg, stSweep, stTurnReact, |
1495 | 518 |
stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
519 |
stSpawn, stNTurn) = stDelay; |
|
1054 | 520 |
|
4 | 521 |
var Gear, t: PGear; |
522 |
begin |
|
868 | 523 |
PrvInactive:= AllInactive; |
4 | 524 |
AllInactive:= true; |
1495 | 525 |
|
4 | 526 |
t:= GearsList; |
1054 | 527 |
while t <> nil do |
1352
405ad07cf875
Add more support for handling disconnects while playing (not fully tested)
unc0rr
parents:
1346
diff
changeset
|
528 |
begin |
405ad07cf875
Add more support for handling disconnects while playing (not fully tested)
unc0rr
parents:
1346
diff
changeset
|
529 |
Gear:= t; |
405ad07cf875
Add more support for handling disconnects while playing (not fully tested)
unc0rr
parents:
1346
diff
changeset
|
530 |
t:= Gear^.NextGear; |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
531 |
if Gear^.Active then |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
532 |
begin |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
533 |
if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
534 |
begin |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
535 |
if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
536 |
Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), $FFFFFFFF, fntSmall); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
537 |
end; |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
538 |
Gear^.doStep(Gear); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
539 |
end |
1352
405ad07cf875
Add more support for handling disconnects while playing (not fully tested)
unc0rr
parents:
1346
diff
changeset
|
540 |
end; |
89 | 541 |
|
4 | 542 |
if AllInactive then |
1343 | 543 |
case step of |
544 |
stDelay: begin |
|
545 |
if delay = 0 then |
|
546 |
delay:= cInactDelay |
|
547 |
else |
|
548 |
dec(delay); |
|
614 | 549 |
|
1343 | 550 |
if delay = 0 then |
551 |
inc(step) |
|
552 |
end; |
|
1797 | 553 |
stChDmg: if CheckNoDamage then inc(step) else step:= stDelay; |
554 |
stSweep: if SweepDirty then |
|
1792 | 555 |
begin |
1918 | 556 |
SetAllToActive; |
1792 | 557 |
step:= stChDmg |
1797 | 558 |
end else inc(step); |
1343 | 559 |
stTurnReact: begin |
560 |
if (not bBetweenTurns) and (not isInMultiShoot) then |
|
561 |
begin |
|
562 |
uStats.TurnReaction; |
|
563 |
inc(step) |
|
564 |
end else |
|
565 |
inc(step, 2); |
|
566 |
end; |
|
567 |
stAfterDelay: begin |
|
568 |
if delay = 0 then |
|
569 |
delay:= cInactDelay |
|
570 |
else |
|
571 |
dec(delay); |
|
815 | 572 |
|
1343 | 573 |
if delay = 0 then |
574 |
inc(step) |
|
575 |
end; |
|
576 |
stChWin: begin |
|
577 |
CheckForWin; |
|
578 |
inc(step) |
|
579 |
end; |
|
580 |
stWater: if (not bBetweenTurns) and (not isInMultiShoot) then |
|
581 |
begin |
|
1782
e7589e37a6d6
Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents:
1781
diff
changeset
|
582 |
if TotalRounds = cSuddenDTurns + 2 then bWaterRising:= true; |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
583 |
|
1343 | 584 |
if bWaterRising then |
585 |
AddGear(0, 0, gtWaterUp, 0, _0, _0, 0); |
|
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
586 |
|
1343 | 587 |
inc(step) |
588 |
end else inc(step); |
|
589 |
stChWin2: begin |
|
590 |
CheckForWin; |
|
591 |
inc(step) |
|
592 |
end; |
|
593 |
stHealth: begin |
|
1782
e7589e37a6d6
Options for bonus box probability tuning and number of turn until sudden death
unc0rr
parents:
1781
diff
changeset
|
594 |
if (TotalRounds = cSuddenDTurns) and (cHealthDecrease = 0) then |
1343 | 595 |
begin |
596 |
cHealthDecrease:= 5; |
|
2217 | 597 |
AddCaption(trmsg[sidSuddenDeath], $FFFFFF, capgrpGameState); |
598 |
playSound(sndSuddenDeath, false, nil); |
|
1343 | 599 |
end; |
1055
9af540b23409
Water rises after 25 mins of round, health is decreased after 20 mins
unc0rr
parents:
1054
diff
changeset
|
600 |
|
1343 | 601 |
if (cHealthDecrease = 0) |
602 |
or bBetweenTurns |
|
603 |
or isInMultiShoot |
|
604 |
or (TotalRounds = 0) then inc(step) |
|
605 |
else begin |
|
606 |
bBetweenTurns:= true; |
|
607 |
HealthMachine; |
|
2017 | 608 |
SuddenDeathDmg:= true; |
1343 | 609 |
step:= stChDmg |
610 |
end |
|
611 |
end; |
|
612 |
stSpawn: begin |
|
613 |
if not isInMultiShoot then SpawnBoxOfSmth; |
|
614 |
inc(step) |
|
615 |
end; |
|
616 |
stNTurn: begin |
|
617 |
if isInMultiShoot then isInMultiShoot:= false |
|
618 |
else begin |
|
2289 | 619 |
ResetUtilities; |
620 |
||
621 |
FreeActionsList; // could send -left, -right and similar commands, so should be called before /nextturn |
|
622 |
||
1343 | 623 |
ParseCommand('/nextturn', true); |
624 |
SwitchHedgehog; |
|
1298 | 625 |
|
2045
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
626 |
inc(step); // FIXME wtf is that, it overflows step, and does nothing |
1298 | 627 |
|
1343 | 628 |
AfterSwitchHedgehog; |
629 |
bBetweenTurns:= false |
|
630 |
end; |
|
631 |
step:= Low(step) |
|
632 |
end; |
|
633 |
end; |
|
15 | 634 |
|
4 | 635 |
if TurnTimeLeft > 0 then |
870 | 636 |
if CurrentHedgehog^.Gear <> nil then |
637 |
if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0) |
|
638 |
and not isInMultiShoot then |
|
639 |
begin |
|
640 |
if (TurnTimeLeft = 5000) |
|
641 |
and (CurrentHedgehog^.Gear <> nil) |
|
1669 | 642 |
and ((CurrentHedgehog^.Gear^.State and gstAttacked) = 0) then |
643 |
PlaySound(sndHurry, false, CurrentTeam^.voicepack); |
|
870 | 644 |
dec(TurnTimeLeft) |
645 |
end; |
|
351 | 646 |
|
2134 | 647 |
if ((GameTicks and $FFFF) = $FFFF) then |
917 | 648 |
begin |
2134 | 649 |
if (not CurrentTeam^.ExtDriven) then |
650 |
SendIPCTimeInc; |
|
651 |
||
652 |
if (not CurrentTeam^.ExtDriven) or CurrentTeam^.hasGone then |
|
653 |
inc(hiTicks) // we do not recieve a message for this |
|
917 | 654 |
end; |
656
6d6d9d7b1054
Fix network game bug caused by recent protocol changes
unc0rr
parents:
651
diff
changeset
|
655 |
|
515 | 656 |
inc(GameTicks) |
4 | 657 |
end; |
658 |
||
1854 | 659 |
//Purpose, to reset all transient attributes toggled by a utility. |
660 |
//If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here. |
|
1849 | 661 |
procedure ResetUtilities; |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
662 |
var i: LongInt; |
1849 | 663 |
begin |
2221 | 664 |
SpeechText:= ''; // in case it has not been consumed |
2017 | 665 |
|
1895 | 666 |
if (GameFlags and gfLowGravity) = 0 then |
667 |
cGravity:= cMaxWindSpeed; |
|
668 |
||
2017 | 669 |
if (GameFlags and gfVampiric) = 0 then |
670 |
cVampiric:= false; |
|
671 |
||
1849 | 672 |
cDamageModifier:= _1; |
1895 | 673 |
|
674 |
if (GameFlags and gfLaserSight) = 0 then |
|
675 |
cLaserSighting:= false; |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
676 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
677 |
if (GameFlags and gfArtillery) = 0 then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
678 |
cArtillery:= false; |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
679 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
680 |
// have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
681 |
if (CurrentTeam <> nil) then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
682 |
with CurrentTeam^ do |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
683 |
for i:= 0 to cMaxHHIndex do |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
684 |
with Hedgehogs[i] do |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
685 |
begin |
2045
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
686 |
if (SpeechGear <> nil) then |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
687 |
begin |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
688 |
DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
689 |
SpeechGear:= nil |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
690 |
end; |
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
691 |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
692 |
if (Gear <> nil) then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
693 |
if (GameFlags and gfInvulnerable) = 0 then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
694 |
Gear^.Invulnerable:= false; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
695 |
end; |
1849 | 696 |
end; |
2045
b0588498bc3a
- Fix network (my crappy fault, triggered by nemo's patch)
unc0rr
parents:
2042
diff
changeset
|
697 |
|
2017 | 698 |
procedure ApplyDamage(Gear: PGear; Damage: Longword); |
699 |
var s: shortstring; |
|
2067
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
700 |
vampDmg, tmpDmg: Longword; |
2017 | 701 |
begin |
2074 | 702 |
if (Gear^.Kind = gtHedgehog) and (Damage>=1) then |
2017 | 703 |
begin |
704 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
|
2067
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
705 |
tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
706 |
if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then |
2017 | 707 |
begin |
708 |
if cVampiric then |
|
709 |
begin |
|
2067
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
710 |
vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
711 |
if vampDmg >= 1 then |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
712 |
begin |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
713 |
// was considering pulsing on attack, Tiy thinks it should be permanent while in play |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
714 |
//CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric; |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
715 |
inc(CurrentHedgehog^.Gear^.Health,vampDmg); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
716 |
str(vampDmg, s); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
717 |
s:= '+' + s; |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
718 |
AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
719 |
RenderHealth(CurrentHedgehog^); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
720 |
RecountTeamHealth(CurrentHedgehog^.Team); |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
721 |
end |
2017 | 722 |
end; |
723 |
if ((GameFlags and gfKarma) <> 0) and |
|
724 |
((GameFlags and gfInvulnerable) = 0) and |
|
725 |
not CurrentHedgehog^.Gear^.Invulnerable then |
|
726 |
begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid |
|
2135
0b7972dfad01
Push karma application to end of round - should avoid problems w/ plane and kamikaze
nemo
parents:
2134
diff
changeset
|
727 |
inc(CurrentHedgehog^.Gear^.Karma, tmpDmg); |
2067
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
728 |
AddGear(hwRound(CurrentHedgehog^.Gear^.X), |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
729 |
hwRound(CurrentHedgehog^.Gear^.Y), |
7524a783bd8c
use separate variable for vamp/karma calcs, move karma damage tag from point of damage origin to originating hedgehog at unc0rr's request
nemo
parents:
2057
diff
changeset
|
730 |
gtHealthTag, tmpDmg, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; |
2017 | 731 |
end; |
732 |
end; |
|
733 |
end; |
|
2057
cf0d84479251
Prevent gaining more health than hedgehog actually has
nemo
parents:
2053
diff
changeset
|
734 |
inc(Gear^.Damage, Damage); |
2017 | 735 |
end; |
1849 | 736 |
|
4 | 737 |
procedure SetAllToActive; |
738 |
var t: PGear; |
|
739 |
begin |
|
740 |
AllInactive:= false; |
|
741 |
t:= GearsList; |
|
351 | 742 |
while t <> nil do |
1505 | 743 |
begin |
744 |
t^.Active:= true; |
|
745 |
t:= t^.NextGear |
|
746 |
end |
|
4 | 747 |
end; |
748 |
||
749 |
procedure SetAllHHToActive; |
|
750 |
var t: PGear; |
|
751 |
begin |
|
752 |
AllInactive:= false; |
|
753 |
t:= GearsList; |
|
351 | 754 |
while t <> nil do |
1505 | 755 |
begin |
756 |
if t^.Kind = gtHedgehog then t^.Active:= true; |
|
757 |
t:= t^.NextGear |
|
758 |
end |
|
4 | 759 |
end; |
760 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
761 |
procedure DrawHH(Gear: PGear); |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
762 |
var i, t: LongInt; |
822 | 763 |
amt: TAmmoType; |
2020 | 764 |
hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt; // hedgehog, crosshair, temp, sprite, direction |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
765 |
lx, ly, dx, dy, ax, ay, aAngle, dAngle: real; // laser, change |
1253 | 766 |
defaultPos, HatVisible: boolean; |
1906 | 767 |
VertexBuffer: array [0..1] of TVertex2f; |
292 | 768 |
begin |
2020 | 769 |
m:= 1; |
2137 | 770 |
if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1; |
868 | 771 |
if (Gear^.State and gstHHDeath) <> 0 then |
772 |
begin |
|
773 |
DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos); |
|
774 |
exit |
|
775 |
end; |
|
1002 | 776 |
|
824 | 777 |
defaultPos:= true; |
1253 | 778 |
HatVisible:= false; |
847 | 779 |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
780 |
sx:= hwRound(Gear^.X) + 1 + WorldDx; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
781 |
sy:= hwRound(Gear^.Y) - 3 + WorldDy; |
1002 | 782 |
if (Gear^.State and gstDrowning) <> 0 then |
783 |
begin |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
784 |
DrawHedgehog(sx, sy, |
1002 | 785 |
hwSign(Gear^.dX), |
786 |
1, |
|
787 |
7, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
788 |
0); |
1002 | 789 |
defaultPos:= false |
790 |
end else |
|
1892 | 791 |
if ((Gear^.State and gstWinner) <> 0) and |
792 |
((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then |
|
1011 | 793 |
begin |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
794 |
DrawHedgehog(sx, sy, |
1011 | 795 |
hwSign(Gear^.dX), |
796 |
2, |
|
797 |
0, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
798 |
0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
799 |
defaultPos:= false |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
800 |
end else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
801 |
if (Gear^.State and gstLoser) <> 0 then // for now using the jackhammer for its kind of bemused "oops" look |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
802 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
803 |
DrawHedgehog(sx, sy, |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
804 |
hwSign(Gear^.dX), |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
805 |
2, |
2053
9a8a4add3eff
Use shrug frame for injuring yourself/team-mate, add custom theme music to Sheep theme
nemo
parents:
2045
diff
changeset
|
806 |
3, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
807 |
0); |
1011 | 808 |
defaultPos:= false |
809 |
end else |
|
810 |
||
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
815
diff
changeset
|
811 |
if (Gear^.State and gstHHDriven) <> 0 then |
966 | 812 |
begin |
2028 | 813 |
if ((Gear^.State and gstHHThinking) = 0) and |
814 |
ShowCrosshair and |
|
815 |
((Gear^.State and (gstAttacked or gstAnimation)) = 0) then |
|
816 |
begin |
|
817 |
(* These calculations are a little complex for a few reasons: |
|
818 |
1: I need to draw the laser from weapon origin to nearest land |
|
819 |
2: I need to start the beam outside the hedgie for attractiveness. |
|
820 |
3: I need to extend the beam beyond land. |
|
821 |
This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function. |
|
822 |
*) |
|
823 |
dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle); |
|
824 |
dy:= - Cos(Gear^.Angle * pi / cMaxAngle); |
|
825 |
if cLaserSighting then |
|
826 |
begin |
|
827 |
lx:= hwRound(Gear^.X); |
|
828 |
ly:= hwRound(Gear^.Y); |
|
829 |
lx:= lx + dx * 16; |
|
830 |
ly:= ly + dy * 16; |
|
831 |
||
832 |
ax:= dx * 4; |
|
833 |
ay:= dy * 4; |
|
834 |
||
835 |
tx:= round(lx); |
|
836 |
ty:= round(ly); |
|
837 |
hx:= tx; |
|
838 |
hy:= ty; |
|
839 |
while ((ty and LAND_HEIGHT_MASK) = 0) and |
|
840 |
((tx and LAND_WIDTH_MASK) = 0) and |
|
841 |
(Land[ty, tx] = 0) do |
|
842 |
begin |
|
843 |
lx:= lx + ax; |
|
844 |
ly:= ly + ay; |
|
845 |
tx:= round(lx); |
|
846 |
ty:= round(ly) |
|
847 |
end; |
|
848 |
// reached edge of land. assume infinite beam. Extend it way out past camera |
|
849 |
if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then |
|
850 |
begin |
|
851 |
tx:= round(lx + ax * (LAND_WIDTH div 4)); |
|
852 |
ty:= round(ly + ay * (LAND_WIDTH div 4)); |
|
853 |
end; |
|
854 |
||
855 |
//if (abs(lx-tx)>8) or (abs(ly-ty)>8) then |
|
856 |
begin |
|
857 |
glDisable(GL_TEXTURE_2D); |
|
858 |
glEnable(GL_LINE_SMOOTH); |
|
859 |
||
2362 | 860 |
glLineWidth(1.0); |
861 |
||
2028 | 862 |
glColor4ub($FF, $00, $00, $C0); |
863 |
VertexBuffer[0].X:= hx + WorldDx; |
|
864 |
VertexBuffer[0].Y:= hy + WorldDy; |
|
865 |
VertexBuffer[1].X:= tx + WorldDx; |
|
866 |
VertexBuffer[1].Y:= ty + WorldDy; |
|
867 |
||
868 |
glEnableClientState(GL_VERTEX_ARRAY); |
|
869 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
870 |
glDrawArrays(GL_LINES, 0, Length(VertexBuffer)); |
|
871 |
glColor4f(1, 1, 1, 1); |
|
872 |
glEnable(GL_TEXTURE_2D); |
|
873 |
glDisable(GL_LINE_SMOOTH); |
|
874 |
end; |
|
875 |
end; |
|
876 |
// draw crosshair |
|
877 |
cx:= Round(hwRound(Gear^.X) + dx * 80); |
|
878 |
cy:= Round(hwRound(Gear^.Y) + dy * 80); |
|
879 |
DrawRotatedTex(PHedgehog(Gear^.Hedgehog)^.Team^.CrosshairTex, |
|
880 |
12, 12, cx + WorldDx, cy + WorldDy, 0, |
|
881 |
hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle); |
|
882 |
end; |
|
1002 | 883 |
hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx; |
884 |
hy:= hwRound(Gear^.Y) - 2 + WorldDy; |
|
885 |
aangle:= Gear^.Angle * 180 / cMaxAngle - 90; |
|
874 | 886 |
|
1002 | 887 |
if CurAmmoGear <> nil then |
888 |
begin |
|
889 |
case CurAmmoGear^.Kind of |
|
1294
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
890 |
gtShotgunShot: begin |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
891 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
892 |
DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle) |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
893 |
else |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
894 |
DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
895 |
end; |
1002 | 896 |
gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
897 |
gtSniperRifleShot: begin |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
898 |
if (CurAmmoGear^.State and gstAnimation <> 0) then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
899 |
DrawRotatedF(sprSniperRifle, hx, hy, 1, hwSign(Gear^.dX), aangle) |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
900 |
else |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
901 |
DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle) |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
902 |
end; |
1601 | 903 |
gtBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
1717 | 904 |
gtRCPlane: begin |
905 |
DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
|
906 |
defaultPos:= false |
|
907 |
end; |
|
1002 | 908 |
gtRope: begin |
909 |
if Gear^.X < CurAmmoGear^.X then |
|
910 |
begin |
|
911 |
dAngle:= 0; |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
912 |
i:= 1 |
1002 | 913 |
end else |
914 |
begin |
|
915 |
dAngle:= 180; |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
916 |
i:= -1 |
966 | 917 |
end; |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
918 |
sx:= hwRound(Gear^.X) + WorldDx; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
919 |
sy:= hwRound(Gear^.Y) + WorldDy; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
920 |
DrawHedgehog(sx, sy, |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
921 |
i, |
1002 | 922 |
1, |
923 |
0, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
924 |
DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle); |
1002 | 925 |
defaultPos:= false |
926 |
end; |
|
927 |
gtBlowTorch: begin |
|
928 |
DrawRotated(sprBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
929 |
DrawHedgehog(sx, sy, |
1002 | 930 |
hwSign(Gear^.dX), |
931 |
3, |
|
1113 | 932 |
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
933 |
0); |
1002 | 934 |
defaultPos:= false |
935 |
end; |
|
936 |
gtShover: DrawRotated(sprHandBaseball, hx, hy, hwSign(Gear^.dX), aangle + 180); |
|
937 |
gtFirePunch: begin |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
938 |
DrawHedgehog(sx, sy, |
1002 | 939 |
hwSign(Gear^.dX), |
940 |
1, |
|
941 |
4, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
942 |
0); |
1002 | 943 |
defaultPos:= false |
944 |
end; |
|
1892 | 945 |
gtPickHammer: begin |
946 |
defaultPos:= false; |
|
947 |
dec(sy,20); |
|
948 |
end; |
|
1002 | 949 |
gtTeleport: defaultPos:= false; |
1010 | 950 |
gtWhip: begin |
951 |
DrawRotatedF(sprWhip, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
952 |
sx, |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
953 |
sy, |
1010 | 954 |
1, |
955 |
hwSign(Gear^.dX), |
|
956 |
0); |
|
957 |
defaultPos:= false |
|
958 |
end; |
|
1002 | 959 |
gtKamikaze: begin |
1286 | 960 |
if CurAmmoGear^.Pos = 0 then |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
961 |
DrawHedgehog(sx, sy, |
1286 | 962 |
hwSign(Gear^.dX), |
963 |
1, |
|
964 |
6, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
965 |
0) |
1286 | 966 |
else |
967 |
DrawRotatedF(sprKamikaze, |
|
968 |
hwRound(Gear^.X) + WorldDx, |
|
969 |
hwRound(Gear^.Y) + WorldDy, |
|
970 |
CurAmmoGear^.Pos - 1, |
|
2025
692308790912
Adjust routines impacted by DrawRotatedF modification, clear gstHHHJump in rope to avoid crosshair/hat drawing bug.
nemo
parents:
2023
diff
changeset
|
971 |
hwSign(Gear^.dX), |
692308790912
Adjust routines impacted by DrawRotatedF modification, clear gstHHHJump in rope to avoid crosshair/hat drawing bug.
nemo
parents:
2023
diff
changeset
|
972 |
aangle); |
1286 | 973 |
defaultPos:= false |
974 |
end; |
|
975 |
gtSeduction: begin |
|
976 |
if CurAmmoGear^.Pos >= 6 then |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
977 |
DrawHedgehog(sx, sy, |
1286 | 978 |
hwSign(Gear^.dX), |
979 |
2, |
|
980 |
2, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
981 |
0) |
1286 | 982 |
else |
983 |
begin |
|
984 |
DrawRotatedF(sprDress, |
|
985 |
hwRound(Gear^.X) + WorldDx, |
|
986 |
hwRound(Gear^.Y) + WorldDy, |
|
987 |
CurAmmoGear^.Pos, |
|
988 |
hwSign(Gear^.dX), |
|
989 |
0); |
|
990 |
DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0) |
|
991 |
end; |
|
992 |
defaultPos:= false |
|
993 |
end; |
|
1002 | 994 |
end; |
995 |
||
996 |
case CurAmmoGear^.Kind of |
|
997 |
gtShotgunShot, |
|
998 |
gtDEagleShot, |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
999 |
gtSniperRifleShot, |
1002 | 1000 |
gtShover: begin |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1001 |
DrawHedgehog(sx, sy, |
1002 | 1002 |
hwSign(Gear^.dX), |
1003 |
0, |
|
1004 |
4, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1005 |
0); |
1977 | 1006 |
defaultPos:= false; |
1007 |
HatVisible:= true |
|
1002 | 1008 |
end |
1009 |
end |
|
1010 |
end else |
|
876 | 1011 |
|
1002 | 1012 |
if ((Gear^.State and gstHHJumping) <> 0) then |
1013 |
begin |
|
2020 | 1014 |
DrawHedgehog(sx, sy, |
1015 |
hwSign(Gear^.dX)*m, |
|
1016 |
1, |
|
1017 |
1, |
|
1018 |
0); |
|
1019 |
HatVisible:= true; |
|
2017 | 1020 |
HatVisible:= true; |
1002 | 1021 |
defaultPos:= false |
1022 |
end else |
|
874 | 1023 |
|
1913 | 1024 |
if (Gear^.Message and (gm_Left or gm_Right) <> 0) and (not isCursorVisible) then |
824 | 1025 |
begin |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1026 |
DrawHedgehog(sx, sy, |
1002 | 1027 |
hwSign(Gear^.dX), |
1028 |
0, |
|
1029 |
PHedgehog(Gear^.Hedgehog)^.visStepPos div 2, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1030 |
0); |
1257 | 1031 |
defaultPos:= false; |
1032 |
HatVisible:= true |
|
1002 | 1033 |
end |
1034 |
else |
|
1035 |
||
1033 | 1036 |
if ((Gear^.State and gstAnimation) <> 0) then |
1037 |
begin |
|
1034 | 1038 |
DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1039 |
sx, |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1040 |
sy, |
1033 | 1041 |
Gear^.Pos, |
1042 |
hwSign(Gear^.dX), |
|
1043 |
0.0); |
|
1044 |
defaultPos:= false |
|
1045 |
end |
|
1046 |
else |
|
1002 | 1047 |
if ((Gear^.State and gstAttacked) = 0) then |
1048 |
begin |
|
1049 |
amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
|
1050 |
case amt of |
|
1051 |
amBazooka, |
|
1717 | 1052 |
amMortar: DrawRotated(sprHandBazooka, hx, hy, hwSign(Gear^.dX), aangle); |
1053 |
amBallgun: DrawRotated(sprHandBallgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1054 |
amDrill: DrawRotated(sprHandDrill, hx, hy, hwSign(Gear^.dX), aangle); |
|
1002 | 1055 |
amRope: DrawRotated(sprHandRope, hx, hy, hwSign(Gear^.dX), aangle); |
1056 |
amShotgun: DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle); |
|
1057 |
amDEagle: DrawRotated(sprHandDEagle, hx, hy, hwSign(Gear^.dX), aangle); |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
1058 |
amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, hwSign(Gear^.dX), aangle); |
1002 | 1059 |
amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, hwSign(Gear^.dX), aangle); |
1717 | 1060 |
amRCPlane: begin |
1061 |
DrawRotated(sprHandPlane, hx, hy, hwSign(Gear^.dX), 0); |
|
1062 |
defaultPos:= false |
|
1063 |
end; |
|
1939 | 1064 |
amGirder: begin |
1065 |
DrawSpriteClipped(sprGirder, |
|
1066 |
sx-256, |
|
1067 |
sy-256, |
|
1068 |
LongInt(topY)+WorldDy, |
|
1069 |
LongInt(rightX)+WorldDx, |
|
1070 |
cWaterLine+WorldDy, |
|
1071 |
LongInt(leftX)+WorldDx); |
|
1072 |
end; |
|
1002 | 1073 |
end; |
1074 |
||
1075 |
case amt of |
|
1076 |
amAirAttack, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1077 |
amMineStrike: DrawRotated(sprHandAirAttack, sx, hwRound(Gear^.Y) + WorldDy, hwSign(Gear^.dX), 0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1078 |
amPickHammer: DrawHedgehog(sx, sy, |
1002 | 1079 |
hwSign(Gear^.dX), |
1080 |
1, |
|
1081 |
2, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1082 |
0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1083 |
amBlowTorch: DrawHedgehog(sx, sy, |
1002 | 1084 |
hwSign(Gear^.dX), |
1085 |
1, |
|
1086 |
3, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1087 |
0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1088 |
amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, hwSign(Gear^.dX), 0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1089 |
amKamikaze: DrawHedgehog(sx, sy, |
1002 | 1090 |
hwSign(Gear^.dX), |
1091 |
1, |
|
1092 |
5, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1093 |
0); |
1221 | 1094 |
amWhip: DrawRotatedF(sprWhip, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1095 |
sx, |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1096 |
sy, |
1010 | 1097 |
0, |
1098 |
hwSign(Gear^.dX), |
|
1099 |
0); |
|
1002 | 1100 |
else |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1101 |
DrawHedgehog(sx, sy, |
822 | 1102 |
hwSign(Gear^.dX), |
1103 |
0, |
|
1002 | 1104 |
4, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1105 |
0); |
1253 | 1106 |
|
1107 |
HatVisible:= true; |
|
1108 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
1294
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
1109 |
if (HatTex <> nil) |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1110 |
and (HatVisibility > 0) then |
1253 | 1111 |
DrawTextureF(HatTex, |
1112 |
HatVisibility, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1113 |
sx, |
1253 | 1114 |
hwRound(Gear^.Y) - 8 + WorldDy, |
1115 |
0, |
|
1116 |
hwSign(Gear^.dX), |
|
1117 |
32); |
|
1002 | 1118 |
end; |
966 | 1119 |
|
1002 | 1120 |
case amt of |
1121 |
amBaseballBat: DrawRotated(sprHandBaseball, |
|
1122 |
hwRound(Gear^.X) + 1 - 4 * hwSign(Gear^.dX) + WorldDx, |
|
1123 |
hwRound(Gear^.Y) + 6 + WorldDy, hwSign(Gear^.dX), aangle); |
|
1124 |
end; |
|
966 | 1125 |
|
1002 | 1126 |
defaultPos:= false |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1127 |
end; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1128 |
|
1002 | 1129 |
end else // not gstHHDriven |
1012 | 1130 |
begin |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1131 |
if (Gear^.Damage > 0) |
2028 | 1132 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1133 |
begin |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1134 |
DrawHedgehog(sx, sy, |
1012 | 1135 |
hwSign(Gear^.dX), |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1136 |
2, |
1012 | 1137 |
1, |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1138 |
Gear^.DirAngle); |
1012 | 1139 |
defaultPos:= false |
1020 | 1140 |
end else |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1141 |
|
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1142 |
if ((Gear^.State and gstHHJumping) <> 0) then |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1143 |
begin |
2020 | 1144 |
DrawHedgehog(sx, sy, |
1145 |
hwSign(Gear^.dX)*m, |
|
1146 |
1, |
|
1147 |
1, |
|
1148 |
0); |
|
1149 |
defaultPos:= false |
|
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
1013
diff
changeset
|
1150 |
end; |
1012 | 1151 |
end; |
834 | 1152 |
|
1251 | 1153 |
with PHedgehog(Gear^.Hedgehog)^ do |
970 | 1154 |
begin |
1251 | 1155 |
if defaultPos then |
1156 |
begin |
|
1157 |
DrawRotatedF(sprHHIdle, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1158 |
sx, |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1159 |
sy, |
1251 | 1160 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
1161 |
hwSign(Gear^.dX), |
|
1162 |
0); |
|
1253 | 1163 |
HatVisible:= true; |
1164 |
end; |
|
1165 |
||
1166 |
if HatVisible then |
|
1251 | 1167 |
if HatVisibility < 1.0 then |
1254 | 1168 |
HatVisibility:= HatVisibility + 0.2 |
1253 | 1169 |
else |
1251 | 1170 |
else |
1171 |
if HatVisibility > 0.0 then |
|
1254 | 1172 |
HatVisibility:= HatVisibility - 0.2; |
1253 | 1173 |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1174 |
if (HatTex <> nil) |
1294
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1286
diff
changeset
|
1175 |
and (HatVisibility > 0) then |
1255 | 1176 |
if DefaultPos then |
1177 |
DrawTextureF(HatTex, |
|
1178 |
HatVisibility, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1179 |
sx, |
1255 | 1180 |
hwRound(Gear^.Y) - 8 + WorldDy, |
1181 |
(RealTicks div 128 + Gear^.Pos) mod 19, |
|
1182 |
hwSign(Gear^.dX), |
|
1183 |
32) |
|
1184 |
else |
|
1185 |
DrawTextureF(HatTex, |
|
1186 |
HatVisibility, |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1187 |
sx, |
1255 | 1188 |
hwRound(Gear^.Y) - 8 + WorldDy, |
1189 |
0, |
|
2020 | 1190 |
hwSign(Gear^.dX)*m, |
1255 | 1191 |
32); |
970 | 1192 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1193 |
if (Gear^.State and gstHHDriven) <> 0 then |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1194 |
begin |
2186
5ec3e4a03d51
disable selection sprite, nudge ship into the air on launch
nemo
parents:
2182
diff
changeset
|
1195 |
(* if (CurAmmoGear = nil) then |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1196 |
begin |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1197 |
amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1198 |
case amt of |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1199 |
amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1200 |
end |
2186
5ec3e4a03d51
disable selection sprite, nudge ship into the air on launch
nemo
parents:
2182
diff
changeset
|
1201 |
end; *) |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1202 |
if CurAmmoGear <> nil then |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1203 |
begin |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1204 |
case CurAmmoGear^.Kind of |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1205 |
gtJetpack: begin |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1206 |
DrawSprite(sprJetpack, sx-32, sy-32, 0); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1207 |
if (CurAmmoGear^.MsgParam and gm_Up) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 1); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1208 |
if (CurAmmoGear^.MsgParam and gm_Left) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 2); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1209 |
if (CurAmmoGear^.MsgParam and gm_Right) <> 0 then DrawSprite(sprJetpack, sx-32, sy-32, 3); |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
1210 |
if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex) |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1211 |
end; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1212 |
end; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1213 |
end |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2177
diff
changeset
|
1214 |
end; |
1251 | 1215 |
|
351 | 1216 |
with PHedgehog(Gear^.Hedgehog)^ do |
994 | 1217 |
begin |
1011 | 1218 |
if ((Gear^.State and not gstWinner) = 0) |
994 | 1219 |
or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then |
958 | 1220 |
begin |
1660 | 1221 |
t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy; |
1222 |
if (cTagsMask and 1) <> 0 then |
|
1223 |
begin |
|
1224 |
dec(t, HealthTagTex^.h + 2); |
|
1225 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex) |
|
1226 |
end; |
|
1227 |
if (cTagsMask and 2) <> 0 then |
|
1228 |
begin |
|
1229 |
dec(t, NameTagTex^.h + 2); |
|
1230 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex) |
|
1231 |
end; |
|
1232 |
if (cTagsMask and 4) <> 0 then |
|
1233 |
begin |
|
1234 |
dec(t, Team^.NameTagTex^.h + 2); |
|
1235 |
DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex) |
|
1236 |
end |
|
958 | 1237 |
end; |
994 | 1238 |
if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog |
958 | 1239 |
begin |
1240 |
if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then |
|
1241 |
DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy, |
|
1242 |
GameTicks div 32 mod 16); |
|
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
815
diff
changeset
|
1243 |
|
958 | 1244 |
if (Gear^.State and gstDrowning) = 0 then |
1245 |
if (Gear^.State and gstHHThinking) <> 0 then |
|
1246 |
DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0) |
|
2028 | 1247 |
end |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1248 |
end; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1249 |
|
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1250 |
if Gear^.Invulnerable then |
2017 | 1251 |
begin |
1252 |
DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0); |
|
1253 |
end; |
|
1254 |
if cVampiric and |
|
1255 |
(CurrentHedgehog^.Gear <> nil) and |
|
1256 |
(CurrentHedgehog^.Gear = Gear) then |
|
1257 |
begin |
|
1258 |
DrawSprite(sprVampiric, sx - 24, sy - 24, 0); |
|
1259 |
end; |
|
292 | 1260 |
end; |
1261 |
||
2362 | 1262 |
procedure DrawRopeLinesRQ(Gear: PGear); |
1263 |
var i, cnt: LongInt; |
|
1264 |
px, py: LongInt; |
|
1265 |
begin |
|
1266 |
// FIXME: store rounded coordinates in second points array |
|
1267 |
cnt:= 0; |
|
1268 |
with RopePoints do |
|
1269 |
if RopePoints.Count > 0 then |
|
1270 |
begin |
|
1271 |
i:= 0; |
|
1272 |
cnt:= 0; |
|
1273 |
px:= hwRound(ar[0].X) - 1; |
|
1274 |
while i < Count do |
|
1275 |
begin |
|
1276 |
rounded[cnt].X:= hwRound(ar[i].X) + WorldDx; |
|
1277 |
rounded[cnt].Y:= hwRound(ar[i].Y) + WorldDy; |
|
1278 |
// prevent equal points |
|
1279 |
if (px <> rounded[cnt].X) or (py <> rounded[cnt].Y) then |
|
1280 |
begin |
|
1281 |
px:= rounded[cnt].X; |
|
1282 |
py:= rounded[cnt].Y; |
|
1283 |
inc(cnt) |
|
1284 |
end; |
|
1285 |
inc(i) |
|
1286 |
end; |
|
1287 |
rounded[cnt].X:= hwRound(Gear^.X) + WorldDx; |
|
1288 |
rounded[cnt].Y:= hwRound(Gear^.Y) + WorldDy; |
|
1289 |
inc(cnt); |
|
1290 |
rounded[cnt].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx; |
|
1291 |
rounded[cnt].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy; |
|
1292 |
end else |
|
1293 |
if Gear^.Elasticity.QWordValue > 0 then |
|
1294 |
begin |
|
1295 |
cnt:= 1; |
|
1296 |
rounded[0].X:= hwRound(Gear^.X) + WorldDx; |
|
1297 |
rounded[0].Y:= hwRound(Gear^.Y) + WorldDy; |
|
1298 |
rounded[1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx; |
|
1299 |
rounded[1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy; |
|
1300 |
end; |
|
1301 |
||
1302 |
if cnt > 0 then |
|
1303 |
begin |
|
1304 |
glDisable(GL_TEXTURE_2D); |
|
1305 |
glEnable(GL_LINE_SMOOTH); |
|
1306 |
||
1307 |
glLineWidth(4.0); |
|
1308 |
||
1309 |
glColor4ub($A0, $A0, $A0, $C0); |
|
1310 |
||
1311 |
glEnableClientState(GL_VERTEX_ARRAY); |
|
1312 |
glVertexPointer(2, GL_INT, 0, @RopePoints.rounded[0]); |
|
1313 |
glDrawArrays(GL_LINES, 0, cnt + 1); |
|
1314 |
glColor4f(1, 1, 1, 1); |
|
1315 |
glEnable(GL_TEXTURE_2D); |
|
1316 |
glDisable(GL_LINE_SMOOTH); |
|
1317 |
end |
|
1318 |
end; |
|
1319 |
||
1320 |
procedure DrawRope(Gear: PGear); |
|
1321 |
var roplen: LongInt; |
|
1322 |
i: LongInt; |
|
1323 |
||
1324 |
procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt); |
|
1325 |
var eX, eY, dX, dY: LongInt; |
|
1326 |
i, sX, sY, x, y, d: LongInt; |
|
1327 |
b: boolean; |
|
1328 |
begin |
|
1329 |
if (X1 = X2) and (Y1 = Y2) then |
|
1330 |
begin |
|
1331 |
//OutError('WARNING: zero length rope line!', false); |
|
1332 |
exit |
|
1333 |
end; |
|
1334 |
eX:= 0; |
|
1335 |
eY:= 0; |
|
1336 |
dX:= X2 - X1; |
|
1337 |
dY:= Y2 - Y1; |
|
1338 |
||
1339 |
if (dX > 0) then sX:= 1 |
|
1340 |
else |
|
1341 |
if (dX < 0) then |
|
1342 |
begin |
|
1343 |
sX:= -1; |
|
1344 |
dX:= -dX |
|
1345 |
end else sX:= dX; |
|
1346 |
||
1347 |
if (dY > 0) then sY:= 1 |
|
1348 |
else |
|
1349 |
if (dY < 0) then |
|
1350 |
begin |
|
1351 |
sY:= -1; |
|
1352 |
dY:= -dY |
|
1353 |
end else sY:= dY; |
|
1354 |
||
1355 |
if (dX > dY) then d:= dX |
|
1356 |
else d:= dY; |
|
1357 |
||
1358 |
x:= X1; |
|
1359 |
y:= Y1; |
|
1360 |
||
1361 |
for i:= 0 to d do |
|
1362 |
begin |
|
1363 |
inc(eX, dX); |
|
1364 |
inc(eY, dY); |
|
1365 |
b:= false; |
|
1366 |
if (eX > d) then |
|
1367 |
begin |
|
1368 |
dec(eX, d); |
|
1369 |
inc(x, sX); |
|
1370 |
b:= true |
|
1371 |
end; |
|
1372 |
if (eY > d) then |
|
1373 |
begin |
|
1374 |
dec(eY, d); |
|
1375 |
inc(y, sY); |
|
1376 |
b:= true |
|
1377 |
end; |
|
1378 |
if b then |
|
1379 |
begin |
|
1380 |
inc(roplen); |
|
1381 |
if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0) |
|
1382 |
end |
|
1383 |
end |
|
1384 |
end; |
|
1385 |
begin |
|
1386 |
if cReducedQuality then |
|
1387 |
DrawRopeLinesRQ(Gear) |
|
1388 |
else |
|
1389 |
begin |
|
1390 |
roplen:= 0; |
|
1391 |
if RopePoints.Count > 0 then |
|
1392 |
begin |
|
1393 |
i:= 0; |
|
1394 |
while i < Pred(RopePoints.Count) do |
|
1395 |
begin |
|
1396 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
|
1397 |
hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy); |
|
1398 |
inc(i) |
|
1399 |
end; |
|
1400 |
DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy, |
|
1401 |
hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy); |
|
1402 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
1403 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
1404 |
end else |
|
1405 |
if Gear^.Elasticity.QWordValue > 0 then |
|
1406 |
DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, |
|
1407 |
hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy); |
|
1408 |
end; |
|
1409 |
||
1410 |
||
1411 |
if RopePoints.Count > 0 then |
|
1412 |
DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle) |
|
1413 |
else |
|
1414 |
if Gear^.Elasticity.QWordValue > 0 then |
|
1415 |
DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1416 |
end; |
|
1417 |
||
956 | 1418 |
procedure DrawGears; |
853 | 1419 |
var Gear, HHGear: PGear; |
4 | 1420 |
i: Longword; |
1421 |
begin |
|
1422 |
Gear:= GearsList; |
|
1423 |
while Gear<>nil do |
|
1689 | 1424 |
begin |
1425 |
case Gear^.Kind of |
|
822 | 1426 |
gtAmmo_Bomb: DrawRotated(sprBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1689 | 1427 |
|
1696 | 1428 |
gtRCPlane: if (Gear^.Tag = -1) then |
1689 | 1429 |
DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, -1, DxDy2Angle(Gear^.dX, Gear^.dY) + 90) |
1430 |
else |
|
1431 |
DrawRotated(sprPlane, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,0,DxDy2Angle(Gear^.dY, Gear^.dX)); |
|
1432 |
||
1601 | 1433 |
gtBall: DrawRotatedf(sprBalls, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tag,0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1689 | 1434 |
|
1573 | 1435 |
gtDrill: DrawRotated(sprDrill, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1689 | 1436 |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1437 |
gtHedgehog: DrawHH(Gear); |
1689 | 1438 |
|
822 | 1439 |
gtAmmo_Grenade: DrawRotated(sprGrenade, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1689 | 1440 |
|
1505 | 1441 |
gtHealthTag: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex); |
2017 | 1442 |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1443 |
gtGrave: DrawSurfSprite(hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex); |
1689 | 1444 |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1445 |
gtUFO: DrawSprite(sprUFO, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4); |
1689 | 1446 |
|
848 | 1447 |
gtPickHammer: DrawSprite(sprPHammer, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 50 + LongInt(((GameTicks shr 5) and 1) * 2) + WorldDy, 0); |
2362 | 1448 |
gtRope: DrawRope(Gear); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1449 |
gtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
1012 | 1450 |
gtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State); |
351 | 1451 |
gtMine: if ((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420) |
822 | 1452 |
then DrawRotated(sprMineOff, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle) |
1453 |
else DrawRotated(sprMineOn, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
|
351 | 1454 |
gtCase: case Gear^.Pos of |
1794 | 1455 |
posCaseAmmo : begin |
1456 |
i:= (GameTicks shr 6) mod 64; |
|
1457 |
if i > 18 then i:= 0; |
|
1458 |
DrawSprite(sprCase, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
|
1459 |
end; |
|
1009 | 1460 |
posCaseHealth: begin |
1863 | 1461 |
i:= ((GameTicks shr 6) + 38) mod 64; |
1462 |
if i > 13 then i:= 0; |
|
1009 | 1463 |
DrawSprite(sprFAid, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
1464 |
end; |
|
1861 | 1465 |
posCaseUtility: begin |
1863 | 1466 |
i:= (GameTicks shr 6) mod 70; |
1467 |
if i > 23 then i:= 0; |
|
1909 | 1468 |
i:= i mod 12; |
1863 | 1469 |
DrawSprite(sprUtility, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i); |
1861 | 1470 |
end; |
42 | 1471 |
end; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1472 |
gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1); |
822 | 1473 |
gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1474 |
gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0); |
1560
e140bc57ff68
Quick replay round to spectators until current move
unc0rr
parents:
1555
diff
changeset
|
1475 |
gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, (GameTicks div 128 + LongWord(Gear^.Tag)) mod 8); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1476 |
gtParachute: DrawSprite(sprParachute, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 48 + WorldDy, 0); |
2168 | 1477 |
gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 0) |
1478 |
else DrawSprite(sprAirplane, hwRound(Gear^.X) - SpritesData[sprAirplane].Width div 2 + WorldDx, hwRound(Gear^.Y) - SpritesData[sprAirplane].Height div 2 + WorldDy, 1); |
|
822 | 1479 |
gtAirBomb: DrawRotated(sprAirBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
853 | 1480 |
gtTeleport: begin |
1481 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1482 |
DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1483 |
DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0); |
|
1484 |
end; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1485 |
gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, (GameTicks shr 6) mod 12); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
1486 |
gtTarget: DrawSprite(sprTarget, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
959 | 1487 |
gtMortar: DrawRotated(sprMortar, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX)); |
1108 | 1488 |
gtCake: if Gear^.Pos = 6 then |
2025
692308790912
Adjust routines impacted by DrawRotatedF modification, clear gstHHHJump in rope to avoid crosshair/hat drawing bug.
nemo
parents:
2023
diff
changeset
|
1489 |
DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90) |
1108 | 1490 |
else |
1262 | 1491 |
DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0); |
1367 | 1492 |
gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0); |
1262 | 1493 |
gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle); |
1494 |
gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle); |
|
1263 | 1495 |
gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle); |
1496 |
gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State); |
|
1497 |
end; |
|
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2186
diff
changeset
|
1498 |
if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(hwRound(Gear^.X) + 8 + WorldDx, hwRound(Gear^.Y) + 8 + WorldDy, Gear^.Tex); |
351 | 1499 |
Gear:= Gear^.NextGear |
4 | 1500 |
end; |
1501 |
end; |
|
1502 |
||
1503 |
procedure FreeGearsList; |
|
1504 |
var t, tt: PGear; |
|
1505 |
begin |
|
1506 |
tt:= GearsList; |
|
1507 |
GearsList:= nil; |
|
1505 | 1508 |
while tt <> nil do |
1509 |
begin |
|
1510 |
t:= tt; |
|
1511 |
tt:= tt^.NextGear; |
|
1512 |
Dispose(t) |
|
1513 |
end; |
|
4 | 1514 |
end; |
1515 |
||
10 | 1516 |
procedure AddMiscGears; |
371 | 1517 |
var i: LongInt; |
1515 | 1518 |
Gear: PGear; |
4 | 1519 |
begin |
498 | 1520 |
AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000); |
1435
d4b32ee3caa6
Fix using freed memory (could be the cause of queue error problem and other bugs)
unc0rr
parents:
1434
diff
changeset
|
1521 |
|
1895 | 1522 |
if ((GameFlags and gfForts) = 0) and ((GameFlags and gfMines) <> 0) then |
1435
d4b32ee3caa6
Fix using freed memory (could be the cause of queue error problem and other bugs)
unc0rr
parents:
1434
diff
changeset
|
1523 |
for i:= 0 to Pred(cLandAdditions) do |
1515 | 1524 |
begin |
1525 |
Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0); |
|
2333 | 1526 |
Gear^.TriggerId:= i + 1; |
1527 |
FindPlace(Gear, false, 0, LAND_WIDTH); |
|
1528 |
{ if(Gear <> nil) then |
|
1529 |
ParseCommand('addtrig s' + inttostr(Gear^.TriggerId) + ' 1 5 11 ' + |
|
1530 |
inttostr(hwRound(Gear^.X)) + ' ' + inttostr(hwRound(Gear^.Y)) + |
|
1531 |
' ' + inttostr(Gear^.TriggerId), true); |
|
1532 |
} end; |
|
1895 | 1533 |
|
1534 |
if (GameFlags and gfLowGravity) <> 0 then |
|
1535 |
cGravity:= cMaxWindSpeed / 2; |
|
1536 |
||
2017 | 1537 |
if (GameFlags and gfVampiric) <> 0 then |
1538 |
cVampiric:= true; |
|
1539 |
||
1895 | 1540 |
Gear:= GearsList; |
1541 |
if (GameFlags and gfInvulnerable) <> 0 then |
|
1542 |
while Gear <> nil do |
|
1543 |
begin |
|
1544 |
Gear^.Invulnerable:= true; // this is only checked on hogs right now, so no need for gear type check |
|
1545 |
Gear:= Gear^.NextGear |
|
1546 |
end; |
|
1547 |
||
1548 |
if (GameFlags and gfLaserSight) <> 0 then |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
1549 |
cLaserSighting:= true; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
1550 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
1551 |
if (GameFlags and gfArtillery) <> 0 then |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2020
diff
changeset
|
1552 |
cArtillery:= true |
4 | 1553 |
end; |
1554 |
||
371 | 1555 |
procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
4 | 1556 |
var Gear: PGear; |
506 | 1557 |
dmg, dmgRadius: LongInt; |
4 | 1558 |
begin |
1559 |
TargetPoint.X:= NoPointX; |
|
1434 | 1560 |
{$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} |
1049 | 1561 |
if (Radius > 10) then AddGear(X, Y, gtExplosion, 0, _0, _0, 0); |
1669 | 1562 |
if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion, false, nil); |
1433 | 1563 |
|
1564 |
if (Mask and EXPLAllDamageInRadius) = 0 then |
|
1565 |
dmgRadius:= Radius shl 1 |
|
1566 |
else |
|
1567 |
dmgRadius:= Radius; |
|
1568 |
||
4 | 1569 |
Gear:= GearsList; |
1570 |
while Gear <> nil do |
|
1200 | 1571 |
begin |
1572 |
dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
|
1573 |
if (dmg > 1) and |
|
1574 |
((Gear^.State and gstNoDamage) = 0) then |
|
1575 |
begin |
|
1861 | 1576 |
dmg:= modifyDamage(min(dmg div 2, Radius)); |
1200 | 1577 |
case Gear^.Kind of |
1578 |
gtHedgehog, |
|
1579 |
gtMine, |
|
1580 |
gtCase, |
|
1581 |
gtTarget, |
|
1582 |
gtFlame: begin |
|
1346 | 1583 |
//{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1200 | 1584 |
if (Mask and EXPLNoDamage) = 0 then |
1585 |
begin |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1586 |
if not Gear^.Invulnerable then |
2017 | 1587 |
ApplyDamage(Gear, dmg) |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1588 |
else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1589 |
Gear^.State:= Gear^.State or gstWinner; |
1200 | 1590 |
end; |
1591 |
if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
|
1592 |
begin |
|
1593 |
DeleteCI(Gear); |
|
1594 |
Gear^.dX:= Gear^.dX + SignAs(_0_005 * dmg + cHHKick, Gear^.X - int2hwFloat(X)); |
|
1595 |
Gear^.dY:= Gear^.dY + SignAs(_0_005 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y)); |
|
1868 | 1596 |
Gear^.State:= (Gear^.State or gstMoving) and (not gstLoser); |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1597 |
if not Gear^.Invulnerable then |
1868 | 1598 |
Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner); |
1200 | 1599 |
Gear^.Active:= true; |
1600 |
FollowGear:= Gear |
|
1601 |
end; |
|
1602 |
end; |
|
1603 |
gtGrave: begin |
|
1604 |
Gear^.dY:= - _0_004 * dmg; |
|
1605 |
Gear^.Active:= true; |
|
1606 |
end; |
|
1607 |
end; |
|
1608 |
end; |
|
1609 |
Gear:= Gear^.NextGear |
|
1610 |
end; |
|
1611 |
||
621 | 1612 |
if (Mask and EXPLDontDraw) = 0 then |
1200 | 1613 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); |
1614 |
||
498 | 1615 |
uAIMisc.AwareOfExplosion(0, 0, 0) |
4 | 1616 |
end; |
1617 |
||
506 | 1618 |
procedure ShotgunShot(Gear: PGear); |
1619 |
var t: PGear; |
|
955 | 1620 |
dmg: LongInt; |
506 | 1621 |
begin |
509 | 1622 |
Gear^.Radius:= cShotgunRadius; |
506 | 1623 |
t:= GearsList; |
1624 |
while t <> nil do |
|
1286 | 1625 |
begin |
1861 | 1626 |
dmg:= modifyDamage(min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25)); |
1286 | 1627 |
if dmg > 0 then |
1628 |
case t^.Kind of |
|
1629 |
gtHedgehog, |
|
1630 |
gtMine, |
|
1631 |
gtCase, |
|
1632 |
gtTarget: begin |
|
1854 | 1633 |
if (not t^.Invulnerable) then |
2017 | 1634 |
ApplyDamage(t, dmg) |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1635 |
else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1636 |
Gear^.State:= Gear^.State or gstWinner; |
867 | 1637 |
|
1286 | 1638 |
DeleteCI(t); |
1639 |
t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
|
1640 |
t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
|
1641 |
t^.State:= t^.State or gstMoving; |
|
1642 |
t^.Active:= true; |
|
1643 |
FollowGear:= t |
|
1644 |
end; |
|
1645 |
gtGrave: begin |
|
1646 |
t^.dY:= - _0_1; |
|
1647 |
t^.Active:= true |
|
1648 |
end; |
|
1649 |
end; |
|
1650 |
t:= t^.NextGear |
|
1651 |
end; |
|
621 | 1652 |
if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
506 | 1653 |
end; |
1654 |
||
371 | 1655 |
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); |
53 | 1656 |
var t: PGearArray; |
371 | 1657 |
i: LongInt; |
38 | 1658 |
begin |
53 | 1659 |
t:= CheckGearsCollision(Ammo); |
351 | 1660 |
i:= t^.Count; |
1506 | 1661 |
|
1861 | 1662 |
Damage:= modifyDamage(Damage); |
1663 |
||
53 | 1664 |
while i > 0 do |
981 | 1665 |
begin |
1666 |
dec(i); |
|
1667 |
if (t^.ar[i]^.State and gstNoDamage) = 0 then |
|
1668 |
case t^.ar[i]^.Kind of |
|
1669 |
gtHedgehog, |
|
1670 |
gtMine, |
|
1671 |
gtTarget, |
|
1672 |
gtCase: begin |
|
1573 | 1673 |
if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; |
1854 | 1674 |
if (not t^.ar[i]^.Invulnerable) then |
2017 | 1675 |
ApplyDamage(t^.ar[i], Damage) |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1676 |
else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1677 |
t^.ar[i]^.State:= t^.ar[i]^.State or gstWinner; |
867 | 1678 |
|
981 | 1679 |
DeleteCI(t^.ar[i]); |
1680 |
t^.ar[i]^.dX:= Ammo^.dX * Power * _0_01; |
|
1681 |
t^.ar[i]^.dY:= Ammo^.dY * Power * _0_01; |
|
1682 |
t^.ar[i]^.Active:= true; |
|
1683 |
t^.ar[i]^.State:= t^.ar[i]^.State or gstMoving; |
|
867 | 1684 |
|
982 | 1685 |
if TestCollisionXwithGear(t^.ar[i], hwSign(t^.ar[i]^.dX)) then |
981 | 1686 |
begin |
1687 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -3, hwSign(t^.ar[i]^.dX)) |
|
1688 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1689 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -2, hwSign(t^.ar[i]^.dX)) |
|
1690 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1691 |
if not (TestCollisionXwithXYShift(t^.ar[i], _0, -1, hwSign(t^.ar[i]^.dX)) |
|
1692 |
or TestCollisionYwithGear(t^.ar[i], -1)) then t^.ar[i]^.Y:= t^.ar[i]^.Y - _1; |
|
1693 |
end; |
|
982 | 1694 |
|
981 | 1695 |
FollowGear:= t^.ar[i] |
1696 |
end; |
|
1697 |
end |
|
1698 |
end; |
|
126 | 1699 |
SetAllToActive |
38 | 1700 |
end; |
1701 |
||
4 | 1702 |
procedure AssignHHCoords; |
955 | 1703 |
var i, t, p, j: LongInt; |
1760 | 1704 |
ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
1705 |
Count: Longword; |
|
4 | 1706 |
begin |
1428 | 1707 |
if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then |
955 | 1708 |
begin |
1709 |
t:= 0; |
|
1428 | 1710 |
TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true); |
955 | 1711 |
for p:= 0 to 1 do |
1712 |
begin |
|
1713 |
with ClansArray[p]^ do |
|
1714 |
for j:= 0 to Pred(TeamsNumber) do |
|
1715 |
with Teams[j]^ do |
|
1716 |
for i:= 0 to cMaxHHIndex do |
|
1717 |
with Hedgehogs[i] do |
|
958 | 1718 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1719 |
begin |
|
1760 | 1720 |
FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil |
1515 | 1721 |
if Gear <> nil then |
1722 |
begin |
|
1784 | 1723 |
Gear^.Pos:= GetRandom(49); |
1515 | 1724 |
Gear^.dX.isNegative:= p = 1; |
1725 |
end |
|
958 | 1726 |
end; |
1760 | 1727 |
t:= LAND_WIDTH div 2 |
955 | 1728 |
end |
1729 |
end else // mix hedgehogs |
|
1730 |
begin |
|
1731 |
Count:= 0; |
|
1732 |
for p:= 0 to Pred(TeamsCount) do |
|
1733 |
with TeamsArray[p]^ do |
|
1734 |
begin |
|
1735 |
for i:= 0 to cMaxHHIndex do |
|
1736 |
with Hedgehogs[i] do |
|
1737 |
if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
|
1738 |
begin |
|
1515 | 1739 |
ar[Count]:= @Hedgehogs[i]; |
955 | 1740 |
inc(Count) |
1741 |
end; |
|
1742 |
end; |
|
1792 | 1743 |
// unC0Rr, while it is true user can watch value on map screen, IMO this (and check above) should be enforced in UI |
1744 |
// - is there a good place to put values for the different widgets to check? Right now they are kind of disconnected. |
|
1965 | 1745 |
//it would be nice if divide teams, forts mode and hh per map could all be checked by the team widget, or maybe disable start button |
1795 | 1746 |
TryDo(Count <= MaxHedgehogs, 'Too many hedgehogs for this map! (max # is ' + inttostr(MaxHedgehogs) + ')', true); |
955 | 1747 |
while (Count > 0) do |
1748 |
begin |
|
1749 |
i:= GetRandom(Count); |
|
1760 | 1750 |
FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH); |
1515 | 1751 |
if ar[i]^.Gear <> nil then |
1752 |
begin |
|
1760 | 1753 |
ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2; |
1776 | 1754 |
ar[i]^.Gear^.Pos:= GetRandom(19) |
1515 | 1755 |
end; |
1776 | 1756 |
ar[i]:= ar[Count - 1]; |
955 | 1757 |
dec(Count) |
1758 |
end |
|
1759 |
end |
|
4 | 1760 |
end; |
1761 |
||
371 | 1762 |
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; |
10 | 1763 |
var t: PGear; |
1764 |
begin |
|
1765 |
t:= GearsList; |
|
1766 |
rX:= sqr(rX); |
|
1767 |
rY:= sqr(rY); |
|
1433 | 1768 |
|
10 | 1769 |
while t <> nil do |
1433 | 1770 |
begin |
1771 |
if (t <> Gear) and (t^.Kind = Kind) then |
|
1772 |
if not((hwSqr(Gear^.X - t^.X) / rX + hwSqr(Gear^.Y - t^.Y) / rY) > _1) then |
|
1773 |
exit(t); |
|
1774 |
t:= t^.NextGear |
|
1775 |
end; |
|
1776 |
||
351 | 1777 |
CheckGearNear:= nil |
15 | 1778 |
end; |
1779 |
||
1433 | 1780 |
{procedure AmmoFlameWork(Ammo: PGear); |
79 | 1781 |
var t: PGear; |
1782 |
begin |
|
1783 |
t:= GearsList; |
|
1784 |
while t <> nil do |
|
1295 | 1785 |
begin |
1786 |
if (t^.Kind = gtHedgehog) and (t^.Y < Ammo^.Y) then |
|
1787 |
if not (hwSqr(Ammo^.X - t^.X) + hwSqr(Ammo^.Y - t^.Y - int2hwFloat(cHHRadius)) * 2 > _2) then |
|
1788 |
begin |
|
2017 | 1789 |
ApplyDamage(t, 5); |
1295 | 1790 |
t^.dX:= t^.dX + (t^.X - Ammo^.X) * _0_02; |
1791 |
t^.dY:= - _0_25; |
|
1792 |
t^.Active:= true; |
|
1793 |
DeleteCI(t); |
|
1794 |
FollowGear:= t |
|
1795 |
end; |
|
1796 |
t:= t^.NextGear |
|
1797 |
end; |
|
1433 | 1798 |
end;} |
79 | 1799 |
|
371 | 1800 |
function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear; |
16 | 1801 |
var t: PGear; |
1802 |
begin |
|
1803 |
t:= GearsList; |
|
1804 |
rX:= sqr(rX); |
|
1805 |
rY:= sqr(rY); |
|
1806 |
while t <> nil do |
|
1515 | 1807 |
begin |
1808 |
if t^.Kind in Kind then |
|
1809 |
if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
|
1810 |
exit(t); |
|
1811 |
t:= t^.NextGear |
|
1812 |
end; |
|
351 | 1813 |
CheckGearsNear:= nil |
16 | 1814 |
end; |
1815 |
||
1816 |
function CountGears(Kind: TGearType): Longword; |
|
1817 |
var t: PGear; |
|
351 | 1818 |
Result: Longword; |
16 | 1819 |
begin |
1820 |
Result:= 0; |
|
1821 |
t:= GearsList; |
|
1822 |
while t <> nil do |
|
1515 | 1823 |
begin |
1824 |
if t^.Kind = Kind then inc(Result); |
|
1825 |
t:= t^.NextGear |
|
1826 |
end; |
|
351 | 1827 |
CountGears:= Result |
16 | 1828 |
end; |
1829 |
||
15 | 1830 |
procedure SpawnBoxOfSmth; |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1831 |
var t: LongInt; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1832 |
i: TAmmoType; |
15 | 1833 |
begin |
614 | 1834 |
if (cCaseFactor = 0) or |
1835 |
(CountGears(gtCase) >= 5) or |
|
1836 |
(getrandom(cCaseFactor) <> 0) then exit; |
|
1295 | 1837 |
|
1948 | 1838 |
FollowGear:= nil; |
1839 |
||
2145 | 1840 |
if shoppa then // FIXME - TEMPORARY REMOVE WHEN CRATE PROBABILITY IS ADDED |
1966 | 1841 |
t:= 7 |
1842 |
else |
|
1843 |
t:= getrandom(20); |
|
1844 |
||
1845 |
//case getrandom(20) of |
|
1846 |
case t of |
|
1861 | 1847 |
0..6: begin |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1848 |
FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
351 | 1849 |
FollowGear^.Health:= 25; |
2143
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1850 |
FollowGear^.Pos:= posCaseHealth; |
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1851 |
AddCaption(GetEventString(eidNewHealthPack), $FFFFFF, capgrpGameState); |
295 | 1852 |
end; |
1861 | 1853 |
7..13: begin |
394
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1854 |
t:= 0; |
4c017ae1226a
- Implement hack to let ammo stores work without needed assistance of frontend
unc0rr
parents:
393
diff
changeset
|
1855 |
for i:= Low(TAmmoType) to High(TAmmoType) do |
1861 | 1856 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
1857 |
inc(t, Ammoz[i].Probability); |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1858 |
if (t > 0) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1859 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1860 |
FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1861 |
t:= GetRandom(t); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1862 |
i:= Low(TAmmoType); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1863 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1864 |
dec(t, Ammoz[i].Probability); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1865 |
while t >= 0 do |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1866 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1867 |
inc(i); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1868 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1869 |
dec(t, Ammoz[i].Probability) |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1870 |
end; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1871 |
FollowGear^.Pos:= posCaseAmmo; |
2143
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1872 |
FollowGear^.State:= Longword(i); |
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1873 |
AddCaption(GetEventString(eidNewAmmoPack), $FFFFFF, capgrpGameState); |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1874 |
end |
295 | 1875 |
end; |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1876 |
14..19: begin |
1861 | 1877 |
t:= 0; |
1878 |
for i:= Low(TAmmoType) to High(TAmmoType) do |
|
1879 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
|
1880 |
inc(t, Ammoz[i].Probability); |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1881 |
if (t > 0) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1882 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1883 |
FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1884 |
t:= GetRandom(t); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1885 |
i:= Low(TAmmoType); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1886 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1887 |
dec(t, Ammoz[i].Probability); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1888 |
while t >= 0 do |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1889 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1890 |
inc(i); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1891 |
if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1892 |
dec(t, Ammoz[i].Probability) |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1893 |
end; |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1894 |
FollowGear^.Pos:= posCaseUtility; |
2143
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1895 |
FollowGear^.State:= Longword(i); |
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2137
diff
changeset
|
1896 |
AddCaption(GetEventString(eidNewUtilityPack), $FFFFFF, capgrpGameState); |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1897 |
end |
1861 | 1898 |
end; |
295 | 1899 |
end; |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1900 |
// handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1901 |
if (FollowGear <> nil) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1902 |
begin |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1903 |
FindPlace(FollowGear, true, 0, LAND_WIDTH); |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1904 |
|
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1905 |
if (FollowGear <> nil) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1906 |
PlaySound(sndReinforce, false, CurrentTeam^.voicepack) |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1863
diff
changeset
|
1907 |
end |
70 | 1908 |
end; |
1909 |
||
1515 | 1910 |
procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
70 | 1911 |
|
1515 | 1912 |
function CountNonZeroz(x, y, r: LongInt): LongInt; |
1913 |
var i: LongInt; |
|
1914 |
Result: LongInt; |
|
1915 |
begin |
|
1916 |
Result:= 0; |
|
1753 | 1917 |
if (y and LAND_HEIGHT_MASK) = 0 then |
1760 | 1918 |
for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
1515 | 1919 |
if Land[y, i] <> 0 then inc(Result); |
1920 |
CountNonZeroz:= Result |
|
1921 |
end; |
|
70 | 1922 |
|
495 | 1923 |
var x: LongInt; |
1515 | 1924 |
y, sy: LongInt; |
1925 |
ar: array[0..511] of TPoint; |
|
1926 |
ar2: array[0..1023] of TPoint; |
|
1927 |
cnt, cnt2: Longword; |
|
1928 |
delta: LongInt; |
|
70 | 1929 |
begin |
386 | 1930 |
delta:= 250; |
1931 |
cnt2:= 0; |
|
16 | 1932 |
repeat |
1515 | 1933 |
x:= Left + LongInt(GetRandom(Delta)); |
1934 |
repeat |
|
1935 |
inc(x, Delta); |
|
1936 |
cnt:= 0; |
|
1939 | 1937 |
if topY > 1024 then |
1938 |
y:= 1024-Gear^.Radius * 2 |
|
1939 |
else |
|
1940 |
y:= topY-Gear^.Radius * 2; |
|
1753 | 1941 |
while y < LAND_HEIGHT do |
1515 | 1942 |
begin |
1943 |
repeat |
|
1944 |
inc(y, 2); |
|
1760 | 1945 |
until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0); |
1515 | 1946 |
|
1947 |
sy:= y; |
|
1948 |
||
1949 |
repeat |
|
1950 |
inc(y); |
|
1760 | 1951 |
until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0); |
1515 | 1952 |
|
1953 |
if (y - sy > Gear^.Radius * 2) |
|
1753 | 1954 |
and (y < LAND_HEIGHT) |
1515 | 1955 |
and (CheckGearsNear(x, y - Gear^.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
1956 |
begin |
|
1957 |
ar[cnt].X:= x; |
|
1958 |
if withFall then ar[cnt].Y:= sy + Gear^.Radius |
|
1959 |
else ar[cnt].Y:= y - Gear^.Radius; |
|
1960 |
inc(cnt) |
|
1961 |
end; |
|
1962 |
||
1963 |
inc(y, 45) |
|
1964 |
end; |
|
1965 |
||
1966 |
if cnt > 0 then |
|
1967 |
with ar[GetRandom(cnt)] do |
|
1968 |
begin |
|
1969 |
ar2[cnt2].x:= x; |
|
1970 |
ar2[cnt2].y:= y; |
|
1971 |
inc(cnt2) |
|
1972 |
end |
|
1973 |
until (x + Delta > Right); |
|
1760 | 1974 |
|
1515 | 1975 |
dec(Delta, 60) |
386 | 1976 |
until (cnt2 > 0) or (Delta < 70); |
1515 | 1977 |
|
386 | 1978 |
if cnt2 > 0 then |
1515 | 1979 |
with ar2[GetRandom(cnt2)] do |
1980 |
begin |
|
1981 |
Gear^.X:= int2hwFloat(x); |
|
1982 |
Gear^.Y:= int2hwFloat(y); |
|
1983 |
{$IFDEF DEBUGFILE} |
|
1984 |
AddFileLog('Assigned Gear coordinates (' + inttostr(x) + ',' + inttostr(y) + ')'); |
|
1985 |
{$ENDIF} |
|
1986 |
end |
|
1987 |
else |
|
1988 |
begin |
|
1989 |
OutError('Can''t find place for Gear', false); |
|
1990 |
DeleteGear(Gear); |
|
1991 |
Gear:= nil |
|
1992 |
end |
|
10 | 1993 |
end; |
1994 |
||
4 | 1995 |
initialization |
1996 |
||
1997 |
finalization |
|
95 | 1998 |
FreeGearsList; |
4 | 1999 |
|
2000 |
end. |