From 23e422ddcc3d16f6244139e28883b9c592ac184e Mon Sep 17 00:00:00 2001 From: div0 Date: Sat, 6 Jun 2009 19:57:38 +0000 Subject: [PATCH] Here it is: the @!#%'n Tuba. But it does not work yet, audio samples do not exist yet. DO NOT MERGE THIS INTO BRANCH. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6894 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/defaultNexuiz.cfg | 6 +++ data/qcsrc/common/items.qc | 1 + data/qcsrc/common/items.qh | 5 +- data/qcsrc/server/progs.src | 1 + data/qcsrc/server/w_tuba.qc | 95 +++++++++++++++++++++++++++++++++++++ data/weapons.cfg | 10 ++++ 6 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 data/qcsrc/server/w_tuba.qc diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index 18a9ce546..4e5e45202 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -186,6 +186,12 @@ seta crosshair_campingrifle_color_green 0.5 "crosshair color green component to seta crosshair_campingrifle_color_blue 0.25 "crosshair color blue component to display when wielding the campingrifle" seta crosshair_campingrifle_color_alpha 1 "crosshair alpha value to display when wielding the campingrifle" seta crosshair_campingrifle_size 0.85 "crosshair size when wielding the campingrifle" +seta crosshair_tuba "" "crosshair to display when wielding the tuba" +seta crosshair_tuba_color_red 0.85 "crosshair color red component to display when wielding the tuba" +seta crosshair_tuba_color_green 0.5 "crosshair color green component to display when wielding the tuba" +seta crosshair_tuba_color_blue 0.25 "crosshair color blue component to display when wielding the tuba" +seta crosshair_tuba_color_alpha 1 "crosshair alpha value to display when wielding the tuba" +seta crosshair_tuba_size 0.85 "crosshair size when wielding the tuba" fov 90 seta cl_zoomfactor 5 "how much +zoom will zoom (1-16)" seta cl_zoomspeed 3.5 "how fast it will zoom (0.5-16), negative values mean instant zoom" diff --git a/data/qcsrc/common/items.qc b/data/qcsrc/common/items.qc index 5be7ad5d3..ab9210b38 100644 --- a/data/qcsrc/common/items.qc +++ b/data/qcsrc/common/items.qc @@ -113,6 +113,7 @@ void RegisterWeapons() register_weapon(WEP_SEEKER, w_seeker, IT_ROCKETS, 8, 0, 0, BOT_PICKUP_RATING_HIGH, "seeker", "seeker", "T.A.G. Seeker"); register_weapon(WEP_HLAC, w_hlac, IT_CELLS, 6, 1, 0, BOT_PICKUP_RATING_MID, "hlac", "hlac", "Heavy Laser Assault Cannon"); register_weapon(WEP_CAMPINGRIFLE, w_campingrifle, IT_NAILS, 3, 1, 0, BOT_PICKUP_RATING_MID, "campingrifle", "campingrifle", "Rifle"); + register_weapon(WEP_TUBA, w_tuba, 0, 1, 0, 0, BOT_PICKUP_RATING_MID, "tuba", "tuba", "@!#%'n Tuba"); register_weapons_done(); } diff --git a/data/qcsrc/common/items.qh b/data/qcsrc/common/items.qh index 8c71693fa..774776cd5 100644 --- a/data/qcsrc/common/items.qh +++ b/data/qcsrc/common/items.qh @@ -16,8 +16,9 @@ float WEP_HOOK = 12; float WEPBIT_HOOK = 2048; float WEP_HLAC = 13; float WEPBIT_HLAC = 4096; float WEP_SEEKER = 14; float WEPBIT_SEEKER = 8192; float WEP_CAMPINGRIFLE = 15; float WEPBIT_CAMPINGRIFLE = 16384; -float WEP_LAST = 15; float WEPBIT_ALL = 32767; -float WEP_COUNT = 16; +float WEP_TUBA = 16; float WEPBIT_TUBA = 32768; +float WEP_LAST = 16; float WEPBIT_ALL = 65535; +float WEP_COUNT = 17; float BOT_PICKUP_RATING_LOW = 2500; float BOT_PICKUP_RATING_MID = 5000; diff --git a/data/qcsrc/server/progs.src b/data/qcsrc/server/progs.src index f54ebe76b..83f069fad 100644 --- a/data/qcsrc/server/progs.src +++ b/data/qcsrc/server/progs.src @@ -105,6 +105,7 @@ w_hook.qc w_hlac.qc w_seeker.qc w_campingrifle.qc +w_tuba.qc t_items.qc cl_weapons.qc diff --git a/data/qcsrc/server/w_tuba.qc b/data/qcsrc/server/w_tuba.qc new file mode 100644 index 000000000..1d3c60def --- /dev/null +++ b/data/qcsrc/server/w_tuba.qc @@ -0,0 +1,95 @@ +float Tuba_GetNote(entity pl, float hittype) +{ + float note; + float movestate; + print(etos(pl), "\n"); + movestate = 5; + if(pl.movement_x < 0) movestate -= 3; + if(pl.movement_x > 0) movestate += 3; + if(pl.movement_y < 0) movestate -= 1; + if(pl.movement_y > 0) movestate += 1; + switch(movestate) + { + case 1: note = -6; break; // Gb + case 2: note = -5; break; // G + case 3: note = -4; break; // G# + case 4: note = -1; break; // B + case 5: note = 0; break; // c + case 6: note = +2; break; // d + case 7: note = +3; break; // eb + case 8: note = +4; break; // e + case 9: note = +5; break; // e# + } + print(ftos(movestate), "\n"); + if(pl.BUTTON_CROUCH) + note -= 12; + if(hittype & HITTYPE_SECONDARY) + note += 7; + + // total range of notes: + // 0 + // *** ** **** + // *** ** **** + // *** ** **** + // *** ** **** + // -18.........................+12 + return note; +} + +void W_Tuba_Attack(float hittype) +{ + W_SetupShot(self, FALSE, 2, ""); + sound(self, CHAN_WEAPON, strcat("weapons/tuba_note", ftos(Tuba_GetNote(self, hittype)), ".wav"), VOL_BASE, cvar("g_balance_tuba_attenuation")); + 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); +} + +void spawnfunc_weapon_tuba (void) +{ + error("The tuba does not work yet. Forget it."); + weapon_defaultspawnfunc(WEP_TUBA); +} + +float w_tuba(float req) +{ + if (req == WR_AIM) + { + // bots cannot play the Tuba yet + // I think they should start with the recorder first + } + else if (req == WR_THINK) + { + if (self.BUTTON_ATCK) + if (weapon_prepareattack(0, cvar("g_balance_tuba_refire"))) + { + W_Tuba_Attack(0); + weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_tuba_animtime"), w_ready); + } + if (self.BUTTON_ATCK2) + if (weapon_prepareattack(1, cvar("g_balance_tuba_refire"))) + { + W_Tuba_Attack(HITTYPE_SECONDARY); + weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_tuba_animtime"), w_ready); + } + } + else if (req == WR_PRECACHE) + { + precache_model ("models/weapons/g_tuba.md3"); + precache_model ("models/weapons/v_tuba.md3"); + precache_model ("models/weapons/h_tuba.dpm"); + } + else if (req == WR_SETUP) + weapon_setup(WEP_TUBA); + else if (req == WR_CHECKAMMO1) + return TRUE; // TODO use fuel? + else if (req == WR_CHECKAMMO2) + return TRUE; // TODO use fuel? + else if (req == WR_SUICIDEMESSAGE) + { + w_deathtypestring = "hurt his own ears"; + } + else if (req == WR_KILLMESSAGE) + { + w_deathtypestring = "died of #'s great playing"; + } + return TRUE; +}; diff --git a/data/weapons.cfg b/data/weapons.cfg index 6103019c5..2bbe0be16 100644 --- a/data/weapons.cfg +++ b/data/weapons.cfg @@ -24,6 +24,7 @@ set g_weaponreplace_hook "" set g_weaponreplace_seeker "" set g_weaponreplace_hlac "" set g_weaponreplace_campingrifle "" +set g_weaponreplace_tuba "" set g_start_weapon_laser -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default" @@ -41,6 +42,7 @@ set g_start_weapon_hook -1 "0 = never provide the weapon, 1 = always provide the set g_start_weapon_hlac -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default" set g_start_weapon_seeker -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default" set g_start_weapon_campingrifle -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default" +set g_start_weapon_tuba -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default" set g_start_ammo_shells 40 set g_start_ammo_nails 0 set g_start_ammo_rockets 0 @@ -415,3 +417,11 @@ set g_balance_campingrifle_secondary_refire 0.12 set g_balance_campingrifle_secondary_animtime 0.1 set g_balance_campingrifle_secondary_ammo 10 set g_balance_campingrifle_secondary_bulletconstant 130 // 18.3qu + +set g_balance_tuba_refire 0.3 +set g_balance_tuba_animtime 0.3 +set g_balance_tuba_attenuation 0.5 +set g_balance_tuba_damage 80 +set g_balance_tuba_edgedamage 0 +set g_balance_tuba_radius 100 +set g_balance_tuba_force 200 -- 2.39.2