Ejemplo n.º 1
0
void CA_LoadAllSounds()
{
	int start, i;

	if (w0 == true || w1 == true){
		for (start = STARTADLIBSOUNDSWL6, i = 0; i < NUMSOUNDSWL6; i++, start++)
			CA_CacheAudioChunk(start);
		} else {
		for (start = STARTADLIBSOUNDSSOD, i = 0; i < NUMSOUNDSSOD; i++, start++)
			CA_CacheAudioChunk(start);
		}
}
Ejemplo n.º 2
0
//-------------------------------------------------------------------------
// StartMusic()
//		o preload = true, music is cached but not started
//-------------------------------------------------------------------------
void StartMusic(boolean preload)
{
	musicnames	musicchunk;

	SD_MusicOff();
#if IN_DEVELOPMENT || GAME_VERSION != SHAREWARE_VERSION || TECH_SUPPORT_VERSION
	if (gamestate.flags & GS_MUSIC_TEST)
		musicchunk=static_cast<musicnames>(music_num);
	else
#endif
	if (playstate==ex_victorious)
		musicchunk = FORTRESS_MUS;
	else
		musicchunk = static_cast<musicnames>(songs[gamestate.mapon+gamestate.episode*MAPS_PER_EPISODE]);

	if (!audiosegs[STARTMUSIC+musicchunk])
	{
		CA_CacheAudioChunk(static_cast<Sint16>(STARTMUSIC + musicchunk));
	}

	{
		if (!preload)
        ::SD_StartMusic(musicchunk);
	}
}
Ejemplo n.º 3
0
// JAB - Cache & start the appropriate music for this level
void StartMusic(void)
{
	musicnames	chunk;

	SD_MusicOff();
	chunk =	TOOHOT_MUS;
//	if ((chunk == -1) || (MusicMode != smm_AdLib))
//DEBUG control panel		return;

	MM_BombOnError (false);
	CA_CacheAudioChunk(STARTMUSIC + chunk);
	MM_BombOnError (true);
	if (mmerror)
		mmerror = false;
	else
	{
		MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),true);
		SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + chunk]);
	}
}
Ejemplo n.º 4
0
void StartMusic(void)
{
	musicnames	chunk;

	SD_MusicOff();
	chunk = songs[gamestate.mapon+gamestate.episode*10];

//	if ((chunk == -1) || (MusicMode != smm_AdLib))
//DEBUG control panel		return;

	MM_BombOnError (False);
	CA_CacheAudioChunk(STARTMUSIC + chunk);
	MM_BombOnError (True);
	if (mmerror)
		mmerror = False;
	else
	{
		MM_SetLock(&((memptr)audiosegs[STARTMUSIC + chunk]),True);
		SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
	}
}
Ejemplo n.º 5
0
void SD_ContinueMusic(int chunk, int startoffs)
{
   SD_MusicOff();

   if (MusicMode == SMM_ADLIB)
   {
      unsigned i;
      int32_t chunkLen = CA_CacheAudioChunk(chunk);
      sqHack = (word *)(void *) audiosegs[chunk];     /* alignment is correct */
      if((word)Retro_SwapLES16(*sqHack) == 0)
         sqHackLen = sqHackSeqLen = chunkLen;
      else
         sqHackLen = sqHackSeqLen = (word)Retro_SwapLES16(*sqHack++);
      sqHackPtr = sqHack;

      if(startoffs >= sqHackLen)
      {
         Quit("SD_StartMusic: Illegal startoffs provided!");
      }

      /* fast forward to correct position
       * (needed to reconstruct the instruments). */

      for(i = 0; i < startoffs; i += 2)
      {
         byte reg = *(byte *)sqHackPtr;
         byte val = *(((byte *)sqHackPtr) + 1);
         if(reg >= 0xb1 && reg <= 0xb8) val &= 0xdf;           /* disable play note flag */
         else if(reg == 0xbd) val &= 0xe0;                     /* disable drum flags */

         YM3812Write(0, reg,val);
         sqHackPtr += 2;
         sqHackLen -= 4;
      }
      sqHackTime = 0;
      alTimeCount = 0;

      SD_MusicOn();
   }
}
Ejemplo n.º 6
0
/*
-----------------------------------------------------------------------------
 Function: CA_SaveAudioChunk() -Decode and save audio data.
 
 Parameters: chunk -[in] Chunk number to cache.
			 filename -[in] Save as filename.
			 BuffChunk -[in] Sound data to decode.
			 BuffWav -[in] Allocated memory block to hold decoded data.
 
 Returns: Nothing.
 
 Notes: 
-----------------------------------------------------------------------------
*/
PRIVATE void CA_SaveAudioChunk( W32 chunk, const char *filename,
				  W8 *BuffChunk, W8 *BuffWav )
{     
	W32 length;

	if( ! filename || ! *filename )
	{
	   return;	
	}

	if( ! CA_CacheAudioChunk( chunk, BuffChunk ) )
	{
		return;
	}

	if( ADLIB_DecodeSound( (AdLibSound *)BuffChunk, BuffWav, &length ) == 0 )
	{
	   return;
    }	

	write_wav( filename, BuffWav, length, 1, 22050, 2  );
}
Ejemplo n.º 7
0
///////////////////////////////////////////////////////////////////////////
//
//      SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(int chunk)
{
   SD_MusicOff();

   switch (MusicMode)
   {
      case SMM_ADLIB:
         {
            int32_t chunkLen = CA_CacheAudioChunk(chunk);
            sqHack = (word *)(void *) audiosegs[chunk];     /* alignment is correct */
            if ( (word)Retro_SwapLES16(*sqHack) == 0)
               sqHackLen = sqHackSeqLen = chunkLen;
            else
               sqHackLen = sqHackSeqLen = (word)Retro_SwapLES16(*sqHack++);
            sqHackPtr    = sqHack;
            sqHackTime   = 0;
            alTimeCount  = 0;
            SD_MusicOn();
         }
         break;
      default:
         break;
   }
}
Ejemplo n.º 8
0
//------------------------------------------------------------------------
// PreDemo()
//------------------------------------------------------------------------
void PreDemo()
{
#if !SKIP_TITLE_AND_CREDITS
#if TECH_SUPPORT_VERSION

	fontnumber=4;
	SETFONTCOLOR(0,15*3);
	CenterWindow (26,7);
	US_Print(EnterBetaCode);
	VW_UpdateScreen();
	CA_LoadAllSounds();
	PM_CheckMainMem();
	SD_PlaySound(INFORMDEATH2SND);		// Nooooo!
	IN_UserInput(TickBase*20);
	ClearMemory();

#elif BETA_TEST

	boolean param=false;

	for (i=1; i<g_argc; i++)
		switch (US_CheckParm(g_argv[i],MainStrs))
		{
			case 13:
				param=true;
			break;
		}

	if (!param)
	{
		char buffer[15] = {0};

		fontnumber=4;
		CenterWindow (26,7);
		US_Print(EnterBetaCode);
		VW_UpdateScreen();
		SETFONTCOLOR(0,15*3);
		US_LineInput(24*8,92,buffer,buffer,true,14,100);
		if (_fstricmp(buffer,bc_buffer))
			Quit("Bad beta code!");
	}
#endif



#if GAME_VERSION == SHAREWARE_VERSION
#if IN_DEVELOPMENT || GEORGE_CHEAT
	if (!MS_CheckParm("nochex"))
#endif
	{
#if  (!SKIP_CHECKSUMS)
//	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM,"LEVELS");
	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM);
#endif
	}
#else
#if  (!SKIP_CHECKSUMS)
	if (ChecksumFile("FILE_ID.DIZ",0) != DIZFILE_CHECKSUM)
		gamestate.flags |= GS_BAD_DIZ_FILE;
#endif
#endif

	VL_SetPaletteIntensity(0,255,vgapal,0);

	if (!(gamestate.flags & GS_NOWAIT))
	{
#if (0)				// GAME_VERSION != SHAREWARE_VERSION
//---------------------
// Anti-piracy screen
//---------------------
	// Cache pic
	//
		CA_CacheScreen(PIRACYPIC);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(PIRACYPALETTE);
		VL_SetPalette (0,256,grsegs[PIRACYPALETTE]);
		VL_SetPaletteIntensity(0,255,grsegs[PIRACYPALETTE],0);
		VW_UpdateScreen();

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VL_FadeIn(0,255,grsegs[PIRACYPALETTE],30);

	// Wait a little
	//
		IN_UserInput(TickBase*20);

	// Free palette
	//
		UNCACHEGRCHUNK(PIRACYPALETTE);

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VW_FadeOut();

	// Cleanup screen for upcoming SetPalette call
	//
		{
		Uint16 old_bufferofs=bufferofs;

		bufferofs=displayofs;
		VL_Bar(0,0,320,200,0);
		bufferofs=old_bufferofs;
		}
#endif

//---------------------
// Apogee presents
//---------------------
        // ISG --> this fixes intro timing
        IN_UserInput(TickBase*1);
        
	// Cache pic
	//
		CA_CacheScreen(APOGEEPIC);

	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+APOGFNFM_MUS);

        ::SD_StartMusic(APOGFNFM_MUS);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(APOGEEPALETTE);
		VL_SetPalette (0,256,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]));
		VL_SetPaletteIntensity(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),0);
		VW_UpdateScreen();
    
		VL_FadeOut (0, 255, 25, 29, 53, 20);
		VL_FadeIn(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),30);

	// Wait for end of fanfare
	//
		if (MusicMode==smm_AdLib)
		{
			IN_StartAck();
			while ((!sqPlayedOnce) && (!IN_CheckAck()));
      }
		else
			IN_UserInput(TickBase*6);

		SD_MusicOff();

	// Free palette and music.  AND  Restore palette
	//
		UNCACHEGRCHUNK(APOGEEPALETTE);

        delete [] audiosegs[STARTMUSIC + APOGFNFM_MUS];
        audiosegs[STARTMUSIC + APOGFNFM_MUS] = NULL;

      // Do A Blue Flash!

      VL_FadeOut (0, 255, 25, 29, 53, 20);
      VL_FadeOut (0, 255, 0, 	0,  0,  30);

//---------------------
// JAM logo intro
//---------------------
	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
        ::SD_StartMusic(TITLE_LOOP_MUSIC);

	// Show JAM logo
	//
		if (!DoMovie(mv_intro,0))
			MAIN_ERROR(PREDEMO_NOJAM);

		if (PowerBall)
      {
      	Sint16 i;

			for (i=0;i<60 && (!DebugOk);i++)
   	   {
      		VL_WaitVBL(1);

            // BBi
            ::in_handle_events();

				if (Keyboard[sc_left_shift] && Keyboard[sc_right_shift])
		      {
					CA_LoadAllSounds();

					SD_MusicOff();

                   ::sd_play_player_sound(SHOOTDOORSND, bstone::AC_ITEM);

		         SD_WaitSoundDone();

				   ClearMemory();
		      	DebugOk = 1;

					CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
                    ::SD_StartMusic(TITLE_LOOP_MUSIC);
      		}
         }
      }

//---------------------
// PC-13
//---------------------
		VL_Bar(0,0,320,200,0x14);
		CacheDrawPic(0,64,PC13PIC);
		VW_UpdateScreen();
		VW_FadeIn();
		IN_UserInput(TickBase*2);

      // Do A Red Flash!

      VL_FadeOut (0, 255, 39, 0, 0, 20);
		VW_FadeOut();
	}
#endif // SKIP_TITLE_AND_CREDITS
}