X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=data%2Fqcsrc%2Fserver%2Fcl_weaponsystem.qc;h=48058cca9e23864607b36b7c0aef2052aa229df1;hb=07eb71508b30944a3608716998047a97f67a94c1;hp=e90c78e08ac99eeeeb45b23dc647eee4a90a5171;hpb=023a2558d7dd3d6c2281ca33a656ee00a8018b3f;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index e90c78e0..48058cca 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -223,7 +223,10 @@ 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; + { + ent.punchangle_x += crandom() * recoil; + ent.punchangle_y += crandom() * recoil; + } if (snd != "") { @@ -269,7 +272,13 @@ float CL_ExteriorWeaponentity_CustomizeEntityForClient() return TRUE; } - self.effects &~= EF_NODEPTHTEST; + 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")) @@ -754,12 +763,19 @@ void CL_Weaponentity_Think() // if we are a micro or macro, size the weapon model accordingly if(cvar("g_healthsize") && cvar("g_healthsize_weapon_scalefactor")) - if(self.model != "") + if(self.owner.scale) // prevents some exceptions { - self.weaponentity.scale = (1 + cvar("g_healthsize_weapon_scalefactor")) - cvar("g_healthsize_weapon_scalefactor") * self.owner.scale; - if(self.weaponentity.scale < 0.1) - self.weaponentity.scale = 0.1; // stuff breaks if scale is smaller than this - self.weaponentity.origin_z = (1 - self.weaponentity.scale) * cvar("g_healthsize_weapon_scalefactor_pos"); + 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; + } } }; @@ -1579,113 +1595,6 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) #define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread")) #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread")) -void W_DisplayDigitThink() -{ - self.nextthink = time; - - // the owner has switched to another weapon, remove the digits - if(self.weapon != self.owner.weapon) - { - self.nextthink = 0; - remove(self); - self = world; - return; - } - - entity gun; - if(self.dmg) // exterior weapon - { - // keep the digit attached to the same bone as the gun - setattachment(self, self.owner, "bip01 r hand"); - gun = self.owner.exteriorweaponentity; - } - else // view weapon - { - // keep the digit attached to the same bone as the gun - // TODO: Does this work with self-animated weapons too? - if(gettagindex(self.owner.weaponentity, "weapon")) - setattachment(self, self.owner.weaponentity, "weapon"); - else if(gettagindex(self.owner.weaponentity, "tag_weapon")) - setattachment(self, self.owner.weaponentity, "tag_weapon"); - gun = self.owner.weaponentity.weaponentity; - } - - // copy all properties of the weapon to the digit - self.origin = gun.origin; - self.angles = gun.angles; - self.scale = gun.scale; - self.effects = gun.effects; - self.alpha = gun.alpha; - self.colormap = gun.colormap; - self.colormod = gun.colormod; // used by the regurgitating colors - self.glowmod = gun.glowmod; - - string txt; - if(self.team) // weapon load display - { - if(self.owner.weapon_load[self.owner.weapon] <= 0) - { - self.skin = 11; // unavailable digit - return; - } - else - { - txt = ftos(floor(self.owner.weapon_load[self.owner.weapon])); - txt = substring(txt, self.cnt - 1, 1); - } - } - else // ammo display - { - txt = ftos(floor(self.owner.(self.owner.current_ammo))); - txt = substring(txt, self.cnt - 1, 1); - } - - if((!txt || txt == "")) - self.skin = 10; // empty digit - else - self.skin = stof(txt); -} - -void W_DisplayDigitSetup(entity own, float num, float load, float exterior) -{ - entity digit, e; - digit = spawn(); - digit.owner = own; - digit.weapon = own.weapon; - digit.dmg = exterior; - digit.team = load; - digit.cnt = num; - e = get_weaponinfo(digit.weapon); - - if(load) - { - // weapon load digit - setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(num) , ".md3")); - } - else - { - // ammo count digit - setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(num) , ".md3")); - } - digit.think = W_DisplayDigitThink; - digit.nextthink = time; -} - -void W_Display(entity own, float load_num, float ammo_num) -{ - float i; - for(i = 1; i <= load_num; i++) - { - W_DisplayDigitSetup(own, i, TRUE, FALSE); // weapon load digit, view model - W_DisplayDigitSetup(own, i, TRUE, TRUE); // weapon load digit, exterior model - } - for(i = 1; i <= ammo_num; i++) - { - W_DisplayDigitSetup(own, i, FALSE, FALSE); // ammo count digit, view model - W_DisplayDigitSetup(own, i, FALSE, TRUE); // ammo count digit, exterior model - } -} - void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) { if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)