X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fcl_weaponsystem.qc;h=c1e9ec53b9398ecf07a4040ec0a278bfd22d67ae;hb=316058afa5483a58be58ed6313f7f3c0e02d32f4;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..c1e9ec53 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -255,19 +255,30 @@ 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 not(chase || other.classname == "observer") // the observer check prevents a bug if(other.predator == self.owner || other.fakepredator == self.owner) { setmodel(self, ""); return TRUE; } - setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); + + self.effects &~= EF_NODEPTHTEST; + 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 || other.fakepredator == 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 +365,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 +579,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'; @@ -738,6 +753,14 @@ void CL_Weaponentity_Think() } // create or update the lasertarget entity + + // if we are a micro or macro, size the weapon model accordingly + if(self.owner.scale && cvar("g_healthsize_weapon_scalefactor")) + if(self.model != "") + { + self.weaponentity.scale = (1 + cvar("g_healthsize_weapon_scalefactor")) - cvar("g_healthsize_weapon_scalefactor") * self.owner.scale; + self.weaponentity.origin_z = (1 - self.weaponentity.scale) * cvar("g_healthsize_weapon_scalefactor_pos"); + } }; void CL_ExteriorWeaponentity_Think() @@ -756,6 +779,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 +844,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; }; @@ -1570,7 +1603,7 @@ 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; w_ready(); // don't keep executing each frame @@ -1586,7 +1619,7 @@ 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; @@ -1606,7 +1639,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 +1666,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 +1676,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 +1696,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,