hedgewars/uStore.pas
branchsdl2transition
changeset 9798 f2b18754742f
parent 9684 8113075dc7cc
parent 9791 446e4919b738
child 11360 7a7611adf715
equal deleted inserted replaced
9711:7d0329f37181 9798:f2b18754742f
   151     i, maxLevel: LongInt;
   151     i, maxLevel: LongInt;
   152     r: TSDL_Rect;
   152     r: TSDL_Rect;
   153     drY: LongInt;
   153     drY: LongInt;
   154     texsurf, flagsurf, iconsurf: PSDL_Surface;
   154     texsurf, flagsurf, iconsurf: PSDL_Surface;
   155     foundBot: boolean;
   155     foundBot: boolean;
       
   156     year, month, md : word;
   156 begin
   157 begin
   157     if cOnlyStats then exit;
   158     if cOnlyStats then exit;
   158 r.x:= 0;
   159 r.x:= 0;
   159 r.y:= 0;
   160 r.y:= 0;
   160 drY:= - 4;
   161 drY:= - 4;
       
   162 DecodeDate(Date, year, month, md);
   161 for t:= 0 to Pred(TeamsCount) do
   163 for t:= 0 to Pred(TeamsCount) do
   162     with TeamsArray[t]^ do
   164     with TeamsArray[t]^ do
   163         begin
   165         begin
   164         NameTagTex:= RenderStringTexLim(TeamName, Clan^.Color, Font, cTeamHealthWidth);
   166         NameTagTex:= RenderStringTexLim(TeamName, Clan^.Color, Font, cTeamHealthWidth);
       
   167         if length(Owner) > 0 then
       
   168             OwnerTex:= RenderStringTexLim(Owner, Clan^.Color, Font, cTeamHealthWidth);
   165 
   169 
   166         r.x:= 0;
   170         r.x:= 0;
   167         r.y:= 0;
   171         r.y:= 0;
   168         r.w:= 32;
   172         r.w:= 32;
   169         r.h:= 32;
   173         r.h:= 32;
   234         for i:= 0 to cMaxHHIndex do
   238         for i:= 0 to cMaxHHIndex do
   235             with Hedgehogs[i] do
   239             with Hedgehogs[i] do
   236                 if Gear <> nil then
   240                 if Gear <> nil then
   237                     begin
   241                     begin
   238                     NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth);
   242                     NameTagTex:= RenderStringTexLim(Name, Clan^.Color, fnt16, cTeamHealthWidth);
       
   243                     if Hat = 'NoHat' then
       
   244                         begin
       
   245                         if ((month = 4) and (md = 20)) then
       
   246                             Hat := 'eastertop'; // Easter
       
   247                         if ((month = 12) and (md = 25)) then
       
   248                             Hat := 'Santa'; // Christmas
       
   249                         if ((month = 10) and (md = 31)) then
       
   250                             Hat := 'fr_pumpkin'; // Halloween/Hedgewars' birthday
       
   251                         end;
       
   252                     
   239                     if Hat <> 'NoHat' then
   253                     if Hat <> 'NoHat' then
   240                         begin
   254                         begin
   241                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   255                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
   242                             LoadHedgehogHat(Hedgehogs[i], 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
   256                             LoadHedgehogHat(Hedgehogs[i], 'Reserved/' + Copy(Hat,9,Length(Hat)-8))
   243                         else
   257                         else
   328     with SpritesData[ii] do
   342     with SpritesData[ii] do
   329         // FIXME - add a sprite attribute to match on rq flags?
   343         // FIXME - add a sprite attribute to match on rq flags?
   330         if (((cReducedQuality and (rqNoBackground or rqLowRes)) = 0) or   // why rqLowRes?
   344         if (((cReducedQuality and (rqNoBackground or rqLowRes)) = 0) or   // why rqLowRes?
   331                 (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]))) and
   345                 (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]))) and
   332            (((cReducedQuality and rqPlainSplash) = 0) or ((not (ii in [sprSplash, sprDroplet, sprSDSplash, sprSDDroplet])))) and
   346            (((cReducedQuality and rqPlainSplash) = 0) or ((not (ii in [sprSplash, sprDroplet, sprSDSplash, sprSDDroplet])))) and
   333            (((cReducedQuality and rqKillFlakes) = 0) or (Theme = 'Snow') or (Theme = 'Christmas') or ((not (ii in [sprFlake, sprSDFlake])))) and
   347            (((cReducedQuality and rqKillFlakes) = 0) or cSnow or ((not (ii in [sprFlake, sprSDFlake])))) and
   334            ((cCloudsNumber > 0) or (ii <> sprCloud)) and
   348            ((cCloudsNumber > 0) or (ii <> sprCloud)) and
   335            ((vobCount > 0) or (ii <> sprFlake)) then
   349            ((vobCount > 0) or (ii <> sprFlake)) then
   336             begin
   350             begin
   337             if reload then
   351             if reload then
   338                 tmpsurf:= Surface
   352                 tmpsurf:= Surface
   628 end;
   642 end;
   629 
   643 
   630 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
   644 procedure LoadHedgehogHat(var HH: THedgehog; newHat: shortstring);
   631 var texsurf: PSDL_Surface;
   645 var texsurf: PSDL_Surface;
   632 begin
   646 begin
       
   647     // free the mem of any previously assigned texture.  This was previously only if the new one could be loaded, but, NoHat is usually a better choice
       
   648     if HH.HatTex <> nil then
       
   649         begin
       
   650         FreeTexture(HH.HatTex);
       
   651         HH.HatTex:= nil
       
   652         end;
   633     texsurf:= LoadDataImage(ptHats, newHat, ifNone);
   653     texsurf:= LoadDataImage(ptHats, newHat, ifNone);
   634 AddFileLog('Hat => '+newHat);
   654 AddFileLog('Hat => '+newHat);
   635     // only do something if the hat could be loaded
   655     // only do something if the hat could be loaded
   636     if texsurf <> nil then
   656     if texsurf <> nil then
   637         begin
   657         begin
   638 AddFileLog('Got Hat');
   658 AddFileLog('Got Hat');
   639         // free the mem of any previously assigned texture
       
   640         FreeTexture(HH.HatTex);
       
   641 
   659 
   642         // assign new hat to hedgehog
   660         // assign new hat to hedgehog
   643         HH.HatTex:= Surface2Tex(texsurf, true);
   661         HH.HatTex:= Surface2Tex(texsurf, true);
   644 
   662 
   645         // cleanup: free temporary surface mem
   663         // cleanup: free temporary surface mem