X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_items.qc;h=964b05e1bd2f69099745e91c212191d8f356b209;hb=05375be95785001ea4228a59f830308501e59b5e;hp=33232029e28a2a608ad42022da19f6471e051849;hpb=9a3b01ba5da2726001a5ed74645a15ce764a3675;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 33232029e..964b05e1b 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -5,9 +5,6 @@ #if defined(SVQC) #include "_all.qh" - #include "bot/bot.qh" - #include "bot/waypoints.qh" - #include "mutators/mutators_include.qh" #include "weapons/common.qh" @@ -28,8 +25,8 @@ #endif #ifdef CSQC -void ItemDraw() -{SELFPARAM(); +void ItemDraw(entity self) +{ if(self.gravity) { Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); @@ -64,8 +61,8 @@ void ItemDraw() } } -void ItemDrawSimple() -{SELFPARAM(); +void ItemDrawSimple(entity this) +{ if(self.gravity) { Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); @@ -246,8 +243,8 @@ void ItemRead(float _IsNew) #endif #ifdef SVQC -bool ItemSend(entity to, int sf) -{SELFPARAM(); +bool ItemSend(entity this, entity to, int sf) +{ if(self.gravity) sf |= ISF_DROP; else @@ -472,15 +469,24 @@ void Item_RespawnCountdown (void) if(self.count == 1) { MUTATOR_CALLHOOK(Item_RespawnCountdown, string_null, '0 0 0'); - int wpextra = 0; - entity e = self.itemdef; - if (e) wpextra = e.m_id; - if (self.flags & FL_WEAPON) { - entity wi = get_weaponinfo(self.weapon); - if (wi) wpextra = wi.m_id; - } - entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP); - wp.wp_extra = wpextra; + do { + { + entity wi = get_weaponinfo(self.weapon); + if (wi.m_id) { + entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon); + wp.wp_extra = wi.m_id; + break; + } + } + { + entity ii = self.itemdef; + if (ii.m_id) { + entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item); + wp.wp_extra = ii.m_id; + break; + } + } + } while (0); if(self.waypointsprite_attached) { GameItem def = self.itemdef; @@ -645,7 +651,7 @@ float Item_GiveTo(entity item, entity player) for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(it & WepSet_FromWeapon(i)) { - W_DropEvent(WR_PICKUP, player, i, item); + W_DropEvent(wr_pickup, player, i, item); W_GiveWeapon(player, i); } } @@ -1188,21 +1194,14 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, } } -string Item_Model(string item_mdl) -{ - string output = strcat("models/items/", item_mdl); - MUTATOR_CALLHOOK(ItemModel, item_mdl, output); - return strzone(item_model_output); -} - void StartItemA (entity a) {SELFPARAM(); self.itemdef = a; - StartItem(Item_Model(a.m_model), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue); + StartItem(strzone(a.m_model.model_str()), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue); } -void spawnfunc_item_rockets() -{SELFPARAM(); +spawnfunc(item_rockets) +{ if(!self.ammo_rockets) self.ammo_rockets = g_pickup_rockets; if(!self.pickup_anyway) @@ -1210,14 +1209,14 @@ void spawnfunc_item_rockets() StartItemA (ITEM_Rockets); } -void spawnfunc_item_bullets() -{SELFPARAM(); +spawnfunc(item_bullets) +{ if(!weaponswapping) if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weaponswapping = true; - spawnfunc_item_shells(); + spawnfunc_item_shells(this); weaponswapping = false; return; } @@ -1229,8 +1228,8 @@ void spawnfunc_item_bullets() StartItemA (ITEM_Bullets); } -void spawnfunc_item_cells() -{SELFPARAM(); +spawnfunc(item_cells) +{ if(!self.ammo_cells) self.ammo_cells = g_pickup_cells; if(!self.pickup_anyway) @@ -1238,8 +1237,8 @@ void spawnfunc_item_cells() StartItemA (ITEM_Cells); } -void spawnfunc_item_plasma() -{SELFPARAM(); +spawnfunc(item_plasma) +{ if(!self.ammo_plasma) self.ammo_plasma = g_pickup_plasma; if(!self.pickup_anyway) @@ -1247,14 +1246,14 @@ void spawnfunc_item_plasma() StartItemA (ITEM_Plasma); } -void spawnfunc_item_shells() -{SELFPARAM(); +spawnfunc(item_shells) +{ if(!weaponswapping) if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { weaponswapping = true; - spawnfunc_item_bullets(); + spawnfunc_item_bullets(this); weaponswapping = false; return; } @@ -1266,8 +1265,8 @@ void spawnfunc_item_shells() StartItemA (ITEM_Shells); } -void spawnfunc_item_armor_small() -{SELFPARAM(); +spawnfunc(item_armor_small) +{ if(!self.armorvalue) self.armorvalue = g_pickup_armorsmall; if(!self.max_armorvalue) @@ -1277,8 +1276,8 @@ void spawnfunc_item_armor_small() StartItemA (ITEM_ArmorSmall); } -void spawnfunc_item_armor_medium() -{SELFPARAM(); +spawnfunc(item_armor_medium) +{ if(!self.armorvalue) self.armorvalue = g_pickup_armormedium; if(!self.max_armorvalue) @@ -1288,8 +1287,8 @@ void spawnfunc_item_armor_medium() StartItemA (ITEM_ArmorMedium); } -void spawnfunc_item_armor_big() -{SELFPARAM(); +spawnfunc(item_armor_big) +{ if(!self.armorvalue) self.armorvalue = g_pickup_armorbig; if(!self.max_armorvalue) @@ -1299,8 +1298,8 @@ void spawnfunc_item_armor_big() StartItemA (ITEM_ArmorLarge); } -void spawnfunc_item_armor_large() -{SELFPARAM(); +spawnfunc(item_armor_large) +{ if(!self.armorvalue) self.armorvalue = g_pickup_armorlarge; if(!self.max_armorvalue) @@ -1310,8 +1309,8 @@ void spawnfunc_item_armor_large() StartItemA (ITEM_ArmorMega); } -void spawnfunc_item_health_small() -{SELFPARAM(); +spawnfunc(item_health_small) +{ if(!self.max_health) self.max_health = g_pickup_healthsmall_max; if(!self.health) @@ -1321,8 +1320,8 @@ void spawnfunc_item_health_small() StartItemA (ITEM_HealthSmall); } -void spawnfunc_item_health_medium() -{SELFPARAM(); +spawnfunc(item_health_medium) +{ if(!self.max_health) self.max_health = g_pickup_healthmedium_max; if(!self.health) @@ -1332,8 +1331,8 @@ void spawnfunc_item_health_medium() StartItemA (ITEM_HealthMedium); } -void spawnfunc_item_health_large() -{SELFPARAM(); +spawnfunc(item_health_large) +{ if(!self.max_health) self.max_health = g_pickup_healthlarge_max; if(!self.health) @@ -1343,8 +1342,8 @@ void spawnfunc_item_health_large() StartItemA (ITEM_HealthLarge); } -void spawnfunc_item_health_mega() -{SELFPARAM(); +spawnfunc(item_health_mega) +{ if(!self.max_health) self.max_health = g_pickup_healthmega_max; if(!self.health) @@ -1355,28 +1354,28 @@ void spawnfunc_item_health_mega() } // support old misnamed entities -void spawnfunc_item_armor1() { spawnfunc_item_armor_small(); } // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard -void spawnfunc_item_armor25() { spawnfunc_item_armor_large(); } -void spawnfunc_item_health1() { spawnfunc_item_health_small(); } -void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } -void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } +spawnfunc(item_armor1) { spawnfunc_item_armor_small(this); } // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard +spawnfunc(item_armor25) { spawnfunc_item_armor_large(this); } +spawnfunc(item_health1) { spawnfunc_item_health_small(this); } +spawnfunc(item_health25) { spawnfunc_item_health_medium(this); } +spawnfunc(item_health100) { spawnfunc_item_health_mega(this); } -void spawnfunc_item_strength() -{SELFPARAM(); +spawnfunc(item_strength) +{ if(!self.strength_finished) self.strength_finished = autocvar_g_balance_powerup_strength_time; StartItemA (ITEM_Strength); } -void spawnfunc_item_invincible() -{SELFPARAM(); +spawnfunc(item_invincible) +{ if(!self.invincible_finished) self.invincible_finished = autocvar_g_balance_powerup_invincible_time; StartItemA (ITEM_Shield); } // compatibility: -void spawnfunc_item_quad() {SELFPARAM(); self.classname = "item_strength";spawnfunc_item_strength();} +spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);} void target_items_use() {SELFPARAM(); @@ -1402,8 +1401,8 @@ void target_items_use() centerprint(activator, self.message); } -void spawnfunc_target_items (void) -{SELFPARAM(); +spawnfunc(target_items) +{ float n, i, j; entity e; string s; @@ -1442,8 +1441,10 @@ void spawnfunc_target_items (void) if(s == e.netname) { self.weapons |= WepSet_FromWeapon(j); - if(self.spawnflags == 0 || self.spawnflags == 2) - WEP_ACTION(e.weapon, WR_INIT); + if(self.spawnflags == 0 || self.spawnflags == 2) { + Weapon w = get_weaponinfo(e.weapon); + w.wr_init(w); + } break; } } @@ -1513,15 +1514,16 @@ void spawnfunc_target_items (void) e = get_weaponinfo(j); if(argv(i) == e.netname) { - WEP_ACTION(e.weapon, WR_INIT); + Weapon w = get_weaponinfo(e.weapon); + w.wr_init(w); break; } } } } -void spawnfunc_item_fuel(void) -{SELFPARAM(); +spawnfunc(item_fuel) +{ if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel; if(!self.pickup_anyway) @@ -1529,23 +1531,23 @@ void spawnfunc_item_fuel(void) StartItemA (ITEM_JetpackFuel); } -void spawnfunc_item_fuel_regen(void) +spawnfunc(item_fuel_regen) { if(start_items & ITEM_JetpackRegen.m_itemid) { - spawnfunc_item_fuel(); + spawnfunc_item_fuel(this); return; } StartItemA (ITEM_JetpackRegen); } -void spawnfunc_item_jetpack(void) -{SELFPARAM(); +spawnfunc(item_jetpack) +{ if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel_jetpack; if(start_items & ITEM_Jetpack.m_itemid) { - spawnfunc_item_fuel(); + spawnfunc_item_fuel(this); return; } StartItemA (ITEM_Jetpack); @@ -1826,8 +1828,10 @@ float GiveItems(entity e, float beginarg, float endarg) { POSTGIVE_WEAPON(e, j, SND(WEAPONPICKUP), string_null); if (!(save_weapons & WepSet_FromWeapon(j))) - if(e.weapons & WepSet_FromWeapon(j)) - WEP_ACTION(wi.weapon, WR_INIT); + if(e.weapons & WepSet_FromWeapon(j)) { + Weapon w = get_weaponinfo(wi.weapon); + w.wr_init(w); + } } } POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));