hedgewars/uStore.pas
changeset 780 f45b0e513dfd
parent 777 86177328b094
child 785 ac538f1a629e
equal deleted inserted replaced
779:cb18225a150a 780:f45b0e513dfd
   225           GraveTex:= Surface2Tex(texsurf);
   225           GraveTex:= Surface2Tex(texsurf);
   226           SDL_FreeSurface(texsurf)
   226           SDL_FreeSurface(texsurf)
   227           end
   227           end
   228     end;
   228     end;
   229 
   229 
   230     procedure GetSkyColor;
       
   231 //    var p: PByteArray;
       
   232     begin
       
   233 (*    if SDL_MustLock(SpritesData[sprSky].Surface) then
       
   234        SDLTry(SDL_LockSurface(SpritesData[sprSky].Surface) >= 0, true);
       
   235     p:= SpritesData[sprSky].Surface^.pixels;
       
   236     case SpritesData[sprSky].Surface^.format^.BytesPerPixel of
       
   237          1: cSkyColor:= PByte(p)^;
       
   238          2: cSkyColor:= PWord(p)^;
       
   239          3: cSkyColor:= (p^[0]) or (p^[1] shl 8) or (p^[2] shl 16);
       
   240          4: cSkyColor:= PLongword(p)^;
       
   241          end;*)
       
   242     cSkyColor:= $3030A0;
       
   243     glClearColor((cSkyColor shr 16) / 255, ((cSkyColor shr 8) and $FF) / 255, (cSkyColor and $FF) / 255, 0);
       
   244 
       
   245 //    if SDL_MustLock(SpritesData[sprSky].Surface) then
       
   246 //       SDL_UnlockSurface(SpritesData[sprSky].Surface)
       
   247     end;
       
   248 
       
   249     procedure GetExplosionBorderColor;
   230     procedure GetExplosionBorderColor;
   250     var f: textfile;
   231     var f: textfile;
   251         c: LongInt;
   232         s1, s2: shortstring;
       
   233         c1, c2: TSDL_Color;
   252     begin
   234     begin
   253     s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename;
   235     s:= Pathz[ptCurrTheme] + '/' + cThemeCFGFilename;
   254     WriteToConsole(msgLoading + s + ' ');
   236     WriteToConsole(msgLoading + s + ' ');
   255     Assign(f, s);
   237     Assign(f, s);
   256     {$I-}
   238     {$I-}
   257     Reset(f);
   239     Reset(f);
   258     Readln(f, s);
   240     Readln(f, c1.r, c1.g, c1. b);
       
   241     Readln(f, c2.r, c2.g, c2. b);
   259     Close(f);
   242     Close(f);
   260     {$I+}
   243     {$I+}
   261     TryDo(IOResult = 0, msgFailed, true);
   244     TryDo(IOResult = 0, msgFailed, true);
   262     WriteLnToConsole(msgOK);
   245     WriteLnToConsole(msgOK);
   263     val(s, cExplosionBorderColor, c);
   246 
   264     TryDo(c = 0, 'Theme data corrupted', true);
   247     glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99); // sky color
   265     cExplosionBorderColor:= (cExplosionBorderColor shr 16) or
   248     cExplosionBorderColor:= c2.value or
   266                             (cExplosionBorderColor and $FF) or
       
   267                             (cExplosionBorderColor shl 16) or
       
   268                             $FF000000
   249                             $FF000000
   269     end;
   250     end;
   270 
   251 
   271 begin
   252 begin
   272 for fi:= Low(THWFont) to High(THWFont) do
   253 for fi:= Low(THWFont) to High(THWFont) do
   302          if Width = 0 then Width:= tmpsurf^.w;
   283          if Width = 0 then Width:= tmpsurf^.w;
   303          if Height = 0 then Height:= tmpsurf^.h;
   284          if Height = 0 then Height:= tmpsurf^.h;
   304          Texture:= Surface2Tex(tmpsurf);
   285          Texture:= Surface2Tex(tmpsurf);
   305          if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
   286          if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
   306          end;
   287          end;
   307 
       
   308 GetSkyColor;
       
   309 
   288 
   310 AddProgress;
   289 AddProgress;
   311 
   290 
   312 tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, true, true, true);
   291 tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, true, true, true);
   313 HHTexture:= Surface2Tex(tmpsurf);
   292 HHTexture:= Surface2Tex(tmpsurf);