shithub: choc

Download patch

ref: 83d832ee4e6aabcdeacd282e73dd12ba81367e88
parent: e4e5387b31550cd771b0ae77db18a2914a82688a
author: James Haley <[email protected]>
date: Sun Sep 15 20:29:44 EDT 2013

Support for the -random parameter. Needs netcode support (passing the
ball to fraggle).

Subversion-branch: /branches/v2-branch
Subversion-revision: 2657

--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -111,6 +111,7 @@
 boolean         respawnparm;    // checkparm of -respawn
 boolean         fastparm;       // checkparm of -fast
 boolean         flipparm;       // [STRIFE] haleyjd 20110629: checkparm of -flip
+boolean         randomparm;     // [STRIFE] haleyjd 20130915: checkparm of -random
 
 boolean         showintro = true;   // [STRIFE] checkparm of -nograph, disables intro
 
@@ -1431,6 +1432,14 @@
     //
 
     respawnparm = M_CheckParm ("-respawn");
+
+    //!
+    // @vanilla
+    //
+    // Items respawn at random locations
+    //
+
+    randomparm = M_CheckParm ("-random");
 
     //!
     // @vanilla
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -54,6 +54,7 @@
 extern  boolean	nomonsters;	// checkparm of -nomonsters
 extern  boolean	respawnparm;	// checkparm of -respawn
 extern  boolean	fastparm;	// checkparm of -fast
+extern  boolean randomparm;     // [STRIFE] checkparm of -random
 extern  boolean flipparm;       // [STRIFE] checkparm of -flip
 
 extern  boolean	devparm;	// DEBUG: launched with -devparm
--- a/src/strife/p_mobj.c
+++ b/src/strife/p_mobj.c
@@ -709,13 +709,22 @@
     {
         itemrespawnque[iquehead] = mobj->spawnpoint;
         itemrespawntime[iquehead] = leveltime + 30*TICRATE; // [STRIFE]
-        iquehead = (iquehead+1)&(ITEMQUESIZE-1);
 
-        // [STRIFE] FIXME/TODO: - haleyjd 20110629
+        // [STRIFE] haleyjd 20130915
         // -random parameter affects the behavior of respawning items here.
-        // However, this requires addition of randomparm to the transmission
-        // of variables during netgame initialization, and the netcode is not
-        // functional yet - so, I haven't added this yet!
+        if(randomparm && iquehead != iquetail)
+        {
+            short type    = itemrespawnque[iquehead].type;
+            short options = itemrespawnque[iquehead].options;
+
+            // swap the type and options of iquehead and iquetail
+            itemrespawnque[iquehead].type    = itemrespawnque[iquetail].type;
+            itemrespawnque[iquehead].options = itemrespawnque[iquetail].options;
+            itemrespawnque[iquetail].type    = type;
+            itemrespawnque[iquetail].options = options;
+        }
+
+        iquehead = (iquehead+1)&(ITEMQUESIZE-1);
 
         // lose one off the end?
         if (iquehead == iquetail)