Example #1
0
static void selectoption(int index)
{
	switch(index)
	{
		case 0:		// New
		{
			music(0);
			
			game.switchstage.mapno = NEW_GAME_FROM_MENU;
			game.setmode(GM_NORMAL);
		}
		break;
		
		case 1:		// Load
		{
			music(0);
			
			game.switchstage.mapno = LOAD_GAME_FROM_MENU;
			game.setmode(GM_NORMAL);
		}
		break;
		
		case 2:		// Load Menu (multisave)
		{
			textbox.SetVisible(true);
			textbox.SaveSelect.SetVisible(true, SS_LOADING);
			title.in_multiload = true;
		}
		break;
	}
}
Example #2
0
void	analyzeSeq(int seq[]) {
   int dmin, dmax;
   int base;
   byte pattern[3][4] = {
	{ 1, 1, 2, 0 },
	{ 2, 1, 1, 0 },
	{ 1, 2, 1, 0 }
   };
   
   
   bitSet(PORTB, PB3);
   _delay_ms(12);
   bitClear(PORTB, PB3);
   
   dmax = seq[0];
   dmin = dmax;
   int i;
   for (i = 0; seq[i] > 0 && i < SEQMAX; i++) {
	dmax = max(dmax, seq[i]);
	dmin = min(dmin, seq[i]);
	_delay_ms(4*(seq[i]-3));
	bitSet(PORTB, PB3);
	_delay_ms(12);
	bitClear(PORTB, PB3);
   }
   base = (dmax + (dmin/2)) / dmin;
   base = dmax/8 / base;
   for (i = 0; seq[i] > 0 && i < SEQMAX; i++) {
	seq[i] = (seq[i] + (base/2) ) / base;
   }
   int n;
   int error;
   for ( n = 0; n < 3; n++) {
	error = 0;
	for (i = 0; seq[i] != 0 && pattern[n][i] != 0; i++) {
	   error += abs(seq[i] - pattern[n][i]*8);
	}
	if ( error > 5 ) 
	   continue;
	if ( i > 0 && (seq[i] == 0 && pattern[n][i] == 0) ) {
	   bitSet(PORTB, PB3);
	   switch(n) {
		case 0:
		   music(1);
		   break;
		case 1:
		   music(2);
		   break;
		case 2:
		   music(3);
		   break;
	   }
	   bitClear(PORTB, PB3);
	}
   }
}
Example #3
0
int SDL_main(int argc, char *argv[])
{
	stat("Entering main loop");
	testblit();

	if (SSInit()) return 1;
	if (pxt_init()) return 1;
	
	if (pxt_LoadSoundFX(pxt_dir, sndcache, 0x75)) {
		printf("Can't load\n");
		return 1;
	}

	if (org_init(org_wavetable, pxt_dir, ORG_VOLUME))
	{
		staterr("Music failed to initialize");
		return 1;
	}

	music(19);

	while(!quitting)
	{
		org_run();
		
		SDL_Event pie;
		if (SDL_PollEvent(&pie))
		{
			if (pie.type == SDL_KEYDOWN) {
				
				if(pie.key.keysym.sym == SDLK_F3)
					quitting = true;
				else if(pie.key.keysym.sym == SDLK_BTN_A)
					pxt_Play(-1, 1, 1);
				else if(pie.key.keysym.sym == SDLK_BTN_B)
					org_stop();
				else if(pie.key.keysym.sym == SDLK_BTN_Y)
					music(random(1,42));
			}
		}
	}


	pxt_freeSoundFX();
	SSClose();

	return 0;
}
bool ResourceManager::addMusicFile(const QString path, const QString music_file) {
    QFile file(findFile(path).absoluteFilePath());

    // Does the path exist?
    if(file.exists()) {
        // if the optional param music_file is not given, use the basename as key
        QString music_key;
        if(music_file == "") {
            music_key = path;
        } else {
            music_key = music_file;
        }

        // if a sound with that key already exists in the dictionary, return
        if(mMusic.contains(music_key)) {
            return true;
        }

        std::shared_ptr<sf::Music> music(new sf::Music());
        if(!music->openFromFile(Utils::toStdString(file.fileName()))) {
            Logger::get().error("Loading Music <" + file.fileName() + "> failed.");
            return false;
        }

        mMusic.insert(music_key, music);
        return true;
    }
    return false;
}
Example #5
0
int		play(t_game *game)
{
  Uint8		*keys;
  int		key;
  char		finish;
  Uint32	timer, elapsed;

  finish = 1;
  music(game, "sprites/demacia.mp3");
  while (finish)
    {
      timer = SDL_GetTicks();
      SDL_FillRect(game->sdl.screen, NULL, 0);
      SDL_PumpEvents();
      keys = SDL_GetKeyState(&key);
      if (physics(&game->darien.darien, game) == 0)
	gere_key(game, &game->darien.darien.sprite, keys);
      aff_screen(game);
      elapsed = SDL_GetTicks() - timer;
      if (elapsed < 20)
	SDL_Delay(20 - elapsed);
      if (keys[SDLK_ESCAPE])
	finish = 0;
    }
  exit(0);
}
Example #6
0
bool MusicManager::Register(const boost::filesystem::path& path,
							const std::string& trackname,
							const float volume,
							const float pitch) {
	if(!boost::filesystem::is_regular_file(path/trackname)) {
		Logger::Critical(LogOrigin::MUSICMANAGER, "Tried registering music path '"+(path/trackname).string()+"' but this music path doesn't exist!");
		exit(1);
	}

    // if music already is registered, return
    if(mMusicTracks.count((path/trackname).string()) != 0) {
        return true;
    }

	// log output
	Logger::Debug(LogOrigin::MUSICMANAGER, "Registering music track '"+(path/trackname).string()+"'");

	boost::shared_ptr<sf::Music> music(new sf::Music());
	mMusicTracks[trackname] = music;
	mMusicTracks[trackname]->OpenFromFile((path/trackname).string());
	mMusicTracks[trackname]->SetPitch(pitch);
	mMusicTracks[trackname]->SetVolume(volume);
	mMusicTracks[trackname]->SetLoop(true);
	return true;
}
Example #7
0
void SoundManager::PlayMusicOnChannel(const gd::String & name, unsigned int channel , bool repeat, float volume, float pitch)
{
    const gd::String & file = GetFileFromSoundName(name);
    std::shared_ptr<Music> music(new Music);
    #if !defined(GD_IDE_ONLY)
    gd::ResourcesLoader * ressourcesLoader = gd::ResourcesLoader::Get();
    if(ressourcesLoader->HasFile(file))
    {
        std::size_t size = ressourcesLoader->GetBinaryFileSize(file);
        music->SetBuffer(ressourcesLoader->LoadBinaryFile(file), size);
        music->OpenFromMemory(size);
    }
    else
    #endif
    {
        music->OpenFromFile(file);
    }

    SetMusicOnChannel(channel, music);
    music->Play();

    music->SetLoop(repeat);
    music->SetVolume(volume, globalVolume);
    music->SetPitch(pitch);
}
Example #8
0
bool title_init(int param)
{
	memset(&title, 0, sizeof(title));
	game.switchstage.mapno = 0;
	game.switchstage.eventonentry = 0;
	game.showmapnametime = 0;
	textbox.SetVisible(false);
	
	if (niku_load(&title.besttime))
		title.besttime = 0xffffffff;
	
	// select a title screen based on Nikumaru time
	int t;
	for(t=0;;t++)
	{
		if (title.besttime < titlescreens[t].timetobeat || \
			titlescreens[t].timetobeat == 0xffffffff)
		{
			break;
		}
	}
	
	title.sprite = titlescreens[t].sprite;
	music(titlescreens[t].songtrack);
	
	if (AnyProfileExists())
		title.cursel = 1;	// Load Game
	else
		title.cursel = 0;	// New Game
	
	return 0;
}
Example #9
0
void  SoundManager::setBackgroundMusic(std::string const& name, sf::Time fadeDuration)
{
    std::unique_ptr<VFileMusic> music(new VFileMusic);
    music->stream.open(name);
    music->openFromStream(music->stream);
    music->play();
    setBackgroundMusic(*music.release(), fadeDuration);
}
Example #10
0
void kaeru(void)
{
    int notes1[]={DO,RE,MI,FA,MI,RE,DO,NN,
            MI,FA,SO,RA,SO,FA,MI,NN,
            DO,NN,DO,NN,DO,NN,DO,NN,XX};
    int notes2[]={DO,DO,RE,RE,MI,MI,FA,FA,XX};
    int notes3[]={MI,RE,DO,XX};

    music(notes1,0);

    duration = DURATION/2;
    pause    = PAUSE/2;
    music(notes2,0);

    duration  = DURATION;
    pause     = PAUSE;
    music(notes3,0);
}
Example #11
0
DiaScene::DiaScene(WebSocketServer *ws,
                   JackProcessor *jackP, SceneBuilder *builderP, MonitorIO* monitorIoP, QString name, QJsonObject serialized):
                Scene(name,serialized),WebSocketServerProvider(ws),
                current(-1),fadingTo(-1),fadeTimer(),fusion("fusion"),wss(ws),builder(builderP),
                jack(jackP), monitorIo(monitorIoP), sceneIdCountr(0)
{
    ws->registerProvider(this);
    connect(jack,SIGNAL(musicNotification()),this,SLOT(music()));
}
Example #12
0
void kaeru(void)
{
    int notes[]={DO,RE,MI,FA,MI,RE,DO,NN,
            MI,FA,SO,RA,SO,FA,MI,NN,
            DO,NN,DO,NN,DO,NN,DO,NN,
            DO,DO,RE,RE,MI,MI,FA,FA,MI,NN,RE,NN,DO,XX};

  music(notes);
}
Example #13
0
	pMusic newMusic(const char * filename)
	{
		love::pFile * file = filesystem->getFile( filename , love::FILE_READ);
		pMusic music(new Music(*file));
		if(!music->load())
		{
			std::stringstream err;
			err << "Could not load music \"" << filename << "\".";
			core->error(err.str().c_str());
		}
		delete file; // music has copy of the file at this point.
		return music;
	}
Example #14
0
bool intro_init(int param)
{
	music(0);
	fade.set_full(FADE_OUT);
	
	game.switchstage.mapno = STAGE_KINGS;
	game.switchstage.playerx = 0;
	game.switchstage.playery = 0;
	game.switchstage.eventonentry = 100;
	player->hide = true;
	
	return 0;
}
Example #15
0
/**
 * Show the game introduction
 */
void MortevielleEngine::showIntroduction() {
	_dialogManager->displayIntroScreen(false);
	_dialogManager->checkForF8(142, false);
	if (shouldQuit())
		return;

	_dialogManager->displayIntroFrame2();
	_dialogManager->checkForF8(143, true);
	if (shouldQuit())
		return;

	showTitleScreen();
	music();
	_mixer->stopAll();
}
Example #16
0
void	scene_music(char *s, t_music *m)
{
  int	i, j;
  char	*mus;

  mus = xmalloc(512);
  memset(mus, 0, 512);
  if (!strncmp(s, "music = \"", 9))
    {
      for (j = 0, i = 9 ; s[i] != '"';)
	mus[j++] = s[i++];
      music(mus, m);
    }
  free(mus);
}
Example #17
0
void MainWindow::stopMessage(){
    ui->lcdNumber->display("00:00");
    ui->statusBar->clearMessage();
    ui->statusBar->showMessage("Рассылка закончена",10000);
    msg.setText("Рассылка закончена");
    msg.exec();
    ui->comboBox->setEnabled(true);
    ui->lineEdit->setEnabled(true);
    ui->doubleSpinBox->setEnabled(true);
    ui->actionLogin->setEnabled(true);
    ui->actionStart_messages->setEnabled(true);
    pause_mess=false;
    stop_mess=false;
    play_mess=false;
    music();
}
Example #18
0
// ********************************************************************** main
int main( int argc, char *argv[] )
{
  SND::Player player;
  
  std::cout << "__CREATION SNDPlayer__" << std::endl;

  SND::Piece sound( "data/31304__erdie__imp04.ogg", true );
  SND::Piece music( "../ressources/15-sonic-team-presents.ogg", true );

  sound.inverse();
  music.inverse();

  std::cout << "__PLAY__" << std::endl;
  player.play( music );
  player.play( sound );
  std::cout << "__END__" << std::endl;
  
  return 0;
}
Example #19
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    KAboutData aboutData( "simon-touch", "simon-touch",
    			  ki18n("simon-touch"), "0.1",
    			  ki18n("Voice controlled media center and personal communication portal"),
			  KAboutData::License_GPL,
              ki18n("Copyright (c) 2011-2012 Peter Grasch, Mathias Stieger, Claus Zotter") );

    KCmdLineOptions options;
    options.add("images <folder>", ki18n("Path to images"));
    options.add("music <folder>", ki18n("Path to music"));
    options.add("videos <folder>", ki18n("Path to videos"));
    options.add("feeds <description>", ki18n("RSS feeds to use; Feed format: \"<title 1>,<url 1>,<icon 1>,<group>;<title 2>,...\""));
    options.add("groups <description>", ki18n("RSS feed groups (e.g. different newspapers) to use; format: \"<grouphandle 1>,<groupname 1>,<groupicon 1>;<grouphandle 2>,...\""));
    KCmdLineArgs::addCmdLineOptions(options);
    
    KCmdLineArgs::init(argc, argv, &aboutData);
    KApplication app;

    KGlobal::locale()->insertCatalog("libskype");

    Configuration cfg;

    ImagesModel img(cfg.imagePath());
    MusicModel music(cfg.musicPath());
    VideosModel vids(cfg.videosPath());
    QStringList groups = cfg.groups().split(';');
    QStringList feeds = cfg.feeds().split(';');

    QStringList grouphandles, groupnames, groupicons;
    foreach (const QString& group, groups) {
        QStringList groupdetails = group.split(',');
        if (groupdetails.count() != 3) {
            qWarning() << i18n("RSS feed groups format: \"<grouphandle 1>,<groupname 1>,<groupicon 1>;<grouphandle 2>,...\"");
        return -1;
    }
        grouphandles << groupdetails[0];
        groupnames << groupdetails[1];
        groupicons << groupdetails[2];
    }
Example #20
0
bool arguments::validate( arg_parser& ap )
{               
  if ( bells <= 0 )
    {
      ap.error( "Then number of bells must be positive" );
      return false;
    }

  if ( bells >= int(bell::MAX_BELLS) )
    {
      ap.error( make_string() << "The number of bells must be less than "
                << bell::MAX_BELLS );
      return false;
    }

  if ( in_course && oo_course )
    {
      ap.error( "Cannot use both -i and -o" );
      return false;
    }

  mus = music(bells);
  for ( vector<string>::const_iterator i = musstrs.begin(), e = musstrs.end();
          i != e; ++i ) 
  {
    try 
    {
      size_t first = distance(mus.begin(), mus.end());
      add_scored_music_string( mus, *i );
      size_t last = distance(mus.begin(), mus.end());
      musdets.push_back( make_pair( first, last ) );
    }
    catch ( exception const& e ) {
      ap.error( make_string() << "Error parsing music pattern: " << e.what() );
      return false;
    }
  }

  return true;
}
		/// Make sure delays are combined correctly
		void test_delay_combining()
		{
			this->base.reset(new stream::string());
			this->base << STRING_WITH_NULLS(
				"DBRAWOPL" "\x00\x00\x01\x00"
				"\x37\x03\x01\x00" "\x2f\x00\x00\x00" "\x00\x00\x00\x00"
				"\x20\xae\x40\x7f\x60\xed\x80\xcb\xe0\x06"
				"\x23\xa7\x43\x1f\x63\x65\x83\x43\xe3\x02\xc0\x04"
				"\xa0\x44\xb0\x32"
				"\x00\x0f" "\x00\x0f"
				"\xb0\x12"
				"\x00\x0f" "\x01\x0f\x02"
				"\xb0\x32"
				"\x01\xf0\x80\x01\x05\x80"
				"\xb0\x12"
			);

			// Read the above file
			MusicPtr music(this->pType->read(this->base, this->suppData));
			// Write it out again
			this->base.reset(new stream::string());
			this->pType->write(this->base, this->suppData, music, this->writeFlags);

			// Make sure it matches what we read
			std::string target = STRING_WITH_NULLS(
				"DBRAWOPL" "\x00\x00\x01\x00"
				"\x37\x03\x01\x00" "\x2a\x00\x00\x00" "\x00\x00\x00\x00"
				"\x20\xae\x40\x7f\x60\xed\x80\xcb\xe0\x06"
				"\x23\xa7\x43\x1f\x63\x65\x83\x43\xe3\x02\xc0\x04"
				"\xa0\x44\xb0\x32"
				"\x00\x1f"
				"\xb0\x12"
				"\x01\x1f\x02"
				"\xb0\x32"
				"\x01\xff\xff\x00\xf6"
				"\xb0\x12"
			);
			BOOST_REQUIRE(this->is_content_equal(target));
		}
Example #22
0
void org_test_miniloop(void)
{
uint32_t start = 0, curtime;
uint32_t counter;

	stat("Starting org test");
	
	font_draw(5, 5, "ORG test in progress...", 0, &greenfont);
	font_draw(5, 15, "Logging statistics to nx.log", 0, &greenfont);
	font_draw(5, 25, "Press any button to quit", 0, &greenfont);
	screen->Flip();
	
	music_set_enabled(1);
	music(32);
	
	last_sdl_key = -1;
	
	for(;;)
	{
		org_run();
		
		if (++counter > 1024)
		{
			counter = 0;
			
			curtime = SDL_GetTicks();
			if ((curtime - start) >= 100)
			{
				start = curtime;
				input_poll();
				
				if (last_sdl_key != -1)
					return;
			}
		}
	}
}
		/// Make sure OPL decoder reads the instruments properly
		void test_inst_read()
		{
			// Read the standard file
			MusicPtr music(this->pType->read(this->base, this->suppData));
			// Melodic instrument is handled in default test
			// Rhythm hi-hat
			CHECK_OPL_PATCH(1, m.scaleLevel, 0x1);
			CHECK_OPL_PATCH(1, m.attackRate, 0xD);
			CHECK_OPL_PATCH(1, rhythm, 1);
			// Rhythm top-cymbal
			CHECK_OPL_PATCH(2, c.scaleLevel, 0x1);
			CHECK_OPL_PATCH(2, c.attackRate, 0xC);
			CHECK_OPL_PATCH(2, rhythm, 2);
			// Rhythm tom-tom
			CHECK_OPL_PATCH(3, m.attackRate, 0xB);
			CHECK_OPL_PATCH(3, rhythm, 3);
			// Rhythm snare
			CHECK_OPL_PATCH(4, c.attackRate, 0xA);
			CHECK_OPL_PATCH(4, rhythm, 4);
			// Rhythm bass-drum
			CHECK_OPL_PATCH(5, m.attackRate, 0x9);
			CHECK_OPL_PATCH(5, c.attackRate, 0x8);
			CHECK_OPL_PATCH(5, rhythm, 5);
		}
Example #24
0
static void
diggerdie(struct digger_draw_api *ddap, int n)
{
  int clfirst[TYPES],clcoll[SPRITES],i;
  bool alldead;
  switch (digdat[n].deathstage) {
    case 1:
      if (bagy(digdat[n].deathbag)+6>digdat[n].dob.y)
        digdat[n].dob.y=bagy(digdat[n].deathbag)+6;
      drawdigger(n-curplayer,15,digdat[n].dob.x,digdat[n].dob.y,false);
      incpenalty();
      if (getbagdir(digdat[n].deathbag)+1==0) {
        soundddie();
        digdat[n].deathtime=5;
        digdat[n].deathstage=2;
        digdat[n].deathani=0;
        digdat[n].dob.y-=6;
      }
      break;
    case 2:
      if (digdat[n].deathtime!=0) {
        digdat[n].deathtime--;
        break;
      }
      if (digdat[n].deathani==0)
        music(2);
      drawdigger(n-curplayer,14-digdat[n].deathani,digdat[n].dob.x,digdat[n].dob.y,
                 false);
      for (i=0;i<TYPES;i++)
        clfirst[i]=first[i];
      for (i=0;i<SPRITES;i++)
        clcoll[i]=coll[i];
      incpenalty();
      if (digdat[n].deathani==0 && clfirst[2]!=-1)
        killmonsters(clfirst,clcoll);
      if (digdat[n].deathani<4) {
        digdat[n].deathani++;
        digdat[n].deathtime=2;
      }
      else {
        digdat[n].deathstage=4;
        if (musicflag || diggers>1)
          digdat[n].deathtime=60;
        else
          digdat[n].deathtime=10;
      }
      break;
    case 3:
      digdat[n].deathstage=5;
      digdat[n].deathani=0;
      digdat[n].deathtime=0;
      break;
    case 5:
      if (digdat[n].deathani>=0 && digdat[n].deathani<=6) {
        drawdigger(n-curplayer,15,digdat[n].dob.x,
                   digdat[n].dob.y-deatharc[digdat[n].deathani],false);
        if (digdat[n].deathani==6 && !isalive())
          musicoff();
        incpenalty();
        digdat[n].deathani++;
        if (digdat[n].deathani==1)
          soundddie();
        if (digdat[n].deathani==7) {
          digdat[n].deathtime=5;
          digdat[n].deathani=0;
          digdat[n].deathstage=2;
        }
      }
      break;
    case 4:
      if (digdat[n].deathtime!=0)
        digdat[n].deathtime--;
      else {
        digdat[n].dead=true;
        alldead=true;
        for (i=0;i<diggers;i++)
          if (!digdat[i].dead) {
            alldead=false;
            break;
          }
        if (alldead)
          setdead(true);
        else
          if (isalive() && digdat[n].lives>0) {
            if (!gauntlet)
              digdat[n].lives--;
            drawlives(ddap);
            if (digdat[n].lives>0) {
              digdat[n].v=9;
              digdat[n].mdir=4;
              digdat[n].h=(diggers==1) ? 7 : (8-n*2);
              digdat[n].dob.x=digdat[n].h*20+12;
              digdat[n].dob.dir=(n==0) ? DIR_RIGHT : DIR_LEFT;
              digdat[n].rx=0;
              digdat[n].ry=0;
              digdat[n].bagtime=0;
              digdat[n].dob.alive=true;
              digdat[n].dead=false;
              digdat[n].invin=true;
              digdat[n].ivt=50;
              digdat[n].deathstage=1;
              digdat[n].dob.y=digdat[n].v*18+18;
              erasespr(n+FIRSTDIGGER-curplayer);
              CALL_METHOD(&digdat[n].dob, put);
              digdat[n].notfiring=true;
              digdat[n].emocttime=0;
              digdat[n].firepressed=false;
              digdat[n].bob.expsn=0;
              digdat[n].rechargetime=0;
              digdat[n].emn=0;
              digdat[n].msc=1;
            }
            clearfire(n);
            if (bonusmode)
              music(0);
            else
              music(1);
          }
      }
  }
}
Example #25
0
void
dodigger(struct digger_draw_api *ddap)
{
  int n;
  int16_t tdir;

  newframe();
  if (gauntlet) {
    drawlives(ddap);
    if (cgtime<ftime)
      timeout=true;
    cgtime-=ftime;
  }
  for (n=curplayer;n<diggers+curplayer;n++) {
    if (digdat[n].bob.expsn!=0)
      drawexplosion(n);
    else
      updatefire(ddap, n);
    if (digvisible) {
      if (digdat[n].dob.alive)
        if (digdat[n].bagtime!=0) {
          tdir = digdat[n].dob.dir;
          digdat[n].dob.dir = digdat[n].mdir;
          drawdig(n);
          digdat[n].dob.dir = tdir;
          incpenalty();
          digdat[n].bagtime--;
        }
        else
          updatedigger(ddap, n);
      else
        diggerdie(ddap, n);
    }
    if (digdat[n].emocttime>0)
      digdat[n].emocttime--;
  }
  if (bonusmode && isalive()) {
    if (bonustimeleft!=0) {
      bonustimeleft--;
      if (startbonustimeleft!=0 || bonustimeleft<20) {
        startbonustimeleft--;
        if (bonustimeleft&1) {
          ddap->ginten(0);
          soundbonus();
        }
        else {
          ddap->ginten(1);
          soundbonus();
        }
        if (startbonustimeleft==0) {
          music(0);
          soundbonusoff();
          ddap->ginten(1);
        }
      }
    }
    else {
      endbonusmode(ddap);
      soundbonusoff();
      music(1);
    }
  }
  if (bonusmode && !isalive()) {
    endbonusmode(ddap);
    soundbonusoff();
    music(1);
  }
}
Example #26
0
static void handle_input()
{
    bool button_pressed = false;
#ifdef CONFIG_USE_TAPS
    // tap controls
    {
        int cx = (Graphics::SCREEN_WIDTH / 2) - (sprites[SPR_MENU].w / 2) - 8;
        int cy = (Graphics::SCREEN_HEIGHT / 2) - 8;
        for(int i=0;i<sprites[SPR_MENU].nframes;i++)
        {
            RectI r = Sprites::get_sprite_rect(cx, cy, SPR_MENU, i);
            if (VJoy::ModeAware::wasTap(r))
            {
                if (title.cursel == i)
                {
                    button_pressed = true;
                    
                }
                else
                {
                    sound(SND_MENU_MOVE);
                    title.cursel = i;
                }
                
                break;
            }

            cy += (sprites[SPR_MENU].h + 18);
        }
    }
#endif
    
    // pad control
    {
        if (justpushed(DOWNKEY))
        {
            sound(SND_MENU_MOVE);
            if (++title.cursel >= sprites[SPR_MENU].nframes)
                title.cursel = 0;
        }
        else if (justpushed(UPKEY))
        {
            sound(SND_MENU_MOVE);
            if (--title.cursel < 0)
                title.cursel = sprites[SPR_MENU].nframes - 1;
        }
        
        button_pressed = button_pressed || buttonjustpushed();
	}
    
    
	if (button_pressed)
	{
		sound(SND_MENU_SELECT);
		int choice = title.cursel;
		
		// handle case where user selects Load but there is no savefile,
		// or the last_save_file is deleted.
		if (title.cursel == 1)
		{
			if (!ProfileExists(settings->last_save_slot))
			{
				bool foundslot = false;
				for(int i=0;i<MAX_SAVE_SLOTS;i++)
				{
					if (ProfileExists(i))
					{
						stat("Last save file %d missing. Defaulting to %d instead.", settings->last_save_slot, i);
						settings->last_save_slot = i;
						foundslot = true;
					}
				}
				
				// there are no save files. Start a new game instead.
				if (!foundslot)
				{
					stat("No save files found. Starting new game instead.");
					choice = 0;
				}
			}
		}
		
		if (choice == 1 && settings->multisave)
		{
			title.selchoice = 2;
			title.seldelay = SELECT_MENU_DELAY;
		}
		else
		{
			title.selchoice = choice;
			title.seldelay = SELECT_DELAY;
			music(0);
		}
	}
	
	run_konami_code();
}
Example #27
0
void SystemActions::generateActions(const std::vector<int> & actions)
{
    category()->setText(QCoreApplication::tr("System"));
    actions_.clear();

    std::vector<int> all = actions;
    if (all.size() <= 0)
    {
        all.push_back(ROTATE_SCREEN);
        all.push_back(SCREEN_UPDATE_TYPE);
        all.push_back(MUSIC);
        all.push_back(RETURN_TO_LIBRARY);
    }

    for(int i = 0; i < static_cast<int>(all.size()); ++i)
    {
        switch (all[i])
        {
        case ROTATE_SCREEN:
            {
                shared_ptr<QAction> rotate(new QAction(exclusiveGroup()));
                rotate->setCheckable(true);
                rotate->setText(QCoreApplication::tr("Rotate Screen"));
                rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png")));
                rotate->setData(ROTATE_SCREEN);
                actions_.push_back(rotate);
                break;
            }
        case SCREEN_UPDATE_TYPE:
            {
                // Screen update type.
                shared_ptr<QAction> screen(new QAction(exclusiveGroup()));
                screen->setCheckable(true);
                if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC)
                {
                    screen->setText(QCoreApplication::tr("Full Refresh Off"));
                    screen->setIcon(QIcon(QPixmap(":/images/fast_update.png")));
                }
                else
                {
                    screen->setText(QCoreApplication::tr("Full Refresh On"));
                    screen->setIcon(QIcon(QPixmap(":/images/full_update.png")));
                }
                screen->setData(SCREEN_UPDATE_TYPE);
                actions_.push_back(screen);
                break;
            }
        case FULL_SCREEN:
            {
                shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup()));
                fullScreen->setCheckable(true);
                fullScreen->setText(QCoreApplication::tr("Full Screen"));
                fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png")));
                fullScreen->setData(FULL_SCREEN);
                actions_.push_back(fullScreen);
                break;
            }
        case EXIT_FULL_SCREEN:
            {
                shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup()));
                exitFullScreen->setCheckable(true);
                exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen"));
                exitFullScreen->setIcon(QIcon(QPixmap(
                        ":/images/exit_full_screen.png")));
                exitFullScreen->setData(EXIT_FULL_SCREEN);
                actions_.push_back(exitFullScreen);
                break;
            }
        case MUSIC:
            {
                if (sys::SystemConfig::isMusicPlayerAvailable())
                {
                    // Music.
                    shared_ptr<QAction> music(new QAction(exclusiveGroup()));
                    music->setCheckable(true);
                    music->setText(QCoreApplication::tr("Music"));
                    music->setIcon(QIcon(QPixmap(":/images/music.png")));
                    music->setData(MUSIC);
                    actions_.push_back(music);
                }
                break;
            }
        case RETURN_TO_LIBRARY:
            {
                // Close document.
                shared_ptr<QAction> close(new QAction(exclusiveGroup()));
                close->setCheckable(true);
                close->setText(QCoreApplication::tr("Close"));
                close->setIcon(QIcon(QPixmap(":/images/return_to_library.png")));
                close->setData(RETURN_TO_LIBRARY);
                actions_.push_back(close);
                break;
            }
        }
    }
}
Example #28
0
void funccall::entertainment()
{
	int v;
	struct dostime_t t;
	struct dosdate_t d;
	do
	{
		textbackground(BLUE);
		textcolor(MAGENTA);
		_setcursortype(_NORMALCURSOR);
		clrscr();
		textcolor(GREEN);
		box(4,4,4,4);
		box(4,4,6,6);
		textcolor(GREEN+BLINK);
		gotoxy(11,7);
		cputs("CREEPER");
		delay(502);
		_dos_gettime(&t);
		_dos_getdate(&d);
		box(21,6,52,4,222);
		gotoxy(54,6);
		printf("DATE:%2d/%02d/%02d\n",d.day,d.month,d.year);
		gotoxy(54,7);
		printf("Time:%2d:%02d:%02d.%02d\n",t.hour,t.minute,t.second,t.hsecond);

		gotoxy(25,9);
		textcolor(WHITE);
		cputs(">>> CREEPERTAINMENT >>>");
		textcolor(WHITE);
		gotoxy(2,2);
		cputs(">>>> LETS  TAKE ENTERTAINMENT TO NEXT LEVEL >>>>");
		box(35,10,20,11);
		textcolor(WHITE);
		gotoxy(22,12);
		cputs("1. MUSIC");
		gotoxy(22,14);
		cputs("2. GAMES");
		gotoxy(22,16);
		cputs("0. MAIN MENU");
		gotoxy(25,18);
		cputs("ENTER THE CHOICE NUMBER : ");
		v=int(getche()-48);
		delay(100);
		if(v)
		{ switch(v)
		 {
			case 1:
			      music();
			      break;

			case 2:
			       game();
				break;
			default:

				gotoxy(27,20);
				cputs("INVALID ENTRY");
				delay(1000);
				break;

		 }}
	}while(v!=0);
}
Example #29
0
void App::run() {
    int size = 0, tabSize = 0;
    uint8 *data, *tabData;

    // this font is for the intro
    tabData = File::loadFile("mfnt-0.tab", tabSize);
    data = File::loadFile("mfnt-0.dat", size);
    printf("Loading %d sprites from mfnt-0.dat\n", tabSize / 6);
    intro_font_sprites_.loadSprites(tabData, tabSize, data, true);
    delete[] tabData;
    delete[] data;
    intro_font_.setSpriteManager(&intro_font_sprites_, 1);

    // play intro
    FliPlayer fliPlayer;
    data = File::loadFile("intro.dat", size);
    fliPlayer.loadFliData(data);
    music().playTrack(MusicManager::TRACK_INTRO);
    fliPlayer.play(true);
    music().stopPlayback();
    delete[] data;

    // load palette
    data = File::loadFile("hpal01.dat", size);
    system_->setPalette6b3(data);
    delete[] data;

    // load palette
    setPalette("mselect.pal");

    // load "req"
    // TODO: what's this for?
    data = File::loadFile("hreq.dat", size);
    delete[] data;

    // load mspr-0 sprites
    // TODO: cursor is sprite 63
    tabData = File::loadFile("mspr-0.tab", tabSize);
    data = File::loadFile("mspr-0.dat", size);
    printf("Loading %d sprites from mspr-0.dat\n", tabSize / 6);
    menu_sprites_.loadSprites(tabData, tabSize, data, true);
    delete[] tabData;
    delete[] data;
    fonts_.loadFont(&menu_sprites_, 3, true, 1076, 'A');
    fonts_.loadFont(&menu_sprites_, 2, true, 802, 'A');
    fonts_.loadFont(&menu_sprites_, 1, true, 528, 'A');
    fonts_.loadFont(&menu_sprites_, 0, true, 254, 'A');
    fonts_.loadFont(&menu_sprites_, 3, false, 939, 'A');
    fonts_.loadFont(&menu_sprites_, 2, false, 665, 'A');
    fonts_.loadFont(&menu_sprites_, 1, false, 391, 'A');
    fonts_.loadFont(&menu_sprites_, 0, false, 117, 'A');
    fonts_.loadWidgets(&menu_sprites_);
    game_font_.load();

#if 0
    system_->updateScreen();
    int nx = 0, ny = 0, my = 0;
    for (int i = 0; i < tabSize / 6; i++) {
        Sprite *s = menu_sprites_.sprite(i);
        if (nx + s->width() >= GAME_SCREEN_WIDTH) {
            nx = 0;
            ny += my;
            my = 0;
        }
        if (ny + s->height() > GAME_SCREEN_HEIGHT)
            break;
        s->draw(nx, ny, 0);
        system_->updateScreen();
        nx += s->width();
        if (s->height() > my)
            my = s->height();
    }
    while (1)
        waitForKeyPress();
    exit(1);
#endif

    // load "col01"
    // TODO: what's this for?
    data = File::loadFile("col01.dat", size);
    g_Screen.scale2x(0, 0, 16, 16, data);
    delete[] data;

    // load palette
    setPalette("mselect.pal");

    // play title
    data = File::loadFile("mtitle.dat", size);
    fliPlayer.loadFliData(data);
    fliPlayer.play();
    delete[] data;
    waitForKeyPress();

    // play the groovy menu startup anim
	g_App.gameSounds().sound(Sound::MENU_UP)->play();
    data = File::loadFile("mscrenup.dat", size);
    fliPlayer.loadFliData(data);
    fliPlayer.play();
    delete[] data;

    menus_.createAllMenus();

    int lasttick = SDL_GetTicks();
    while (running_) {
        system_->handleEvents();
        system_->updateScreen();
        int curtick = SDL_GetTicks();
        menus_.handleTick(curtick - lasttick);
        lasttick = curtick;
        system_->delay(1);
    }

#ifdef GP2X
#ifndef WIN32
    // return to the menu
    chdir("/usr/gp2x");
    execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif
#endif
}
Example #30
0
void tyarumera(void)
{
	int notes[]={DO,RE,MI,MI,RE,DO,NN,DO,RE,MI,RE,DO,RE,RE};

	music(notes);
}