diff --git a/engine/client/gl_rmain.c b/engine/client/gl_rmain.c index f6c607a8c..418c173a7 100644 --- a/engine/client/gl_rmain.c +++ b/engine/client/gl_rmain.c @@ -843,11 +843,17 @@ static void R_SetupGL( void ) f = sin( cl.time * r_underwater_distortion->value * ( M_PI * 2.7f )); RI.refdef.fov_x += f; RI.refdef.fov_y -= f; + + } R_SetupModelviewMatrix( &RI.refdef, RI.worldviewMatrix ); R_SetupProjectionMatrix( &RI.refdef, RI.projectionMatrix ); // if( RI.params & RP_MIRRORVIEW ) RI.projectionMatrix[0][0] = -RI.projectionMatrix[0][0]; + if( host.joke ) + { + RI.projectionMatrix[0][0] = -RI.projectionMatrix[0][0]; + } Matrix4x4_Concat( RI.worldviewProjectionMatrix, RI.projectionMatrix, RI.worldviewMatrix ); @@ -1293,6 +1299,7 @@ void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld ) if( drawWorld ) r_lastRefdef = *fd; RI.params = RP_NONE; + if( host.joke ) RI.params |= RP_FLIPFRONTFACE; RI.farClip = 0; RI.clipFlags = 15; RI.drawWorld = drawWorld; diff --git a/engine/client/input.c b/engine/client/input.c index eee3d3238..db6c53e8b 100644 --- a/engine/client/input.c +++ b/engine/client/input.c @@ -947,6 +947,12 @@ void Host_InputFrame( void ) inputstate.lastyaw = yaw; } + if( host.joke ) + { + yaw = -yaw; + side = -side; + } + if( cls.key_dest == key_game ) { clgame.dllFuncs.pfnLookEvent( yaw, pitch ); diff --git a/engine/client/s_main.c b/engine/client/s_main.c index 73b683fc7..8aa904272 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -764,6 +764,7 @@ SND_Spatialize void SND_Spatialize( channel_t *ch ) { vec3_t source_vec; + vec3_t right; float dist, dot, gain = 1.0f; qboolean fplayersound = false; qboolean looping = false; @@ -810,7 +811,11 @@ void SND_Spatialize( channel_t *ch ) // normalize source_vec and get distance from listener to source dist = VectorNormalizeLength( source_vec ); - dot = DotProduct( s_listener.right, source_vec ); + if( host.joke ) + VectorNegate( s_listener.right, right ); + else + VectorCopy( s_listener.right, right ); + dot = DotProduct( right, source_vec ); // for sounds with a radius, spatialize left/right evenly within the radius diff --git a/engine/common/common.h b/engine/common/common.h index 943fc1722..4e4be4ba9 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -447,6 +447,8 @@ typedef struct host_parm_s qboolean enabledll; qboolean textmode; qboolean daemonized; + + qboolean joke; // 1st April 2018 } host_parm_t; extern host_parm_t host; diff --git a/engine/common/host.c b/engine/common/host.c index 91909665a..6b6970f69 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -22,6 +22,7 @@ GNU General Public License for more details. #include // va_args #include // errno #include // strerror +#include #ifndef _WIN32 #include // fork @@ -70,6 +71,9 @@ convar_t *host_build, *host_ver; // fork info convar_t *host_mapdesign_fatal; convar_t *cmd_scripting = NULL; +static convar_t *host_nojoke; +static convar_t *host_forcejoke; + static int num_decals; void Sys_PrintUsage( void ) @@ -1265,6 +1269,8 @@ int EXPORT Host_Main( int argc, const char **argv, const char *progname, int bCh host_ver = Cvar_Get( "host_ver", va("%i %s %s %s %s", Q_buildnum(), XASH_VERSION, Q_buildos(), Q_buildarch(), Q_buildcommit() ), CVAR_INIT, "detailed info about this build" ); host_mapdesign_fatal = Cvar_Get( "host_mapdesign_fatal", "1", CVAR_ARCHIVE, "make map design errors fatal" ); host_xashds_hacks = Cvar_Get( "xashds_hacks", "0", 0, "hacks for xashds in singleplayer" ); + host_nojoke = Cvar_Get( "host_nojoke", "0", CVAR_ARCHIVE, "disable april fools joke"); + host_forcejoke = Cvar_Get( "host_forcejoke", "0", 0, "let april fools continue" ); // content control Cvar_Get( "violence_hgibs", "1", CVAR_ARCHIVE, "show human gib entities" ); @@ -1384,6 +1390,24 @@ int EXPORT Host_Main( int argc, const char **argv, const char *progname, int bCh if( host.state == HOST_INIT ) host.state = HOST_FRAME; // initialization is finished + if( host_forcejoke->value ) + { + host.joke = true; + } + else + { + #ifndef __ANDROID__ + time_t timeval; + struct tm *timeinfo; + + timeval = time( NULL ); + timeinfo = localtime( &timeval ); + + host.joke = !host_nojoke->value && ( timeinfo->tm_year == 118 && timeinfo->tm_mday == 1 && timeinfo->tm_mon == 3 ); + #else + host.joke = false; + #endif + } Host_FrameLoop(); // never reached