OSDN Git Service

同じ条件のままでも音楽を再度読み込み直す処理と、音楽の優先度も若干修正。 / Fix process reloading same music under same...
authorDeskull <desull@users.sourceforge.jp>
Mon, 29 Feb 2016 13:33:09 +0000 (22:33 +0900)
committerDeskull <desull@users.sourceforge.jp>
Mon, 29 Feb 2016 13:33:09 +0000 (22:33 +0900)
src/externs.h
src/main-win.c
src/util.c
src/variable.c

index d977fc6..27916cd 100644 (file)
@@ -1816,4 +1816,3 @@ extern void revenge_store(int dam);
 extern bool teleport_barrier(int m_idx);
 extern bool magic_barrier(int m_idx);
 extern bool multiply_barrier(int m_idx);
-
index 1bc7d19..649ff61 100644 (file)
@@ -553,6 +553,9 @@ static bool can_use_music = FALSE;
 static MCI_OPEN_PARMS mop;
 static char mci_device_type[256];
 
+int current_music_type = 0;
+int current_music_id = 0;
+
 #endif /* USE_MUSIC */
 
 
@@ -2489,6 +2492,7 @@ static errr Term_xtra_win_music(int n, int v)
 #endif /* USE_MUSIC */
 
        /* Sound disabled */
+
        if(!use_music) return (1);
 
        /* Illegal sound */
@@ -2516,8 +2520,8 @@ static errr Term_xtra_win_music(int n, int v)
        /* No sample */
        if (i == 0)
        {
-               mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
-               mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
+               //mciSendCommand(mop.wDeviceID, MCI_STOP, 0, 0);
+               //mciSendCommand(mop.wDeviceID, MCI_CLOSE, 0, 0);
                return (1);
        }
 
@@ -2561,6 +2565,13 @@ static errr Term_xtra_win_music(int n, int v)
                break;
        }
 
+       if(current_music_type == n && current_music_id == v)
+       {
+               return (0);
+       }
+       current_music_type = n;
+       current_music_id = v;
+
 #ifdef WIN32
 
        mop.lpstrDeviceType = mci_device_type;  
index 5c8f8b2..bb882de 100644 (file)
@@ -1715,7 +1715,7 @@ errr play_music(int type, int val)
        if (!use_music) return 1;
 
        /* Make a sound (if allowed) */
-       return Term_xtra(type , val);
+       return Term_xtra(type, val);
 }
 
 /*
@@ -1770,11 +1770,11 @@ void select_floor_music()
 
        if(dungeon_type)
        {
-               if(play_music(TERM_XTRA_MUSIC_DUNGEON, dungeon_type))
+               if(p_ptr->feeling == 2) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2);
+               else if(p_ptr->feeling >= 3 && p_ptr->feeling <= 5) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1);
+               else
                {
-                       if(p_ptr->feeling == 2) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL2);
-                       else if(p_ptr->feeling >= 3 && p_ptr->feeling <= 5) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_FEEL1);
-                       else
+                       if(play_music(TERM_XTRA_MUSIC_DUNGEON, dungeon_type))
                        {
                                if(dun_level < 40) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_LOW);
                                else if(dun_level < 80) play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DUN_MED);
index 623b1f1..bb5def9 100644 (file)
@@ -1279,3 +1279,4 @@ travel_type travel;
 int snipe_type = SP_NONE;
 bool reset_concent = FALSE;   /* Concentration reset flag */
 bool is_fired = FALSE;
+