Sound effect management

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 559d2b1752
commit bfc5015c03
  1. 43
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. BIN
      assets/gameover.wav

@ -725,11 +725,12 @@ public:
int WALK_STEPS=0; int WALK_STEPS=0;
int PETRIFY_TURNS=0; int PETRIFY_TURNS=0;
int LAST_FRAME_SOUND_PLAYED=0; int LAST_FRAME_SOUND_PLAYED=0;
bool queueBGMPlayback=false;
Map*CURRENT_MAP=MAP_1; Map*CURRENT_MAP=MAP_1;
sound::Wave SONG_MAIN,SONG_BATTLE,SONG_FINALBATTLE,SONG_EXPLORE,SONG_DOME; sound::Wave SONG_MAIN,SONG_BATTLE,SONG_FINALBATTLE,SONG_EXPLORE,SONG_DOME,SONG_GAMEOVER;
sound::Wave SOUND_MSG,SOUND_CHANGE_OPTION,SOUND_ROBOTICNOISE,SOUND_SELECT,SOUND_SAW,SOUND_SONAR,SOUND_WARNING,SOUND_EXPLODE,SOUND_LASERSHOOT,SOUND_WEATHERHEAVY,SOUND_WEATHERLIGHT; sound::Wave SOUND_MSG,SOUND_CHANGE_OPTION,SOUND_ROBOTICNOISE,SOUND_SELECT,SOUND_SAW,SOUND_SONAR,SOUND_WARNING,SOUND_EXPLODE,SOUND_LASERSHOOT,SOUND_WEATHERHEAVY,SOUND_WEATHERLIGHT;
std::queue<int> turnOrder; std::queue<int> turnOrder;
@ -807,6 +808,7 @@ public:
SONG_BATTLE = sound::Wave("./assets/battle.wav"); SONG_BATTLE = sound::Wave("./assets/battle.wav");
SONG_FINALBATTLE = sound::Wave("./assets/finalBattle.wav"); SONG_FINALBATTLE = sound::Wave("./assets/finalBattle.wav");
SONG_EXPLORE = sound::Wave("./assets/explore.wav"); SONG_EXPLORE = sound::Wave("./assets/explore.wav");
SONG_GAMEOVER = sound::Wave("./assets/gameover.wav");
SONG_DOME = sound::Wave("./assets/dome.wav"); SONG_DOME = sound::Wave("./assets/dome.wav");
SOUND_MSG = sound::Wave("./assets/msg.wav"); SOUND_MSG = sound::Wave("./assets/msg.wav");
SOUND_CHANGE_OPTION = sound::Wave("./assets/card_flip.wav"); SOUND_CHANGE_OPTION = sound::Wave("./assets/card_flip.wav");
@ -1345,10 +1347,14 @@ public:
PLAYER_SELECTED_TARGET=-2; PLAYER_SELECTED_TARGET=-2;
setupBattleTurns(); setupBattleTurns();
} }
PlaySound(&SOUND_SELECT);
} else {
PlaySound(&SOUND_ROBOTICNOISE);
} }
}break; }break;
case battle::PLAYER_TARGET_SELECTION:{ case battle::PLAYER_TARGET_SELECTION:{
setupBattleTurns(); setupBattleTurns();
PlaySound(&SOUND_SELECT);
}break; }break;
} }
switch (CURRENT_CUTSCENE) { switch (CURRENT_CUTSCENE) {
@ -1433,12 +1439,14 @@ public:
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) { if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) {
BATTLE_CARD_SELECTION_IND=(BATTLE_CARD_SELECTION_IND+1)%availablePowers.size(); BATTLE_CARD_SELECTION_IND=(BATTLE_CARD_SELECTION_IND+1)%availablePowers.size();
BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND]; BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND];
PlaySound(&SOUND_CHANGE_OPTION);
} }
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) { if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) {
if (--BATTLE_CARD_SELECTION_IND<0) { if (--BATTLE_CARD_SELECTION_IND<0) {
BATTLE_CARD_SELECTION_IND=availablePowers.size()-1; BATTLE_CARD_SELECTION_IND=availablePowers.size()-1;
} }
BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND]; BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND];
PlaySound(&SOUND_CHANGE_OPTION);
} }
}break; }break;
case battle::PLAYER_TARGET_SELECTION:{ case battle::PLAYER_TARGET_SELECTION:{
@ -1449,6 +1457,7 @@ public:
break; break;
} }
} }
PlaySound(&SOUND_CHANGE_OPTION);
} }
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) { if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) {
PLAYER_SELECTED_TARGET=-1; PLAYER_SELECTED_TARGET=-1;
@ -1464,6 +1473,7 @@ public:
break; break;
} }
} }
PlaySound(&SOUND_CHANGE_OPTION);
} }
}break; }break;
} }
@ -1670,6 +1680,7 @@ public:
updatePlayerState(); updatePlayerState();
fadeIn(); fadeIn();
EndCutscene(); EndCutscene();
playMusic(&SONG_DOME);
if (GAME_FLAGS[gameflag::CHECK_ROVER_3]&&!GAME_FLAGS[gameflag::STORY_REVIEW]) { if (GAME_FLAGS[gameflag::CHECK_ROVER_3]&&!GAME_FLAGS[gameflag::STORY_REVIEW]) {
GAME_FLAGS[gameflag::STORY_REVIEW]=true; GAME_FLAGS[gameflag::STORY_REVIEW]=true;
//20,2 //20,2
@ -1682,12 +1693,12 @@ public:
//20,2 //20,2
GAME_STATE=LATER_THAT_NIGHTFADEIN; GAME_STATE=LATER_THAT_NIGHTFADEIN;
fadeOutCompleted(); fadeOutCompleted();
playMusic(&SONG_DOME,true,0.4);
} else } else
if (!GAME_FLAGS[gameflag::CHECK_ROVER]&&GAME_FLAGS[gameflag::TUTORIAL2_X_X]) { if (!GAME_FLAGS[gameflag::CHECK_ROVER]&&GAME_FLAGS[gameflag::TUTORIAL2_X_X]) {
GAME_FLAGS[gameflag::CHECK_ROVER]=true; GAME_FLAGS[gameflag::CHECK_ROVER]=true;
DisplayMessageBox(26); DisplayMessageBox(26);
} }
playMusic(&SONG_DOME);
}break; }break;
case cutscene::DISPLAY_VOLCANIC_AREA:{ case cutscene::DISPLAY_VOLCANIC_AREA:{
TeleportToMapFileCoords(13,122); TeleportToMapFileCoords(13,122);
@ -1857,6 +1868,11 @@ public:
if (audioFade&&audioLevel>0) { if (audioFade&&audioLevel>0) {
audioLevel-=0.01; audioLevel-=0.01;
engine.SetOutputVolume(audioLevel); engine.SetOutputVolume(audioLevel);
if (audioLevel<=0&&queueBGMPlayback) {
queueBGMPlayback=false;
fadeIn();
playMusic(&SONG_EXPLORE);
}
} else } else
if (!audioFade&&audioLevel<0.6&&!SOUND_IS_MUTED) { if (!audioFade&&audioLevel<0.6&&!SOUND_IS_MUTED) {
audioLevel+=0.01; audioLevel+=0.01;
@ -2073,6 +2089,7 @@ public:
if (obj->name.compare("SILICON_PIECE")==0&&collidesWithPlayer(obj)) { if (obj->name.compare("SILICON_PIECE")==0&&collidesWithPlayer(obj)) {
GAME_STATE=COLLECTED_SILICON; GAME_STATE=COLLECTED_SILICON;
DisplayMessageBox(14); DisplayMessageBox(14);
PlaySound(&SOUND_SELECT);
COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y}); COLLECTED_ITEMS.push_back({(int)obj->x,(int)obj->y});
OBJECTS.erase(OBJECTS.begin()+i--); OBJECTS.erase(OBJECTS.begin()+i--);
delete obj; delete obj;
@ -2097,6 +2114,18 @@ public:
WEATHER_POWERS[i]->playerOwnCount=foodCount; WEATHER_POWERS[i]->playerOwnCount=foodCount;
} }
} }
bool containsFinalBoss=false;
for (int i=0;i<enc.entities.size();i++) {
if (enc.entities[i]->name.compare("A.A")==0) {
containsFinalBoss=true;
break;
}
}
if (containsFinalBoss) {
playMusic(&SONG_FINALBATTLE);
} else {
playMusic(&SONG_BATTLE);
}
availablePowers.erase(availablePowers.begin(),availablePowers.end()); availablePowers.erase(availablePowers.begin(),availablePowers.end());
IN_BATTLE_ENCOUNTER=true; IN_BATTLE_ENCOUNTER=true;
CURRENT_ENCOUNTER=enc; CURRENT_ENCOUNTER=enc;
@ -2524,6 +2553,8 @@ public:
} }
} }
} }
queueBGMPlayback=true;
audioFadeOut();
IN_BATTLE_ENCOUNTER=false; IN_BATTLE_ENCOUNTER=false;
ENCOUNTERS.erase(ENCOUNTERS.begin()+CURRENT_ENCOUNTER_IND); ENCOUNTERS.erase(ENCOUNTERS.begin()+CURRENT_ENCOUNTER_IND);
resetBattleState(); resetBattleState();
@ -2776,6 +2807,7 @@ public:
} else } else
if (CUTSCENE_FLAGS[0]&&!CUTSCENE_FLAGS[1]&&CUTSCENE_TIMER>60*4) { if (CUTSCENE_FLAGS[0]&&!CUTSCENE_FLAGS[1]&&CUTSCENE_TIMER>60*4) {
StartCutscene(cutscene::SHAKE); StartCutscene(cutscene::SHAKE);
stopMusic();
} }
}break; }break;
case cutscene::SHAKE:{ case cutscene::SHAKE:{
@ -2795,6 +2827,9 @@ public:
} else { } else {
StartCutscene(cutscene::INVESTIGATE_X_X); StartCutscene(cutscene::INVESTIGATE_X_X);
} }
if (frameCount%20==0) {
PlaySound(&SOUND_SAW);
}
}break; }break;
case cutscene::INVESTIGATE_X_X:{ case cutscene::INVESTIGATE_X_X:{
if (!messageBoxVisible) { if (!messageBoxVisible) {
@ -3309,8 +3344,12 @@ public:
void advanceMessageBox() { void advanceMessageBox() {
if (frameCount%4==0) { if (frameCount%4==0) {
if (messageBoxSpeaker.compare("Y.Y")==0||messageBoxSpeaker.compare("A.A")==0) {
PlaySound(&SOUND_ROBOTICNOISE);
} else {
PlaySound(&SOUND_MSG); PlaySound(&SOUND_MSG);
} }
}
char c = messageBoxRefText[messageBoxCursor++]; char c = messageBoxRefText[messageBoxCursor++];
printf("%c",c); printf("%c",c);
if (c=='\n') { if (c=='\n') {

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save