From de8dfa48a63f8957bda7efd3f00442757a3d3831 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Thu, 19 Sep 2019 12:04:10 -0400 Subject: [PATCH] make bodyque procedurally and increase maximum to 16 --- source/defs.qc | 2 ++ source/world.qc | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/source/defs.qc b/source/defs.qc index b8a3700..489080d 100644 --- a/source/defs.qc +++ b/source/defs.qc @@ -273,6 +273,8 @@ void(entity e) setspawnparms = #78; const vector VEC_ORIGIN = '0 0 0'; +const float BODYQUE_MAX = 16; + const string WEPNAME_AXE = "Axe"; const string WEPNAME_SHOTGUN = "Shotgun"; const string WEPNAME_SUPER_SHOTGUN = "Double-barrelled Shotgun"; diff --git a/source/world.qc b/source/world.qc index 478db94..1928ebd 100644 --- a/source/world.qc +++ b/source/world.qc @@ -197,18 +197,30 @@ void() bodyque = { // creates bodyques }; -void() InitBodyQue = { +entity() spawn_bodyque = { entity e; - bodyque_head = spawn(); - bodyque_head.classname = "bodyque"; - bodyque_head.owner = spawn(); - bodyque_head.owner.classname = "bodyque"; - bodyque_head.owner.owner = spawn(); - bodyque_head.owner.owner.classname = "bodyque"; - bodyque_head.owner.owner.owner = spawn(); - bodyque_head.owner.owner.owner.classname = "bodyque"; - bodyque_head.owner.owner.owner.owner = bodyque_head; + e = spawn(); + e.classname = "bodyque"; + + return e; +}; + +void() InitBodyQue = { + entity e; + float i; + + for(i = 0; i < BODYQUE_MAX; i++) { + if(i == 0) { + bodyque_head = spawn_bodyque(); + e = bodyque_head; + } else { + e.owner = spawn_bodyque(); + e = e.owner; + } + } + + e.owner = bodyque_head; }; // make a body que entry for the given ent so the ent can be