From 5e38af0dbb859633140b764cb44e4b9467fe189d Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 8 Oct 2017 21:43:47 +1100 Subject: [PATCH] Fix compilation units --- qcsrc/common/items/inventory.qh | 3 +-- qcsrc/common/items/item.qh | 3 ++- qcsrc/common/items/item/ammo.qh | 13 +++++++++++ qcsrc/common/items/item/pickup.qc | 14 +++++++++++ qcsrc/common/items/item/pickup.qh | 20 +--------------- qcsrc/common/mutators/mutator/overkill/hmg.qh | 2 ++ qcsrc/common/mutators/mutator/overkill/rpc.qh | 2 ++ .../mutators/mutator/overkill/sv_overkill.qc | 23 +++++++------------ qcsrc/common/stats.qh | 1 + qcsrc/common/t_items.qh | 4 ---- qcsrc/common/weapons/weapon.qh | 18 --------------- qcsrc/server/compat/quake2.qc | 2 ++ qcsrc/server/defs.qh | 1 - qcsrc/server/items.qc | 5 ++-- qcsrc/server/items.qh | 2 -- 15 files changed, 48 insertions(+), 65 deletions(-) diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index a022979a7..852007501 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -1,7 +1,6 @@ #pragma once #include "all.qh" -#include "item/pickup.qh" CLASS(Inventory, Object) /** Stores counts of items, the id being the index */ @@ -81,7 +80,7 @@ void Inventory_Write(Inventory data) if (!(minorBits & BIT(j))) { \ continue; \ } \ - const GameItem it = Items_from(Inventory_groups_minor * maj + j); \ + const entity it = Items_from(Inventory_groups_minor * maj + j); \ WriteByte(MSG_ENTITY, data.inv_items[it.m_id]); \ } \ } \ diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index d5b25c436..6ec6dd8a4 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -1,9 +1,10 @@ #pragma once -#include #ifdef GAMEQC +#include #include #include +#include #endif const int IT_UNLIMITED_WEAPON_AMMO = BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. diff --git a/qcsrc/common/items/item/ammo.qh b/qcsrc/common/items/item/ammo.qh index b9b6fc158..cc3cfe064 100644 --- a/qcsrc/common/items/item/ammo.qh +++ b/qcsrc/common/items/item/ammo.qh @@ -5,6 +5,19 @@ #include #endif +.int ammo_none; +.int ammo_shells; +.int ammo_nails; +.int ammo_rockets; +.int ammo_cells; +#ifdef SVQC +.int ammo_plasma = _STAT(PLASMA); +.int ammo_fuel = _STAT(FUEL); +#else +.int ammo_plasma; +.int ammo_fuel; +#endif + #ifdef SVQC PROPERTY(float, g_pickup_ammo_anyway); #endif diff --git a/qcsrc/common/items/item/pickup.qc b/qcsrc/common/items/item/pickup.qc index fc958709e..b5944fc0a 100644 --- a/qcsrc/common/items/item/pickup.qc +++ b/qcsrc/common/items/item/pickup.qc @@ -1,7 +1,21 @@ #include "pickup.qh" +#include #ifdef SVQC bool ITEM_HANDLE(Pickup, entity this, entity item, entity player) { return this.giveTo(this, item, player); } + +METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player)) +{ + TC(Pickup, this); + bool b = Item_GiveTo(item, player); + if (b) { + LOG_DEBUGF("entity %i picked up %s", player, this.m_name); + player.inventory.inv_items[this.m_id]++; + Inventory_update(player); + } + return b; +} + #endif diff --git a/qcsrc/common/items/item/pickup.qh b/qcsrc/common/items/item/pickup.qh index 39cf78cc3..fb4bc28cd 100644 --- a/qcsrc/common/items/item/pickup.qh +++ b/qcsrc/common/items/item/pickup.qh @@ -17,15 +17,7 @@ PROPERTY(float, g_pickup_respawntimejitter_long) PROPERTY(float, g_pickup_respawntimejitter_powerup) #endif -#include #include -#include - -#ifdef GAMEQC -#include -#include -#include -#endif CLASS(Pickup, GameItem) #ifdef GAMEQC @@ -52,17 +44,7 @@ CLASS(Pickup, GameItem) ATTRIB(Pickup, m_pickupanyway, float()); ATTRIB(Pickup, m_iteminit, void(entity item)); float Item_GiveTo(entity item, entity player); - METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player)) - { - TC(Pickup, this); - bool b = Item_GiveTo(item, player); - if (b) { - LOG_DEBUGF("entity %i picked up %s", player, this.m_name); - player.inventory.inv_items[this.m_id]++; - Inventory_update(player); - } - return b; - } + METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player)); bool ITEM_HANDLE(Pickup, Pickup this, entity item, entity player); #endif ENDCLASS(Pickup) diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qh b/qcsrc/common/mutators/mutator/overkill/hmg.qh index 49457fb76..99c809397 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qh +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qh @@ -1,5 +1,7 @@ #pragma once +#include + CLASS(HeavyMachineGun, Weapon) /* spawnfunc */ ATTRIB(HeavyMachineGun, m_canonical_spawnfunc, string, "weapon_hmg"); /* ammotype */ ATTRIB(HeavyMachineGun, ammo_type, int, RESOURCE_BULLETS); diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qh b/qcsrc/common/mutators/mutator/overkill/rpc.qh index a6891a05d..78d5de51a 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qh +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qh @@ -1,5 +1,7 @@ #pragma once +#include + CLASS(RocketPropelledChainsaw, Weapon) /* spawnfunc */ ATTRIB(RocketPropelledChainsaw, m_canonical_spawnfunc, string, "weapon_rpc"); /* ammotype */ ATTRIB(RocketPropelledChainsaw, ammo_type, int, RESOURCE_ROCKETS); diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 734a14bae..6b32ec352 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -11,13 +11,18 @@ bool autocvar_g_overkill_itemwaypoints = true; .Weapon ok_lastwep[MAX_WEAPONSLOTS]; -void ok_Initialize(); - REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill") { MUTATOR_ONADD { - ok_Initialize(); + precache_all_playermodels("models/ok_player/*.dpm"); + + WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; + WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; + + WEP_SHOTGUN.mdl = "ok_shotgun"; + WEP_MACHINEGUN.mdl = "ok_mg"; + WEP_VORTEX.mdl = "ok_sniper"; } MUTATOR_ONREMOVE @@ -285,15 +290,3 @@ MUTATOR_HOOKFUNCTION(ok, SetModname) M_ARGV(0, string) = "Overkill"; return true; } - -void ok_Initialize() -{ - precache_all_playermodels("models/ok_player/*.dpm"); - - WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; - WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED; - - WEP_SHOTGUN.mdl = "ok_shotgun"; - WEP_MACHINEGUN.mdl = "ok_mg"; - WEP_VORTEX.mdl = "ok_sniper"; -} diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 94e408d7f..71149463c 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -295,6 +295,7 @@ REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity) #ifdef SVQC #include "physics/movetypes/movetypes.qh" +float warmup_limit; #endif REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float) diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index 7eb863e32..5ecbe5488 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -1,9 +1,5 @@ #pragma once -#ifdef SVQC -#include -#endif - const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index fa62ffbd3..b5f542928 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -37,24 +37,6 @@ const int WS_INUSE = 3; /** idle frame */ const int WS_READY = 4; -#ifdef SVQC -.int ammo_shells; -.int ammo_nails; -.int ammo_rockets; -.int ammo_cells; -.int ammo_plasma = _STAT(PLASMA); -.int ammo_fuel = _STAT(FUEL); -.int ammo_none; -#else -.int ammo_shells; -.int ammo_nails; -.int ammo_rockets; -.int ammo_cells; -.int ammo_plasma; -.int ammo_fuel; -.int ammo_none; -#endif - /** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */ CLASS(Weapon, Object) ATTRIB(Weapon, m_id, int, 0); diff --git a/qcsrc/server/compat/quake2.qc b/qcsrc/server/compat/quake2.qc index 323127764..19f9ebf40 100644 --- a/qcsrc/server/compat/quake2.qc +++ b/qcsrc/server/compat/quake2.qc @@ -1,5 +1,7 @@ #include "quake2.qh" +#include + //*********************** //QUAKE 2 ENTITIES - So people can play quake2 maps with the xonotic weapons //*********************** diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 4c3b1d221..08a4a726b 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -1,6 +1,5 @@ #pragma once -float warmup_limit; #include #include diff --git a/qcsrc/server/items.qc b/qcsrc/server/items.qc index 6a0593282..23124730f 100644 --- a/qcsrc/server/items.qc +++ b/qcsrc/server/items.qc @@ -5,9 +5,8 @@ /// game items. /// \copyright GNU GPLv2 or any later version. -#include -#include -#include +#include "g_subs.qh" +#include .bool m_isloot; ///< Holds whether item is loot. diff --git a/qcsrc/server/items.qh b/qcsrc/server/items.qh index f7e301365..6544336d9 100644 --- a/qcsrc/server/items.qh +++ b/qcsrc/server/items.qh @@ -3,8 +3,6 @@ /// \brief Header file that describes the functions related to game items. /// \copyright GNU GPLv2 or any later version. -#pragma once - /// \brief Creates a new item. /// \param[in] class_name Class name of the item. /// \param[in] position Position of the item. -- 2.39.2