From: TimePath Date: Thu, 29 Oct 2015 07:57:34 +0000 (+1100) Subject: Merge branch 'master' into TimePath/items X-Git-Tag: xonotic-v0.8.2~1760^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=349aeb508e5a3d577df60bef8a552da2db7d928d;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into TimePath/items # Conflicts: # qcsrc/lib/misc.qh # qcsrc/lib/oo.qh --- 349aeb508e5a3d577df60bef8a552da2db7d928d diff --cc qcsrc/common/weapons/weapon.qh index 624cb83f5,3d7ae3bb5..63ce4c31a --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@@ -1,7 -1,8 +1,9 @@@ #ifndef WEAPON_H #define WEAPON_H +#include "../items/item/pickup.qh" + const int MAX_WEAPONSLOTS = 2; + .int ammo_shells; .int ammo_nails; .int ammo_rockets; diff --cc qcsrc/common/weapons/weapon/hmg.qc index ebc4a48ff,c420cf08b..9ebc56f67 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@@ -43,9 -43,9 +43,9 @@@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP #ifdef IMPLEMENTATION #ifdef SVQC -spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); } +spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); } - void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2) + void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int slot, int fire) { if (!actor.BUTTON_ATCK) { diff --cc qcsrc/lib/misc.qh index 938e2e6ac,692ef2553..db7819b8c --- a/qcsrc/lib/misc.qh +++ b/qcsrc/lib/misc.qh @@@ -25,15 -25,18 +25,18 @@@ #define GET(name) name##get #define GETTER(type, name) type GET(name)() { return name; } - +#define PROPERTY(type, name) type name; GETTER(type, name) - #define LAMBDA(...) { __VA_ARGS__ ; } + #define LAMBDA(...) { __VA_ARGS__; } - // Can't wrap with do-while as block may contain continue or break - #define WITH(type, name, value, block) { \ - type __with_save = (name); \ - name = (value); \ - LAMBDA(block) \ - name = __with_save; \ - } do { } while (0) + // With block may not contain continue or break + #define WITH(type, name, value, block) \ + do \ + { \ + type __with_save = (name); \ + name = (value); \ + LAMBDA(block) \ + name = __with_save; \ + } \ + while (0) #endif diff --cc qcsrc/lib/oo.qh index ed2029aec,6a9a2e3b7..554dc3f81 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@@ -87,46 -94,58 +94,58 @@@ STATIC_INIT(RegisterClasses #define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this) #define CLASS(cname, base) \ - entityclass(cname, base); \ - class(cname) .bool instanceOf##cname; \ - VTBL(cname, base) \ - INIT_STATIC(cname) { \ - if (cname##_vtbl) { \ - copyentity(cname##_vtbl, this); \ - return; \ - } \ - spawn##base##_static(this); \ - this.instanceOf##cname = true; \ - } \ - INIT(cname) { \ - /* Only statically initialize the current class, it contains everything it inherits */ \ - if (cname##_vtbl.vtblname == this.classname) { \ - spawn##cname##_static(this); \ - this.classname = #cname; \ - this.vtblname = string_null; \ - this.vtblbase = cname##_vtbl; \ - } \ - spawn##base##_1(this); \ - } + entityclass(cname, base); \ + class(cname).bool instanceOf##cname; \ + VTBL(cname, base) \ + INIT_STATIC(cname) \ + { \ + if (cname##_vtbl) \ + { \ + copyentity(cname##_vtbl, this); \ + return; \ + } \ + spawn##base##_static(this); \ + this.instanceOf##cname = true; \ + } \ + INIT(cname) \ + { \ + /* Only statically initialize the current class, it contains everything it inherits */ \ + if (cname##_vtbl.vtblname == this.classname) \ + { \ + spawn##cname##_static(this); \ + this.classname = #cname; \ + this.vtblname = string_null; \ + this.vtblbase = cname##_vtbl; \ + } \ + spawn##base##_1(this); \ + } #define METHOD(cname, name, prototype) \ - class(cname) .prototype name; \ - prototype cname##_##name; \ - INIT_STATIC(cname) { this.name = cname##_##name; } \ - prototype cname##_##name + class(cname).prototype name; \ + prototype cname##_##name; \ + INIT_STATIC(cname) \ + { \ + this.name = cname##_##name; \ + } \ + prototype cname##_##name #define ATTRIB(cname, name, type, val) \ - class(cname) .type name; \ - INIT(cname) { this.name = val; } + class(cname).type name; \ + INIT(cname) \ + { \ + this.name = val; \ + } #define ATTRIBARRAY(cname, name, type, cnt) \ - class(cname) .type name[cnt]; + class(cname).type name[cnt]; #define ENDCLASS(cname) \ - INIT(cname) { return this; } - [[last]] INIT(cname) \ ++ INIT(cname) \ + { \ + return this; \ + } #define SUPER(cname) (cname##_vtbl.vtblbase) - #define super (this.vtblbase.vtblbase) #define spawn_static(this) #define spawn_1(this)