[quake3-commits] r2294 - in trunk/code: botlib cgame game

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Jul 1 13:27:52 EDT 2012


Author: thilo
Date: 2012-07-01 13:27:52 -0400 (Sun, 01 Jul 2012)
New Revision: 2294

Modified:
   trunk/code/botlib/be_ai_move.c
   trunk/code/botlib/be_interface.c
   trunk/code/cgame/cg_ents.c
   trunk/code/cgame/cg_local.h
   trunk/code/cgame/cg_players.c
   trunk/code/cgame/cg_playerstate.c
   trunk/code/cgame/cg_predict.c
   trunk/code/cgame/cg_servercmds.c
   trunk/code/game/g_client.c
   trunk/code/game/g_cmds.c
   trunk/code/game/g_main.c
Log:
Various bugfixes by Tobias Kuehnhammer (#5270)
- A stupid bug where bots re-trigger jumppads if they fell onto it.
- A small "memset" bug concerning player animations.
- Reward sounds were never cleared and thus they are played on a map restart.
- Safer and more secure handling of disconnected clients and clients with 
  malformed or illegal info strings.
- first_gauntlet_hit.wav was not played (ops/ps) bug
- capturelimit not hit (from OAX)


Modified: trunk/code/botlib/be_ai_move.c
===================================================================
--- trunk/code/botlib/be_ai_move.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/botlib/be_ai_move.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -742,7 +742,7 @@
 int BotGetReachabilityToGoal(vec3_t origin, int areanum,
 									  int lastgoalareanum, int lastareanum,
 									  int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
-									  bot_goal_t *goal, int travelflags, int movetravelflags,
+									  bot_goal_t *goal, int travelflags,
 									  struct bot_avoidspot_s *avoidspots, int numavoidspots, int *flags)
 {
 	int i, t, besttime, bestreachnum, reachnum;
@@ -754,7 +754,6 @@
 	if (AAS_AreaDoNotEnter(areanum) || AAS_AreaDoNotEnter(goal->areanum))
 	{
 		travelflags |= TFL_DONOTENTER;
-		movetravelflags |= TFL_DONOTENTER;
 	} //end if
 	//use the routing to find the next area to go to
 	besttime = 0;
@@ -787,7 +786,7 @@
 		if (lastgoalareanum == goal->areanum && reach.areanum == lastareanum) continue;
 		//if (AAS_AreaContentsTravelFlags(reach.areanum) & ~travelflags) continue;
 		//if the travel isn't valid
-		if (!BotValidTravel(origin, &reach, movetravelflags)) continue;
+		if (!BotValidTravel(origin, &reach, travelflags)) continue;
 		//get the travel time
 		t = AAS_AreaTravelTimeToGoalArea(reach.areanum, reach.end, goal->areanum, travelflags);
 		//if the goal area isn't reachable from the reachable area
@@ -874,7 +873,7 @@
 		reachnum = BotGetReachabilityToGoal(reach.end, reach.areanum,
 						ms->lastgoalareanum, lastareanum,
 							ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
-									goal, travelflags, travelflags, NULL, 0, NULL);
+									goal, travelflags, NULL, 0, NULL);
 		VectorCopy(reach.end, end);
 		lastareanum = reach.areanum;
 		if (lastareanum == goal->areanum)
@@ -933,7 +932,7 @@
 		reachnum = BotGetReachabilityToGoal(end, areanum,
 						lastgoalareanum, lastareanum,
 							avoidreach, avoidreachtimes, avoidreachtries,
-									goal, travelflags, travelflags, NULL, 0, NULL);
+									goal, travelflags, NULL, 0, NULL);
 		if (!reachnum) return qfalse;
 		AAS_ReachabilityFromNum(reachnum, &reach);
 		//
@@ -3246,7 +3245,7 @@
 			reachnum = BotGetReachabilityToGoal(ms->origin, ms->areanum,
 								ms->lastgoalareanum, ms->lastareanum,
 											ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
-														goal, travelflags, travelflags,
+														goal, travelflags,
 																ms->avoidspots, ms->numavoidspots, &resultflags);
 			//the area number the reachability starts in
 			ms->reachareanum = ms->areanum;
@@ -3369,7 +3368,7 @@
 				lastreachnum = BotGetReachabilityToGoal(end, areas[i],
 							ms->lastgoalareanum, ms->lastareanum,
 							ms->avoidreach, ms->avoidreachtimes, ms->avoidreachtries,
-							goal, travelflags, TFL_JUMPPAD, ms->avoidspots, ms->numavoidspots, NULL);
+							goal, TFL_JUMPPAD, ms->avoidspots, ms->numavoidspots, NULL);
 				if (lastreachnum)
 				{
 					ms->lastreachnum = lastreachnum;
@@ -3389,7 +3388,6 @@
 							ms->lastreachnum = lastreachnum;
 							ms->lastareanum = areas[i];
 							//botimport.Print(PRT_MESSAGE, "found jumppad reachability hard!!\n");
-							break;
 						} //end if
 					} //end for
 					if (lastreachnum) break;

Modified: trunk/code/botlib/be_interface.c
===================================================================
--- trunk/code/botlib/be_interface.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/botlib/be_interface.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -323,7 +323,7 @@
 int BotGetReachabilityToGoal(vec3_t origin, int areanum,
 									  int lastgoalareanum, int lastareanum,
 									  int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
-									  bot_goal_t *goal, int travelflags, int movetravelflags,
+									  bot_goal_t *goal, int travelflags,
 									  struct bot_avoidspot_s *avoidspots, int numavoidspots, int *flags);
 
 int AAS_PointLight(vec3_t origin, int *red, int *green, int *blue);

Modified: trunk/code/cgame/cg_ents.c
===================================================================
--- trunk/code/cgame/cg_ents.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_ents.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -668,20 +668,21 @@
 Also called by client movement prediction code
 =========================
 */
-void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) {
+void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out, vec3_t angles_in, vec3_t angles_out) {
 	centity_t	*cent;
 	vec3_t	oldOrigin, origin, deltaOrigin;
-	vec3_t	oldAngles, angles;
-	//vec3_t	deltaAngles;
+	vec3_t	oldAngles, angles, deltaAngles;
 
 	if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) {
 		VectorCopy( in, out );
+		VectorCopy(angles_in, angles_out);
 		return;
 	}
 
 	cent = &cg_entities[ moverNum ];
 	if ( cent->currentState.eType != ET_MOVER ) {
 		VectorCopy( in, out );
+		VectorCopy(angles_in, angles_out);
 		return;
 	}
 
@@ -692,10 +693,10 @@
 	BG_EvaluateTrajectory( &cent->currentState.apos, toTime, angles );
 
 	VectorSubtract( origin, oldOrigin, deltaOrigin );
-	//VectorSubtract( angles, oldAngles, deltaAngles );
+	VectorSubtract( angles, oldAngles, deltaAngles );
 
 	VectorAdd( in, deltaOrigin, out );
-
+	VectorAdd( angles_in, deltaAngles, angles_out );
 	// FIXME: origin change when on a rotating object
 }
 
@@ -773,7 +774,7 @@
 	// player state
 	if ( cent != &cg.predictedPlayerEntity ) {
 		CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum, 
-		cg.snap->serverTime, cg.time, cent->lerpOrigin );
+		cg.snap->serverTime, cg.time, cent->lerpOrigin, cent->lerpAngles, cent->lerpAngles);
 	}
 }
 

Modified: trunk/code/cgame/cg_local.h
===================================================================
--- trunk/code/cgame/cg_local.h	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_local.h	2012-07-01 17:27:52 UTC (rev 2294)
@@ -1333,7 +1333,7 @@
 void CG_SetEntitySoundPosition( centity_t *cent );
 void CG_AddPacketEntities( void );
 void CG_Beam( centity_t *cent );
-void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
+void CG_AdjustPositionForMover(const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out, vec3_t angles_in, vec3_t angles_out);
 
 void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent, 
 							qhandle_t parentModel, char *tagName );

Modified: trunk/code/cgame/cg_players.c
===================================================================
--- trunk/code/cgame/cg_players.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_players.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -2615,7 +2615,7 @@
 	cent->pe.legs.pitchAngle = 0;
 	cent->pe.legs.pitching = qfalse;
 
-	memset( &cent->pe.torso, 0, sizeof( cent->pe.legs ) );
+	memset( &cent->pe.torso, 0, sizeof( cent->pe.torso ) );
 	cent->pe.torso.yawAngle = cent->rawAngles[YAW];
 	cent->pe.torso.yawing = qfalse;
 	cent->pe.torso.pitchAngle = cent->rawAngles[PITCH];

Modified: trunk/code/cgame/cg_playerstate.c
===================================================================
--- trunk/code/cgame/cg_playerstate.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_playerstate.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -375,7 +375,7 @@
 	}
 	if (ps->persistant[PERS_GAUNTLET_FRAG_COUNT] != ops->persistant[PERS_GAUNTLET_FRAG_COUNT]) {
 #ifdef MISSIONPACK
-		if (ops->persistant[PERS_GAUNTLET_FRAG_COUNT] == 1) {
+		if (ps->persistant[PERS_GAUNTLET_FRAG_COUNT] == 1) {
 			sfx = cgs.media.firstHumiliationSound;
 		} else {
 			sfx = cgs.media.humiliationSound;

Modified: trunk/code/cgame/cg_predict.c
===================================================================
--- trunk/code/cgame/cg_predict.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_predict.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -534,9 +534,9 @@
 				}
 				cg.thisFrameTeleport = qfalse;
 			} else {
-				vec3_t	adjusted;
+				vec3_t adjusted, new_angles;
 				CG_AdjustPositionForMover( cg.predictedPlayerState.origin, 
-					cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted );
+				cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted, cg.predictedPlayerState.viewangles, new_angles);
 
 				if ( cg_showmiss.integer ) {
 					if (!VectorCompare( oldPlayerState.origin, adjusted )) {
@@ -604,7 +604,7 @@
 	// adjust for the movement of the groundentity
 	CG_AdjustPositionForMover( cg.predictedPlayerState.origin, 
 		cg.predictedPlayerState.groundEntityNum, 
-		cg.physicsTime, cg.time, cg.predictedPlayerState.origin );
+		cg.physicsTime, cg.time, cg.predictedPlayerState.origin, cg.predictedPlayerState.viewangles, cg.predictedPlayerState.viewangles);
 
 	if ( cg_showmiss.integer ) {
 		if (cg.predictedPlayerState.eventSequence > oldPlayerState.eventSequence + MAX_PS_EVENTS) {

Modified: trunk/code/cgame/cg_servercmds.c
===================================================================
--- trunk/code/cgame/cg_servercmds.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/cgame/cg_servercmds.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -457,7 +457,8 @@
 	cg.fraglimitWarnings = 0;
 
 	cg.timelimitWarnings = 0;
-
+	cg.rewardTime = 0;
+	cg.rewardStack = 0;
 	cg.intermissionStarted = qfalse;
 	cg.levelShot = qfalse;
 

Modified: trunk/code/game/g_client.c
===================================================================
--- trunk/code/game/g_client.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/game/g_client.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -722,6 +722,8 @@
 	// check for malformed or illegal info strings
 	if ( !Info_Validate(userinfo) ) {
 		strcpy (userinfo, "\\name\\badinfo");
+		// don't keep those clients and userinfo
+		trap_DropClient(clientNum, "Invalid userinfo");
 	}
 
 	// check for local client
@@ -938,7 +940,12 @@
 			return "Invalid password";
 		}
 	}
-
+	// if a player reconnects quickly after a disconnect, the client disconnect may never be called, thus flag can get lost in the ether
+	if (ent->inuse) {
+		G_LogPrintf("Forcing disconnect on active client: %i\n", ent-g_entities);
+		// so lets just fix up anything that should happen on a disconnect
+		ClientDisconnect(ent-g_entities);
+	}
 	// they can connect
 	ent->client = level.clients + clientNum;
 	client = ent->client;
@@ -1271,7 +1278,7 @@
 	G_RemoveQueuedBotBegin( clientNum );
 
 	ent = g_entities + clientNum;
-	if ( !ent->client ) {
+	if (!ent->client || ent->client->pers.connected == CON_DISCONNECTED) {
 		return;
 	}
 

Modified: trunk/code/game/g_cmds.c
===================================================================
--- trunk/code/game/g_cmds.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/game/g_cmds.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -1590,7 +1590,7 @@
 	char	cmd[MAX_TOKEN_CHARS];
 
 	ent = g_entities + clientNum;
-	if ( !ent->client ) {
+	if (!ent->client || ent->client->pers.connected != CON_CONNECTED) {
 		return;		// not fully in game yet
 	}
 

Modified: trunk/code/game/g_main.c
===================================================================
--- trunk/code/game/g_main.c	2012-07-01 17:01:30 UTC (rev 2293)
+++ trunk/code/game/g_main.c	2012-07-01 17:27:52 UTC (rev 2294)
@@ -1363,10 +1363,6 @@
 		}
 	}
 
-	if ( level.numPlayingClients < 2 ) {
-		return;
-	}
-
 	if ( g_gametype.integer < GT_CTF && g_fraglimit.integer ) {
 		if ( level.teamScores[TEAM_RED] >= g_fraglimit.integer ) {
 			trap_SendServerCommand( -1, "print \"Red hit the fraglimit.\n\"" );



More information about the quake3-commits mailing list