//------------------------------------------------------------------------- /* Copyright (C) 1996, 2003 - 3D Realms Entertainment This file is part of Duke Nukem 3D version 1.5 - Atomic Edition Duke Nukem 3D is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Original Source: 1996 - Todd Replogle Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- #if PLATFORM_DOS #include #include #endif /* this should be a proper prototype included from a header file */ extern int stricmp(const char *x, const char *y); #include #include #include #include #include #include "duke3d.h" #include "scriplib.h" // we load this in to get default button and key assignments // as well as setting up function mappings #include "_functio.h" // // Sound variables // int32 FXDevice; int32 MusicDevice; int32 FXVolume; int32 MusicVolume; int32 SoundToggle; int32 MusicToggle; int32 VoiceToggle; int32 AmbienceToggle; fx_blaster_config BlasterConfig; int32 NumVoices; int32 NumChannels; int32 NumBits; int32 MixRate; int32 MidiPort; int32 ReverseStereo; int32 ControllerType; int32 MouseAiming; // // Screen variables // int32 ScreenMode; int32 ScreenWidth; int32 ScreenHeight; static char setupfilename[128]; static int32 scripthandle; static int32 setupread=0; /* =================== = = CONFIG_GetSetupFilename = =================== */ #define MAXSETUPFILES 20 void CONFIG_GetSetupFilename( void ) { // this isn't hooked up to read from stdin, so skip it on Unix for now. --ryan. #if PLATFORM_UNIX GetPathFromEnvironment(setupfilename, 128, SETUPFILENAME); #else struct find_t fblock; char extension[10]; char * src; char * filenames[MAXSETUPFILES]; clock_t time; int32 numfiles; int32 i; GetPathFromEnvironment(setupfilename, 128, SETUPFILENAME); // determine extension src = setupfilename + strlen(setupfilename) - 1; while (*src != '.') { src--; } strcpy (&extension[1],src); extension[0] = '*'; numfiles=0; if (_dos_findfirst(extension,0,&fblock)==0) { do { // skip timidity.cfg if it exists; it's needed for MIDI playback // with SDL_mixer, and isn't a Duke configuration file. --ryan. if (strcmpi(fblock.name, "timidity.cfg") != 0) { filenames[numfiles]=SafeMalloc(128); strcpy(filenames[numfiles],fblock.name); numfiles++; if (numfiles == MAXSETUPFILES) break; } } while(!_dos_findnext(&fblock)); } i = CheckParm (SETUPNAMEPARM); if (i!=0) { numfiles = 0; strcpy(setupfilename,_argv[i+1]); } if (numfiles>1) { clock_t oldtime; int32 count; printf("\nMultiple Configuration Files Encountered\n"); printf("========================================\n"); printf("Please choose a configuration file from the following list by pressing its\n"); printf("corresponding letter:\n"); for (i=0;i\n",'a'+(char)i,filenames[i]); } } printf("\n"); printf("(%s will be used if no selection is made within 10 seconds.)\n\n",SETUPFILENAME); KB_FlushKeyboardQueue(); KB_ClearKeysDown(); count = 9; oldtime = clock(); time=clock()+(10*CLOCKS_PER_SEC); while (clock()oldtime) { printf("%ld seconds left. \r",count); fflush(stdout); oldtime = clock()+CLOCKS_PER_SEC; count--; } if (KB_KeyWaiting()) { int32 ch = KB_Getch(); ch -='a'; if (ch>=0 && ch