Browse Source

Move logging options to bottom & fix ending bug

1. As suggested by @PalMusicFan, move the logging options to bottoms on
Android/UWP
2. Fix the bug of playing ending AVI, and try use WIN95's music if we
can
Lou Yihua 7 years ago
parent
commit
283d4de828
3 changed files with 50 additions and 48 deletions
  1. 24 24
      android/app/src/main/res/layout/content_settings.xml
  2. 9 7
      ending.c
  3. 17 17
      winrt/SDLPal.Common/MainPage.xaml

+ 24 - 24
android/app/src/main/res/layout/content_settings.xml

@@ -65,30 +65,6 @@
                 android:ems="10"
                 android:inputType="textUri" />
 
-            <TextView
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/label_loglevel" />
-
-            <android.support.v7.widget.AppCompatSpinner
-                android:id="@+id/spLogLevel"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:entries="@array/log_level" />
-
-            <android.support.v7.widget.SwitchCompat
-                android:id="@+id/swLogFile"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/action_uselogfile" />
-
-            <EditText
-                android:id="@+id/edLogFile"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:ems="10"
-                android:inputType="textUri" />
-
             <android.support.v7.widget.SwitchCompat
                 android:id="@+id/swTouch"
                 android:layout_width="match_parent"
@@ -234,6 +210,30 @@
 
             </LinearLayout>
 
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/label_loglevel" />
+
+            <android.support.v7.widget.AppCompatSpinner
+                android:id="@+id/spLogLevel"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:entries="@array/log_level" />
+
+            <android.support.v7.widget.SwitchCompat
+                android:id="@+id/swLogFile"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/action_uselogfile" />
+
+            <EditText
+                android:id="@+id/edLogFile"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:ems="10"
+                android:inputType="textUri" />
+
             <android.support.v7.widget.GridLayout
                 app:columnCount="3"
                 app:rowCount="1"

+ 9 - 7
ending.c

@@ -413,20 +413,22 @@ PAL_EndingScreen(
 --*/
 {
     //
-    // Use AVI if we can
+    // Use AVI & WIN95's music if we can
 	// Otherwise, simulate the ending of DOS version
 	//
 	PAL_PlayAVI("4.avi");
 
-	if (PAL_PlayAVI("5.avi"))
+	if (!PAL_PlayAVI("5.avi"))
 	{
-		AUDIO_PlayMusic(0x1a, TRUE, 0);
+		BOOL win_music = AUDIO_PlayCDTrack(12);
+
+		if (!win_music) AUDIO_PlayMusic(0x1a, TRUE, 0);
 		PAL_RNGPlay(gpGlobals->iCurPlayingRNG, 110, 150, 7);
 		PAL_RNGPlay(gpGlobals->iCurPlayingRNG, 151, 999, 9);
 
 		PAL_FadeOut(2);
 
-		AUDIO_PlayMusic(0x19, TRUE, 0);
+		if (!win_music) AUDIO_PlayMusic(0x19, TRUE, 0);
 
 		PAL_ShowFBP(75, 0);
 		PAL_FadeIn(5, FALSE, 1);
@@ -439,10 +441,10 @@ PAL_EndingScreen(
 		gpGlobals->fNeedToFadeIn = TRUE;
 		PAL_EndingAnimation();
 
-		AUDIO_PlayMusic(0, FALSE, 2);
+		if (!win_music) AUDIO_PlayMusic(0, FALSE, 2);
 		PAL_ColorFade(7, 15, FALSE);
 
-		if (!AUDIO_PlayCDTrack(2))
+		if (!win_music && !AUDIO_PlayCDTrack(2))
 		{
 			AUDIO_PlayMusic(0x11, TRUE, 0);
 		}
@@ -487,7 +489,7 @@ PAL_EndingScreen(
 		PAL_EndingSetEffectSprite(0);
 	}
 
-	if (PAL_PlayAVI("6.avi"))
+	if (!PAL_PlayAVI("6.avi"))
 	{
 		if (!AUDIO_PlayCDTrack(13))
 		{

+ 17 - 17
winrt/SDLPal.Common/MainPage.xaml

@@ -45,23 +45,6 @@
                     <TextBox x:Name="tbFontFile" x:Uid="FontFile" Grid.Column="0" TextWrapping="Wrap" VerticalAlignment="Top" PlaceholderText="无自定义字体文件" IsReadOnly="True"/>
                     <Button x:Name="btnBrowseFontFile" x:Uid="ButtonBrowse" Grid.Column="1" Content="浏览" HorizontalAlignment="Right" Click="btnBrowseFileOpen_Click" />
                 </Grid>
-                <ComboBox x:Name="cbLogLevel" x:Uid="LogLevel" HorizontalAlignment="Stretch" Header="日志记录级别" PlaceholderText="选择日志记录级别">
-                    <ComboBoxItem x:Uid="Verbose" Content="详细信息"/>
-                    <ComboBoxItem x:Uid="Debug" Content="调试信息"/>
-                    <ComboBoxItem x:Uid="Information" Content="运行信息"/>
-                    <ComboBoxItem x:Uid="Warning" Content="普通警告"/>
-                    <ComboBoxItem x:Uid="Error" Content="严重错误"/>
-                    <ComboBoxItem x:Uid="Fatal" Content="致命错误"/>
-                </ComboBox>
-                <CheckBox x:Name="cbUseLogFile" x:Uid="UseLogFile" Content="记录日志到文件" Checked="cbUseFile_CheckChanged" Unchecked="cbUseFile_CheckChanged" />
-                <Grid x:Name="gridLogFile">
-                    <Grid.ColumnDefinitions>
-                        <ColumnDefinition/>
-                        <ColumnDefinition Width="Auto"/>
-                    </Grid.ColumnDefinitions>
-                    <TextBox x:Name="tbLogFile" x:Uid="LogFile" Grid.Column="0" TextWrapping="Wrap" VerticalAlignment="Top" PlaceholderText="无日志文件" IsReadOnly="True"/>
-                    <Button x:Name="btnBrowseLogFile" x:Uid="ButtonBrowse" Grid.Column="1" Content="浏览" HorizontalAlignment="Right" Click="btnBrowseFileSave_Click" />
-                </Grid>
                 <ToggleSwitch x:Name="tsTouchOverlay" x:Uid="TouchOverlay" Header="启用触屏辅助" OffContent="否" OnContent="是" />
                 <ToggleSwitch x:Name="tsKeepAspect" x:Uid="AspectRatio" Header="保持纵横比" OffContent="否" OnContent="是" />
                 <ToggleSwitch x:Name="tsEnableAVI" x:Uid="EnableAVI" Header="启用 AVI 过场动画" OffContent="否" OnContent="是" />
@@ -102,6 +85,23 @@
                     <ComboBoxItem Content="49716"/>
                 </ComboBox>
                 <ToggleSwitch x:Name="tsSurroundOPL" x:Uid="SurroundOPL" Header="环绕声 OPL" OffContent="否" OnContent="是" />
+                <ComboBox x:Name="cbLogLevel" x:Uid="LogLevel" HorizontalAlignment="Stretch" Header="日志记录级别" PlaceholderText="选择日志记录级别">
+                    <ComboBoxItem x:Uid="Verbose" Content="详细信息"/>
+                    <ComboBoxItem x:Uid="Debug" Content="调试信息"/>
+                    <ComboBoxItem x:Uid="Information" Content="运行信息"/>
+                    <ComboBoxItem x:Uid="Warning" Content="普通警告"/>
+                    <ComboBoxItem x:Uid="Error" Content="严重错误"/>
+                    <ComboBoxItem x:Uid="Fatal" Content="致命错误"/>
+                </ComboBox>
+                <CheckBox x:Name="cbUseLogFile" x:Uid="UseLogFile" Content="记录日志到文件" Checked="cbUseFile_CheckChanged" Unchecked="cbUseFile_CheckChanged" />
+                <Grid x:Name="gridLogFile">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition/>
+                        <ColumnDefinition Width="Auto"/>
+                    </Grid.ColumnDefinitions>
+                    <TextBox x:Name="tbLogFile" x:Uid="LogFile" Grid.Column="0" TextWrapping="Wrap" VerticalAlignment="Top" PlaceholderText="无日志文件" IsReadOnly="True"/>
+                    <Button x:Name="btnBrowseLogFile" x:Uid="ButtonBrowse" Grid.Column="1" Content="浏览" HorizontalAlignment="Right" Click="btnBrowseFileSave_Click" />
+                </Grid>
                 <Grid VerticalAlignment="Top">
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition />