diff --git a/Quake/cmd.c b/Quake/cmd.c index 5993d154..a392239b 100644 --- a/Quake/cmd.c +++ b/Quake/cmd.c @@ -267,6 +267,20 @@ void Cmd_Exec_f (void) } 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); Hunk_FreeToLowMark (mark); } diff --git a/Quake/common.c b/Quake/common.c index 366669e9..75b8d80f 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -1452,6 +1452,7 @@ typedef struct char com_gamedir[MAX_OSPATH]; char com_basedir[MAX_OSPATH]; 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 { @@ -1573,7 +1574,8 @@ static int COM_FindFile (const char *filename, int *handle, FILE **file, Sys_Error ("COM_FindFile: both handle and file set"); file_from_pak = 0; - + com_pakfile = NULL; + // // 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! com_filesize = pak->files[i].filelen; file_from_pak = 1; + com_pakfile = pak->filename; if (path_id) *path_id = search->path_id; if (handle) diff --git a/Quake/common.h b/Quake/common.h index 35464bfb..b0f33759 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -197,6 +197,7 @@ struct cache_user_s; extern char com_basedir[MAX_OSPATH]; extern char com_gamedir[MAX_OSPATH]; 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); int COM_OpenFile (const char *filename, int *handle, unsigned int *path_id);