summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: 3e3656b)
raw | patch | inline | side by side (from parent 1: 3e3656b)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 16 Aug 2017 09:26:06 +0000 (12:26 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 16 Aug 2017 09:27:46 +0000 (12:27 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 206d6e4d8301b561a14fb27b460731e9e78ad84c..73e6b28e6221babfb08549a07202ca96ac9f1bf9 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
var
lnum, idx: Integer;
begin
+ if not gwin_has_stencil then begin g_dynLightCount := 0; exit; end;
lnum := 0;
for idx := 0 to g_dynLightCount-1 do
begin
procedure g_AddDynLight (x, y, radius: Integer; r, g, b, a: Single);
begin
+ if not gwin_has_stencil then exit;
if g_dynLightCount = length(g_dynLights) then SetLength(g_dynLights, g_dynLightCount+1024);
g_dynLights[g_dynLightCount].x := x;
g_dynLights[g_dynLightCount].y := y;
procedure g_DynLightExplosion (x, y, radius: Integer; r, g, b: Single);
begin
+ if not gwin_has_stencil then exit;
if g_dynLightCount = length(g_dynLights) then SetLength(g_dynLights, g_dynLightCount+1024);
g_dynLights[g_dynLightCount].x := x;
g_dynLights[g_dynLightCount].y := y;
Inc(g_dynLightCount);
end;
+
type
TEndCustomGameStat = record
PlayerStat: TPlayerStatArray;
end;
// HACK: add dynlight here
- if e_KeyPressed(IK_F8) and gGameOn and (not gConsoleShow) and (g_ActiveWindow = nil) then
- begin
- g_playerLight := true;
- end;
- if e_KeyPressed(IK_F9) and gGameOn and (not gConsoleShow) and (g_ActiveWindow = nil) then
+ if gwin_k8_enable_light_experiments then
begin
- g_playerLight := false;
+ if e_KeyPressed(IK_F8) and gGameOn and (not gConsoleShow) and (g_ActiveWindow = nil) then
+ begin
+ g_playerLight := true;
+ end;
+ if e_KeyPressed(IK_F9) and gGameOn and (not gConsoleShow) and (g_ActiveWindow = nil) then
+ begin
+ g_playerLight := false;
+ end;
end;
- if (g_playerLight) then g_AddDynLight(plr.GameX+32, plr.GameY+40, 128, 1, 1, 0, 0.6);
+ if gwin_has_stencil and g_playerLight then g_AddDynLight(plr.GameX+32, plr.GameY+40, 128, 1, 1, 0, 0.6);
end;
procedure g_Game_Update();
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 6dfa778096ff33f616b553c00539c81b542227fd..e7cc9cd5bb37b42372c61a8bc8e9c9000630e066 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
var
gwin_dump_extensions: Boolean = false;
gwin_has_stencil: Boolean = false;
+ gwin_k8_enable_light_experiments: Boolean = false;
implementation
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); // lights; it is enough to have 1-bit stencil buffer for lighting
+ if gwin_k8_enable_light_experiments then
+ begin
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); // lights; it is enough to have 1-bit stencil buffer for lighting
+ end;
SDL_GL_SetSwapInterval(v);
end;
e_NoGraphics := True;
{$ENDIF}
+ for idx := 1 to ParamCount do
+ begin
+ if ParamStr(idx) = '--opengl-dump-exts' then gwin_dump_extensions := true;
+ if ParamStr(idx) = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
+ end;
+
e_WriteLog('Initializing OpenGL', MSG_NOTIFY);
InitOpenGL(gVSync);
{EnumDisplayModes();}
- for idx := 1 to ParamCount do
+ if gwin_k8_enable_light_experiments then
begin
- if ParamStr(idx) = '--opengl-dump-exts' then gwin_dump_extensions := true;
+ SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp);
+ e_WriteLog(Format('stencil buffer size: %d', [ltmp]), MSG_WARNING);
+ gwin_has_stencil := (ltmp > 0);
+ end
+ else
+ begin
+ gwin_has_stencil := false;
end;
- SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp);
- e_WriteLog(Format('stencil buffer size: %d', [ltmp]), MSG_WARNING);
-
- gwin_has_stencil := (ltmp > 0);
-
if not glHasExtension('GL_ARB_texture_non_power_of_two') then
begin
e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING);