8#define MAX_TUBANOTES 32
15 float i, j, mmin, mmax, nolength;
17 if(n > pl.(weaponentity).tuba_lastnotes_cnt)
22 if(pl.(weaponentity).tuba_instrument != instrument)
27 for(i = 0; i < n; ++i)
38 if(ignorepitch && i == 0)
40 pitchshift = np - v.z;
44 if(v.z + pitchshift != np)
55 mmin = 240 / maxtempo;
59 mmax = 240 / mintempo;
64 for(i = 0; i < n; ++i)
68 ti -= 1 / (ai -
floor(ai));
70 for(j = i+1; j < n; ++j)
74 tj -= (aj -
floor(aj));
90 mmin =
max(mmin, (vi.x - vj.y) / (ti - tj));
91 mmax =
min(mmax, (vi.y - vj.x) / (ti - tj));
112 if (actor.(weaponentity).tuba_note ==
this)
127 bprint(
strcat(
"\{1}\{13}* ^3", actor.netname,
"^3 played on the @!#%'n Tuba: ^7", s,
"\n"));
130 bprint(
strcat(
"\{1}\{13}* ^3", actor.netname,
"^3 played on the @!#%'n Accordeon: ^7", s,
"\n"));
133 bprint(
strcat(
"\{1}\{13}* ^3", actor.netname,
"^3 played on the @!#%'n Klein Bottle: ^7", s,
"\n"));
145 else if (
CS(pl).
movement.x > 0) movestate += 3;
147 else if (
CS(pl).
movement.y > 0) movestate += 1;
161 case 1: note = -6;
break;
162 case 2: note = -5;
break;
163 case 3: note = -4;
break;
164 case 4: note = +5;
break;
166 case 5: note = 0;
break;
167 case 6: note = +2;
break;
168 case 7: note = +3;
break;
169 case 8: note = +4;
break;
170 case 9: note = -1;
break;
190 if(pl.clientcolors & 1)
245 v = this.
origin - (it.origin + it.view_ofs);
246 vol0 =
max(0, 1 -
vlen(v) * dist_mult);
248 v = this.
realowner.origin - (it.origin + it.view_ofs);
249 vol1 =
max(0, 1 -
vlen(v) * dist_mult);
251 if(
fabs(vol0 - vol1) > 0.005)
257 if(dir0 * dir1 < 0.9994)
271 if(actor.(weaponentity).tuba_instrument & 1)
273 if(actor.(weaponentity).tuba_instrument & 2)
276 W_SetupShot(actor, weaponentity,
false, 2, SND_Null, 0,
WEP_CVAR(WEP_TUBA, damage), hittype | WEP_TUBA.m_id);
278 if(actor.(weaponentity).tuba_note)
280 if(actor.(weaponentity).tuba_note.cnt != n || actor.(weaponentity).tuba_note.tuba_instrument != actor.(weaponentity).tuba_instrument)
286 if(!actor.(weaponentity).tuba_note)
289 note.weaponentity_fld = weaponentity;
291 note.owner = note.realowner = actor;
295 note.nextthink =
time;
296 note.spawnshieldtime =
time;
303 RadiusDamage(actor, actor,
WEP_CVAR(WEP_TUBA, damage),
WEP_CVAR(WEP_TUBA, edgedamage),
WEP_CVAR(WEP_TUBA,
radius),
NULL,
NULL,
WEP_CVAR(WEP_TUBA, force), hittype | WEP_TUBA.m_id, weaponentity,
NULL);
305 if(
time > actor.(weaponentity).tuba_smoketime)
309 if(actor.(weaponentity).tuba_instrument == 1)
311 else if(actor.(weaponentity).tuba_instrument == 2)
348 if (actor.(weaponentity).tuba_note)
350 if (!(fire & (1 | 2)))
365 if (actor.(weaponentity).state ==
WS_READY)
367 switch (actor.(weaponentity).tuba_instrument)
375 actor.(weaponentity).
weaponname =
"kleinbottle";
383 if(actor.(weaponentity).tuba_instrument & 1)
385 if(actor.(weaponentity).tuba_instrument & 2)
387 W_SetupShot(actor, weaponentity,
false, 0, SND_Null, 0, 0, hittype | WEP_TUBA.m_id);
404 return WEAPON_KLEINBOTTLE_SUICIDE;
406 return WEAPON_ACCORDEON_SUICIDE;
408 return WEAPON_TUBA_SUICIDE;
413 return WEAPON_KLEINBOTTLE_MURDER;
415 return WEAPON_ACCORDEON_MURDER;
417 return WEAPON_TUBA_MURDER;
424 return (wep.tuba_instrument == 0) ?
"tuba" :
425 (wep.tuba_instrument == 1) ?
"akordeon" :
433#define TUBA_STARTNOTE(i, n) _Sound_fixpath(W_Sound(strcat("tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n))))
462 speed1 = (2.0 ** (m / 12.0));
468 speed1 = (2.0 ** (m / 12.0));
475 }
else if (restart) {
495 this.tuba_volume -=
frametime * this.tuba_volume_initial / f;
497 this.tuba_volume = 0;
500 if (this.tuba_volume <= 0) {
515 this.
enemy.tuba_volume_initial = this.
enemy.tuba_volume;
516 this.
enemy.note = this.note;
544 this.
enemy.enemy =
new(tuba_note_2);
549 this.
enemy.tuba_attenuate = att;
561 if (this.
enemy.enemy) {
562 setorigin(this.
enemy.enemy,
this.enemy.origin);
582 LOG_WARN(
"requested pitch shifting, but not supported by this engine build");
602 PAR(_(
"The %s is a unique weapon that makes the ears of nearby enemies bleed by playing awful sounds, also slightly knocking them back."),
COLORED_NAME(
this));
603 PAR(_(
"The secondary fire works the same way, playing a higher pitch."));
604 PAR(_(
"The only ammo it needs to operate is the breath from your lungs."));
605 PAR(_(
"Since your enemies need to be close by to hear your rubbish music, the %s is only effective at very close ranges."),
COLORED_NAME(
this));
606 PAR(_(
"The pitch the %s plays depends on the movement keys pressed."),
COLORED_NAME(
this));
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
#define PHYS_INPUT_BUTTON_CROUCH(s)
#define PHYS_INPUT_BUTTON_JUMP(s)
#define PHYS_INPUT_BUTTON_ATCK(s)
#define PHYS_INPUT_BUTTON_ATCK2(s)
float W_WeaponRateFactor(entity this)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
const int HITTYPE_SECONDARY
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
#define NET_HANDLE(id, param)
#define WriteHeader(to, id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin)
float pymod(float e, float f)
Pythonic mod: TODO: %% operator?
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
entity Notification
always last
#define METHOD(cname, name, prototype)
#define _sound(e, c, s, v, a)
#define sound(e, c, s, v, a)
bool sound_allowed(int to, entity e)
ClientState CS(Client this)
#define PRECACHE(func)
directly after STATIC_INIT_LATE
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
int W_Tuba_GetNote(entity pl, int hittype)
void Ent_TubaNote_UpdateSound(entity this)
void Ent_TubaNote_StopSound(entity this)
void Ent_TubaNote_Think(entity this)
void tubasound(entity e, bool restart)
vector tuba_lastnotes[MAX_TUBANOTES]
bool W_Tuba_HasPlayed(entity pl,.entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
const int TUBA_INSTRUMENTS
bool W_Tuba_NoteSendEntity(entity this, entity to, int sf)
void W_Tuba_NoteOn(entity actor,.entity weaponentity, float hittype)
void W_Tuba_NoteOff(entity this)
void W_Tuba_NoteThink(entity this)
#define TUBA_STARTNOTE(i, n)
float tuba_lastnotes_last
float autocvar_cl_tuba_fadetime
float autocvar_cl_tuba_attenuation
float autocvar_cl_tuba_pitchstep
float autocvar_cl_tuba_volume
float autocvar_snd_soundradius
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
string W_Guide_Keybinds(Weapon wep)
string W_Guide_DPS_onlyOne_unnamed(string name)
#define WEP_CVAR(wep, name)
const int WS_READY
idle frame
const int WS_INUSE
fire state
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
bool weapon_prepareattack(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)