1 float Tuba_GetNote(entity pl, float hittype)
7 if(pl.movement_x < 0) movestate -= 3;
8 if(pl.movement_x > 0) movestate += 3;
9 if(pl.movement_y < 0) movestate -= 1;
10 if(pl.movement_y > 0) movestate += 1;
13 case 1: note = -6; break; // Gb
14 case 2: note = -5; break; // G
15 case 3: note = -4; break; // G#
16 case 4: note = -1; break; // B
17 case 5: note = 0; break; // c
18 case 6: note = +2; break; // d
19 case 7: note = +3; break; // eb
20 case 8: note = +4; break; // e
21 case 9: note = +5; break; // e#
23 print(ftos(movestate), "\n");
26 if(hittype & HITTYPE_SECONDARY)
29 // total range of notes:
35 // -18.........................+12
39 void W_Tuba_Attack(float hittype)
41 W_SetupShot(self, FALSE, 2, "");
42 sound(self, CHAN_WEAPON, strcat("weapons/tuba_note", ftos(Tuba_GetNote(self, hittype)), ".wav"), VOL_BASE, cvar("g_balance_tuba_attenuation"));
43 RadiusDamage(self, self, cvar("g_balance_tuba_damage"), cvar("g_balance_tuba_edgedamage"), cvar("g_balance_tuba_radius"), world, cvar("g_balance_tuba_force"), hittype | WEP_TUBA, world);
46 void spawnfunc_weapon_tuba (void)
48 error("The tuba does not work yet. Forget it.");
49 weapon_defaultspawnfunc(WEP_TUBA);
52 float w_tuba(float req)
56 // bots cannot play the Tuba yet
57 // I think they should start with the recorder first
59 else if (req == WR_THINK)
62 if (weapon_prepareattack(0, cvar("g_balance_tuba_refire")))
65 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_tuba_animtime"), w_ready);
67 if (self.BUTTON_ATCK2)
68 if (weapon_prepareattack(1, cvar("g_balance_tuba_refire")))
70 W_Tuba_Attack(HITTYPE_SECONDARY);
71 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_tuba_animtime"), w_ready);
74 else if (req == WR_PRECACHE)
76 precache_model ("models/weapons/g_tuba.md3");
77 precache_model ("models/weapons/v_tuba.md3");
78 precache_model ("models/weapons/h_tuba.dpm");
80 else if (req == WR_SETUP)
81 weapon_setup(WEP_TUBA);
82 else if (req == WR_CHECKAMMO1)
83 return TRUE; // TODO use fuel?
84 else if (req == WR_CHECKAMMO2)
85 return TRUE; // TODO use fuel?
86 else if (req == WR_SUICIDEMESSAGE)
88 w_deathtypestring = "hurt his own ears";
90 else if (req == WR_KILLMESSAGE)
92 w_deathtypestring = "died of #'s great playing";