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