コード例 #1
0
static void DoJoinGame(void *unused1, void *unused2)
{
    execute_context_t *exec;

    exec = NewExecuteContext();

    if (jointype == JOIN_ADDRESS)
    {
        AddCmdLineParameter(exec, "-connect %s", connect_address);
    }
    else if (jointype == JOIN_AUTO_LAN)
    {
        AddCmdLineParameter(exec, "-autojoin");
    }

    // Extra parameters come first, so that they can be used to override
    // the other parameters.

    AddExtraParameters(exec);
    AddIWADParameter(exec);
    AddWADs(exec);

    TXT_Shutdown();
    
    M_SaveDefaults();

    AddConfigParameters(exec);

    ExecuteDoom(exec);

    exit(0);
}
コード例 #2
0
ファイル: i_system.cpp プロジェクト: WChrisK/OdaStats
void STACK_ARGS I_Quit (void)
{
	has_exited = 1;		/* Prevent infinitely recursive exits -- killough */

	G_ClearSnapshots ();

	CL_QuitNetGame();

	M_SaveDefaults();

	//I_ShutdownHardware();

    CloseNetwork();

	DConsoleAlias::DestroyAll();

	try
	{
		if (r_showendoom && !Args.CheckParm ("-novideo"))
			I_Endoom();
	}
	catch (CRecoverableError &error)
	{
		// [AM] ENDOOM does not exist, but at this point we don't care.
	}
}
コード例 #3
0
ファイル: i_system.cpp プロジェクト: JonnyPtn/SFML-DOOM
//
// I_Quit
//
void I_Quit (void)
{
    D_QuitNetGame ();
    I_Sound::getInstance()->shutdown();
    M_SaveDefaults ();
    I_ShutdownGraphics();
    exit(0);
}
コード例 #4
0
ファイル: m_misc.cpp プロジェクト: Jayman2000/zdoom-pull
void M_SaveDefaultsFinal ()
{
	while (!M_SaveDefaults (NULL) && I_WriteIniFailed ())
	{
		/* Loop until the config saves or I_WriteIniFailed() returns false */
	}
	delete GameConfig;
	GameConfig = NULL;
}
コード例 #5
0
ファイル: i_system.c プロジェクト: bmarcot/DOOM
//
// I_Quit
//
void I_Quit (void)
{
    D_QuitNetGame ();
    I_ShutdownSound();
    I_ShutdownMusic();
    M_SaveDefaults ();
    I_ShutdownGraphics();
    exit(0);
}
コード例 #6
0
ファイル: i_system.cpp プロジェクト: JohnnyonFlame/odamex
void STACK_ARGS I_Quit (void)
{
	has_exited = 1;		/* Prevent infinitely recursive exits -- killough */

	G_ClearSnapshots ();
	
	CL_QuitNetGame();

	M_SaveDefaults();
}
コード例 #7
0
//
// I_Quit
//
void I_Quit (void)
{
//    __libclog_printf("Calling I_Quit from %x\n",__builtin_return_address(0));
    D_QuitNetGame ();
    I_ShutdownSound();
 //   I_ShutdownMusic();
    M_SaveDefaults ();
//    I_ShutdownGraphics();
    exit(0);
}
コード例 #8
0
ファイル: mainmenu.c プロジェクト: Clever-Boy/chocolate-doom
static void DoQuit(void *widget, void *dosave)
{
    if (dosave != NULL)
    {
        M_SaveDefaults();
    }

    TXT_Shutdown();

    exit(0);
}
コード例 #9
0
ファイル: i_system.c プロジェクト: aagallag/psDooM
//
// I_Quit
//
void I_Quit(void)
{
    D_QuitNetGame();
    I_ShutdownMusic();
    I_ShutdownSound();
    M_SaveDefaults();
    I_ShutdownGraphics();
    printf("\r");
    ShowEndTxt();
    exit(0);
}
コード例 #10
0
//
// I_Quit
//
void I_Quit (void)
{
    D_QuitNetGame ();
    I_ShutdownSound();
    I_ShutdownMusic();
    M_SaveDefaults ();
    I_ShutdownGraphics();
//    exit(0);

// Exceptions disabled by default on PS3
//	throw;
}
コード例 #11
0
void D_DoomDeinit(void)
{
  lprintf(LO_INFO,"D_DoomDeinit:\n");
  //Deinit
  M_QuitDOOM(0);
  Z_Close();
#ifdef HAVE_NET
  D_QuitNetGame();
  I_ShutdownNetwork();
#endif
  M_SaveDefaults ();
  W_Exit();
  I_ShutdownSound();
  I_ShutdownMusic();
  p_checksum_cleanup();
}
コード例 #12
0
void STACK_ARGS I_Quit (void)
{
	has_exited = 1;		/* Prevent infinitely recursive exits -- killough */

	G_ClearSnapshots ();

	CL_QuitNetGame();

	M_SaveDefaults();

	//I_ShutdownHardware();

    CloseNetwork();

	if (r_showendoom && !Args.CheckParm ("-novideo"))
		I_Endoom();
}
コード例 #13
0
ファイル: m_config.c プロジェクト: fielder/chocolate-doom
void M_SaveDefaultsAlternate(char *main, char *extra)
{
    char *orig_main;
    char *orig_extra;

    // Temporarily change the filenames

    orig_main = doom_defaults.filename;
    orig_extra = extra_defaults.filename;

    doom_defaults.filename = main;
    extra_defaults.filename = extra;

    M_SaveDefaults();

    // Restore normal filenames

    doom_defaults.filename = orig_main;
    extra_defaults.filename = orig_extra;
}
コード例 #14
0
ファイル: i_system.c プロジェクト: Slipyx/Mint-Doom
void I_Quit (void)
{
    D_QuitNetGame ();
    G_CheckDemoStatus();
    S_Shutdown();

    if (!screensaver_mode)
    {
        M_SaveDefaults ();
    }

    I_ShutdownGraphics();

    if (show_endoom && !testcontrols && !screensaver_mode)
    {
        I_Endoom();
    }

    exit(0);
}
コード例 #15
0
ファイル: mainmenu.c プロジェクト: Clever-Boy/chocolate-doom
static void LaunchDoom(void *unused1, void *unused2)
{
    execute_context_t *exec;
    
    // Save configuration first

    M_SaveDefaults();

    // Shut down textscreen GUI

    TXT_Shutdown();

    // Launch Doom

    exec = NewExecuteContext();
    PassThroughArguments(exec);
    ExecuteDoom(exec);

    exit(0);
}
コード例 #16
0
static void DoJoinGame(void *unused1, void *unused2)
{
    execute_context_t *exec;

    if (connect_address == NULL || strlen(connect_address) <= 0)
    {
        TXT_MessageBox(NULL, "Please enter a server address\n"
                             "to connect to.");
        return;
    }

    exec = NewExecuteContext();

    AddCmdLineParameter(exec, "-connect %s", connect_address);

    if (gamemission == hexen)
    {
        AddCmdLineParameter(exec, "-class %i", character_class);
    }

    // Extra parameters come first, so that they can be used to override
    // the other parameters.

    AddExtraParameters(exec);
    AddIWADParameter(exec);
    AddWADs(exec);

    TXT_Shutdown();
    
    M_SaveDefaults();

    PassThroughArguments(exec);

    ExecuteDoom(exec);

    exit(0);
}
コード例 #17
0
ファイル: i_system.cpp プロジェクト: Blastfrog/eternity
//
// I_Quit
//
// Primary atexit routine for shutting down the game engine.
//
void I_Quit(void)
{
   has_exited = 1;   /* Prevent infinitely recursive exits -- killough */
   
   // haleyjd 06/05/10: not in fatal error situations; causes heap calls
   if(error_exitcode < I_ERRORLEVEL_FATAL && demorecording)
      G_CheckDemoStatus();
   
   // sf : rearrange this so the errmsg doesn't get messed up
   if(error_exitcode >= I_ERRORLEVEL_MESSAGE)
      puts(errmsg);   // killough 8/8/98
   else
      I_EndDoom();

   // SoM: 7/5/2002: Why I didn't remember this in the first place I'll never know.
   // haleyjd 10/09/05: moved down here
   SDL_Quit();

   // haleyjd 03/18/10: none of these should be called in fatal error situations.
   //         06/06/10: check each call, as an I_FatalError called from any of this
   //                   code could escalate the error status.

   IFNOTFATAL(M_SaveDefaults());
   IFNOTFATAL(M_SaveSysConfig());
   IFNOTFATAL(G_SaveDefaults()); // haleyjd
   
#ifdef _MSC_VER
   // Under Visual C++, the console window likes to rudely slam
   // shut -- this can stop it, but is now optional except when an error occurs
   if(error_exitcode >= I_ERRORLEVEL_NORMAL || waitAtExit)
   {
      puts("Press any key to continue\n");
      getch();
   }
#endif
}
コード例 #18
0
ファイル: d_main.c プロジェクト: gamebytes/doomretro
//
// D_DoomMainSetup
//
// CPhipps - the old contents of D_DoomMain, but moved out of the main
//  line of execution so its stack space can be freed
static void D_DoomMainSetup(void)
{
    int     p;
    char    file[256];
    int     temp;
    int     choseniwad;

    SDL_Init(0);

    M_FindResponseFile();

    iwadfile = D_FindIWAD();

    modifiedgame = false;

    nomonsters = M_CheckParm("-nomonsters");
    respawnparm = M_CheckParm("-respawn");
    fastparm = M_CheckParm("-fast");
    devparm = M_CheckParm("-devparm");
    if (M_CheckParm("-altdeath"))
        deathmatch = 2;
    else if (M_CheckParm("-deathmatch"))
        deathmatch = 1;

    M_SetConfigDir();

    // turbo option
    p = M_CheckParm("-turbo");
    if (p)
    {
        int        scale = 200;
        extern int forwardmove[2];
        extern int sidemove[2];

        if (p < myargc - 1)
            scale = atoi(myargv[p + 1]);
        if (scale < 10)
            scale = 10;
        if (scale > 400)
            scale = 400;
        forwardmove[0] = forwardmove[0] * scale / 100;
        forwardmove[1] = forwardmove[1] * scale / 100;
        sidemove[0] = sidemove[0] * scale / 100;
        sidemove[1] = sidemove[1] * scale / 100;
    }

    // init subsystems
    V_Init();

    // Load configuration files before initialising other subsystems.
    M_LoadDefaults();

    if (!M_FileExists("doomretro.wad"))
        if (!M_FileExists("doomretro.wad.temp"))
            I_Error("Can't find doomretro.wad.");

    if (iwadfile)
    {
        if (D_AddFile(iwadfile))
            if (runcount < RUNCOUNT_MAX)
                runcount++;
    }
    else 
    {
        if (!runcount)
            D_FirstUse();

        rename("doomretro.wad", "doomretro.wad.temp");

        do
        {
            choseniwad = D_ChooseIWAD();

            if (choseniwad == -1)
            {
                rename("doomretro.wad.temp", "doomretro.wad");
                I_Quit(false);
            }
            else if (!choseniwad)
                PlaySound((LPCTSTR)SND_ALIAS_SYSTEMHAND, NULL, SND_ALIAS_ID | SND_ASYNC);

        } while (!choseniwad);

        rename("doomretro.wad.temp", "doomretro.wad");

        if (runcount < RUNCOUNT_MAX)
            runcount++;
    }
    M_SaveDefaults();

    if (!W_MergeFile("doomretro.wad"))
        if (!W_MergeFile("doomretro.wad.temp"))
            I_Error("Can't find doomretro.wad.");

    if (W_CheckNumForName("BLD2A0") < 0 ||
        W_CheckNumForName("MEDBA0") < 0 ||
        W_CheckNumForName("STBAR2") < 0)
        I_Error("Wrong version of doomretro.wad.");

    p = M_CheckParmsWithArgs("-file", "-pwad", 1);
    if (p > 0)
    {
        for (p = p + 1; p < myargc && myargv[p][0] != '-'; ++p)
        {
            char *filename = uppercase(D_TryFindWADByName(myargv[p]));

            if (W_MergeFile(filename))
            {
                modifiedgame = true;
                if (D_CheckFilename(filename, "NERVE.WAD"))
                    nerve = true;
            }
        }
    }

    if (FREEDOOM && W_CheckNumForName("FREEDM") < 0 && !modifiedgame)
        I_Error("FREEDOOM requires a BOOM-compatible source port, and is therefore"
                "unable to be opened by DOOM RETRO.");

    DMENUPIC = (W_CheckNumForName("DMENUPIC") >= 0);
    M_DOOM = (W_CheckMultipleLumps("M_DOOM") > 1);
    M_EPISOD = (W_CheckMultipleLumps("M_EPISOD") > 1);
    M_GDHIGH = (W_CheckMultipleLumps("M_GDHIGH") > 1);
    M_GDLOW = (W_CheckMultipleLumps("M_GDLOW") > 1);
    M_LOADG = (W_CheckMultipleLumps("M_LOADG") > 1);
    M_LSCNTR = (W_CheckMultipleLumps("M_LSCNTR") > 1);
    M_MSENS = (W_CheckMultipleLumps("M_MSENS") > 1);
    M_MSGOFF = (W_CheckMultipleLumps("M_MSGOFF") > 1);
    M_MSGON = (W_CheckMultipleLumps("M_MSGON") > 1);
    M_NEWG = (W_CheckMultipleLumps("M_NEWG") > 1);
    M_NMARE = (W_CheckMultipleLumps("M_NMARE") > 1);
    M_OPTTTL = (W_CheckMultipleLumps("M_OPTTTL") > 1);
    M_PAUSE = (W_CheckMultipleLumps("M_PAUSE") > 1);
    M_SAVEG = (W_CheckMultipleLumps("M_SAVEG") > 1);
    M_SKILL = (W_CheckMultipleLumps("M_SKILL") > 1);
    M_SKULL1 = (W_CheckMultipleLumps("M_SKULL1") > 1);
    M_SVOL = (W_CheckMultipleLumps("M_SVOL") > 1);
    STARMS = (W_CheckMultipleLumps("STARMS") > 2);
    STBAR = (W_CheckMultipleLumps("STBAR") > 2);
    STCFN034 = (W_CheckMultipleLumps("STCFN034") > 1);
    STCFN039 = (W_CheckMultipleLumps("STCFN039") > 1);
    STCFN121 = (W_CheckMultipleLumps("STCFN121") > 1);
    STYSNUM0 = (W_CheckMultipleLumps("STYSNUM0") > 1);
    TITLEPIC = (W_CheckNumForName("TITLEPIC") >= 0);
    WISCRT2 = (W_CheckMultipleLumps("WISCRT2") > 1);

    bfgedition = (DMENUPIC && W_CheckNumForName("M_ACPT") >= 0);

    // Generate the WAD hash table. Speed things up a bit.
    W_GenerateHashTable();

    D_IdentifyVersion();
    InitGameVersion();
    D_SetGameDescription();
    D_SetSaveGameDir();

    // Check for -file in shareware
    if (modifiedgame)
    {
        // These are the lumps that will be checked in IWAD,
        // if any one is not present, execution will be aborted.
        char name[23][9] =
        {
            "e2m1", "e2m2", "e2m3", "e2m4", "e2m5", "e2m6", "e2m7", "e2m8", "e2m9",
            "e3m1", "e3m3", "e3m3", "e3m4", "e3m5", "e3m6", "e3m7", "e3m8", "e3m9",
            "dphoof", "bfgga0", "heada1", "cybra1", "spida1d1"
        };
        int i;

        if (gamemode == shareware)
            I_Error("You cannot use -FILE with the shareware version.\n"
                    "Please purchase the full version.");

        // Check for fake IWAD with right name,
        // but w/o all the lumps of the registered version.
        if (gamemode == registered)
            for (i = 0; i < 23; i++)
                if (W_CheckNumForName(name[i]) < 0)
                    I_Error("This is not the registered version.");
    }

    // get skill / episode / map from parms
    startskill = sk_medium;
    startepisode = 1;
    startmap = 1;
    autostart = false;

    p = M_CheckParmWithArgs("-skill", 1);
    if (p)
    {
        temp = myargv[p + 1][0] - '1';
        if (temp >= sk_baby && temp <= sk_nightmare)
        {
            startskill = (skill_t)temp;
            autostart = true;
        }
    }

    p = M_CheckParmWithArgs("-episode", 1);
    if (p)
    {
        temp = myargv[p + 1][0] - '0';
        if ((gamemode == shareware && temp == 1)
            || (temp >= 1
                && ((gamemode == registered && temp <= 3)
                    || (gamemode == retail && temp <= 4))))
        {
            startepisode = temp;
            startmap = 1;
            autostart = true;
        }
    }

    p = M_CheckParmWithArgs("-expansion", 1);
    if (p)
    {
        temp = myargv[p + 1][0] - '0';
        if (gamemode == commercial && temp <= (nerve ? 2 : 1))
        {
            gamemission = (temp == 1 ? doom2 : pack_nerve);
            selectedexpansion = temp - 1;
            startepisode = 1;
            startmap = 1;
            autostart = true;
        }
    }

    timelimit = 0;

    p = M_CheckParmWithArgs("-timer", 1);
    if (p)
        timelimit = atoi(myargv[p + 1]);

    p = M_CheckParm("-avg");
    if (p)
        timelimit = 20;

    p = M_CheckParmWithArgs("-warp", 1);
    if (p)
    {
        static char lumpname[6];

        if (gamemode == commercial)
        {
            if (strlen(myargv[p + 1]) == 5 &&
                toupper(myargv[p + 1][0]) == 'M' &&
                toupper(myargv[p + 1][1]) == 'A' &&
                toupper(myargv[p + 1][2]) == 'P')
                startmap = (myargv[p + 1][3] - '0') * 10 + myargv[p + 1][4] - '0';
            else
                startmap = atoi(myargv[p + 1]);

            sprintf(lumpname, "MAP%02i", startmap);
        }
        else
        {
            if (strlen(myargv[p + 1]) == 4 &&
                toupper(myargv[p + 1][0]) == 'E' &&
                toupper(myargv[p + 1][2]) == 'M')
            {
                startepisode = myargv[p + 1][1] - '0';
                startmap = myargv[p + 1][3] - '0';
            }
            else
            {
                startepisode = myargv[p + 1][0] - '0';

                if (p + 2 < myargc)
                    startmap = myargv[p + 2][0] - '0';
                else
                    startmap = 1;
            }

            sprintf(lumpname, "E%iM%i", startepisode, startmap);
        }

        if (W_CheckNumForName(lumpname) >= 0)
            autostart = true;
    }

    p = M_CheckParmWithArgs("-loadgame", 1);
    if (p)
        startloadgame = atoi(myargv[p + 1]);
    else
        startloadgame = -1;

    if (mouseSensitivity < MOUSESENSITIVITY_MIN || mouseSensitivity > MOUSESENSITIVITY_MAX)
        mouseSensitivity = MOUSESENSITIVITY_DEFAULT;
    if (mouseSensitivity == MOUSESENSITIVITY_MIN)
        mouseSensitivity = -5;
    gamepadSensitivity = (!mouseSensitivity ? 0.0f :
                          (2.0f + mouseSensitivity / (float)MOUSESENSITIVITY_MAX));

    if (sfxVolume < SFXVOLUME_MIN || sfxVolume > SFXVOLUME_MAX)
        sfxVolume = SFXVOLUME_DEFAULT;

    if (musicVolume < MUSICVOLUME_MIN || musicVolume > MUSICVOLUME_MAX)
        musicVolume = MUSICVOLUME_DEFAULT;

    if (screensize < SCREENSIZE_MIN || screensize > SCREENSIZE_MAX)
        screensize = SCREENSIZE_DEFAULT;
    if (widescreen && !fullscreen)
    {
        widescreen = false;
        screensize = SCREENSIZE_MAX;
    }
    if (!widescreen)
        hud = true;
    if (fullscreen && screensize == SCREENSIZE_MAX)
    {
        widescreen = true;
        screensize = SCREENSIZE_MAX - 1;
    }
    if (widescreen)
    {
        returntowidescreen = true;
        widescreen = false;
    }

    if (screenwidth && screenheight
        && (screenwidth < SCREENWIDTH || screenheight < SCREENHEIGHT * 3 / 4))
    {
        screenwidth = SCREENWIDTH;
        screenheight = SCREENWIDTH * 3 / 4;
    }

    if (windowwidth < SCREENWIDTH || windowheight < SCREENWIDTH * 3 / 4)
    {
        windowwidth = SCREENWIDTH;
        windowheight = SCREENWIDTH * 3 / 4;
    }

    if (gammalevel < GAMMALEVEL_MIN || gammalevel > GAMMALEVEL_MAX)
        gammalevel = GAMMALEVEL_DEFAULT;
    gammalevelindex = 0;
    while (gammalevelindex < GAMMALEVELS)
        if (gammalevels[gammalevelindex++] == gammalevel)
            break;
    if (gammalevelindex == GAMMALEVELS)
    {
        gammalevelindex = 0;
        while (gammalevels[gammalevelindex++] != GAMMALEVEL_DEFAULT);
    }
    gammalevelindex--;

    if (bloodsplats < BLOODSPLATS_MIN || bloodsplats > BLOODSPLATS_MAX)
        bloodsplats = BLOODSPLATS_DEFAULT;
    bloodSplatSpawner = ((bloodsplats == UNLIMITED ? P_SpawnBloodSplat : 
                         (bloodsplats ? P_SpawnBloodSplat2 : P_SpawnBloodSplat3)));

    if (pixelwidth < PIXELWIDTH_MIN || pixelwidth > PIXELWIDTH_MAX)
        pixelwidth = PIXELWIDTH_DEFAULT;
    while (SCREENWIDTH % pixelwidth)
        pixelwidth--;
    if (pixelheight < PIXELHEIGHT_MIN || pixelheight > PIXELHEIGHT_MAX)
        pixelheight = PIXELHEIGHT_DEFAULT;
    while (SCREENHEIGHT % pixelheight)
        pixelheight--;

    M_Init();

    R_Init();

    P_Init();

    I_Init();

    S_Init((int)(sfxVolume * (127.0f / 15.0f)), (int)(musicVolume * (127.0f / 15.0f)));

    D_CheckNetGame();

    HU_Init();

    ST_Init();

    AM_Init();

    if (startloadgame >= 0)
    {
        M_StringCopy(file, P_SaveGameFile(startloadgame), sizeof(file));
        G_LoadGame(file);
    }

    if (gameaction != ga_loadgame)
    {
        if (autostart || netgame)
            G_DeferredInitNew(startskill, startepisode, startmap);
        else
            D_StartTitle();                     // start up intro loop
    }
}
コード例 #19
0
ファイル: OLDSETUP.C プロジェクト: AnerolCoo/idsetup
//===================================================
//
// Enter modem savegame info
//
//===================================================
int RestoreModem(void)
{
   char * wstr = "MODSAVE";
   short *window;
   short field;
   int   rval = 0;
   char  *args[MAXARGS];
   int   argcount;
   char  string[MAXARGS*2][16];
   union REGS r;
   int   i;
   int   numplayers[6];
   int   saveslot;
   int   handle;
   char  name[32];
	char  p1,p2,p3,p4;


   minfo = modeminfo;       // save copy of netinfo

   field = MS_SAVEGAME0;        // FIRST FIELD TO LIGHT BAR
  
   if ( ( window = IWD_OpenWindow( NULL, wstr ) ) == NULL )
   {
      IWD_CloseWRF ( NULL );
      printf( "\nError opening %s window.\n", wstr );
      exit(1);
   }
  
   saveslot = -1;
   memset(savenames,0,6*24);

   //
   // Read in savegame strings
   //
   for (i = 0;i < 6;i++)
   {
      sprintf(name,SAVENAME,i);
      handle = open (name, O_BINARY | O_RDONLY);
		if (handle == -1)
		   continue;

		read(handle,savenames[i],24);
      lseek(handle,27+16,SEEK_SET);
      read(handle,&p1,1);
      read(handle,&p2,1);
      read(handle,&p3,1);
      read(handle,&p4,1);
      numplayers[i] = p1+p2+p3+p4;
      close(handle);

      IWD_PutFieldData(window,MS_SAVEGAME0+i,savenames[i]);
   }
  	                 	
   //
   // Set defaults
   //
   IWD_SetFieldMark(window,MS_CONTYPE0M,0);
   IWD_SetFieldMark(window,MS_CONTYPE1M,1);
   IWD_SetFieldMark(window,MS_CONTYPE2M,0);
   minfo.comtype = 1;

   IWD_SetFieldMark(window,MS_COM1M,1);
   IWD_SetFieldMark(window,MS_COM2M,0);
   IWD_SetFieldMark(window,MS_COM3M,0);
   IWD_SetFieldMark(window,MS_COM4M,0);
   minfo.comport = 1;
   
   IWD_SetFieldMark(window,MS_DEATHNOM2,1);
   IWD_SetFieldMark(window,MS_DEATHYESM2,0);
   minfo.deathMatch = 0;

   strcpy(minfo.phonenum,"");
   IWD_PutFieldDataType(window,MS_PHONENUM, FTYPE_STRING,&minfo.phonenum);

   IWD_ShowWindow ( window );

   for (;;)
   {
      switch ( IWD_Dialog ( window, &field, DialogControl, hot_keys ) )
      {
         case KEY_ESC:
            rval = -1;
            goto func_exit;
  
exitandsave:
         case KEY_F10:

            if (saveslot < 0)
            {
               short *window;

               if ( ( window = IWD_OpenWindow( NULL, "NETSERR" ) ) == NULL )
                  exit(1);
               IWD_ShowWindow ( window );
               while(kbhit());
                  getch();
               IWD_CloseWindow( window );
               break;
            }

            IWD_GetFieldDataType(window,MS_PHONENUM,FTYPE_STRING,&minfo.phonenum);
            modeminfo = minfo;
            
            M_SaveDefaults();
            IWD_CloseWRF( NULL );
            IWD_Shutdown();

            argcount = 1;

            args[0] = "sersetup.exe ";

               if (cdrom)
                  args[argcount++] = "-cdrom";

            args[argcount++] = "-nodes";
            sprintf(string[argcount],"%d",numplayers[saveslot]);
            args[argcount] = string[argcount];
            argcount++;

            if (modeminfo.deathMatch)
               args[argcount++] = "-deathmatch";

            sprintf(string[argcount],"-com%d",modeminfo.comport);
            args[argcount] = string[argcount];
            argcount++;
            
            switch(modeminfo.comtype)
            {
               case 0:     // no parameter if already connected!
                  break;
               case 1:
                  args[argcount++] = "-answer";
                  break;
               case 2:
                  args[argcount++] = "-dial";
                  sprintf(string[argcount],"%s",minfo.phonenum);
                  args[argcount] = string[argcount];
                  argcount++;
                  break;
            }

            args[argcount++] = "-loadgame";
            sprintf(string[argcount],"%d",saveslot);
            args[argcount] = string[argcount];
            argcount++;
            
            for (i = 1;i < myargc; i++)
               args[argcount++] = myargv[i];

            args[argcount] = NULL;

            r.x.ax = 3;
            int86(0x10,&r,&r);

            execv("sersetup.exe",args);

            //
            // ERROR EXECing!
            //
            printf("Problem EXECing SERSETUP for netplay. Need to be in same directory!");
            exit(0);

         case KEY_CR:
         case 32:
         switch ( field )
         {
            case MS_COM1:
               IWD_SetFieldMark(window,MS_COM1M,1);
               IWD_SetFieldMark(window,MS_COM2M,0);
               IWD_SetFieldMark(window,MS_COM3M,0);
               IWD_SetFieldMark(window,MS_COM4M,0);
               minfo.comport = 1;
               break;

            case MS_COM2:
               IWD_SetFieldMark(window,MS_COM1M,0);
               IWD_SetFieldMark(window,MS_COM2M,1);
               IWD_SetFieldMark(window,MS_COM3M,0);
               IWD_SetFieldMark(window,MS_COM4M,0);
               minfo.comport = 2;
               break;

            case MS_COM3:
               IWD_SetFieldMark(window,MS_COM1M,0);
               IWD_SetFieldMark(window,MS_COM2M,0);
               IWD_SetFieldMark(window,MS_COM3M,1);
               IWD_SetFieldMark(window,MS_COM4M,0);
               minfo.comport = 3;
               break;

            case MS_COM4:
               IWD_SetFieldMark(window,MS_COM1M,0);
               IWD_SetFieldMark(window,MS_COM2M,0);
               IWD_SetFieldMark(window,MS_COM3M,0);
               IWD_SetFieldMark(window,MS_COM4M,1);
               minfo.comport = 4;
               break;
               

            case MS_CONTYPE0:
               IWD_SetFieldMark(window,MS_CONTYPE0M,1);
               IWD_SetFieldMark(window,MS_CONTYPE1M,0);
               IWD_SetFieldMark(window,MS_CONTYPE2M,0);
               minfo.comtype = 0;
               break;

            case MS_CONTYPE1:
               IWD_SetFieldMark(window,MS_CONTYPE0M,0);
               IWD_SetFieldMark(window,MS_CONTYPE1M,1);
               IWD_SetFieldMark(window,MS_CONTYPE2M,0);
               minfo.comtype = 1;
               break;

            case MS_CONTYPE2:
               IWD_SetFieldMark(window,MS_CONTYPE0M,0);
               IWD_SetFieldMark(window,MS_CONTYPE1M,0);
               IWD_SetFieldMark(window,MS_CONTYPE2M,1);
               minfo.comtype = 2;
               field = MS_PHONENUM;
               break;


            case MS_SAVEGAME0:
               if (!savenames[0][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 0;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,1);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,0);
               break;

            case MS_SAVEGAME1:
               if (!savenames[1][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 1;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,1);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,0);
               break;


            case MS_SAVEGAME2:
               if (!savenames[2][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 2;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,1);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,0);
               break;

            case MS_SAVEGAME3:
               if (!savenames[3][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 3;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,1);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,0);
               break;

            case MS_SAVEGAME4:
               if (!savenames[4][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 4;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,1);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,0);
               break;

            case MS_SAVEGAME5:
               if (!savenames[5][0])
               {
                  IWD_Sound(1000,6);
                  break;
               }
               saveslot = 5;
               IWD_SetFieldMark(window,MS_SAVEGAME0M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME1M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME2M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME3M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME4M,0);
               IWD_SetFieldMark(window,MS_SAVEGAME5M,1);
               break;

            //
            // Deathmatch
            //
            case MS_DEATHNO2:
               minfo.deathMatch = 0;
               IWD_SetFieldMark(window,MS_DEATHNOM2,1);
               IWD_SetFieldMark(window,MS_DEATHYESM2,0);
               break;

            case MS_DEATHYES2:
               minfo.deathMatch = 1;
               IWD_SetFieldMark(window,MS_DEATHNOM2,0);
               IWD_SetFieldMark(window,MS_DEATHYESM2,1);
               break;

            default:
               break;
         }
            break;
      }
   }
  
   func_exit:
  
   IWD_CloseWindow(window);
  
   return ( rval );
}
コード例 #20
0
ファイル: m_config.c プロジェクト: Billy2600/doomretro
static void M_CheckDefaults(void)
{
    if (alwaysrun != false && alwaysrun != true)
        alwaysrun = ALWAYSRUN_DEFAULT;

    if (bloodsplats < BLOODSPLATS_MIN || BLOODSPLATS_MAX)
        bloodsplats = BLOODSPLATS_DEFAULT;

    if (brightmaps != false && brightmaps != true)
        brightmaps = BRIGHTMAPS_DEFAULT;

    if (corpses < CORPSES_MIN || corpses > CORPSES_MAX || (corpses & (corpses - 1)))
        corpses = CORPSES_DEFAULT;

    if (dclick_use != false && dclick_use != true)
        dclick_use = DCLICKUSE_DEFAULT;

    if (fullscreen != false && fullscreen != true)
        fullscreen = FULLSCREEN_DEFAULT;

    if (gamepadautomap < 0 || gamepadautomap > GAMEPAD_Y || (gamepadautomap & (gamepadautomap - 1)))
        gamepadautomap = GAMEPADAUTOMAP_DEFAULT;

    if (gamepadfire < 0 || gamepadfire > GAMEPAD_Y || (gamepadfire & (gamepadfire - 1)))
        gamepadfire = GAMEPADFIRE_DEFAULT;

    if (gamepadlefthanded != false && gamepadlefthanded != true)
        gamepadlefthanded = GAMEPADLEFTHANDED_DEFAULT;

    if (gamepadmenu < 0 || gamepadmenu > GAMEPAD_Y || (gamepadmenu & (gamepadmenu - 1)))
        gamepadmenu = GAMEPADMENU_DEFAULT;

    if (gamepadnextweapon < 0 || gamepadnextweapon > GAMEPAD_Y || (gamepadnextweapon & (gamepadnextweapon - 1)))
        gamepadnextweapon = GAMEPADNEXTWEAPON_DEFAULT;

    if (gamepadprevweapon < 0 || gamepadprevweapon > GAMEPAD_Y || (gamepadprevweapon & (gamepadprevweapon - 1)))
        gamepadprevweapon = GAMEPADPREVWEAPON_DEFAULT;

    if (gamepadspeed < 0 || gamepadspeed > GAMEPAD_Y || (gamepadspeed & (gamepadspeed - 1)))
        gamepadspeed = GAMEPADSPEED_DEFAULT;

    if (gamepaduse < 0 || gamepaduse > GAMEPAD_Y || (gamepaduse & (gamepaduse - 1)))
        gamepaduse = GAMEPADUSE_DEFAULT;

    if (gamepadvibrate != false && gamepadvibrate != true)
        gamepadvibrate = GAMEPADVIBRATE_DEFAULT;

    if (gamepadweapon1 < 0 || gamepadweapon1 > GAMEPAD_Y || (gamepadweapon1 & (gamepadweapon1 - 1)))
        gamepadweapon1 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon2 < 0 || gamepadweapon2 > GAMEPAD_Y || (gamepadweapon2 & (gamepadweapon2 - 1)))
        gamepadweapon2 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon3 < 0 || gamepadweapon3 > GAMEPAD_Y || (gamepadweapon3 & (gamepadweapon3 - 1)))
        gamepadweapon3 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon4 < 0 || gamepadweapon4 > GAMEPAD_Y || (gamepadweapon4 & (gamepadweapon4 - 1)))
        gamepadweapon4 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon5 < 0 || gamepadweapon5 > GAMEPAD_Y || (gamepadweapon5 & (gamepadweapon5 - 1)))
        gamepadweapon5 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon6 < 0 || gamepadweapon6 > GAMEPAD_Y || (gamepadweapon6 & (gamepadweapon6 - 1)))
        gamepadweapon6 = GAMEPADWEAPON_DEFAULT;

    if (gamepadweapon7 < 0 || gamepadweapon7 > GAMEPAD_Y || (gamepadweapon7 & (gamepadweapon7 - 1)))
        gamepadweapon7 = GAMEPADWEAPON_DEFAULT;

    if (gamma < GAMMA_MIN || gamma > GAMMA_MAX)
        gamma = GAMMA_DEFAULT;
    gammaindex = 0;
    while (gammaindex < GAMMALEVELS)
        if (gammalevels[gammaindex++] == gamma)
            break;
    if (gammaindex == GAMMALEVELS)
    {
        gammaindex = 0;
        while (gammalevels[gammaindex++] != GAMMA_DEFAULT);
    }
    --gammaindex;

    if (graphicdetail != LOW && graphicdetail != HIGH)
        graphicdetail = GRAPHICDETAIL_DEFAULT;

    if (grid != false && grid != true)
        grid = GRID_DEFAULT;

    if (homindicator != false && homindicator != true)
        homindicator = HOMINDICATOR_DEFAULT;

    if (hud != false && hud != true)
        hud = HUD_DEFAULT;

    if (key_down < 0 || key_down > 255)
        key_down = KEYDOWN_DEFAULT;

    if (key_down2 < 0 || key_down2 > 255)
        key_down2 = KEYDOWN2_DEFAULT;

    if (key_fire < 0 || key_fire > 255)
        key_fire = KEYFIRE_DEFAULT;

    if (key_left < 0 || key_left > 255)
        key_left = KEYLEFT_DEFAULT;

    if (key_nextweapon < 0 || key_nextweapon > 255)
        key_nextweapon = KEYNEXTWEAPON_DEFAULT;

    if (key_prevweapon < 0 || key_prevweapon > 255)
        key_prevweapon = KEYPREVWEAPON_DEFAULT;

    if (key_right < 0 || key_right > 255)
        key_right = KEYRIGHT_DEFAULT;

    if (key_speed < 0 || key_speed > 255)
        key_speed = KEYSPEED_DEFAULT;

    if (key_strafe < 0 || key_strafe > 255)
        key_strafe = KEYSTRAFE_DEFAULT;

    if (key_strafeleft < 0 || key_strafeleft > 255)
        key_strafeleft = KEYSTRAFELEFT_DEFAULT;

    if (key_straferight < 0 || key_straferight > 255)
        key_straferight = KEYSTRAFERIGHT_DEFAULT;

    if (key_up < 0 || key_up > 255)
        key_up = KEYUP_DEFAULT;

    if (key_up2 < 0 || key_up2 > 255)
        key_up2 = KEYUP2_DEFAULT;

    if (key_use < 0 || key_use > 255)
        key_use = KEYUSE_DEFAULT;

    if (messages != false && messages != true)
        messages = MESSAGES_DEFAULT;

    if (mirrorweapons != false && mirrorweapons != true)
        mirrorweapons = MIRRORWEAPONS_DEFAULT;

    if (mousebfire < -1 || mousebfire > MAX_MOUSE_BUTTONS)
        mousebfire = MOUSEFIRE_DEFAULT;

    if (mousebforward < -1 || mousebforward > MAX_MOUSE_BUTTONS)
        mousebforward = MOUSEFORWARD_DEFAULT;

    if (mouseSensitivity < MOUSESENSITIVITY_MIN || mouseSensitivity > MOUSESENSITIVITY_MAX)
        mouseSensitivity = MOUSESENSITIVITY_DEFAULT;
    gamepadSensitivity = (!mouseSensitivity ? 0.0f :
        mouseSensitivity / (float)MOUSESENSITIVITY_MAX + GAMEPAD_SENSITIVITY_OFFSET);

    if (mousebstrafe < -1 || mousebstrafe > MAX_MOUSE_BUTTONS)
        mousebstrafe = MOUSESTRAFE_DEFAULT;

    if (mousebuse < -1 || mousebuse > MAX_MOUSE_BUTTONS)
        mousebuse = MOUSEUSE_DEFAULT;

    if (musicVolume < MUSICVOLUME_MIN || musicVolume > MUSICVOLUME_MAX)
        musicVolume = MUSICVOLUME_DEFAULT;

    if (novert != false && novert != true)
        novert = NOVERT_DEFAULT;

    if (pixelwidth < PIXELWIDTH_MIN || pixelwidth > PIXELWIDTH_MAX)
        pixelwidth = PIXELWIDTH_DEFAULT;
    while (SCREENWIDTH % pixelwidth)
        --pixelwidth;

    if (pixelheight < PIXELHEIGHT_MIN || pixelheight > PIXELHEIGHT_MAX)
        pixelheight = PIXELHEIGHT_DEFAULT;
    while (SCREENHEIGHT % pixelheight)
        --pixelheight;

    if (playerbob < PLAYERBOB_MIN || playerbob > PLAYERBOB_MAX)
        playerbob = PLAYERBOB_DEFAULT;

    if (rotate != false && rotate != true)
        rotate = ROTATE_DEFAULT;

    if (runcount < 0 || runcount > RUNCOUNT_MAX)
        runcount = 0;

    if (saturation < SATURATION_MIN || saturation > SATURATION_MAX)
        saturation = SATURATION_DEFAULT;

    if ((gamemode == registered && (selectedepisode < EPISODE_MIN || selectedepisode > EPISODE_MAX - 1))
        || (gamemode == retail && (selectedepisode < EPISODE_MIN || selectedepisode > EPISODE_MAX)))
        selectedepisode = EPISODE_DEFAULT;

    if (selectedexpansion < EXPANSION_MIN || selectedexpansion > EXPANSION_MAX)
        selectedexpansion = EXPANSION_DEFAULT;

    if (selectedsavegame < 0)
        selectedsavegame = 0;
    else if (selectedsavegame > 5)
        selectedsavegame = 5;

    if (selectedskilllevel < SKILLLEVEL_MIN || selectedskilllevel > SKILLLEVEL_MAX)
        selectedskilllevel = SKILLLEVEL_DEFAULT;

    if (screensize < SCREENSIZE_MIN || screensize > SCREENSIZE_MAX)
        screensize = SCREENSIZE_DEFAULT;

    if (screenwidth && screenheight
        && (screenwidth < SCREENWIDTH || screenheight < SCREENHEIGHT * 3 / 4))
    {
        screenwidth = SCREENWIDTH_DEFAULT;
        screenheight = SCREENHEIGHT_DEFAULT;
    }

    if (sfxVolume < SFXVOLUME_MIN || sfxVolume > SFXVOLUME_MAX)
        sfxVolume = SFXVOLUME_DEFAULT;

    if (selectedskilllevel < SKILLLEVEL_MIN || selectedskilllevel > SKILLLEVEL_MAX)
        selectedskilllevel = SKILLLEVEL_DEFAULT;

    if (smoketrails != false && smoketrails != true)
        smoketrails = SMOKETRAILS_DEFAULT;

    if (translucency != false && translucency != true)
        translucency = TRANSLUCENCY_DEFAULT;

    if (strcasecmp(videodriver, "directx") && strcasecmp(videodriver, "windib"))
        M_StringCopy(videodriver, VIDEODRIVER_DEFAULT, 8);

    if (widescreen && !fullscreen)
    {
        widescreen = false;
        screensize = SCREENSIZE_MAX;
    }
    if (!widescreen)
        hud = true;
    if (fullscreen && screensize == SCREENSIZE_MAX)
    {
        widescreen = true;
        screensize = SCREENSIZE_MAX - 1;
    }
    if (widescreen)
    {
        returntowidescreen = true;
        widescreen = false;
    }

    if (windowwidth < SCREENWIDTH || windowheight < SCREENWIDTH * 3 / 4)
    {
        windowwidth = WINDOWWIDTH_DEFAULT;
        windowheight = WINDOWHEIGHT_DEFAULT;
    }

    M_SaveDefaults();
}
コード例 #21
0
static void StartGame(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data))
{
    execute_context_t *exec;

    exec = NewExecuteContext();

    // Extra parameters come first, before all others; this way,
    // they can override any of the options set in the dialog.

    AddExtraParameters(exec);

    AddIWADParameter(exec);
    AddCmdLineParameter(exec, "-server");
    AddCmdLineParameter(exec, "-skill %i", skill + 1);

    if (nomonsters)
    {
        AddCmdLineParameter(exec, "-nomonsters");
    }

    if (fast)
    {
        AddCmdLineParameter(exec, "-fast");
    }

    if (respawn)
    {
        AddCmdLineParameter(exec, "-respawn");
    }

    if (deathmatch == 1)
    {
        AddCmdLineParameter(exec, "-deathmatch");
    }
    else if (deathmatch == 2)
    {
        AddCmdLineParameter(exec, "-altdeath");
    }

    if (timer > 0)
    {
        AddCmdLineParameter(exec, "-timer %i", timer);
    }

    if (warptype == WARP_DOOM1)
    {
        // TODO: select IWAD based on warp type
        AddCmdLineParameter(exec, "-warp %i %i", warpepisode, warpmap);
    }
    else if (warptype == WARP_DOOM2)
    {
        AddCmdLineParameter(exec, "-warp %i", warpmap);
    }

    AddCmdLineParameter(exec, "-port %i", udpport);

    AddWADs(exec);

    TXT_Shutdown();
    
    M_SaveDefaults();
    AddConfigParameters(exec);

    ExecuteDoom(exec);

    exit(0);
}
コード例 #22
0
static void StartGame(int multiplayer)
{
    execute_context_t *exec;

    exec = NewExecuteContext();

    // Extra parameters come first, before all others; this way,
    // they can override any of the options set in the dialog.

    AddExtraParameters(exec);

    AddIWADParameter(exec);
    AddCmdLineParameter(exec, "-skill %i", skill + 1);

    if (gamemission == hexen)
    {
        AddCmdLineParameter(exec, "-class %i", character_class);
    }

    if (nomonsters)
    {
        AddCmdLineParameter(exec, "-nomonsters");
    }

    if (fast)
    {
        AddCmdLineParameter(exec, "-fast");
    }

    if (respawn)
    {
        AddCmdLineParameter(exec, "-respawn");
    }

    if (warptype == WARP_ExMy)
    {
        // TODO: select IWAD based on warp type
        AddCmdLineParameter(exec, "-warp %i %i", warpepisode, warpmap);
    }
    else if (warptype == WARP_MAPxy)
    {
        AddCmdLineParameter(exec, "-warp %i", warpmap);
    }

    // Multiplayer-specific options:

    if (multiplayer)
    {
        AddCmdLineParameter(exec, "-server");
        AddCmdLineParameter(exec, "-port %i", udpport);

        if (deathmatch == 1)
        {
            AddCmdLineParameter(exec, "-deathmatch");
        }
        else if (deathmatch == 2 || strife_altdeath != 0)
        {
            AddCmdLineParameter(exec, "-altdeath");
        }

        if (timer > 0)
        {
            AddCmdLineParameter(exec, "-timer %i", timer);
        }

        if (privateserver)
        {
            AddCmdLineParameter(exec, "-privateserver");
        }
    }

    AddWADs(exec);

    TXT_Shutdown();
 
    M_SaveDefaults();
    PassThroughArguments(exec);

    ExecuteDoom(exec);

    exit(0);
}
コード例 #23
0
ファイル: SERIAL.C プロジェクト: AnerolCoo/idsetup
int SerialConfig(void)
{
	short	key;
	short field;
	int   rval = 0;
	char  *args[MAXARGS];
	int   argcount;
	char  string[MAXARGS*2][12];
	int   i;
	int   level;


	sinfo = serialinfo;       // save copy of modeminfo

	SaveScreen();
	DrawPup(&cserial);

	//
	// Set defaults
	//
	sinfo.skillLevel = 3;
	DrawRadios(&sskillg);

	sinfo.episode = 1;
	#ifndef DOOM2
	DrawRadios(&sepig);
	#endif

	sinfo.deathMatch = 1;
	DrawRadios(&sdeathg);

	sinfo.comport = comport;
	DrawRadios(&scomg);

	while(1)
	{
		SetupMenu(&cserialmenu);
		field = GetMenuInput();
		key = menukey;
		switch ( key )
		{
			case KEY_ESC:
				rval = -1;
				goto func_exit;

			//
			// Secret WARP code: F5+warp
			//
			case KEY_F1:
			{
				level = WarpTime();
				if (!level)
					continue;

				serialinfo = sinfo;

				M_SaveDefaults();
				RestoreScreen();

				argcount = 1;

				args[0] = "sersetup.exe ";

				if (cdrom)
					args[argcount++] = "-cdrom";

				args[argcount++] = "-skill";
				sprintf(string[argcount],"%d",serialinfo.skillLevel);
				args[argcount] = string[argcount];
				argcount++;

				if (!level)
				{
					#ifndef DOOM2
					 args[argcount++] = "-episode";
					 sprintf(string[argcount],"%d",serialinfo.episode);
					 args[argcount] = string[argcount];
					 argcount++;
					#endif
				}
				else
				{
					args[argcount++] = "-warp";
					#ifdef DOOM2
					sprintf(string[argcount],"%d",level);
					args[argcount] = string[argcount];
					#else
					sprintf(string[argcount],"%d",level>>8);
					args[argcount] = string[argcount];
					argcount++;
					sprintf(string[argcount],"%d",level&0x0f);
					args[argcount] = string[argcount];
					#endif
					argcount++;
				}

				if (serialinfo.deathMatch)
					args[argcount++] = "-deathmatch";

				if (nomonsters)
					args[argcount++] = "-nomonsters";

				if (respawn)
					args[argcount++] = "-respawn";

				if (deathmatch2 && serialinfo.deathMatch)
					args[argcount++] = "-altdeath";

				sprintf(string[argcount],"-com%d",serialinfo.comport);
				args[argcount] = string[argcount];
				argcount++;

				for (i = 1;i < myargc; i++)
					args[argcount++] = myargv[i];

				args[argcount] = NULL;

				textbackground(0);
				textcolor(7);
				clrscr();

				execv("sersetup.exe",args);

				//
				// ERROR EXECing!
				//
				printf("Problem EXECing SERSETUP for netplay. Need to be in same directory!");
				exit(1);

			}
			break;

exitandsave:
			case KEY_F10:

				serialinfo = sinfo;

				M_SaveDefaults();
				RestoreScreen();

				argcount = 1;

				args[0] = "sersetup.exe ";

					if (cdrom)
						args[argcount++] = "-cdrom";

				args[argcount++] = "-skill";
				sprintf(string[argcount],"%d",serialinfo.skillLevel);
				args[argcount] = string[argcount];
				argcount++;

				if (serialinfo.deathMatch)
					args[argcount++] = "-deathmatch";

				#ifndef DOOM2
				args[argcount++] = "-episode";
				sprintf(string[argcount],"%d",serialinfo.episode);
				args[argcount] = string[argcount];
				argcount++;
				#endif

				sprintf(string[argcount],"-com%d",serialinfo.comport);
				args[argcount] = string[argcount];
				argcount++;
            
            for (i = 1;i < myargc; i++)
               args[argcount++] = myargv[i];

            args[argcount] = NULL;

				textbackground(0);
				textcolor(7);
				clrscr();

				execv("sersetup.exe",args);

				//
				// ERROR EXECing!
				//
				printf("Problem EXECing SERSETUP for netplay. Need to be in same directory!");
				exit(1);

			case KEY_ENTER:
			case 32:
			switch ( field )
			{
				#ifndef DOOM2
				//
				// Episode
				//
				case SER_EPISODE0:
				case SER_EPISODE1:
				case SER_EPISODE2:
					sinfo.episode = field - SER_EPISODE0 + 1;
					DrawRadios(&sepig);
					break;
				#endif

				//
				// Skill level
				//
				case SER_SKILL1:
				case SER_SKILL2:
				case SER_SKILL3:
				case SER_SKILL4:
					sinfo.skillLevel = field - SER_SKILL1 + 2; break;

				//
				// Deathmatch
				//
				case SER_DEATHNO:
				case SER_DEATHYES:
					sinfo.deathMatch = field - SER_DEATHNO;
					break;

				//
				// COM port
				//
				case SER_COM1:
				case SER_COM2:
				case SER_COM3:
				case SER_COM4:
					comport = sinfo.comport = field - SER_COM1 + 1;
					break;

				default:
					break;
			}
			DrawRadios(&sskillg);
			DrawRadios(&sdeathg);
			DrawRadios(&scomg);
			break;
		}
	}

	func_exit:

	RestoreScreen();
	return ( rval );
}
コード例 #24
0
ファイル: SERREST.C プロジェクト: AnerolCoo/idsetup
int RestoreSerial(void)
{
	short field;
	short	key;
	int   rval = 0;
	char  *args[MAXARGS];
	int   argcount;
	char  string[MAXARGS*2][16];
	int   i;
	int   numplayers[6];
	int   saveslot;
	int   handle;
	char  name[32];
	char  p1,p2,p3,p4;


	sinfo = serialinfo;       // save copy of netinfo

	SaveScreen();
	DrawPup(&sersave);

	saveslot = -1;
	memset(savenames,0,6*24);

	//
	// Read in savegame strings
	//
	textbackground(1);
	textcolor(15);
	for (i = 0;i < 6;i++)
	{
		sprintf(name,SAVENAME,i);
		handle = open (name, O_BINARY | O_RDONLY);
		if (handle == -1)
			continue;

		read(handle,savenames[i],24);
		lseek(handle,27+16,SEEK_SET);
		read(handle,&p1,1);
		read(handle,&p2,1);
		read(handle,&p3,1);
		read(handle,&p4,1);
		numplayers[i] = p1+p2+p3+p4;
		close(handle);

		Clear(&sersaveitems[i]);
		Pos(&sersaveitems[i]);
		cprintf("%s",savenames[i]);
	}

	//
	// Set defaults
	//
	sinfo.comport = comport;
	DrawRadios(&serscomg);

	sinfo.deathMatch = 0;
	DrawRadios(&sersdeathg);
	gotoxy(1,25);

	while(1)
	{
		SetupMenu(&sersavemenu);
		field = GetMenuInput();
		key = menukey;
      switch ( key )
		{
			case KEY_ESC:
				rval = -1;
				goto func_exit;

exitandsave:
			case KEY_F10:

				if (saveslot < 0)
				{
					ErrorWindow(&netserr);
					break;
				}

				serialinfo = sinfo;

				M_SaveDefaults();
				RestoreScreen();

				argcount = 1;

				args[0] = "sersetup.exe ";

					if (cdrom)
						args[argcount++] = "-cdrom";

				args[argcount++] = "-nodes";
				sprintf(string[argcount],"%d",numplayers[saveslot]);
				args[argcount] = string[argcount];
				argcount++;

				if (modeminfo.deathMatch)
					args[argcount++] = "-deathmatch";

				sprintf(string[argcount],"-com%d",serialinfo.comport);
				args[argcount] = string[argcount];
				argcount++;

				args[argcount++] = "-loadgame";
				sprintf(string[argcount],"%d",saveslot);
				args[argcount] = string[argcount];
				argcount++;

				for (i = 1;i < myargc; i++)
					args[argcount++] = myargv[i];

				args[argcount] = NULL;

				textbackground(0);
				textcolor(7);
				clrscr();

				execv("sersetup.exe",args);

				//
				// ERROR EXECing!
				//
				printf("Problem EXECing SERSETUP for netplay. Need to be in same directory!");
				exit(0);

			case KEY_ENTER:
				switch ( field )
				{
					case SERS_COM1:
					case SERS_COM2:
					case SERS_COM3:
					case SERS_COM4:
						sinfo.comport = field - SERS_COM1 + 1;
						DrawRadios(&serscomg);
						break;

					case SERS_0:
					case SERS_1:
					case SERS_2:
					case SERS_3:
					case SERS_4:
					case SERS_5:
						if (!savenames[field - SERS_0][0])
						{
							Sound(1000,12);
							break;
						}
						saveslot = field - SERS_0;
						DrawRadios(&serslotsg);
						break;

					//
					// Deathmatch
					//
					case SERS_DEATHNO:
					case SERS_DEATHYES:
						sinfo.deathMatch = field - SERS_DEATHNO;
						DrawRadios(&sersdeathg);

					default:
						break;
				}
            break;
      }
   }
  
   func_exit:
  
	RestoreScreen();
	return ( rval );
}
コード例 #25
0
ファイル: i_gamepad.c プロジェクト: AlexMax/doomretro
void I_InitGamepad(void)
{
    gamepadfunc = I_PollDirectInputGamepad;
    gamepadthumbsfunc = (gamepadlefthanded ? I_PollThumbs_DirectInput_LeftHanded :
        I_PollThumbs_DirectInput_RightHanded);

    if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
        return;
    else
    {
        int     i;
        int     numgamepads = SDL_NumJoysticks();

        for (i = 0; i < numgamepads; ++i)
        {
            gamepad = SDL_JoystickOpen(i);
            if (gamepad)
                break;
        }

        if (!gamepad)
        {
            SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
            return;
        }
        else
        {
#ifdef WIN32
            HMODULE     pXInputDLL;

            if (!(pXInputDLL = LoadLibrary("XInput1_4.dll")))
                if (!(pXInputDLL = LoadLibrary("XInput9_1_0.dll")))
                    pXInputDLL = LoadLibrary("XInput1_3.dll");

            if (pXInputDLL)
            {
                M_SaveDefaults();

                pXInputGetState = (XINPUTGETSTATE)GetProcAddress(pXInputDLL, "XInputGetState");
                pXInputSetState = (XINPUTSETSTATE)GetProcAddress(pXInputDLL, "XInputSetState");

                if (pXInputGetState && pXInputSetState)
                {
                    XINPUT_STATE        state;

                    ZeroMemory(&state, sizeof(XINPUT_STATE));

                    if (pXInputGetState(0, &state) == ERROR_SUCCESS)
                    {
                        gamepadfunc = I_PollXInputGamepad;
                        gamepadthumbsfunc = (gamepadlefthanded ? I_PollThumbs_XInput_LeftHanded :
                            I_PollThumbs_XInput_RightHanded);
                    }
                }
            }
#endif

            SDL_JoystickEventState(SDL_ENABLE);
        }
    }
}