Difference for main/piggy.c from version 1.2 to 1.3


version 1.2 version 1.3
Line 19
 
Line 19
  * Functions for managing the pig files.   * Functions for managing the pig files.
  *    *
  * $Log$   * $Log$
    * Revision 1.3  1999/11/15 10:44:42  sekmu
    * added calls to altsound.c for loading new sounds
    *
  * Revision 1.2  1999/10/07 22:40:29  donut   * Revision 1.2  1999/10/07 22:40:29  donut
  * shareware fixes   * shareware fixes
  *   *
Line 378
 
Line 381
 #include "newmenu.h"  #include "newmenu.h"
 #include "custom.h"  #include "custom.h"
   
   //added 11/13/99 by Victor Rachels for alternate sounds
   #include "altsound.h"
   //end this section addition - VR
   
 int piggy_is_substitutable_bitmap( char * name, char * subst_name );  int piggy_is_substitutable_bitmap( char * name, char * subst_name );
   
 //#define NO_DUMP_SOUNDS 1 //if set, dump bitmaps but not sounds  //#define NO_DUMP_SOUNDS 1 //if set, dump bitmaps but not sounds
Line 544
 
Line 551
  strncpy( AllSounds[Num_sound_files].name, name, 12 );   strncpy( AllSounds[Num_sound_files].name, name, 12 );
  hashtable_insert( &AllDigiSndNames, AllSounds[Num_sound_files].name, Num_sound_files );   hashtable_insert( &AllDigiSndNames, AllSounds[Num_sound_files].name, Num_sound_files );
  GameSounds[Num_sound_files] = *snd;   GameSounds[Num_sound_files] = *snd;
   
   //added/moved on 11/13/99 by Victor Rachels to ready for changing freq
   //#ifdef ALLEGRO
           GameSounds[Num_sound_files].bits = snd->bits;
           GameSounds[Num_sound_files].freq = snd->freq;
   
 #ifdef ALLEGRO  #ifdef ALLEGRO
  GameSounds[Num_sound_files].bits = 8;  //end this section move - VR
  GameSounds[Num_sound_files].freq = 11025;  
  GameSounds[Num_sound_files].priority = 128;   GameSounds[Num_sound_files].priority = 128;
  GameSounds[Num_sound_files].loop_start = 0;   GameSounds[Num_sound_files].loop_start = 0;
  GameSounds[Num_sound_files].loop_end = GameSounds[Num_sound_files].len;   GameSounds[Num_sound_files].loop_end = GameSounds[Num_sound_files].len;
Line 650
 
Line 662
 #endif  #endif
  GameSounds[i].data = NULL;   GameSounds[i].data = NULL;
  SoundOffset[i] = 0;   SoundOffset[i] = 0;
   
   //added on 11/13/99 by Victor Rachels to ready for changing freq
                   GameSounds[i].bits = 0;
                   GameSounds[i].freq = 0;
   //end this section addition - VR
  }   }
   
  for (i=0; i<MAX_BITMAP_FILES; i++ ) {   for (i=0; i<MAX_BITMAP_FILES; i++ ) {
Line 677
 
Line 694
         bogus_sound.length = 64*64;          bogus_sound.length = 64*64;
 #endif  #endif
  bogus_sound.data = bogus_data;   bogus_sound.data = bogus_data;
   //added on 11/13/99 by Victor Rachels to ready for changing freq
                   bogus_sound.freq = 11025;
                   bogus_sound.bits = 8;
   //end this section addition - VR
  GameBitmapOffset[0] = 0;   GameBitmapOffset[0] = 0;
  }   }
   
Line 763
 
Line 784
  }   }
   
  for (i=0; i<N_sounds; i++ ) {   for (i=0; i<N_sounds; i++ ) {
   //added on 11/13/99 by Victor Rachels to add alt soundfiles
                  if(use_alt_sounds && use_alt_sound(i))
                   {
                    char *altfname;
                     altfname = load_alt_sound_info(i,&temp_sound);
                     piggy_register_sound(&temp_sound,altfname,1);
                     SoundOffset[Num_sound_files] = 0;
   #ifdef ALLEGRO
                     sbytes += temp_sound.len;
   #else
                     sbytes += temp_sound.length;
   #endif
                   }
                  else
                   {
  cfread( &sndh, sizeof(DiskSoundHeader), 1, Piggy_fp );   cfread( &sndh, sizeof(DiskSoundHeader), 1, Piggy_fp );
   
  //size -= sizeof(DiskSoundHeader);   //size -= sizeof(DiskSoundHeader);
 #ifdef ALLEGRO  #ifdef ALLEGRO
  temp_sound.len = sndh.length;   temp_sound.len = sndh.length;
 #else  #else
  temp_sound.length = sndh.length;   temp_sound.length = sndh.length;
 #endif  #endif
   
   //added on 11/13/99 by Victor Rachels to ready for changing freq
                   temp_sound.bits = 8;
                   temp_sound.freq = 11025;
   //end this section addition - VR
  temp_sound.data = (ubyte *)(sndh.offset + header_size + (sizeof(int)*2)+Pigdata_start);   temp_sound.data = (ubyte *)(sndh.offset + header_size + (sizeof(int)*2)+Pigdata_start);
  SoundOffset[Num_sound_files] = sndh.offset + header_size + (sizeof(int)*2)+Pigdata_start;   SoundOffset[Num_sound_files] = sndh.offset + header_size + (sizeof(int)*2)+Pigdata_start;
 #ifdef SHAREWARE  #ifdef SHAREWARE
Line 780
 
Line 822
  piggy_register_sound( &temp_sound, temp_name_read, 1 );   piggy_register_sound( &temp_sound, temp_name_read, 1 );
                 sbytes += sndh.length;                  sbytes += sndh.length;
  //mprintf(( 0, "%d bytes of sound\n", sbytes ));   //mprintf(( 0, "%d bytes of sound\n", sbytes ));
   
                   } // - VR - link to alt sound stuff
  }   }
   
  SoundBits = malloc( sbytes + 16 );   SoundBits = malloc( sbytes + 16 );
Line 844
 
Line 888
  for (i=0; i<Num_sound_files; i++ ) {   for (i=0; i<Num_sound_files; i++ ) {
  digi_sound *snd = &GameSounds[i];   digi_sound *snd = &GameSounds[i];
   
  if ( SoundOffset[i] > 0 ) {  //added on 11/13/99 by Victor Rachels to use alternate sounds
                   if ( use_alt_sounds && use_alt_sound(i) )
                    {
                      snd->data = ptr;
                      load_alt_sound(i,snd);
                       #ifdef ALLEGRO
                         ptr += snd->len;
                         sbytes += snd->len;
                       #else
                         ptr += snd->length;
                         sbytes += snd->length;
                       #endif
                    }
                   else if ( SoundOffset[i] > 0 )       {
   //end this section addition - VR
  if ( piggy_is_needed(i) ) {   if ( piggy_is_needed(i) ) {
  cfseek( Piggy_fp, SoundOffset[i], SEEK_SET );   cfseek( Piggy_fp, SoundOffset[i], SEEK_SET );
    

Legend:
line(s) removed in v.1.2 
line(s) changed
 line(s) added in v.1.3