hedgewars/uGearsRender.pas
changeset 10866 c1f75780c56f
parent 10848 231d3e3d3267
child 10867 36ca7a39f34d
equal deleted inserted replaced
10865:a587145ced34 10866:c1f75780c56f
    34             HookAngle : GLfloat;
    34             HookAngle : GLfloat;
    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 DrawHHOrder();
    39 
    40 
    40 var RopePoints: record
    41 var RopePoints: record
    41                 Count: Longword;
    42                 Count: Longword;
    42                 HookAngle: GLfloat;
    43                 HookAngle: GLfloat;
    43                 ar: array[0..MAXROPEPOINTS] of record
    44                 ar: array[0..MAXROPEPOINTS] of record
   211     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
   212     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
   212         exit;
   213         exit;
   213     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   214     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   214     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   215     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   215     end;
   216     end;
       
   217 end;
       
   218 
       
   219 procedure DrawHHOrder();
       
   220 var HHGear: PGear;
       
   221     hh: PHedgehog;
       
   222     c, i, t, x, y, sprH, sprW, fSprOff: LongInt;
       
   223 begin
       
   224 t:= LocalTeam;
       
   225 
       
   226 if not CurrentTeam^.ExtDriven then
       
   227     for i:= 0 to Pred(TeamsCount) do
       
   228         if (TeamsArray[i] = CurrentTeam) then
       
   229             t:= i;
       
   230 
       
   231 if TeamsArray[t] <> nil then
       
   232     begin
       
   233     sprH:= SpritesData[sprBigDigit].Height;
       
   234     sprW:= SpritesData[sprBigDigit].Width;
       
   235     fSprOff:= sprW div 4 + SpritesData[sprFrame].Width div 4 - 1; // - 1 for overlap to avoid artifacts
       
   236     i:= 0;
       
   237     c:= 0;
       
   238         repeat
       
   239         hh:= @TeamsArray[t]^.Hedgehogs[i];
       
   240         inc(i);
       
   241         if (hh <> nil) and (hh^.Gear <> nil) then
       
   242             begin
       
   243             inc(c);
       
   244             HHGear:= hh^.Gear;
       
   245             x:= hwRound(HHGear^.X) + WorldDx;
       
   246             y:= hwRound(HHGear^.Y) + WorldDy - 2;
       
   247             if (SpeechHogNumber <> c) or ((RealTicks and 512) < 256) then
       
   248                 begin
       
   249                 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x - fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
       
   250                 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
       
   251                 DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH);
       
   252                 end
       
   253             else
       
   254                 DrawCircle(x, y, 20, 3, 0, $FF, 0, $60);
       
   255             end;
       
   256         until (i > cMaxHHIndex);
       
   257     end
       
   258 
   216 end;
   259 end;
   217 
   260 
   218 
   261 
   219 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   262 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   220 var i, t: LongInt;
   263 var i, t: LongInt;