Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching between renderers #66

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/client/cl_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -4048,7 +4048,7 @@ qboolean CL_LoadProgs( const char *name )
CL_InitViewBeams ();
CL_InitTempEnts ();

if( !R_InitRenderAPI()) // Xash3D extension
if( !R_InitRenderAPI( false )) // Xash3D extension
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get render API\n" );

if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface
Expand Down
2 changes: 1 addition & 1 deletion engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3121,7 +3121,7 @@ void CL_Shutdown( void )
FS_Delete( "demoheader.tmp" ); // remove tmp file
SCR_FreeCinematic (); // release AVI's *after* client.dll because custom renderer may use them
S_Shutdown ();
R_Shutdown ();
R_Shutdown ( false );

Con_Shutdown ();
}
6 changes: 3 additions & 3 deletions engine/client/cl_remap.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int sk
tx = entity->model->textures[skinnum];
if( !tx ) return; // missing texture ?

if( *texture == 0 )
{
//if( *texture == 0 )
//{
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", entity->model->name, skinnum, entity->index );
skin.width = tx->width;
skin.height = tx->height;
Expand All @@ -228,7 +228,7 @@ void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int sk
skin.palette = skin.buffer + skin.size;
pic = FS_CopyImage( &skin ); // because GL_LoadTextureInternal will freed a rgbdata_t at end
*texture = GL_LoadTextureInternal( texname, pic, TF_KEEP_SOURCE );
}
//}

// and now we can remap with internal routines
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
Expand Down
32 changes: 16 additions & 16 deletions engine/client/cl_scrn.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ qboolean SCR_LoadFixedWidthFont( const char *fontname )
{
int i, fontWidth;

if( cls.creditsFont.valid )
return true; // already loaded
//if( cls.creditsFont.valid )
// return true; // already loaded

if( !FS_FileExists( fontname, false ))
return false;
Expand Down Expand Up @@ -614,8 +614,8 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
fs_offset_t length;
qfont_t *src;

if( cls.creditsFont.valid )
return true; // already loaded
//if( cls.creditsFont.valid )
// return true; // already loaded

if( !FS_FileExists( fontname, false ))
return false;
Expand Down Expand Up @@ -779,14 +779,14 @@ void SCR_SizeDown_f( void )
SCR_VidInit
==================
*/
void SCR_VidInit( void )
void SCR_VidInit()
{
if( !ref.initialized ) // don't call VidInit too soon
return;

memset( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
memset( &gameui.ds, 0, sizeof( gameui.ds )); // reset a draw state
memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
memset(&clgame.ds, 0, sizeof(clgame.ds)); // reset a draw state
memset(&gameui.ds, 0, sizeof(gameui.ds)); // reset a draw state
memset(&clgame.centerPrint, 0, sizeof(clgame.centerPrint));

// update screen sizes for menu
if( gameui.globals )
Expand All @@ -795,16 +795,16 @@ void SCR_VidInit( void )
gameui.globals->scrHeight = refState.height;
}

VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL
VGui_Startup(NULL, refState.width, refState.height); // initialized already, so pass NULL

CL_ClearSpriteTextures(); // now all hud sprites are invalid

// vid_state has changed
if( gameui.hInstance ) gameui.dllFuncs.pfnVidInit();
if( clgame.hInstance ) clgame.dllFuncs.pfnVidInit();
if (gameui.hInstance) gameui.dllFuncs.pfnVidInit();
if (clgame.hInstance) clgame.dllFuncs.pfnVidInit();

// restart console size
Con_VidInit ();
Con_VidInit();
}

/*
Expand All @@ -814,7 +814,7 @@ SCR_Init
*/
void SCR_Init( void )
{
if( scr_init ) return;
//if( scr_init ) return;

scr_centertime = Cvar_Get( "scr_centertime", "2.5", 0, "centerprint hold time" );
cl_levelshot_name = Cvar_Get( "cl_levelshot_name", "*black", 0, "contains path to current levelshot" );
Expand Down Expand Up @@ -843,9 +843,9 @@ void SCR_Init( void )
}

SCR_VidInit();
SCR_LoadCreditsFont ();
SCR_RegisterTextures ();
SCR_InstallParticlePalette ();
SCR_LoadCreditsFont();
SCR_RegisterTextures();
SCR_InstallParticlePalette();
SCR_InitCinematic();
CL_InitNetgraph();

Expand Down
4 changes: 2 additions & 2 deletions engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ void CL_ParseServerTime( sizebuf_t *msg );
//
// cl_scrn.c
//
void SCR_VidInit( void );
void SCR_VidInit();
void SCR_TileClear( void );
void SCR_DirtyScreen( void );
void SCR_AddDirtyPoint( int x, int y );
Expand Down Expand Up @@ -968,7 +968,7 @@ void CL_ClearAllRemaps( void );
//
// cl_render.c
//
qboolean R_InitRenderAPI( void );
qboolean R_InitRenderAPI( qboolean );
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef );
lightstyle_t *CL_GetLightStyle( int number );
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
Expand Down
22 changes: 11 additions & 11 deletions engine/client/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,8 @@ static qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font )
{
int i, fontWidth;

if( font->valid )
return true; // already loaded
//if( font->valid )
// return true; // already loaded

if( !FS_FileExists( fontname, false ))
return false;
Expand Down Expand Up @@ -586,8 +586,8 @@ static qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font
fs_offset_t length;
qfont_t *src;

if( font->valid )
return true; // already loaded
//if( font->valid )
// return true; // already loaded

if( !FS_FileExists( fontname, false ))
return false;
Expand Down Expand Up @@ -636,7 +636,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
const char *path = NULL;
dword crc = 0;

if( font->valid ) return; // already loaded
//if( font->valid ) return; // already loaded

// replace default fonts.wad textures by current charset's font
if( !CRC32_File( &crc, "fonts.wad" ) || crc == 0x3c0a0029 )
Expand Down Expand Up @@ -2389,27 +2389,27 @@ void Con_VidInit( void )
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );

if( !con.background )
{
//if( !con.background )
//{
if( FS_FileExists( "cached/conback640", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "cached/conback", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
}
//}
}
else
{
// trying to load truecolor image first
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );

if( !con.background )
{
//if( !con.background )
//{
if( FS_FileExists( "cached/loading640", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
else if( FS_FileExists( "cached/loading", false ))
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
}
//}
}


Expand Down
Loading