From 69430b7a2ad7ab61b00b1ca2ce465bd7506cfe67 Mon Sep 17 00:00:00 2001 From: Layla Marchant Date: Sat, 26 Dec 2020 13:33:15 -0500 Subject: [PATCH] Added an option to compile a binary that will use the original music. We can't distribute the original music, but adding support for it in as a compile-time option will enable modding the game to look and feel like the original without having to edit the source code. --- configure.ac | 6 ++++++ music/Makefile.am | 1 - src/audio.c | 39 +++++++++++++++++++++++++++++++++++++-- src/game.c | 4 ++++ src/intermission.c | 8 ++++++++ src/mission.c | 4 ++++ src/title.c | 12 ++++++++++++ 7 files changed, 71 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8fa6740..f07c046 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,7 @@ AC_ARG_VAR([SF_WARN], [Set to 1 to enable compiler warnings]) AC_ARG_VAR([SF_SCREEN_WIDTH], [The width of the game window in pixels]) AC_ARG_VAR([SF_SCREEN_HEIGHT], [The height of the game window in pixels]) AC_ARG_VAR([SF_NOFONT], [Set to 1 to manually force the compiler not to include font/Unicode support]) +AC_ARG_VAR([SF_OLD_MUSIC], [Set to 1 to compile for use with the MOD-based music originally packaged with the game by Parallel Realities (note: you must supply said music if you use this option; all files must have the same name and format as distributed with Project: Starfighter 1.1)]) AC_ARG_VAR([SF_RUN_IN_PLACE], [Set to 1 to compile Starfighter to run in-place (instead of installing)]) AS_IF([test -n "$SF_WARN"], [ STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -Wall -Wformat-truncation=0" @@ -84,6 +85,11 @@ AS_IF([test -n "$SF_NOFONT"], [ echo "Font/Unicode support manually disabled" ]) +AS_IF([test -n "$SF_OLD_MUSIC"], [ + STARFIGHTER_CPPFLAGS="$STARFIGHTER_CPPFLAGS -DOLD_MUSIC" + echo "Building for use with old music" +]) + AS_IF([test -n "$SF_RUN_IN_PLACE"], [ echo "Preparing a run-in-place build" ]) diff --git a/music/Makefile.am b/music/Makefile.am index 9984d76..0e04b74 100644 --- a/music/Makefile.am +++ b/music/Makefile.am @@ -17,4 +17,3 @@ nobase_dist_music_DATA = \ space_dimensions.ogg \ through_space.ogg \ walking_among_androids.ogg - diff --git a/src/audio.c b/src/audio.c index b3c0020..3374f5d 100644 --- a/src/audio.c +++ b/src/audio.c @@ -188,25 +188,60 @@ void audio_playRandomTrack() if ((!engine.useMusic) || (!engine.useAudio)) return; +#ifdef OLD_MUSIC + int tracks = 0; + char track[][PATH_MAX] = { + "music/Frantic.mod", "music/Artificial.mod", "music/Lunatic.mod", + "music/ToxicFriend.mod", "music/DigitalInferno.mod", + "music/TempoTrance.mod", "music/IntoTheMachine.mod" + }; + + switch (game.system) + { + case SYSTEM_SPIRIT: + tracks = 3; + break; + case SYSTEM_EYANANTH: + tracks = 5; + break; + case SYSTEM_MORDOR: + case SYSTEM_SOL: + tracks = 7; + break; + default: + tracks = 3; + } +#else int tracks = 4; - char track[][64] = { + char track[][PATH_MAX] = { "music/railjet_short.ogg", "music/space_dimensions.ogg", "music/frozen_jam.ogg", "music/sound_and_silence.ogg" }; +#endif - switch(game.area) + switch (game.area) { +#ifndef OLD_MUSIC case MISN_START: audio_playMusic("music/railjet_short.ogg", -1); break; +#endif case MISN_MOEBO: case MISN_ELAMALE: case MISN_ELLESH: case MISN_EARTH: +#ifdef OLD_MUSIC + audio_playMusic("music/HardTranceDub.mod", -1); +#else audio_playMusic("music/orbital_colossus.ogg", -1); +#endif break; case MISN_VENUS: +#ifdef OLD_MUSIC + audio_playMusic("music/LoopsAndTings.mod", -1); +#else audio_playMusic("music/RE.ogg", -1); +#endif break; default: audio_playMusic(track[rand() % tracks], -1); diff --git a/src/game.c b/src/game.c index 1a8acae..8a06dcf 100644 --- a/src/game.c +++ b/src/game.c @@ -2448,7 +2448,11 @@ static void game_showGameOver() screen_clear(black); SDL_Delay(1000); +#ifdef OLD_MUSIC + audio_playMusic("music/Wybierak.mod", -1); +#else audio_playMusic("music/death.ogg", -1); +#endif int x = (screen->w - gameover->w) / 2; int y = (screen->h - gameover->h) / 2; diff --git a/src/intermission.c b/src/intermission.c index 4b58b70..1bf3e90 100644 --- a/src/intermission.c +++ b/src/intermission.c @@ -1318,7 +1318,11 @@ static void intermission_doOptions(SDL_Surface *optionsSurface, int x, int y) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 92, 45, 22)) { engine.useMusic = 1; +#ifdef OLD_MUSIC + audio_playMusic("music/3DParadise.mod", -1); +#else audio_playMusic("music/through_space.ogg", -1); +#endif } if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 92, 45, 22)) @@ -1500,7 +1504,11 @@ int intermission() } if ((engine.useAudio) && (engine.useMusic)) +#ifdef OLD_MUSIC + audio_playMusic("music/3DParadise.mod", -1); +#else audio_playMusic("music/through_space.ogg", -1); +#endif /// Retain "%s" as-is. It is replaced with the current system name. snprintf(string, STRMAX_SHORT, _("System : %s"), game_systemNames[game.system]); diff --git a/src/mission.c b/src/mission.c index 6cb6fa9..d077b96 100644 --- a/src/mission.c +++ b/src/mission.c @@ -924,7 +924,11 @@ static int mission_revealObjectives() aliens[ALIEN_KLINE].y = player.y; aliens[ALIEN_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE; player_setTarget(ALIEN_KLINE); +#ifdef OLD_MUSIC + audio_playMusic("music/TranceGeneration.mod", -1); +#else audio_playMusic("music/last_cyber_dance.ogg", -1); +#endif } } diff --git a/src/title.c b/src/title.c index 0be1f82..91a6a68 100644 --- a/src/title.c +++ b/src/title.c @@ -313,7 +313,11 @@ int title_show() player_flushInput(); engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0; +#ifdef OLD_MUSIC + audio_playMusic("music/Platinum.mod", 1); +#else audio_playMusic("music/walking_among_androids.ogg", 1); +#endif while (!engine.done) { @@ -510,7 +514,11 @@ int title_show() if (engine.useMusic) { +#ifdef OLD_MUSIC + audio_playMusic("music/Platinum.mod", 1); +#else audio_playMusic("music/walking_among_androids.ogg", 1); +#endif } else { @@ -643,7 +651,11 @@ void title_showCredits() screen_drawBackground(); +#ifdef OLD_MUSIC + audio_playMusic("music/Solace.s3m", 1); +#else audio_playMusic("music/rise_of_spirit.ogg", 1); +#endif fp = fopen("data/credits.txt", "rb");