Skip to content

Commit

Permalink
Fixed -dedicated and -novideo modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jul 16, 2011
1 parent 3566be5 commit 704f059
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 36 deletions.
38 changes: 18 additions & 20 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions doomsday/engine/portable/src/gl_main.c
Expand Up @@ -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.
Expand Down Expand Up @@ -468,7 +468,6 @@ boolean GL_EarlyInit(void)
}

renderTextures = !ArgExists("-notex");
novideo = ArgCheck("-novideo") || isDedicated;

VERBOSE( printConfiguration() );

Expand All @@ -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");
Expand Down
11 changes: 4 additions & 7 deletions doomsday/engine/portable/src/gl_texmanager.c
Expand Up @@ -1361,9 +1361,6 @@ void GL_EarlyInitTextureManager(void)

void GL_InitTextureManager(void)
{
if(novideo)
return;

if(texInited)
return; // Don't init again.

Expand Down Expand Up @@ -1567,7 +1564,7 @@ static void calcGammaTable(void)

void GL_LoadSystemTextures(void)
{
if(!texInited)
if(isDedicated || !texInited)
return;

UI_LoadTextures();
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions doomsday/engine/portable/src/r_data.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down

0 comments on commit 704f059

Please sign in to comment.