Skip to content

Commit

Permalink
Add end, lose and victory musics
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Jun 11, 2021
1 parent 175cbf6 commit 373ae45
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
Binary file added music/lose/CrashedShip.ogg
Binary file not shown.
4 changes: 4 additions & 0 deletions music/lose/CrashedShip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Reencoded from Sci-Fi Ambient - Crashed Ship by Ted Kerr
https://opengameart.org/content/sci-fi-ambient-crashed-ship

http://creativecommons.org/licenses/by/3.0/
Binary file added music/lose/Epic Fall.ogg
Binary file not shown.
5 changes: 5 additions & 0 deletions music/lose/Epic Fall.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Reencoded from Epic Fall by Alexandr Zhelanov
Alexandr Zhelanov https://soundcloud.com/alexandr-zhelanov
https://opengameart.org/content/epic-fall

http://creativecommons.org/licenses/by/3.0/
Binary file added music/victory/Party Sector.ogg
Binary file not shown.
5 changes: 5 additions & 0 deletions music/victory/Party Sector.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Reencoded from Party Sector by Joth
Joth https://soundcloud.com/user-215083110
https://opengameart.org/content/party-sector

http://creativecommons.org/publicdomain/zero/1.0/
Binary file added music/victory/low-fi.ogg
Binary file not shown.
5 changes: 5 additions & 0 deletions music/victory/low-fi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Reencoded from low-fi by Alexandr Zhelanov
https://soundcloud.com/alexandr-zhelanov
https://opengameart.org/content/low-fi

http://creativecommons.org/licenses/by/3.0/
10 changes: 8 additions & 2 deletions src/briefing_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,19 @@ GameLoopData *ScreenMissionSummary(
if (completed)
{
MenuAddSubmenu(mData->ms.root, MenuCreateReturn("Continue", 0));

MusicPlayFromChunk(
&gSoundDevice.music, MUSIC_END,
&gCampaign.Setting.CustomSongs[MUSIC_END]);
}
else
{
MenuAddSubmenu(mData->ms.root, MenuCreateReturn("Replay mission", 0));
MenuAddSubmenu(mData->ms.root, MenuCreateReturn("Back to menu", 1));

MusicPlayFromChunk(
&gSoundDevice.music, MUSIC_LOSE,
&gCampaign.Setting.CustomSongs[MUSIC_LOSE]);
}
mData->ms.allowAborts = true;
MenuAddExitType(&mData->ms, MENU_TYPE_RETURN);
Expand Down Expand Up @@ -450,8 +458,6 @@ static void MissionSummaryOnEnter(GameLoopData *data)
{
MissionSummaryData *mData = data->Data;

MusicPlayGeneral(&gSoundDevice.music, MUSIC_BRIEFING);

if (mData->completed && CanLevelSelect(mData->c->Entry.Mode))
{
AutosaveAdd(&gAutosave, &mData->c->Entry, mData->m->index, mData->m->NextMission, &gPlayerDatas);
Expand Down
5 changes: 5 additions & 0 deletions src/cdogs/mission.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ void MissionCopy(Mission *dst, const Mission *src)
dst->Music = src->Music;
switch (src->Music.Type)
{
case MUSIC_SRC_GENERAL:
break;
case MUSIC_SRC_DYNAMIC:
CSTRDUP(dst->Music.Data.Filename, src->Music.Data.Filename);
break;
Expand Down Expand Up @@ -488,6 +490,9 @@ void MissionBegin(struct MissionOptions *m, const NGameBegin gb)
m->state = MISSION_STATE_PLAY;
switch (m->missionData->Music.Type)
{
case MUSIC_SRC_GENERAL:
MusicPlayGeneral(&gSoundDevice.music, MUSIC_GAME);
break;
case MUSIC_SRC_DYNAMIC:
MusicPlayFile(
&gSoundDevice.music, MUSIC_GAME, gCampaign.Entry.Path,
Expand Down
3 changes: 3 additions & 0 deletions src/cdogs/music.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ void MusicPlayerInit(MusicPlayer *mp)
LoadMusic(&mp->generalTracks[MUSIC_MENU], "music/menu");
LoadMusic(&mp->generalTracks[MUSIC_BRIEFING], "music/briefing");
LoadMusic(&mp->generalTracks[MUSIC_GAME], "music/game");
LoadMusic(&mp->generalTracks[MUSIC_END], "music/end");
LoadMusic(&mp->generalTracks[MUSIC_LOSE], "music/lose");
LoadMusic(&mp->generalTracks[MUSIC_VICTORY], "music/victory");
}
static void LoadMusic(CArray *tracks, const char *path)
{
Expand Down
6 changes: 3 additions & 3 deletions src/cdogs/music.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ typedef enum
MUSIC_MENU,
MUSIC_BRIEFING,
MUSIC_GAME,
// TODO: end music
// TODO: lose music
// TODO: victory music
MUSIC_END,
MUSIC_LOSE,
MUSIC_VICTORY,
MUSIC_COUNT
} MusicType;

Expand Down
3 changes: 3 additions & 0 deletions src/screens_end.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ GameLoopData *ScreenVictory(Campaign *c)
PlayerListNew(PlayerListUpdate, VictoryDraw, data, true, false);
pl->pos.y = 75;
pl->size.y -= pl->pos.y;
MusicPlayFromChunk(
&gSoundDevice.music, MUSIC_VICTORY,
&gCampaign.Setting.CustomSongs[MUSIC_VICTORY]);
return PlayerListLoop(pl);
}
static void VictoryDraw(void *data)
Expand Down

0 comments on commit 373ae45

Please sign in to comment.