@@ -3015,6 +3015,28 @@ void COM_WriteSelectedBaseDir (void)
30153015#endif
30163016}
30173017
3018+ /*
3019+ =================
3020+ COM_MountNightdiveUserDir
3021+
3022+ The official rerelease client downloads add-ons into its user dir
3023+ (e.g. Saved Games/Nightdive Studios/Quake); mount it as an extra
3024+ content root so they show up in the mods menu (like Ironwail does)
3025+ =================
3026+ */
3027+ static char com_nightdivedir [MAX_OSPATH ];
3028+
3029+ static void COM_MountNightdiveUserDir (void )
3030+ {
3031+ if (!com_nightdivedir [0 ] || COM_CheckParm ("-nonightdive" ))
3032+ return ;
3033+ if (Sys_FileType (com_nightdivedir ) != FS_ENT_DIRECTORY )
3034+ return ;
3035+
3036+ COM_AddBaseDir (com_nightdivedir );
3037+ Sys_Printf ("Mounted Nightdive add-on dir %s\n" , com_nightdivedir );
3038+ }
3039+
30183040/*
30193041=================
30203042COM_FindStoreBaseDir
@@ -3044,27 +3066,45 @@ static void COM_FindStoreBaseDir (void)
30443066 {
30453067 if ((size_t )q_snprintf (remastered , sizeof (remastered ), "%s/rerelease" , original ) >= sizeof (remastered ))
30463068 remastered [0 ] = '\0' ;
3069+ else if (!Sys_GetNightdiveUserDir (com_nightdivedir , sizeof (com_nightdivedir ), steamquake .library ))
3070+ com_nightdivedir [0 ] = '\0' ;
30473071 }
30483072 }
30493073
30503074 if ((!forced || force_gog ) && !COM_CheckParm ("-nogog" ))
30513075 {
30523076 if (!original [0 ] && !Sys_GetGOGQuakeDir (original , sizeof (original )))
30533077 original [0 ] = '\0' ;
3054- if (!remastered [0 ] && !Sys_GetGOGQuakeEnhancedDir (remastered , sizeof (remastered )))
3055- remastered [0 ] = '\0' ;
3078+ if (!remastered [0 ])
3079+ {
3080+ if (Sys_GetGOGQuakeEnhancedDir (remastered , sizeof (remastered )))
3081+ {
3082+ if (!com_nightdivedir [0 ] && !Sys_GetNightdiveUserDir (com_nightdivedir , sizeof (com_nightdivedir ), NULL ))
3083+ com_nightdivedir [0 ] = '\0' ;
3084+ }
3085+ else
3086+ remastered [0 ] = '\0' ;
3087+ }
30563088 }
30573089
30583090 if ((!forced || force_egs ) && !COM_CheckParm ("-noegs" ) && !COM_CheckParm ("-noepic" ))
30593091 {
3060- if (!remastered [0 ] && !EGS_FindGame (remastered , sizeof (remastered ), QUAKE_EGS_NAMESPACE , QUAKE_EGS_ITEM_ID , QUAKE_EGS_APP_NAME ))
3061- remastered [0 ] = '\0' ;
3092+ if (!remastered [0 ])
3093+ {
3094+ if (EGS_FindGame (remastered , sizeof (remastered ), QUAKE_EGS_NAMESPACE , QUAKE_EGS_ITEM_ID , QUAKE_EGS_APP_NAME ))
3095+ {
3096+ if (!com_nightdivedir [0 ] && !Sys_GetNightdiveUserDir (com_nightdivedir , sizeof (com_nightdivedir ), NULL ))
3097+ com_nightdivedir [0 ] = '\0' ;
3098+ }
3099+ else
3100+ remastered [0 ] = '\0' ;
3101+ }
30623102 }
30633103
30643104 if (original [0 ] && !COM_IsValidFlavorDir (original , QUAKE_FLAVOR_ORIGINAL ))
30653105 original [0 ] = '\0' ;
30663106 if (remastered [0 ] && !COM_IsValidFlavorDir (remastered , QUAKE_FLAVOR_REMASTERED ))
3067- remastered [0 ] = '\0' ;
3107+ remastered [0 ] = com_nightdivedir [ 0 ] = '\0' ;
30683108
30693109 requested = COM_RequestedQuakeFlavor ();
30703110
@@ -3143,6 +3183,11 @@ static void COM_FindStoreBaseDir (void)
31433183
31443184 q_strlcpy (com_basedir , (flavor == QUAKE_FLAVOR_REMASTERED ) ? remastered : original , sizeof (com_basedir ));
31453185 Sys_Printf ("Using Quake data from %s\n" , com_basedir );
3186+
3187+ if (flavor == QUAKE_FLAVOR_REMASTERED )
3188+ COM_MountNightdiveUserDir ();
3189+ else
3190+ com_nightdivedir [0 ] = '\0' ;
31463191}
31473192
31483193/*
@@ -3190,40 +3235,6 @@ static void COM_InitSteamAPI (void)
31903235 Steam_Init (& steamquake );
31913236}
31923237
3193- /*
3194- =================
3195- COM_MountNightdiveUserDir
3196-
3197- The official rerelease client downloads add-ons into its user dir
3198- (e.g. Saved Games/Nightdive Studios/Quake); mount it as an extra
3199- content root so they show up in the mods menu (like Ironwail does)
3200- =================
3201- */
3202- static void COM_MountNightdiveUserDir (void )
3203- {
3204- steamgame_t steamquake ;
3205- char path [MAX_OSPATH ];
3206- const char * steamlibrary = NULL ;
3207-
3208- if (COM_CheckParm ("-nonightdive" ))
3209- return ;
3210-
3211- // only relevant when running rerelease data
3212- if ((size_t )q_snprintf (path , sizeof (path ), "%s/QuakeEX.kpf" , com_basedir ) >= sizeof (path ) || Sys_FileType (path ) != FS_ENT_FILE )
3213- return ;
3214-
3215- if (!COM_CheckParm ("-nosteam" ) && Steam_FindGame (& steamquake , QUAKE_STEAM_APPID ))
3216- steamlibrary = steamquake .library ;
3217-
3218- if (!Sys_GetNightdiveUserDir (path , sizeof (path ), steamlibrary ))
3219- return ;
3220- if (Sys_FileType (path ) != FS_ENT_DIRECTORY || COM_IsPathPrefix (path , com_basedir ))
3221- return ;
3222-
3223- COM_AddBaseDir (path );
3224- Sys_Printf ("Mounted Nightdive add-on dir %s\n" , path );
3225- }
3226-
32273238/*
32283239=================
32293240COM_InitFilesystem
@@ -3262,8 +3273,6 @@ void COM_InitFilesystem (void) // johnfitz -- modified based on topaz's tutorial
32623273 // no matter whether it was found by detection, -basedir or the working directory
32633274 COM_InitSteamAPI ();
32643275
3265- COM_MountNightdiveUserDir ();
3266-
32673276 i = COM_CheckParmNext (i , "-basegame" );
32683277 if (i )
32693278 { //-basegame:
0 commit comments