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 SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat |
24 uses {$IFNDEF PAS2C} StrUtils, {$ENDIF}SysUtils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; |
25 {$IFDEF GL2}, uMatrix{$ENDIF} |
|
26 {$IFNDEF PAS2C}, StrUtils{$ENDIF} |
|
27 ; |
|
28 |
25 |
29 procedure initModule; |
26 procedure initModule; |
30 procedure freeModule; |
27 procedure freeModule; |
31 |
28 |
32 procedure StoreLoad(reload: boolean); |
29 procedure StoreLoad(reload: boolean); |
572 {$IFDEF USE_VIDEO_RECORDING} |
569 {$IFDEF USE_VIDEO_RECORDING} |
573 if defaultFrame <> 0 then |
570 if defaultFrame <> 0 then |
574 DeleteFramebuffer(defaultFrame, depthv, texv); |
571 DeleteFramebuffer(defaultFrame, depthv, texv); |
575 {$ENDIF} |
572 {$ENDIF} |
576 {$IFDEF USE_S3D_RENDERING} |
573 {$IFDEF USE_S3D_RENDERING} |
577 if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) or (cStereoMode = smAFR) then |
574 if (cStereoMode = smHorizontal) or (cStereoMode = smVertical) then |
578 begin |
575 begin |
579 DeleteFramebuffer(framel, depthl, texl); |
576 DeleteFramebuffer(framel, depthl, texl); |
580 DeleteFramebuffer(framer, depthr, texr); |
577 DeleteFramebuffer(framer, depthr, texr); |
581 end |
578 end |
582 {$ENDIF} |
579 {$ENDIF} |
630 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
627 function LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
631 var tmpsurf: PSDL_Surface; |
628 var tmpsurf: PSDL_Surface; |
632 begin |
629 begin |
633 // check for file in user dir (never critical) |
630 // check for file in user dir (never critical) |
634 tmpsurf:= LoadImage(cPathz[path] + '/' + filename, imageFlags); |
631 tmpsurf:= LoadImage(cPathz[path] + '/' + filename, imageFlags); |
|
632 |
|
633 LoadDataImage:= tmpsurf; |
635 end; |
634 end; |
636 |
635 |
637 |
636 |
638 function LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
637 function LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface; |
639 var tmpsurf: PSDL_Surface; |
638 var tmpsurf: PSDL_Surface; |
1465 exit |
1464 exit |
1466 end; |
1465 end; |
1467 if Length(s) = 0 then |
1466 if Length(s) = 0 then |
1468 cFullScreen:= (not cFullScreen) |
1467 cFullScreen:= (not cFullScreen) |
1469 else cFullScreen:= s = '1'; |
1468 else cFullScreen:= s = '1'; |
|
1469 |
|
1470 if cFullScreen then |
|
1471 begin |
|
1472 cScreenWidth:= cFullscreenWidth; |
|
1473 cScreenHeight:= cFullscreenHeight; |
|
1474 end |
|
1475 else |
|
1476 begin |
|
1477 cScreenWidth:= cWindowedWidth; |
|
1478 cScreenHeight:= cWindowedHeight; |
|
1479 end; |
1470 |
1480 |
1471 AddFileLog('Preparing to change video parameters...'); |
1481 AddFileLog('Preparing to change video parameters...'); |
1472 {$IFDEF SDL13} |
1482 {$IFDEF SDL13} |
1473 if SDLwindow = nil then |
1483 if SDLwindow = nil then |
1474 {$ELSE} |
1484 {$ELSE} |
1544 flags:= flags or SDL_WINDOW_BORDERLESS; |
1554 flags:= flags or SDL_WINDOW_BORDERLESS; |
1545 {$ENDIF} |
1555 {$ENDIF} |
1546 |
1556 |
1547 if SDLwindow = nil then |
1557 if SDLwindow = nil then |
1548 if cFullScreen then |
1558 if cFullScreen then |
1549 SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cOrigScreenWidth, cOrigScreenHeight, flags or SDL_WINDOW_FULLSCREEN) |
1559 SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags or SDL_WINDOW_FULLSCREEN) |
1550 else |
1560 else |
|
1561 begin |
1551 SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags); |
1562 SDLwindow:= SDL_CreateWindow('Hedgewars', x, y, cScreenWidth, cScreenHeight, flags); |
|
1563 end; |
1552 SDLTry(SDLwindow <> nil, true); |
1564 SDLTry(SDLwindow <> nil, true); |
1553 {$ELSE} |
1565 {$ELSE} |
1554 flags:= SDL_OPENGL or SDL_RESIZABLE; |
1566 flags:= SDL_OPENGL or SDL_RESIZABLE; |
1555 if cFullScreen then |
1567 if cFullScreen then |
|
1568 begin |
1556 flags:= flags or SDL_FULLSCREEN; |
1569 flags:= flags or SDL_FULLSCREEN; |
1557 |
1570 end; |
1558 if not cOnlyStats then |
1571 if not cOnlyStats then |
1559 begin |
1572 begin |
1560 {$IFDEF WIN32} |
1573 {$IFDEF WIN32} |
1561 s:= SDL_getenv('SDL_VIDEO_CENTERED'); |
1574 s:= SDL_getenv('SDL_VIDEO_CENTERED'); |
1562 SDL_putenv('SDL_VIDEO_CENTERED=1'); |
1575 SDL_putenv('SDL_VIDEO_CENTERED=1'); |