hedgewars/uWorld.pas
changeset 2428 6800f8aa0184
parent 2426 9d674c5c828d
child 2434 5faa05d99241
equal deleted inserted replaced
2427:241e3bb6a146 2428:6800f8aa0184
    81 procedure ShowAmmoMenu;
    81 procedure ShowAmmoMenu;
    82 const MENUSPEED = 15;
    82 const MENUSPEED = 15;
    83 var x, y, i, t, l, g: LongInt;
    83 var x, y, i, t, l, g: LongInt;
    84     Slot, Pos: LongInt;
    84     Slot, Pos: LongInt;
    85 begin
    85 begin
    86 if (TurnTimeLeft = 0) or (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and KbdKeyPressed) then bShowAmmoMenu:= false;
    86 if (TurnTimeLeft = 0) or (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu) then bShowAmmoMenu:= false;
    87 if bShowAmmoMenu then
    87 if bShowAmmoMenu then
    88    begin
    88    begin
    89    FollowGear:= nil;
    89    FollowGear:= nil;
    90    if AMxShift = 210 then prevPoint.X:= 0;
    90    if AMxShift = 210 then prevPoint.X:= 0;
    91    if cReducedQuality then
    91    if cReducedQuality then
   136 				begin
   136 				begin
   137 				if (Ammo^[i, t].AmmoType <> amNothing) then
   137 				if (Ammo^[i, t].AmmoType <> amNothing) then
   138 					begin
   138 					begin
   139 					l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   139 					l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   140 
   140 
       
   141 					if (TrainingFlags and tfIgnoreDelays) <> 0 then l:= -1;
       
   142 
   141 					if l >= 0 then
   143 					if l >= 0 then
   142 						begin
   144 						begin
   143 						DrawSprite(sprAMAmmosBW, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   145 						DrawSprite(sprAMAmmosBW, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   144 						DrawSprite(sprTurnsLeft, x + g * 33 + 51, y + 17, l);
   146 						DrawSprite(sprTurnsLeft, x + g * 33 + 51, y + 17, l);
   145 						end else
   147 						end else
   166 		DrawTexture(cScreenWidth div 2 - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   168 		DrawTexture(cScreenWidth div 2 - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   167 
   169 
   168 		if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   170 		if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   169 			DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   171 			DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   170 
   172 
   171 		if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   173 		if bSelected and (((TrainingFlags and tfIgnoreDelays) <> 0) or (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0)) then
   172 			begin
   174 			begin
   173 			bShowAmmoMenu:= false;
   175 			bShowAmmoMenu:= false;
   174 			SetWeapon(Ammo^[Slot, Pos].AmmoType);
   176 			SetWeapon(Ammo^[Slot, Pos].AmmoType);
   175 			bSelected:= false;
   177 			bSelected:= false;
   176 			exit
   178 			exit
   414          i:= i div 10
   416          i:= i div 10
   415          end;
   417          end;
   416    DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, cScreenHeight - 48, 0);
   418    DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, cScreenHeight - 48, 0);
   417    end;
   419    end;
   418 
   420 
       
   421 // Timetrial
       
   422 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then
       
   423 	begin
       
   424 	if TimeTrialStopTime = 0 then i:= RealTicks - TimeTrialStartTime else i:= TimeTrialStopTime - TimeTrialStartTime;
       
   425 	t:= 272;
       
   426 	// right frame
       
   427 	DrawSprite(sprFrame, -cScreenWidth div 2 + t, 8, 1);
       
   428     dec(t, 32);
       
   429 	// 1 ms
       
   430     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10); 
       
   431     dec(t, 32);
       
   432 	i:= i div 10;
       
   433 	// 10 ms
       
   434     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
       
   435     dec(t, 32);
       
   436 	i:= i div 10;
       
   437 	// 100 ms
       
   438     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
       
   439 	dec(t, 16);
       
   440 	// Point
       
   441 	DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 11);
       
   442     dec(t, 32);
       
   443 	i:= i div 10;
       
   444 	// 1 s
       
   445     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
       
   446     dec(t, 32);
       
   447 	i:= i div 10;
       
   448 	// 10s
       
   449     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 6);
       
   450 	dec(t, 16);
       
   451 	// Point
       
   452 	DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 10);
       
   453     dec(t, 32);
       
   454 	i:= i div 6;
       
   455 	// 1 m
       
   456     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
       
   457     dec(t, 32);
       
   458 	i:= i div 10;
       
   459 	// 10 m
       
   460     DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
       
   461 	// left frame
       
   462 	DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, 8, 0);
       
   463 	end;
       
   464    
   419 // Captions
   465 // Captions
   420 i:= 8;
   466 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then i:= 48 else i:= 8;
       
   467 
   421 for grp:= Low(TCapGroup) to High(TCapGroup) do
   468 for grp:= Low(TCapGroup) to High(TCapGroup) do
   422     with Captions[grp] do
   469     with Captions[grp] do
   423          if Tex <> nil then
   470          if Tex <> nil then
   424             begin
   471             begin
   425             DrawCentered(0, i, Tex);
   472             DrawCentered(0, i, Tex);
   559 	end;
   606 	end;
   560 end;
   607 end;
   561 
   608 
   562 procedure MoveCamera;
   609 procedure MoveCamera;
   563 const PrevSentPointTime: LongWord = 0;
   610 const PrevSentPointTime: LongWord = 0;
   564 var EdgesDist, cw, wdy: LongInt;
   611 var EdgesDist,  wdy: LongInt;
   565 begin
   612 begin
   566 
       
   567 cw:= round(cScreenWidth / cScaleFactor);
       
   568 
       
   569 if (not (CurrentTeam^.ExtDriven and isCursorVisible)) and cHasFocus then
   613 if (not (CurrentTeam^.ExtDriven and isCursorVisible)) and cHasFocus then
   570 	begin
   614 	begin
   571 {$IFDEF SDL13}
   615 {$IFDEF SDL13}
   572 	SDL_GetMouseState(0, @CursorPoint.X, @CursorPoint.Y);
   616 	SDL_GetMouseState(0, @CursorPoint.X, @CursorPoint.Y);
   573 {$ELSE}
   617 {$ELSE}