From b51530886e499da4ebfaa97f3800ddea72cf0a6a Mon Sep 17 00:00:00 2001
From: Spoike <acceptthis@users.sourceforge.net>
Date: Wed, 23 Jan 2008 01:32:20 +0000
Subject: [PATCH] Seeing as this is the only csqc example on fte's svn, I'm
 updating it to support the recent clientstat standardisation.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2870 fc73d0e0-1445-4013-8a0c-d673dee63da5
---
 quakec/fallout2/csqc/system.qc |  2 ++
 quakec/fallout2/inventory.qc   | 54 +++++++++++++++++-----------------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/quakec/fallout2/csqc/system.qc b/quakec/fallout2/csqc/system.qc
index 031e31013..7519dd044 100644
--- a/quakec/fallout2/csqc/system.qc
+++ b/quakec/fallout2/csqc/system.qc
@@ -1,4 +1,6 @@
 //Don't modify this file
+
+#define CSQC	//so code sections can be compiled for either progs
 /*
 ==============================================================================
 
diff --git a/quakec/fallout2/inventory.qc b/quakec/fallout2/inventory.qc
index 0c1ab8ef5..2aff70d50 100644
--- a/quakec/fallout2/inventory.qc
+++ b/quakec/fallout2/inventory.qc
@@ -91,6 +91,9 @@ float IID_EQUIP_SPRINTKIT = 377;
 float IID_EQUIP_HOVERBOOTS = 378;
 
 #define IsShootable(iid) (IsMelee(iid) || IsRanged(iid) || IsGrenade(iid))
+#define ToIID(it) floor(it/512)
+#define ToStatus(it) (it&511)
+#define SlotVal(iid,st) ((iid*512) | (st&511))
 
 float(float slotno, float iid) FitsInSlot;
 
@@ -98,6 +101,9 @@ float(float slotno, float iid) FitsInSlot;
 //slot3 is the armour slot.
 //the other slots are for misilaneous things.
 
+#define MAXSLOTS 16
+
+#ifndef CSQC
 .float          islot1;
 .float          islot2;
 .float          islot3;
@@ -114,41 +120,34 @@ float(float slotno, float iid) FitsInSlot;
 .float          islot14;
 .float          islot15;
 .float          islot16;
-#define MAXSLOTS 16
 
-void(float sttype, float stnum, string fieldname) clientstat = #232;
+void(float stnum, float sttype, .float fieldname) clientstatf = #232;
 void() SetupStats =
 {
 	//2 is ev_float
 	//32 is the first stat we are allowed to use
-	clientstat(2, 32, "islot1");
-	clientstat(2, 33, "islot2");
-	clientstat(2, 34, "islot3");
-	clientstat(2, 35, "islot4");
-	clientstat(2, 36, "islot5");
-	clientstat(2, 37, "islot6");
-	clientstat(2, 38, "islot7");
-	clientstat(2, 39, "islot8");
-	clientstat(2, 40, "islot9");
-	clientstat(2, 41, "islot10");
-	clientstat(2, 42, "islot11");
-	clientstat(2, 43, "islot12");
-	clientstat(2, 44, "islot13");
-	clientstat(2, 45, "islot14");
-	clientstat(2, 46, "islot15");
-	clientstat(2, 47, "islot16");
+	clientstatf(32, 2, islot1);
+	clientstatf(33, 2, islot2);
+	clientstatf(34, 2, islot3);
+	clientstatf(35, 2, islot4);
+	clientstatf(36, 2, islot5);
+	clientstatf(37, 2, islot6);
+	clientstatf(38, 2, islot7);
+	clientstatf(39, 2, islot8);
+	clientstatf(40, 2, islot9);
+	clientstatf(41, 2, islot10);
+	clientstatf(42, 2, islot11);
+	clientstatf(43, 2, islot12);
+	clientstatf(44, 2, islot13);
+	clientstatf(45, 2, islot14);
+	clientstatf(46, 2, islot15);
+	clientstatf(47, 2, islot16);
 
-	clientstat(2, 61, "current_slot");
-	clientstat(2, 62, "team");
-	clientstat(2, 63, "class");
+	clientstatf(61, 2, current_slot);
+	clientstatf(62, 2, team);
+	clientstatf(63, 2, class);
 };
 
-
-#define ToIID(it) floor(it/512)
-#define ToStatus(it) (it&511)
-#define SlotVal(iid,st) ((iid*512) | (st&511))
-
-
 float(entity e, float slotno) ItemInSlot =
 {
 	if (slotno == 1)
@@ -428,6 +427,7 @@ slot_t(float slot) SlotField =
 	bprint(PRINT_MEDIUM, "ERROR: Invalid slot number (", ftos(slot), ")\n");
 	return islot1;
 };
+#endif
 
 
 string(float iid) GetItemVModel =