45 |
45 |
46 |
46 |
47 implementation |
47 implementation |
48 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
48 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
49 uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
49 uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
50 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug; |
50 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture; |
51 |
51 |
52 |
52 |
53 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
53 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward; |
54 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward; |
54 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward; |
55 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
55 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
218 gear^.nImpactSounds:= 1; |
219 gear^.nImpactSounds:= 1; |
219 gear^.AdvBounce:= 1; |
220 gear^.AdvBounce:= 1; |
220 gear^.Radius:= 5; |
221 gear^.Radius:= 5; |
221 gear^.Elasticity:= _0_8; |
222 gear^.Elasticity:= _0_8; |
222 gear^.Friction:= _0_8; |
223 gear^.Friction:= _0_8; |
|
224 gear^.Density:= _1_5; |
223 gear^.RenderTimer:= true; |
225 gear^.RenderTimer:= true; |
224 if gear^.Timer = 0 then gear^.Timer:= 3000 |
226 if gear^.Timer = 0 then gear^.Timer:= 3000 |
225 end; |
227 end; |
226 gtWatermelon: begin |
228 gtWatermelon: begin |
227 gear^.ImpactSound:= sndMelonImpact; |
229 gear^.ImpactSound:= sndMelonImpact; |
228 gear^.nImpactSounds:= 1; |
230 gear^.nImpactSounds:= 1; |
229 gear^.AdvBounce:= 1; |
231 gear^.AdvBounce:= 1; |
230 gear^.Radius:= 6; |
232 gear^.Radius:= 6; |
231 gear^.Elasticity:= _0_8; |
233 gear^.Elasticity:= _0_8; |
232 gear^.Friction:= _0_995; |
234 gear^.Friction:= _0_995; |
|
235 gear^.Density:= _2; |
233 gear^.RenderTimer:= true; |
236 gear^.RenderTimer:= true; |
234 if gear^.Timer = 0 then gear^.Timer:= 3000 |
237 if gear^.Timer = 0 then gear^.Timer:= 3000 |
|
238 end; |
|
239 gtMelonPiece: begin |
|
240 gear^.Density:= _2; |
235 end; |
241 end; |
236 gtHedgehog: begin |
242 gtHedgehog: begin |
237 gear^.AdvBounce:= 1; |
243 gear^.AdvBounce:= 1; |
238 gear^.Radius:= cHHRadius; |
244 gear^.Radius:= cHHRadius; |
239 gear^.Elasticity:= _0_35; |
245 gear^.Elasticity:= _0_35; |
240 gear^.Friction:= _0_999; |
246 gear^.Friction:= _0_999; |
241 gear^.Angle:= cMaxAngle div 2; |
247 gear^.Angle:= cMaxAngle div 2; |
|
248 gear^.Density:= _3; |
242 gear^.Z:= cHHZ; |
249 gear^.Z:= cHHZ; |
243 if (GameFlags and gfAISurvival) <> 0 then |
250 if (GameFlags and gfAISurvival) <> 0 then |
244 if gear^.Hedgehog^.BotLevel > 0 then |
251 if gear^.Hedgehog^.BotLevel > 0 then |
245 gear^.Hedgehog^.Effects[heResurrectable] := true; |
252 gear^.Hedgehog^.Effects[heResurrectable] := true; |
246 end; |
253 end; |
247 gtShell: begin |
254 gtShell: begin |
248 gear^.Radius:= 4; |
255 gear^.Radius:= 4; |
|
256 gear^.Density:= _1; |
249 end; |
257 end; |
250 gtSnowball: begin |
258 gtSnowball: begin |
251 gear^.Radius:= 4; |
259 gear^.Radius:= 4; |
252 gear^.Elasticity:= _1; |
260 gear^.Elasticity:= _1; |
253 gear^.Friction:= _1; |
261 gear^.Friction:= _1; |
|
262 gear^.Density:= _0_5; |
|
263 end; |
|
264 |
|
265 gtFlake: begin |
|
266 with Gear^ do |
|
267 begin |
|
268 DirAngle:= random * 360; |
|
269 dx.isNegative:= GetRandom(2) = 0; |
|
270 dx.QWordValue:= GetRandom(100000000); |
|
271 dy.isNegative:= false; |
|
272 dy.QWordValue:= GetRandom(70000000); |
|
273 if GetRandom(2) = 0 then dx := -dx; |
|
274 Health:= random(vobFrameTicks); |
|
275 Timer:= random(vobFramesCount); |
|
276 Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity |
|
277 end |
254 end; |
278 end; |
255 gtGrave: begin |
279 gtGrave: begin |
256 gear^.ImpactSound:= sndGraveImpact; |
280 gear^.ImpactSound:= sndGraveImpact; |
257 gear^.nImpactSounds:= 1; |
281 gear^.nImpactSounds:= 1; |
258 gear^.Radius:= 10; |
282 gear^.Radius:= 10; |
286 gear^.Health:= 10; |
310 gear^.Health:= 10; |
287 gear^.State:= gear^.State or gstMoving; |
311 gear^.State:= gear^.State or gstMoving; |
288 gear^.Radius:= 2; |
312 gear^.Radius:= 2; |
289 gear^.Elasticity:= _0_55; |
313 gear^.Elasticity:= _0_55; |
290 gear^.Friction:= _0_995; |
314 gear^.Friction:= _0_995; |
|
315 gear^.Density:= _0_9; |
291 if cMinesTime < 0 then |
316 if cMinesTime < 0 then |
292 gear^.Timer:= getrandom(51)*100 |
317 gear^.Timer:= getrandom(51)*100 |
293 else |
318 else |
294 gear^.Timer:= cMinesTime; |
319 gear^.Timer:= cMinesTime; |
295 end; |
320 end; |
297 gear^.Health:= 10; |
322 gear^.Health:= 10; |
298 gear^.State:= gear^.State or gstMoving; |
323 gear^.State:= gear^.State or gstMoving; |
299 gear^.Radius:= 2; |
324 gear^.Radius:= 2; |
300 gear^.Elasticity:= _0_55; |
325 gear^.Elasticity:= _0_55; |
301 gear^.Friction:= _0_995; |
326 gear^.Friction:= _0_995; |
|
327 gear^.Density:= _0_9; |
302 gear^.Timer:= 500; |
328 gear^.Timer:= 500; |
303 end; |
329 end; |
304 gtCase: begin |
330 gtCase: begin |
305 gear^.ImpactSound:= sndGraveImpact; |
331 gear^.ImpactSound:= sndGraveImpact; |
306 gear^.nImpactSounds:= 1; |
332 gear^.nImpactSounds:= 1; |
325 end; |
352 end; |
326 gtDynamite: begin |
353 gtDynamite: begin |
327 gear^.Radius:= 3; |
354 gear^.Radius:= 3; |
328 gear^.Elasticity:= _0_55; |
355 gear^.Elasticity:= _0_55; |
329 gear^.Friction:= _0_03; |
356 gear^.Friction:= _0_03; |
|
357 gear^.Density:= _2; |
330 gear^.Timer:= 5000; |
358 gear^.Timer:= 5000; |
331 end; |
359 end; |
332 gtCluster: begin |
360 gtCluster: begin |
333 gear^.Radius:= 2; |
361 gear^.Radius:= 2; |
|
362 gear^.Density:= _1_5; |
334 gear^.RenderTimer:= true |
363 gear^.RenderTimer:= true |
335 end; |
364 end; |
336 gtShover: gear^.Radius:= 20; |
365 gtShover: gear^.Radius:= 20; |
337 gtFlame: begin |
366 gtFlame: begin |
338 gear^.Tag:= GetRandom(32); |
367 gear^.Tag:= GetRandom(32); |
339 gear^.Radius:= 1; |
368 gear^.Radius:= 1; |
340 gear^.Health:= 5; |
369 gear^.Health:= 5; |
|
370 gear^.Density:= _1; |
341 if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then |
371 if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then |
342 begin |
372 begin |
343 gear^.dY:= (getrandom - _0_8) * _0_03; |
373 gear^.dY:= (getrandom - _0_8) * _0_03; |
344 gear^.dX:= (getrandom - _0_5) * _0_4 |
374 gear^.dX:= (getrandom - _0_5) * _0_4 |
345 end |
375 end |
389 gear^.nImpactSounds:= 4; |
421 gear^.nImpactSounds:= 4; |
390 gear^.AdvBounce:= 1; |
422 gear^.AdvBounce:= 1; |
391 gear^.Radius:= 4; |
423 gear^.Radius:= 4; |
392 gear^.Elasticity:= _0_5; |
424 gear^.Elasticity:= _0_5; |
393 gear^.Friction:= _0_96; |
425 gear^.Friction:= _0_96; |
|
426 gear^.Density:= _1_5; |
394 gear^.RenderTimer:= true; |
427 gear^.RenderTimer:= true; |
395 gear^.Timer:= 5000 |
428 gear^.Timer:= 5000 |
396 end; |
429 end; |
397 gtDrill: begin |
430 gtDrill: begin |
398 gear^.Timer:= 5000; |
431 gear^.Timer:= 5000; |
399 gear^.Radius:= 4 |
432 gear^.Radius:= 4; |
|
433 gear^.Density:= _1; |
400 end; |
434 end; |
401 gtBall: begin |
435 gtBall: begin |
402 gear^.ImpactSound:= sndGrenadeImpact; |
436 gear^.ImpactSound:= sndGrenadeImpact; |
403 gear^.nImpactSounds:= 1; |
437 gear^.nImpactSounds:= 1; |
404 gear^.AdvBounce:= 1; |
438 gear^.AdvBounce:= 1; |
405 gear^.Radius:= 5; |
439 gear^.Radius:= 5; |
406 gear^.Tag:= random(8); |
440 gear^.Tag:= random(8); |
407 gear^.Timer:= 5000; |
441 gear^.Timer:= 5000; |
408 gear^.Elasticity:= _0_7; |
442 gear^.Elasticity:= _0_7; |
409 gear^.Friction:= _0_995; |
443 gear^.Friction:= _0_995; |
|
444 gear^.Density:= _1_5; |
410 end; |
445 end; |
411 gtBallgun: begin |
446 gtBallgun: begin |
412 gear^.Timer:= 5001; |
447 gear^.Timer:= 5001; |
413 end; |
448 end; |
414 gtRCPlane: begin |
449 gtRCPlane: begin |
880 t: PGear; |
919 t: PGear; |
881 begin |
920 begin |
882 SpeechText:= ''; // in case it has not been consumed |
921 SpeechText:= ''; // in case it has not been consumed |
883 |
922 |
884 if (GameFlags and gfLowGravity) = 0 then |
923 if (GameFlags and gfLowGravity) = 0 then |
|
924 begin |
885 cGravity:= cMaxWindSpeed * 2; |
925 cGravity:= cMaxWindSpeed * 2; |
|
926 cGravityf:= 0.00025 * 2 |
|
927 end; |
886 |
928 |
887 if (GameFlags and gfVampiric) = 0 then |
929 if (GameFlags and gfVampiric) = 0 then |
888 cVampiric:= false; |
930 cVampiric:= false; |
889 |
931 |
890 cDamageModifier:= _1; |
932 cDamageModifier:= _1; |
1055 Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0); |
1097 Gear:= AddGear(0, 0, gtExplosives, 0, _0, _0, 0); |
1056 FindPlace(Gear, false, 0, LAND_WIDTH); |
1098 FindPlace(Gear, false, 0, LAND_WIDTH); |
1057 end; |
1099 end; |
1058 |
1100 |
1059 if (GameFlags and gfLowGravity) <> 0 then |
1101 if (GameFlags and gfLowGravity) <> 0 then |
|
1102 begin |
1060 cGravity:= cMaxWindSpeed; |
1103 cGravity:= cMaxWindSpeed; |
|
1104 cGravityf:= 0.00025 |
|
1105 end; |
1061 |
1106 |
1062 if (GameFlags and gfVampiric) <> 0 then |
1107 if (GameFlags and gfVampiric) <> 0 then |
1063 cVampiric:= true; |
1108 cVampiric:= true; |
1064 |
1109 |
1065 Gear:= GearsList; |
1110 Gear:= GearsList; |
1072 |
1117 |
1073 if (GameFlags and gfLaserSight) <> 0 then |
1118 if (GameFlags and gfLaserSight) <> 0 then |
1074 cLaserSighting:= true; |
1119 cLaserSighting:= true; |
1075 |
1120 |
1076 if (GameFlags and gfArtillery) <> 0 then |
1121 if (GameFlags and gfArtillery) <> 0 then |
1077 cArtillery:= true |
1122 cArtillery:= true; |
|
1123 |
|
1124 if (Theme = 'Snow') or (Theme = 'Christmas') then |
|
1125 for i:= 0 to Pred(vobCount*2) do |
|
1126 AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(1024), gtFlake, 0, _0, _0, 0); |
1078 end; |
1127 end; |
1079 |
1128 |
1080 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
1129 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
1081 begin |
1130 begin |
1082 doMakeExplosion(X, Y, Radius, Mask, $FFFFFFFF); |
1131 doMakeExplosion(X, Y, Radius, Mask, $FFFFFFFF); |