[iortcw] 483/497: SP: Fix loading cutscene autosaves

Simon McVittie smcv at debian.org
Fri Sep 8 10:38:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 2e3c5fd2da204ea0f8cc2e51dd95ff09a1d5ccb9
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sat Dec 19 07:37:31 2015 -0500

    SP: Fix loading cutscene autosaves
---
 SP/code/game/g_save.c | 158 ++++++++++++++++++++++++--------------------------
 1 file changed, 76 insertions(+), 82 deletions(-)

diff --git a/SP/code/game/g_save.c b/SP/code/game/g_save.c
index 45b150b..f7fa94c 100644
--- a/SP/code/game/g_save.c
+++ b/SP/code/game/g_save.c
@@ -1267,8 +1267,6 @@ qboolean G_SaveGame( char *username ) {
 		G_SaveWriteError();
 	}
 
-
-
 	// write out the entity structures
 	i = sizeof( gentity_t );
 	if ( !G_SaveWrite( &i, sizeof( i ), f ) ) {
@@ -1333,7 +1331,6 @@ qboolean G_SaveGame( char *username ) {
 		G_SaveWriteError();
 	}
 
-
 	trap_FS_FCloseFile( f );
 
 	// check the byte count
@@ -1374,6 +1371,7 @@ G_LoadGame
 */
 void G_LoadGame( char *filename ) {
 	char mapname[MAX_QPATH];
+	char mapstr[MAX_QPATH];
 	fileHandle_t f;
 	int i, leveltime, size, last;
 	gentity_t   *ent;
@@ -1420,6 +1418,7 @@ void G_LoadGame( char *filename ) {
 
 	// read the mapname (this is only used in the sever exe, so just discard it)
 	trap_FS_Read( mapname, MAX_QPATH, f );
+	Com_sprintf( mapstr, MAX_QPATH, "%s", mapname );
 
 	// read the level time
 	trap_FS_Read( &i, sizeof( i ), f );
@@ -1498,7 +1497,6 @@ void G_LoadGame( char *filename ) {
 				}
 				trap_Cvar_Set( "r_savegameFogColor", infoString );
 			}
-
 			trap_SetConfigstring( CS_FOGVARS, infoString );
 		}
 //----(SA)	end
@@ -1513,96 +1511,96 @@ void G_LoadGame( char *filename ) {
 		}
 	}
 
-
-
-
 	// reset all AAS blocking entities
 	trap_AAS_SetAASBlockingEntity( vec3_origin, vec3_origin, -1 );
 
-	// read the entity structures
-	trap_FS_Read( &i, sizeof( i ), f );
-	size = i;
-	last = 0;
-	while ( 1 )
-	{
+	if ( Q_stricmpn( mapstr, "cutscene", 8 ) ) { // Don't read in this stuff for cutscenes
+		// read the entity structures
 		trap_FS_Read( &i, sizeof( i ), f );
-		if ( i < 0 ) {
-			break;
-		}
-		if ( i >= MAX_GENTITIES ) {
-			trap_FS_FCloseFile( f );
-			G_Error( "G_LoadGame: entitynum out of range (%i, MAX = %i)\n", i, MAX_GENTITIES );
-		}
-		if ( i >= level.num_entities ) {  // notify server
-			level.num_entities = i;
-			serverEntityUpdate = qtrue;
-		}
-		ent = &g_entities[i];
-		ReadEntity( f, ent, size );
-		// free all entities that we skipped
-		for ( ; last < i; last++ ) {
-			if ( g_entities[last].inuse && i != ENTITYNUM_WORLD ) {
-				if ( last < MAX_CLIENTS ) {
-					trap_DropClient( last, "" );
-				} else {
-					G_FreeEntity( &g_entities[last] );
+		size = i;
+		last = 0;
+		while ( 1 )
+		{
+			trap_FS_Read( &i, sizeof( i ), f );
+			if ( i < 0 ) {
+				break;
+			}
+			if ( i >= MAX_GENTITIES ) {
+				trap_FS_FCloseFile( f );
+				G_Error( "G_LoadGame: entitynum out of range (%i, MAX = %i)\n", i, MAX_GENTITIES );
+			}
+			if ( i >= level.num_entities ) {  // notify server
+				level.num_entities = i;
+				serverEntityUpdate = qtrue;
+			}
+			ent = &g_entities[i];
+			ReadEntity( f, ent, size );
+			// free all entities that we skipped
+			for ( ; last < i; last++ ) {
+				if ( g_entities[last].inuse && i != ENTITYNUM_WORLD ) {
+					if ( last < MAX_CLIENTS ) {
+						trap_DropClient( last, "" );
+					} else {
+						G_FreeEntity( &g_entities[last] );
+					}
 				}
 			}
+			last = i + 1;
 		}
-		last = i + 1;
-	}
 
-	// clear all remaining entities
-	for ( ent = &g_entities[last] ; last < MAX_GENTITIES ; last++, ent++ ) {
-		memset( ent, 0, sizeof( *ent ) );
-		ent->classname = "freed";
-		ent->freetime = level.time;
-		ent->inuse = qfalse;
-	}
+		// clear all remaining entities
+		for ( ent = &g_entities[last] ; last < MAX_GENTITIES ; last++, ent++ ) {
+			memset( ent, 0, sizeof( *ent ) );
+			ent->classname = "freed";
+			ent->freetime = level.time;
+			ent->inuse = qfalse;
+		}
 
-	// read the client structures
-	trap_FS_Read( &i, sizeof( i ), f );
-	size = i;
-	while ( 1 )
-	{
+		// read the client structures
 		trap_FS_Read( &i, sizeof( i ), f );
-		if ( i < 0 ) {
-			break;
-		}
-		if ( i > MAX_CLIENTS ) {
-			trap_FS_FCloseFile( f );
-			G_Error( "G_LoadGame: clientnum out of range\n" );
-		}
-		cl = &level.clients[i];
-		if ( cl->pers.connected == CON_DISCONNECTED ) {
-			trap_FS_FCloseFile( f );
-			G_Error( "G_LoadGame: client mis-match in savegame" );
+		size = i;
+		while ( 1 )
+		{
+			trap_FS_Read( &i, sizeof( i ), f );
+			if ( i < 0 ) {
+				break;
+			}
+			if ( i > MAX_CLIENTS ) {
+				trap_FS_FCloseFile( f );
+				G_Error( "G_LoadGame: clientnum out of range\n" );
+			}
+			cl = &level.clients[i];
+			if ( cl->pers.connected == CON_DISCONNECTED ) {
+				trap_FS_FCloseFile( f );
+				G_Error( "G_LoadGame: client mis-match in savegame" );
+			}
+			ReadClient( f, cl, size );
 		}
-		ReadClient( f, cl, size );
-	}
 
-	// read the cast_state structures
-	trap_FS_Read( &i, sizeof( i ), f );
-	size = i;
-	while ( 1 )
-	{
+		// read the cast_state structures
 		trap_FS_Read( &i, sizeof( i ), f );
-		if ( i < 0 ) {
-			break;
+		size = i;
+		while ( 1 )
+		{
+			trap_FS_Read( &i, sizeof( i ), f );
+			if ( i < 0 ) {
+				break;
+			}
+			if ( i > MAX_CLIENTS ) {
+				trap_FS_FCloseFile( f );
+				G_Error( "G_LoadGame: clientnum out of range\n" );
+			}
+			cs = &caststates[i];
+			ReadCastState( f, cs, size );
 		}
-		if ( i > MAX_CLIENTS ) {
-			trap_FS_FCloseFile( f );
-			G_Error( "G_LoadGame: clientnum out of range\n" );
+
+		// inform server of entity count if it has increased
+		if ( serverEntityUpdate ) {
+			// let the server system know that there are more entities
+			trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ),
+								 &level.clients[0].ps, sizeof( level.clients[0] ) );
 		}
-		cs = &caststates[i];
-		ReadCastState( f, cs, size );
-	}
 
-	// inform server of entity count if it has increased
-	if ( serverEntityUpdate ) {
-		// let the server system know that there are more entities
-		trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ),
-							 &level.clients[0].ps, sizeof( level.clients[0] ) );
 	}
 
 //----(SA)	moved these up in ver 15
@@ -1621,7 +1619,6 @@ void G_LoadGame( char *filename ) {
 					trap_SetConfigstring( CS_MUSIC_QUEUE, musicString );
 				}
 			}
-
 		}
 
 		if ( ver > 13 ) {
@@ -1633,11 +1630,8 @@ void G_LoadGame( char *filename ) {
 			aicast_skillscale = (float)i / (float)GSKILL_MAX;
 		}
 	}
-
 //----(SA)	end moved
 
-
-
 	trap_FS_FCloseFile( f );
 
 	// now increment the attempts field and update totalplaytime according to cvar

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list