5072 Gear^.Damage:= t; |
5072 Gear^.Damage:= t; |
5073 FreeTexture(Gear^.Tex); |
5073 FreeTexture(Gear^.Tex); |
5074 Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) + |
5074 Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) + |
5075 '%', cWhiteColor, fntSmall) |
5075 '%', cWhiteColor, fntSmall) |
5076 end; |
5076 end; |
5077 if GameTicks mod 10 = 0 then dec(Gear^.Health); |
5077 if Gear^.Message and (gmUp or gmDown) <> 0 then |
|
5078 begin |
|
5079 if GameTicks mod 40 = 0 then dec(Gear^.Health) |
|
5080 end |
|
5081 else if GameTicks mod 10 = 0 then dec(Gear^.Health); |
5078 end; |
5082 end; |
5079 |
5083 |
5080 |
5084 |
5081 procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
5085 procedure updateTarget(Gear:PGear; newX, newY:HWFloat); |
5082 // var |
5086 // var |
5117 const iceHeight = 40; |
5121 const iceHeight = 40; |
5118 var |
5122 var |
5119 HHGear: PGear; |
5123 HHGear: PGear; |
5120 landRect: TSDL_Rect; |
5124 landRect: TSDL_Rect; |
5121 ndX, ndY: hwFloat; |
5125 ndX, ndY: hwFloat; |
5122 i, t, gX, gY: LongInt; |
5126 i, j, t, gX, gY: LongInt; |
5123 hogs: PGearArrayS; |
5127 hogs: PGearArrayS; |
|
5128 vg: PVisualGear; |
5124 begin |
5129 begin |
5125 HHGear := Gear^.Hedgehog^.Gear; |
5130 HHGear := Gear^.Hedgehog^.Gear; |
5126 if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5131 if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5127 begin |
5132 begin |
5128 DeleteGear(Gear); |
5133 DeleteGear(Gear); |
5129 AfterAttack; |
5134 AfterAttack; |
5130 exit |
5135 exit |
5131 end |
5136 end; |
5132 else if Gear^.Message and (gmUp or gmDown) = 0 then updateFuel(Gear); |
5137 updateFuel(Gear); |
5133 |
5138 |
5134 with Gear^ do |
5139 with Gear^ do |
5135 begin |
5140 begin |
5136 HedgehogChAngle(HHGear); |
5141 HedgehogChAngle(HHGear); |
5137 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5142 ndX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _4; |
5195 begin |
5200 begin |
5196 DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); |
5201 DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); |
5197 SetAllHHToActive; |
5202 SetAllHHToActive; |
5198 Timer := iceWaitCollision; |
5203 Timer := iceWaitCollision; |
5199 end; |
5204 end; |
|
5205 (* |
|
5206 Any ideas for something that would look good here? |
|
5207 if (Target.X <> NoPointX) and ((Timer = iceCollideWithGround) or (Timer = iceCollideWithWater)) and (GameTicks mod max((groundFreezingTime-((GameTicks - Power)*2)),2) = 0) then //and CheckLandValue(Target.X, Target.Y, lfIce) then |
|
5208 begin |
|
5209 vg:= AddVisualGear(Target.X+random(20)-10, Target.Y+random(40)-10, vgtDust, 1); |
|
5210 if vg <> nil then |
|
5211 begin |
|
5212 i:= random(100) + 155; |
|
5213 vg^.Tint:= IceColor or $FF; |
|
5214 vg^.Angle:= random(360); |
|
5215 vg^.dx:= 0.001 * random(80); |
|
5216 vg^.dy:= 0.001 * random(80) |
|
5217 end |
|
5218 end; |
|
5219 *) |
5200 |
5220 |
5201 // freeze nearby hogs |
5221 // freeze nearby hogs |
5202 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
5222 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
5203 if hogs.size > 0 then |
5223 if hogs.size > 0 then |
5204 for i:= 0 to hogs.size - 1 do |
5224 for i:= 0 to hogs.size - 1 do |
5220 Target.X:= gX; |
5240 Target.X:= gX; |
5221 Target.Y:= gY; |
5241 Target.Y:= gY; |
5222 X:= HHGear^.X; |
5242 X:= HHGear^.X; |
5223 Y:= HHGear^.Y |
5243 Y:= HHGear^.Y |
5224 end; |
5244 end; |
5225 {if (gX > max(LAND_WIDTH,4096)*2) or |
5245 if (gX > max(LAND_WIDTH,4096)*2) or |
5226 (gX < -max(LAND_WIDTH,4096)) or |
5246 (gX < -max(LAND_WIDTH,4096)) or |
5227 (gY < -max(LAND_HEIGHT,4096)) or |
5247 (gY < -max(LAND_HEIGHT,4096)) or |
5228 (gY > max(LAND_HEIGHT,4096)+512) then |
5248 (gY > max(LAND_HEIGHT,4096)+512) then |
5229 begin |
5249 begin |
5230 X:= HHGear^.X; |
5250 //X:= HHGear^.X; |
5231 Y:= HHGear^.Y |
5251 //Y:= HHGear^.Y |
5232 end} |
5252 Target.X:= gX; |
|
5253 Target.Y:= gY; |
|
5254 end |
5233 end |
5255 end |
5234 end; |
5256 end; |
5235 end; |
5257 end; |
5236 |
5258 |
5237 procedure doStepAddAmmo(Gear: PGear); |
5259 procedure doStepAddAmmo(Gear: PGear); |