Skip to content

Commit eac7540

Browse files
committed
Skip idlogo cinematic and tweak renderer lighting
Add logic to skip the idlogo cinematic when com_skipIdLogo is set: introduce CL_CinematicBasename, CL_ShouldSkipIdLogoCinematic and CL_RunCinematicNextmap, use them from CIN_PlayCinematic/CL_PlayCinematic_f and RoQShutdown. Adjust Com_Init to set/queue intro/idlogo handling based on com_skipIdLogo and com_introPlayed. Renderer: widen legacy dlight conditionals to also cover USE_PMLIGHT for bounds and light culling, remove an unused glxDlightProgramActive flag, and update GLx stream defaults/descriptions to disable r_glxStreamDrawDynamicLights by default and mark it experimental.
1 parent c0c0341 commit eac7540

8 files changed

Lines changed: 100 additions & 25 deletions

File tree

code/client/cl_cin.cpp

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,64 @@ extern int s_rawend;
9393
static void RoQ_init( void );
9494
static void CIN_SetLooping (int handle, qboolean loop);
9595

96+
static const char *CL_CinematicBasename( const char *path )
97+
{
98+
const char *slash;
99+
const char *backslash;
100+
101+
if ( !path ) {
102+
return "";
103+
}
104+
105+
slash = strrchr( path, '/' );
106+
backslash = strrchr( path, '\\' );
107+
108+
if ( slash && ( !backslash || slash > backslash ) ) {
109+
return slash + 1;
110+
}
111+
if ( backslash ) {
112+
return backslash + 1;
113+
}
114+
115+
return path;
116+
}
117+
118+
static qboolean CL_ShouldSkipIdLogoCinematic( const char *arg )
119+
{
120+
const char *base;
121+
const char *dot;
122+
size_t len;
123+
124+
if ( !Cvar_VariableIntegerValue( "com_skipIdLogo" ) ) {
125+
return qfalse;
126+
}
127+
128+
base = CL_CinematicBasename( arg );
129+
dot = strrchr( base, '.' );
130+
len = dot ? (size_t)( dot - base ) : strlen( base );
131+
132+
if ( len != 6 || Q_stricmpn( base, "idlogo", 6 ) != 0 ) {
133+
return qfalse;
134+
}
135+
136+
if ( dot && Q_stricmp( dot, ".roq" ) != 0 ) {
137+
return qfalse;
138+
}
139+
140+
return qtrue;
141+
}
142+
143+
static void CL_RunCinematicNextmap( void )
144+
{
145+
const char *s;
146+
147+
s = Cvar_VariableString( "nextmap" );
148+
if ( s[0] ) {
149+
Cbuf_ExecuteText( EXEC_APPEND, va("%s\n", s) );
150+
Cvar_Set( "nextmap", "" );
151+
}
152+
}
153+
96154
/******************************************************************************
97155
*
98156
* Class: trFMV
@@ -1329,8 +1387,6 @@ static void RoQ_init( void )
13291387
******************************************************************************/
13301388

13311389
static void RoQShutdown( void ) {
1332-
const char *s;
1333-
13341390
if (!cinTable[currentHandle].buf) {
13351391
return;
13361392
}
@@ -1349,11 +1405,7 @@ static void RoQShutdown( void ) {
13491405
// if we are aborting the intro cinematic with
13501406
// a devmap command, nextmap would be valid by
13511407
// the time it was referenced
1352-
s = Cvar_VariableString( "nextmap" );
1353-
if ( s[0] ) {
1354-
Cbuf_ExecuteText( EXEC_APPEND, va("%s\n", s) );
1355-
Cvar_Set( "nextmap", "" );
1356-
}
1408+
CL_RunCinematicNextmap();
13571409
CL_handle = -1;
13581410
}
13591411
cinTable[currentHandle].fileName[0] = '\0';
@@ -1472,6 +1524,14 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
14721524
std::array<char, MAX_OSPATH> name;
14731525
int i;
14741526

1527+
if ( CL_ShouldSkipIdLogoCinematic( arg )
1528+
&& ( ( systemBits & CIN_system ) != 0 || cls.state < CA_LOADING ) ) {
1529+
if ( ( systemBits & CIN_system ) != 0 ) {
1530+
CL_RunCinematicNextmap();
1531+
}
1532+
return -1;
1533+
}
1534+
14751535
if (strchr(arg, '/') == nullptr && strchr(arg, '\\') == nullptr) {
14761536
Com_sprintf( name.data(), static_cast<int>( name.size() ), "video/%s", arg );
14771537
} else {
@@ -1694,13 +1754,18 @@ void CL_PlayCinematic_f( void ) {
16941754
int bits = CIN_system;
16951755

16961756
Com_DPrintf("CL_PlayCinematic_f\n");
1757+
arg = Cmd_Argv( 1 );
1758+
s = Cmd_Argv(2);
1759+
1760+
if ( CL_ShouldSkipIdLogoCinematic( arg ) ) {
1761+
CL_RunCinematicNextmap();
1762+
return;
1763+
}
1764+
16971765
if (cls.state == CA_CINEMATIC) {
16981766
SCR_StopCinematic();
16991767
}
17001768

1701-
arg = Cmd_Argv( 1 );
1702-
s = Cmd_Argv(2);
1703-
17041769
if ((s && s[0] == '1') || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) {
17051770
bits |= CIN_hold;
17061771
}

code/qcommon/common.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,11 +4008,16 @@ void Com_Init( char *commandLine ) {
40084008
// if the user didn't give any commands, run default action
40094009
if ( !com_dedicated->integer ) {
40104010
#ifndef DEDICATED
4011-
if ( !com_skipIdLogo || !com_skipIdLogo->integer )
4012-
Cbuf_AddText( "cinematic idlogo.RoQ\n" );
40134011
if( !com_introPlayed->integer ) {
40144012
Cvar_Set( com_introPlayed->name, "1" );
4015-
Cvar_Set( "nextmap", "cinematic intro.RoQ" );
4013+
if ( com_skipIdLogo && com_skipIdLogo->integer ) {
4014+
Cbuf_AddText( "cinematic intro.RoQ\n" );
4015+
} else {
4016+
Cvar_Set( "nextmap", "cinematic intro.RoQ" );
4017+
}
4018+
}
4019+
if ( !com_skipIdLogo || !com_skipIdLogo->integer ) {
4020+
Cbuf_AddText( "cinematic idlogo.RoQ\n" );
40164021
}
40174022
#endif
40184023
}

code/renderer/tr_arb.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,6 @@ void GL_ProgramEnable( void )
777777

778778
#ifdef USE_PMLIGHT
779779
#ifdef RENDERER_GLX
780-
static qboolean glxDlightProgramActive = qfalse;
781-
782780
static qboolean GLX_TryStreamDrawPMLightPass( int numIndexes, const glIndex_t *indexes )
783781
{
784782
const shaderCommands_t *input;
@@ -819,7 +817,7 @@ static qboolean GLX_TryStreamDrawPMLightPass( int numIndexes, const glIndex_t *i
819817

820818
materialFlags = GLX_STAGE_DLIGHT_MAP | GLX_STAGE_ST0;
821819
categoryMask = GLX_CompatDynamicCategoryMaskForTess( input, materialFlags );
822-
if ( !glxDlightProgramActive && !GLX_CompatStreamDrawAllowsMaterial( materialFlags, 0,
820+
if ( !GLX_CompatStreamDrawAllowsMaterial( materialFlags, 0,
823821
GLX_MATERIAL_RGBGEN_IDENTITY, GLX_MATERIAL_ALPHAGEN_SKIP,
824822
GLX_MATERIAL_TCGEN_TEXTURE, GLX_MATERIAL_TCGEN_BAD,
825823
0, 0, 0, 0, 0, 0,
@@ -1222,7 +1220,6 @@ qboolean GLX_LightingSetupProgram( const shaderStage_t *pStage )
12221220
float radius;
12231221
float textureScale;
12241222

1225-
glxDlightProgramActive = qfalse;
12261223
tess.dlightUpdateParams = qfalse;
12271224
tess.cullType = tess.shader->cullType;
12281225

@@ -1301,13 +1298,11 @@ qboolean GLX_LightingSetupProgram( const shaderStage_t *pStage )
13011298
return qfalse;
13021299
}
13031300

1304-
glxDlightProgramActive = qtrue;
13051301
return qtrue;
13061302
}
13071303

13081304
void GLX_LightingProgramUnbind( void )
13091305
{
1310-
glxDlightProgramActive = qfalse;
13111306
GLX_CompatUnbindDlightProgram();
13121307
}
13131308
#endif

code/renderer/tr_bsp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
654654
cv->numPoints = numPoints;
655655
cv->numIndices = numIndexes;
656656
cv->ofsIndices = ofsIndexes;
657-
#ifdef USE_LEGACY_DLIGHTS
657+
#if defined( USE_LEGACY_DLIGHTS ) || defined( USE_PMLIGHT )
658658
ClearBounds( cv->bounds[0], cv->bounds[1] );
659659
#endif
660660

@@ -663,7 +663,7 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
663663
for ( j = 0 ; j < 3 ; j++ ) {
664664
cv->points[i][j] = LittleFloat( verts[i].xyz[j] );
665665
}
666-
#ifdef USE_LEGACY_DLIGHTS
666+
#if defined( USE_LEGACY_DLIGHTS ) || defined( USE_PMLIGHT )
667667
AddPointToBounds( cv->points[i], cv->bounds[0], cv->bounds[1] );
668668
#endif
669669
for ( j = 0 ; j < 2 ; j++ ) {

code/renderer/tr_local.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,8 @@ typedef struct {
859859
// dynamic lighting information
860860
#ifdef USE_LEGACY_DLIGHTS
861861
int dlightBits;
862+
#endif
863+
#if defined( USE_LEGACY_DLIGHTS ) || defined( USE_PMLIGHT )
862864
vec3_t bounds[2];
863865
#endif
864866
int vboItemIndex;

code/renderer/tr_world.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,15 @@ qboolean R_LightCullBounds( const dlight_t* dl, const vec3_t mins, const vec3_t
202202

203203
static qboolean R_LightCullFace( const srfSurfaceFace_t* face, const dlight_t* dl )
204204
{
205-
float d = DotProduct( dl->transformed, face->plane.normal ) - face->plane.dist;
205+
float d;
206+
207+
#if defined( USE_LEGACY_DLIGHTS ) || defined( USE_PMLIGHT )
208+
if ( R_LightCullBounds( dl, face->bounds[0], face->bounds[1] ) ) {
209+
return qtrue;
210+
}
211+
#endif
212+
213+
d = DotProduct( dl->transformed, face->plane.normal ) - face->plane.dist;
206214
if ( dl->linear )
207215
{
208216
float d2 = DotProduct( dl->transformed2, face->plane.normal ) - face->plane.dist;

code/rendererglx/glx_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static const ProfileCvarSetting GLX_PROFILE_CVARS[] = {
123123
{ "r_glxStreamDrawDepthFragment", "0", "1", "1" },
124124
{ "r_glxStreamDrawTexMods", "0", "1", "1" },
125125
{ "r_glxStreamDrawEnvironment", "0", "1", "1" },
126-
{ "r_glxStreamDrawDynamicLights", "0", "1", "1" },
126+
{ "r_glxStreamDrawDynamicLights", "0", "0", "0" },
127127
{ "r_glxStreamDrawScreenMaps", "0", "0", "0" },
128128
{ "r_glxStreamDrawVideoMaps", "0", "0", "0" },
129129
{ "r_glxStreamDrawShadows", "0", "1", "1" },

code/rendererglx/glx_stream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,9 @@ void GLX_Stream_RegisterCvars( StreamState *state )
800800
RI().Cvar_SetDescription( state->r_glxStreamDrawEnvironment,
801801
"Allow GLx streamed draws for stages using legacy CPU-computed environment texture coordinates." );
802802

803-
state->r_glxStreamDrawDynamicLights = RI().Cvar_Get( "r_glxStreamDrawDynamicLights", "1", CVAR_ARCHIVE_ND | CVAR_DEVELOPER );
803+
state->r_glxStreamDrawDynamicLights = RI().Cvar_Get( "r_glxStreamDrawDynamicLights", "0", CVAR_ARCHIVE_ND | CVAR_DEVELOPER );
804804
RI().Cvar_SetDescription( state->r_glxStreamDrawDynamicLights,
805-
"Allow GLx streamed draws for dynamic-light map stages when GLx stream drawing is enabled." );
805+
"Allow experimental GLx streamed draws for dynamic-light map stages when GLx stream drawing is enabled." );
806806

807807
state->r_glxStreamDrawScreenMaps = RI().Cvar_Get( "r_glxStreamDrawScreenMaps", "0", CVAR_ARCHIVE_ND | CVAR_DEVELOPER );
808808
RI().Cvar_SetDescription( state->r_glxStreamDrawScreenMaps,

0 commit comments

Comments
 (0)