hedgewars/uVisualGearsList.pas
changeset 11880 2eac7a96b342
parent 11857 cb137eb71556
child 12110 f214d6315b71
equal deleted inserted replaced
11879:c6eafb6f2735 11880:2eac7a96b342
    34 
    34 
    35 var VGCounter: LongWord;
    35 var VGCounter: LongWord;
    36     VisualGearLayers: array[0..6] of PVisualGear;
    36     VisualGearLayers: array[0..6] of PVisualGear;
    37 
    37 
    38 implementation
    38 implementation
    39 uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers;
    39 uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers, uScript;
    40 
    40 
    41 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
    41 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
    42 begin
    42 begin
    43     // adjust some visual gear types if underwater
    43     // adjust some visual gear types if underwater
    44     if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then
    44     if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then
   435     gear^.NextGear:= VisualGearLayers[gear^.Layer]
   435     gear^.NextGear:= VisualGearLayers[gear^.Layer]
   436     end;
   436     end;
   437 VisualGearLayers[gear^.Layer]:= gear;
   437 VisualGearLayers[gear^.Layer]:= gear;
   438 
   438 
   439 AddVisualGear:= gear;
   439 AddVisualGear:= gear;
       
   440 ScriptCall('onVisualGearAdd', gear^.uid);
   440 end;
   441 end;
   441 
   442 
   442 procedure DeleteVisualGear(Gear: PVisualGear);
   443 procedure DeleteVisualGear(Gear: PVisualGear);
   443 begin
   444 begin
       
   445     ScriptCall('onVisualGearDelete', Gear^.uid);
   444     FreeAndNilTexture(Gear^.Tex);
   446     FreeAndNilTexture(Gear^.Tex);
   445 
   447 
   446     if Gear^.NextGear <> nil then
   448     if Gear^.NextGear <> nil then
   447         Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
   449         Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
   448     if Gear^.PrevGear <> nil then
   450     if Gear^.PrevGear <> nil then