5116 |
5115 |
5117 |
5116 |
5118 procedure doStepIceGun(Gear: PGear); |
5117 procedure doStepIceGun(Gear: PGear); |
5119 const iceWaitCollision:Longint = 0; |
5118 const iceWaitCollision:Longint = 0; |
5120 const iceCollideWithGround:Longint = 1; |
5119 const iceCollideWithGround:Longint = 1; |
5121 const iceWaitNextTarget:Longint = 2; |
5120 //const iceWaitNextTarget:Longint = 2; |
5122 const iceCollideWithHog:Longint = 4; |
5121 //const iceCollideWithHog:Longint = 4; |
5123 const iceCollideWithWater:Longint = 5; |
5122 const iceCollideWithWater:Longint = 5; |
5124 const waterFreezingTime:Longint = 500; |
5123 //const waterFreezingTime:Longint = 500; |
5125 const groundFreezingTime:Longint = 1000; |
5124 const groundFreezingTime:Longint = 1000; |
5126 const iceRadius = 32; |
5125 const iceRadius = 32; |
5127 const iceHeight = 40; |
5126 const iceHeight = 40; |
5128 var |
5127 var |
5129 HHGear: PGear; |
5128 HHGear: PGear; |
5130 ndX, ndY: hwFloat; |
5129 ndX, ndY: hwFloat; |
5131 i, t, gX, gY: LongInt; |
5130 i, t, gX, gY: LongInt; |
5132 hogs: PGearArrayS; |
5131 hogs: PGearArrayS; |
5133 begin |
5132 begin |
5134 HHGear := Gear^.Hedgehog^.Gear; |
5133 HHGear := Gear^.Hedgehog^.Gear; |
5135 if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5134 if (Gear^.Message and gmAttack <> 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then |
5136 begin |
5135 begin |
5137 DeleteGear(Gear); |
5136 DeleteGear(Gear); |
5138 AfterAttack; |
5137 AfterAttack; |
5139 exit |
5138 exit |
5140 end |
5139 end |
5148 if (ndX <> dX) or (ndY <> dY) or |
5147 if (ndX <> dX) or (ndY <> dY) or |
5149 ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
5148 ((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and |
5150 (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then |
5149 (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0))) then |
5151 begin |
5150 begin |
5152 updateTarget(Gear, ndX, ndY); |
5151 updateTarget(Gear, ndX, ndY); |
5153 IceState := iceWaitCollision; |
5152 Health := iceWaitCollision; |
5154 end |
5153 end |
5155 else |
5154 else |
5156 begin |
5155 begin |
5157 X:= X + dX; |
5156 X:= X + dX; |
5158 Y:= Y + dY; |
5157 Y:= Y + dY; |
5166 if Target.X <> NoPointX then |
5165 if Target.X <> NoPointX then |
5167 begin |
5166 begin |
5168 CheckCollisionWithLand(Gear); |
5167 CheckCollisionWithLand(Gear); |
5169 if (State and gstCollision) <> 0 then |
5168 if (State and gstCollision) <> 0 then |
5170 begin |
5169 begin |
5171 if IceState = iceWaitCollision then |
5170 if Health = iceWaitCollision then |
5172 begin |
5171 begin |
5173 IceState := iceCollideWithGround; |
5172 Health := iceCollideWithGround; |
5174 IceTime := GameTicks; |
5173 Power := GameTicks; |
5175 end |
5174 end |
5176 end |
5175 end |
5177 else if (target.y >= cWaterLine) then |
5176 else if (target.y >= cWaterLine) then |
5178 begin |
5177 begin |
5179 if IceState = iceWaitCollision then |
5178 if Health = iceWaitCollision then |
5180 begin |
5179 begin |
5181 IceState := iceCollideWithWater; |
5180 Health := iceCollideWithWater; |
5182 IceTime := GameTicks; |
5181 Power := GameTicks; |
5183 end; |
5182 end; |
5184 end; |
5183 end; |
5185 |
5184 |
5186 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5185 if (abs(gX-Target.X) < 2) and (abs(gY-Target.Y) < 2) then |
5187 begin |
5186 begin |
5188 X:= HHGear^.X; |
5187 X:= HHGear^.X; |
5189 Y:= HHGear^.Y |
5188 Y:= HHGear^.Y |
5190 end; |
5189 end; |
5191 |
5190 |
5192 if (IceState = iceCollideWithGround) and ((GameTicks - IceTime) > groundFreezingTime) then |
5191 if (Health = iceCollideWithGround) and ((GameTicks - Power) > groundFreezingTime) then |
5193 begin |
5192 begin |
5194 FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
5193 FillRoundInLandWithIce(Target.X, Target.Y, iceRadius); |
5195 SetAllHHToActive; |
5194 SetAllHHToActive; |
5196 IceState := iceWaitCollision; |
5195 Health := iceWaitCollision; |
5197 end; |
5196 end; |
5198 |
5197 |
5199 if (IceState = iceCollideWithWater) and ((GameTicks - IceTime) > groundFreezingTime) then |
5198 if (Health = iceCollideWithWater) and ((GameTicks - Power) > groundFreezingTime) then |
5200 begin |
5199 begin |
5201 DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); |
5200 DrawIceBreak(Target.X, cWaterLine - iceHeight, iceRadius, iceHeight); |
5202 SetAllHHToActive; |
5201 SetAllHHToActive; |
5203 IceState := iceWaitCollision; |
5202 Health := iceWaitCollision; |
5204 end; |
5203 end; |
5205 |
5204 |
5206 // freeze nearby hogs |
5205 // freeze nearby hogs |
5207 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
5206 hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2); |
5208 if hogs.size > 0 then |
5207 if hogs.size > 0 then |