hedgewars/uStore.pas
changeset 2290 bf87ca44782e
parent 2285 6746bda385e8
child 2292 87af4ad0ec98
equal deleted inserted replaced
2289:cb850ba733bd 2290:bf87ca44782e
   160 
   160 
   161 		DrawRoundRect(@r, cWhiteColor, cColorNearBlack, texsurf, true);
   161 		DrawRoundRect(@r, cWhiteColor, cColorNearBlack, texsurf, true);
   162 		rr:= r;
   162 		rr:= r;
   163 		inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
   163 		inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
   164 		DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false);
   164 		DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false);
   165 		HealthTex:= Surface2Tex(texsurf);
   165 		HealthTex:= Surface2Tex(texsurf, false);
   166 		SDL_FreeSurface(texsurf);
   166 		SDL_FreeSurface(texsurf);
   167 
   167 
   168 		dec(drY, r.h + 2);
   168 		dec(drY, r.h + 2);
   169 		DrawHealthY:= drY;
   169 		DrawHealthY:= drY;
   170 		for i:= 0 to 7 do
   170 		for i:= 0 to 7 do
   175 					if Hat <> 'NoHat' then
   175 					if Hat <> 'NoHat' then
   176 						begin
   176 						begin
   177 						texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, ifNone);
   177 						texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, ifNone);
   178 						if texsurf <> nil then
   178 						if texsurf <> nil then
   179 							begin
   179 							begin
   180 							HatTex:= Surface2Tex(texsurf);
   180 							HatTex:= Surface2Tex(texsurf, false);
   181 							SDL_FreeSurface(texsurf)
   181 							SDL_FreeSurface(texsurf)
   182 							end
   182 							end
   183 						end
   183 						end
   184 					end;
   184 					end;
   185 		end;
   185 		end;
   215 			if PLongwordArray(texsurf^.pixels)^[i] = $FF000000 then PLongwordArray(texsurf^.pixels)^[i]:= 0;
   215 			if PLongwordArray(texsurf^.pixels)^[i] = $FF000000 then PLongwordArray(texsurf^.pixels)^[i]:= 0;
   216 
   216 
   217 		if SDL_MustLock(texsurf) then
   217 		if SDL_MustLock(texsurf) then
   218 			SDL_UnlockSurface(texsurf);
   218 			SDL_UnlockSurface(texsurf);
   219 
   219 
   220 		CrosshairTex:= Surface2Tex(texsurf);
   220 		CrosshairTex:= Surface2Tex(texsurf, false);
   221 		SDL_FreeSurface(texsurf)
   221 		SDL_FreeSurface(texsurf)
   222 		end;
   222 		end;
   223 
   223 
   224 	SDL_FreeSurface(tmpsurf)
   224 	SDL_FreeSurface(tmpsurf)
   225 	end;
   225 	end;
   245 	if TeamsArray[t] <> nil then
   245 	if TeamsArray[t] <> nil then
   246 		with TeamsArray[t]^ do
   246 		with TeamsArray[t]^ do
   247 			begin
   247 			begin
   248 			if GraveName = '' then GraveName:= 'Simple';
   248 			if GraveName = '' then GraveName:= 'Simple';
   249 			texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifCritical or ifTransparent);
   249 			texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifCritical or ifTransparent);
   250 			GraveTex:= Surface2Tex(texsurf);
   250 			GraveTex:= Surface2Tex(texsurf, false);
   251 			SDL_FreeSurface(texsurf)
   251 			SDL_FreeSurface(texsurf)
   252 			end
   252 			end
   253 	end;
   253 	end;
   254 
   254 
   255 var ii: TSprite;
   255 var ii: TSprite;
   289 				end;
   289 				end;
   290 			if imageWidth = 0 then imageWidth := tmpsurf^.w;
   290 			if imageWidth = 0 then imageWidth := tmpsurf^.w;
   291 			if imageHeight = 0 then imageHeight := tmpsurf^.h;
   291 			if imageHeight = 0 then imageHeight := tmpsurf^.h;
   292 			if Width = 0 then Width:= tmpsurf^.w;
   292 			if Width = 0 then Width:= tmpsurf^.w;
   293 			if Height = 0 then Height:= tmpsurf^.h;
   293 			if Height = 0 then Height:= tmpsurf^.h;
   294 			Texture:= Surface2Tex(tmpsurf);
   294             if (ii = sprSky) or (ii = sprWater) then
       
   295 			    Texture:= Surface2Tex(tmpsurf, true)
       
   296             else
       
   297 			    Texture:= Surface2Tex(tmpsurf, false);
   295 			if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
   298 			if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf)
   296 		end;
   299 		end;
   297 
   300 
   298 AddProgress;
   301 AddProgress;
   299 
   302 
   300 tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, ifAlpha or ifCritical or ifTransparent);
   303 tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, ifAlpha or ifCritical or ifTransparent);
   301 HHTexture:= Surface2Tex(tmpsurf);
   304 HHTexture:= Surface2Tex(tmpsurf, false);
   302 SDL_FreeSurface(tmpsurf);
   305 SDL_FreeSurface(tmpsurf);
   303 
   306 
   304 InitHealth;
   307 InitHealth;
   305 
   308 
   306 PauseTexture:= RenderStringTex(trmsg[sidPaused], $FFFF00, fntBig);
   309 PauseTexture:= RenderStringTex(trmsg[sidPaused], $FFFF00, fntBig);
   308 
   311 
   309 for ai:= Low(TAmmoType) to High(TAmmoType) do
   312 for ai:= Low(TAmmoType) to High(TAmmoType) do
   310 	with Ammoz[ai] do
   313 	with Ammoz[ai] do
   311 		begin
   314 		begin
   312 		tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), $FFFFFF);
   315 		tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), $FFFFFF);
   313 		NameTex:= Surface2Tex(tmpsurf);
   316 		NameTex:= Surface2Tex(tmpsurf, false);
   314 		SDL_FreeSurface(tmpsurf)
   317 		SDL_FreeSurface(tmpsurf)
   315 		end;
   318 		end;
   316 		
   319 		
   317 for i:= Low(CountTexz) to High(CountTexz) do
   320 for i:= Low(CountTexz) to High(CountTexz) do
   318 	begin
   321 	begin
   319 	tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), $FFFFFF);
   322 	tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), $FFFFFF);
   320 	CountTexz[i]:= Surface2Tex(tmpsurf);
   323 	CountTexz[i]:= Surface2Tex(tmpsurf, false);
   321 	SDL_FreeSurface(tmpsurf)
   324 	SDL_FreeSurface(tmpsurf)
   322 	end;
   325 	end;
   323 
   326 
   324 {$IFDEF DUMP}
   327 {$IFDEF DUMP}
   325 SDL_SaveBMP_RW(LandSurface, SDL_RWFromFile('LandSurface.bmp', 'wb'), 1);
   328 SDL_SaveBMP_RW(LandSurface, SDL_RWFromFile('LandSurface.bmp', 'wb'), 1);
   679 
   682 
   680 WriteInRoundRect(Result, 0, 0, Color, font, s);
   683 WriteInRoundRect(Result, 0, 0, Color, font, s);
   681 
   684 
   682 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   685 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   683 
   686 
   684 RenderStringTex:= Surface2Tex(Result);
   687 RenderStringTex:= Surface2Tex(Result, false);
   685 
   688 
   686 SDL_FreeSurface(Result)
   689 SDL_FreeSurface(Result)
   687 end;
   690 end;
   688 
   691 
   689 function RenderSpeechBubbleTex(s: string; SpeechType: Longword; font: THWFont): PTexture;
   692 function RenderSpeechBubbleTex(s: string; SpeechType: Longword; font: THWFont): PTexture;
   859         end;
   862         end;
   860     inc(pos);
   863     inc(pos);
   861     end;
   864     end;
   862 
   865 
   863 //TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   866 //TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
   864 RenderSpeechBubbleTex:= Surface2Tex(Result);
   867 RenderSpeechBubbleTex:= Surface2Tex(Result, false);
   865 
   868 
   866 SDL_FreeSurface(rotatedEdge);
   869 SDL_FreeSurface(rotatedEdge);
   867 SDL_FreeSurface(Result)
   870 SDL_FreeSurface(Result)
   868 end;
   871 end;
   869 
   872 
   998 begin
  1001 begin
   999 if Step = 0 then
  1002 if Step = 0 then
  1000    begin
  1003    begin
  1001    WriteToConsole(msgLoading + 'progress sprite: ');
  1004    WriteToConsole(msgLoading + 'progress sprite: ');
  1002    texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', ifCritical or ifTransparent);
  1005    texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', ifCritical or ifTransparent);
  1003    ProgrTex:= Surface2Tex(texsurf);
  1006    ProgrTex:= Surface2Tex(texsurf, false);
  1004    SDL_FreeSurface(texsurf);
  1007    SDL_FreeSurface(texsurf);
  1005    squaresize:= ProgrTex^.w shr 1;
  1008    squaresize:= ProgrTex^.w shr 1;
  1006    numsquares:= ProgrTex^.h div squaresize;
  1009    numsquares:= ProgrTex^.h div squaresize;
  1007    end;
  1010    end;
  1008 
  1011