X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=data%2Fqcsrc%2Fserver%2Fcl_weaponsystem.qc;h=48058cca9e23864607b36b7c0aef2052aa229df1;hb=8cafc5adad92ae3d4f6c75260a1a1d509942447a;hp=9716e9852bfa19cb5feda45938f457b8b6e89fda;hpb=9ff04a44c0df8ef195db6d2c47e1071e61d307e7;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index 9716e985..48058cca 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -223,15 +223,18 @@ void W_SetupShot_Dir_ProjectileSize(entity ent, vector s_forward, vector mi, vec ent.dphitcontentsmask = oldsolid; // restore solid type (generally SOLID_SLIDEBOX) if (!g_norecoil) - ent.punchangle_x = recoil * -1; + { + ent.punchangle_x += crandom() * recoil; + ent.punchangle_y += crandom() * recoil; + } if (snd != "") { sound (ent, CHAN_WEAPON, snd, VOL_BASE, ATTN_NORM); } - if (ent.items & IT_STRENGTH) - sound (ent, CHAN_AUTO, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM); + if (ent.items & IT_STRENGTH && maxdamage) + sound (ent, CHAN_AUTO, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM); }; #define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, maxdamage) @@ -255,19 +258,36 @@ float CL_ExteriorWeaponentity_CustomizeEntityForClient() // otherwise, the stomach model the predator is transformed in (see Client_customizeentityforclient) will have a weapon model attached to it if(self.owner.weaponname == "" || self.owner.deadflag != DEAD_NO) return TRUE; - if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug - { - setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); - return TRUE; - } - if(other.spectatee_status) + + float chase; + chase = other.cvar_chase_active; + + if(other.spectatee_status && other.spectatee_status == num_for_edict(other.enemy)) other = other.enemy; // also do this for the player we are spectating - if(other.predator == self.owner || other.fakepredator == self.owner) + + if not(chase || other.classname == "observer") // the observer check prevents a bug + if(other.predator == self.owner) { setmodel(self, ""); return TRUE; } - setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); + + if(cvar("g_nodepthtestplayers")) + self.effects |= EF_NODEPTHTEST; + else + self.effects &~= EF_NODEPTHTEST; + if(cvar("g_fullbrightplayers")) + self.effects |= EF_FULLBRIGHT; + + if not(self.owner.stat_eaten) + setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); + else if(cvar("g_vore_neighborprey_distance") && other.predator == self.owner.predator && !(chase || other.classname == "observer")) + { + setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // allow seeing neighboring prey's weapon model + self.effects |= EF_NODEPTHTEST; // don't hide behind the stomach's own EF_NODEPTHTEST + } + else + setmodel(self, ""); // hide prey's weapon model return TRUE; } @@ -354,6 +374,7 @@ void CL_Weaponentity_Think() return; } if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) + if (substring(self.owner.model, -4, 4) != ".md3") // not a stomach model { self.cnt = self.owner.weapon; self.dmg = self.owner.modelindex; @@ -567,18 +588,21 @@ void CL_Weaponentity_Think() if(self.owner.alpha == default_player_alpha) self.alpha = default_weapon_alpha; - else if(self.owner.alpha != 0 && self.owner.predator.classname != "player") + else if(self.owner.alpha != 0 && !self.owner.stat_eaten) self.alpha = self.owner.alpha; else self.alpha = 1; self.colormap = self.owner.colormap; + self.colormod = self.owner.colormod; + self.glowmod = self.owner.weaponentity_glowmod; if (self.weaponentity) { self.weaponentity.effects = self.effects; self.weaponentity.alpha = self.alpha; self.weaponentity.colormap = self.colormap; self.weaponentity.colormod = self.owner.colormod; // used by the regurgitating colors + self.weaponentity.glowmod = self.glowmod; } self.angles = '0 0 0'; @@ -737,7 +761,22 @@ void CL_Weaponentity_Think() } - // create or update the lasertarget entity + // if we are a micro or macro, size the weapon model accordingly + if(cvar("g_healthsize") && cvar("g_healthsize_weapon_scalefactor")) + if(self.owner.scale) // prevents some exceptions + { + self.scale = pow(1 / self.owner.scale, cvar("g_healthsize_weapon_scalefactor")); + if(self.scale < 0.1) + self.scale = 0.1; // stuff breaks if scale is smaller than this + self.origin_z = (1 - self.scale) * cvar("g_healthsize_weapon_scalefactor_pos"); + + // copy properties to the static weapon entity as well + if(self.weaponentity != world) // prevents assignment to world + { + self.weaponentity.scale = self.scale; + self.weaponentity.origin = self.origin; + } + } }; void CL_ExteriorWeaponentity_Think() @@ -756,6 +795,7 @@ void CL_ExteriorWeaponentity_Think() return; } if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) + if (substring(self.owner.model, -4, 4) != ".md3") // not a stomach model { self.cnt = self.owner.weapon; self.dmg = self.owner.modelindex; @@ -820,7 +860,16 @@ void CL_ExteriorWeaponentity_Think() self.angles = ang; } + // if we are a micro or macro, size the weapon model accordingly + if(self.owner.scale && cvar("g_healthsize_exteriorweapon_scalefactor")) + if(self.model != "") + { + self.scale = 1 / self.owner.scale; // for some reason, the exterior weapon entity copies the player's scale somewhere else, so undo that first + self.scale = (1 - cvar("g_healthsize_exteriorweapon_scalefactor")) + cvar("g_healthsize_exteriorweapon_scalefactor") * self.scale; + } + self.colormap = self.owner.colormap; + self.glowmod = self.owner.weaponentity_glowmod; self.customizeentityforclient = CL_ExteriorWeaponentity_CustomizeEntityForClient; }; @@ -1555,7 +1604,7 @@ void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) if(ammo_reload) { self.clip_load -= ammo_use; - self.weapon_load[self.weapon] = self.clip_load; + self.(weapon_load[self.weapon]) = self.clip_load; } else self.(self.current_ammo) -= ammo_use; @@ -1570,9 +1619,9 @@ void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) void W_ReloadedAndReady() { // if we are inside the stomach, don't allow reloading, and schedule the weapon to reload once when we're out - if(self.predator.classname == "player") + if(self.stat_eaten) { - self.clip_load = self.weapon_load[self.weapon] = -1; + self.clip_load = self.(weapon_load[self.weapon]) = -1; w_ready(); // don't keep executing each frame return; } @@ -1586,13 +1635,13 @@ void W_ReloadedAndReady() self.clip_load = self.reload_ammo_amount; else { - while(self.clip_load < self.reload_ammo_amount && self.(self.current_ammo)) // make sure we don't add more ammo than we have + while(self.clip_load < self.reload_ammo_amount && self.(self.current_ammo) >= 1) // make sure we don't add more ammo than we have { self.clip_load += 1; self.(self.current_ammo) -= 1; } } - self.weapon_load[self.weapon] = self.clip_load; + self.(weapon_load[self.weapon]) = self.clip_load; // do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon, // then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there, @@ -1606,7 +1655,7 @@ void W_ReloadedAndReady() void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, string sent_sound) { // if we are inside the stomach, don't allow reloading - if(self.predator.classname == "player") + if(self.stat_eaten) return; // set global values to work with @@ -1633,7 +1682,7 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri if (self.clip_load >= self.reload_ammo_amount) return; // no ammo, so nothing to load - if(!self.(self.current_ammo) && self.reload_ammo_min) + if(self.(self.current_ammo) < 1 && self.reload_ammo_min) if not(self.items & IT_UNLIMITED_WEAPON_AMMO) { if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time) @@ -1643,11 +1692,12 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri self.reload_complain = time + 1; } // switch away if the amount of ammo is not enough to keep using this weapon - if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2)) + // disabled since we only have one weapon in VT, so nothing else to switch to if we're out of ammo + /*if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2)) { self.clip_load = -1; // reload later W_SwitchToOtherWeapon(self); - } + }*/ return; } @@ -1662,6 +1712,14 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri // now begin the reloading process + // weapon reload effects + if(self.weapon == WEP_GRABBER && self.clip_load >= 0) // only when we first begin reloading + { + vector org; + org = self.origin + self.view_ofs + self.weaponentity.spawnorigin_x * v_forward - self.weaponentity.spawnorigin_y * v_right + self.weaponentity.spawnorigin_z * v_up; + SpawnCasing (org, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, self); + pointparticles(particleeffectnum("grabber_reload"), org, '0 0 0', 1); + } sound (self, CHAN_WEAPON2, self.reload_sound, VOL_BASE, ATTN_NORM); // do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon, @@ -1675,5 +1733,5 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri if(self.clip_load < 0) self.clip_load = 0; self.old_clip_load = self.clip_load; - self.clip_load = self.weapon_load[self.weapon] = -1; + self.clip_load = self.(weapon_load[self.weapon]) = -1; } \ No newline at end of file