X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_items.qc;h=238c6cec506240d758fb262853bb3345f7b9dbf4;hb=ac5366add2c2d44bff2e03fc916b991eb009a10a;hp=69223cc020b80411e9c3fad67e12fcd0dac8fd9d;hpb=7ed6b5adc348af2a7094c85517e824c04e2005cd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 69223cc02..238c6cec5 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1,36 +1,64 @@ +#define ISF_LOCATION 2 +#define ISF_MODEL 4 +#define ISF_STATUS 8 + #define ITS_STAYWEP 1 + #define ITS_ANIMATE1 2 + #define ITS_ANIMATE2 4 + #define ITS_AVAILABLE 8 + #define ITS_ALLOWFB 16 + #define ITS_ALLOWSI 32 + #define ITS_POWERUP 64 +#define ISF_COLORMAP 16 +#define ISF_DROP 32 +#define ISF_ANGLES 64 + +.float ItemStatus; + #ifdef CSQC + +var float autocvar_cl_animate_items = 1; +var float autocvar_cl_ghost_items = 0.45; +var vector autocvar_cl_ghost_items_color = '-1 -1 -1'; +var float autocvar_cl_fullbright_items = 0; +var vector autocvar_cl_weapon_stay_color = '2 0.5 0.5'; +var float autocvar_cl_weapon_stay_alpha = 0.75; +var float autocvar_cl_simple_items = 0; +var string autocvar_cl_simpleitems_postfix = "_simple"; +.float spawntime; +.float gravity; +.vector colormod; void ItemDraw() -{ +{ if(self.gravity) - { + { Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); - if(self.move_flags & FL_ONGROUND) + if(self.move_flags & FL_ONGROUND) { // For some reason move_avelocity gets set to '0 0 0' here ... self.oldorigin = self.origin; self.gravity = 0; - if(autocvar_cl_animate_items) - { // ... so reset it if animations are requested. + if(autocvar_cl_animate_items) + { // ... so reset it if animations are requested. if(self.ItemStatus & ITS_ANIMATE1) self.move_avelocity = '0 180 0'; - + if(self.ItemStatus & ITS_ANIMATE2) self.move_avelocity = '0 -90 0'; } } } else if (autocvar_cl_animate_items) - { + { if(self.ItemStatus & ITS_ANIMATE1) { self.angles += self.move_avelocity * frametime; - setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2)); - } - + setorigin(self, '0 0 10' + self.oldorigin + '0 0 8' * sin(time * 2)); + } + if(self.ItemStatus & ITS_ANIMATE2) { self.angles += self.move_avelocity * frametime; - setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3)); + setorigin(self, '0 0 8' + self.oldorigin + '0 0 4' * sin(time * 3)); } } } @@ -38,9 +66,9 @@ void ItemDraw() void ItemDrawSimple() { if(self.gravity) - { - Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); - + { + Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); + if(self.move_flags & FL_ONGROUND) self.gravity = 0; } @@ -58,19 +86,19 @@ void ItemRead(float _IsNew) setorigin(self, self.origin); self.oldorigin = self.origin; } - - if(sf & ISF_ANGLES) + + if(sf & ISF_ANGLES) { self.angles_x = ReadCoord(); self.angles_y = ReadCoord(); - self.angles_z = ReadCoord(); + self.angles_z = ReadCoord(); self.move_angles = self.angles; } - + if(sf & ISF_STATUS) // need to read/write status frist so model can handle simple, fb etc. { - self.ItemStatus = ReadByte(); - + self.ItemStatus = ReadByte(); + if(self.ItemStatus & ITS_AVAILABLE) { self.alpha = 1; @@ -85,19 +113,19 @@ void ItemRead(float _IsNew) } else self.alpha = -1; - } - + } + if(autocvar_cl_fullbright_items) if(self.ItemStatus & ITS_ALLOWFB) self.effects |= EF_FULLBRIGHT; - + if(self.ItemStatus & ITS_STAYWEP) { self.colormod = self.glowmod = autocvar_cl_weapon_stay_color; self.alpha = autocvar_cl_weapon_stay_alpha; - + } - + if(self.ItemStatus & ITS_POWERUP) { if(self.ItemStatus & ITS_AVAILABLE) @@ -106,55 +134,55 @@ void ItemRead(float _IsNew) self.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT); } } - + if(sf & ISF_MODEL) { self.drawmask = MASK_NORMAL; self.movetype = MOVETYPE_NOCLIP; self.draw = ItemDraw; - + if(self.mdl) strunzone(self.mdl); - + self.mdl = ""; string _fn = ReadString(); - + if(autocvar_cl_simple_items && (self.ItemStatus & ITS_ALLOWSI)) { string _fn2 = substring(_fn, 0 , strlen(_fn) -4); self.draw = ItemDrawSimple; - - - - if(fexists(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix))) - self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvr_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.dpm", _fn2, autocvr_cl_simpleitems_postfix))) - self.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvr_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.iqm", _fn2, autocvr_cl_simpleitems_postfix))) - self.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvr_cl_simpleitems_postfix)); - else if(fexists(sprintf("%s%s.obj", _fn2, autocvr_cl_simpleitems_postfix))) - self.mdl = strzone(sprintf("%s%s.obj", _fn2, autocvr_cl_simpleitems_postfix)); + + + + if(fexists(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix))) + self.mdl = strzone(sprintf("%s%s.md3", _fn2, autocvar_cl_simpleitems_postfix)); + else if(fexists(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix))) + self.mdl = strzone(sprintf("%s%s.dpm", _fn2, autocvar_cl_simpleitems_postfix)); + else if(fexists(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix))) + self.mdl = strzone(sprintf("%s%s.iqm", _fn2, autocvar_cl_simpleitems_postfix)); + else if(fexists(sprintf("%s%s.obj", _fn2, autocvar_cl_simpleitems_postfix))) + self.mdl = strzone(sprintf("%s%s.obj", _fn2, autocvar_cl_simpleitems_postfix)); else { self.draw = ItemDraw; dprint("Simple item requested for ", _fn, " but no model exsist for it\n"); } } - - if(self.draw != ItemDrawSimple) - self.mdl = strzone(_fn); - - + + if(self.draw != ItemDrawSimple) + self.mdl = strzone(_fn); + + if(self.mdl == "") dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, " tell tZork aboute this!\n"); - + precache_model(self.mdl); setmodel(self, self.mdl); } - + if(sf & ISF_COLORMAP) self.colormap = ReadShort(); - + if(sf & ISF_DROP) { self.gravity = 1; @@ -165,7 +193,7 @@ void ItemRead(float _IsNew) self.move_velocity_z = ReadCoord(); self.velocity = self.move_velocity; self.move_origin = self.oldorigin; - + if(!self.move_time) { self.move_time = time; @@ -174,12 +202,12 @@ void ItemRead(float _IsNew) else self.move_time = max(self.move_time, time); } - + if(autocvar_cl_animate_items) - { + { if(self.ItemStatus & ITS_ANIMATE1) self.move_avelocity = '0 180 0'; - + if(self.ItemStatus & ITS_ANIMATE2) self.move_avelocity = '0 -90 0'; } @@ -188,14 +216,15 @@ void ItemRead(float _IsNew) #endif #ifdef SVQC +float autocvar_sv_simple_items; float ItemSend(entity to, float sf) { if(self.gravity) sf |= ISF_DROP; else sf &= ~ISF_DROP; - - WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM); + + WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM); WriteByte(MSG_ENTITY, sf); //WriteByte(MSG_ENTITY, self.cnt); @@ -205,7 +234,7 @@ float ItemSend(entity to, float sf) WriteCoord(MSG_ENTITY, self.origin_y); WriteCoord(MSG_ENTITY, self.origin_z); } - + if(sf & ISF_ANGLES) { WriteCoord(MSG_ENTITY, self.angles_x); @@ -218,14 +247,14 @@ float ItemSend(entity to, float sf) if(sf & ISF_MODEL) { - + if(self.mdl == "") dprint("^1WARNING!^7 self.mdl is unset for item ", self.classname, "exspect a crash just aboute now\n"); - + WriteString(MSG_ENTITY, self.mdl); } - - + + if(sf & ISF_COLORMAP) WriteShort(MSG_ENTITY, self.colormap); @@ -235,10 +264,14 @@ float ItemSend(entity to, float sf) WriteCoord(MSG_ENTITY, self.velocity_y); WriteCoord(MSG_ENTITY, self.velocity_z); } - + return TRUE; } +void ItemUpdate(entity item) +{ + item.SendFlags |= ISF_LOCATION; +} float have_pickup_item(void) { @@ -262,6 +295,13 @@ float have_pickup_item(void) return TRUE; } +#define ITEM_RESPAWN_TICKS 10 + +#define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter) + // range: respawntime - respawntimejitter .. respawntime + respawntimejitter +#define ITEM_RESPAWNTIME_INITIAL(i) (ITEM_RESPAWN_TICKS + random() * ((i).respawntime + (i).respawntimejitter - ITEM_RESPAWN_TICKS)) + // range: 10 .. respawntime + respawntimejitter + floatfield Item_CounterField(float it) { switch(it) @@ -304,6 +344,8 @@ string Item_CounterFieldName(float it) #endif } +.float max_armorvalue; +.float pickup_anyway; /* float Item_Customize() { @@ -332,7 +374,7 @@ float Item_Customize() */ void Item_Show (entity e, float mode) -{ +{ e.effects &= ~(EF_ADDITIVE | EF_STARDUST | EF_FULLBRIGHT | EF_NODEPTHTEST); e.ItemStatus &= ~ITS_STAYWEP; if (mode > 0) @@ -369,17 +411,17 @@ void Item_Show (entity e, float mode) e.spawnshieldtime = 1; e.ItemStatus &= ~ITS_AVAILABLE; } - + if (e.items & IT_STRENGTH || e.items & IT_INVINCIBLE) - e.ItemStatus |= ITS_POWERUP; - + e.ItemStatus |= ITS_POWERUP; + if (autocvar_g_nodepthtestitems) e.effects |= EF_NODEPTHTEST; - - + + if (autocvar_g_fullbrightitems) e.ItemStatus |= ITS_ALLOWFB; - + if (autocvar_sv_simple_items) e.ItemStatus |= ITS_ALLOWSI; @@ -495,6 +537,10 @@ void Item_ScheduleInitialRespawn(entity e) Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e)); } +const float ITEM_MODE_NONE = 0; +const float ITEM_MODE_HEALTH = 1; +const float ITEM_MODE_ARMOR = 2; +const float ITEM_MODE_FUEL = 3; float Item_GiveAmmoTo(entity item, entity player, .float ammofield, float ammomax, float mode) { if (!item.ammofield) @@ -555,7 +601,7 @@ float Item_GiveTo(entity item, entity player) if (player.switchweapon == w_getbestweapon(player)) _switchweapon = TRUE; - if not(player.weapons & WepSet_FromWeapon(player.switchweapon)) + if (!(player.weapons & WepSet_FromWeapon(player.switchweapon))) _switchweapon = TRUE; pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL); @@ -605,7 +651,7 @@ float Item_GiveTo(entity item, entity player) } :skip - + // always eat teamed entities if(item.team) pickedup = TRUE; @@ -623,7 +669,7 @@ float Item_GiveTo(entity item, entity player) void Item_Touch (void) { entity e, head; - + // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky) if(self.classname == "droppedweapon") { @@ -634,7 +680,7 @@ void Item_Touch (void) } } - if not(IS_PLAYER(other)) + if (!IS_PLAYER(other)) return; if (other.deadflag) return; @@ -642,6 +688,8 @@ void Item_Touch (void) return; if (self.owner == other) return; + if (time < self.item_spawnshieldtime) + return; switch(MUTATOR_CALLHOOK(ItemTouch)) { @@ -677,7 +725,7 @@ void Item_Touch (void) if (self.classname == "droppedweapon") remove (self); - else if not(self.spawnshieldtime) + else if (!self.spawnshieldtime) return; else { @@ -823,7 +871,7 @@ float commodity_pickupevalfunc(entity player, entity item) { wi = get_weaponinfo(i); - if not(player.weapons & WepSet_FromWeapon(i)) + if (!(player.weapons & WepSet_FromWeapon(i))) continue; if(wi.items & IT_SHELLS) @@ -877,22 +925,23 @@ void Item_Damage(entity inflictor, entity attacker, float damage, float deathtyp RemoveItem(); } +.float is_item; void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue) { startitem_failed = FALSE; if(self.model == "") self.model = itemmodel; - + if(self.model == "") { error(strcat("^1Tried to spawn ", itemname, " with no model!\n")); return; } - + if(self.item_pickupsound == "") self.item_pickupsound = pickupsound; - + if(!self.respawntime) // both need to be set { self.respawntime = defaultrespawntime; @@ -904,7 +953,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, if(weaponid) self.weapons = WepSet_FromWeapon(weaponid); - + self.flags = FL_ITEM | itemflags; if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item @@ -962,7 +1011,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, remove (self); return; } - + if(self.angles != '0 0 0') self.SendFlags |= ISF_ANGLES; @@ -1043,8 +1092,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.netname = itemname; self.touch = Item_Touch; setmodel(self, "null"); // precision set below - //self.effects |= EF_LOWPRECISION; - + //self.effects |= EF_LOWPRECISION; + if((itemflags & FL_POWERUP) || self.health || self.armorvalue) { self.pos1 = '-16 -16 0'; @@ -1056,20 +1105,20 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.pos2 = '16 16 32'; } setsize (self, self.pos1, self.pos2); - - if(itemflags & FL_POWERUP) + + if(itemflags & FL_POWERUP) self.ItemStatus |= ITS_ANIMATE1; - + if(self.armorvalue || self.health) self.ItemStatus |= ITS_ANIMATE2; - + if(itemflags & FL_WEAPON) { if (self.classname != "droppedweapon") // if dropped, colormap is already set up nicely self.colormap = 1024; // color shirt=0 pants=0 grey else self.gravity = 1; - + self.ItemStatus |= ITS_ANIMATE1; self.ItemStatus |= ISF_COLORMAP; } @@ -1079,13 +1128,13 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, { if(!self.cnt) self.cnt = 1; // item probability weight - + self.effects |= EF_NODRAW; // marker for item team search InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET); } else Item_Reset(); - + Net_LinkEntity(self, FALSE, 0, ItemSend); // call this hook after everything else has been done @@ -1096,6 +1145,183 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, return; } } + +float weaponswapping; +float internalteam; + +void weapon_defaultspawnfunc(float wpn) +{ + entity e; + float t; + var .float ammofield; + string s; + entity oldself; + float i, j; + float f; + + if(self.classname != "droppedweapon" && self.classname != "replacedweapon") + { + e = get_weaponinfo(wpn); + + if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED) + { + objerror("Attempted to spawn a mutator-blocked weapon rejected"); + startitem_failed = TRUE; + return; + } + + s = W_Apply_Weaponreplace(e.netname); + ret_string = s; + other = e; + MUTATOR_CALLHOOK(SetWeaponreplace); + s = ret_string; + if(s == "") + { + remove(self); + startitem_failed = TRUE; + return; + } + t = tokenize_console(s); + if(t >= 2) + { + self.team = --internalteam; + oldself = self; + for(i = 1; i < t; ++i) + { + s = argv(i); + for(j = WEP_FIRST; j <= WEP_LAST; ++j) + { + e = get_weaponinfo(j); + if(e.netname == s) + { + self = spawn(); + copyentity(oldself, self); + self.classname = "replacedweapon"; + weapon_defaultspawnfunc(j); + break; + } + } + if(j > WEP_LAST) + { + print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n"); + } + } + self = oldself; + } + if(t >= 1) // always the case! + { + s = argv(0); + wpn = 0; + for(j = WEP_FIRST; j <= WEP_LAST; ++j) + { + e = get_weaponinfo(j); + if(e.netname == s) + { + wpn = j; + break; + } + } + if(j > WEP_LAST) + { + print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n"); + } + } + if(wpn == 0) + { + remove(self); + startitem_failed = TRUE; + return; + } + } + + e = get_weaponinfo(wpn); + + if(!self.respawntime) + { + if(e.weapons & WEPSET_SUPERWEAPONS) + { + self.respawntime = g_pickup_respawntime_superweapon; + self.respawntimejitter = g_pickup_respawntimejitter_superweapon; + } + else + { + self.respawntime = g_pickup_respawntime_weapon; + self.respawntimejitter = g_pickup_respawntimejitter_weapon; + } + } + + if(e.weapons & WEPSET_SUPERWEAPONS) + if(!self.superweapons_finished) + self.superweapons_finished = autocvar_g_balance_superweapons_time; + + if(e.items) + { + for(i = 0, j = 1; i < 24; ++i, j *= 2) + { + if(e.items & j) + { + ammofield = Item_CounterField(j); + if(!self.ammofield) + self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon")); + } + } + } + + // pickup anyway + if(g_pickup_weapons_anyway) + self.pickup_anyway = TRUE; + + f = FL_WEAPON; + + // no weapon-stay on superweapons + if(e.weapons & WEPSET_SUPERWEAPONS) + f |= FL_NO_WEAPON_STAY; + + // weapon stay isn't supported for teamed weapons + if(self.team) + f |= FL_NO_WEAPON_STAY; + + StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, 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(autocvar_sv_q3acompat_machineshotgunswap) + if(self.classname != "droppedweapon") + { + weapon_defaultspawnfunc(WEP_SHOTGUN); + return; + } + weapon_defaultspawnfunc(WEP_UZI); +} + +void spawnfunc_weapon_shotgun (void) { + if(autocvar_sv_q3acompat_machineshotgunswap) + if(self.classname != "droppedweapon") + { + weapon_defaultspawnfunc(WEP_UZI); + return; + } + weapon_defaultspawnfunc(WEP_SHOTGUN); +} + +void spawnfunc_weapon_nex (void) +{ + weapon_defaultspawnfunc(WEP_NEX); +} + +void spawnfunc_weapon_minstanex (void) +{ + weapon_defaultspawnfunc(WEP_MINSTANEX); +} + +void spawnfunc_weapon_rocketlauncher (void) +{ + weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER); +} + void spawnfunc_item_rockets (void) { if(!self.ammo_rockets) self.ammo_rockets = g_pickup_rockets; @@ -1252,6 +1478,7 @@ void spawnfunc_item_invincible (void) { // compatibility: void spawnfunc_item_quad (void) {self.classname = "item_strength";spawnfunc_item_strength();} +float GiveItems(entity e, float beginarg, float endarg); void target_items_use (void) { if(activator.classname == "droppedweapon") @@ -1261,7 +1488,7 @@ void target_items_use (void) return; } - if not(IS_PLAYER(activator)) + if (!IS_PLAYER(activator)) return; if(activator.deadflag != DEAD_NO) return; @@ -1322,7 +1549,7 @@ void spawnfunc_target_items (void) { self.weapons |= WepSet_FromWeapon(j); if(self.spawnflags == 0 || self.spawnflags == 2) - WEP_ACTION(e.weapon, WR_INIT); + weapon_action(e.weapon, WR_PRECACHE); break; } } @@ -1394,7 +1621,7 @@ void spawnfunc_target_items (void) e = get_weaponinfo(j); if(argv(i) == e.netname) { - WEP_ACTION(e.weapon, WR_INIT); + weapon_action(e.weapon, WR_PRECACHE); break; } } @@ -1434,6 +1661,13 @@ void spawnfunc_item_jetpack(void) StartItem ("models/items/g_jetpack.md3", "misc/itempickup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Jet pack", IT_JETPACK, 0, FL_POWERUP, commodity_pickupevalfunc, BOT_PICKUP_RATING_LOW); } + +#define OP_SET 0 +#define OP_MIN 1 +#define OP_MAX 2 +#define OP_PLUS 3 +#define OP_MINUS 4 + float GiveWeapon(entity e, float wpn, float op, float val) { WepSet v0, v1; @@ -1543,6 +1777,14 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa else if(v0 > v1) e.regenfield = max(e.regenfield, time + regentime); } + +#define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = e.weapons +#define PREGIVE(e,f) float save_##f; save_##f = (e).f +#define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), !!(save_weapons & WepSet_FromWeapon(b)), !!(e.weapons & WepSet_FromWeapon(b)), 0, snd_incr, snd_decr) +#define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr) +#define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr) +#define POSTGIVE_VALUE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e), save_##f, (e).f, rotfield, rottime, regenfield, regentime); GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr) + float GiveItems(entity e, float beginarg, float endarg) { float got, i, j, val, op; @@ -1563,7 +1805,7 @@ float GiveItems(entity e, float beginarg, float endarg) e.strength_finished = max(0, e.strength_finished - time); e.invincible_finished = max(0, e.invincible_finished - time); e.superweapons_finished = max(0, e.superweapons_finished - time); - + PREGIVE(e, items); PREGIVE_WEAPONS(e); PREGIVE(e, strength_finished); @@ -1619,7 +1861,7 @@ float GiveItems(entity e, float beginarg, float endarg) { wi = get_weaponinfo(j); if(wi.weapon) - if not(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED) + if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED)) got += GiveWeapon(e, j, op, val); } case "allammo": @@ -1703,9 +1945,9 @@ float GiveItems(entity e, float beginarg, float endarg) if(wi.weapon) { POSTGIVE_WEAPON(e, j, "weapons/weaponpickup.wav", string_null); - if not(save_weapons & WepSet_FromWeapon(j)) + if (!(save_weapons & WepSet_FromWeapon(j))) if(e.weapons & WepSet_FromWeapon(j)) - WEP_ACTION(wi.weapon, WR_INIT); + weapon_action(wi.weapon, WR_PRECACHE); } } POSTGIVE_VALUE(e, strength_finished, 1, "misc/powerup.wav", "misc/poweroff.wav"); @@ -1735,7 +1977,7 @@ float GiveItems(entity e, float beginarg, float endarg) else e.superweapons_finished += time; - if not(e.weapons & WepSet_FromWeapon(e.switchweapon)) + if (!(e.weapons & WepSet_FromWeapon(e.switchweapon))) _switchweapon = TRUE; if(_switchweapon) W_SwitchWeapon_Force(e, w_getbestweapon(e));