hedgewars/uStore.pas
changeset 10139 9046f69dae4c
parent 10133 d73412fbf3b4
child 10229 5d38aaff5564
equal deleted inserted replaced
10138:1a71d28392cb 10139:9046f69dae4c
   169     drY: LongInt;
   169     drY: LongInt;
   170     texsurf, flagsurf, iconsurf: PSDL_Surface;
   170     texsurf, flagsurf, iconsurf: PSDL_Surface;
   171     foundBot: boolean;
   171     foundBot: boolean;
   172     year, month, md : word;
   172     year, month, md : word;
   173 begin
   173 begin
   174     if cOnlyStats then exit;
   174 if cOnlyStats then exit;
   175 r.x:= 0;
   175 r.x:= 0;
   176 r.y:= 0;
   176 r.y:= 0;
   177 drY:= - 4;
   177 drY:= - 4;
   178 {$IFNDEF PAS2C}
   178 {$IFNDEF PAS2C}
   179 DecodeDate(Date, year, month, md);
   179 DecodeDate(Date, year, month, md);
   341     tmpsurf: PSDL_Surface;
   341     tmpsurf: PSDL_Surface;
   342     i, imflags: LongInt;
   342     i, imflags: LongInt;
   343 begin
   343 begin
   344 AddFileLog('StoreLoad()');
   344 AddFileLog('StoreLoad()');
   345 
   345 
   346 if not reload then
   346 if (not reload) and (not cOnlyStats) then
   347     for fi:= Low(THWFont) to High(THWFont) do
   347     for fi:= Low(THWFont) to High(THWFont) do
   348         with Fontz[fi] do
   348         with Fontz[fi] do
   349             begin
   349             begin
   350             s:= cPathz[ptFonts] + '/' + Name;
   350             s:= cPathz[ptFonts] + '/' + Name;
   351             WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
   351             WriteToConsole(msgLoading + s + ' (' + inttostr(Height) + 'pt)... ');
   353             SDLTry(Handle <> nil, true);
   353             SDLTry(Handle <> nil, true);
   354             TTF_SetFontStyle(Handle, style);
   354             TTF_SetFontStyle(Handle, style);
   355             WriteLnToConsole(msgOK)
   355             WriteLnToConsole(msgOK)
   356             end;
   356             end;
   357 
   357 
   358 MakeCrossHairs;
   358 if not cOnlyStats then 
   359 LoadGraves;
   359     begin
       
   360     MakeCrossHairs;
       
   361     LoadGraves;
       
   362     end;
       
   363     
   360 if not reload then
   364 if not reload then
   361     AddProgress;
   365     AddProgress;
   362 
   366 
   363 for ii:= Low(TSprite) to High(TSprite) do
   367 for ii:= Low(TSprite) to High(TSprite) do
   364     with SpritesData[ii] do
   368     with SpritesData[ii] do
   365         // FIXME - add a sprite attribute to match on rq flags?
   369         // FIXME - add a sprite attribute to match on rq flags?
   366         if (((cReducedQuality and (rqNoBackground or rqLowRes)) = 0) or   // why rqLowRes?
   370         if (((cReducedQuality and (rqNoBackground or rqLowRes)) = 0) or   // why rqLowRes?
   367                 (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]))) and
   371                 (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR])))
   368            (((cReducedQuality and rqPlainSplash) = 0) or ((not (ii in [sprSplash, sprDroplet, sprSDSplash, sprSDDroplet])))) and
   372            and (((cReducedQuality and rqPlainSplash) = 0) or ((not (ii in [sprSplash, sprDroplet, sprSDSplash, sprSDDroplet])))) 
   369            (((cReducedQuality and rqKillFlakes) = 0) or cSnow or ((not (ii in [sprFlake, sprSDFlake])))) and
   373            and (((cReducedQuality and rqKillFlakes) = 0) or cSnow or ((not (ii in [sprFlake, sprSDFlake]))))
   370            ((cCloudsNumber > 0) or (ii <> sprCloud)) and
   374            and ((cCloudsNumber > 0) or (ii <> sprCloud))
   371            ((vobCount > 0) or (ii <> sprFlake)) then
   375            and ((vobCount > 0) or (ii <> sprFlake)) 
       
   376            and (savesurf or (not cOnlyStats)) // in stats-only only load those which are needed later
       
   377             then
   372             begin
   378             begin
   373             if reload then
   379             if reload then
   374                 tmpsurf:= Surface
   380                 tmpsurf:= Surface
   375             else
   381             else
   376                 begin
   382                 begin
   424                 end
   430                 end
   425             else
   431             else
   426                 Surface:= nil
   432                 Surface:= nil
   427         end;
   433         end;
   428 
   434 
   429 WriteNames(fnt16);
   435 if not cOnlyStats then
   430 
   436     begin
   431 if not reload then
   437     WriteNames(fnt16);
   432     AddProgress;
   438 
   433 
   439     if not reload then
   434 tmpsurf:= LoadDataImage(ptGraphics, cHHFileName, ifAlpha or ifCritical or ifTransparent);
   440         AddProgress;
   435 
   441 
   436 HHTexture:= Surface2Tex(tmpsurf, false);
   442     tmpsurf:= LoadDataImage(ptGraphics, cHHFileName, ifAlpha or ifCritical or ifTransparent);
   437 SDL_FreeSurface(tmpsurf);
   443 
   438 
   444     HHTexture:= Surface2Tex(tmpsurf, false);
   439 InitHealth;
   445     SDL_FreeSurface(tmpsurf);
   440 
   446 
   441 PauseTexture:= RenderStringTex(trmsg[sidPaused], cYellowColor, fntBig);
   447     InitHealth;
   442 AFKTexture:= RenderStringTex(trmsg[sidAFK], cYellowColor, fntBig);
   448 
   443 ConfirmTexture:= RenderStringTex(trmsg[sidConfirm], cYellowColor, fntBig);
   449     PauseTexture:= RenderStringTex(trmsg[sidPaused], cYellowColor, fntBig);
   444 SyncTexture:= RenderStringTex(trmsg[sidSync], cYellowColor, fntBig);
   450     AFKTexture:= RenderStringTex(trmsg[sidAFK], cYellowColor, fntBig);
   445 
   451     ConfirmTexture:= RenderStringTex(trmsg[sidConfirm], cYellowColor, fntBig);
   446 if not reload then
   452     SyncTexture:= RenderStringTex(trmsg[sidSync], cYellowColor, fntBig);
   447     AddProgress;
   453 
   448 
   454     if not reload then
   449 // name of weapons in ammo menu
   455         AddProgress;
   450 for ai:= Low(TAmmoType) to High(TAmmoType) do
   456 
   451     with Ammoz[ai] do
   457     // name of weapons in ammo menu
   452         begin
   458     for ai:= Low(TAmmoType) to High(TAmmoType) do
   453         TryDo(length(trAmmo[NameId]) > 0,'No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
   459         with Ammoz[ai] do
   454         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, PChar(trAmmo[NameId]), cWhiteColorChannels);
   460             begin
   455         TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
   461             TryDo(length(trAmmo[NameId]) > 0,'No default text/translation found for ammo type #' + intToStr(ord(ai)) + '!',true);
       
   462             tmpsurf:= TTF_RenderUTF8_Blended(Fontz[CheckCJKFont(trAmmo[NameId],fnt16)].Handle, PChar(trAmmo[NameId]), cWhiteColorChannels);
       
   463             TryDo(tmpsurf <> nil,'Name-texture creation for ammo type #' + intToStr(ord(ai)) + ' failed!',true);
       
   464             tmpsurf:= doSurfaceConversion(tmpsurf);
       
   465             FreeTexture(NameTex);
       
   466             NameTex:= Surface2Tex(tmpsurf, false);
       
   467             SDL_FreeSurface(tmpsurf)
       
   468             end;
       
   469 
       
   470     // number of weapons in ammo menu
       
   471     for i:= Low(CountTexz) to High(CountTexz) do
       
   472         begin
       
   473         tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   456         tmpsurf:= doSurfaceConversion(tmpsurf);
   474         tmpsurf:= doSurfaceConversion(tmpsurf);
   457         FreeTexture(NameTex);
   475         FreeTexture(CountTexz[i]);
   458         NameTex:= Surface2Tex(tmpsurf, false);
   476         CountTexz[i]:= Surface2Tex(tmpsurf, false);
   459         SDL_FreeSurface(tmpsurf)
   477         SDL_FreeSurface(tmpsurf)
   460         end;
   478         end;
   461 
   479 
   462 // number of weapons in ammo menu
   480     if not reload then
   463 for i:= Low(CountTexz) to High(CountTexz) do
   481         AddProgress;
   464     begin
   482     end;
   465     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), cWhiteColorChannels);
   483 
   466     tmpsurf:= doSurfaceConversion(tmpsurf);
       
   467     FreeTexture(CountTexz[i]);
       
   468     CountTexz[i]:= Surface2Tex(tmpsurf, false);
       
   469     SDL_FreeSurface(tmpsurf)
       
   470     end;
       
   471 
       
   472 if not reload then
       
   473     AddProgress;
       
   474 IMG_Quit();
   484 IMG_Quit();
   475 
       
   476 end;
   485 end;
   477 
   486 
   478 {$IF DEFINED(USE_S3D_RENDERING) OR DEFINED(USE_VIDEO_RECORDING)}
   487 {$IF DEFINED(USE_S3D_RENDERING) OR DEFINED(USE_VIDEO_RECORDING)}
   479 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   488 procedure CreateFramebuffer(var frame, depth, tex: GLuint);
   480 begin
   489 begin