summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2006-01-08 17:52:45 +0000
committerSimon Howard2006-01-08 17:52:45 +0000
commit89d1fc32d35bd53eb66d7b5d568a147ddc36509f (patch)
treeafceac74bc2ff6c58e4971fe706ed8a1f79fb268 /src
parent59aad53bbde97e75e06717ea1b49bd3c92941b83 (diff)
downloadchocolate-doom-89d1fc32d35bd53eb66d7b5d568a147ddc36509f.tar.gz
chocolate-doom-89d1fc32d35bd53eb66d7b5d568a147ddc36509f.tar.bz2
chocolate-doom-89d1fc32d35bd53eb66d7b5d568a147ddc36509f.zip
Play some random music for the players while waiting for the game to
start. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 273
Diffstat (limited to 'src')
-rw-r--r--src/net_gui.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/src/net_gui.c b/src/net_gui.c
index a8307d2e..4bead8c8 100644
--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_gui.c 269 2006-01-08 05:04:50Z fraggle $
+// $Id: net_gui.c 273 2006-01-08 17:52:45Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -21,6 +21,10 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.5 2006/01/08 17:52:45 fraggle
+// Play some random music for the players while waiting for the game to
+// start.
+//
// Revision 1.4 2006/01/08 05:04:50 fraggle
// Don't grab the mouse on the net waiting screen
//
@@ -56,13 +60,17 @@
#include "i_system.h"
#include "i_video.h"
#include "m_menu.h"
+#include "m_random.h"
#include "r_defs.h"
+#include "s_sound.h"
+#include "sounds.h"
#include "v_video.h"
#include "w_wad.h"
#include "z_zone.h"
static patch_t *player_face;
static patch_t *player_backdrops[4];
+static boolean have_music;
extern void M_WriteText(int x, int y, char *string);
@@ -117,6 +125,33 @@ static void Drawer(void)
}
}
+// play some random music
+
+static void RandomMusic(void)
+{
+ musicenum_t mus;
+
+ if (gamemode == commercial)
+ {
+ mus = mus_runnin + M_Random() % 32;
+ }
+ else if (gamemode == shareware)
+ {
+ mus = mus_e1m1 + M_Random() % 9;
+ }
+ else
+ {
+ mus = mus_e1m1 + M_Random() % 27;
+ }
+
+ S_ChangeMusic(mus, 0);
+
+ // If music is not playing straight away, it is turned off. Don't
+ // try to play any more music.
+
+ have_music = S_MusicPlaying();
+}
+
static void ProcessEvents(void)
{
event_t *ev;
@@ -129,6 +164,13 @@ static void ProcessEvents(void)
}
// process event ...
+
+ if (ev->type == ev_keydown && ev->data1 == 'm')
+ {
+ // Music change
+
+ RandomMusic();
+ }
}
}
@@ -162,6 +204,12 @@ void NET_WaitForStart(void)
NET_InitGUI();
+ M_ClearRandom();
+
+ // play some soothing music while we wait
+
+ RandomMusic();
+
// cheap hack: pretend to be on a demo screen so the mouse wont
// be grabbed
@@ -195,6 +243,13 @@ void NET_WaitForStart(void)
Drawer();
M_Drawer();
I_FinishUpdate();
+
+ // check if the music has finished - start another track!
+
+ if (have_music && !S_MusicPlaying())
+ {
+ RandomMusic();
+ }
}
// Network stuff