Skip to content

Commit

Permalink
Merge pull request #303 from drjaska/master
Browse files Browse the repository at this point in the history
Implement r_teleporterFlash cvar
  • Loading branch information
ec- authored Nov 11, 2024
2 parents f259765 + 81bc2fc commit a3b19a3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 3 deletions.
6 changes: 5 additions & 1 deletion code/renderer/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ static void RB_Hyperspace( void ) {

RB_SetGL2D();

c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 255);
if (r_teleporterFlash->integer == 0) {
c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 0); // fade to black
} else {
c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 255); // fade to white
}
c.rgba[3] = 255;

RB_AddQuadStamp2( backEnd.refdef.x, backEnd.refdef.y, backEnd.refdef.width, backEnd.refdef.height,
Expand Down
4 changes: 4 additions & 0 deletions code/renderer/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ cvar_t *r_greyscale;

static cvar_t *r_ignorehwgamma;

cvar_t *r_teleporterFlash;

cvar_t *r_fastsky;
cvar_t *r_neatsky;
cvar_t *r_drawSun;
Expand Down Expand Up @@ -1548,6 +1550,8 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_stereoSeparation, "Control eye separation. Resulting separation is \\r_zproj divided by this value in standard units." );
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_ignoreGLErrors, "Ignore OpenGL errors." );
r_teleporterFlash = ri.Cvar_Get( "r_teleporterFlash", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_teleporterFlash, "Show a white screen instead of a black screen when being teleported in hyperspace." );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_fastsky, "Draw flat colored skies." );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE_ND );
Expand Down
2 changes: 2 additions & 0 deletions code/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,8 @@ extern cvar_t *r_stereoSeparation; // separation of cameras for stereo renderi
extern cvar_t *r_lodbias; // push/pull LOD transitions
extern cvar_t *r_lodscale;

extern cvar_t *r_teleporterFlash; // teleport hyperspace visual

extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *r_neatsky; // nomip and nopicmip for skyboxes, cnq3 like look
extern cvar_t *r_drawSun; // controls drawing of sun quad
Expand Down
6 changes: 5 additions & 1 deletion code/renderer2/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ static void RB_Hyperspace( void ) {
// do initialization shit
}

c = ( backEnd.refdef.time & 255 ) / 255.0f;
if (r_teleporterFlash->integer == 0) {
c = ( backEnd.refdef.time & 0 ) / 255.0f; // fade to black
} else {
c = ( backEnd.refdef.time & 255 ) / 255.0f; // fade to white
}
qglClearColor( c, c, c, 1 );
qglClear( GL_COLOR_BUFFER_BIT );
qglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
Expand Down
4 changes: 4 additions & 0 deletions code/renderer2/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ cvar_t *r_greyscale;
cvar_t *r_ignorehwgamma;
cvar_t *r_measureOverdraw;

cvar_t *r_teleporterFlash;

cvar_t *r_fastsky;
cvar_t *r_drawSun;
cvar_t *r_dynamiclight;
Expand Down Expand Up @@ -1270,6 +1272,8 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_stereoSeparation, "Control eye separation. Resulting separation is \\r_zproj divided by this value in standard units." );
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_ignoreGLErrors, "Ignore OpenGL errors." );
r_teleporterFlash = ri.Cvar_Get( "r_teleporterFlash", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_teleporterFlash, "Show a white screen instead of a black screen when being teleported in hyperspace." );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_fastsky, "Draw flat colored skies." );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE );
Expand Down
2 changes: 2 additions & 0 deletions code/renderer2/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,8 @@ extern cvar_t *r_measureOverdraw; // enables stencil buffer overdraw measuremen
extern cvar_t *r_lodbias; // push/pull LOD transitions
extern cvar_t *r_lodscale;

extern cvar_t *r_teleporterFlash; // teleport hyperspace visual

extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *r_drawSun; // controls drawing of sun quad
extern cvar_t *r_dynamiclight; // dynamic lights enabled/disabled
Expand Down
6 changes: 5 additions & 1 deletion code/renderervk/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,11 @@ static void RB_Hyperspace( void ) {

RB_SetGL2D();

c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 255);
if (r_teleporterFlash->integer == 0) {
c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 0); // fade to black
} else {
c.rgba[0] = c.rgba[1] = c.rgba[2] = (backEnd.refdef.time & 255); // fade to white
}
c.rgba[3] = 255;

RB_AddQuadStamp2( backEnd.refdef.x, backEnd.refdef.y, backEnd.refdef.width, backEnd.refdef.height,
Expand Down
4 changes: 4 additions & 0 deletions code/renderervk/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ cvar_t *r_presentBits;

static cvar_t *r_ignorehwgamma;

cvar_t *r_teleporterFlash;

cvar_t *r_fastsky;
cvar_t *r_neatsky;
cvar_t *r_drawSun;
Expand Down Expand Up @@ -1575,6 +1577,8 @@ static void R_Register( void )
ri.Cvar_SetDescription( r_stereoSeparation, "Control eye separation. Resulting separation is \\r_zproj divided by this value in standard units." );
r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_ignoreGLErrors, "Ignore OpenGL errors." );
r_teleporterFlash = ri.Cvar_Get( "r_teleporterFlash", "1", CVAR_ARCHIVE );
ri.Cvar_SetDescription( r_teleporterFlash, "Show a white screen instead of a black screen when being teleported in hyperspace." );
r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE_ND );
ri.Cvar_SetDescription( r_fastsky, "Draw flat colored skies." );
r_drawSun = ri.Cvar_Get( "r_drawSun", "0", CVAR_ARCHIVE_ND );
Expand Down
2 changes: 2 additions & 0 deletions code/renderervk/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,8 @@ extern cvar_t *r_stereoSeparation; // separation of cameras for stereo renderi
extern cvar_t *r_lodbias; // push/pull LOD transitions
extern cvar_t *r_lodscale;

extern cvar_t *r_teleporterFlash; // teleport hyperspace visual

extern cvar_t *r_fastsky; // controls whether sky should be cleared or drawn
extern cvar_t *r_neatsky; // nomip and nopicmip for skyboxes, cnq3 like look
extern cvar_t *r_drawSun; // controls drawing of sun quad
Expand Down

0 comments on commit a3b19a3

Please sign in to comment.