19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 {$IF GLunit = GL}{$DEFINE GLunit:=GL,GLext}{$ENDIF} |
20 {$IF GLunit = GL}{$DEFINE GLunit:=GL,GLext}{$ENDIF} |
21 |
21 |
22 unit uStore; |
22 unit uStore; |
23 interface |
23 interface |
24 uses {$IFNDEF PAS2C} StrUtils, {$ENDIF}SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; |
24 uses StrUtils, SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; |
25 |
25 |
26 procedure initModule; |
26 procedure initModule; |
27 procedure freeModule; |
27 procedure freeModule; |
28 |
28 |
29 procedure StoreLoad(reload: boolean); |
29 procedure StoreLoad(reload: boolean); |
573 |
573 |
574 s:= filename + '.png'; |
574 s:= filename + '.png'; |
575 tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); |
575 tmpsurf:= IMG_Load_RW(rwopsOpenRead(s), true); |
576 |
576 |
577 if tmpsurf = nil then |
577 if tmpsurf = nil then |
578 begin |
578 begin |
579 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
579 OutError(msgFailed, (imageFlags and ifCritical) <> 0); |
580 exit; |
580 exit; |
581 end; |
581 end; |
582 |
582 |
583 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
583 if ((imageFlags and ifIgnoreCaps) = 0) and ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then |
584 begin |
584 begin |
585 SDL_FreeSurface(tmpsurf); |
585 SDL_FreeSurface(tmpsurf); |
586 OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0))); |
586 OutError(msgFailedSize, ((not cOnlyStats) and ((imageFlags and ifCritical) <> 0))); |
587 // dummy surface to replace non-critical textures that failed to load due to their size |
587 // dummy surface to replace non-critical textures that failed to load due to their size |
588 LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask); |
588 LoadImage:= SDL_CreateRGBSurface(SDL_SWSURFACE, 2, 2, 32, RMask, GMask, BMask, AMask); |
589 exit; |
589 exit; |
590 end; |
590 end; |
591 |
591 |
592 tmpsurf:= doSurfaceConversion(tmpsurf); |
592 tmpsurf:= doSurfaceConversion(tmpsurf); |
593 |
593 |
594 if (imageFlags and ifTransparent) <> 0 then |
594 if (imageFlags and ifTransparent) <> 0 then |
595 TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
595 TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
763 {$IFDEF USE_VIDEO_RECORDING} |
763 {$IFDEF USE_VIDEO_RECORDING} |
764 glGetIntegerv(GL_AUX_BUFFERS, @AuxBufNum); |
764 glGetIntegerv(GL_AUX_BUFFERS, @AuxBufNum); |
765 AddFileLog(' |----- Number of auxiliary buffers: ' + inttostr(AuxBufNum)); |
765 AddFileLog(' |----- Number of auxiliary buffers: ' + inttostr(AuxBufNum)); |
766 {$ENDIF} |
766 {$ENDIF} |
767 AddFileLog(' \----- Extensions: '); |
767 AddFileLog(' \----- Extensions: '); |
768 {$IFNDEF PAS2C} |
768 |
769 // fetch extentions and store them in string |
769 // fetch extentions and store them in string |
770 tmpstr := StrPas(PChar(glGetString(GL_EXTENSIONS))); |
770 tmpstr := StrPas(PChar(glGetString(GL_EXTENSIONS))); |
771 tmpn := WordCount(tmpstr, [' ']); |
771 tmpn := WordCount(tmpstr, [' ']); |
772 tmpint := 1; |
772 tmpint := 1; |
773 |
773 |
781 ExtractWord(tmpint+2, tmpstr, [' ']) |
781 ExtractWord(tmpint+2, tmpstr, [' ']) |
782 )); |
782 )); |
783 tmpint := tmpint + 3; |
783 tmpint := tmpint + 3; |
784 end; |
784 end; |
785 until (tmpint > tmpn); |
785 until (tmpint > tmpn); |
786 {$ELSE} |
|
787 // doesn't seem to print >256 chars |
|
788 AddFileLogRaw(PChar(glGetString(GL_EXTENSIONS))); |
|
789 {$ENDIF} |
|
790 AddFileLog(''); |
786 AddFileLog(''); |
791 |
787 |
792 defaultFrame:= 0; |
788 defaultFrame:= 0; |
793 {$IFDEF USE_VIDEO_RECORDING} |
789 {$IFDEF USE_VIDEO_RECORDING} |
794 if GameType = gmtRecord then |
790 if GameType = gmtRecord then |