hedgewars/uGearsRender.pas
changeset 14995 e796e9a88394
parent 14994 d9de740e194c
child 14998 39dd40aca1b1
equal deleted inserted replaced
14994:d9de740e194c 14995:e796e9a88394
   205     if Gear^.Elasticity.QWordValue > 0 then
   205     if Gear^.Elasticity.QWordValue > 0 then
   206         DrawSpriteRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   206         DrawSpriteRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   207 end;
   207 end;
   208 
   208 
   209 
   209 
   210 procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt);
   210 procedure DrawSelectedWeapon(Gear: PGear; sx, sy: LongInt; isAltWeapon: boolean);
   211 begin
   211 begin
   212 with Gear^.Hedgehog^ do
   212 with Gear^.Hedgehog^ do
   213     begin
   213     begin
   214     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
   214     if ((Gear^.State and gstAttacked) <> 0) then
   215         exit;
   215         exit;
       
   216     if (isAltWeapon and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0)) then
       
   217         exit;
       
   218     if (not isAltWeapon) and (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_ShowSelIcon) = 0) or (
       
   219             (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) = 0) and ((Gear^.State and gstMoving) <> 0)))) then
       
   220         exit;
       
   221     if (not isAltWeapon) then
       
   222         begin
       
   223         sy:= sy - 64;
       
   224         if (IsHogFacingLeft(Gear)) then
       
   225             sx:= sx - 61;
       
   226         end;
   216     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   227     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   217     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   228     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   218     end;
   229     end;
   219 end;
   230 end;
   220 
   231 
   340                                     ((cWaterLine < (hwRound(Gear^.Y) + Gear^.Radius - 16)) or
   351                                     ((cWaterLine < (hwRound(Gear^.Y) + Gear^.Radius - 16)) or
   341                                     ((WorldEdge = weSea) and ((hwRound(Gear^.X) < LeftX) or (hwRound(Gear^.X) > RightX)))) then
   352                                     ((WorldEdge = weSea) and ((hwRound(Gear^.X) < LeftX) or (hwRound(Gear^.X) > RightX)))) then
   342                                 DrawSprite(sprJetpack, sx-32, sy-32, 4);
   353                                 DrawSprite(sprJetpack, sx-32, sy-32, 4);
   343                             if CurAmmoGear^.Tex <> nil then
   354                             if CurAmmoGear^.Tex <> nil then
   344                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   355                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   345                             DrawAltWeapon(Gear, sx, sy);
   356                             DrawSelectedWeapon(Gear, sx, sy, true);
   346                             end;
   357                             end;
   347             gtRope:         DrawAltWeapon(Gear, sx, sy);
   358             gtRope:         DrawSelectedWeapon(Gear, sx, sy, true);
   348             gtParachute:    DrawAltWeapon(Gear, sx, sy);
   359             gtParachute:    DrawSelectedWeapon(Gear, sx, sy, true);
   349             gtLandGun:      if CurAmmoGear^.Tex <> nil then
   360             gtLandGun:      if CurAmmoGear^.Tex <> nil then
   350                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   361                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   351             gtFlamethrower: if CurAmmoGear^.Tex <> nil then
   362             gtFlamethrower: if CurAmmoGear^.Tex <> nil then
   352                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   363                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   353             gtIceGun:       if CurAmmoGear^.Tex <> nil then
   364             gtIceGun:       if CurAmmoGear^.Tex <> nil then
   354                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   365                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
   355         end;
   366         end;
   356         end;
   367         end
       
   368     else if ((Gear^.State and gstHHDriven) <> 0) then
       
   369         begin
       
   370         DrawSelectedWeapon(Gear, sx, sy, false);
       
   371         end
   357 end;
   372 end;
   358 
   373 
   359 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   374 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   360 var i, t: LongInt;
   375 var i, t: LongInt;
   361     amt: TAmmoType;
   376     amt: TAmmoType;