X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_window.pas;h=a8c6b6a7b3c3bf8302e95d712e2a2b875750359a;hb=94c8854f0ba3a87de3928f587e66d5d0e43d8f9b;hp=6ffa8ff05468b132ff35b3eaa2e8b4b988979a7e;hpb=e2c0ffbd3c4bc1516930552924062d56447df065;p=d2df-sdl.git diff --git a/src/game/g_window.pas b/src/game/g_window.pas index 6ffa8ff..a8c6b6a 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . *) -{$MODE DELPHI} +{$INCLUDE g_amodes.inc} unit g_window; interface @@ -38,6 +38,8 @@ function g_Window_SetSize(W, H: Word; FScreen: Boolean): Boolean; var gwin_dump_extensions: Boolean = false; + gwin_has_stencil: Boolean = false; + gwin_k8_enable_light_experiments: Boolean = false; implementation @@ -543,10 +545,17 @@ begin e_SoundUpdate(); if NetMode = NET_SERVER then - g_Net_Host_Update - else - if (NetMode = NET_CLIENT) and (NetState <> NET_STATE_AUTH) then - g_Net_Client_UpdateWhileLoading; + begin + g_Net_Host_Update(); + g_Net_Flush(); + end + else if NetMode = NET_CLIENT then + if (NetState <> NET_STATE_AUTH) then + begin + g_Net_Client_UpdateWhileLoading(); + g_Net_Flush(); + end; + wLoadingProgress := False; end; @@ -584,12 +593,14 @@ begin if NetMode = NET_SERVER then g_Net_Host_Update() else if NetMode = NET_CLIENT then g_Net_Client_Update(); Update(); + if NetMode <> NET_NONE then g_Net_Flush(); end; end - else + else if NetMode <> NET_NONE then begin if NetMode = NET_SERVER then g_Net_Host_Update() else if NetMode = NET_CLIENT then g_Net_Client_Update(); + g_Net_Flush(); end; if wLoadingQuit then @@ -640,6 +651,10 @@ begin SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + 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; @@ -685,11 +700,20 @@ begin end; function SDLMain(): Integer; +var + idx: Integer; + ltmp: Integer; begin {$IFDEF HEADLESS} 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); @@ -702,6 +726,17 @@ begin {EnumDisplayModes();} + if gwin_k8_enable_light_experiments then + begin + 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; + if not glHasExtension('GL_ARB_texture_non_power_of_two') then begin e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING); @@ -712,6 +747,7 @@ begin e_WriteLog('Driver advertised NPOT textures support', MSG_NOTIFY); glLegacyNPOT := false; end; + gwin_dump_extensions := false; Init(); Time_Old := GetTimer();