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