hedgewars/uWorld.pas
changeset 2747 7889a3a9724f
parent 2735 f2008d0ce3f8
child 2762 2fbc8d35eb52
equal deleted inserted replaced
2746:55593f8a490b 2747:7889a3a9724f
    63     fpsTexture: PTexture;
    63     fpsTexture: PTexture;
    64     FPS: Longword;
    64     FPS: Longword;
    65     CountTicks: Longword;
    65     CountTicks: Longword;
    66     SoundTimerTicks: Longword;
    66     SoundTimerTicks: Longword;
    67     prevPoint: TPoint;
    67     prevPoint: TPoint;
       
    68 	amSel: TAmmoType = amNothing;
    68 
    69 
    69 procedure InitWorld;
    70 procedure InitWorld;
    70 var i, t: LongInt;
    71 var i, t: LongInt;
    71     cp: PClan;
    72     cp: PClan;
    72 begin
    73 begin
   181 			end;
   182 			end;
   182 	dec(y, 1);
   183 	dec(y, 1);
   183 	DrawSprite(sprAMBorders, x, y, 0);
   184 	DrawSprite(sprAMBorders, x, y, 0);
   184 
   185 
   185 	if (Pos >= 0) then
   186 	if (Pos >= 0) then
       
   187 		begin
   186 		if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
   188 		if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
   187 		begin
   189 			if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
   188 		DrawTexture(cScreenWidth div 2 - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   190 				begin
   189 
   191 				amSel:= Ammo^[Slot, Pos].AmmoType;
   190 		if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   192 				RenderWeaponTooltip(amSel)
   191 			DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   193 				end;
   192 
   194 			
   193 		if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   195 			DrawTexture(cScreenWidth div 2 - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   194 			begin
   196 
   195 			bShowAmmoMenu:= false;
   197 			if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   196 			SetWeapon(Ammo^[Slot, Pos].AmmoType);
   198 				DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   197 			bSelected:= false;
   199 
   198 			exit
   200 			if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   199 			end;
   201 				begin
   200 		end;
   202 				bShowAmmoMenu:= false;
       
   203 				SetWeapon(Ammo^[Slot, Pos].AmmoType);
       
   204 				bSelected:= false;
       
   205 				FreeWeaponTooltip;
       
   206 				exit
       
   207 				end;
       
   208 		end
       
   209 	else
       
   210 		FreeWeaponTooltip;
       
   211 	
       
   212 	if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
       
   213 		ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, y);
   201 	end;
   214 	end;
   202 
   215 
   203 bSelected:= false;
   216 bSelected:= false;
   204 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   217 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   205 end;
   218 end;
   339 var i, t: LongInt;
   352 var i, t: LongInt;
   340     r: TSDL_Rect;
   353     r: TSDL_Rect;
   341     tdx, tdy: Double;
   354     tdx, tdy: Double;
   342     grp: TCapGroup;
   355     grp: TCapGroup;
   343     s: string[15];
   356     s: string[15];
       
   357 	highlight: Boolean;
   344     offset: LongInt;
   358     offset: LongInt;
   345     scale: GLfloat;
   359     scale: GLfloat;
   346 begin
   360 begin
   347 if ZoomValue < zoom then
   361 if ZoomValue < zoom then
   348 	begin
   362 	begin
   516 					EndTime:= 0
   530 					EndTime:= 0
   517 				end;
   531 				end;
   518 			end;
   532 			end;
   519 
   533 
   520 // Teams Healths
   534 // Teams Healths
       
   535 
   521 for t:= 0 to Pred(TeamsCount) do
   536 for t:= 0 to Pred(TeamsCount) do
   522    with TeamsArray[t]^ do
   537    with TeamsArray[t]^ do
   523       begin
   538       begin
   524       DrawTexture(- NameTagTex^.w - 3, cScreenHeight + DrawHealthY, NameTagTex);
   539 	  highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
   525 
   540 	  
       
   541       if highlight then
       
   542          glColor4f(((Clan^.Color shr 16) and $ff) / $ff, ((Clan^.Color shr 8) and $ff) / $ff, (Clan^.Color and $ff) / $ff, 1);
       
   543       DrawTexture(- NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex);
       
   544   
   526       r.x:= 0;
   545       r.x:= 0;
   527       r.y:= 0;
   546       r.y:= 0;
       
   547 	  
       
   548 	  r.w:= 26;
       
   549 	  r.h:= 19;
       
   550 	  DrawFromRect(-14, cScreenHeight + DrawHealthY, @r, FlagTex);
       
   551 	   
   528       r.w:= 2 + TeamHealthBarWidth;
   552       r.w:= 2 + TeamHealthBarWidth;
   529       r.h:= HealthTex^.h;
   553       r.h:= HealthTex^.h;
   530 
   554       DrawFromRect(14, cScreenHeight + DrawHealthY, @r, HealthTex);
   531       DrawFromRect(0, cScreenHeight + DrawHealthY, @r, HealthTex);
       
   532 
   555 
   533       inc(r.x, cTeamHealthWidth + 2);
   556       inc(r.x, cTeamHealthWidth + 2);
   534       r.w:= 3;
   557       r.w:= 3;
   535 
   558 
   536       DrawFromRect(TeamHealthBarWidth + 2, cScreenHeight + DrawHealthY, @r, HealthTex);
   559       DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex);
       
   560       if highlight then // if highlighted, draw flag again to keep its colors
       
   561          begin
       
   562          r.x:= 2;
       
   563          r.y:= 2;
       
   564          r.w:= 22;
       
   565          r.h:= 15;
       
   566          glColor4f(1, 1, 1, 1);
       
   567          DrawFromRect(-12, cScreenHeight + DrawHealthY + 2, @r, FlagTex);
       
   568          end;
   537       end;
   569       end;
   538 
   570 
   539 // Lag alert
   571 // Lag alert
   540 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   572 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   541 
   573