# HG changeset patch # User tiyuri@gmail.com # Date 1282766794 -3600 # Node ID 39947624dabb49b143d4c2c27975b34c109658ae # Parent 2416a3f51c77a26ee9667c7867b6d7c26411d836 Some survival mode changes by burp diff -r 2416a3f51c77 -r 39947624dabb hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Wed Aug 25 12:28:37 2010 +0200 +++ b/hedgewars/GSHandlers.inc Wed Aug 25 21:06:34 2010 +0100 @@ -125,13 +125,17 @@ Gear^.State := gstDrowning; Gear^.RenderTimer := false; if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then - Gear^.doStep := @doStepDrowningGear; - if Gear^.Kind = gtHedgehog then - begin - Gear^.State := Gear^.State and (not gstHHDriven); - AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), - cWhiteColor, capgrpMessage); - end; + if Gear^.Kind = gtHedgehog then begin + if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin + ResurrectHedgehog(Gear); + end else begin + Gear^.doStep := @doStepDrowningGear; + Gear^.State := Gear^.State and (not gstHHDriven); + AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + end; + end else begin + Gear^.doStep := @doStepDrowningGear; + end; if hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius then // don't play splash if they are already way past the surface PlaySound(sndSplash) diff -r 2416a3f51c77 -r 39947624dabb hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Wed Aug 25 12:28:37 2010 +0200 +++ b/hedgewars/HHHandlers.inc Wed Aug 25 21:06:34 2010 +0100 @@ -851,10 +851,14 @@ if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then begin - Gear^.State:= Gear^.State or gstHHDeath; - Gear^.doStep:= @doStepHedgehogDead; - // Death message - AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin + ResurrectHedgehog(Gear); + end else begin + Gear^.State:= Gear^.State or gstHHDeath; + Gear^.doStep:= @doStepHedgehogDead; + // Death message + AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); + end; end else begin diff -r 2416a3f51c77 -r 39947624dabb hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Wed Aug 25 12:28:37 2010 +0200 +++ b/hedgewars/uConsts.pas Wed Aug 25 21:06:34 2010 +0100 @@ -184,7 +184,7 @@ PrevTexture, NextTexture: PTexture; end; - THogEffect = (heInvulnerable, hePoisoned); + THogEffect = (heInvulnerable, heResurrectable, hePoisoned); TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); const diff -r 2416a3f51c77 -r 39947624dabb hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Aug 25 12:28:37 2010 +0200 +++ b/hedgewars/uGears.pas Wed Aug 25 21:06:34 2010 +0100 @@ -82,6 +82,7 @@ procedure freeModule; function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; +procedure ResurrectHedgehog(gear: PGear); procedure ProcessGears; procedure EndTurnCleanup; procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); @@ -318,6 +319,9 @@ gear^.Friction:= _0_999; gear^.Angle:= cMaxAngle div 2; gear^.Z:= cHHZ; + if (GameFlags and gfAISurvival) <> 0 then + if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then + PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true; end; gtAmmo_Grenade: begin // bazooka gear^.Radius:= 4; @@ -1539,6 +1543,18 @@ CountGears:= count; end; +procedure ResurrectHedgehog(gear: PGear); +begin + gear^.Health := 100; + gear^.dX := _0; + gear^.dY := _0; + gear^.State := gstWait; + FindPlace(Gear, false, 0, LAND_WIDTH); + RenderHealth(PHedgehog(gear^.Hedgehog)^); + RecountTeamHealth(PHedgehog(gear^.Hedgehog)^.Team); + ScriptCall('onResurrect', gear^.uid); +end; + function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear; begin FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);