hedgewars/uWorld.pas
changeset 14411 71359339a493
parent 14409 85008b73e118
child 14419 b33d1c694b1d
equal deleted inserted replaced
14410:e72ffa27492d 14411:71359339a493
    61     , uCaptions
    61     , uCaptions
    62     , uCursor
    62     , uCursor
    63     , uCommands
    63     , uCommands
    64     , uTeams
    64     , uTeams
    65     , uDebug
    65     , uDebug
       
    66     , uInputHandler
    66 {$IFDEF USE_VIDEO_RECORDING}
    67 {$IFDEF USE_VIDEO_RECORDING}
    67     , uVideoRec
    68     , uVideoRec
    68 {$ENDIF}
    69 {$ENDIF}
    69     ;
    70     ;
    70 
    71 
   413 const BORDERSIZE = 2;
   414 const BORDERSIZE = 2;
   414 var x, y, i, t, SlotsNumY, SlotsNumX, AMFrame: LongInt;
   415 var x, y, i, t, SlotsNumY, SlotsNumX, AMFrame: LongInt;
   415     STurns: LongInt;
   416     STurns: LongInt;
   416     amSurface: PSDL_Surface;
   417     amSurface: PSDL_Surface;
   417     AMRect: TSDL_Rect;
   418     AMRect: TSDL_Rect;
   418 {$IFDEF USE_AM_NUMCOLUMN}tmpsurf: PSDL_Surface;{$ENDIF}
   419 {$IFDEF USE_AM_NUMCOLUMN}
       
   420     tmpsurf: PSDL_Surface;
       
   421     usesDefaultSlotKeys: boolean;
       
   422 {$ENDIF}
   419 begin
   423 begin
   420     if cOnlyStats then exit(nil);
   424     if cOnlyStats then exit(nil);
   421 
   425 
   422     SlotsNum:= 0;
   426     SlotsNum:= 0;
   423     for i:= 0 to cMaxSlotIndex do
   427     for i:= 0 to cMaxSlotIndex do
   449 
   453 
   450     SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0));
   454     SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0));
   451 
   455 
   452     x:= AMRect.x;
   456     x:= AMRect.x;
   453     y:= AMRect.y;
   457     y:= AMRect.y;
       
   458 {$IFDEF USE_AM_NUMCOLUMN}
       
   459     usesDefaultSlotKeys:= CheckDefaultSlotKeys;
       
   460 {$ENDIF USE_AM_NUMCOLUMN}
   454     for i:= 0 to cMaxSlotIndex do
   461     for i:= 0 to cMaxSlotIndex do
   455         if (i <> cHiddenSlotIndex) and (Ammo^[i, 0].Count > 0) then
   462         if (i <> cHiddenSlotIndex) and (Ammo^[i, 0].Count > 0) then
   456             begin
   463             begin
   457 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   464 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   458             y:= AMRect.y;
   465             y:= AMRect.y;
   459 {$ELSE}
   466 {$ELSE}
   460             x:= AMRect.x;
   467             x:= AMRect.x;
   461 {$ENDIF}
   468 {$ENDIF}
   462 {$IFDEF USE_AM_NUMCOLUMN}
   469 {$IFDEF USE_AM_NUMCOLUMN}
   463             tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F' + IntToStr(i+1)), cWhiteColorChannels);
   470             // Ammo slot number column
       
   471             if usesDefaultSlotKeys then
       
   472                 // F1, F2, F3, F4, ...
       
   473                 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F'+IntToStr(i+1)), cWhiteColorChannels)
       
   474             else
       
   475                 // 1, 2, 3, 4, ...
       
   476                 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i+1)), cWhiteColorChannels);
   464             copyToXY(tmpsurf, amSurface,
   477             copyToXY(tmpsurf, amSurface,
   465                      x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1),
   478                      x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1),
   466                      y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1));
   479                      y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1));
   467 
   480 
   468             SDL_FreeSurface(tmpsurf);
   481             SDL_FreeSurface(tmpsurf);