X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fall.qc;h=effa087e65c57ce2efabc3d2a5d9ad54622d7c74;hb=cd6c2c93684d30a3e2878d8f4d48875dcd4c1978;hp=e1efeb02e933c4559f5455d8e1691fd1a42f7ecc;hpb=5ad35ed58c9eb8f52afd13db42f712d308d807df;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index e1efeb02e..effa087e6 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -107,21 +107,6 @@ string W_NameWeaponOrder_MapFunc(string s) return s; } -string W_UndeprecateName(string s) -{ - switch (s) - { - case "nex": return "vortex"; - case "rocketlauncher": return "devastator"; - case "laser": return "blaster"; - case "minstanex": return "vaporizer"; - case "grenadelauncher": return "mortar"; - case "uzi": return "machinegun"; - case "hmg": return "okhmg"; - case "rpc": return "okrpc"; - default: return s; - } -} string W_NameWeaponOrder(string order) { return mapPriorityList(order, W_NameWeaponOrder_MapFunc); @@ -129,8 +114,7 @@ string W_NameWeaponOrder(string order) string W_NumberWeaponOrder_MapFunc(string s) { if (s == "0" || stof(s)) return s; - s = W_UndeprecateName(s); - FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i)); + FOREACH(Weapons, it != WEP_Null && (it.netname == s || it.m_deprecated_netname == s), return ftos(i)); return s; } string W_NumberWeaponOrder(string order) @@ -249,20 +233,6 @@ entity GetAmmoItem(Resource ammotype) } #ifdef CSQC -Resource GetAmmoTypeFromNum(int i) -{ - switch (i) - { - case 0: return RES_SHELLS; - case 1: return RES_BULLETS; - case 2: return RES_ROCKETS; - case 3: return RES_CELLS; - case 4: return RES_PLASMA; - case 5: return RES_FUEL; - default: return RES_NONE; - } -} - int GetAmmoStat(Resource ammotype) { switch (ammotype) @@ -394,6 +364,7 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn * this.origin, this.angles * this.weaponchild * this.movedir, this.view_ofs, this.movedir_aligned + * this.spawnorigin (SVQC only) * attachment stuff * anim stuff * to free: @@ -410,7 +381,9 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) if (this.weaponchild) delete(this.weaponchild); this.weaponchild = NULL; this.movedir = '0 0 0'; +#ifdef SVQC this.spawnorigin = '0 0 0'; +#endif this.oldorigin = '0 0 0'; this.anim_fire1 = '0 1 0.01'; this.anim_fire2 = '0 1 0.01'; @@ -482,6 +455,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) this.movedir = '0 0 0'; } } +#ifdef SVQC { int idx = 0; // v_ model attached to invisible h_ model @@ -501,6 +475,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) this.spawnorigin = this.movedir; } } +#endif if (v_shot_idx) { this.oldorigin = '0 0 0'; // use regular attachment @@ -547,7 +522,7 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) vector v = this.movedir; this.movedir = shotorg_adjust(v, false, false, algn); this.movedir_aligned = shotorg_adjust(v, false, true, algn); - this.view_ofs = shotorg_adjust(v, false, true, algn) - v; + this.view_ofs = this.movedir_aligned - v; } int compressed_shotorg = compressShotOrigin(this.movedir); // make them match perfectly @@ -557,7 +532,9 @@ void CL_WeaponEntity_SetModel(entity this, string name, bool _anim) #endif this.movedir = decompressShotOrigin(compressed_shotorg); +#ifdef SVQC this.spawnorigin += this.view_ofs; // offset the casings origin by the same amount +#endif // check if an instant weapon switch occurred setorigin(this, this.view_ofs); @@ -827,3 +804,35 @@ NET_HANDLE(w_muzzleflash, bool isNew) #endif #endif + +#ifdef SVQC +string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo) +{ + string o = W_FixWeaponOrder_ForceComplete(wo); + strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o)); + return o; +} +#endif + +#ifdef CSQC +REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share"); +REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive"); +#endif + +#ifdef GAMEQC +REPLICATE(cvar_cl_gunalign, int, "cl_gunalign"); +REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload"); +REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse"); +REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode"); +REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList); +REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete); +REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete); +#endif