hedgewars/uStore.pas
changeset 10116 dd27562b6f21
parent 10108 c68cf030eded
child 10120 b7f632c12784
equal deleted inserted replaced
10115:794af9339726 10116:dd27562b6f21
   183 md:= 0;
   183 md:= 0;
   184 {$ENDIF}
   184 {$ENDIF}
   185 for t:= 0 to Pred(TeamsCount) do
   185 for t:= 0 to Pred(TeamsCount) do
   186     with TeamsArray[t]^ do
   186     with TeamsArray[t]^ do
   187         begin
   187         begin
   188         NameTagTex:= RenderStringTexLim(Str2PChar(TeamName), Clan^.Color, Font, cTeamHealthWidth);
   188         NameTagTex:= RenderStringTexLim(TeamName, Clan^.Color, Font, cTeamHealthWidth);
   189         if length(Owner) > 0 then
   189         if length(Owner) > 0 then
   190             OwnerTex:= RenderStringTexLim(Str2PChar(Owner), Clan^.Color, Font, cTeamHealthWidth);
   190             OwnerTex:= RenderStringTexLim(Owner, Clan^.Color, Font, cTeamHealthWidth);
   191 
   191 
   192         r.x:= 0;
   192         r.x:= 0;
   193         r.y:= 0;
   193         r.y:= 0;
   194         r.w:= 32;
   194         r.w:= 32;
   195         r.h:= 32;
   195         r.h:= 32;
   259         DrawHealthY:= drY;
   259         DrawHealthY:= drY;
   260         for i:= 0 to cMaxHHIndex do
   260         for i:= 0 to cMaxHHIndex do
   261             with Hedgehogs[i] do
   261             with Hedgehogs[i] do
   262                 if Gear <> nil then
   262                 if Gear <> nil then
   263                     begin
   263                     begin
   264                     NameTagTex:= RenderStringTexLim(Str2PChar(Name), Clan^.Color, fnt16, cTeamHealthWidth);
   264                     NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth);
   265                     if Hat = 'NoHat' then
   265                     if Hat = 'NoHat' then
   266                         begin
   266                         begin
   267                         if (month = 4) and (md = 20) then
   267                         if (month = 4) and (md = 20) then
   268                             Hat := 'eastertop'   // Easter
   268                             Hat := 'eastertop'   // Easter
   269                         else if (month = 12) and ((md = 24) or (md = 25) or (md = 26)) then
   269                         else if (month = 12) and ((md = 24) or (md = 25) or (md = 26)) then
   436 HHTexture:= Surface2Tex(tmpsurf, false);
   436 HHTexture:= Surface2Tex(tmpsurf, false);
   437 SDL_FreeSurface(tmpsurf);
   437 SDL_FreeSurface(tmpsurf);
   438 
   438 
   439 InitHealth;
   439 InitHealth;
   440 
   440 
   441 PauseTexture:= RenderStringTexPChar(trmsg[sidPaused], cYellowColor, fntBig);
   441 PauseTexture:= RenderStringTex(trmsg[sidPaused], cYellowColor, fntBig);
   442 AFKTexture:= RenderStringTexPChar(trmsg[sidAFK], cYellowColor, fntBig);
   442 AFKTexture:= RenderStringTex(trmsg[sidAFK], cYellowColor, fntBig);
   443 ConfirmTexture:= RenderStringTexPChar(trmsg[sidConfirm], cYellowColor, fntBig);
   443 ConfirmTexture:= RenderStringTex(trmsg[sidConfirm], cYellowColor, fntBig);
   444 SyncTexture:= RenderStringTexPChar(trmsg[sidSync], cYellowColor, fntBig);
   444 SyncTexture:= RenderStringTex(trmsg[sidSync], cYellowColor, fntBig);
   445 
   445 
   446 if not reload then
   446 if not reload then
   447     AddProgress;
   447     AddProgress;
   448 
   448 
   449 // name of weapons in ammo menu
   449 // name of weapons in ammo menu
   450 for ai:= Low(TAmmoType) to High(TAmmoType) do
   450 for ai:= Low(TAmmoType) to High(TAmmoType) do
   451     with Ammoz[ai] do
   451     with Ammoz[ai] do
   452         begin
   452         begin
   453         TryDo(trAmmo[NameId][0] <> #0,'No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
   453         TryDo(trAmmo[NameId] <> '','No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
   454         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, trAmmo[NameId], cWhiteColorChannels);
   454         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, Str2PChar(trAmmo[NameId]), cWhiteColorChannels);
   455         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
   455         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
   456         tmpsurf:= doSurfaceConversion(tmpsurf);
   456         tmpsurf:= doSurfaceConversion(tmpsurf);
   457         FreeTexture(NameTex);
   457         FreeTexture(NameTex);
   458         NameTex:= Surface2Tex(tmpsurf, false);
   458         NameTex:= Surface2Tex(tmpsurf, false);
   459         SDL_FreeSurface(tmpsurf)
   459         SDL_FreeSurface(tmpsurf)
  1236     r, r2: TSDL_Rect;
  1236     r, r2: TSDL_Rect;
  1237     wa, ha: LongInt;
  1237     wa, ha: LongInt;
  1238     tmpline, tmpline2, tmpdesc: ansistring;
  1238     tmpline, tmpline2, tmpdesc: ansistring;
  1239 begin
  1239 begin
  1240 // make sure there is a caption as well as a sub caption - description is optional
  1240 // make sure there is a caption as well as a sub caption - description is optional
  1241 if caption[0] = #0 then
  1241 if caption = '' then
  1242     caption:= Str2PChar(_S'???');
  1242     caption:= '???';
  1243 if subcaption[0] = #0 then
  1243 if subcaption = '' then
  1244     subcaption:= Str2PChar(_S' ');
  1244     subcaption:= _S' ';
  1245 
  1245 
  1246 font:= CheckCJKFont(caption,fnt16);
  1246 font:= CheckCJKFont(caption,fnt16);
  1247 font:= CheckCJKFont(subcaption,font);
  1247 font:= CheckCJKFont(subcaption,font);
  1248 font:= CheckCJKFont(description,font);
  1248 font:= CheckCJKFont(description,font);
  1249 font:= CheckCJKFont(extra,font);
  1249 font:= CheckCJKFont(extra,font);
  1283             w:= i + wa;
  1283             w:= i + wa;
  1284         inc(h, j + ha)
  1284         inc(h, j + ha)
  1285         end
  1285         end
  1286     end;
  1286     end;
  1287 
  1287 
  1288 if extra[0] <> #0 then
  1288 if extra <> '' then
  1289     begin
  1289     begin
  1290     // get extra label's dimensions
  1290     // get extra label's dimensions
  1291     TTF_SizeUTF8(Fontz[font].Handle, extra, @i, @j);
  1291     TTF_SizeUTF8(Fontz[font].Handle, extra, @i, @j);
  1292     if w < (i + wa) then
  1292     if w < (i + wa) then
  1293         w:= i + wa;
  1293         w:= i + wa;
  1330         if tmpline2 <> _S'' then
  1330         if tmpline2 <> _S'' then
  1331             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, Str2PChar(tmpline + ':'));
  1331             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, Str2PChar(tmpline + ':'));
  1332         end
  1332         end
  1333     end;
  1333     end;
  1334 
  1334 
  1335 if extra[0] <> #0 then
  1335 if extra <> '' then
  1336     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, extra);
  1336     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, extra);
  1337 
  1337 
  1338 r.x:= cFontBorder + 6;
  1338 r.x:= cFontBorder + 6;
  1339 r.y:= cFontBorder + 4;
  1339 r.y:= cFontBorder + 4;
  1340 r.w:= 32;
  1340 r.w:= 32;
  1368 r.y:= (i mod 16) * 32;
  1368 r.y:= (i mod 16) * 32;
  1369 r.w:= 32;
  1369 r.w:= 32;
  1370 r.h:= 32;
  1370 r.h:= 32;
  1371 
  1371 
  1372 // default (no extra text)
  1372 // default (no extra text)
  1373 extra:= Str2PChar(''); // conversion because pas2c ain't smart enough yet
  1373 extra:= _S'';
  1374 extracolor:= 0;
  1374 extracolor:= 0;
  1375 
  1375 
  1376 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1376 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1377     begin
  1377     begin
  1378     extra:= trmsg[sidNotYetAvailable];
  1378     extra:= trmsg[sidNotYetAvailable];
  1383     extra:= trmsg[sidNoEndTurn];
  1383     extra:= trmsg[sidNoEndTurn];
  1384     extracolor:= LongInt($ff70c770);
  1384     extracolor:= LongInt($ff70c770);
  1385     end
  1385     end
  1386 else
  1386 else
  1387     begin
  1387     begin
  1388     extra:= Str2PChar(''); // conversion because pas2c ain't smart enough yet
  1388     extra:= _S'';
  1389     extracolor:= 0;
  1389     extracolor:= 0;
  1390     end;
  1390     end;
  1391 
  1391 
  1392 // render window and return the texture
  1392 // render window and return the texture
  1393 WeaponTooltipTex:= RenderHelpWindow(trammo[Ammoz[atype].NameId], trammoc[Ammoz[atype].NameId], trammod[Ammoz[atype].NameId], extra, extracolor, SpritesData[sprAMAmmos].Surface, @r)
  1393 WeaponTooltipTex:= RenderHelpWindow(trammo[Ammoz[atype].NameId], trammoc[Ammoz[atype].NameId], trammod[Ammoz[atype].NameId], extra, extracolor, SpritesData[sprAMAmmos].Surface, @r)