hedgewars/uGearsRender.pas
changeset 13639 73c2a669c1fd
parent 13610 422d6062620a
child 13781 720dc03600c9
equal deleted inserted replaced
13638:35d93b1e7fef 13639:73c2a669c1fd
    35             ar        : array[0..MAXROPEPOINTS] of Tar;
    35             ar        : array[0..MAXROPEPOINTS] of Tar;
    36             rounded   : array[0..MAXROPEPOINTS + 2] of TVertex2f;
    36             rounded   : array[0..MAXROPEPOINTS + 2] of TVertex2f;
    37          end;
    37          end;
    38 procedure RenderGear(Gear: PGear; x, y: LongInt);
    38 procedure RenderGear(Gear: PGear; x, y: LongInt);
    39 procedure RenderGearTimer(Gear: PGear; x, y: LongInt);
    39 procedure RenderGearTimer(Gear: PGear; x, y: LongInt);
       
    40 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt);
    40 procedure DrawHHOrder();
    41 procedure DrawHHOrder();
    41 
    42 
    42 var RopePoints: record
    43 var RopePoints: record
    43                 Count: Longword;
    44                 Count: Longword;
    44                 HookAngle: GLfloat;
    45                 HookAngle: GLfloat;
   257         until (i > cMaxHHIndex);
   258         until (i > cMaxHHIndex);
   258     end
   259     end
   259 
   260 
   260 end;
   261 end;
   261 
   262 
       
   263 // Render some informational GUI next to hedgehog, like fuel and alternate weapon
       
   264 procedure RenderHHGuiExtras(Gear: PGear; ox, oy: LongInt);
       
   265 var HH: PHedgehog;
       
   266     sx, sy: LongInt;
       
   267 begin
       
   268     HH:= Gear^.Hedgehog;
       
   269     sx:= ox + 1; // this offset is very common
       
   270     sy:= oy - 3;
       
   271     if HH^.Unplaced then
       
   272         exit;
       
   273     if (Gear^.State and gstHHDeath) <> 0 then
       
   274         exit;
       
   275     if (Gear^.State and gstHHGone) <> 0 then
       
   276         exit;
       
   277 
       
   278     if ((Gear^.State and gstHHDriven) <> 0) and (CurAmmoGear <> nil) then
       
   279         begin
       
   280         case CurAmmoGear^.Kind of
       
   281             gtJetpack:      begin
       
   282                             if CurAmmoGear^.Tex <> nil then
       
   283                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
   284                             DrawAltWeapon(Gear, sx, sy);
       
   285                             end;
       
   286             gtRope:         DrawAltWeapon(Gear, sx, sy);
       
   287             gtParachute:    DrawAltWeapon(Gear, sx, sy);
       
   288             gtLandGun:      if CurAmmoGear^.Tex <> nil then
       
   289                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
   290             gtFlamethrower: if CurAmmoGear^.Tex <> nil then
       
   291                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
   292             gtIceGun:       if CurAmmoGear^.Tex <> nil then
       
   293                                 DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
   294         end;
       
   295         end;
       
   296 end;
   262 
   297 
   263 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   298 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   264 var i, t: LongInt;
   299 var i, t: LongInt;
   265     amt: TAmmoType;
   300     amt: TAmmoType;
   266     sign, hx, hy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
   301     sign, hx, hy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
   528                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   563                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   529                                     untint
   564                                     untint
   530                                     end
   565                                     end
   531                                 end
   566                                 end
   532                     end;
   567                     end;
   533                     DrawAltWeapon(Gear, ox, oy);
       
   534                     defaultPos:= false
   568                     defaultPos:= false
   535                     end;
   569                     end;
   536                 gtBlowTorch:
   570                 gtBlowTorch:
   537                     begin
   571                     begin
   538                     DrawSpriteRotated(sprBlowTorch, hx, hy, sign, aangle);
   572                     DrawSpriteRotated(sprBlowTorch, hx, hy, sign, aangle);
   648                         if Copy(cLocale, 1, 2) = 'en' then
   682                         if Copy(cLocale, 1, 2) = 'en' then
   649                             DrawSprite(sprCensored, ox - 32, oy - 20, 0);
   683                             DrawSprite(sprCensored, ox - 32, oy - 20, 0);
   650                         end;
   684                         end;
   651                     defaultPos:= false
   685                     defaultPos:= false
   652                     end;
   686                     end;
   653                 gtFlamethrower:
   687                 gtFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   654                     begin
   688                 gtLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   655                     DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   689                 gtIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
   656                     if CurAmmoGear^.Tex <> nil then
       
   657                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
       
   658                     end;
       
   659                 gtLandGun:
       
   660                     begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   661                     if CurAmmoGear^.Tex <> nil then
       
   662                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
       
   663                     end;
       
   664                 gtIceGun:
       
   665                     begin DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
       
   666                     if CurAmmoGear^.Tex <> nil then
       
   667                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
       
   668                     end;
       
   669             end;
   690             end;
   670 
   691 
   671             case CurAmmoGear^.Kind of
   692             case CurAmmoGear^.Kind of
   672                 gtShotgunShot,
   693                 gtShotgunShot,
   673                 gtDEagleShot,
   694                 gtDEagleShot,
  1094                             if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then
  1115                             if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then
  1095                                 DrawSprite(sprJetpack, sx-28, sy-28, 2);
  1116                                 DrawSprite(sprJetpack, sx-28, sy-28, 2);
  1096                             if (CurAmmoGear^.MsgParam and gmRight) <> 0 then
  1117                             if (CurAmmoGear^.MsgParam and gmRight) <> 0 then
  1097                                 DrawSprite(sprJetpack, sx-36, sy-28, 3)
  1118                                 DrawSprite(sprJetpack, sx-36, sy-28, 3)
  1098                             end;
  1119                             end;
  1099                         if CurAmmoGear^.Tex <> nil then
       
  1100                             DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
  1101                         DrawAltWeapon(Gear, sx, sy)
       
  1102                         end;
  1120                         end;
  1103                 gtShover: DrawSpritePivotedF(sprHandBaseball,
  1121                 gtShover: DrawSpritePivotedF(sprHandBaseball,
  1104                     sx + 9 * sign, sy + 2, CurAmmoGear^.Tag, sign, -8, 1, aangle);
  1122                     sx + 9 * sign, sy + 2, CurAmmoGear^.Tag, sign, -8, 1, aangle);
  1105                 gtMinigun: DrawSpritePivotedF(sprMinigun,
  1123                 gtMinigun: DrawSpritePivotedF(sprMinigun,
  1106                     sx + 20 * sign, sy + 4, CurAmmoGear^.Tag, sign, -18, -2, aangle);
  1124                     sx + 20 * sign, sy + 4, CurAmmoGear^.Tag, sign, -18, -2, aangle);
  1427            gtFlame: if Gear^.Tag and 1 = 0 then
  1445            gtFlame: if Gear^.Tag and 1 = 0 then
  1428                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1446                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1429                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
  1447                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
  1430        gtParachute: begin
  1448        gtParachute: begin
  1431                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1449                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1432                     DrawAltWeapon(Gear, x + 1, y - 3)
       
  1433                     end;
  1450                     end;
  1434        gtAirAttack: begin
  1451        gtAirAttack: begin
  1435                     Tint(Gear^.Tint);
  1452                     Tint(Gear^.Tint);
  1436                     DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0);
  1453                     DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0);
  1437                     untint;
  1454                     untint;