add add_to_end parameter to cfile_init, allowing custom MIDI music to be found in an add-on hog

This commit is contained in:
kreatordxx 2007-05-27 02:24:00 +00:00
parent 0de587cadf
commit 5c7f38f8e2
5 changed files with 13 additions and 9 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20070527
--------
include/cfile.h, main/inferno.c, main/mission.c, main/movie.c: add add_to_end parameter to cfile_init, allowing custom MIDI music to be found in an add-on hog
20070523
--------
arch/ogl/gr.c: make sure gl functions are not called before OpenGL is initialised, when fullscreen switching

View file

@ -50,14 +50,14 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
//}
//Specify the name of the hogfile. Returns 1 if hogfile found & had files
static inline int cfile_init(char *hogname)
static inline int cfile_init(char *hogname, int add_to_end)
{
char pathname[PATH_MAX];
if (!PHYSFSX_getRealPath(hogname, pathname))
return 0;
if (!PHYSFS_addToSearchPath(pathname, 1))
if (!PHYSFS_addToSearchPath(pathname, add_to_end))
{ // try the 'Data' directory for old Mac Descent directories compatibility
char std_path[PATH_MAX] = "Data/";
@ -67,7 +67,7 @@ static inline int cfile_init(char *hogname)
if (!PHYSFSX_getRealPath(std_path, pathname))
return 0;
return PHYSFS_addToSearchPath(pathname, 1);
return PHYSFS_addToSearchPath(pathname, add_to_end);
}
return 1;

View file

@ -438,8 +438,8 @@ int main(int argc, char *argv[])
else if (FindArg("-verbose"))
con_threshold.value = (float)1;
if (! cfile_init("descent2.hog"))
if (! cfile_init("d2demo.hog"))
if (! cfile_init("descent2.hog", 1))
if (! cfile_init("d2demo.hog", 1))
Error("Could not find a valid hog file (descent2.hog or d2demo.hog)\nPossible locations are:\n"
#ifdef __unix__
"\t$HOME/.d2x-rebirth\n"

View file

@ -629,7 +629,7 @@ int load_mission(mle *mission)
// for Descent 1 missions, load descent.hog
if (EMULATING_D1) {
if (!cfile_init("descent.hog"))
if (!cfile_init("descent.hog", 1))
Warning("descent.hog not available, this mission may be missing some files required for briefings and exit sequence\n");
if (!stricmp(Current_mission_filename, D1_MISSION_FILENAME))
return load_mission_d1();
@ -692,7 +692,7 @@ int load_mission(mle *mission)
PHYSFSEXT_locateCorrectCase(buf);
found_hogfile = cfile_init(buf);
found_hogfile = cfile_init(buf, 0);
//require mission to be in hogfile
if (! found_hogfile) {
@ -733,7 +733,7 @@ int load_mission(mle *mission)
while (*(++bufp) == ' ')
;
cfile_init(bufp);
cfile_init(bufp, 0);
mprintf((0, "Hog file override = [%s]\n", bufp));
}
else if (istok(buf,"briefing")) {

View file

@ -602,7 +602,7 @@ void init_movie(char *movielib, int required)
sprintf(filename, "%s-%s.mvl", movielib, MovieHires?"h":"l");
if (!cfile_init(filename))
if (!cfile_init(filename, 0))
{
if (required)
con_printf(CON_URGENT, "Can't open movielib <%s>: %s\n", filename, PHYSFS_getLastError());