r4338 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Sep 4 09:13:32 EDT 2008
Author: div0
Date: 2008-09-04 09:13:32 -0400 (Thu, 04 Sep 2008)
New Revision: 4338
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/cl_weapons.qc
trunk/data/qcsrc/server/cl_weaponsystem.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/t_items.qc
trunk/data/qcsrc/server/w_crylink.qc
trunk/data/qcsrc/server/w_electro.qc
trunk/data/qcsrc/server/w_grenadelauncher.qc
trunk/data/qcsrc/server/w_hagar.qc
trunk/data/qcsrc/server/w_laser.qc
trunk/data/qcsrc/server/w_minstanex.qc
trunk/data/qcsrc/server/w_nex.qc
trunk/data/qcsrc/server/w_porto.qc
trunk/data/qcsrc/server/w_rocketlauncher.qc
trunk/data/qcsrc/server/w_shotgun.qc
trunk/data/qcsrc/server/w_uzi.qc
Log:
g_weaponreplace_*
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/defaultNexuiz.cfg 2008-09-04 13:13:32 UTC (rev 4338)
@@ -1091,3 +1091,18 @@
seta cl_weaponpriority8 ""
// impulse 209, 219, 229:
seta cl_weaponpriority9 ""
+
+// NOTE: this only replaces weapons on the map
+// use g_start_weapon_* to also replace the on-startup weapons!
+// example: g_weaponreplace_7 "7 11", then Nexes become MinstaNexes 50% of the times
+set g_weaponreplace_1 ""
+set g_weaponreplace_2 ""
+set g_weaponreplace_3 ""
+set g_weaponreplace_4 ""
+set g_weaponreplace_5 ""
+set g_weaponreplace_6 ""
+set g_weaponreplace_7 ""
+set g_weaponreplace_8 ""
+set g_weaponreplace_9 ""
+set g_weaponreplace_10 ""
+set g_weaponreplace_11 ""
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -189,7 +189,7 @@
{
oldself = self;
self = wep;
- Item_SpawnByWeaponCode(wpn);
+ weapon_defaultspawnfunc(wpn);
self = oldself;
if(startitem_failed)
return -1;
@@ -451,15 +451,15 @@
{
register_dummy_weapon();
// %weaponaddpoint
- register_weapon(WEP_LASER, w_laser, 0, 1, 1, "laser", "laser", "Laser");
- register_weapon(WEP_SHOTGUN, w_shotgun, IT_SHELLS, 2, 1, "shotgun", "shotgun", "Shotgun");
- register_weapon(WEP_UZI, w_uzi, IT_NAILS, 3, 1, "uzi", "uzi", "Machine Gun");
- register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS, 4, 1, "gl", "grenadelauncher", "Mortar");
- register_weapon(WEP_ELECTRO, w_electro, IT_CELLS, 5, 1, "electro", "electro", "Electro");
- register_weapon(WEP_CRYLINK, w_crylink, IT_CELLS, 6, 1, "crylink", "crylink", "Crylink");
- register_weapon(WEP_NEX, w_nex, IT_CELLS, 7, 1, "nex", "nex", "Nex");
- register_weapon(WEP_HAGAR, w_hagar, IT_ROCKETS, 8, 1, "hagar", "hagar", "Hagar");
- register_weapon(WEP_ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, 1, "rl", "rocketlauncher", "Rocket Launcher");
- register_weapon(WEP_PORTO, w_porto, IT_SUPERWEAPON, 0, 0, "porto" , "porto", "Port-O-Launch");
- register_weapon(WEP_MINSTANEX, w_minstanex, IT_CELLS, 7, 0, "minstanex", "minstanex", "MinstaNex");
+ register_weapon(WEP_LASER, w_laser, 0, 1, 1, 0, "laser", "laser", "Laser");
+ register_weapon(WEP_SHOTGUN, w_shotgun, IT_SHELLS, 2, 1, 2500, "shotgun", "shotgun", "Shotgun");
+ register_weapon(WEP_UZI, w_uzi, IT_NAILS, 3, 1, 5000, "uzi", "uzi", "Machine Gun");
+ register_weapon(WEP_GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS, 4, 1, 5000, "gl", "grenadelauncher", "Mortar");
+ register_weapon(WEP_ELECTRO, w_electro, IT_CELLS, 5, 1, 5000, "electro", "electro", "Electro");
+ register_weapon(WEP_CRYLINK, w_crylink, IT_CELLS, 6, 1, 5000, "crylink", "crylink", "Crylink");
+ register_weapon(WEP_NEX, w_nex, IT_CELLS, 7, 1, 10000, "nex", "nex", "Nex");
+ register_weapon(WEP_HAGAR, w_hagar, IT_ROCKETS, 8, 1, 5000, "hagar", "hagar", "Hagar");
+ register_weapon(WEP_ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, 1, 10000, "rl", "rocketlauncher", "Rocket Launcher");
+ register_weapon(WEP_PORTO, w_porto, IT_SUPERWEAPON, 0, 0, 0, "porto" , "porto", "Port-O-Launch");
+ register_weapon(WEP_MINSTANEX, w_minstanex, IT_CELLS, 7, 0, 10000, "minstanex", "minstanex", "MinstaNex");
}
Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -588,7 +588,7 @@
entity weapon_info[24];
entity dummy_weapon_info;
.float(float) weapon_func;
-void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, string modelname, string shortname, string name)
+void register_weapon(float id, float(float) func, float ammotype, float i, float normalweapon, float pickupbasevalue, string modelname, string shortname, string name)
{
entity e;
weapon_info[id - 1] = e = spawn();
@@ -603,6 +603,7 @@
e.model = strzone(strcat("models/weapons/g_", modelname, ".md3"));
e.spawnflags = normalweapon;
e.impulse = i;
+ e.bot_pickupbasevalue = pickupbasevalue;
}
float w_null(float dummy)
{
@@ -621,6 +622,7 @@
dummy_weapon_info.model = "";
dummy_weapon_info.spawnflags = 0;
dummy_weapon_info.impulse = -1;
+ dummy_weapon_info.bot_pickupbasevalue = 0;
}
entity get_weaponinfo(float id)
{
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/defs.qh 2008-09-04 13:13:32 UTC (rev 4338)
@@ -208,9 +208,8 @@
float WR_PRECACHE = 6; // precaches models/sounds used by this weapon
float WR_SUICIDEMESSAGE = 7; // sets w_deathtypestring or leaves it alone
float WR_KILLMESSAGE = 8; // sets w_deathtypestring or leaves it alone
-float WR_SPAWNFUNC = 9; // calls the spawn function (which just needs to call weapon_defaultspawnfunc)
-void weapon_defaultspawnfunc(float wpn, float weight);
+void weapon_defaultspawnfunc(float wpn);
string w_deathtypestring;
Modified: trunk/data/qcsrc/server/t_items.qc
===================================================================
--- trunk/data/qcsrc/server/t_items.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/t_items.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -29,11 +29,6 @@
}
}
-void Item_SpawnByWeaponCode(float it)
-{
- weapon_action(it, WR_SPAWNFUNC);
-}
-
.float max_armorvalue;
void Item_Respawn (void)
@@ -587,12 +582,39 @@
}
float weaponswapping;
+float internalteam;
-void weapon_defaultspawnfunc(float wpn, float weight)
+void weapon_defaultspawnfunc(float wpn)
{
entity e;
float t;
var .float ammofield;
+ string s;
+ entity oldself;
+ float i;
+
+ if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
+ {
+ s = cvar_string(strcat("g_weaponreplace_", ftos(wpn)));
+ t = tokenize(s);
+ if(t >= 2)
+ {
+ self.team = --internalteam;
+ for(i = 1; i < t; ++i)
+ {
+ oldself = self;
+ self = spawn();
+ copyentity(oldself, self);
+ self.classname = "replacedweapon";
+ weapon_defaultspawnfunc(stof(argv(i)));
+ self = oldself;
+ print("replaced by ", argv(i), "\n");
+ }
+ }
+ if(t >= 1)
+ wpn = stof(argv(0));
+ }
+
e = get_weaponinfo(wpn);
t = g_pickup_respawntime_short;
@@ -607,32 +629,30 @@
if(e.items == IT_SUPERWEAPON)
t = g_pickup_respawntime_powerup;
- StartItem (e.model, "weapons/weaponpickup.wav", t, e.message, 0, e.weapons, FL_WEAPON, weapon_pickupevalfunc, weight);
+ StartItem(e.model, "weapons/weaponpickup.wav", t, e.message, 0, e.weapons, FL_WEAPON, weapon_pickupevalfunc, e.bot_pickupbasevalue);
if (self.modelindex) // don't precache if self was removed
weapon_action(e.weapon, WR_PRECACHE);
}
void spawnfunc_weapon_shotgun (void);
void spawnfunc_weapon_uzi (void) {
- if(!weaponswapping)
if(q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
- weapon_defaultspawnfunc(WEP_SHOTGUN, 2500);
+ weapon_defaultspawnfunc(WEP_SHOTGUN);
return;
}
- weapon_defaultspawnfunc(WEP_UZI, 5000);
+ weapon_defaultspawnfunc(WEP_UZI);
}
void spawnfunc_weapon_shotgun (void) {
- if(!weaponswapping)
if(q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
- weapon_defaultspawnfunc(WEP_UZI, 5000);
+ weapon_defaultspawnfunc(WEP_UZI);
return;
}
- weapon_defaultspawnfunc(WEP_SHOTGUN, 2500);
+ weapon_defaultspawnfunc(WEP_SHOTGUN);
}
void spawnfunc_weapon_nex (void)
@@ -644,7 +664,7 @@
self.nextthink = time + cvar("sys_ticrate");
return;
}
- weapon_defaultspawnfunc(WEP_NEX, 10000);
+ weapon_defaultspawnfunc(WEP_NEX);
}
void spawnfunc_weapon_minstanex (void)
@@ -656,7 +676,7 @@
self.nextthink = time + cvar("sys_ticrate");
return;
}
- weapon_defaultspawnfunc(WEP_MINSTANEX, 10000);
+ weapon_defaultspawnfunc(WEP_MINSTANEX);
}
void spawnfunc_weapon_rocketlauncher (void)
@@ -668,7 +688,7 @@
self.nextthink = time + cvar("sys_ticrate");
return;
}
- weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER, 10000);
+ weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER);
}
void spawnfunc_item_rockets (void) {
Modified: trunk/data/qcsrc/server/w_crylink.qc
===================================================================
--- trunk/data/qcsrc/server/w_crylink.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_crylink.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -197,7 +197,7 @@
void spawnfunc_weapon_crylink (void)
{
- weapon_defaultspawnfunc(WEP_CRYLINK, 5000);
+ weapon_defaultspawnfunc(WEP_CRYLINK);
}
float w_crylink(float req)
@@ -239,8 +239,6 @@
return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
else if (req == WR_CHECKAMMO2)
return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_crylink();
// else if (req == WR_SUICIDEMESSAGE) // TODO
// else if (req == WR_KILLMESSAGE) // TODO
return TRUE;
Modified: trunk/data/qcsrc/server/w_electro.qc
===================================================================
--- trunk/data/qcsrc/server/w_electro.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_electro.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -166,7 +166,7 @@
void spawnfunc_weapon_electro (void)
{
- weapon_defaultspawnfunc(WEP_ELECTRO, 5000);
+ weapon_defaultspawnfunc(WEP_ELECTRO);
}
.float bot_secondary_electromooth;
@@ -232,8 +232,6 @@
return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
else if (req == WR_SUICIDEMESSAGE)
w_deathtypestring = "played with plasma";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_electro();
// else if (req == WR_KILLMESSAGE) // TODO
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_grenadelauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_grenadelauncher.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_grenadelauncher.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -148,7 +148,7 @@
void spawnfunc_weapon_grenadelauncher (void)
{
- weapon_defaultspawnfunc(WEP_GRENADE_LAUNCHER, 5000);
+ weapon_defaultspawnfunc(WEP_GRENADE_LAUNCHER);
}
.float bot_secondary_grenademooth;
@@ -215,7 +215,5 @@
w_deathtypestring = "detonated";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "was blasted by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_grenadelauncher();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_hagar.qc
===================================================================
--- trunk/data/qcsrc/server/w_hagar.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_hagar.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -158,7 +158,7 @@
void spawnfunc_weapon_hagar (void)
{
- weapon_defaultspawnfunc(WEP_HAGAR, 5000);
+ weapon_defaultspawnfunc(WEP_HAGAR);
}
float w_hagar(float req)
@@ -206,7 +206,5 @@
// else if (req == WR_SUICIDEMESSAGE) // TODO
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "was pummeled by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_hagar();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_laser.qc
===================================================================
--- trunk/data/qcsrc/server/w_laser.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_laser.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -133,13 +133,7 @@
return TRUE;
else if (req == WR_CHECKAMMO2)
return TRUE;
- else if (req == WR_SUICIDEMESSAGE)
- w_deathtypestring = "did the impossible";
+ // else if (req == WR_SUICIDEMESSAGE) // TODO
// else if (req == WR_KILLMESSAGE) // TODO
- else if (req == WR_SPAWNFUNC)
- {
- remove(self); // cannot spawn this
- self = world;
- }
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_minstanex.qc
===================================================================
--- trunk/data/qcsrc/server/w_minstanex.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_minstanex.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -161,7 +161,5 @@
w_deathtypestring = "did the impossible";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "has been vaporized by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_minstanex();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_nex.qc
===================================================================
--- trunk/data/qcsrc/server/w_nex.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_nex.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -64,7 +64,5 @@
w_deathtypestring = "did the impossible";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "has been vaporized by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_nex();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_porto.qc
===================================================================
--- trunk/data/qcsrc/server/w_porto.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_porto.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -118,7 +118,7 @@
void spawnfunc_weapon_porto (void)
{
- weapon_defaultspawnfunc(WEP_PORTO, 5000);
+ weapon_defaultspawnfunc(WEP_PORTO);
}
float w_porto(float req)
@@ -192,7 +192,5 @@
w_deathtypestring = "did the impossible";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "felt # doing the impossible";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_porto();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_rocketlauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_rocketlauncher.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_rocketlauncher.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -434,7 +434,5 @@
w_deathtypestring = "exploded";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "almost dodged #'s rocket";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_rocketlauncher();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_shotgun.qc
===================================================================
--- trunk/data/qcsrc/server/w_shotgun.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_shotgun.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -145,7 +145,5 @@
w_deathtypestring = "did the impossible";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "was gunned by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_shotgun();
return TRUE;
};
Modified: trunk/data/qcsrc/server/w_uzi.qc
===================================================================
--- trunk/data/qcsrc/server/w_uzi.qc 2008-09-04 12:35:39 UTC (rev 4337)
+++ trunk/data/qcsrc/server/w_uzi.qc 2008-09-04 13:13:32 UTC (rev 4338)
@@ -151,7 +151,5 @@
w_deathtypestring = "did the impossible";
else if (req == WR_KILLMESSAGE)
w_deathtypestring = "was riddled full of holes by";
- else if (req == WR_SPAWNFUNC)
- spawnfunc_weapon_machinegun();
return TRUE;
};
More information about the nexuiz-commits
mailing list