hedgewars/uGears.pas
changeset 9 4cbf854ad095
parent 6 9c1f00e7b43e
child 10 edf56dca1587
equal deleted inserted replaced
8:24048039955c 9:4cbf854ad095
   102                                                                doStepUFO,
   102                                                                doStepUFO,
   103                                                                doStepShotgunShot,
   103                                                                doStepShotgunShot,
   104                                                                doStepActionTimer,
   104                                                                doStepActionTimer,
   105                                                                doStepPickHammer,
   105                                                                doStepPickHammer,
   106                                                                doStepRope,
   106                                                                doStepRope,
   107                                                                doStepSmokeTrace
   107                                                                doStepSmokeTrace,
       
   108                                                                doStepExplosion
   108                                                                );
   109                                                                );
   109 
   110 
   110 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   111 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   111 begin
   112 begin
   112 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+')');{$ENDIF}
   113 {$IFDEF DEBUGFILE}AddFileLog('AddGear: ('+inttostr(x)+','+inttostr(y)+')');{$ENDIF}
   168                 Result.HalfWidth:= 10;
   169                 Result.HalfWidth:= 10;
   169                 Result.HalfHeight:= 2;
   170                 Result.HalfHeight:= 2;
   170                 Result.Timer:= 4000
   171                 Result.Timer:= 4000
   171                 end;
   172                 end;
   172   gtSmokeTrace: begin
   173   gtSmokeTrace: begin
   173                 Result.Tag:= 8
   174                 Result.X:= Result.X - 16;
       
   175                 Result.Y:= Result.Y - 16;
       
   176                 Result.State:= 8
   174                 end;
   177                 end;
   175         gtRope: begin
   178         gtRope: begin
   176                 Result.HalfWidth:= 3;
   179                 Result.HalfWidth:= 3;
   177                 Result.HalfHeight:= 3;
   180                 Result.HalfHeight:= 3;
   178                 Result.Friction:= 500;
   181                 Result.Friction:= 500;
   179                 RopePoints.Count:= 0;
   182                 RopePoints.Count:= 0;
       
   183                 end;
       
   184    gtExplosion: begin
       
   185                 Result.X:= Result.X - 25;
       
   186                 Result.Y:= Result.Y - 25;
   180                 end;
   187                 end;
   181      end;
   188      end;
   182 if GearsList = nil then GearsList:= Result
   189 if GearsList = nil then GearsList:= Result
   183                    else begin
   190                    else begin
   184                    GearsList.PrevGear:= Result;
   191                    GearsList.PrevGear:= Result;
   404                                  Surface);
   411                                  Surface);
   405     gtAmmo_Grenade: DrawSprite(sprGrenade , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   412     gtAmmo_Grenade: DrawSprite(sprGrenade , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   406        gtHealthTag: DrawCaption(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, PHedgehog(Gear.Hedgehog).HealthTagRect, Surface, true);
   413        gtHealthTag: DrawCaption(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, PHedgehog(Gear.Hedgehog).HealthTagRect, Surface, true);
   407            gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface);
   414            gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface);
   408              gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   415              gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   409       gtSmokeTrace: if Gear.Tag < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, Gear.Tag, Surface);
   416       gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
   410             gtRope: begin
   417             gtRope: begin
   411                     DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy,
   418                     DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy,
   412                                  Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy);
   419                                  Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy);
   413                     if RopePoints.Count > 0 then
   420                     if RopePoints.Count > 0 then
   414                        begin
   421                        begin
   423                                     Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy);
   430                                     Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy);
   424                        DrawSprite(sprRopeHook, Round(RopePoints.ar[0].X) + WorldDx - 16, Round(RopePoints.ar[0].Y) + WorldDy - 16, RopePoints.HookAngle, Surface);
   431                        DrawSprite(sprRopeHook, Round(RopePoints.ar[0].X) + WorldDx - 16, Round(RopePoints.ar[0].Y) + WorldDy - 16, RopePoints.HookAngle, Surface);
   425                        end else
   432                        end else
   426                        DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   433                        DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   427                     end;
   434                     end;
       
   435        gtExplosion: DrawSprite(sprExplosion50, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
   428               end;
   436               end;
   429       Gear:= Gear.NextGear
   437       Gear:= Gear.NextGear
   430       end;
   438       end;
   431 end;
   439 end;
   432 
   440 
   457     dmg: integer;
   465     dmg: integer;
   458 begin
   466 begin
   459 TargetPoint.X:= NoPointX;
   467 TargetPoint.X:= NoPointX;
   460 {$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
   468 {$IFDEF DEBUGFILE}if Radius > 3 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
   461 DrawExplosion(X, Y, Radius);
   469 DrawExplosion(X, Y, Radius);
       
   470 if Radius = 50 then AddGear(X, Y, gtExplosion, 0);
   462 if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion);
   471 if (Mask and EXPLAutoSound)<>0 then PlaySound(sndExplosion);
   463 if (Mask and EXPLNoDamage)<>0 then exit;
   472 if (Mask and EXPLNoDamage)<>0 then exit;
   464 if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1;
   473 if (Mask and EXPLAllDamageInRadius)=0 then Radius:= Radius shl 1;
   465 Gear:= GearsList;
   474 Gear:= GearsList;
   466 while Gear <> nil do
   475 while Gear <> nil do