hedgewars/GSHandlers.inc
changeset 7730 2013733f9ca9
parent 7729 c374746bb56e
child 7733 a1476c09403f
equal deleted inserted replaced
7729:c374746bb56e 7730:2013733f9ca9
  5194         Gear^.Timer:= 0
  5194         Gear^.Timer:= 0
  5195         end;
  5195         end;
  5196     exit
  5196     exit
  5197     end;
  5197     end;
  5198 
  5198 
  5199 // Search out a new target, as target seek time has expired, target is dead, target is out of range, or we didn't have a target
  5199 // Search out a new target, as target seek time has expired, target is dead, target is out of range, or we did not have a target
  5200 if (HHGear = nil) or (Gear^.Timer = 0) or 
  5200 if (HHGear = nil) or (Gear^.Timer = 0) or 
  5201    (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) >  Gear^.Angle) and
  5201    (((abs(HHGear^.X.Round-Gear^.X.Round) + abs(HHGear^.Y.Round-Gear^.Y.Round) + 2) >  Gear^.Angle) and
  5202         (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle)))
  5202         (Distance(HHGear^.X-Gear^.X,HHGear^.Y-Gear^.Y) > int2hwFloat(Gear^.Angle)))
  5203     then
  5203     then
  5204     begin
  5204     begin
  5242             end
  5242             end
  5243         end;
  5243         end;
  5244     end;
  5244     end;
  5245 end;
  5245 end;
  5246 
  5246 
  5247 /* Yay. More incomplete code.
  5247 ////////////////////////////////////////////////////////////////////////////////
       
  5248 // Make the knife initial angle based on the hog attack angle, or is that too hard?
       
  5249 procedure doStepKnife(Gear: PGear);
       
  5250 var t, ox, oy, w, h, cx, cy, tx, ty, hx, hy : LongInt;
       
  5251 begin
       
  5252     doStepFallingGear(Gear);
       
  5253     with Gear^ do
       
  5254         begin
       
  5255         if State and gstCollision <> 0 then
       
  5256             begin
       
  5257 (* Yay. More incomplete code.
  5248 This is the set of postions for the knife.
  5258 This is the set of postions for the knife.
  5249 Using FlipSurface and copyToXY the knife can be written to the Land at 32 positions.
  5259 Using FlipSurface and copyToXY the knife can be written to the LandPixels at 32 positions, and an appropriate line drawn in Land.
  5250 0deg
  5260 0deg
  5251 2,5   (x,y offset)
  5261 2,5   (x,y offset)
  5252 25,5  (wXh of clip area)
  5262 25,5  (wXh of clip area)
  5253 2,7   (tip x,y)
  5263 13,2  (centre of mass, relative to the clip)
       
  5264 -13,0 (tip relative to centre of mass)
       
  5265 11,0  (handle relative to centre of mass)
  5254 
  5266 
  5255 11.25deg
  5267 11.25deg
  5256 2,15
  5268 2,15
  5257 24,8
  5269 24,8
  5258 2,22
  5270 13,4
       
  5271 -13,3
       
  5272 10,-3
  5259 
  5273 
  5260 22.5deg
  5274 22.5deg
  5261 2,27
  5275 2,27
  5262 23,12
  5276 23,12
  5263 2,38
  5277 12,6
       
  5278 -12,5
       
  5279 10,-5
  5264 
  5280 
  5265 33.75deg
  5281 33.75deg
  5266 2,43
  5282 2,43
  5267 21,15
  5283 21,15
  5268 2,57
  5284 11,7
       
  5285 -11,7
       
  5286 9,-6
  5269 
  5287 
  5270 45deg
  5288 45deg
  5271 29,8
  5289 29,8
  5272 19,19
  5290 19,19
  5273 29,26
  5291 9,9
       
  5292 -9,8
       
  5293 8,-9
  5274 
  5294 
  5275 56.25deg
  5295 56.25deg
  5276 29,32
  5296 29,32
  5277 15,21
  5297 15,21
  5278 29,52
  5298 7,10
       
  5299 -7,10
       
  5300 7,-10
  5279 
  5301 
  5280 67.5deg
  5302 67.5deg
  5281 51,3
  5303 51,3
  5282 11,23
  5304 11,23
  5283 51,25
  5305 5,11
       
  5306 -5,11
       
  5307 5,-11
  5284 
  5308 
  5285 78.75deg
  5309 78.75deg
  5286 51,34
  5310 51,34
  5287 7,24
  5311 7,24
  5288 51,57    */
  5312 2,11
       
  5313 -2,12
       
  5314 4,-11
       
  5315 *)
       
  5316             DeleteGear(Gear);
       
  5317             exit
       
  5318             end
       
  5319         else
       
  5320             begin
       
  5321             t := hwRound((dX + dY) * _10);
       
  5322             if not dX.isNegative then inc(Angle, t)
       
  5323             else dec(Angle,t);
       
  5324 
       
  5325             if Angle < -2048 then inc(Angle, 4096)
       
  5326             else if 2048 < Angle then dec(Angle, 4096);
       
  5327             DirAngle:= (Angle+2048) / 4096 * 360;
       
  5328             end
       
  5329         end;
       
  5330 end;