279 with SpritesData[ii] do |
279 with SpritesData[ii] do |
280 // FIXME - add a sprite attribute |
280 // FIXME - add a sprite attribute |
281 if (not cReducedQuality) or ((ii <> sprSky) and (ii <> sprHorizont) and (ii <> sprFlake)) then |
281 if (not cReducedQuality) or ((ii <> sprSky) and (ii <> sprHorizont) and (ii <> sprFlake)) then |
282 begin |
282 begin |
283 if AltPath = ptNone then |
283 if AltPath = ptNone then |
284 //{$IFDEF IPHONEOS} |
|
285 // tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent) |
|
286 //{$ELSE} |
|
287 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical or ifLowRes) |
284 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical or ifLowRes) |
288 //{$ENDIF} |
|
289 else begin |
285 else begin |
290 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent); |
286 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent); |
291 if tmpsurf = nil then |
287 if tmpsurf = nil then |
292 tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent); |
288 tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent); |
293 end; |
289 end; |
877 str(Hedgehog.Gear^.Health, s); |
873 str(Hedgehog.Gear^.Health, s); |
878 if Hedgehog.HealthTagTex <> nil then FreeTexture(Hedgehog.HealthTagTex); |
874 if Hedgehog.HealthTagTex <> nil then FreeTexture(Hedgehog.HealthTagTex); |
879 Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16) |
875 Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16) |
880 end; |
876 end; |
881 |
877 |
882 // hasAlpha: boolean; critical, setTransparent: boolean |
|
883 function LoadImage(const filename: string; imageFlags: Integer): PSDL_Surface; |
878 function LoadImage(const filename: string; imageFlags: Integer): PSDL_Surface; |
884 var tmpsurf: PSDL_Surface; |
879 var tmpsurf: PSDL_Surface; |
885 //Result: PSDL_Surface; |
|
886 s: shortstring; |
880 s: shortstring; |
|
881 {$IFDEF IPHONEOS} |
|
882 convertedSurf: PSDL_Surface; |
|
883 const TestFormat: TSDL_PixelFormat = ( |
|
884 palette: nil; |
|
885 BitsPerPixel : 32; |
|
886 BytesPerPixel: 4; |
|
887 Rloss : 0; |
|
888 Gloss : 0; |
|
889 Bloss : 0; |
|
890 Aloss : 0; |
|
891 Rshift: 0; |
|
892 Gshift: 8; |
|
893 Bshift: 16; |
|
894 Ashift: 24; |
|
895 RMask : $000000FF; |
|
896 GMask : $0000FF00; |
|
897 BMask : $00FF0000; |
|
898 AMask : $FF000000; |
|
899 colorkey: 0; |
|
900 alpha : 255); |
|
901 {$ENDIF} |
887 begin |
902 begin |
888 WriteToConsole(msgLoading + filename + '... '); |
903 WriteToConsole(msgLoading + filename + '... '); |
889 s:= filename + '.' + cBitsStr + '.png'; |
904 s:= filename + '.' + cBitsStr + '.png'; |
890 tmpsurf:= IMG_Load(Str2PChar(s)); |
905 tmpsurf:= IMG_Load(Str2PChar(s)); |
891 WriteToConsole(inttostr(imageFlags)); |
906 WriteToConsole(inttostr(imageFlags)); |
921 |
936 |
922 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
937 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
923 begin |
938 begin |
924 SDL_FreeSurface(tmpsurf); |
939 SDL_FreeSurface(tmpsurf); |
925 OutError(msgFailedSize, (imageFlags and ifCritical) <> 0); |
940 OutError(msgFailedSize, (imageFlags and ifCritical) <> 0); |
|
941 //dummy surface to replace non-critical textures that failed to load due to their size |
926 exit(SDL_CreateRGBSurface(SDL_SWSURFACE, 32, 32, 32, RMask, GMask, BMask, AMask)); |
942 exit(SDL_CreateRGBSurface(SDL_SWSURFACE, 32, 32, 32, RMask, GMask, BMask, AMask)); |
927 end; |
943 end; |
928 |
944 |
929 if (imageFlags and ifTransparent) <> 0 then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
945 if (imageFlags and ifTransparent) <> 0 then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
930 //if (imageFlags and ifAlpha) <> 0 then Result:= SDL_DisplayFormatAlpha(tmpsurf) |
946 //if (imageFlags and ifAlpha) <> 0 then Result:= SDL_DisplayFormatAlpha(tmpsurf) else Result:= SDL_DisplayFormat(tmpsurf); |
931 // else Result:= SDL_DisplayFormat(tmpsurf); |
|
932 WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') '); |
947 WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') '); |
933 WriteLnToConsole(msgOK); |
948 WriteLnToConsole(msgOK); |
|
949 |
|
950 {$IFDEF IPHONEOS} |
|
951 //for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 |
|
952 convertedSurf:= SDL_ConvertSurface(tmpsurf, @TestFormat, SDL_SWSURFACE); |
|
953 tmpsurf:= convertedSurf; |
|
954 {$ENDIF} |
934 |
955 |
935 LoadImage:= tmpsurf //Result |
956 LoadImage:= tmpsurf //Result |
936 end; |
957 end; |
937 |
958 |
938 procedure SetupOpenGL; |
959 procedure SetupOpenGL; |