From 704f0591bcda1410525c28e4738fb3e5993e6a9b Mon Sep 17 00:00:00 2001 From: danij Date: Sat, 16 Jul 2011 15:06:28 +0100 Subject: [PATCH] Fixed -dedicated and -novideo modes. --- doomsday/engine/portable/src/dd_main.c | 38 ++++++++++---------- doomsday/engine/portable/src/gl_main.c | 10 +++--- doomsday/engine/portable/src/gl_texmanager.c | 11 +++--- doomsday/engine/portable/src/r_data.c | 10 +++--- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/doomsday/engine/portable/src/dd_main.c b/doomsday/engine/portable/src/dd_main.c index c391bd16e6..7f4098c9ee 100644 --- a/doomsday/engine/portable/src/dd_main.c +++ b/doomsday/engine/portable/src/dd_main.c @@ -1383,26 +1383,24 @@ int DD_Main(void) if(!Sys_SetWindow(windowIDX, winX, winY, winWidth, winHeight, winBPP, winFlags, 0)) return -1; - if(!isDedicated) + if(!GL_EarlyInit()) { - if(!GL_EarlyInit()) - { - Sys_CriticalMessage("GL_EarlyInit() failed."); - return -1; - } + Sys_CriticalMessage("GL_EarlyInit() failed."); + return -1; + } + novideo = ArgCheck("-novideo") || isDedicated; + if(!novideo && !isDedicated) + { // Render a few black frames before we continue. This will help to // stabilize things before we begin drawing for real and to avoid any // unwanted video artefacts. - if(!novideo) + { int i = 0; + while(i++ < 3) { - int i = 0; - while(i++ < 3) - { - glClear(GL_COLOR_BUFFER_BIT); - GL_DoUpdate(); - } - } + glClear(GL_COLOR_BUFFER_BIT); + GL_DoUpdate(); + }} } Sys_Init(); @@ -1420,11 +1418,8 @@ int DD_Main(void) "Starting up...", DD_StartupWorker, 0); // Engine initialization is complete. Now finish up with the GL. - if(!isDedicated) - { - GL_Init(); - GL_InitRefresh(); - } + GL_Init(); + GL_InitRefresh(); // Do deferred uploads. Con_InitProgress(200); @@ -1768,7 +1763,10 @@ static int DD_UpdateEngineStateWorker(void* paramaters) { ddupdateenginestateworker_paramaters_t* p = (ddupdateenginestateworker_paramaters_t*) paramaters; - GL_InitRefresh(); + if(!novideo) + { + GL_InitRefresh(); + } if(p->initiatedBusyMode) Con_SetProgress(50); diff --git a/doomsday/engine/portable/src/gl_main.c b/doomsday/engine/portable/src/gl_main.c index a43ea9e9ca..5fc981ddee 100644 --- a/doomsday/engine/portable/src/gl_main.c +++ b/doomsday/engine/portable/src/gl_main.c @@ -420,12 +420,12 @@ static void printConfiguration(void) */ boolean GL_EarlyInit(void) { + if(isDedicated) + return true; + if(initGLOk) return true; // Already initialized. - if(novideo) - return true; - Con_Message("Initializing Render subsystem...\n"); // Get the original gamma ramp and check if ramps are supported. @@ -468,7 +468,6 @@ boolean GL_EarlyInit(void) } renderTextures = !ArgExists("-notex"); - novideo = ArgCheck("-novideo") || isDedicated; VERBOSE( printConfiguration() ); @@ -486,6 +485,9 @@ boolean GL_EarlyInit(void) */ void GL_Init(void) { + if(isDedicated) + return; + if(!initGLOk) { Con_Error("GL_Init: GL_EarlyInit has not been done yet.\n"); diff --git a/doomsday/engine/portable/src/gl_texmanager.c b/doomsday/engine/portable/src/gl_texmanager.c index 27c3f1b267..eae0fa9f8d 100644 --- a/doomsday/engine/portable/src/gl_texmanager.c +++ b/doomsday/engine/portable/src/gl_texmanager.c @@ -1361,9 +1361,6 @@ void GL_EarlyInitTextureManager(void) void GL_InitTextureManager(void) { - if(novideo) - return; - if(texInited) return; // Don't init again. @@ -1567,7 +1564,7 @@ static void calcGammaTable(void) void GL_LoadSystemTextures(void) { - if(!texInited) + if(isDedicated || !texInited) return; UI_LoadTextures(); @@ -2407,7 +2404,7 @@ DGLuint GL_PrepareLSTexture(lightingtexid_t which) { "radioOE", GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE } }; - if(which < 0 || which >= NUM_LIGHTING_TEXTURES) + if(isDedicated || which < 0 || which >= NUM_LIGHTING_TEXTURES) return 0; if(!lightingTextures[which].tex) @@ -2421,7 +2418,7 @@ DGLuint GL_PrepareLSTexture(lightingtexid_t which) DGLuint GL_PrepareSysFlareTexture(flaretexid_t flare) { - if(flare < 0 || flare >= NUM_SYSFLARE_TEXTURES) + if(isDedicated || flare < 0 || flare >= NUM_SYSFLARE_TEXTURES) return 0; if(!sysFlareTextures[flare].tex) @@ -3069,7 +3066,7 @@ DGLuint GL_GetFlareTexture(const dduri_t* uri, int oldIdx) DGLuint GL_PreparePatch(patchtex_t* patchTex) { - if(patchTex) + if(!isDedicated && patchTex) { texturevariantspecification_t* texSpec = GL_TextureVariantSpecificationForContext(TC_UI, diff --git a/doomsday/engine/portable/src/r_data.c b/doomsday/engine/portable/src/r_data.c index 921f6932fd..2d66762bfa 100644 --- a/doomsday/engine/portable/src/r_data.c +++ b/doomsday/engine/portable/src/r_data.c @@ -1023,8 +1023,9 @@ void R_DestroySystemTextures(void) { int i; for(i = 0; i < sysTexturesCount; ++i) { - Uri_Destruct(sysTextures[i]->external); - free(sysTextures[i]); + systex_t* rec = sysTextures[i]; + Uri_Destruct(rec->external); + free(rec); }} if(sysTextures) @@ -1193,9 +1194,6 @@ patchid_t R_PrecachePatch(const char* name, patchinfo_t* info) if(info) memset(info, 0, sizeof(patchinfo_t)); - if(isDedicated) - return 0; - if(NULL == name || !name[0]) { Con_Message("Warning:R_PrecachePatch: Invalid 'name' argument, ignoring.\n"); @@ -1207,7 +1205,9 @@ patchid_t R_PrecachePatch(const char* name, patchinfo_t* info) { GL_PreparePatch(getPatchTex(patchId)); if(info) + { R_GetPatchInfo(patchId, info); + } } return patchId; }