1
0
Fork 0

Added suffixes for engine-specific syscall extensions

Added trap_IsRecordingDemo extension
Try to use better source for client's challenge
This commit is contained in:
ec- 2018-11-21 21:38:11 +02:00
parent 9e4d882b4f
commit c01c7f4bf5
6 changed files with 16 additions and 6 deletions

View File

@ -181,6 +181,7 @@ typedef enum {
CG_R_ADDREFENTITYTOSCENE2,
CG_R_FORCEFIXEDDLIGHTS,
CG_R_ADDLINEARLIGHTTOSCENE,
CG_IS_RECORDING_DEMO,
CG_TRAP_GETVALUE = COM_TRAP_GETVALUE,
} cgameImport_t;

View File

@ -413,11 +413,16 @@ static qboolean CL_GetValue( char* value, int valueSize, const char* key ) {
return qtrue;
}
if ( !Q_stricmp( key, "trap_R_AddLinearLightToScene" ) && re.AddLinearLightToScene ) {
if ( !Q_stricmp( key, "trap_R_AddLinearLightToScene_Q3E" ) && re.AddLinearLightToScene ) {
Com_sprintf( value, valueSize, "%i", CG_R_ADDLINEARLIGHTTOSCENE );
return qtrue;
}
if ( !Q_stricmp( key, "trap_IsRecordingDemo" ) ) {
Com_sprintf( value, valueSize, "%i", CG_IS_RECORDING_DEMO );
return qtrue;
}
return qfalse;
}
@ -756,6 +761,9 @@ static intptr_t CL_CgameSystemCalls( intptr_t *args ) {
CL_ForceFixedDlights();
return 0;
case CG_IS_RECORDING_DEMO:
return clc.demorecording;
case CG_TRAP_GETVALUE:
VM_CHECKBOUNDS( cgvm, args[1], args[2] );
return CL_GetValue( VMA(1), args[2], VMA(3) );

View File

@ -1652,7 +1652,8 @@ static void CL_Connect_f( void ) {
cls.state = CA_CONNECTING;
// Set a client challenge number that ideally is mirrored back by the server.
clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds();
//clc.challenge = ((rand() << 16) ^ rand()) ^ Com_Milliseconds();
Com_RandomBytes( (char*)&clc.challenge, sizeof( clc.challenge ) );
}
Key_SetCatcher( 0 );

View File

@ -766,7 +766,7 @@ static qboolean UI_GetValue( char* value, int valueSize, const char* key ) {
return qtrue;
}
if ( !Q_stricmp( key, "trap_R_AddLinearLightToScene" ) && re.AddLinearLightToScene ) {
if ( !Q_stricmp( key, "trap_R_AddLinearLightToScene_Q3E" ) && re.AddLinearLightToScene ) {
Com_sprintf( value, valueSize, "%i", UI_R_ADDLINEARLIGHTTOSCENE );
return qtrue;
}

View File

@ -4431,10 +4431,10 @@ void Com_RandomBytes( byte *string, int len )
{
int i;
if( Sys_RandomBytes( string, len ) )
if ( Sys_RandomBytes( string, len ) )
return;
Com_Printf( "Com_RandomBytes: using weak randomization\n" );
Com_Printf( S_COLOR_YELLOW "Com_RandomBytes: using weak randomization\n" );
srand( time( NULL ) );
for( i = 0; i < len; i++ )
string[i] = (unsigned char)( rand() % 256 );

View File

@ -342,7 +342,7 @@ void *GVM_ArgPtr( intptr_t intValue )
static qboolean SV_GetValue( char* value, int valueSize, const char* key )
{
if ( !Q_stricmp( key, "SVF_SELF_PORTAL2" ) )
if ( !Q_stricmp( key, "SVF_SELF_PORTAL2_Q3E" ) )
{
Com_sprintf( value, valueSize, "%i", SVF_SELF_PORTAL2 );
return qtrue;