pkgs/chocolate-doom2xx: Add -demoloopi flag
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				CI / Check, build and cache Nix flake (push) Successful in 32m58s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	CI / Check, build and cache Nix flake (push) Successful in 32m58s
				
			This commit is contained in:
		
							
								
								
									
										49
									
								
								pkgs/chocolate-doom2xx/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								pkgs/chocolate-doom2xx/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
{ lib, stdenv, autoreconfHook, pkg-config, SDL, SDL_mixer, SDL_net
 | 
			
		||||
, fetchFromGitHub, fetchpatch, python3 }:
 | 
			
		||||
 | 
			
		||||
stdenv.mkDerivation rec {
 | 
			
		||||
  pname = "chocolate-doom";
 | 
			
		||||
  version = "2.3.0";
 | 
			
		||||
 | 
			
		||||
  src = fetchFromGitHub {
 | 
			
		||||
    owner = "chocolate-doom";
 | 
			
		||||
    repo = pname;
 | 
			
		||||
    rev = "${pname}-${version}";
 | 
			
		||||
    sha256 = "sha256-1uw/1CYKBvDNgT5XxRBY24Evt3f4Y6YQ6bScU+KNHgM=";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  patches = [
 | 
			
		||||
    # Pull upstream patch to fix build against gcc-10:
 | 
			
		||||
    #   https://github.com/chocolate-doom/chocolate-doom/pull/1257
 | 
			
		||||
    (fetchpatch {
 | 
			
		||||
      name = "fno-common.patch";
 | 
			
		||||
      url = "https://github.com/chocolate-doom/chocolate-doom/commit/a8fd4b1f563d24d4296c3e8225c8404e2724d4c2.patch";
 | 
			
		||||
      sha256 = "1dmbygn952sy5n8qqp0asg11pmygwgygl17lrj7i0fxa0nrhixhj";
 | 
			
		||||
    })
 | 
			
		||||
    ./demoloopi.patch
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  outputs = [ "out" "man" ];
 | 
			
		||||
 | 
			
		||||
  postPatch = ''
 | 
			
		||||
    patchShebangs --build man/{simplecpp,docgen}
 | 
			
		||||
  '';
 | 
			
		||||
 | 
			
		||||
  nativeBuildInputs = [
 | 
			
		||||
    autoreconfHook
 | 
			
		||||
    pkg-config
 | 
			
		||||
    # for documentation
 | 
			
		||||
    python3
 | 
			
		||||
  ];
 | 
			
		||||
  buildInputs = [ (SDL.override { cacaSupport = true; }) SDL_mixer SDL_net ];
 | 
			
		||||
  enableParallelBuilding = true;
 | 
			
		||||
 | 
			
		||||
  meta = {
 | 
			
		||||
    homepage = "http://chocolate-doom.org/";
 | 
			
		||||
    description = "A Doom source port that accurately reproduces the experience of Doom as it was played in the 1990s";
 | 
			
		||||
    license = lib.licenses.gpl2Plus;
 | 
			
		||||
    platforms = lib.platforms.unix;
 | 
			
		||||
    hydraPlatforms = lib.platforms.linux; # darwin times out
 | 
			
		||||
    maintainers = with lib.maintainers; [ ];
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										91
									
								
								pkgs/chocolate-doom2xx/demoloopi.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								pkgs/chocolate-doom2xx/demoloopi.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,91 @@
 | 
			
		||||
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
 | 
			
		||||
index 65a39a10..3f799b0f 100644
 | 
			
		||||
--- a/src/doom/d_main.c
 | 
			
		||||
+++ b/src/doom/d_main.c
 | 
			
		||||
@@ -483,6 +483,8 @@ void D_DoomLoop (void)
 | 
			
		||||
 //  DEMO LOOP
 | 
			
		||||
 //
 | 
			
		||||
 int             demosequence;
 | 
			
		||||
+int             demoloopi;
 | 
			
		||||
+char            demoloopname[9];
 | 
			
		||||
 int             pagetic;
 | 
			
		||||
 char                    *pagename;
 | 
			
		||||
 
 | 
			
		||||
@@ -524,6 +526,8 @@ void D_AdvanceDemo (void)
 | 
			
		||||
 //
 | 
			
		||||
 void D_DoAdvanceDemo (void)
 | 
			
		||||
 {
 | 
			
		||||
+    int havedemo4;
 | 
			
		||||
+
 | 
			
		||||
     players[consoleplayer].playerstate = PST_LIVE;  // not reborn
 | 
			
		||||
     advancedemo = false;
 | 
			
		||||
     usergame = false;               // no save / end game here
 | 
			
		||||
@@ -539,10 +543,14 @@ void D_DoAdvanceDemo (void)
 | 
			
		||||
     // However! There is an alternate version of Final Doom that
 | 
			
		||||
     // includes a fixed executable.
 | 
			
		||||
 
 | 
			
		||||
-    if (gameversion == exe_ultimate || gameversion == exe_final)
 | 
			
		||||
+    havedemo4 = gameversion == exe_ultimate || gameversion == exe_final;
 | 
			
		||||
+    if (havedemo4)
 | 
			
		||||
       demosequence = (demosequence+1)%7;
 | 
			
		||||
     else
 | 
			
		||||
       demosequence = (demosequence+1)%6;
 | 
			
		||||
+
 | 
			
		||||
+    if (demoloopi < 0 || demoloopi > (havedemo4 ? 3 : 2))
 | 
			
		||||
+      I_Error("Invalid demo loop start %d", demoloopi);
 | 
			
		||||
     
 | 
			
		||||
     switch (demosequence)
 | 
			
		||||
     {
 | 
			
		||||
@@ -558,17 +566,11 @@ void D_DoAdvanceDemo (void)
 | 
			
		||||
 	else
 | 
			
		||||
 	  S_StartMusic (mus_intro);
 | 
			
		||||
 	break;
 | 
			
		||||
-      case 1:
 | 
			
		||||
-	G_DeferedPlayDemo(DEH_String("demo1"));
 | 
			
		||||
-	break;
 | 
			
		||||
       case 2:
 | 
			
		||||
 	pagetic = 200;
 | 
			
		||||
 	gamestate = GS_DEMOSCREEN;
 | 
			
		||||
 	pagename = DEH_String("CREDIT");
 | 
			
		||||
 	break;
 | 
			
		||||
-      case 3:
 | 
			
		||||
-	G_DeferedPlayDemo(DEH_String("demo2"));
 | 
			
		||||
-	break;
 | 
			
		||||
       case 4:
 | 
			
		||||
 	gamestate = GS_DEMOSCREEN;
 | 
			
		||||
 	if ( gamemode == commercial)
 | 
			
		||||
@@ -587,12 +589,14 @@ void D_DoAdvanceDemo (void)
 | 
			
		||||
 	      pagename = DEH_String("HELP2");
 | 
			
		||||
 	}
 | 
			
		||||
 	break;
 | 
			
		||||
+      case 1:
 | 
			
		||||
+      case 3:
 | 
			
		||||
       case 5:
 | 
			
		||||
-	G_DeferedPlayDemo(DEH_String("demo3"));
 | 
			
		||||
-	break;
 | 
			
		||||
         // THE DEFINITIVE DOOM Special Edition demo
 | 
			
		||||
       case 6:
 | 
			
		||||
-	G_DeferedPlayDemo(DEH_String("demo4"));
 | 
			
		||||
+	DEH_snprintf(demoloopname, 9, "demo%d", demoloopi + 1);
 | 
			
		||||
+	G_DeferedPlayDemo(demoloopname);
 | 
			
		||||
+	demoloopi = (demoloopi+1) % (havedemo4 ? 4 : 3);
 | 
			
		||||
 	break;
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
@@ -1891,7 +1895,15 @@ void D_DoomMain (void)
 | 
			
		||||
 	G_TimeDemo (demolumpname);
 | 
			
		||||
 	D_DoomLoop ();  // never returns
 | 
			
		||||
     }
 | 
			
		||||
-	
 | 
			
		||||
+
 | 
			
		||||
+    p = M_CheckParmWithArgs("-demoloopi", 1);
 | 
			
		||||
+    if (p)
 | 
			
		||||
+    {
 | 
			
		||||
+        demoloopi = atoi(myargv[p+1]);
 | 
			
		||||
+    } else {
 | 
			
		||||
+        demoloopi = 0;
 | 
			
		||||
+    }
 | 
			
		||||
+
 | 
			
		||||
     if (startloadgame >= 0)
 | 
			
		||||
     {
 | 
			
		||||
         M_StringCopy(file, P_SaveGameFile(startloadgame), sizeof(file));
 | 
			
		||||
		Reference in New Issue
	
	Block a user