コード例 #1
0
ファイル: ozcp20.c プロジェクト: cjdaniel/sharp-wizard-games
option()
{
	ozcls();
	getsound();
	getmovie();
	ozputs(0,0,"Options: (Press ENTER when done, MENU to save)");
	ozputs(0,20,"PgUp/PgDn: Clay Pigeon Speed");
	putspeed();
	ozputs(135,20,slow);
	ozputs(0,30,"S: Toggle Sound");
	ozputs(135,30,soundstat);
	ozputs(0,40,"M: Toggle Startup Movie");
	ozputs(135,40,moviestat);
	ozputs(0,55,"(You should save after changing startup movie option)");
	ozputs(0,70,"OZCP Concept by Danny Jackson, coded by Chris Daniel");
	switch(ozngetch())
	{
		case 's': changesound(); break;
		case 'm': changemovie(); break;
		case KEY_PAGEUP:
		{
			if(speed==5001|speed==2501)
			{
				speed-=2500;
			}
			else if(speed==1)
			{
				speed=0;
			}
			else if(speed==0)
			{
				speed=5001;
			}
			break;
		}
		case KEY_PAGEDOWN:
		{
			if(speed==2501|speed==1)
			{
				speed+=2500;
			}
			else if(speed==5001)
			{
				speed=0;
			}
			else if(speed==0)
			{
				speed=1;
			}
			break;
		}
		case KEY_LOWER_MENU: saveconfig(); break;
		case KEY_UPPER_MENU: saveconfig(); break;
		case KEY_LOWER_ENTER: main();
		case KEY_NEWLINE: ozsnap(); break;
	}
	option();
}
コード例 #2
0
ファイル: jack.c プロジェクト: lgarrido/xjadeo
void jack_session_cb(jack_session_event_t *event, void *arg) {
	char filename[256];
	char command[256];
	if (interaction_override&OVR_JSESSION) {
		/* DO NOT SAVE SESSION 
		 * e.g. if xjadeo will be restored by wrapper-program
		 * f.i. ardour3+videotimeline
		 */
	  jack_session_reply(jack_client, event);
	  jack_session_event_free(event);
		return;
	}

	snprintf(filename, sizeof(filename), "%sxjadeo.state", event->session_dir );
	snprintf(command,  sizeof(command),  "xjadeo -U %s --rc ${SESSION_DIR}xjadeo.state", event->client_uuid );

	//TODO save-state in filename
	saveconfig(filename);

	event->command_line = strdup(command);
	jack_session_reply( jack_client, event );
  if(event->type == JackSessionSaveAndQuit)
		loop_flag=0;
	jack_session_event_free(event);
}
コード例 #3
0
static gboolean apply_config_changes(gpointer data) {
    apply_timeout = 0;
    saveconfig();
    start();
    running = TRUE;
    return FALSE;
}
コード例 #4
0
ファイル: mapedit.c プロジェクト: Jedzia/acm3
void setscreenmode(void)
{
    if (!gfx_init(320,200,60,screenmode))
    {
        win_messagebox("Graphics init error!\n");
        saveconfig();
        exit(1);
    }
}
コード例 #5
0
ファイル: infedit.c プロジェクト: neuromancer/BOFH
int main(int argc, char *argv[])
{
    io_openlinkeddatafile(datafile);

    loadconfig();
    initstuff();
    mainloop();
    saveconfig();
    return 0;
}
コード例 #6
0
ファイル: win-deviceconfig.c プロジェクト: Wack0/PCem-X
static INT_PTR CALLBACK deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
#endif
{
        switch (message)
        {
                case WM_INITDIALOG:
                {
                        int id = IDC_CONFIG_BASE;
                        device_config_t *config = config_device->config;
                        int c;

                        while (config->type != -1)
                        {
                                device_config_selection_t *selection = config->selection;
                                HWND h = GetDlgItem(hdlg, id);
                                int val_int;
                                char *val_string;
				int num;
				char s[80];
                                
                                switch (config->type)
                                {
                                        case CONFIG_BINARY:
                                        val_int = config_get_int(config_device->name, config->name, config->default_int);
                                        
                                        SendMessage(h, BM_SETCHECK, val_int, 0);
                                                
                                        id++;
                                        break;
                                     
                                        case CONFIG_SELECTION:
                                        val_int = config_get_int(config_device->name, config->name, config->default_int);
                                        
                                        c = 0;
                                        while (selection->description[0])
                                        {
                                                SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)selection->description);
                                                if (val_int == selection->value)
                                                        SendMessage(h, CB_SETCURSEL, c, 0);
                                                selection++;
                                                c++;
                                        }
                                        
                                        id += 2;
                                        break;

                                        case CONFIG_MIDI:
                                        val_int = config_get_int(NULL, config->name, config->default_int);
                                        
                                        num  = midi_get_num_devs();
                                        for (c = 0; c < num; c++)
                                        {
                                                midi_get_dev_name(c, s);
                                                SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s);
                                                if (val_int == c)
                                                        SendMessage(h, CB_SETCURSEL, c, 0);
                                        }

                                        id += 2;
                                        break;
                                }
                                config++;
                        }
                }
                return TRUE;
                
                case WM_COMMAND:
                switch (LOWORD(wParam))
                {
                        case IDOK:
                        {
                                int id = IDC_CONFIG_BASE;
                                device_config_t *config = config_device->config;
                                int c;
                                int changed = 0;
                                
                                while (config->type != -1)
                                {
                                        device_config_selection_t *selection = config->selection;
                                        HWND h = GetDlgItem(hdlg, id);
                                        int val_int;
                                        char *val_string;
                                
                                        switch (config->type)
                                        {
                                                case CONFIG_BINARY:
                                                val_int = config_get_int(config_device->name, config->name, config->default_int);

                                                if (val_int != SendMessage(h, BM_GETCHECK, 0, 0))
                                                        changed = 1;
                                                
                                                id++;
                                                break;
                                     
                                                case CONFIG_SELECTION:
                                                val_int = config_get_int(config_device->name, config->name, config->default_int);

                                                c = SendMessage(h, CB_GETCURSEL, 0, 0);

                                                for (; c > 0; c--)
                                                        selection++;

                                                if (val_int != selection->value)
                                                        changed = 1;
                                        
                                                id += 2;
                                                break;

                                                case CONFIG_MIDI:
                                                val_int = config_get_int(NULL, config->name, config->default_int);

                                                c = SendMessage(h, CB_GETCURSEL, 0, 0);

                                                if (val_int != c)
                                                        changed = 1;
                                        
                                                id += 2;
                                                break;
                                        }
                                        config++;
                                }
                                
                                if (!changed)
                                {
                                        EndDialog(hdlg, 0);
                                        return TRUE;
                                }
                                        
                                if (MessageBox(NULL, "This will reset PCem!\nOkay to continue?", "PCem", MB_OKCANCEL) != IDOK)
                                {
                                        EndDialog(hdlg, 0);
                                        return TRUE;
                                }

                                id = IDC_CONFIG_BASE;
                                config = config_device->config;
                                
                                while (config->type != -1)
                                {
                                        device_config_selection_t *selection = config->selection;
                                        HWND h = GetDlgItem(hdlg, id);
                                        int val_int;
                                        char *val_string;
                                
                                        switch (config->type)
                                        {
                                                case CONFIG_BINARY:
                                                config_set_int(config_device->name, config->name, SendMessage(h, BM_GETCHECK, 0, 0));
                                                
                                                id++;
                                                break;
                                     
                                                case CONFIG_SELECTION:
                                                c = SendMessage(h, CB_GETCURSEL, 0, 0);
                                                for (; c > 0; c--)
                                                        selection++;
                                                config_set_int(config_device->name, config->name, selection->value);
                                        
                                                id += 2;
                                                break;

                                                case CONFIG_MIDI:
                                                c = SendMessage(h, CB_GETCURSEL, 0, 0);
                                                config_set_int(NULL, config->name, c);

                                                id += 2;
                                                break;
                                        }
                                        config++;
                                }

                                saveconfig();
                        
                                resetpchard();

                                EndDialog(hdlg, 0);
                                return TRUE;
                        }
                        case IDCANCEL:
                        EndDialog(hdlg, 0);
                        return TRUE;
                }
                break;
        }
        return FALSE;
}
コード例 #7
0
void st_shutdown(void)
{
  close_audio();
  SDL_Quit();
  saveconfig();
}
コード例 #8
0
ファイル: swall.cpp プロジェクト: zotz/jSoundz
Swall::Swall(QWidget *parent)
    : QWidget(parent)
{
//sndt_key = new QString("");
//sndf_key = new QString("");

  // think I don't need playplay due to g_playmode
  // m_playplay = true; // this does not seem to have the right or any effect. why?
/*
  QMap<QString, QString>::const_iterator ii = cfgmap.constBegin();
  while (ii != cfgmap.constEnd()) {
      qDebug() << ii.key() << ": " << ii.value();
      ++ii;
  }
*/

  QGridLayout *grid = new QGridLayout(this);
  grid->setSpacing(2);

  QPushButton *quit = new QPushButton("Quit", this);
  grid->addWidget(quit, 11,0);
  connect(quit, SIGNAL(clicked()),
  		qApp, SLOT(quit()));

  QPushButton *savecfg = new QPushButton("Save Config", this);
  grid->addWidget(savecfg, 11,2);
  connect(savecfg, SIGNAL(clicked()),
  		this, SLOT(saveconfig()));

  QPushButton *loadcfg = new QPushButton("Load Config", this);
  grid->addWidget(loadcfg, 11,3);
  connect(loadcfg, SIGNAL(clicked()),
  		this, SLOT(loadconfig()));


  QPushButton *playmode = new QPushButton("Play Mode", this);
  playmode->setCheckable(1);
  playmode->setChecked(1);
  grid->addWidget(playmode, 11,5);
  connect(playmode, SIGNAL(clicked()),
  		this, SLOT(processplaymode()));

	
  QPushButton *editmode = new QPushButton("Edit Mode", this);
  editmode->setCheckable(1);
  grid->addWidget(editmode, 11,6);
  connect(editmode, SIGNAL(clicked()),
  		this, SLOT(processeditmode()));


  QButtonGroup* buttonGroup = new QButtonGroup(this) ;
  buttonGroup->addButton(playmode);
  buttonGroup->addButton(editmode);


  QPushButton *help = new QPushButton("Help", this);
  grid->addWidget(help, 11,7);
  connect(help, SIGNAL(clicked()),
  		this, SLOT(help()));
		
  QPushButton *about = new QPushButton("About", this);
  grid->addWidget(about, 11,8);
  connect(about, SIGNAL(clicked()),
  		this, SLOT(about()));


  QPushButton *notes = new QPushButton("Notes", this);
  grid->addWidget(notes, 11,9);
  connect(notes, SIGNAL(clicked()),
  		this, SLOT(notes()));

  QPalette pal;
  pal.setColor( QPalette::Active, QPalette::Button, "Blue" );
  pal.setColor( QPalette::Active, QPalette::ButtonText, "Yellow" );
  pal.setColor( QPalette::Inactive, QPalette::Button, "Cyan" );
  pal.setColor( QPalette::Inactive, QPalette::ButtonText, "Green" );



  // QButtonGroup* gridGroup = new QButtonGroup(this) ;
  // gridGroup->setExclusive(0);
  for (int row=0; row<10; row++) {
    for (int col=0; col<10; col++) {
      SPushButton *btn = new SPushButton("", this);
      // qDebug() << "Making SPushButtons for the grid.";
      btn->setFixedSize(115, 80);
      btn->setCheckable(1);
      // btn->setAutoDefault(false);
      btn->setPalette( pal );
      QString sndt_key;
      QString some_sndt;
      QString some_butid;
      // sndt_key = new QString("");
      some_sndt.append(QString("Cut::R"));
      some_sndt.append(QString("%1").arg(row));
      some_sndt.append(QString(":C"));
      some_sndt.append(QString("%1").arg(col));
      sndt_key.append(QString("sndt"));
      sndt_key.append(QString("%1").arg(row));
      sndt_key.append(QString("%1").arg(col));
      some_butid.append(QString("%1").arg(row));
      some_butid.append(QString("%1").arg(col));
      some_sndt = cfgmap[sndt_key];
      QString sndf_key;
      QString some_sndf;
      // sndf_key = new QString("");
      some_sndf.append(QString("cut_r"));
      some_sndf.append(QString("%1").arg(row));
      some_sndf.append(QString("_c"));
      some_sndf.append(QString("%1").arg(col));
      some_sndf.append(QString(".mp3"));
      sndf_key.append(QString("sndf"));
      sndf_key.append(QString("%1").arg(row));
      sndf_key.append(QString("%1").arg(col));
      some_sndf = cfgmap[sndf_key];
      btn->setSndf(some_sndf);
      btn->setSndfKey(sndf_key);
      btn->setSndt(some_sndt);
      btn->setSndtKey(sndt_key);
      btn->setButId(some_butid);
      btn->setProcId("00");
      btn->setText(btn->getSndt());
      btn->setPlayb(false);
      btn->setSndLoop(false);
      connect(btn, SIGNAL(clicked()),
  		btn, SLOT(processButton()));
  	  connect(this, SIGNAL(sbutconfig(QString, QString, QString)),
  		btn, SLOT(updateButConfig(QString, QString, QString)));
      grid->addWidget(btn, row, col);

    }
  }



  setLayout(grid);

}
コード例 #9
0
int main(int argc, char *argv[])
{
	struct sigaction act;
	int rc, rc1, rc2, readonly, clobbercfg;

	clobbercfg = readonly = 0;

	openlog("flatfsd", LOG_PERROR, LOG_DAEMON);

	while ((rc = getopt(argc, argv, "vcnribwH123hs?")) != EOF) {
		switch (rc) {
		case 'w':
			clobbercfg++;
			readonly++;
			break;

		case 'r':
			readonly++;
			break;
		case 'n':
			nowrite = 1;
			break;
		case 'c':
#if !defined(USING_FLASH_FILESYSTEM)
			rc = flat_check();
			if (rc < 0) {
#ifdef LOGGING
				char ecmd[64];
				sprintf(ecmd, "/bin/logd chksum-bad %d", -rc);
				system(ecmd);
#endif
				printf("Flash filesystem is invalid %d - check syslog\n", rc);
			} else {
				printf("Flash filesystem is valid\n");
#ifdef LOGGING
				system("/bin/logd chksum-good");
#endif
			}
			exit(rc);
#else
			exit(0);
#endif
			break;
		case 'v':
			version();
			exit(0);
			break;
		case 's':
			log_caller("/bin/logd flatfsd-s");
			exit(saveconfig());
			break;
		case 'b':
			log_caller("/bin/logd flatfsd-b");
			exit(reboot_system());
			break;
		case 'H':
			log_caller("/bin/logd flatfsd-h");
			exit(halt_system());
			break;
		case 'i':
			log_caller("/bin/logd flatfsd-i");
			exit(reset_config());
			break;
		case '1':
			fsver = 1;
			break;
		case '2':
			fsver = 2;
			break;
		case '3':
			fsver = 3;
			break;
		case 'h':
		case '?':
			usage(0);
			break;
		default:
			usage(1);
			break;
		}
	}

	if (readonly) {
		rc1 = rc2 = 0;

		if (clobbercfg ||
#if !defined(USING_FLASH_FILESYSTEM)
			((rc = flat_restorefs()) < 0) ||
#endif
			(rc1 = flat_filecount()) <= 0 ||
			(rc2 = flat_needinit())
		) {
#ifdef LOGGING
			char ecmd[64];

			/* log the reason we have for killing the flatfs */
			if (clobbercfg)
				sprintf(ecmd, "/bin/logd newflatfs clobbered");
			else if (rc < 0)
				sprintf(ecmd, "/bin/logd newflatfs recreate=%d", rc);
			else if (rc1 <= 0)
				sprintf(ecmd, "/bin/logd newflatfs filecount=%d", rc1);
			else if (rc2)
				sprintf(ecmd, "/bin/logd newflatfs needinit");
			else
				sprintf(ecmd, "/bin/logd newflatfs unknown");

			system(ecmd);
#endif
			syslog(LOG_ERR, "Nonexistent or bad flatfs (%d), creating new one...", rc);
			flat_clean(1);
			if ((rc = flat_new(DEFAULTDIR)) < 0) {
				syslog(LOG_ERR, "Failed to create new flatfs, err=%d errno=%d",
					rc, errno);
				exit(1);
			}
			save_config_to_flash();
		}
		syslog(LOG_INFO, "Created %d configuration files (%d bytes)",
			numfiles, numbytes);
		exit(0);
	}

	creatpidfile();

	act.sa_handler = sighup;
	memset(&act.sa_mask, 0, sizeof(act.sa_mask));
	act.sa_flags = SA_RESTART;
	act.sa_restorer = 0;
	sigaction(SIGHUP, &act, NULL);

	act.sa_handler = sigusr1;
	memset(&act.sa_mask, 0, sizeof(act.sa_mask));
	act.sa_flags = SA_RESTART;
	act.sa_restorer = 0;
	sigaction(SIGUSR1, &act, NULL);

	act.sa_handler = sigusr2;
	memset(&act.sa_mask, 0, sizeof(act.sa_mask));
	act.sa_flags = SA_RESTART;
	act.sa_restorer = 0;
	sigaction(SIGUSR2, &act, NULL);

	act.sa_handler = sigpwr;
	memset(&act.sa_mask, 0, sizeof(act.sa_mask));
	act.sa_flags = SA_RESTART;
	act.sa_restorer = 0;
	sigaction(SIGPWR, &act, NULL);

	/* Make sure we don't suddenly exit while we are writing */
	act.sa_handler = sigexit;
	memset(&act.sa_mask, 0, sizeof(act.sa_mask));
	act.sa_flags = SA_RESTART;
	act.sa_restorer = 0;
	sigaction(SIGINT, &act, NULL);
	sigaction(SIGTERM, &act, NULL);
	sigaction(SIGQUIT, &act, NULL);

	register_resetpid();

	/*
	 * Spin forever, waiting for a signal to write...
	 */
	for (;;) {
		if (recv_usr1) {
			struct stat st_buf;
			recv_usr1 = 0;
			/* Don't write out config if temp file  exists. */
			if (stat(IGNORE_FLASH_WRITE_FILE, &st_buf) == 0) {
				syslog(LOG_INFO, "Not writing to flash "
					"because %s exists",
					IGNORE_FLASH_WRITE_FILE);
				continue;
			}
			save_config_to_flash();
			continue;
		}

		if (recv_hup) {
			/*
			 * Make sure we do the check above first so that we
			 * commit to flash before rebooting.
			 */
			recv_hup = 0;
			reboot_now();
			/*notreached*/
			exit(1);
		}

		if (recv_pwr) {
			/*
			 * Ditto for halt
			 */
			recv_pwr = 0;
			halt_now();
			/*notreached*/
			exit(1);
		}

		if (recv_usr2) {
#ifdef LOGGING
			system("/bin/logd button");
#endif
			recv_usr2 = 0;
			current_cmd++;
			if (cmd_list[current_cmd].action == NULL) /* wrap */
				current_cmd = 0;
		}

		if (exit_flatfsd)
			break;

		if (current_cmd)
			led_pause();
		else if (!recv_hup && !recv_usr1 && !recv_usr2 && !recv_pwr)
			pause();
	}

	return 0;
}
コード例 #10
0
ファイル: startgame.cpp プロジェクト: ultravolt/SAIS
int32 startgame()
{
	int32 end;
	int32 c, mc;
	int32 bx=192, by=88, h=300;
	int32 y;
	int32 upd=1;
	int32 mx, my;
	int32 cn=0;
	int32 ti, ot;
	t_ik_image *bg;
	char name[32];

	loadconfig();

	start_ik_timer(1, 31);
	while (get_ik_timer(1) < 2 && !must_quit)
	{
		ik_eventhandler();
	}
	Play_Sound(WAV_MUS_TITLE, 15, 1, 100, 22050,-1000);
	while (get_ik_timer(1) < 4 && !must_quit)
	{
		ik_eventhandler();
	}
	Play_Sound(WAV_MUS_TITLE, 14, 1, 80, 22050, 1000);


	if (settings.random_names & 1)
		strcpy(settings.captname, captnames[rand()%num_captnames]);

	if (settings.random_names & 2)
		strcpy(settings.shipname, shipnames[rand()%num_shipnames]);

	bg = ik_load_pcx("graphics/starback.pcx", NULL);

	end = 0; ti = get_ik_timer(2);
	while (!end && !must_quit)
	{
		ik_eventhandler();
		c = ik_inkey();
		mc = ik_mclick();
		mx = ik_mouse_x - bx; 
		my = ik_mouse_y - by;

		ot = ti;
		ti = get_ik_timer(2);
		if (ti != ot)
		{
			prep_screen();
			ik_blit();
		}

		if (c==13 || c==32)
			end = 2;
		if ((mc & 1) && mx > 0 && mx < 240)
		{
			if (my > h-24 && my < h-8) // buttons
			{
				if (mx > 16 && mx < 64) // cancel
					end = 1;
				else if (mx > 176 && mx < 224) // ok
				{	end = 2; Play_SoundFX(WAV_DOT); }
			}
			else if (my > 32 && my < 40) // captain
			{
				if (mx < 216)
				{
					cn |= 1;
					prep_screen();
					ik_drawbox(screen, bx+70, by+32, bx+215, by+39, STARMAP_INTERFACE_COLOR*16+3);
					ik_blit();
					strcpy(name, settings.captname);
					ik_text_input(bx+70, by+32, 14, font_6x8, "", name, STARMAP_INTERFACE_COLOR*16+3, STARMAP_INTERFACE_COLOR);
					if (strlen(name)>0)
						strcpy(settings.captname, name);
				}
				else
				{
					settings.random_names ^= 1;
					Play_SoundFX(WAV_LOCK,0);
				}
				upd = 1;must_quit=0;
			}
			else if (my > 40 && my < 48) // ship
			{
				if (mx < 216)
				{
					cn |= 2;
					prep_screen();
					ik_drawbox(screen, bx+70, by+40, bx+215, by+47, STARMAP_INTERFACE_COLOR*16+3);
					ik_blit();
					strcpy(name, settings.shipname);
					ik_text_input(bx+70, by+40, 14, font_6x8, "", name, STARMAP_INTERFACE_COLOR*16+3, STARMAP_INTERFACE_COLOR);
					if (strlen(name)>0)
						strcpy(settings.shipname, name);
				}
				else
				{
					settings.random_names ^= 2;
					Play_SoundFX(WAV_LOCK,0);
				}
				upd = 1;must_quit=0;
			}
			else if (my > 64 && my < 96)	// ship
			{
				settings.dif_ship = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 112 && my < 176) // nebula
			{
				settings.dif_nebula = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 192 && my < 224) // enemies
			{
				settings.dif_enemies = (mx - 16)/72;
				Play_SoundFX(WAV_SLIDER,0);
				upd = 1; 
			}
			else if (my > 232 && my < 240)	// easy/hard
			{
				c = (mx-40)/32; 
				if (c < 0) c=0;
				if (c > 4) c=4;
				settings.dif_nebula = (c+1)/2;
				settings.dif_enemies = c/2;
				upd = 1;
				Play_SoundFX(WAV_SLIDER,0);
			}
			else if (my > 256 && my < 264)	// enable tutorial
			{
				if (mx > 16 && mx < 24)
				{
					settings.random_names ^= 4;
					Play_SoundFX(WAV_LOCK,0);
					upd = 1;
				}
			}
		}
		if (upd)
		{
			upd = 0;
			prep_screen();
			ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

			y = by+16;
			interface_drawborder(screen, bx, by, bx+240, by+h, 1, STARMAP_INTERFACE_COLOR, "Start new adventure");
			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_IDENTIFY]);
			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_CAPTAIN]);
			ik_print(screen, font_6x8, bx+70, y, 3, settings.captname);
			if (!(cn&1))
				ik_print(screen, font_4x8, bx+216-strlen(textstring[STR_STARTGAME_RENAME])*4, y, 3, textstring[STR_STARTGAME_RENAME]);
			ik_dsprite(screen, bx+216, y, spr_IFslider->spr[8+(settings.random_names&1)], 2+((3-3*(settings.random_names&1))<<8));

			ik_print(screen, font_6x8, bx+16, y+=8, 0, textstring[STR_STARTGAME_STARSHIP]);
			ik_print(screen, font_6x8, bx+70, y, 3, settings.shipname);
			if (!(cn&2))
				ik_print(screen, font_4x8, bx+216-strlen(textstring[STR_STARTGAME_RENAME])*4, y, 3, textstring[STR_STARTGAME_RENAME]);
			ik_dsprite(screen, bx+216, y, spr_IFslider->spr[8+(settings.random_names&2)/2], 2+((3-3*(settings.random_names&2)/2)<<8));

			ik_print(screen, font_6x8, bx+16, y+=16, 0, textstring[STR_STARTGAME_LOADOUT], textstring[STR_STARTGAME_LOADOUT1+settings.dif_ship]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifenemy->spr[c+3], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[20], 2+(3<<8)*(c==settings.dif_ship));
			}

			ik_print(screen, font_6x8, bx+16, y+=40, 0, textstring[STR_STARTGAME_NEBULA]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifnebula->spr[c], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[18], 2+(3<<8)*(c==settings.dif_nebula));
			}

			ik_print(screen, font_6x8, bx+16, y+=72, 0, textstring[STR_STARTGAME_ENEMIES]);
			y += 8;
			for (c = 0; c < 3; c++)
			{
				ik_dsprite(screen, bx+16+c*72, y, spr_IFdifenemy->spr[c], 0);
				ik_dsprite(screen, bx+16+c*72, y, spr_IFborder->spr[20], 2+(3<<8)*(c==settings.dif_enemies));
			}

			y+=40;
			ik_print(screen, font_6x8, bx+16, y, 0, textstring[STR_STARTGAME_EASY]);
			ik_print(screen, font_6x8, bx+224-6*strlen(textstring[STR_STARTGAME_HARD]), y, 0, textstring[STR_STARTGAME_HARD]);
			ik_print(screen, font_6x8, bx+16, y+12, 0, textstring[STR_STARTGAME_LOSCORE]);
			ik_print(screen, font_6x8, bx+224-6*strlen(textstring[STR_STARTGAME_HISCORE]), y+12, 0, textstring[STR_STARTGAME_HISCORE]);
			interface_drawslider(screen, bx+56, y, 0, 128, 4, settings.dif_enemies+settings.dif_nebula, STARMAP_INTERFACE_COLOR);

			y+=24;
			ik_dsprite(screen, bx+12, y-5, spr_IFbutton->spr[(settings.random_names&4)>0], 0);
			ik_print(screen, font_6x8, bx+32, y, 0, "TUTORIAL MODE");


			interface_drawbutton(screen, bx+16, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_CANCEL]);
			interface_drawbutton(screen, bx+240-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);

			ik_blit();
			update_palette();
		}
	}

	interface_cleartuts();

	if (must_quit)
		end = 1;

	if (settings.opt_mucrontext & 1)
	{


	if (end > 1)
	{
		bx = 192; by = 72; h = 328;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE1]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON1]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON2]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON3]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON4]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_SMraces->spr[race_unknown], 0);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}

	if (end > 1)
	{
		bx = 192; by = 96; h = 168;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE2]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON5]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+16, by+y*8, 224, 88, 0, 
								textstring[STR_STARTGAME_MUCRON6]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_IFdifnebula->spr[1], 0);
		ik_dsprite(screen, bx+16, by+24, hulls[shiptypes[0].hull].sprite, 0);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}



	if (end > 1)
	{
		bx = 192; by = 120; h = 112;
		by = 220 - h/2;

		prep_screen();
		ik_copybox(bg, screen, 0, 0, 640, 480, 0,0);

		y = 3;
		interface_drawborder(screen, bx, by, bx+256, by+h, 1, STARMAP_INTERFACE_COLOR, textstring[STR_STARTGAME_TITLE3]);
		y +=  1 + interface_textbox(screen, font_6x8, bx+84, by+y*8, 160, 88, 0, 
								textstring[STR_STARTGAME_MUCRON7]);
		interface_drawbutton(screen, bx+256-64, by+h-24, 48, STARMAP_INTERFACE_COLOR, textstring[STR_OK]);
		ik_dsprite(screen, bx+16, by+24, spr_SMraces->spr[RC_PLANET], 4);
		ik_dsprite(screen, bx+16, by+24, spr_IFborder->spr[18], 2+(STARMAP_INTERFACE_COLOR<<8));

		ik_blit();
		update_palette();
		end = waitclick(bx+256-64, by+h-24, bx+256-16, by+h-8);
	}

	}

	del_image(bg);

	if (end > 1)
	{
		starmap_create();
		player_init();
	}

	saveconfig();
	
	return end-1;
}
コード例 #11
0
ファイル: allegro-main.c プロジェクト: MoochMcGee/PCem-mooch
int main(int argc, char *argv[])
{
        int frames = 0;
        int c, d;
        allegro_init();
        allegro_video_init();
        install_timer();
        install_int_ex(timer_rout, BPS_TO_TIMER(100));
	install_int_ex(onesec, BPS_TO_TIMER(1));
	midi_init();
        
        initpc(argc, argv);

        d = romset;
        for (c = 0; c < ROM_MAX; c++)
        {
                romset = c;
                romspresent[c] = loadbios();
                pclog("romset %i - %i\n", c, romspresent[c]);
        }
        
        for (c = 0; c < ROM_MAX; c++)
        {
                if (romspresent[c])
                   break;
        }
        if (c == ROM_MAX)
        {
                printf("No ROMs present!\nYou must have at least one romset to use PCem.");
                return 0;
        }

        romset=d;
        c=loadbios();

        if (!c)
        {
                if (romset != -1)
			printf("Configured romset not available.\nDefaulting to available romset.");
                for (c = 0; c < ROM_MAX; c++)
                {
                        if (romspresent[c])
                        {
                                romset = c;
                                model = model_getmodel(romset);
                                saveconfig();
                                resetpchard();
                                break;
                        }
                }
        }

        for (c = 0; c < GFX_MAX; c++)
                gfx_present[c] = video_card_available(video_old_to_new(c));

        if (!video_card_available(video_old_to_new(gfxcard)))
        {
                if (gfxcard) printf("Configured video BIOS not available.\nDefaulting to available romset.");
                for (c = GFX_MAX-1; c >= 0; c--)
                {
                        if (gfx_present[c])
                        {
                                gfxcard = c;
                                saveconfig();
                                resetpchard();
                                break;
                        }
                }
        }

	resetpchard();

        ticks = 0;
        while (!quited)
        {
                if (ticks)
                {
                        ticks--;
                        runpc();
                        frames++;
                        if (frames >= 200 && nvr_dosave)
                        {
                                frames = 0;
                                nvr_dosave = 0;
                                savenvr();
                        }
                }
                else
                        rest(1);

		if (ticks > 10)
			ticks = 0;
                
		if ((mouse_b & 1) && !mousecapture)
			mousecapture = 1;

		if (((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_END]) || (mouse_b & 4))
			mousecapture = 0;

                if ((key[KEY_LCONTROL] || key[KEY_RCONTROL]) && key[KEY_ALT] && key[KEY_PGDN])
                {
			int old_winsizex = winsizex, old_winsizey = winsizey;
			if (winsizex < 512 || winsizey < 350)
				updatewindowsize(512, 350);
                        gui_enter();
			if (old_winsizex < 512 || old_winsizey < 350)
				updatewindowsize(old_winsizex, old_winsizey);
                        ticks = 0;
                }
        }
        
        closepc();

	midi_close();

        return 0;
}
コード例 #12
0
ファイル: main.c プロジェクト: FrozenCow/gish
int main (int argc,char *argv[])
  {
  int count;
  int flags;
  const char *temp;

#ifdef DATAPATH
  chdir(DATAPATH);
#endif

  checkbigendian();

  loadconfig();
  loadscores();
  loadplayers();

  flags=SDL_INIT_VIDEO|SDL_INIT_TIMER;
  if (config.joystick)
    flags|=SDL_INIT_JOYSTICK;

  SDL_Init(flags);

  sdlvideoinfo=SDL_GetVideoInfo();
  sdlpixelformat=sdlvideoinfo->vfmt;
  if (sdlpixelformat->BitsPerPixel==16)
    config.bitsperpixel=16;

  for (count=1;count<argc;count++)
    {
    if (strcmp("-nosound",argv[count])==0)
      {
      config.sound=0;
      option.sound=0;
      option.music=0;
      }
    if (strcmp("-sound",argv[count])==0)
      config.sound=1;
    if (strcmp("-nomusic",argv[count])==0)
      option.music=0;
    }

  saveconfig();

  SDL_ShowCursor(SDL_DISABLE);

  listvideomodes();

  SDL_WM_SetCaption("Gish","SDL");
  SDL_WM_SetIcon(SDL_LoadBMP("gish.bmp"),iconmask);

  if (windowinfo.bitsperpixel==16)
    {
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,5);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,6);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,5);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,0);
    }
  if (windowinfo.bitsperpixel==32)
    {
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,8);
    }
  SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,windowinfo.depthbits);
  SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,windowinfo.stencilbits);
  SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);

  if (windowinfo.fullscreen)
    SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,SDL_OPENGL|SDL_FULLSCREEN);
  else
    SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,SDL_OPENGL);

  loadglextentions();

  for (count=0;count<2048;count++)
    glGenTextures(1,&texture[count].glname);

  glDisable(GL_DEPTH_TEST);
  glDepthMask(GL_FALSE);

  if (config.joystick)
    {
    numofjoysticks=SDL_NumJoysticks();
    for (count=0;count<numofjoysticks;count++)
      {
      joy[count]=SDL_JoystickOpen(count);
      temp=SDL_JoystickName(count);
      strcpy(joystick[count].name,temp);
      joystick[count].numofbuttons=SDL_JoystickNumButtons(joy[count]);
      joystick[count].numofhats=SDL_JoystickNumHats(joy[count]);
      }

    SDL_JoystickEventState(SDL_IGNORE);
    }

  font.texturenum=0;
  font.cursornum=0;
  font.sizex=640;
  font.sizey=480;

  loadtexture(1000,"font00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR);
  loadtexture(1001,"font01.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR);

  loadtexture(768,"mouse00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR);
  loadtexture(769,"mouse00.png",0,GL_CLAMP,GL_CLAMP,GL_LINEAR,GL_LINEAR);

  setupmenuitems();

  if (!glext.multitexture)
    {
    notsupportedmenu();

    SDL_WM_IconifyWindow();
    SDL_Quit();
    return(0);
    }
    
  if (config.sound)
    setupaudio();

  mainmenu();

  saveconfig();
  savescores();
  saveplayers();

  if (config.sound)
    shutdownaudio();

  SDL_WM_IconifyWindow();

  SDL_Quit();

  return(0);
  }
コード例 #13
0
ファイル: menuTabHD.cpp プロジェクト: Elotoha/uae4all-rpi
   void action(const gcn::ActionEvent& actionEvent)
   {
 		if (saveconfig(2))
 		 showInfo("Config saved for current HD");
   }