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