hedgewars/uStore.pas
branchui-scaling
changeset 15304 c4fd2813b127
parent 13385 ec1491bb5acc
parent 14768 7dfc6ed13337
child 15685 d92eeb468dad
equal deleted inserted replaced
13390:0135e64c6c66 15304:c4fd2813b127
    44 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    44 function  LoadDataImageAltFile(const path: TPathType; const filename, altFile: shortstring; imageFlags: LongInt): PSDL_Surface;
    45 
    45 
    46 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
    46 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
    47 procedure LoadHedgehogHat2(var HH: THedgehog; newHat: shortstring; allowSurfReuse: boolean);
    47 procedure LoadHedgehogHat2(var HH: THedgehog; newHat: shortstring; allowSurfReuse: boolean);
    48 
    48 
       
    49 procedure LoadDefaultClanColors(s: shortstring);
       
    50 
    49 procedure InitZoom(zoom: real);
    51 procedure InitZoom(zoom: real);
    50 
    52 
    51 procedure SetupOpenGL;
    53 procedure SetupOpenGL;
    52 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    54 function  RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture;
    53 procedure RenderWeaponTooltip(atype: TAmmoType);
    55 procedure RenderWeaponTooltip(atype: TAmmoType);
   110 finalRect.w:= w + cFontBorder * 2 + 4;
   112 finalRect.w:= w + cFontBorder * 2 + 4;
   111 finalRect.h:= h + cFontBorder * 2;
   113 finalRect.h:= h + cFontBorder * 2;
   112 clr.r:= Color shr 16;
   114 clr.r:= Color shr 16;
   113 clr.g:= (Color shr 8) and $FF;
   115 clr.g:= (Color shr 8) and $FF;
   114 clr.b:= Color and $FF;
   116 clr.b:= Color and $FF;
       
   117 clr.a:= $FF;
   115 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, s, clr);
   118 tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, s, clr);
   116 if tmpsurf = nil then exit;
   119 if tmpsurf = nil then exit;
   117 tmpsurf:= doSurfaceConversion(tmpsurf);
   120 tmpsurf:= doSurfaceConversion(tmpsurf);
   118 
   121 
   119 if tmpsurf <> nil then
   122 if tmpsurf <> nil then
   275                 if Gear <> nil then
   278                 if Gear <> nil then
   276                     begin
   279                     begin
   277                     if ExtDriven then
   280                     if ExtDriven then
   278                          NameTagTex:= RenderStringTexLim(ansistring(Name), Clan^.Color, fnt16, cTeamHealthWidth)
   281                          NameTagTex:= RenderStringTexLim(ansistring(Name), Clan^.Color, fnt16, cTeamHealthWidth)
   279                     else NameTagTex:= RenderStringTex(ansistring(Name), Clan^.Color, fnt16);
   282                     else NameTagTex:= RenderStringTex(ansistring(Name), Clan^.Color, fnt16);
   280                     if Hat = 'NoHat' then
   283                     if cHolidaySilliness then
   281                         begin
   284                         begin
   282                         if (month = 4) and (md = 20) then
   285                         // Special hats on special days
   283                             Hat := 'eastertop'   // Easter
   286                         if Hat = 'NoHat' then
   284                         else if (month = 12) and ((md = 24) or (md = 25) or (md = 26)) then
   287                             begin
   285                             Hat := 'Santa'       // Christmas Eve/Christmas/Boxing Day
   288                             if (month = 4) and (md = 20) then
   286                         else if (month = 10) and (md = 31) then
   289                                 Hat := 'eastertop'   // Easter
   287                             Hat := 'fr_pumpkin'; // Halloween/Hedgewars' birthday
   290                             else if (month = 12) and ((md = 24) or (md = 25) or (md = 26)) then
   288                         end;
   291                                 Hat := 'Santa'       // Christmas Eve/Christmas/Boxing Day
   289                     if (month = 4) and (md = 1) then
   292                             else if (month = 10) and (md = 31) then
   290                         begin
   293                                 Hat := 'fr_pumpkin'; // Halloween/Hedgewars' birthday
   291                         AprilOne:= true;
   294                             end;
   292                         Hat := 'fr_tomato'; // avoid promoting violence to hedgehogs. see http://hedgewars.org/node/5818
   295                         if (month = 4) and (md = 1) then
       
   296                             begin
       
   297                             AprilOne:= true;
       
   298                             Hat := 'fr_tomato'; // avoid promoting violence to hedgehogs. see https://hedgewars.org/node/5818
       
   299                             end;
   293                         end;
   300                         end;
   294 
   301 
   295                     if Hat <> 'NoHat' then
   302                     if Hat <> 'NoHat' then
   296                         begin
   303                         begin
   297                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   304                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   319         end;
   326         end;
   320 
   327 
   321 
   328 
   322 for t:= 0 to Pred(ClansCount) do
   329 for t:= 0 to Pred(ClansCount) do
   323     with ClansArray[t]^ do
   330     with ClansArray[t]^ do
   324         HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, Teams[0]^.NameTagTex^.h, Color);
   331         HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, 19 * HDPIScaleFactor, Color);
   325 
   332 
   326 GenericHealthTexture:= makeHealthBarTexture(cTeamHealthWidth + 5, TeamsArray[0]^.NameTagTex^.h, cWhiteColor)
   333 GenericHealthTexture:= makeHealthBarTexture(cTeamHealthWidth + 5, 19 * HDPIScaleFactor, cWhiteColor)
   327 end;
   334 end;
   328 
   335 
   329 
   336 
   330 procedure InitHealth;
   337 procedure InitHealth;
   331 var i, t: LongInt;
   338 var i, t: LongInt;
   516     HHTexture:= Surface2Tex(tmpsurf, false);
   523     HHTexture:= Surface2Tex(tmpsurf, false);
   517     SDL_FreeSurface(tmpsurf);
   524     SDL_FreeSurface(tmpsurf);
   518 
   525 
   519     InitHealth;
   526     InitHealth;
   520 
   527 
   521     PauseTexture:= RenderStringTex(trmsg[sidPaused], cYellowColor, fntBig);
   528     PauseTexture:= RenderStringTex(trmsg[sidPaused], cCentralMessageColor, fntBig);
   522     AFKTexture:= RenderStringTex(trmsg[sidAFK], cYellowColor, fntBig);
   529     AFKTexture:= RenderStringTex(trmsg[sidAFK], cCentralMessageColor, fntBig);
   523     keyConfirm:= KeyBindToName('confirm');
   530     keyConfirm:= KeyBindToName('confirm');
   524     keyQuit:= KeyBindToName('quit');
   531     keyQuit:= KeyBindToName('quit');
   525     ConfirmTexture:= RenderStringTex(Format(trmsg[sidConfirm], [keyConfirm, keyQuit]), cYellowColor, fntBig);
   532     ConfirmTexture:= RenderStringTex(FormatA(trmsg[sidConfirm], ansistring(keyConfirm), ansistring(keyQuit)), cCentralMessageColor, fntBig);
   526     SyncTexture:= RenderStringTex(trmsg[sidSync], cYellowColor, fntBig);
   533     SyncTexture:= RenderStringTex(trmsg[sidSync], cCentralMessageColor, fntBig);
   527 
   534 
   528     if not reload then
   535     if not reload then
   529         AddProgress;
   536         AddProgress;
   530 
   537 
   531     // name of weapons in ammo menu
   538     // name of weapons in ammo menu
   542             end;
   549             end;
   543 
   550 
   544     // number of weapons in ammo menu
   551     // number of weapons in ammo menu
   545     for i:= Low(CountTexz) to High(CountTexz) do
   552     for i:= Low(CountTexz) to High(CountTexz) do
   546         begin
   553         begin
   547         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   554         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trmsg[sidAmmoCount],fnt16)].Handle, Str2PChar(Format(shortstring(trmsg[sidAmmoCount]), IntToStr(i))), cWhiteColorChannels);
       
   555         if checkFails(tmpsurf <> nil,'Number texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true) then exit;
   548         tmpsurf:= doSurfaceConversion(tmpsurf);
   556         tmpsurf:= doSurfaceConversion(tmpsurf);
   549         FreeAndNilTexture(CountTexz[i]);
   557         FreeAndNilTexture(CountTexz[i]);
   550         CountTexz[i]:= Surface2Tex(tmpsurf, false);
   558         CountTexz[i]:= Surface2Tex(tmpsurf, false);
   551         SDL_FreeSurface(tmpsurf)
   559         SDL_FreeSurface(tmpsurf)
   552         end;
   560         end;
   627 
   635 
   628 
   636 
   629 procedure RenderHealth(var Hedgehog: THedgehog);
   637 procedure RenderHealth(var Hedgehog: THedgehog);
   630 var s: shortstring;
   638 var s: shortstring;
   631 begin
   639 begin
   632 s:= IntToStr(Hedgehog.Gear^.Health);
       
   633 FreeAndNilTexture(Hedgehog.HealthTagTex);
   640 FreeAndNilTexture(Hedgehog.HealthTagTex);
       
   641 if Hedgehog.Gear <> nil then
       
   642     s:= IntToStr(Hedgehog.Gear^.Health)
       
   643 else if Hedgehog.GearHidden <> nil then
       
   644     s:= IntToStr(Hedgehog.GearHidden^.Health)
       
   645 else
       
   646     exit;
   634 Hedgehog.HealthTagTex:= RenderStringTex(ansistring(s), Hedgehog.Team^.Clan^.Color, fnt16)
   647 Hedgehog.HealthTagTex:= RenderStringTex(ansistring(s), Hedgehog.Team^.Clan^.Color, fnt16)
   635 end;
   648 end;
   636 
   649 
   637 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
   650 function LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
   638 var tmpsurf: PSDL_Surface;
   651 var tmpsurf: PSDL_Surface;
   639     s: shortstring;
   652     s: shortstring;
       
   653     logMsg: shortstring;
   640     rwops: PSDL_RWops;
   654     rwops: PSDL_RWops;
   641 begin
   655 begin
   642     LoadImage:= nil;
   656     LoadImage:= nil;
   643     WriteToConsole(msgLoading + filename + '.png [flags: ' + inttostr(imageFlags) + '] ');
   657     logMsg:= msgLoading + filename + '.png [flags: ' + inttostr(imageFlags) + ']';
   644 
   658 
   645     s:= filename + '.png';
   659     s:= filename + '.png';
   646 
   660 
   647     rwops:= nil;
   661     rwops:= nil;
   648     tmpsurf:= nil;
   662     tmpsurf:= nil;
   662         begin
   676         begin
   663         // output sdl error if loading failed when data source was available
   677         // output sdl error if loading failed when data source was available
   664         if rwops <> nil then
   678         if rwops <> nil then
   665             begin
   679             begin
   666             // anounce that loading failed
   680             // anounce that loading failed
   667             OutError(msgFailed, false);
   681             OutError(logMsg + ' ' + msgFailed, false);
   668 
   682 
   669             if SDLCheck(false, 'LoadImage', (imageFlags and ifCritical) <> 0) then exit;
   683             if SDLCheck(false, 'LoadImage: ' + logMsg + ' ' + msgFailed, (imageFlags and ifCritical) <> 0) then
       
   684                 exit;
   670             // rwops was already freed by IMG_Load_RW
   685             // rwops was already freed by IMG_Load_RW
   671             rwops:= nil;
   686             rwops:= nil;
   672             end else
   687             end
   673             OutError(msgFailed, (imageFlags and ifCritical) <> 0);
   688         else
       
   689             OutError(logMsg + ' ' + msgFailed, (imageFlags and ifCritical) <> 0);
   674         exit;
   690         exit;
   675         end;
   691         end;
   676 
   692 
   677     if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then
   693     if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then
   678         begin
   694         begin
   679         SDL_FreeSurface(tmpsurf);
   695         SDL_FreeSurface(tmpsurf);
   680         OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0)));
   696         OutError(logMsg + ' ' + msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0)));
   681         // dummy surface to replace non-critical textures that failed to load due to their size
   697         // dummy surface to replace non-critical textures that failed to load due to their size
   682         LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask);
   698         LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask);
   683         exit;
   699         exit;
   684         end;
   700         end;
   685 
   701 
   686     tmpsurf:= doSurfaceConversion(tmpsurf);
   702     tmpsurf:= doSurfaceConversion(tmpsurf);
   687 
   703 
   688     if (imageFlags and ifColorKey) <> 0 then
   704     if (imageFlags and ifColorKey) <> 0 then
   689         if checkFails(SDL_SetColorKey(tmpsurf, SDL_TRUE, 0) = 0, errmsgTransparentSet, true) then exit;
   705         if checkFails(SDL_SetColorKey(tmpsurf, SDL_TRUE, 0) = 0, errmsgTransparentSet, true) then exit;
   690 
   706 
   691     WriteLnToConsole(msgOK + ' (' + inttostr(tmpsurf^.w) + 'x' + inttostr(tmpsurf^.h) + ')');
   707     // log success
       
   708     WriteLnToConsole(logMsg + ' ' + msgOK + ' (' + inttostr(tmpsurf^.w) + 'x' + inttostr(tmpsurf^.h) + ')');
   692 
   709 
   693     LoadImage:= tmpsurf //Result
   710     LoadImage:= tmpsurf //Result
   694 end;
   711 end;
   695 
   712 
   696 
   713 
   771         // cleanup: free temporary surface mem
   788         // cleanup: free temporary surface mem
   772         else
   789         else
   773             freeTmpHatSurf();
   790             freeTmpHatSurf();
   774         end;
   791         end;
   775 end;
   792 end;
       
   793 
       
   794 // Load default clan colors from config fiile
       
   795 procedure LoadDefaultClanColors(s: shortstring);
       
   796 var i: LongInt;
       
   797     f: PFSFile;
       
   798     key, value, l, temp: shortstring;
       
   799     color, tempColor: Longword;
       
   800     clanID, tempClanID: byte;
       
   801 begin
       
   802     if cOnlyStats then exit;
       
   803 
       
   804     WriteLnToConsole('Loading default clan colors from: ' + s);
       
   805 
       
   806     l:= '';
       
   807     if pfsExists(s) then
       
   808         begin
       
   809         f:= pfsOpenRead(s);
       
   810         while (not pfsEOF(f)) and (l <> '[colors]') do
       
   811             pfsReadLn(f, l);
       
   812 
       
   813         while (not pfsEOF(f)) and (l <> '') do
       
   814             begin
       
   815             pfsReadLn(f, l);
       
   816 
       
   817             key:= '';
       
   818             i:= 1;
       
   819             while (i <= length(l)) and (l[i] <> '=') do
       
   820                 begin
       
   821                 key:= key + l[i];
       
   822                 inc(i)
       
   823                 end;
       
   824             temp:= copy(key, 1, 5);
       
   825             if temp = 'color' then
       
   826                 begin
       
   827                 temp:= copy(key, 6, length(key) - 5);
       
   828                 tempClanID:= StrToInt(temp);
       
   829                 clanID:= tempClanID
       
   830                 end
       
   831             else
       
   832                 continue;
       
   833 
       
   834             if i < length(l) then
       
   835                 begin
       
   836                 value:= copy(l, i + 1, length(l) - i);
       
   837                 if (length(value) = 2) and (value[1] = '\') then
       
   838                     value:= value[1] + ''
       
   839                 else if (value[1] = '"') and (value[length(value)] = '"') then
       
   840                     value:= copy(value, 2, length(value) - 2);
       
   841                 if value[1] <> '#' then
       
   842                     continue;
       
   843                 temp:= copy(value, 2, length(value) - 1);
       
   844                 tempColor:= StrToInt('$'+temp);
       
   845                 color:= tempColor
       
   846                 end;
       
   847 
       
   848             if clanID <= cClanColors then
       
   849                 ClanColorArray[clanID]:= color;
       
   850 
       
   851             end;
       
   852 
       
   853         pfsClose(f)
       
   854         end
       
   855         else
       
   856             WriteLnToConsole('Settings file not found');
       
   857 end;
       
   858 
   776 
   859 
   777 procedure SetupOpenGLAttributes;
   860 procedure SetupOpenGLAttributes;
   778 begin
   861 begin
   779 {$IFDEF IPHONEOS}
   862 {$IFDEF IPHONEOS}
   780     SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
   863     SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0);
   836             if GameLoading <> nil then
   919             if GameLoading <> nil then
   837                 GameLoading();
   920                 GameLoading();
   838         {$ENDIF}
   921         {$ENDIF}
   839         end;
   922         end;
   840 
   923 
   841     if checkFails((ProgrTex <> nil) and (LoadingText <> nil), 'Error - Progress or Loading Texture is nil!', true) then exit;
   924     if checkFails((ProgrTex <> nil) and (LoadingText <> nil), 'Error - Progress or Loading texture is nil!', true) then exit;
   842 
   925 
   843     RenderClear();
   926     RenderClear();
   844     if Step < numsquares then
   927     if Step < numsquares then
   845         r.x:= 0
   928         r.x:= 0
   846     else
   929     else
   875 var tmpsurf: PSDL_SURFACE;
   958 var tmpsurf: PSDL_SURFACE;
   876     w, h, i, j: LongInt;
   959     w, h, i, j: LongInt;
   877     font: THWFont;
   960     font: THWFont;
   878     r, r2: TSDL_Rect;
   961     r, r2: TSDL_Rect;
   879     wa, ha: LongInt;
   962     wa, ha: LongInt;
   880     tmpline, tmpline2, tmpdesc: ansistring;
   963     tmpline, tmpline2, tmpline3, tmpdesc: ansistring;
   881 begin
   964 begin
   882 // make sure there is a caption as well as a sub caption - description is optional
   965 // make sure there is a caption as well as a sub caption - description is optional
   883 if length(caption) = 0 then
   966 if length(caption) = 0 then
   884     caption:= ansistring('???');
   967     caption:= ansistring('???');
   885 if length(subcaption) = 0 then
   968 if length(subcaption) = 0 then
   915 // get description's dimensions
   998 // get description's dimensions
   916 tmpdesc:= description;
   999 tmpdesc:= description;
   917 while length(tmpdesc) > 0 do
  1000 while length(tmpdesc) > 0 do
   918     begin
  1001     begin
   919     tmpline:= tmpdesc;
  1002     tmpline:= tmpdesc;
       
  1003     EscapeCharA(tmpline, '|');
   920     SplitByCharA(tmpline, tmpdesc, '|');
  1004     SplitByCharA(tmpline, tmpdesc, '|');
       
  1005     UnEscapeCharA(tmpline, '|');
   921     if length(tmpline) > 0 then
  1006     if length(tmpline) > 0 then
   922         begin
  1007         begin
   923         TTF_SizeUTF8(Fontz[font].Handle, PChar(tmpline), @i, @j);
  1008         TTF_SizeUTF8(Fontz[font].Handle, PChar(tmpline), @i, @j);
   924         if w < (i + wa) then
  1009         if w < (i + wa) then
   925             w:= i + wa;
  1010             w:= i + wa;
   958 // render all description lines
  1043 // render all description lines
   959 tmpdesc:= description;
  1044 tmpdesc:= description;
   960 while length(tmpdesc) > 0 do
  1045 while length(tmpdesc) > 0 do
   961     begin
  1046     begin
   962     tmpline:= tmpdesc;
  1047     tmpline:= tmpdesc;
       
  1048     EscapeCharA(tmpline, '|');
   963     SplitByCharA(tmpline, tmpdesc, '|');
  1049     SplitByCharA(tmpline, tmpdesc, '|');
       
  1050     UnEscapeCharA(tmpline, '|');
   964     r2:= r;
  1051     r2:= r;
   965     if length(tmpline) > 0 then
  1052     if length(tmpline) > 0 then
   966         begin
  1053         begin
   967         r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline));
  1054 
   968 
  1055         // Render highlighted caption if there is a ':',
   969         // render highlighted caption (if there is a ':')
  1056         // from the beginning of the line to (and including) the ':'.
       
  1057         // With '::', the colons will be suppressed in the final text.
       
  1058         EscapeCharA(tmpline, ':');
   970         tmpline2:= _S'';
  1059         tmpline2:= _S'';
   971         SplitByCharA(tmpline, tmpline2, ':');
  1060         SplitByCharA(tmpline, tmpline2, ':');
   972         if length(tmpline2) > 0 then
  1061         if length(tmpline2) > 0 then
   973             begin
  1062             begin
   974             tmpline:= tmpline + ':';
  1063             if (tmpline2[1] <> ':') then
       
  1064                 begin
       
  1065                 tmpline:= tmpline + ':';
       
  1066                 tmpline3:= tmpline + tmpline2;
       
  1067                 end
       
  1068             else
       
  1069                 tmpline3:= tmpline + Copy(tmpline2, 2, Length(tmpline2)-1);
       
  1070             UnEscapeCharA(tmpline3, ':');
       
  1071             r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline3));
   975             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, PChar(tmpline));
  1072             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, PChar(tmpline));
   976             end;
  1073             end
   977         end
  1074         else
       
  1075             begin
       
  1076             UnEscapeCharA(tmpline, ':');
       
  1077             r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline));
       
  1078             end
       
  1079         end;
   978     end;
  1080     end;
   979 
  1081 
   980 if length(extra) > 0 then
  1082 if length(extra) > 0 then
   981     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, PChar(extra));
  1083     r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, PChar(extra));
   982 
  1084 
   983 r.x:= cFontBorder + 6;
  1085 r.x:= cFontBorder + 6;
   984 r.y:= cFontBorder + 4;
  1086 r.y:= cFontBorder + 4;
   985 r.w:= 32;
  1087 r.w:= 32;
   986 r.h:= 32;
  1088 r.h:= 32;
   987 SDL_FillRect(tmpsurf, @r, $ff000000);
  1089 SDL_FillRect(tmpsurf, @r, SDL_MapRGB(tmpsurf^.format, 0, 0, 0));
   988 SDL_UpperBlit(iconsurf, iconrect, tmpsurf, @r);
  1090 SDL_UpperBlit(iconsurf, iconrect, tmpsurf, @r);
   989 
  1091 
   990 RenderHelpWindow:=  Surface2Tex(tmpsurf, true);
  1092 RenderHelpWindow:=  Surface2Tex(tmpsurf, true);
   991 SDL_FreeSurface(tmpsurf)
  1093 SDL_FreeSurface(tmpsurf)
   992 end;
  1094 end;
  1019 
  1121 
  1020 // default (no extra text)
  1122 // default (no extra text)
  1021 extra:= _S'';
  1123 extra:= _S'';
  1022 extracolor:= 0;
  1124 extracolor:= 0;
  1023 
  1125 
  1024 if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1126 if (trluaammoe[Ammoz[atype].NameId] = true) then
  1025     begin
  1127     if (CurrentTeam <> nil) and (Ammoz[atype].SkipTurns >= CurrentTeam^.Clan^.TurnNumber) then // weapon or utility is not yet available
  1026     if (atype = amTardis) and (SuddenDeathActive) then
  1128         begin
  1027         extra:= trmsg[sidNotAvailableInSD]
  1129         if (atype = amTardis) and (SuddenDeathActive) then
  1028     else
  1130             extra:= trmsg[sidNotAvailableInSD]
  1029         extra:= trmsg[sidNotYetAvailable];
  1131         else
  1030     extracolor:= LongInt($ffc77070);
  1132             extra:= trmsg[sidNotYetAvailable];
  1031     end
  1133         extracolor:= LongInt($ffc77070);
  1032 else if (((GameFlags and gfInfAttack) <> 0) and ((Ammoz[atype].Ammo.Propz and ammoprop_ForceTurnEnd) = 0)) or ((Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
  1134         end
  1033     // weapon or utility will not end your turn
  1135     else if ((((GameFlags and gfInfAttack) <> 0) and ((Ammoz[atype].Ammo.Propz and ammoprop_ForceTurnEnd) = 0)) or ((Ammoz[atype].Ammo.Propz and ammoprop_NoRoundEnd) <> 0)) and (not (PlacingHogs and (atype = amTeleport))) then
  1034     begin
  1136         // weapon or utility will not end your turn
  1035     extra:= trmsg[sidNoEndTurn];
  1137         begin
  1036     extracolor:= LongInt($ff70c770);
  1138         extra:= trmsg[sidNoEndTurn];
  1037     end
  1139         extracolor:= LongInt($ff70c770);
  1038 else
  1140         end;
  1039     begin
       
  1040     extra:= _S'';
       
  1041     extracolor:= 0;
       
  1042     end;
       
  1043 
  1141 
  1044 if length(trluaammo[Ammoz[atype].NameId]) > 0  then
  1142 if length(trluaammo[Ammoz[atype].NameId]) > 0  then
  1045     ammoname := trluaammo[Ammoz[atype].NameId]
  1143     ammoname := trluaammo[Ammoz[atype].NameId]
  1046 else
  1144 else
  1047     ammoname := trammo[Ammoz[atype].NameId];
  1145     ammoname := trammo[Ammoz[atype].NameId];
  1142         AddFileLog('Freeing old primary surface...');
  1240         AddFileLog('Freeing old primary surface...');
  1143 {$ENDIF}
  1241 {$ENDIF}
  1144         end;
  1242         end;
  1145 
  1243 
  1146     // these attributes must be set up before creating the sdl window
  1244     // these attributes must be set up before creating the sdl window
  1147 {$IFNDEF WIN32}
  1245 {$IFNDEF WINDOWS}
  1148 (* On a large number of testers machines, SDL default to software rendering
  1246 (* On a large number of testers machines, SDL default to software rendering
  1149    when opengl attributes were set. These attributes were "set" after
  1247    when opengl attributes were set. These attributes were "set" after
  1150    CreateWindow in .15, which probably did nothing.
  1248    CreateWindow in .15, which probably did nothing.
  1151    IMO we should rely on the gl_config defaults from SDL, and use
  1249    IMO we should rely on the gl_config defaults from SDL, and use
  1152    SDL_GL_GetAttribute to possibly post warnings if any bad values are set.
  1250    SDL_GL_GetAttribute to possibly post warnings if any bad values are set.