Xonotic
speed.qc
Go to the documentation of this file.
1 #include "speed.qh"
2 
3 #ifdef SVQC
4 METHOD(Speed, m_remove, void(StatusEffects this, entity actor, int removal_type))
5 {
6  bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
7  if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
8  {
9  //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_SPEED, actor.netname);
10  Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERDOWN_SPEED);
11  }
12  if(wasactive)
13  stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound
14  actor.effects &= ~EF_STARDUST;
15  SUPER(Speed).m_remove(this, actor, removal_type);
16 }
17 METHOD(Speed, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags))
18 {
19  bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
20  if(!wasactive && IS_PLAYER(actor))
21  {
22  if(!g_cts)
23  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SPEED, actor.netname);
24  Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_SPEED);
25  }
26  SUPER(Speed).m_apply(this, actor, eff_time, eff_flags);
27 }
28 METHOD(Speed, m_tick, void(StatusEffects this, entity actor))
29 {
30  play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
31  actor.effects |= EF_STARDUST;
32  SUPER(Speed).m_tick(this, actor);
33 }
34 #endif
void play_countdown(entity this, float finished, Sound samp)
Definition: client.qc:1447
entity() spawn
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
Definition: speed.qh:57
#define SUPER(cname)
Definition: oo.qh:219
int m_id
Definition: effect.qh:19
#define g_cts
Definition: cts.qh:36
#define NULL
Definition: post.qh:17
const int CH_TRIGGER_SINGLE
Definition: sound.qh:13
#define IS_PLAYER(v)
Definition: utils.qh:9
const float EF_STARDUST
Definition: csprogsdefs.qc:308