]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/games/doom/d_main.c
doom: fix music for patch wads
[plan9front.git] / sys / src / games / doom / d_main.c
index f693bebffff963fa88d659d2118c11ab3a04c249..6f1e8621545e224ade980acf47397386b62749b1 100644 (file)
@@ -90,6 +90,9 @@ boolean         drone;
 
 boolean                singletics = false; // debug flag to cancel adaptiveness
 
+/* bug compatibility with various versions of doom */
+boolean                noztele;
+boolean                nobounce;
 
 
 //extern int soundVolume;
@@ -323,6 +326,7 @@ void D_Display (void)
     if (!wipe)
     {
        I_FinishUpdate ();              // page flip or blit buffer
+       I_UpdateSound ();
        return;
     }
     
@@ -344,6 +348,8 @@ void D_Display (void)
        I_UpdateNoBlit ();
        M_Drawer ();                            // menu is drawn even on top of wipes
        I_FinishUpdate ();                      // page flip or blit buffer
+       if (!done)
+               I_UpdateSound ();
     } while (!done);
 }
 
@@ -394,12 +400,6 @@ void D_DoomLoop (void)
 
        // Update display, next frame, with current state.
        D_Display ();
-
-       // Sound mixing for the buffer is snychronous.
-       I_UpdateSound();
-
-       // Update sound output.
-       I_SubmitSound();
     }
 }
 
@@ -560,7 +560,7 @@ void D_AddFile (char *file)
 //
 void IdentifyVersion (void)
 {
-       char *wadfile;
+       char *wadfile, *slash;
 
        if (M_CheckParm ("-shdev"))
        {
@@ -612,35 +612,35 @@ void IdentifyVersion (void)
                language = french;
                printf("French version\n");
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("doom2.wad")) ) {
                gamemode = commercial;
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("plutonia.wad")) ) {
                gamemode = commercial;
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("tnt.wad")) ) {
                gamemode = commercial;
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("doomu.wad")) ) {
                gamemode = retail;
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("doom.wad")) ) {
                gamemode = registered;
                D_AddFile (wadfile);
-               return;
        } else if ( (wadfile = I_IdentifyWAD("doom1.wad")) ) {
                gamemode = shareware;
                D_AddFile (wadfile);
-               return;
        } else {
                printf("Game mode indeterminate.\n");
                gamemode = indetermined;
+               return;
        }
+       strncpy(basedefault, wadfile, sizeof(basedefault)-5);
+       basedefault[sizeof(basedefault)-5] = '\0';
+       slash = strrchr(basedefault, '/');
+       if (slash++ == 0)
+               slash = basedefault;
+       strcpy(slash, "cfg");
 }
 
 //
@@ -736,6 +736,10 @@ void D_DoomMain (void)
     respawnparm = M_CheckParm ("-respawn");
     fastparm = M_CheckParm ("-fast");
     devparm = M_CheckParm ("-devparm");
+    if (M_CheckParm ("-noztele") && gamemode == commercial)
+       noztele = 1;
+    if (M_CheckParm ("-nobounce") && (gamemode == commercial || gamemode == registered))
+       nobounce = 1;
     if (M_CheckParm ("-altdeath"))
        deathmatch = 2;
     else if (M_CheckParm ("-deathmatch"))