hi,
How can i use the function COM_LoadPackFile?
I made a Language menu
here is a small part
case 0:
COM_LoadPackFile ("PAKeng");
M_Menu_Main_f();
break;
case 1:
COM_LoadPackFile ("PAKdt");
M_Menu_Main_f();
break;
I removed my singleplayer.lmp from PAK0
and added it to PAKeng and PAKdt with different languages.
The Game starts with the language menu.
If I choose a language it should load the pak file and
go to main menu but
says singleplayer.lmp not found.
i think it doesn´t load the pak file but i don´t know why.
COM_LoadPackFile
Re: COM_LoadPackFile
With the code above, you aren't specifying a directory or a file extension so it isn't finding the file.Stealth Kill wrote: case 0:
COM_LoadPackFile ("PAKeng");
M_Menu_Main_f();
break;
case 1:
COM_LoadPackFile ("PAKdt");
M_Menu_Main_f();
break;
Code: Select all
//
// add any pak files in the format pak0.pak pak1.pak, ...
//
for (i=0 ; ; i++)
{
sprintf (pakfile, "%s/pak%i.pak", dir, i);
pak = COM_LoadPackFile (pakfile);
Re: COM_LoadPackFile
ADD: Try these instead COM_LoadPackFile(va("%s/pakeng.pak", dir)) and COM_LoadPackFile(va("%s/pakdt.pak", dir));Stealth Kill wrote: case 0:
COM_LoadPackFile ("PAKeng");
M_Menu_Main_f();
break;
case 1:
COM_LoadPackFile ("PAKdt");
M_Menu_Main_f();
break;
Should work, at least as far as properly getting the pak file acknowledged as a place to look for files.
However, it looks like you are doing the above in the menu. The .lmp files are read rather early. Unless you are doing a command line parameter to specify the language, you'd need to get the menu elements reloaded.
-
- Posts: 83
- Joined: Fri Dec 29, 2006 12:34 pm
Sometime later today (several hours from now), I'll help you add it as a command line parameter (i.e. "yourquake -english") which will at least get this initially working for you for testing.Stealth Kill wrote:hmmm i don´t know how to reload the menu
From that point forward, I'll look and see what surprises lie in reloading the menu elements (if any).
The command line parameter method of solving your problem:
In the example, there are 2 pak files named menu-dt.pak and menu-eng.pak.
If "-lang_dt" is added to the command line as such:
c:\quake\quake.exe -lang_dt
It will load the menu-dt.pak, otherwise it will by default use the menu-eng.pak.
In the example, there are 2 pak files named menu-dt.pak and menu-eng.pak.
If "-lang_dt" is added to the command line as such:
c:\quake\quake.exe -lang_dt
It will load the menu-dt.pak, otherwise it will by default use the menu-eng.pak.
I didn't test this out but it should work as-is.common.c wrote: /*
================
COM_AddGameDirectory
Sets com_gamedir, adds the directory to the head of the path,
then loads and adds pak1.pak pak2.pak ...
================
*/
void COM_AddGameDirectory (char *dir)
{
int i;
searchpath_t *search;
pack_t *pak;
char pakfile[MAX_OSPATH];
strcpy (com_gamedir, dir);
//
// add the directory to the search path
//
search = Hunk_Alloc (sizeof(searchpath_t));
strcpy (search->filename, dir);
search->next = com_searchpaths;
com_searchpaths = search;
//
// add any pak files in the format pak0.pak pak1.pak, ...
//
for (i=0 ; ; i++)
{
sprintf (pakfile, "%s/pak%i.pak", dir, i);
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
search = Hunk_Alloc (sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
}
/* Begin modification */
if ((i = COM_CheckParm("-lang_dt"))) { // Check for command line param
// Load German Menu
sprintf (pakfile, "%s/menu-dt.pak", dir); // set filename
} else {
// None specified, load English
sprintf (pakfile, "%s/menu-eng.pak", dir); // set filename
}
pak = COM_LoadPackFile (pakfile); // Try to load it
if (pak) { // If successfully loaded, add to end of search paths
search = Hunk_Alloc (sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
}
/* End modification */
//
// add the contents of the parms.txt file to the end of the command line
//
}
-
- Posts: 83
- Joined: Fri Dec 29, 2006 12:34 pm
It works thanks
is it possible with a cvar too?
i tried this
if i write this language "1" to my config.cfg
it stilll loads the english.pak.
is it possible with a cvar too?
i tried this
Code: Select all
/* Begin modification */
if (i = (language.value == 1)) {
// Load German Menu
sprintf (pakfile, "%s/german.pak", dir); // set filename
} else {
// None specified, load English
sprintf (pakfile, "%s/english.pak", dir); // set filename
it stilll loads the english.pak.
Not as easily in the way you want to do it. The pakfiles are read at startup. Then the graphics are loaded.Stealth Kill wrote:It works thanks
is it possible with a cvar too?
It would almost be easier to load both menus at startup and have both sets of menus available. Then you could use a cvar.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..