hedgewars/uGears.pas
changeset 37 2b7f2a43b999
parent 35 9367f246fb5f
child 38 c1ec4b15d70e
equal deleted inserted replaced
36:a803a00a3272 37:2b7f2a43b999
   108                                                                doStepPickHammer,
   108                                                                doStepPickHammer,
   109                                                                doStepRope,
   109                                                                doStepRope,
   110                                                                doStepSmokeTrace,
   110                                                                doStepSmokeTrace,
   111                                                                doStepExplosion,
   111                                                                doStepExplosion,
   112                                                                doStepMine,
   112                                                                doStepMine,
   113                                                                doStepCase
   113                                                                doStepCase,
       
   114                                                                doStepDEagleShot
   114                                                                );
   115                                                                );
   115 
   116 
   116 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   117 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   117 begin
   118 begin
   118 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+')');{$ENDIF}
   119 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+')');{$ENDIF}
   199                 end;
   200                 end;
   200         gtCase: begin
   201         gtCase: begin
   201                 Result.HalfWidth:= 14;
   202                 Result.HalfWidth:= 14;
   202                 Result.HalfHeight:= 14;
   203                 Result.HalfHeight:= 14;
   203                 Result.Elasticity:= 0.6
   204                 Result.Elasticity:= 0.6
       
   205                 end;
       
   206   gtDEagleShot: begin
       
   207                 Result.HalfWidth:= 1;
       
   208                 Result.HalfHeight:= 1
   204                 end;
   209                 end;
   205      end;
   210      end;
   206 if GearsList = nil then GearsList:= Result
   211 if GearsList = nil then GearsList:= Result
   207                    else begin
   212                    else begin
   208                    GearsList.PrevGear:= Result;
   213                    GearsList.PrevGear:= Result;
   367     procedure DrawRopeLine(X1, Y1, X2, Y2: integer);
   372     procedure DrawRopeLine(X1, Y1, X2, Y2: integer);
   368     const nodlen = 5;
   373     const nodlen = 5;
   369     var i, x, y: integer;
   374     var i, x, y: integer;
   370         t, k, ladd: real;
   375         t, k, ladd: real;
   371     begin
   376     begin
       
   377     if (X1 = X2) and (Y1 = Y2) then
       
   378        begin
       
   379        {$IFDEF DEBUGFILE}AddFileLog('zero length rope line!!!!!');{$ENDIF}
       
   380        exit
       
   381        end;
   372     if abs(X1 - X2) > abs(Y1 - Y2) then
   382     if abs(X1 - X2) > abs(Y1 - Y2) then
   373        begin
   383        begin
   374        if X1 > X2 then
   384        if X1 > X2 then
   375           begin
   385           begin
   376           i:= X1;
   386           i:= X1;
   548 while Gear <> nil do
   558 while Gear <> nil do
   549       begin
   559       begin
   550       if Gear.Kind = gtHedgehog then
   560       if Gear.Kind = gtHedgehog then
   551          begin
   561          begin
   552          GetHHPoint(pX, pY);
   562          GetHHPoint(pX, pY);
       
   563          {$IFDEF DEBUGFILE}AddFileLog('HH at ('+inttostr(pX)+','+inttostr(pY)+')');{$ENDIF}
   553          Gear.X:= pX;
   564          Gear.X:= pX;
   554          Gear.Y:= pY
   565          Gear.Y:= pY
   555          end;
   566          end;
   556       Gear:= Gear.NextGear
   567       Gear:= Gear.NextGear
   557       end
   568       end