1 #define TUBA_NOTE(n) strcat("weapons/tuba_note", ftos(n), ".wav")
4 float Tuba_GetNote(entity pl, float hittype)
9 if(pl.movement_x < 0) movestate -= 3;
10 if(pl.movement_x > 0) movestate += 3;
11 if(pl.movement_y < 0) movestate -= 1;
12 if(pl.movement_y > 0) movestate += 1;
15 // layout: originally I wanted
19 // but then you only use forward and right key. So to make things more
20 // interesting, I swapped B with e#. Har har har...
24 case 1: note = -6; break; // Gb
25 case 2: note = -5; break; // G
26 case 3: note = -4; break; // G#
27 case 4: note = +5; break; // e#
28 case 5: note = 0; break; // c
29 case 6: note = +2; break; // d
30 case 7: note = +3; break; // eb
31 case 8: note = +4; break; // e
32 case 9: note = -1; break; // B
38 if(hittype & HITTYPE_SECONDARY)
41 // we support two kinds of tubas, those tuned in Eb and those tuned in C
42 // kind of tuba currently is player slot number, or team number if in
44 // that way, holes in the range of notes are "plugged"
47 if(pl.team == COLOR_TEAM2 || pl.team == COLOR_TEAM4)
52 if(pl.clientcolors & 1)
56 // total range of notes:
62 // *** ********************* ****
63 // -18.........................+12
64 // *** ********************* ****
65 // -18............................+15
71 void W_Tuba_Attack(float hittype)
74 W_SetupShot(self, FALSE, 2, "", cvar("g_balance_tuba_damage"));
75 self.tuba_notecount = !self.tuba_notecount;
76 sound(self, ((self.tuba_notecount) ? CHAN_WEAPON : CHAN_WEAPON2), TUBA_NOTE(Tuba_GetNote(self, hittype)), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), cvar("g_balance_tuba_attenuation"));
77 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);
79 o = gettaginfo(self.exteriorweaponentity, 0);
80 pointparticles(particleeffectnum("smoke_ring"), o + v_up * 45 + v_right * -6 + v_forward * 8, v_up * 100, 1);
83 void spawnfunc_weapon_tuba (void)
85 if(!sv_cheats && !cvar("developer"))
87 print("The @!#%'n Tuba awaits you... not.\n");
91 weapon_defaultspawnfunc(WEP_TUBA);
94 float w_tuba(float req)
98 // bots cannot play the Tuba well yet
99 // I think they should start with the recorder first
100 if(vlen(self.origin - self.enemy.origin) < cvar("g_balance_tuba_radius"))
103 self.BUTTON_ATCK = 1;
105 self.BUTTON_ATCK2 = 1;
108 else if (req == WR_THINK)
110 if (self.BUTTON_ATCK)
111 if (weapon_prepareattack(0, cvar("g_balance_tuba_refire")))
114 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_tuba_animtime"), w_ready);
116 if (self.BUTTON_ATCK2)
117 if (weapon_prepareattack(1, cvar("g_balance_tuba_refire")))
119 W_Tuba_Attack(HITTYPE_SECONDARY);
120 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_tuba_animtime"), w_ready);
123 else if (req == WR_PRECACHE)
125 precache_model ("models/weapons/g_tuba.md3");
126 precache_model ("models/weapons/v_tuba.md3");
127 precache_model ("models/weapons/h_tuba.dpm");
130 for(i = -18; i <= +27; ++i)
131 precache_sound(TUBA_NOTE(i));
133 else if (req == WR_SETUP)
134 weapon_setup(WEP_TUBA);
135 else if (req == WR_CHECKAMMO1)
136 return TRUE; // TODO use fuel?
137 else if (req == WR_CHECKAMMO2)
138 return TRUE; // TODO use fuel?
139 else if (req == WR_SUICIDEMESSAGE)
141 w_deathtypestring = "hurt his own ears with the @!#%'n Tuba";
143 else if (req == WR_KILLMESSAGE)
145 w_deathtypestring = "died of #'s great playing on the @!#%'n Tuba";