Sound effect management

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

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

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save