X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fall.qh;h=9570e8c561aaac732a39ba63ae1a5d51fdbf68e9;hb=8c965aa90470cfa8cbfaff88db71b6b5899a90ce;hp=7fe6cef9375d55a224608060711c1f0475f2158c;hpb=48d2e89b9d19a9654c48622466c30005857712d2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 7fe6cef93..9570e8c56 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -1,12 +1,11 @@ -#ifndef WEAPONS_ALL_H -#define WEAPONS_ALL_H +#pragma once -#include +#include #include #include "config.qh" // weapon sets -typedef vector WepSet; +USING(WepSet, vector); #ifdef SVQC void WriteWepSet(float dest, WepSet w); #endif @@ -19,22 +18,22 @@ WepSet ReadWepSet(); #include "weapon.qh" -#ifndef MENUQC +#ifdef GAMEQC #include "calculations.qh" #include #endif #include -#ifdef SVQC -#include -#endif - REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72. #define Weapons_from(i) _Weapons_from(i, WEP_Null) REGISTER_REGISTRY(Weapons) STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPickup, it)); } +#ifdef SVQC +#include +#endif + .WepSet m_wepset; #define WEPSET(id) (WEP_##id.m_wepset) #define WepSet_FromWeapon(it) ((it).m_wepset) @@ -107,14 +106,15 @@ void W_PROP_reload(int chan, entity to) if (f) f(it, chan); }); } -void W_PROP_think() +void W_PROP_think(entity this) { W_PROP_reload(MSG_ALL, NULL); } STATIC_INIT_LATE(W_PROP_reloader) { entity e = W_PROP_reloader = new_pure(W_PROP_reloader); - WITH(entity, self, e, (e.think = W_PROP_think)()); + setthink(e, W_PROP_think); + W_PROP_think(e); } #endif @@ -298,6 +298,7 @@ REGISTRY_CHECK(Weapons) STATIC_INIT(register_weapons_done) { + string inaccessible = ""; FOREACH(Weapons, true, { WepSet set = it.m_wepset = _WepSet_FromWeapon(it.m_id = i); WEPSET_ALL |= set; @@ -308,8 +309,9 @@ STATIC_INIT(register_weapons_done) if (imp <= WEP_IMPULSE_END) localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp)); else - LOG_TRACEF("Impulse limit exceeded, weapon will not be directly accessible: %s\n", it.netname); + inaccessible = strcat(inaccessible, "\n", it.netname); }); + if (inaccessible) LOG_TRACEF("Impulse limit exceeded, weapon(s) will not be directly accessible: %s", inaccessible); #ifdef CSQC FOREACH(Weapons, true, it.wr_init(it)); #endif @@ -320,14 +322,14 @@ STATIC_INIT(register_weapons_done) weaponorder_byid = strzone(substring(weaponorder_byid, 1, -1)); } -#ifndef MENUQC +#ifdef GAMEQC .entity weaponchild; .entity exteriorweaponentity; -vector weaponentity_glowmod(Weapon wep, int c) +vector weaponentity_glowmod(Weapon wep, entity actor, int c) { vector g; - if (!(g = wep.wr_glow(wep))) g = colormapPaletteColor(c & 0x0F, true) * 2; + if (!(g = wep.wr_glow(wep, actor))) g = colormapPaletteColor(c & 0x0F, true) * 2; return g; } @@ -357,5 +359,3 @@ ENUMCLASS_END(WFRAME) vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn); void CL_WeaponEntity_SetModel(entity this, string name, bool _anim); #endif - -#endif