X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fserver%2Fcl_weaponsystem.qc;h=2b224bac5ad5d766c647f13522d74380289638e2;hb=19b2166e669ed5315d9ff526c091c552bb741a37;hp=b2706ecd34c002cc9f009ec618dbffd3a0080e7e;hpb=87e16369bba93e1e7ca8bec4837417298053a204;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index b2706ecd..2b224bac 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -255,18 +255,17 @@ 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) other = other.enemy; // also do this for the player we are spectating - if(other.predator == self.owner) + + if not(other.cvar_chase_active || 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")); return TRUE; } @@ -382,8 +381,8 @@ void CL_Weaponentity_Think() } else { - setmodel(self, strcat("models/weapons/h_", self.owner.weaponname, ".dpm")); // precision set below - animfilename = strcat("models/weapons/h_", self.owner.weaponname, ".dpm.animinfo"); + setmodel(self, strcat("models/weapons/h_", self.owner.weaponname, ".iqm")); // precision set below + animfilename = strcat("models/weapons/h_", self.owner.weaponname, ".iqm.animinfo"); animfile = fopen(animfilename, FILE_READ); // preset some defaults that work great for renamed zym files (which don't need an animinfo) self.anim_fire1 = '0 1 0.01'; @@ -567,7 +566,7 @@ void CL_Weaponentity_Think() if(self.owner.alpha == default_player_alpha) self.alpha = default_weapon_alpha; - else if(self.owner.alpha != 0) + else if(self.owner.alpha != 0 && self.owner.predator.classname != "player") self.alpha = self.owner.alpha; else self.alpha = 1; @@ -738,6 +737,13 @@ 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")) + { + 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() @@ -820,6 +826,13 @@ 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")) + { + 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.customizeentityforclient = CL_ExteriorWeaponentity_CustomizeEntityForClient; }; @@ -1569,20 +1582,27 @@ 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") + { + self.clip_load = self.weapon_load[self.weapon] = -1; + w_ready(); // don't keep executing each frame + return; + } + // finish the reloading process, and do the ammo transfer self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading // if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load - if(!self.reload_ammo_min) + if(!self.reload_ammo_min || self.items & IT_UNLIMITED_WEAPON_AMMO) 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 { self.clip_load += 1; - if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.(self.current_ammo) -= 1; + self.(self.current_ammo) -= 1; } } self.weapon_load[self.weapon] = self.clip_load; @@ -1598,6 +1618,10 @@ 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") + return; + // set global values to work with self.reload_ammo_min = sent_ammo_min; self.reload_ammo_amount = sent_ammo_amount; @@ -1615,17 +1639,15 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri dprint("Warning: Attempted to reload a weapon that does not have the WEP_FLAG_RELOADABLE flag. Fix your code!\n"); return; } - // return if reloading is disabled for this weapon if(!self.reload_ammo_amount) return; - // our weapon is fully loaded, no need to reload 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 not(self.items & IT_UNLIMITED_WEAPON_AMMO) { if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time) {