- METHOD(Tuba, wr_aim, void(entity thiswep))
- {
- // bots cannot play the Tuba well yet
- // I think they should start with the recorder first
- if(vlen(self.origin - self.enemy.origin) < WEP_CVAR(tuba, radius))
- {
- if(random() > 0.5)
- self.BUTTON_ATCK = 1;
- else
- self.BUTTON_ATCK2 = 1;
- }
- }
- METHOD(Tuba, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(fire & 1)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
- {
- W_Tuba_NoteOn(0);
- //weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
- }
- if(fire & 2)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
- {
- W_Tuba_NoteOn(HITTYPE_SECONDARY);
- //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
- weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
- }
- if(actor.tuba_note)
- {
- if(!(fire & 1) && !(fire & 2))
- {
- WITH(entity, self, actor.tuba_note, W_Tuba_NoteOff());
- }
- }
- }
- METHOD(Tuba, wr_setup, void(entity thiswep))
- {
- self.ammo_field = ammo_none;
- self.tuba_instrument = 0;
- }
- METHOD(Tuba, wr_reload, void(entity thiswep))
- {
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- // switch to alternate instruments :)
- if(self.(weaponentity).state == WS_READY)
- {
- switch(self.tuba_instrument)
- {
- case 0:
- self.tuba_instrument = 1;
- self.weaponname = "akordeon";
- break;
- case 1:
- self.tuba_instrument = 2;
- self.weaponname = "kleinbottle";
- break;
- case 2:
- self.tuba_instrument = 0;
- self.weaponname = "tuba";
- break;
- }
- W_SetupShot(self, false, 0, "", 0, 0);
- Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
- self.(weaponentity).state = WS_INUSE;
- weapon_thinkf(self, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
- }
- }
- METHOD(Tuba, wr_checkammo1, bool(entity thiswep))
- {
- return true; // infinite ammo
- }
- METHOD(Tuba, wr_checkammo2, bool(entity thiswep))
- {
- return true; // tuba has infinite ammo
- }
- METHOD(Tuba, wr_suicidemessage, int(entity thiswep))
+#ifdef SVQC
+METHOD(Tuba, wr_aim, void(Tuba this))
+{
+ entity actor = self;
+ // bots cannot play the Tuba well yet
+ // I think they should start with the recorder first
+ if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
+ {
+ if (random() > 0.5)
+ actor.BUTTON_ATCK = 1;
+ else
+ actor.BUTTON_ATCK2 = 1;
+ }
+}
+
+METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int fire))
+{
+ if (fire & 1)
+ if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
+ {
+ W_Tuba_NoteOn(0);
+ weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+ }
+ if (fire & 2)
+ if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
+ {
+ W_Tuba_NoteOn(HITTYPE_SECONDARY);
+ weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+ }
+ if (actor.tuba_note)
+ {
+ if (!(fire & 1) && !(fire & 2))