Overide some old fashioned default bindings (from Eric - https://sourceforge.net/p/quakespasm/patches/17/).

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@903 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
stevenaaus 2014-04-26 10:28:13 +00:00
parent 23479771e1
commit 8891cc87a0
3 changed files with 19 additions and 1 deletions

View File

@ -267,6 +267,20 @@ void Cmd_Exec_f (void)
} }
Con_Printf ("execing %s\n",Cmd_Argv(1)); Con_Printf ("execing %s\n",Cmd_Argv(1));
// Override some key bindings in id1/pak0.pak/default.cfg
if (com_pakfile != NULL
&& strstr (com_pakfile, "id1/pak0.pak") != NULL // FIXME: Case-sensitive
&& strcmp (Cmd_Argv(1), "default.cfg") == 0)
{
Cbuf_InsertText ("bind w +forward\n");
Cbuf_InsertText ("bind a +moveleft\n");
Cbuf_InsertText ("bind s +back\n");
Cbuf_InsertText ("bind d +moveright\n");
Cbuf_InsertText ("bind MWHEELUP \"impulse 12\"\n");
Cbuf_InsertText ("bind MWHEELDOWN \"impulse 10\"\n");
Cbuf_InsertText ("+mlook\n");
}
Cbuf_InsertText (f); Cbuf_InsertText (f);
Hunk_FreeToLowMark (mark); Hunk_FreeToLowMark (mark);
} }

View File

@ -1452,6 +1452,7 @@ typedef struct
char com_gamedir[MAX_OSPATH]; char com_gamedir[MAX_OSPATH];
char com_basedir[MAX_OSPATH]; char com_basedir[MAX_OSPATH];
int file_from_pak; // ZOID: global indicating that file came from a pak int file_from_pak; // ZOID: global indicating that file came from a pak
const char *com_pakfile; // if file_from_pak is 1, the filename of the pak
typedef struct searchpath_s typedef struct searchpath_s
{ {
@ -1573,7 +1574,8 @@ static int COM_FindFile (const char *filename, int *handle, FILE **file,
Sys_Error ("COM_FindFile: both handle and file set"); Sys_Error ("COM_FindFile: both handle and file set");
file_from_pak = 0; file_from_pak = 0;
com_pakfile = NULL;
// //
// search through the path, one element at a time // search through the path, one element at a time
// //
@ -1589,6 +1591,7 @@ static int COM_FindFile (const char *filename, int *handle, FILE **file,
// found it! // found it!
com_filesize = pak->files[i].filelen; com_filesize = pak->files[i].filelen;
file_from_pak = 1; file_from_pak = 1;
com_pakfile = pak->filename;
if (path_id) if (path_id)
*path_id = search->path_id; *path_id = search->path_id;
if (handle) if (handle)

View File

@ -197,6 +197,7 @@ struct cache_user_s;
extern char com_basedir[MAX_OSPATH]; extern char com_basedir[MAX_OSPATH];
extern char com_gamedir[MAX_OSPATH]; extern char com_gamedir[MAX_OSPATH];
extern int file_from_pak; // global indicating that file came from a pak extern int file_from_pak; // global indicating that file came from a pak
extern const char *com_pakfile; // global indicating the filename of the pak if file_from_pak is 1
void COM_WriteFile (const char *filename, const void *data, int len); void COM_WriteFile (const char *filename, const void *data, int len);
int COM_OpenFile (const char *filename, int *handle, unsigned int *path_id); int COM_OpenFile (const char *filename, int *handle, unsigned int *path_id);