hedgewars/uWorld.pas
changeset 6918 13d6cce2056c
parent 6899 c3d44a836086
child 6924 57b66ee3bff3
equal deleted inserted replaced
6917:4889c2b779b4 6918:13d6cce2056c
   422             y:= AMRect.y;
   422             y:= AMRect.y;
   423 {$ELSE}
   423 {$ELSE}
   424             x:= AMRect.x;
   424             x:= AMRect.x;
   425 {$ENDIF}
   425 {$ENDIF}
   426 {$IFDEF USE_AM_NUMCOLUMN}
   426 {$IFDEF USE_AM_NUMCOLUMN}
   427             tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F' + IntToStr(i)), cWhiteColorChannels);
   427             tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F' + IntToStr(i+1)), cWhiteColorChannels);
   428             copyToXY(tmpsurf, amSurface,
   428             copyToXY(tmpsurf, amSurface,
   429                      x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1),
   429                      x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1),
   430                      y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1));
   430                      y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1));
   431 
   431 
   432             SDL_FreeSurface(tmpsurf);
   432             SDL_FreeSurface(tmpsurf);
   501     Ammo: PHHAmmo;
   501     Ammo: PHHAmmo;
   502     c,i,g,t,STurns: LongInt;
   502     c,i,g,t,STurns: LongInt;
   503 begin
   503 begin
   504 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil)
   504 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil)
   505 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   505 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   506 bShowAmmoMenu:= false;
   506     bShowAmmoMenu:= false;
   507 
       
   508 
   507 
   509 // give the assigned ammo to hedgehog
   508 // give the assigned ammo to hedgehog
   510 Ammo:= nil;
   509 Ammo:= nil;
   511 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil)
   510 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil)
   512 and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
   511 and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
   513 Ammo:= CurrentHedgehog^.Ammo
   512     Ammo:= CurrentHedgehog^.Ammo
   514 else if (LocalAmmo <> -1) then
   513 else if (LocalAmmo <> -1) then
   515 Ammo:= GetAmmoByNum(LocalAmmo);
   514     Ammo:= GetAmmoByNum(LocalAmmo);
   516 Pos:= -1;
   515 Pos:= -1;
   517 if Ammo = nil then
   516 if Ammo = nil then
   518 begin
   517     begin
   519 bShowAmmoMenu:= false;
   518     bShowAmmoMenu:= false;
   520 AMState:= AMHidden;
   519     AMState:= AMHidden;
   521 exit
   520     exit
   522 end;
   521     end;
   523 
   522 
   524 //Init the menu 
   523 //Init the menu 
   525 if(AmmoMenuInvalidated) then 
   524 if(AmmoMenuInvalidated) then 
   526     begin
   525     begin
   527     AmmoMenuInvalidated:= false;
   526     AmmoMenuInvalidated:= false;
   618     Tint($FF, $ff, $ff, $ff);
   617     Tint($FF, $ff, $ff, $ff);
   619 
   618 
   620 Pos:= -1;
   619 Pos:= -1;
   621 Slot:= -1;
   620 Slot:= -1;
   622 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   621 {$IFDEF USE_LANDSCAPE_AMMOMENU}
       
   622     {$IFDEF USE_AM_NUMCOLUMN}
       
   623 c:= 0;
       
   624     {$ELSE}
   623 c:= -1;
   625 c:= -1;
       
   626     {$ENDIF}
   624     for i:= 0 to cMaxSlotIndex do
   627     for i:= 0 to cMaxSlotIndex do
   625         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   628         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   626             begin
   629             begin
   627             inc(c);
   630             inc(c);
   628 {$IFDEF USE_AM_NUMCOLUMN}
   631     {$IFDEF USE_AM_NUMCOLUMN}
   629             g:= 1;
   632             g:= 1;
   630 {$ELSE}
   633     {$ELSE}
   631             g:= 0;
   634             g:= 0;
   632 {$ENDIF}
   635     {$ENDIF}
   633             for t:=0 to cMaxSlotAmmoIndex do
   636             for t:=0 to cMaxSlotAmmoIndex do
   634                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   637                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   635                     begin
   638                     begin
   636                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g    * (AMSlotSize+1))) and
   639                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g    * (AMSlotSize+1))) and
   637                        (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
   640                        (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
   648                         end;
   651                         end;
   649                         inc(g);
   652                         inc(g);
   650                    end;
   653                    end;
   651             end;
   654             end;
   652 {$ELSE}
   655 {$ELSE}
   653 {$IFDEF USE_AM_NUMCOLUMN}
   656     {$IFDEF USE_AM_NUMCOLUMN}
       
   657 c:= -1;
       
   658     {$ELSE}
   654 c:= 0;
   659 c:= 0;
   655 {$ELSE}
   660     {$ENDIF}
   656 c:= -1;
       
   657 {$ENDIF}
       
   658     for i:= 0 to cMaxSlotIndex do
   661     for i:= 0 to cMaxSlotIndex do
   659         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   662         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   660             begin
   663             begin
   661             inc(c);
   664             inc(c);
   662 {$IFDEF USE_AM_NUMCOLUMN}
   665     {$IFDEF USE_AM_NUMCOLUMN}
   663             g:= 1;
   666             g:= 1;
   664 {$ELSE}
   667     {$ELSE}
   665             g:= 0;
   668             g:= 0;
   666 {$ENDIF}
   669     {$ENDIF}
   667             for t:=0 to cMaxSlotAmmoIndex do
   670             for t:=0 to cMaxSlotAmmoIndex do
   668                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   671                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   669                     begin
   672                     begin
   670                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c    * (AMSlotSize+1))) and
   673                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( c    * (AMSlotSize+1))) and
   671                        (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and
   674                        (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((c+1) * (AMSlotSize+1))) and