Restored ability to hear SIGIL's custom MIDI files and see custom intermission screens

Still working on MP3 soundtrack from SHREDS though.
This commit is contained in:
Tom Kidd 2019-06-09 20:00:01 -05:00
parent a1d4af0f95
commit dc8d87a0da
12 changed files with 120 additions and 31 deletions

View file

@ -35,7 +35,7 @@ And just for fun I did [another article](https://schnapple.com/sigil-for-ios-and
**KNOWN ISSUES WITH SIGIL:**
- As of right now the port can't find the custom level clear screen so the completion screen has a hall of mirrors effect.
- ~~As of right now the port can't find the custom level clear screen so the completion screen has a hall of mirrors effect.~~ *fixed!*
- The port can not play the Buckethead songs from the `SIGIL_SHREDS.wad` file yet.
I will update this README as these things are addressed but I didn't want to let these delay the update.

View file

@ -63,6 +63,7 @@
#if GAME_SIGIL
iphoneIWADSelect("doom.wad");
iphoneClearPWADs();
iphonePWADAdd("SIGIL.wad");
// iphonePWADAdd("SIGIL_SHREDS.wad");
#endif

View file

@ -589,7 +589,7 @@ void iphonePWADRemove( const char* pwad ) {
==================
*/
void iphoneClearPWADs() {
if( doom_pwads ) free(doom_pwads);
//if( doom_pwads ) free(doom_pwads);
doom_pwads = strdup("");
}

View file

@ -772,6 +772,28 @@ int I_RegisterSong(const void *data, size_t len)
return (0);
}
int I_RegisterMusic_MP3( musicinfo_t *song, const void *data, size_t len )
{
FILE *mp3file;
//music->data, W_LumpLength(music->lumpnum)
if (!song) return 1;
if ( len < 32 )
return 0; // the data should at least as big as the MUS header
if ( music_tmp == NULL )
return 0;
mp3file = fopen(music_tmp, "wb");
if ( mp3file == NULL ) {
lprintf(LO_ERROR,"Couldn't write MP3 to %s\n", music_tmp);
return 0;
}
fwrite(data, len, 1, mp3file);
fclose(mp3file);
return I_RegisterMusic(music_tmp, song);
}
// cournia - try to load a music file into SDL_Mixer
// returns true if could not load the file
int I_RegisterMusic( const char* filename, musicinfo_t *song )

View file

@ -663,6 +663,10 @@ void F_Drawer (void)
case 4:
V_DrawNamePatch(0, 0, 0, "ENDPIC", CR_DEFAULT, VPT_STRETCH);
break;
case 5:
// SIGIL
V_DrawNamePatch(0, 0, 0, "SIGILEND", CR_DEFAULT, VPT_STRETCH);
break;
}
}
}

View file

@ -101,6 +101,9 @@ int I_RegisterSong(const void *data, size_t len);
// cournia - tries to load a music file
int I_RegisterMusic( const char* filename, musicinfo_t *music );
// tkidd - fun with mp3
int I_RegisterMusic_MP3( musicinfo_t *song, const void *data, size_t len );
// Called by anything that wishes to start music.
// plays a song, and when the song is done,
// starts playing it again in an endless loop.

View file

@ -383,24 +383,23 @@ void I_Error(const char *error, ...)
}
#endif
// testing something -tkidd
// while( true ) {
// printf( " SAFE EXIT \n" );
// // it's likely our WADs are bad. Wipe them out next time.
// FILE *fp;
// char path[1024];
// char buffer[1024];
// snprintf( path, sizeof( path ), "%s/abandon.ship", SysIphoneGetDocDir() );
// fp = fopen( path, "w" );
// if( ! fp ) {
// printf( "Could not write canary. This is very bad!\n" );
// return;
// }
// snprintf( buffer, sizeof( buffer ), "ABANDON SHIP!\n" );
// fprintf( fp, "%s", buffer );
// fclose(fp);
// assert( false );
// usleep(1000);
// }
while( true ) {
printf( " SAFE EXIT \n" );
// it's likely our WADs are bad. Wipe them out next time.
FILE *fp;
char path[1024];
char buffer[1024];
snprintf( path, sizeof( path ), "%s/abandon.ship", SysIphoneGetDocDir() );
fp = fopen( path, "w" );
if( ! fp ) {
printf( "Could not write canary. This is very bad!\n" );
return;
}
snprintf( buffer, sizeof( buffer ), "ABANDON SHIP!\n" );
fprintf( fp, "%s", buffer );
fclose(fp);
assert( false );
usleep(1000);
}
}

View file

@ -842,8 +842,26 @@ def_bool,ss_none}, // enables translucency
def_str,ss_none,NULL,NULL},
{"mus_dm2ttl", {0,&S_music_files[mus_dm2ttl]}, {0,"dm2ttl.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_dm2int", {0,&S_music_files[mus_dm2int]}, {0,"dm2int.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_dm2int", {0,&S_music_files[mus_dm2int]}, {0,"dm2int.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m1", {0,&S_music_files[mus_e5m1]}, {0,"e5m1.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m2", {0,&S_music_files[mus_e5m2]}, {0,"e5m2.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m3", {0,&S_music_files[mus_e5m3]}, {0,"e5m3.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m4", {0,&S_music_files[mus_e5m4]}, {0,"e5m4.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m5", {0,&S_music_files[mus_e5m5]}, {0,"e5m5.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m6", {0,&S_music_files[mus_e5m6]}, {0,"e5m6.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m7", {0,&S_music_files[mus_e5m7]}, {0,"e5m7.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m8", {0,&S_music_files[mus_e5m8]}, {0,"e5m8.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
{"mus_e5m9", {0,&S_music_files[mus_e5m9]}, {0,"e5m9.mp3"},UL,UL,
def_str,ss_none,NULL,NULL},
};
int numdefaults;

View file

@ -207,10 +207,25 @@ void S_Start(void)
mus_e1m9 // Tim e4m9
};
static const int sigilmus[] = // Song - Who? - Where?
{
mus_e5m1, // Buckethead e5m1
mus_e5m2, // Buckethead e5m2
mus_e5m3, // Buckethead e5m3
mus_e5m4, // Buckethead e5m4
mus_e5m5, // Buckethead e5m5
mus_e5m6, // Buckethead e5m6
mus_e5m7, // Buckethead e5m7
mus_e5m8, // Buckethead e5m8
mus_e5m9 // Buckethead e5m9
};
if (gameepisode < 4)
mnum = mus_e1m1 + (gameepisode-1)*9 + gamemap-1;
else
else if (gameepisode == 4)
mnum = spmus[gamemap-1];
else
mnum = sigilmus[gamemap-1];
}
S_ChangeMusic(mnum, true);
}
@ -553,29 +568,34 @@ void S_ChangeMusic(int musicnum, int looping)
sprintf(namebuf, "d_%s", music->name);
music->lumpnum = W_GetNumForName(namebuf);
}
music_file_failed = 1;
// proff_fs - only load when from IWAD
if (lumpinfo[music->lumpnum].source == source_iwad)
{
//if (lumpinfo[music->lumpnum].source == source_iwad)
// {
// cournia - check to see if we can play a higher quality music file
// rather than the default MIDI
I_FindFile(S_music_files[musicnum], "", music_filename);
I_FindFile(S_music_files[musicnum], "", music_filename);
if ( music_filename[0] != '\0' )
{
music_file_failed = I_RegisterMusic(music_filename, music);
free(music_filename);
//free(music_filename);
}
}
// }
if (music_file_failed)
{
//cournia - could not load music file, play default MIDI music
// load & register it
music->data = W_CacheLumpNum(music->lumpnum);
music->handle = I_RegisterSong(music->data, W_LumpLength(music->lumpnum));
// music_file_failed = I_RegisterMusic_MP3(music, music->data, W_LumpLength(music->lumpnum));
}
// play it

View file

@ -116,6 +116,15 @@ musicinfo_t S_music[] = {
{ "read_m", 0, NULL, 0 },
{ "dm2ttl", 0, NULL, 0 },
{ "dm2int", 0, NULL, 0 },
{ "e5m1", 0, NULL, 0 },
{ "e5m2", 0, NULL, 0 },
{ "e5m3", 0, NULL, 0 },
{ "e5m4", 0, NULL, 0 },
{ "e5m5", 0, NULL, 0 },
{ "e5m6", 0, NULL, 0 },
{ "e5m7", 0, NULL, 0 },
{ "e5m8", 0, NULL, 0 },
{ "e5m9", 0, NULL, 0 },
};

View file

@ -172,6 +172,15 @@ typedef enum {
mus_read_m,
mus_dm2ttl,
mus_dm2int,
mus_e5m1,
mus_e5m2,
mus_e5m3,
mus_e5m4,
mus_e5m5,
mus_e5m6,
mus_e5m7,
mus_e5m8,
mus_e5m9,
NUMMUSIC
} musicenum_t;

View file

@ -415,6 +415,10 @@ static void WI_slamBackground(void)
if (gamemode == commercial || (gamemode == retail && wbs->epsd == 3))
strcpy(name, "INTERPIC");
#ifdef GAME_SIGIL
else if (wbs->epsd == 4)
sprintf(name, "SIGILINT");
#endif
else
sprintf(name, "WIMAP%d", wbs->epsd);