]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rename server/items.qc to server/items/spawning.qc
authorMario <mario.mario@y7mail.com>
Sat, 1 Aug 2020 22:07:07 +0000 (08:07 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 1 Aug 2020 22:07:07 +0000 (08:07 +1000)
18 files changed:
qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc
qcsrc/common/items/item.qh
qcsrc/common/weapons/all.qc
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/compat/wop.qc
qcsrc/server/items.qc [deleted file]
qcsrc/server/items.qh [deleted file]
qcsrc/server/items/_mod.inc [new file with mode: 0644]
qcsrc/server/items/_mod.qh [new file with mode: 0644]
qcsrc/server/items/spawning.qc [new file with mode: 0644]
qcsrc/server/items/spawning.qh [new file with mode: 0644]
qcsrc/server/miscfunctions.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc

index c08176cf8ddef8c5a751bc08c8a4375b308822a8..3f787fa3cf558d3b636e17bf3e58eac5e60f2e9b 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <server/race.qh>
 #include <server/gamelog.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 
 float autocvar_g_cts_finish_kill_delay;
 bool autocvar_g_cts_selfdamage;
index a8b8b46757f7359607d468aeafe15ecf349cc1b4..ef909382b8b23384446fa4274a0bd45534bb0b51 100644 (file)
@@ -8,7 +8,7 @@
 #endif
 
 #ifdef SVQC
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #endif
 
 const int IT_UNLIMITED_AMMO                    =  BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
index bca6cc8a8a79496e3267e12f09d4bc40789f45de..92727b4c0ad436d64165fc1060b5898d75798d5d 100644 (file)
@@ -31,7 +31,7 @@
     #include "config.qh"
     #include <server/weapons/csqcprojectile.qh>
     #include <server/weapons/tracing.qh>
-    #include "../items.qh"
+    #include <server/items/spawning.qh>
     #include <server/autocvars.qh>
     #include <server/constants.qh>
     #include <server/defs.qh>
index 6c66dd95f015f374bd6376a66059f18054ceecd2..7634e76357e6e1eade967a9bfed90eb4b52853b6 100644 (file)
@@ -12,7 +12,6 @@
 #include <server/handicap.qc>
 #include <server/impulse.qc>
 #include <server/ipban.qc>
-#include <server/items.qc>
 #include <server/mapvoting.qc>
 #include <server/matrix.qc>
 #include <server/miscfunctions.qc>
@@ -34,6 +33,7 @@
 #include <server/bot/_mod.inc>
 #include <server/command/_mod.inc>
 #include <server/compat/_mod.inc>
+#include <server/items/_mod.inc>
 #include <server/mutators/_mod.inc>
 #include <server/pathlib/_mod.inc>
 #include <server/weapons/_mod.inc>
index 06bb03df306d21faa905473d127f9922156ed4c0..331fdcd854672a67ffee5a49ae8736165cdbdef7 100644 (file)
@@ -12,7 +12,6 @@
 #include <server/handicap.qh>
 #include <server/impulse.qh>
 #include <server/ipban.qh>
-#include <server/items.qh>
 #include <server/mapvoting.qh>
 #include <server/matrix.qh>
 #include <server/miscfunctions.qh>
@@ -34,6 +33,7 @@
 #include <server/bot/_mod.qh>
 #include <server/command/_mod.qh>
 #include <server/compat/_mod.qh>
+#include <server/items/_mod.qh>
 #include <server/mutators/_mod.qh>
 #include <server/pathlib/_mod.qh>
 #include <server/weapons/_mod.qh>
index d078cae8604903d461bf824bb3a8b4283f0b7755..8081097b46eba9d06d50d52c7d261ecc99ba6e46 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <server/resources.qh>
 #include "havocbot.qh"
 
index baf20c633378dece37563c49c4bf3d9ad74d6e07..4103ccf29a57e2f87f4df8844a17fe78ff446253 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <server/resources.qh>
 #include <common/gamemodes/_mod.qh>
 #include <common/items.qh>
index d2577b46afb356fef97917bf577493f0e483fbaf..bd399bffd3d15c861e60922edf0fb83e7e177f8f 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <common/weapons/_all.qh>
 
 spawnfunc(item_haste);
diff --git a/qcsrc/server/items.qc b/qcsrc/server/items.qc
deleted file mode 100644 (file)
index ab53a10..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "items.qh"
-
-/// \file
-/// \brief Source file that contains implementation of the functions related to
-/// game items.
-/// \copyright GNU GPLv2 or any later version.
-
-#include <server/mutators/_mod.qh>
-#include <common/weapons/all.qh>
-#include <common/mapobjects/subs.qh>
-
-.bool m_isloot; ///< Holds whether item is loot.
-/// \brief Holds whether strength, shield or superweapon timers expire while
-/// this item is on the ground.
-.bool m_isexpiring;
-
-entity Item_FindDefinition(string class_name)
-{
-       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
-       {
-               return it;
-       });
-       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
-       {
-               return it.m_pickup;
-       });
-       return NULL;
-}
-
-bool Item_IsAllowed(string class_name)
-{
-       entity definition = Item_FindDefinition(class_name);
-       if (definition == NULL)
-       {
-               return false;
-       }
-       return Item_IsDefinitionAllowed(definition);
-}
-
-bool Item_IsDefinitionAllowed(entity definition)
-{
-       return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
-}
-
-entity Item_Create(string class_name, vector position, bool no_align)
-{
-       entity item = spawn();
-       item.classname = class_name;
-       item.spawnfunc_checked = true;
-       setorigin(item, position);
-       item.noalign = no_align;
-       Item_Initialize(item, class_name);
-       if (wasfreed(item))
-       {
-               return NULL;
-       }
-       return item;
-}
-
-void Item_Initialize(entity item, string class_name)
-{
-       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
-       {
-               weapon_defaultspawnfunc(item, it);
-               return;
-       });
-       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
-       {
-               StartItem(item, it);
-               return;
-       });
-       LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
-}
-
-entity Item_CreateLoot(string class_name, vector position, vector vel,
-       float time_to_live)
-{
-       entity item = spawn();
-       if (!Item_InitializeLoot(item, class_name, position, vel, time_to_live))
-       {
-               return NULL;
-       }
-       return item;
-}
-
-bool Item_InitializeLoot(entity item, string class_name, vector position,
-       vector vel, float time_to_live)
-{
-       item.classname = class_name;
-       Item_SetLoot(item, true);
-       item.noalign = true;
-       setorigin(item, position);
-       item.pickup_anyway = true;
-       item.spawnfunc_checked = true;
-       Item_Initialize(item, class_name);
-       if (wasfreed(item))
-       {
-               return false;
-       }
-       item.gravity = 1;
-       item.velocity = vel;
-       SUB_SetFade(item, time + time_to_live, 1);
-       return true;
-}
-
-bool Item_IsLoot(entity item)
-{
-       return item.m_isloot || item.classname == "droppedweapon";
-}
-
-void Item_SetLoot(entity item, bool loot)
-{
-       item.m_isloot = loot;
-}
-
-bool Item_ShouldKeepPosition(entity item)
-{
-       return item.noalign || (item.spawnflags & 1);
-}
-
-bool Item_IsExpiring(entity item)
-{
-       return item.m_isexpiring;
-}
-
-void Item_SetExpiring(entity item, bool expiring)
-{
-       item.m_isexpiring = expiring;
-}
-
-// Compatibility spawn functions
-
-// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
-
-SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
-
-SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
-
-SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
-
-SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
-
-SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
-
-SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
-
-SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
diff --git a/qcsrc/server/items.qh b/qcsrc/server/items.qh
deleted file mode 100644 (file)
index b52449e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#pragma once
-
-/// \file
-/// \brief Header file that describes the functions related to game items.
-/// \copyright GNU GPLv2 or any later version.
-
-bool startitem_failed;
-
-/// \brief Returns the item definition corresponding to the given class name.
-/// \param[in] class_name Class name to search for.
-/// \return Item definition corresponding to the given class name or NULL is not
-/// found.
-entity Item_FindDefinition(string class_name);
-
-/// \brief Checks whether the items with the specified class name are allowed to
-/// spawn.
-/// \param[in] class_name Item class name to check.
-/// \return True items with the specified class name are allowed to spawn, false
-/// otherwise.
-bool Item_IsAllowed(string class_name);
-
-/// \brief Checks whether the items with the specified definition are allowed to
-/// spawn.
-/// \param[in] definition Item definition to check.
-/// \return True items with the specified definition are allowed to spawn, false
-/// otherwise.
-bool Item_IsDefinitionAllowed(entity definition);
-
-/// \brief Creates a new item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] no_align True if item should be placed directly at specified
-/// position, false to let it drop to the ground.
-/// \return Item on success, NULL otherwise.
-entity Item_Create(string class_name, vector position, bool no_align);
-
-/// \brief Initializes the item according to class name.
-/// \param[in,out] item Item to initialize.
-/// \param[in] class_name Class name to use.
-/// \return No return.
-/// \nore This function is useful if you want to set some item properties before
-/// initialization.
-void Item_Initialize(entity item, string class_name);
-
-/// \brief Creates a loot item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] velocity of the item.
-/// \param[in] time_to_live Amount of time after which the item will disappear.
-/// \return Item on success, NULL otherwise.
-entity Item_CreateLoot(string class_name, vector position, vector vel,
-       float time_to_live);
-
-/// \brief Initializes the loot item.
-/// \param[in] class_name Class name of the item.
-/// \param[in] position Position of the item.
-/// \param[in] velocity of the item.
-/// \param[in] time_to_live Amount of time after which the item will disappear.
-/// \return True on success, false otherwise.
-/// \nore This function is useful if you want to set some item properties before
-/// initialization.
-bool Item_InitializeLoot(entity item, string class_name, vector position,
-       vector vel, float time_to_live);
-
-/// \brief Returns whether the item is loot.
-/// \param[in] item Item to check.
-/// \return True if the item is loot, false otherwise.
-bool Item_IsLoot(entity item);
-
-/// \brief Sets the item loot status.
-/// \param[in,out] item Item to adjust.
-/// \param[in] loot Whether item is loot.
-/// \return No return.
-void Item_SetLoot(entity item, bool loot);
-
-/// \brief Returns whether item should keep its position or be dropped to the
-/// ground.
-/// \param[in] item Item to check.
-/// \return True if item should keep its position or false if it should be
-/// dropped to the ground.
-bool Item_ShouldKeepPosition(entity item);
-
-/// \brief Returns whether the item is expiring (i.e. its strength, shield and
-/// superweapon timers expire while it is on the ground).
-/// \param[in] item Item to check.
-/// \return True if the item is expiring, false otherwise.
-bool Item_IsExpiring(entity item);
-
-/// \brief Sets the item expiring status (i.e. whether its strength, shield
-/// and superweapon timers expire while it is on the ground).
-/// \param[in,out] item Item to adjust.
-/// \param[in] expiring Whether item is expiring.
-/// \return No return.
-void Item_SetExpiring(entity item, bool expiring);
diff --git a/qcsrc/server/items/_mod.inc b/qcsrc/server/items/_mod.inc
new file mode 100644 (file)
index 0000000..9c55d0b
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include <server/items/spawning.qc>
diff --git a/qcsrc/server/items/_mod.qh b/qcsrc/server/items/_mod.qh
new file mode 100644 (file)
index 0000000..eb6ff1c
--- /dev/null
@@ -0,0 +1,2 @@
+// generated file; do not modify
+#include <server/items/spawning.qh>
diff --git a/qcsrc/server/items/spawning.qc b/qcsrc/server/items/spawning.qc
new file mode 100644 (file)
index 0000000..bbe6622
--- /dev/null
@@ -0,0 +1,148 @@
+#include "spawning.qh"
+
+/// \file
+/// \brief Source file that contains implementation of the functions related to
+/// creation of game items.
+/// \copyright GNU GPLv2 or any later version.
+
+#include <server/mutators/_mod.qh>
+#include <common/weapons/all.qh>
+#include <common/mapobjects/subs.qh>
+
+.bool m_isloot; ///< Holds whether item is loot.
+/// \brief Holds whether strength, shield or superweapon timers expire while
+/// this item is on the ground.
+.bool m_isexpiring;
+
+entity Item_FindDefinition(string class_name)
+{
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               return it;
+       });
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+       {
+               return it.m_pickup;
+       });
+       return NULL;
+}
+
+bool Item_IsAllowed(string class_name)
+{
+       entity definition = Item_FindDefinition(class_name);
+       if (definition == NULL)
+       {
+               return false;
+       }
+       return Item_IsDefinitionAllowed(definition);
+}
+
+bool Item_IsDefinitionAllowed(entity definition)
+{
+       return !MUTATOR_CALLHOOK(FilterItemDefinition, definition);
+}
+
+entity Item_Create(string class_name, vector position, bool no_align)
+{
+       entity item = spawn();
+       item.classname = class_name;
+       item.spawnfunc_checked = true;
+       setorigin(item, position);
+       item.noalign = no_align;
+       Item_Initialize(item, class_name);
+       if (wasfreed(item))
+       {
+               return NULL;
+       }
+       return item;
+}
+
+void Item_Initialize(entity item, string class_name)
+{
+       FOREACH(Weapons, it.m_canonical_spawnfunc == class_name,
+       {
+               weapon_defaultspawnfunc(item, it);
+               return;
+       });
+       FOREACH(Items, it.m_canonical_spawnfunc == class_name,
+       {
+               StartItem(item, it);
+               return;
+       });
+       LOG_FATALF("Item_Initialize: Invalid classname: %s", class_name);
+}
+
+entity Item_CreateLoot(string class_name, vector position, vector vel,
+       float time_to_live)
+{
+       entity item = spawn();
+       if (!Item_InitializeLoot(item, class_name, position, vel, time_to_live))
+       {
+               return NULL;
+       }
+       return item;
+}
+
+bool Item_InitializeLoot(entity item, string class_name, vector position,
+       vector vel, float time_to_live)
+{
+       item.classname = class_name;
+       Item_SetLoot(item, true);
+       item.noalign = true;
+       setorigin(item, position);
+       item.pickup_anyway = true;
+       item.spawnfunc_checked = true;
+       Item_Initialize(item, class_name);
+       if (wasfreed(item))
+       {
+               return false;
+       }
+       item.gravity = 1;
+       item.velocity = vel;
+       SUB_SetFade(item, time + time_to_live, 1);
+       return true;
+}
+
+bool Item_IsLoot(entity item)
+{
+       return item.m_isloot || item.classname == "droppedweapon";
+}
+
+void Item_SetLoot(entity item, bool loot)
+{
+       item.m_isloot = loot;
+}
+
+bool Item_ShouldKeepPosition(entity item)
+{
+       return item.noalign || (item.spawnflags & 1);
+}
+
+bool Item_IsExpiring(entity item)
+{
+       return item.m_isexpiring;
+}
+
+void Item_SetExpiring(entity item, bool expiring)
+{
+       item.m_isexpiring = expiring;
+}
+
+// Compatibility spawn functions
+
+// FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+SPAWNFUNC_ITEM(item_armor1, ITEM_ArmorSmall)
+
+SPAWNFUNC_ITEM(item_armor25, ITEM_ArmorMega)
+
+SPAWNFUNC_ITEM(item_armor_large, ITEM_ArmorMega)
+
+SPAWNFUNC_ITEM(item_health1, ITEM_HealthSmall)
+
+SPAWNFUNC_ITEM(item_health25, ITEM_HealthMedium)
+
+SPAWNFUNC_ITEM(item_health_large, ITEM_HealthBig)
+
+SPAWNFUNC_ITEM(item_health100, ITEM_HealthMega)
+
+SPAWNFUNC_ITEM(item_quad, ITEM_Strength)
diff --git a/qcsrc/server/items/spawning.qh b/qcsrc/server/items/spawning.qh
new file mode 100644 (file)
index 0000000..b52449e
--- /dev/null
@@ -0,0 +1,94 @@
+#pragma once
+
+/// \file
+/// \brief Header file that describes the functions related to game items.
+/// \copyright GNU GPLv2 or any later version.
+
+bool startitem_failed;
+
+/// \brief Returns the item definition corresponding to the given class name.
+/// \param[in] class_name Class name to search for.
+/// \return Item definition corresponding to the given class name or NULL is not
+/// found.
+entity Item_FindDefinition(string class_name);
+
+/// \brief Checks whether the items with the specified class name are allowed to
+/// spawn.
+/// \param[in] class_name Item class name to check.
+/// \return True items with the specified class name are allowed to spawn, false
+/// otherwise.
+bool Item_IsAllowed(string class_name);
+
+/// \brief Checks whether the items with the specified definition are allowed to
+/// spawn.
+/// \param[in] definition Item definition to check.
+/// \return True items with the specified definition are allowed to spawn, false
+/// otherwise.
+bool Item_IsDefinitionAllowed(entity definition);
+
+/// \brief Creates a new item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] no_align True if item should be placed directly at specified
+/// position, false to let it drop to the ground.
+/// \return Item on success, NULL otherwise.
+entity Item_Create(string class_name, vector position, bool no_align);
+
+/// \brief Initializes the item according to class name.
+/// \param[in,out] item Item to initialize.
+/// \param[in] class_name Class name to use.
+/// \return No return.
+/// \nore This function is useful if you want to set some item properties before
+/// initialization.
+void Item_Initialize(entity item, string class_name);
+
+/// \brief Creates a loot item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] velocity of the item.
+/// \param[in] time_to_live Amount of time after which the item will disappear.
+/// \return Item on success, NULL otherwise.
+entity Item_CreateLoot(string class_name, vector position, vector vel,
+       float time_to_live);
+
+/// \brief Initializes the loot item.
+/// \param[in] class_name Class name of the item.
+/// \param[in] position Position of the item.
+/// \param[in] velocity of the item.
+/// \param[in] time_to_live Amount of time after which the item will disappear.
+/// \return True on success, false otherwise.
+/// \nore This function is useful if you want to set some item properties before
+/// initialization.
+bool Item_InitializeLoot(entity item, string class_name, vector position,
+       vector vel, float time_to_live);
+
+/// \brief Returns whether the item is loot.
+/// \param[in] item Item to check.
+/// \return True if the item is loot, false otherwise.
+bool Item_IsLoot(entity item);
+
+/// \brief Sets the item loot status.
+/// \param[in,out] item Item to adjust.
+/// \param[in] loot Whether item is loot.
+/// \return No return.
+void Item_SetLoot(entity item, bool loot);
+
+/// \brief Returns whether item should keep its position or be dropped to the
+/// ground.
+/// \param[in] item Item to check.
+/// \return True if item should keep its position or false if it should be
+/// dropped to the ground.
+bool Item_ShouldKeepPosition(entity item);
+
+/// \brief Returns whether the item is expiring (i.e. its strength, shield and
+/// superweapon timers expire while it is on the ground).
+/// \param[in] item Item to check.
+/// \return True if the item is expiring, false otherwise.
+bool Item_IsExpiring(entity item);
+
+/// \brief Sets the item expiring status (i.e. whether its strength, shield
+/// and superweapon timers expire while it is on the ground).
+/// \param[in,out] item Item to adjust.
+/// \param[in] expiring Whether item is expiring.
+/// \return No return.
+void Item_SetExpiring(entity item, bool expiring);
index 39f26b9bfd9a62b7646650e7888dfba34f8a8a29..bb99abb4b9cde86c69f0211dd970cae3f82b9fb3 100644 (file)
@@ -10,7 +10,7 @@
 #include "../common/items.qh"
 #include "mapvoting.qh"
 #include "resources.qh"
-#include "items.qh"
+#include <server/items/spawning.qh>
 #include "player.qh"
 #include "weapons/accuracy.qh"
 #include "weapons/csqcprojectile.qh"
index 7e9354f7ddcf0a107d24822e206863d10283b938..94034bdbb8b26552f2909fdd6a666972dce50540 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "weaponsystem.qh"
 #include <common/items.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
 #include <common/util.qh>
index 56f81a8aaaccffc54ae351bc8a917fee157526ea..684ea842b94a026146495ffb22db41416a7d1c15 100644 (file)
@@ -4,7 +4,7 @@
 #include "../resources.qh"
 #include <server/mutators/_mod.qh>
 #include <common/items.qh>
-#include <server/items.qh>
+#include <server/items/spawning.qh>
 #include <common/weapons/_all.qh>
 
 .bool m_isreplaced; ///< Holds whether the weapon has been replaced.
index 8730cc1405b350f6930ecf43b42434d55cc34e36..d111a7a4fa7d6d9222cfd4f0b357eb3aaa3920d5 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "weaponsystem.qh"
 #include "../resources.qh"
-#include "../items.qh"
+#include <server/items/spawning.qh>
 #include <server/mutators/_mod.qh>
 #include <common/items.qh>
 #include "../g_damage.qh"