mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-03-04 08:01:04 +00:00
Several Fixes
* Being able to load a game without having to exit to main menu * Crouching does mess up bullet trajectory * Prevent teleport if there is a wall or obstacle between HMD and Controller (will stop people reach through walls to teleport)
This commit is contained in:
parent
d826165dc4
commit
f21e7d8598
5 changed files with 29 additions and 8 deletions
|
@ -3611,10 +3611,15 @@ void CG_Teleport() {
|
||||||
VectorMA(origin, 256, forward, endForward);
|
VectorMA(origin, 256, forward, endForward);
|
||||||
trap_CM_BoxTrace(&trace, origin, endForward, NULL, NULL, 0, MASK_SHOT);
|
trap_CM_BoxTrace(&trace, origin, endForward, NULL, NULL, 0, MASK_SHOT);
|
||||||
|
|
||||||
|
//If there anything between the controller position and the HMD
|
||||||
|
trace_t trace_test;
|
||||||
|
trap_CM_BoxTrace(&trace_test, cg.refdef.vieworg, origin, NULL, NULL, 0, MASK_SHOT);
|
||||||
|
|
||||||
ci.health = 1;
|
ci.health = 1;
|
||||||
ci.handicap = 128; // value out of 255 for alpha channel
|
ci.handicap = 128; // value out of 255 for alpha channel
|
||||||
if (trace.fraction < 1.0f && (trace.plane.normal[2] > trace.plane.normal[1] &&
|
if (trace.fraction < 1.0f &&
|
||||||
trace.plane.normal[2] > trace.plane.normal[0])) {
|
trace_test.fraction == 1.0f && //can't teleport if user has poked controller through something solid
|
||||||
|
(trace.plane.normal[2] > trace.plane.normal[1] && trace.plane.normal[2] > trace.plane.normal[0])) {
|
||||||
cgVR->teleportready = qtrue;
|
cgVR->teleportready = qtrue;
|
||||||
VectorSet(ci.color, 0, 1, 0);
|
VectorSet(ci.color, 0, 1, 0);
|
||||||
VectorCopy(trace.endpos, cgVR->teleportdest);
|
VectorCopy(trace.endpos, cgVR->teleportdest);
|
||||||
|
|
|
@ -325,6 +325,15 @@ static char cmd_tokenized[BIG_INFO_STRING + MAX_STRING_TOKENS]; // will
|
||||||
|
|
||||||
static cmd_function_t *cmd_functions; // possible commands to execute
|
static cmd_function_t *cmd_functions; // possible commands to execute
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Cmd_ClearArgc
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void Cmd_ClearArgc( void ) {
|
||||||
|
cmd_argc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cmd_Argc
|
Cmd_Argc
|
||||||
|
|
|
@ -399,6 +399,7 @@ void Cmd_RemoveCommand( const char *cmd_name );
|
||||||
void Cmd_CommandCompletion( void ( *callback )( const char *s ) );
|
void Cmd_CommandCompletion( void ( *callback )( const char *s ) );
|
||||||
// callback with each valid string
|
// callback with each valid string
|
||||||
|
|
||||||
|
void Cmd_ClearArgc( void );
|
||||||
int Cmd_Argc( void );
|
int Cmd_Argc( void );
|
||||||
char *Cmd_Argv( int arg );
|
char *Cmd_Argv( int arg );
|
||||||
void Cmd_ArgvBuffer( int arg, char *buffer, int bufferLength );
|
void Cmd_ArgvBuffer( int arg, char *buffer, int bufferLength );
|
||||||
|
|
|
@ -308,7 +308,7 @@ static void SV_MapRestart_f( void ) {
|
||||||
client_t *client;
|
client_t *client;
|
||||||
char *denied;
|
char *denied;
|
||||||
qboolean isBot;
|
qboolean isBot;
|
||||||
int delay;
|
float delay;
|
||||||
|
|
||||||
// make sure we aren't restarting twice in the same frame
|
// make sure we aren't restarting twice in the same frame
|
||||||
if ( com_frameTime == sv.serverId ) {
|
if ( com_frameTime == sv.serverId ) {
|
||||||
|
@ -336,8 +336,9 @@ static void SV_MapRestart_f( void ) {
|
||||||
delay = 5;
|
delay = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( delay && !Cvar_VariableValue( "g_doWarmup" ) ) {
|
if ( delay && !Cvar_VariableValue( "g_doWarmup" ) ) {
|
||||||
sv.restartTime = svs.time + delay * 1000;
|
sv.restartTime = svs.time + (int)(delay * 1000);
|
||||||
SV_SetConfigstring( CS_WARMUP, va( "%i", sv.restartTime ) );
|
SV_SetConfigstring( CS_WARMUP, va( "%i", sv.restartTime ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -509,6 +510,9 @@ void SV_LoadGame_f( void ) {
|
||||||
Cvar_Set( "savegame_loading", "2" ); // 2 means it's a restart, so stop rendering until we are loaded
|
Cvar_Set( "savegame_loading", "2" ); // 2 means it's a restart, so stop rendering until we are loaded
|
||||||
// set the filename
|
// set the filename
|
||||||
Cvar_Set( "savegame_filename", filename );
|
Cvar_Set( "savegame_filename", filename );
|
||||||
|
|
||||||
|
Cmd_ClearArgc();
|
||||||
|
|
||||||
// quick-restart the server
|
// quick-restart the server
|
||||||
SV_MapRestart_f(); // savegame will be loaded after restart
|
SV_MapRestart_f(); // savegame will be loaded after restart
|
||||||
|
|
||||||
|
|
|
@ -940,15 +940,17 @@ static void SV_InitGameVM( qboolean restart ) {
|
||||||
// start the entity parsing at the beginning
|
// start the entity parsing at the beginning
|
||||||
sv.entityParsePoint = CM_EntityString();
|
sv.entityParsePoint = CM_EntityString();
|
||||||
|
|
||||||
// use the current msec count for a random seed
|
//DO THIS FIRST??
|
||||||
// init for this gamestate
|
|
||||||
VM_Call( gvm, GAME_INIT, svs.time, Com_Milliseconds(), restart );
|
|
||||||
|
|
||||||
// clear all gentity pointers that might still be set from
|
// clear all gentity pointers that might still be set from
|
||||||
// a previous level
|
// a previous level
|
||||||
for ( i = 0 ; i < sv_maxclients->integer ; i++ ) {
|
for ( i = 0 ; i < sv_maxclients->integer ; i++ ) {
|
||||||
svs.clients[i].gentity = NULL;
|
svs.clients[i].gentity = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use the current msec count for a random seed
|
||||||
|
// init for this gamestate
|
||||||
|
VM_Call( gvm, GAME_INIT, svs.time, Com_Milliseconds(), restart );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue