Exemplo n.º 1
0
void al_resume_duh(AL_DUH_PLAYER *dp)
{
	if (dp && dp->sigrenderer && !(dp->flags & ADP_PLAYING)) {
		voice_start(dp->stream->voice);
		dp->flags |= ADP_PLAYING;
	}
}
Exemplo n.º 2
0
Arquivo: snd.cpp Projeto: wziard/miner
void try_sample_backwards(int sample_index, int x, int y, int volume, int priority, int freq)
{
    if (!snd_data)
       return;

    SAMPLE *s = (SAMPLE *)(snd_data[sample_index].dat);
    int voice = allocate_voice(s);

    if (!playfield->visible(x,y))
    {
      volume /= 2;
      priority /= 2;
    }
    
    if (voice >=0)
    {
         voice_set_volume(voice,volume);
         voice_set_priority(voice,priority);
         voice_set_frequency(voice, voice_get_frequency(voice) * freq / 1000);
         voice_set_playmode(voice, PLAYMODE_BACKWARD);
         voice_start(voice);
         release_voice(voice);
    }


}
Exemplo n.º 3
0
Arquivo: snd.cpp Projeto: wziard/miner
void try_loop(short *voice, int sample_index, int x, int y, int volume, int priority, int freq)
{
    if (!snd_data)
       return;

    SAMPLE *s = (SAMPLE *)(snd_data[sample_index].dat);

    if (*voice <0)
    {
        *voice = allocate_voice(s);
         if (*voice >= 0)
         {
            voice_start(*voice);
            voice_set_frequency(*voice, voice_get_frequency(*voice) * freq / 1000);
         }
    }

    if (playfield && !playfield->visible(x,y))
    {
      volume /= 2;
      priority /= 2;
    }
    
    if (*voice >=0)
    {
         voice_set_volume(*voice,volume);
         voice_set_priority(*voice,priority);
         voice_set_playmode(*voice, PLAYMODE_LOOP);
    }

}
Exemplo n.º 4
0
void sa_unpause_sound(void)
{
  int i;
  pause_sound	   = 0;
   for( i = 0; i < NUMVOICES; i++ ){
     if (playing[i])
       voice_start( hVoice[i] );
   }
}
Exemplo n.º 5
0
void SOUNDCLIP::resume() {
    if (state_ != SoundClipPaused) { return; }

    int voice = get_voice();
    if (voice >= 0) {
        voice_start(voice);
        state_ = SoundClipPlaying;
    }
}
Exemplo n.º 6
0
void resume_mod (void)
{
    int index;

    mi.forbid = TRUE;
    mi.pause = FALSE;
    for (index=0; index<(mi.max_chn); index++)
        {
        if (voice_get_position (voice_table[index]) >=0)
            voice_start (voice_table[index]);
        }

    mi.forbid = FALSE;
}
Exemplo n.º 7
0
// plays an sfx sample
void sfx(int index,int pan,bool loop, bool restart)
{
    if(!sfx_init(index))
        return;
        
    voice_set_playmode(sfx_voice[index],loop?PLAYMODE_LOOP:PLAYMODE_PLAY);
    voice_set_pan(sfx_voice[index],pan);
    
    int pos = voice_get_position(sfx_voice[index]);
    
    if(restart) voice_set_position(sfx_voice[index],0);
    
    if(pos<=0)
        voice_start(sfx_voice[index]);
}
Exemplo n.º 8
0
void _apeg_audio_set_speed_multiple(APEG_LAYER *layer, float multiple)
{
	if(layer->audio.stream)
	{
		int newfreq = (float)layer->stream.audio.freq * multiple;
		int voice = layer->audio.voice;

		if(newfreq > 0)
		{
			voice_set_frequency(voice, newfreq);
			voice_start(voice);
		}
		else
			voice_stop(voice);
	}
}
Exemplo n.º 9
0
// start it (in loop mode) if it's not already playing,
// otherwise adjust it to play in loop mode -DD
void cont_sfx(int index)
{
    if(!sfx_init(index))
    {
        return;
    }
    
    if(voice_get_position(sfx_voice[index])<=0)
    {
        voice_set_position(sfx_voice[index],0);
        voice_set_playmode(sfx_voice[index],PLAYMODE_LOOP);
        voice_start(sfx_voice[index]);
    }
    else
    {
        adjust_sfx(index, 128, true);
    }
}
Exemplo n.º 10
0
bool JamulSoundPlay(int voice, long pan, long vol, byte playFlags)
{
	// if this copy is in use, can't play it
	if (voice_get_position(voice) > 0)
	{
		if (playFlags & SOUND_CUTOFF)
		{
			voice_set_position(voice, 0);
			// keep going to handle the rest of the stuff
		}
		else
			return FALSE; // can't play if it's playing
	}

	// set the pan and volume and start the voice
	voice_set_volume(voice, vol);
	voice_set_pan(voice, pan);
	voice_start(voice);

	return TRUE;
}
void cSoundPlayer::playSound(SAMPLE *sample, int pan, int vol) {
	if (maximumVoices < 0) return;

	assert(sample);
	if (vol < 0) return;
	assert(pan >= 0 && pan < 256);
	assert(vol > 0 && vol <= 256);

	// allocate voice
	int voice = allocate_voice(sample);

	if (voice != -1) {
		voice_set_playmode(voice,0);
		voice_set_volume(voice, vol);
		voice_set_pan(voice, pan);
		voice_start(voice);
		for (int i = 0; i < maximumVoices; i++) {
			if (voices[i] == -1) {
				voices[i] = voice;
				break;
			}
		}
	}
}
Exemplo n.º 12
0
int _apeg_audio_flush(APEG_LAYER *layer)
{
	unsigned char *buf = layer->audio.pcm.samples;
	unsigned char *data;
	int hs;
	int ret = APEG_OK;

	if(layer->audio.pcm.point < layer->audio.bufsize)
	{
		int count = layer->audio.pcm.point / 2;
		int samplesend = layer->audio.bufsize / 2;

		while(count < samplesend)
			((short*)buf)[count++] = 0x8000;

		if(layer->audio.pcm.point == 0)
			ret = APEG_EOF;
	}

	if(layer->audio.callback)
	{
		if(ret != APEG_OK)
			return ret;

		ret = layer->audio.callback((APEG_STREAM*)layer, buf,
		                            layer->audio.pcm.point,
		                            layer->audio.callback_arg);
		if(ret < 0)
			return APEG_ERROR;

		if(ret > 0)
		{
			layer->audio.pos += ret / 2 / layer->stream.audio.channels;
			layer->audio.pcm.point -= ret;
			if(layer->audio.pcm.point > 0)
				memmove(buf, buf+ret, layer->audio.pcm.point);
			layer->stream.audio.flushed = TRUE;

			if(!(layer->stream.flags&APEG_HAS_VIDEO))
				layer->stream.pos = (double)layer->audio.pos /
				                    (double)layer->stream.audio.freq;
		}

		return APEG_OK;
	}

	/* We need to test the stream buffer to see if it's ready for more audio
	 * yet.
	 */
	hs = layer->audio.stream->len/2;
	if((layer->audio.buf_segment &&
	    voice_get_position(layer->audio.voice) >= hs) ||
	   (!layer->audio.buf_segment &&
	    voice_get_position(layer->audio.voice) < hs))
		return ret;

	voice_stop(layer->audio.voice);
	data  = layer->audio.stream->data;
	data += layer->audio.buf_segment * hs * layer->stream.audio.channels * 2;

	/* Commit the buffer to the stream and update the time */
	memcpy(data, buf, layer->audio.bufsize);

	voice_start(layer->audio.voice);
	layer->audio.buf_segment ^= 1;

	layer->audio.pos += ((layer->audio.pcm.point >= layer->audio.bufsize) ?
	                     layer->audio.samples_per_update :
	                     (layer->audio.pcm.point/2/layer->stream.audio.channels));
	if(!(layer->stream.flags&APEG_HAS_VIDEO))
		layer->stream.pos = (double)layer->audio.pos /
		                    (double)layer->stream.audio.freq;

	/* Remove the old data and put the unused samples at the beginning */
	layer->audio.pcm.point -= layer->audio.bufsize;
	if(layer->audio.pcm.point > 0)
		memmove(buf, buf+layer->audio.bufsize, layer->audio.pcm.point);
	else if(layer->audio.pcm.point < 0)
		layer->audio.pcm.point = 0;

	layer->stream.audio.flushed = TRUE;

	return ret;
}
Exemplo n.º 13
0
int osd_start_audio_stream(int stereo)
{
#ifdef USE_SEAL
	int channel;
#endif

	if (stereo) stereo = 1;	/* make sure it's either 0 or 1 */

	stream_cache_stereo = stereo;

	/* determine the number of samples per frame */
	samples_per_frame = (double)Machine->sample_rate / (double)Machine->drv->frames_per_second;

	/* compute how many samples to generate this frame */
	samples_left_over = samples_per_frame;
	samples_this_frame = (UINT32)samples_left_over;
	samples_left_over -= (double)samples_this_frame;

	audio_buffer_length = NUM_BUFFERS * samples_per_frame + 20;


	if (Machine->sample_rate == 0) return 0;

#ifdef USE_SEAL
	for (channel = 0;channel <= stereo;channel++)
	{
		if (ACreateAudioVoice(&hVoice[channel]) != AUDIO_ERROR_NONE)
			return 0;

		if ((lpWave[channel] = (LPAUDIOWAVE)malloc(sizeof(AUDIOWAVE))) == 0)
		{
			ADestroyAudioVoice(hVoice[channel]);
			return 0;
		}

		lpWave[channel]->wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
		lpWave[channel]->nSampleRate = nominal_sample_rate;
		lpWave[channel]->dwLength = 2*audio_buffer_length;
		lpWave[channel]->dwLoopStart = 0;
		lpWave[channel]->dwLoopEnd = lpWave[channel]->dwLength;
		if (ACreateAudioData(lpWave[channel]) != AUDIO_ERROR_NONE)
		{
			free(lpWave[channel]);
			lpWave[channel] = 0;

			return 0;
		}

		memset(lpWave[channel]->lpData,0,lpWave[channel]->dwLength);
		APrimeVoice(hVoice[channel],lpWave[channel]);
		ASetVoiceFrequency(hVoice[channel],nominal_sample_rate);
	}

	if (stereo)
	{
		/* SEAL doubles volume for panned channels, so we have to compensate */
		ASetVoiceVolume(hVoice[0],32);
		ASetVoiceVolume(hVoice[1],32);

		ASetVoicePanning(hVoice[0],0);
		ASetVoicePanning(hVoice[1],255);

		AStartVoice(hVoice[0]);
		AStartVoice(hVoice[1]);
	}
	else
	{
		ASetVoiceVolume(hVoice[0],64);
		ASetVoicePanning(hVoice[0],128);
		AStartVoice(hVoice[0]);
	}
#endif

#ifdef USE_ALLEGRO
	mysample = create_sample(16,stereo,nominal_sample_rate,audio_buffer_length);
	if (mysample == 0) return 0;
	myvoice = allocate_voice(mysample);
	voice_set_playmode(myvoice,PLAYMODE_LOOP);
	if (stereo)
	{
		INT16 *buf = mysample->data;
		int p = 0;
		while (p != audio_buffer_length)
		{
			buf[2*p] = (INT16)0x8000;
			buf[2*p+1] = (INT16)0x8000;
			p++;
		}
	}
	else
	{
		INT16 *buf = mysample->data;
		int p = 0;
		while (p != audio_buffer_length)
		{
			buf[p] = (INT16)0x8000;
			p++;
		}
	}
	voice_start(myvoice);
#endif

	stream_playing = 1;
	voice_pos = 0;

	return samples_this_frame;
}
Exemplo n.º 14
0
int install_mod(int max_chn)
{
    int index;
    int temp=0;

    if (mod_init == TRUE)      // don't need to initialize many times
        return 1;

    register_datafile_jgmod();

    if ( (max_chn > MAX_ALLEG_VOICE) || (max_chn <= 0) )
        return -1;

    if (fake_sample == null)
        fake_sample = (SAMPLE *)jgmod_calloc (sizeof (SAMPLE));     // use to trick allegro
                                                    // into giving me voice
    if (fake_sample == null)                        // channels
        {
        sprintf (jgmod_error, "Unable to setup initialization sample");
        return -1;
        }

    fake_sample->freq = 1000;
    fake_sample->loop_start = 0;
    fake_sample->loop_end = 0;
    fake_sample->priority = JGMOD_PRIORITY;

    #ifdef ALLEGRO_DATE         // for compatibility with Allegro 3.0
    fake_sample->stereo = FALSE;
    #endif

    fake_sample->bits = 8;
    fake_sample->len  = 0;
    fake_sample->param = -1;
    fake_sample->data = jgmod_calloc (0);

    if (fake_sample->data == null)
        {
        sprintf (jgmod_error, "JGMOD : Not enough memory to setup initialization sample");
        free (fake_sample);
        return -1;
        }

    for (index=0; index<max_chn; index++)    //allocate all the voices
        {
        voice_table[index] = allocate_voice (fake_sample);
        if (voice_table[index] == -1)
            temp = -1;
        else
            {
            ci[index].volume = 0;
            voice_set_volume (voice_table[index], 0);
            voice_start (voice_table[index]);
            }
        }
    
    if (temp == -1)
        {
        for (index=0; index<max_chn; index++)
            if (voice_table[index] != -1)
                {
                deallocate_voice (voice_table[index]);
                voice_table[index] = -1;
                }

        sprintf (jgmod_error, "JGMOD : Unable to allocate enough voices");
        return -1;
        }

    mi.max_chn = max_chn;
    mi.is_playing = FALSE;
    mi.speed_ratio = 100;
    mi.pitch_ratio = 100;
    mod_init = TRUE;

    atexit (remove_mod);
    lock_jgmod_player();    // lock functions and variables in player.c
    lock_jgmod_player2();   // in player2.c
    lock_jgmod_player3();   // in player3.c
    lock_jgmod_player4();   // in player4.c
    lock_jgmod_mod();       // and mod.c

    return 1;
}
Exemplo n.º 15
0
void UnpauseAnimation(struct Animation *Anim)
{
   if (Anim->SkateVoice >= 0)
      voice_start(Anim->SkateVoice);
}
Exemplo n.º 16
0
static int allegro_write(SWORD *pbuf, size_t nr)
{
    static int counter;
    unsigned int i, count;
    /*unsigned int write_size;*/

    counter++;

    /* XXX: Assumes `nr' is multiple of `fragment_size'.  This is always the
       case with the current implementation.  */
    count = nr / (fragment_size / sizeof(SWORD));

    /* Write one fragment at a time.  FIXME: This could be faster.  */
    for (i = 0; i < count; i++, pbuf += fragment_size / sizeof(SWORD)) {
        if (!been_suspended) {
            unsigned int write_end;

            /* XXX: We do not use module here because we assume we always write
               full fragments.  */
            write_end = buffer_offset + fragment_size - 1;

            /* Block if we are at the position the soundcard is playing.
               Notice that we also assume that the part of the buffer we are
               going to lock is small enough to fit in the safe space.  */
            while (1) {
                unsigned int pos = sizeof(SWORD) * voice_get_position(voice);
                unsigned int pos2 = pos + fragment_size;

                if (pos2 < buffer_len) {
                    if (buffer_offset >= pos2 || write_end < pos)
                        break;
                } else {
                    pos2 -= buffer_len;
                    if (write_end < pos && buffer_offset >= pos2)
                        break;
                }
            }
        }

        /* Write fragment.  */
	{
	    unsigned int j;
	    WORD *p = (WORD *) (buffer->data + buffer_offset);

            /* XXX: Maybe the SID engine could already produce samples in
               unsigned format as we need them here?  */
	    for (j = 0; j < fragment_size / sizeof(SWORD); j++)
	        p[j] = pbuf[j] + 0x8000;
	}

	buffer_offset += fragment_size;
        if (buffer_offset >= buffer_len)
            buffer_offset = 0;

	if (been_suspended) {
	    been_suspended = 0;
	    voice_set_position(voice, 0);
	    voice_start(voice);
	}
    }

    written_samples += nr;
    if (written_samples > buffer_len)
        written_samples = buffer_len;

    return 0;
}
Exemplo n.º 17
0
void saPlayBufferedStreamedSampleBase( int channel, signed char *data, int len, int freq, int volume, int bits , int pan ){
  /* This version works at low level, creating a sample, and following its
     advancement directly in the voice_position... */
  int i;
  short *dout;
  short *dfin;
  signed short *din;
  //fprintf(stderr,"saPlayBuffer %d freq %d bits %d pan %d len %d\n",channel,freq,bits,pan,len);
  if( audio_sample_rate == 0 || channel >= NUMVOICES )	return;
  if( SndMachine == NULL )  return;
  if( !playing[channel] ){
#ifdef USE_COMPENS
    int fin = stream_buffer_max * freq * 2 / fps;
#else
    int fin = stream_buffer_max * len;
#endif
    if( lpWave[channel] ){
      destroy_sample( lpWave[channel] );
      lpWave[channel] = 0;
    }

    if (!(lpWave[channel] = create_sample(16,0,freq,fin/2))){
      lpWave[channel] = 0;
      return;
    }

    //	  memset( lpWave[channel]->data, 0, fin );
    dout=lpWave[channel]->data;
    dfin=(short*) (((char*)lpWave[channel]->data)+fin);
    // Fill the buffer with 0 (signed) in case the soundcards reads what
    // is after the sample...
    while (dout < dfin)
      *(dout++) = 0x8000;
    vend[channel] = dfin;
    counter[channel] = 0;

    hVoice[channel] = allocate_voice( lpWave[channel] );
    if (hVoice[channel]<0) {
      allegro_message("allocate_voice failed !\n");
      exit(1);
    }

    voice_set_playmode(hVoice[channel],PLAYMODE_LOOP);

    playing[channel] = 1;	/* use front surface */

    init_mixing_buff(len);

    /**** make sound temp. buffer ****/
    if (enh_stereo && SamplePan[channel] == PAN_LEFT)
      dout=(short*) (((char*)lpWave[channel]->data)+len*(MODEB_UPDATE_COUNT+1)); //+len*MODEB_UPDATE_COUNT);
    else
      dout=(short*) (((char*)lpWave[channel]->data)+len*MODEB_UPDATE_COUNT); //+len*MODEB_UPDATE_COUNT);
    din = ((signed short*)data);
    //	      memcpy( dout, din, len );
    for (i=0; i<len; i+=2){
      *(dout++) = *(din++)^0x8000;
    }

    update_recording(channel,data);

    if (dout ==dfin){
      dout=(short*) (((char*)lpWave[channel]->data));
    }
#ifdef DUMP_CHANNELS
    fwrite( lpWave[channel]->data+len*MODEB_UPDATE_COUNT, 1, len, stream_out[channel]);
#endif

    vout[channel] = dout;
    saSetVolume(channel,SampleVol[channel]);
    saSetPan(channel,SamplePan[channel]);
    voice_set_position(hVoice[channel],0);
    voice_start(hVoice[channel]);
    pos_counter[channel] = 0;
  } else{
    int pos = voice_get_position(hVoice[channel]);
    int th_pos;
    int count = (enh_stereo && SamplePan[channel] == PAN_LEFT ?
		 MODEB_UPDATE_COUNT + 1 : MODEB_UPDATE_COUNT);

    // this difference between the theorical position and the actual
    // position is because clearly the reported position is directly
    // dependant of when the sound driver updated the voice for the
    // last time. Luckily the difference is big only when the voice
    // starts. After starting it gets more or less updated when it
    // should, depending on external factors too like the cpu load.

    dout=vout[channel];
    th_pos = (dout - ((INT16 *)lpWave[channel]->data)-
	      count*len/2);
    if (th_pos < 0) th_pos += stream_buffer_max * len/2;

    // if there is more than count frames between pos and th_pos, then
    // wait for the voice.
    if (pos < th_pos) {
      if (th_pos - pos < count * len/2) {
	more_stream = -1; // drop next frame
      }
    }
    din = ((signed short*)data);
    dfin = vend[channel];
    //	  memcpy(dout,din,len);

    for (i=0; i<len; i+=2){
      *(dout++) = *(din++)^0x8000;
    }
    update_recording(channel,data);
    if (dout >=dfin){
      dout=(short*) (((char*)lpWave[channel]->data));

    }

#ifdef DUMP_CHANNELS

    fwrite( lpWave[channel]->data+len*s_pos, 1, len, stream_out[channel]);
#endif
    vout[channel] = dout;

    // more than count frames of advance : more stream !
    pos -= count*len/2;
    if (pos > th_pos && pos > 0) {
      // send more
      more_stream = 1;
    }
  }
}
void Cinematic1()
{
    const char Storylines[]="Once upon a time, there was a team of talented developers called Sharp-Vision.\n" \
                            "They were asked to make a video game, but a game like NO OTHER.\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "They started a brainstorming to get the perfect idea,\n" \
                            "and finally decided to go with a fight game.\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "They started the development, and SUDDENLY!\n" \
                            "somethings went wrong with the code...\n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            " \n" \
                            "THE MACHINE HAS SWALLOWED THEM INSIDE!!!";

    char buffer[100];
    int i,imageindex=0,timer,shaking=15;
    float xrand=0.5,yrand=0.5,TextY=100,TextSpeed=-0.025;
    IMAGE *powerups[39],*meeting[6],*swallow[2],*focuspoint,*storytext;
    int laser,laserboom;

    laser=AddVoice("Resources/Sounds/Laser.wav",1);
    laserboom=AddVoice("Resources/Sounds/Laserboom.wav",1);
    Dramatic=AddVoice("Resources/Sounds/Dramatic.wav",0);
    voice_set_playmode(Dramatic, PLAYMODE_LOOP);

    for(i=0; i<39; i++)
    {
        sprintf(buffer,"Resources/Images/Arcade/Powerup2/powerup00%.2d.png",i+1);
        powerups[i]=load_image(buffer);
    }
    for(i=0; i<6; i++)
    {
        sprintf(buffer,"Resources/Images/Arcade/%.2d.png",i+1);
        meeting[i]=load_image(buffer);
    }
    swallow[0]=load_image("Resources/Images/Arcade/swallow.png");
    swallow[1]=load_image("Resources/Images/Arcade/swallow2.png");
    focuspoint=load_image("Resources/Images/Arcade/focuspoint.png");

    glClear(GL_COLOR_BUFFER_BIT);
    draw_text(SFTransRobotics,Storylines,4.9,50,0,CENTER_X,100);
    PrintScreen(1);
    glClear(GL_COLOR_BUFFER_BIT);
    i=0;
    timer=FrameCount;
    voice_start(Dramatic);
    while( (FrameCount-timer <8*FPS) && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,100);
        draw_image_ex(meeting[0],5,5,90,0,NONE,i);
        if(FrameCount%2==0)
        {
            i++;
        }
        TextY+=TextSpeed;
        next_frame();
    }
    i=0;
    timer=FrameCount;
    while(TextY>40 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,100);
        if(i<100) draw_image_ex(meeting[imageindex],5,5,90,0,NONE,100);
        draw_image_ex(meeting[((imageindex+1)%5)+1],5,5,90,0,NONE,i);
        i+=3;

        if(FrameCount-timer >4*FPS)
        {
            timer=FrameCount;
            imageindex=((imageindex+1)%5)+1;
            i=0;
        }
        TextY+=TextSpeed;
        next_frame();
    }
    i=300;
    while(i>-150 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(screenimage,0,TextY,100,0,NONE,i-100);
        draw_image_ex(meeting[((imageindex+1)%5)+1],5,5,90,0,NONE,i);

        i-=3;
        next_frame();
    }
    i=0;
    timer=FrameCount;
    voice_ramp_volume(Dramatic,500,128);
    voice_start(laser);
    while((FrameCount-timer <3*FPS) && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,i++);
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%shaking==0)shaking=Max(shaking-1,3);

        next_frame();
    }
    i=0;
    while(i<34 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,100);
        draw_image_ex(powerups[i],xrand+10,yrand,80,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,100);

        if(FrameCount%7==0) i++;
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%5==0)shaking=Max(shaking-1,2);
        if(i==28) voice_start(laserboom);

        next_frame();
    }
    voice_ramp_volume(laser,500,0);

    while(i<39 && !close_button_pressed && !IsKeyPressed(3,RETURN) && !IsKeyPressed(3,ENTER))
    {
        draw_image_ex(swallow[0],xrand-1,yrand-1,102,0,NONE,((float)(38-i)/5.0f)*100);
        draw_image_ex(powerups[i],xrand+10,yrand,80,0,NONE,100);
        draw_image_ex(swallow[1],xrand-1,yrand-1,102,0,NONE,((float)(38-i)/5.0f)*100);

        if(FrameCount%7==0) i++;
        if(FrameCount%shaking==0)xrand*=-1;
        if(FrameCount%(shaking*2)==0) yrand*=-1;
        if(FrameCount%5==0)shaking=Max(shaking-1,1);

        next_frame();
    }
}
Exemplo n.º 19
0
// resumes all paused voices
void resume_all_sfx()
{
    for(int i=0; i<WAV_COUNT; i++)
        if(sfx_voice[i]!=-1)
            voice_start(sfx_voice[i]);
}
Exemplo n.º 20
0
// resumes a voice
void resume_sfx(int index)
{
    if(index>0 && index<WAV_COUNT && sfx_voice[index]!=-1)
        voice_start(sfx_voice[index]);
}