X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Ft_items.qc;h=1db8f6cd7630fcf7913d3fd229696986f8aa5e7d;hb=0136b21a9e62bd06b6bfa1c18b6e7580783c8eb0;hp=fcc8c0cf30d5d6b9c955b47618909592deaa7a45;hpb=f314057c5368749c358ea3122af0ef6cd56942ad;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index fcc8c0cf3..1db8f6cd7 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -28,37 +28,37 @@ var string autocvr_cl_simpleitems_postfix = "_simple"; .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)); } } } @@ -66,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; } @@ -86,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; @@ -113,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) @@ -134,26 +134,26 @@ 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))) @@ -168,21 +168,21 @@ void ItemRead(float _IsNew) 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; @@ -193,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; @@ -202,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'; } @@ -223,8 +223,8 @@ float ItemSend(entity to, float sf) 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); @@ -234,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); @@ -247,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); @@ -264,7 +264,7 @@ float ItemSend(entity to, float sf) WriteCoord(MSG_ENTITY, self.velocity_y); WriteCoord(MSG_ENTITY, self.velocity_z); } - + return TRUE; } @@ -374,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) @@ -411,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; @@ -601,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); @@ -651,7 +651,7 @@ float Item_GiveTo(entity item, entity player) } :skip - + // always eat teamed entities if(item.team) pickedup = TRUE; @@ -669,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") { @@ -680,7 +680,7 @@ void Item_Touch (void) } } - if not(IS_PLAYER(other)) + if (!IS_PLAYER(other)) return; if (other.deadflag) return; @@ -723,7 +723,7 @@ void Item_Touch (void) if (self.classname == "droppedweapon") remove (self); - else if not(self.spawnshieldtime) + else if (!self.spawnshieldtime) return; else { @@ -869,7 +869,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) @@ -930,16 +930,16 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, 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; @@ -951,7 +951,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 @@ -1009,7 +1009,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, remove (self); return; } - + if(self.angles != '0 0 0') self.SendFlags |= ISF_ANGLES; @@ -1090,8 +1090,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'; @@ -1103,20 +1103,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; } @@ -1126,13 +1126,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 @@ -1486,7 +1486,7 @@ void target_items_use (void) return; } - if not(IS_PLAYER(activator)) + if (!IS_PLAYER(activator)) return; if(activator.deadflag != DEAD_NO) return; @@ -1803,7 +1803,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); @@ -1859,7 +1859,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": @@ -1943,7 +1943,7 @@ 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)) weapon_action(wi.weapon, WR_PRECACHE); } @@ -1975,7 +1975,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));