4105 hh: PHedgehog; |
4105 hh: PHedgehog; |
4106 i: LongInt; |
4106 i: LongInt; |
4107 begin |
4107 begin |
4108 AllInactive := false; |
4108 AllInactive := false; |
4109 hh := PHedgehog(Gear^.Hedgehog); |
4109 hh := PHedgehog(Gear^.Hedgehog); |
4110 DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy - |
4110 DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy - |
4111 cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); |
4111 cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex); |
4112 (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, |
4112 (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF, |
4113 $FF);*) |
4113 $FF);*) |
4114 |
4114 |
4115 doStepHedgehogMoving(hh^.Gear); |
4115 if hh^.Gear^.Damage <> 0 then doStepHedgehogMoving(hh^.Gear); |
4116 hh^.Gear^.Y := Gear^.Y; |
|
4117 |
4116 |
4118 if ((Gear^.Message and gmUp) <> 0) then |
4117 if ((Gear^.Message and gmUp) <> 0) then |
4119 begin |
4118 begin |
4120 if (GameTicks and $F) <> 0 then exit; |
4119 if (GameTicks and $F) <> 0 then exit; |
4121 end |
4120 end |
4122 else if (GameTicks and $1FF) <> 0 then exit; |
4121 else if (GameTicks and $1FF) <> 0 then exit; |
4123 |
4122 |
4124 if Gear^.Power < 45 then begin |
4123 if Gear^.Power < 45 then |
|
4124 begin |
4125 inc(Gear^.Power); |
4125 inc(Gear^.Power); |
4126 Gear^.Y := Gear^.Y - _1; |
4126 if not TestCollisionYwithGear(hh^.Gear, -1) then hh^.Gear^.Y := hh^.Gear^.Y - _1; |
4127 end; |
4127 end; |
4128 |
4128 |
4129 graves := GearsNear(hh^.Gear^.X, hh^.Gear^.Y + int2hwFloat(Gear^.Power), |
4129 graves := GearsNear(Gear^.X, Gear^.Y + int2hwFloat(Gear^.Power), |
4130 gtGrave, Gear^.Radius); |
4130 gtGrave, Gear^.Radius); |
4131 |
4131 |
4132 if Length(graves) = 0 then begin |
4132 if Length(graves) = 0 then |
|
4133 begin |
4133 StopSound(Gear^.SoundChannel); |
4134 StopSound(Gear^.SoundChannel); |
4134 Gear^.Timer := 250; |
4135 Gear^.Timer := 250; |
4135 Gear^.doStep := @doStepIdle; |
4136 Gear^.doStep := @doStepIdle; |
4136 exit; |
4137 exit; |
4137 end; |
4138 end; |
4138 |
4139 |
4139 if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then begin |
4140 if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then |
|
4141 begin |
4140 i := getRandom(Length(graves)); |
4142 i := getRandom(Length(graves)); |
4141 dec(hh^.Gear^.Health); |
4143 dec(hh^.Gear^.Health); |
4142 if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then |
4144 if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then |
4143 hh^.Gear^.Damage:= 1; |
4145 hh^.Gear^.Damage:= 1; |
4144 RenderHealth(hh^); |
4146 RenderHealth(hh^); |
4147 if hh^.Gear^.Health > 0 then begin |
4149 if hh^.Gear^.Health > 0 then begin |
4148 dec(hh^.Gear^.Health); |
4150 dec(hh^.Gear^.Health); |
4149 inc(graves[i]^.Health); |
4151 inc(graves[i]^.Health); |
4150 end; |
4152 end; |
4151 end; -} |
4153 end; -} |
4152 end else begin |
4154 end |
|
4155 else |
|
4156 begin |
4153 // now really resurrect the hogs with the hp saved in the graves |
4157 // now really resurrect the hogs with the hp saved in the graves |
4154 for i:= 0 to High(graves) do |
4158 for i:= 0 to High(graves) do |
4155 if graves[i]^.Health > 0 then begin |
4159 if graves[i]^.Health > 0 then |
|
4160 begin |
4156 resgear := AddGear(hwRound(graves[i]^.X), hwRound(graves[i]^.Y), |
4161 resgear := AddGear(hwRound(graves[i]^.X), hwRound(graves[i]^.Y), |
4157 gtHedgehog, gstWait, _0, _0, 0); |
4162 gtHedgehog, gstWait, _0, _0, 0); |
4158 resgear^.Hedgehog := graves[i]^.Hedgehog; |
4163 resgear^.Hedgehog := graves[i]^.Hedgehog; |
4159 resgear^.Health := graves[i]^.Health; |
4164 resgear^.Health := graves[i]^.Health; |
4160 PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear; |
4165 PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear; |
4167 FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex); |
4172 FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex); |
4168 PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex( |
4173 PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex( |
4169 LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone), |
4174 LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone), |
4170 True) |
4175 True) |
4171 end |
4176 end |
4172 end; |
4177 end; |
4173 |
4178 |
4174 hh^.Gear^.dY := _0; |
4179 doStepHedgehogMoving(hh^.Gear); |
4175 StopSound(Gear^.SoundChannel); |
4180 StopSound(Gear^.SoundChannel); |
4176 Gear^.Timer := 250; |
4181 Gear^.Timer := 250; |
4177 Gear^.doStep := @doStepIdle; |
4182 Gear^.doStep := @doStepIdle; |
4178 end; |
4183 end |
4179 //if hh^.Gear^.Health = 0 then doStepHedgehogFree(hh^.Gear); |
4184 //if hh^.Gear^.Health = 0 then doStepHedgehogFree(hh^.Gear); |
4180 end; |
4185 end; |
4181 |
4186 |
4182 procedure doStepResurrector(Gear: PGear); |
4187 procedure doStepResurrector(Gear: PGear); |
4183 var |
4188 var |
4184 graves: TPGearArray; |
4189 graves: TPGearArray; |
4185 hh: PHedgehog; |
|
4186 i: LongInt; |
4190 i: LongInt; |
4187 begin |
4191 begin |
4188 AllInactive := false; |
4192 AllInactive := false; |
4189 hh := PHedgehog(Gear^.Hedgehog); |
4193 graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius); |
4190 graves := GearsNear(hh^.Gear^.X, hh^.Gear^.Y, gtGrave, Gear^.Radius); |
4194 |
4191 |
4195 if Length(graves) > 0 then |
4192 if Length(graves) > 0 then begin |
4196 begin |
4193 for i:= 0 to High(graves) do begin |
4197 for i:= 0 to High(graves) do |
|
4198 begin |
4194 PHedgehog(graves[i]^.Hedgehog)^.Gear := nil; |
4199 PHedgehog(graves[i]^.Hedgehog)^.Gear := nil; |
4195 graves[i]^.Health := 0; |
4200 graves[i]^.Health := 0; |
4196 end; |
4201 end; |
4197 Gear^.doStep := @doStepResurrectorWork; |
4202 Gear^.doStep := @doStepResurrectorWork; |
4198 end else begin |
4203 end |
|
4204 else |
|
4205 begin |
4199 StopSound(Gear^.SoundChannel); |
4206 StopSound(Gear^.SoundChannel); |
4200 Gear^.Timer := 250; |
4207 Gear^.Timer := 250; |
4201 Gear^.doStep := @doStepIdle; |
4208 Gear^.doStep := @doStepIdle; |
4202 end; |
4209 end |
4203 end; |
4210 end; |
4204 |
4211 |