Removed the whole volume compensation thing since it caused bugs.

Also adjusted Android Oppression to match the volumes of the other
tracks.
This commit is contained in:
Layla Marchant 2021-07-26 00:34:47 -04:00
parent d806f05a16
commit ab26edddec
No known key found for this signature in database
GPG Key ID: 52FB5C20A8336782
9 changed files with 37 additions and 33 deletions

Binary file not shown.

View File

@ -67,7 +67,7 @@ void audio_playSound(int sid, float x, float y)
int angle = atanf((x - (screen->w / 2)) / (screen->w / 2)) * 180 / M_PI; int angle = atanf((x - (screen->w / 2)) / (screen->w / 2)) * 180 / M_PI;
int attenuation = fabsf(x - (screen->w / 2)) / (screen->w / 20); int attenuation = fabsf(x - (screen->w / 2)) / (screen->w / 20);
float distance = sqrtf(powf(fabsf(x - (screen->w / 2)), 2) + powf(fabsf(y - (screen->h / 2)), 2)); float distance = sqrtf(powf(fabsf(x - (screen->w / 2)), 2) + powf(fabsf(y - (screen->h / 2)), 2));
const int max_volume = MIX_MAX_VOLUME / 4; const int max_volume = MIX_MAX_VOLUME;
int volume = max_volume - (max_volume * distance / (3 * screen->w)); int volume = max_volume - (max_volume * distance / (3 * screen->w));
if ((!engine.useSound) || (!engine.useAudio) || (volume <= 0)) if ((!engine.useSound) || (!engine.useAudio) || (volume <= 0))
@ -179,14 +179,14 @@ void audio_setMusicPosition(double position)
#endif #endif
} }
void audio_playMusic(const char *filename, int loops, int amplified) void audio_playMusic(const char *filename, int loops)
{ {
#ifndef NOSOUND #ifndef NOSOUND
if (engine.useMusic && engine.useAudio) if (engine.useMusic && engine.useAudio)
{ {
audio_haltMusic(); audio_haltMusic();
music = Mix_LoadMUS(filename); music = Mix_LoadMUS(filename);
audio_setMusicVolume(amplified ? MIX_MAX_VOLUME : MIX_MAX_VOLUME / 4); audio_setMusicVolume(MIX_MAX_VOLUME);
Mix_PlayMusic(music, loops); Mix_PlayMusic(music, loops);
} }
#endif #endif
@ -236,13 +236,13 @@ void audio_playRandomTrack()
case MISN_INTERCEPTION: case MISN_INTERCEPTION:
if ((aliens[ALIEN_KLINE].classDef == CD_KLINE) if ((aliens[ALIEN_KLINE].classDef == CD_KLINE)
&& aliens[ALIEN_KLINE].active) && aliens[ALIEN_KLINE].active)
audio_playMusic("music/last_cyber_dance.ogg", -1, 0); audio_playMusic("music/last_cyber_dance.ogg", -1);
else if ((game.system == SYSTEM_MORDOR) else if ((game.system == SYSTEM_MORDOR)
&& (aliens[ALIEN_BOSS].classDef == CD_CLOAKFIGHTER) && (aliens[ALIEN_BOSS].classDef == CD_CLOAKFIGHTER)
&& aliens[ALIEN_BOSS].active) && aliens[ALIEN_BOSS].active)
audio_playMusic("music/space_dimensions.ogg", -1, 0); audio_playMusic("music/space_dimensions.ogg", -1);
else else
audio_playMusic("music/railjet_short.ogg", -1, 0); audio_playMusic("music/railjet_short.ogg", -1);
break; break;
case MISN_HAIL: case MISN_HAIL:
case MISN_JOLDAR: case MISN_JOLDAR:
@ -250,7 +250,7 @@ void audio_playRandomTrack()
case MISN_SIVEDI: case MISN_SIVEDI:
case MISN_NEPTUNE: case MISN_NEPTUNE:
case MISN_SATURN: case MISN_SATURN:
audio_playMusic("music/frozen_jam.ogg", -1, 0); audio_playMusic("music/frozen_jam.ogg", -1);
break; break;
case MISN_CERADSE: case MISN_CERADSE:
case MISN_ALLEZ: case MISN_ALLEZ:
@ -258,7 +258,7 @@ void audio_playRandomTrack()
case MISN_FELLON: case MISN_FELLON:
case MISN_POSWIC: case MISN_POSWIC:
case MISN_MARS: case MISN_MARS:
audio_playMusic("music/sound_and_silence.ogg", -1, 0); audio_playMusic("music/sound_and_silence.ogg", -1);
break; break;
case MISN_HINSTAG: case MISN_HINSTAG:
case MISN_NEROD: case MISN_NEROD:
@ -267,7 +267,7 @@ void audio_playRandomTrack()
case MISN_PLUTO: case MISN_PLUTO:
case MISN_URANUS: case MISN_URANUS:
case MISN_JUPITER: case MISN_JUPITER:
audio_playMusic("music/space_dimensions.ogg", -1, 0); audio_playMusic("music/space_dimensions.ogg", -1);
break; break;
#endif #endif
case MISN_MOEBO: case MISN_MOEBO:
@ -275,20 +275,20 @@ void audio_playRandomTrack()
case MISN_ELLESH: case MISN_ELLESH:
case MISN_EARTH: case MISN_EARTH:
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/HardTranceDub.mod", -1, 0); audio_playMusic("music/HardTranceDub.mod", -1);
#else #else
audio_playMusic("music/orbital_colossus.ogg", -1, 0); audio_playMusic("music/orbital_colossus.ogg", -1);
#endif #endif
break; break;
case MISN_VENUS: case MISN_VENUS:
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/LoopsAndTings.mod", -1, 0); audio_playMusic("music/LoopsAndTings.mod", -1);
#else #else
audio_playMusic("music/androids_last_dance.ogg", -1, 0); audio_playMusic("music/androids_last_dance.ogg", -1);
#endif #endif
break; break;
default: default:
audio_playMusic(track[rand() % tracks], -1, 0); audio_playMusic(track[rand() % tracks], -1);
} }
#endif #endif
} }

View File

@ -30,7 +30,7 @@ void audio_pauseMusic();
void audio_resumeMusic(); void audio_resumeMusic();
void audio_setMusicVolume(int volume); void audio_setMusicVolume(int volume);
void audio_setMusicPosition(double position); void audio_setMusicPosition(double position);
void audio_playMusic(const char *filename, int loops, int amplified); void audio_playMusic(const char *filename, int loops);
void audio_playRandomTrack(); void audio_playRandomTrack();
void audio_free(); void audio_free();

View File

@ -56,7 +56,7 @@ Engine engine;
void engine_init() void engine_init()
{ {
engine.musicVolume = 100; engine.musicVolume = MIX_MAX_VOLUME;
engine.useAudio = 1; engine.useAudio = 1;
engine.maxAliens = 9; engine.maxAliens = 9;

View File

@ -24,6 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "SDL.h" #include "SDL.h"
#ifndef NOSOUND
#include "SDL_mixer.h"
#endif
#include "colors.h" #include "colors.h"
#include "defs.h" #include "defs.h"
#include "structs.h" #include "structs.h"
@ -2449,9 +2453,9 @@ static void game_showGameOver()
SDL_Delay(1000); SDL_Delay(1000);
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/Wybierak.mod", -1, 0); audio_playMusic("music/Wybierak.mod", -1);
#else #else
audio_playMusic("music/reremix.ogg", -1, 1); audio_playMusic("music/reremix.ogg", -1);
#endif #endif
int x = (screen->w - gameover->w) / 2; int x = (screen->w - gameover->w) / 2;
@ -2685,7 +2689,7 @@ int game_mainLoop()
engine.counter2 = (SDL_GetTicks() + 1000); engine.counter2 = (SDL_GetTicks() + 1000);
engine.missionCompleteTimer = 0; engine.missionCompleteTimer = 0;
engine.musicVolume = 100; engine.musicVolume = MIX_MAX_VOLUME;
int rtn = 0; int rtn = 0;
@ -2793,7 +2797,7 @@ int game_mainLoop()
engine.keyState[KEY_ALTFIRE] = 0; engine.keyState[KEY_ALTFIRE] = 0;
engine.xaxis = 0; engine.xaxis = 0;
engine.yaxis = 0; engine.yaxis = 0;
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100); LIMIT_ADD(engine.musicVolume, -0.2, 0, MIX_MAX_VOLUME);
audio_setMusicVolume(engine.musicVolume); audio_setMusicVolume(engine.musicVolume);
} }
else else
@ -2809,7 +2813,7 @@ int game_mainLoop()
else else
{ {
player_getInput(); player_getInput();
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100); LIMIT_ADD(engine.musicVolume, -0.2, 0, MIX_MAX_VOLUME);
audio_setMusicVolume(engine.musicVolume); audio_setMusicVolume(engine.musicVolume);
if (SDL_GetTicks() >= engine.missionCompleteTimer) if (SDL_GetTicks() >= engine.missionCompleteTimer)
{ {

View File

@ -1319,9 +1319,9 @@ static void intermission_doOptions(SDL_Surface *optionsSurface, int x, int y)
{ {
engine.useMusic = 1; engine.useMusic = 1;
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/3DParadise.mod", -1, 0); audio_playMusic("music/3DParadise.mod", -1);
#else #else
audio_playMusic("music/through_space.ogg", -1, 0); audio_playMusic("music/through_space.ogg", -1);
#endif #endif
} }
@ -1505,9 +1505,9 @@ int intermission()
if ((engine.useAudio) && (engine.useMusic)) if ((engine.useAudio) && (engine.useMusic))
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/3DParadise.mod", -1, 0); audio_playMusic("music/3DParadise.mod", -1);
#else #else
audio_playMusic("music/through_space.ogg", -1, 0); audio_playMusic("music/through_space.ogg", -1);
#endif #endif
/// Retain "%s" as-is. It is replaced with the current system name. /// Retain "%s" as-is. It is replaced with the current system name.

View File

@ -925,9 +925,9 @@ static int mission_revealObjectives()
aliens[ALIEN_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE; aliens[ALIEN_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE;
player_setTarget(ALIEN_KLINE); player_setTarget(ALIEN_KLINE);
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/TranceGeneration.mod", -1, 0); audio_playMusic("music/TranceGeneration.mod", -1);
#else #else
audio_playMusic("music/last_cyber_dance.ogg", -1, 0); audio_playMusic("music/last_cyber_dance.ogg", -1);
#endif #endif
} }
} }

View File

@ -316,9 +316,9 @@ int title_show()
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0; engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/Platinum.mod", 1, 0); audio_playMusic("music/Platinum.mod", 1);
#else #else
audio_playMusic("music/android_oppression.ogg", 1, 1); audio_playMusic("music/android_oppression.ogg", 1);
#endif #endif
while (!engine.done) while (!engine.done)
@ -522,9 +522,9 @@ int title_show()
if (engine.useMusic) if (engine.useMusic)
{ {
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/Platinum.mod", 1, 0); audio_playMusic("music/Platinum.mod", 1);
#else #else
audio_playMusic("music/android_oppression.ogg", 1, 1); audio_playMusic("music/android_oppression.ogg", 1);
#endif #endif
} }
else else
@ -659,9 +659,9 @@ void title_showCredits()
screen_drawBackground(); screen_drawBackground();
#ifdef OLD_MUSIC #ifdef OLD_MUSIC
audio_playMusic("music/Solace.s3m", 1, 0); audio_playMusic("music/Solace.s3m", 1);
#else #else
audio_playMusic("music/rise_of_spirit.ogg", 1, 0); audio_playMusic("music/rise_of_spirit.ogg", 1);
#endif #endif
fp = fopen("data/credits.txt", "rb"); fp = fopen("data/credits.txt", "rb");