Xonotic
buffs.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <common/teams.qh>
4 #include <common/util.qh>
5 
6 #ifdef GAMEQC
7 #include <common/items/item.qh>
9 #endif
10 
11 #ifdef GAMEQC
12 REGISTER_WAYPOINT(Buff, _("Buff"), "", '1 0.5 0', 1);
14 #endif
15 
16 #define REGISTER_BUFF(id, inst) \
17  REGISTER(StatusEffect, BUFF_##id, m_id, inst)
18 
21 #ifdef GAMEQC
22  ATTRIB(Buff, m_itemid, int, IT_BUFF);
23 #endif
24  ATTRIB(Buff, netname, string, "buff");
25  ATTRIB(Buff, m_icon, string, "buff");
26  ATTRIB(Buff, m_color, vector, '1 1 1');
27  ATTRIB(Buff, m_name, string, "Buff");
28  ATTRIB(Buff, m_skin, int, 0);
29  ATTRIB(Buff, m_lifetime, float, 60);
30  ATTRIB(Buff, m_sprite, string, "");
31  METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
32  returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
33  }
34 #ifdef SVQC
35  METHOD(Buff, m_time, float(Buff this))
36  { return cvar(strcat("g_buffs_", this.netname, "_time")); }
37 #endif
39 
40 STATIC_INIT(REGISTER_BUFFS) {
41  FOREACH(StatusEffect, it.instanceOfBuff, {
42  it.m_sprite = strzone(strcat("buff-", it.netname));
43  });
44 }
45 
46 #ifdef SVQC
47  .entity buffdef;
48  .int team_forced;
49  void buff_Init(entity ent);
50  void buff_Init_Compat(entity ent, entity replacement);
51  #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
52  this.buffdef = b; \
53  if(teamplay) \
54  this.team_forced = t; \
55  buff_Init(this); \
56  }
57  #define BUFF_SPAWNFUNCS(e, b) \
58  BUFF_SPAWNFUNC(e, b, 0) \
59  BUFF_SPAWNFUNC(e##_team1, b, NUM_TEAM_1) \
60  BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
61  BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
62  BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
63  #define BUFF_SPAWNFUNC_Q3COMPAT(o, r) spawnfunc(o) { buff_Init_Compat(this, r); }
64 #else
65  #define BUFF_SPAWNFUNC(e, b, t)
66  #define BUFF_SPAWNFUNCS(e, b)
67  #define BUFF_SPAWNFUNC_Q3COMPAT(o, r)
68 #endif
69 
70 string Buff_UndeprecateName(string buffname);
71 
73 
74 #include "all.inc"
75 
76 #ifdef GAMEQC
77 REPLICATE_INIT(bool, cvar_cl_buffs_autoreplace);
78 #endif
void buff_Init_Compat(entity ent, entity replacement)
Definition: sv_buffs.qc:474
REPLICATE_INIT(float, cvar_cl_autotaunt)
#define REGISTER_WAYPOINT(id, text, icon, color, blink)
Definition: all.qh:29
CLASS(Object) Object
Definition: oo.qh:318
#define REGISTER_RADARICON(id, num)
Definition: all.qh:36
string Buff_UndeprecateName(string buffname)
Definition: all.inc:1
entity() spawn
STATIC_INIT(REGISTER_BUFFS)
Definition: buffs.qh:40
string netname
Definition: powerups.qc:20
int m_itemid
Definition: jetpack.qh:11
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
void buff_Init(entity this)
Definition: sv_buffs.qc:424
#define ATTRIB(...)
Definition: oo.qh:136
Definition: buffs.qh:20
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
int team_forced
Definition: teamplay.qh:15
#define BUFF_SPAWNFUNCS(e, b)
Definition: buffs.qh:66
#define NULL
Definition: post.qh:17
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define ENDCLASS(cname)
Definition: oo.qh:269
#define FOREACH(list, cond, body)
Definition: iter.qh:19
string m_name
Definition: scores.qh:135