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:
parent
d806f05a16
commit
ab26edddec
Binary file not shown.
Binary file not shown.
28
src/audio.c
28
src/audio.c
|
@ -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 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));
|
||||
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));
|
||||
|
||||
if ((!engine.useSound) || (!engine.useAudio) || (volume <= 0))
|
||||
|
@ -179,14 +179,14 @@ void audio_setMusicPosition(double position)
|
|||
#endif
|
||||
}
|
||||
|
||||
void audio_playMusic(const char *filename, int loops, int amplified)
|
||||
void audio_playMusic(const char *filename, int loops)
|
||||
{
|
||||
#ifndef NOSOUND
|
||||
if (engine.useMusic && engine.useAudio)
|
||||
{
|
||||
audio_haltMusic();
|
||||
music = Mix_LoadMUS(filename);
|
||||
audio_setMusicVolume(amplified ? MIX_MAX_VOLUME : MIX_MAX_VOLUME / 4);
|
||||
audio_setMusicVolume(MIX_MAX_VOLUME);
|
||||
Mix_PlayMusic(music, loops);
|
||||
}
|
||||
#endif
|
||||
|
@ -236,13 +236,13 @@ void audio_playRandomTrack()
|
|||
case MISN_INTERCEPTION:
|
||||
if ((aliens[ALIEN_KLINE].classDef == CD_KLINE)
|
||||
&& 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)
|
||||
&& (aliens[ALIEN_BOSS].classDef == CD_CLOAKFIGHTER)
|
||||
&& aliens[ALIEN_BOSS].active)
|
||||
audio_playMusic("music/space_dimensions.ogg", -1, 0);
|
||||
audio_playMusic("music/space_dimensions.ogg", -1);
|
||||
else
|
||||
audio_playMusic("music/railjet_short.ogg", -1, 0);
|
||||
audio_playMusic("music/railjet_short.ogg", -1);
|
||||
break;
|
||||
case MISN_HAIL:
|
||||
case MISN_JOLDAR:
|
||||
|
@ -250,7 +250,7 @@ void audio_playRandomTrack()
|
|||
case MISN_SIVEDI:
|
||||
case MISN_NEPTUNE:
|
||||
case MISN_SATURN:
|
||||
audio_playMusic("music/frozen_jam.ogg", -1, 0);
|
||||
audio_playMusic("music/frozen_jam.ogg", -1);
|
||||
break;
|
||||
case MISN_CERADSE:
|
||||
case MISN_ALLEZ:
|
||||
|
@ -258,7 +258,7 @@ void audio_playRandomTrack()
|
|||
case MISN_FELLON:
|
||||
case MISN_POSWIC:
|
||||
case MISN_MARS:
|
||||
audio_playMusic("music/sound_and_silence.ogg", -1, 0);
|
||||
audio_playMusic("music/sound_and_silence.ogg", -1);
|
||||
break;
|
||||
case MISN_HINSTAG:
|
||||
case MISN_NEROD:
|
||||
|
@ -267,7 +267,7 @@ void audio_playRandomTrack()
|
|||
case MISN_PLUTO:
|
||||
case MISN_URANUS:
|
||||
case MISN_JUPITER:
|
||||
audio_playMusic("music/space_dimensions.ogg", -1, 0);
|
||||
audio_playMusic("music/space_dimensions.ogg", -1);
|
||||
break;
|
||||
#endif
|
||||
case MISN_MOEBO:
|
||||
|
@ -275,20 +275,20 @@ void audio_playRandomTrack()
|
|||
case MISN_ELLESH:
|
||||
case MISN_EARTH:
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/HardTranceDub.mod", -1, 0);
|
||||
audio_playMusic("music/HardTranceDub.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/orbital_colossus.ogg", -1, 0);
|
||||
audio_playMusic("music/orbital_colossus.ogg", -1);
|
||||
#endif
|
||||
break;
|
||||
case MISN_VENUS:
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/LoopsAndTings.mod", -1, 0);
|
||||
audio_playMusic("music/LoopsAndTings.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/androids_last_dance.ogg", -1, 0);
|
||||
audio_playMusic("music/androids_last_dance.ogg", -1);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
audio_playMusic(track[rand() % tracks], -1, 0);
|
||||
audio_playMusic(track[rand() % tracks], -1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void audio_pauseMusic();
|
|||
void audio_resumeMusic();
|
||||
void audio_setMusicVolume(int volume);
|
||||
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_free();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Engine engine;
|
|||
|
||||
void engine_init()
|
||||
{
|
||||
engine.musicVolume = 100;
|
||||
engine.musicVolume = MIX_MAX_VOLUME;
|
||||
engine.useAudio = 1;
|
||||
|
||||
engine.maxAliens = 9;
|
||||
|
|
14
src/game.c
14
src/game.c
|
@ -24,6 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
#ifndef NOSOUND
|
||||
#include "SDL_mixer.h"
|
||||
#endif
|
||||
|
||||
#include "colors.h"
|
||||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
@ -2449,9 +2453,9 @@ static void game_showGameOver()
|
|||
SDL_Delay(1000);
|
||||
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/Wybierak.mod", -1, 0);
|
||||
audio_playMusic("music/Wybierak.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/reremix.ogg", -1, 1);
|
||||
audio_playMusic("music/reremix.ogg", -1);
|
||||
#endif
|
||||
|
||||
int x = (screen->w - gameover->w) / 2;
|
||||
|
@ -2685,7 +2689,7 @@ int game_mainLoop()
|
|||
engine.counter2 = (SDL_GetTicks() + 1000);
|
||||
|
||||
engine.missionCompleteTimer = 0;
|
||||
engine.musicVolume = 100;
|
||||
engine.musicVolume = MIX_MAX_VOLUME;
|
||||
|
||||
int rtn = 0;
|
||||
|
||||
|
@ -2793,7 +2797,7 @@ int game_mainLoop()
|
|||
engine.keyState[KEY_ALTFIRE] = 0;
|
||||
engine.xaxis = 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);
|
||||
}
|
||||
else
|
||||
|
@ -2809,7 +2813,7 @@ int game_mainLoop()
|
|||
else
|
||||
{
|
||||
player_getInput();
|
||||
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
|
||||
LIMIT_ADD(engine.musicVolume, -0.2, 0, MIX_MAX_VOLUME);
|
||||
audio_setMusicVolume(engine.musicVolume);
|
||||
if (SDL_GetTicks() >= engine.missionCompleteTimer)
|
||||
{
|
||||
|
|
|
@ -1319,9 +1319,9 @@ static void intermission_doOptions(SDL_Surface *optionsSurface, int x, int y)
|
|||
{
|
||||
engine.useMusic = 1;
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/3DParadise.mod", -1, 0);
|
||||
audio_playMusic("music/3DParadise.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/through_space.ogg", -1, 0);
|
||||
audio_playMusic("music/through_space.ogg", -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1505,9 +1505,9 @@ int intermission()
|
|||
|
||||
if ((engine.useAudio) && (engine.useMusic))
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/3DParadise.mod", -1, 0);
|
||||
audio_playMusic("music/3DParadise.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/through_space.ogg", -1, 0);
|
||||
audio_playMusic("music/through_space.ogg", -1);
|
||||
#endif
|
||||
|
||||
/// Retain "%s" as-is. It is replaced with the current system name.
|
||||
|
|
|
@ -925,9 +925,9 @@ static int mission_revealObjectives()
|
|||
aliens[ALIEN_KLINE].flags |= FL_IMMORTAL | FL_NOFIRE;
|
||||
player_setTarget(ALIEN_KLINE);
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/TranceGeneration.mod", -1, 0);
|
||||
audio_playMusic("music/TranceGeneration.mod", -1);
|
||||
#else
|
||||
audio_playMusic("music/last_cyber_dance.ogg", -1, 0);
|
||||
audio_playMusic("music/last_cyber_dance.ogg", -1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
12
src/title.c
12
src/title.c
|
@ -316,9 +316,9 @@ int title_show()
|
|||
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
|
||||
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/Platinum.mod", 1, 0);
|
||||
audio_playMusic("music/Platinum.mod", 1);
|
||||
#else
|
||||
audio_playMusic("music/android_oppression.ogg", 1, 1);
|
||||
audio_playMusic("music/android_oppression.ogg", 1);
|
||||
#endif
|
||||
|
||||
while (!engine.done)
|
||||
|
@ -522,9 +522,9 @@ int title_show()
|
|||
if (engine.useMusic)
|
||||
{
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/Platinum.mod", 1, 0);
|
||||
audio_playMusic("music/Platinum.mod", 1);
|
||||
#else
|
||||
audio_playMusic("music/android_oppression.ogg", 1, 1);
|
||||
audio_playMusic("music/android_oppression.ogg", 1);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -659,9 +659,9 @@ void title_showCredits()
|
|||
screen_drawBackground();
|
||||
|
||||
#ifdef OLD_MUSIC
|
||||
audio_playMusic("music/Solace.s3m", 1, 0);
|
||||
audio_playMusic("music/Solace.s3m", 1);
|
||||
#else
|
||||
audio_playMusic("music/rise_of_spirit.ogg", 1, 0);
|
||||
audio_playMusic("music/rise_of_spirit.ogg", 1);
|
||||
#endif
|
||||
|
||||
fp = fopen("data/credits.txt", "rb");
|
||||
|
|
Loading…
Reference in New Issue