- also check for point release pak files

- make missing pak0 non fatal if fs_game != baseq3. This way total
  conversions like westernq3 work without Q3 data.
This commit is contained in:
Ludwig Nussel 2006-12-30 16:16:25 +00:00
parent 8e82c3d605
commit f6e0c6fd19
1 changed files with 61 additions and 15 deletions

View File

@ -196,12 +196,20 @@ or configs will never get loaded from disk!
*/ */
#define DEMOGAME "demota"
// every time a new demo pk3 file is built, this checksum must be updated. // every time a new demo pk3 file is built, this checksum must be updated.
// the easiest way to get it is to just run the game and see what it spits out // the easiest way to get it is to just run the game and see what it spits out
#define DEMO_PAK0_CHECKSUM 2985612116u #define DEMO_PAK0_CHECKSUM 2985612116u
#define PAK0_CHECKSUM 1566731103u static const unsigned pak_checksums[] = {
1566731103u,
298122907u,
412165236u,
2991495316u,
1197932710u,
4087071573u,
3709064859u,
908855077u,
977125798u
};
// if this is defined, the executable positively won't work with any paks other // if this is defined, the executable positively won't work with any paks other
// than the demo pak, even if productid is present. This is only used for our // than the demo pak, even if productid is present. This is only used for our
@ -2893,14 +2901,18 @@ Q3 media pak0.pk3, you'll want to remove this function
static void FS_CheckPak0( void ) static void FS_CheckPak0( void )
{ {
searchpath_t *path; searchpath_t *path;
qboolean foundPak0 = qfalse; qboolean founddemo = qfalse;
unsigned foundPak = 0;
for( path = fs_searchpaths; path; path = path->next ) { for( path = fs_searchpaths; path; path = path->next ) {
if( path->pack && const char* pakBasename = path->pack->pakBasename;
!Q_stricmpn( path->pack->pakBasename, "pak0", MAX_OSPATH ) &&
(!Q_stricmpn( path->pack->pakGamename, BASEGAME, MAX_OSPATH ) || if(!path->pack)
!Q_stricmpn( path->pack->pakGamename, "demoq3", MAX_OSPATH ))) { continue;
foundPak0 = qtrue;
if(!Q_stricmpn( path->pack->pakGamename, "demoq3", MAX_OSPATH )
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH )) {
founddemo = qtrue;
if( path->pack->checksum == DEMO_PAK0_CHECKSUM ) { if( path->pack->checksum == DEMO_PAK0_CHECKSUM ) {
Com_Printf( "\n\n" Com_Printf( "\n\n"
@ -2909,22 +2921,56 @@ static void FS_CheckPak0( void )
"from the demo. This may work fine, but it is not\n" "from the demo. This may work fine, but it is not\n"
"guaranteed or supported.\n" "guaranteed or supported.\n"
"**************************************************\n\n\n" ); "**************************************************\n\n\n" );
} else if( path->pack->checksum != PAK0_CHECKSUM ) { }
Com_Printf( "\n\n" } else if(!Q_stricmpn( path->pack->pakGamename, BASEGAME, MAX_OSPATH )
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
&& pakBasename[3] >= '0' && pakBasename[3] <= '8') {
if( path->pack->checksum != pak_checksums[pakBasename[3]-'0'] ) {
if(pakBasename[0] == '0') {
Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: pak0.pk3 is present but its checksum (%u)\n" "WARNING: pak0.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-copy pak0.pk3 from your\n" "is not correct. Please re-copy pak0.pk3 from your\n"
"legitimate Q3 CDROM.\n" "legitimate Q3 CDROM.\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
path->pack->checksum ); path->pack->checksum );
} else {
Com_Printf("\n\n"
"**************************************************\n"
"WARNING: pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install the point release\n"
"**************************************************\n\n\n",
pakBasename[3]-'0', path->pack->checksum );
}
} }
foundPak |= 1<<(pakBasename[3]-'0');
} }
} }
if( !foundPak0 ) { if( !founddemo && foundPak != 0x1ff ) {
Com_Error( ERR_FATAL, "Couldn't find pak0.pk3. Check that your Q3\n" if((foundPak&1) != 1 ) {
"executable is in the correct place and that every file\n" Com_Printf("\n\n"
"in the %s directory is present and readable.", BASEGAME); "pak0.pk3 is missing. Please copy it\n"
"from your legitimate Q3 CDROM.\n");
}
if((foundPak&0x1fe) != 0x1fe ) {
Com_Printf("\n\n"
"Point Release files are missing. Please\n"
"re-install the 1.32 point release.\n");
}
Com_Printf("\n\n"
"Also check that your Q3 executable is in\n"
"the correct place and that every file\n"
"in the %s directory is present and readable.\n", BASEGAME);
if(!fs_gamedirvar->string[0]
|| !Q_stricmp( fs_gamedirvar->string, BASEGAME )
|| !Q_stricmp( fs_gamedirvar->string, "missionpack" ))
Com_Error(ERR_FATAL, "\n*** you need to install Quake III Arena in order to play ***");
} }
} }