]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Merge branch 'master' into mirceakitsune/firing_buttons
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 19 Jul 2011 13:29:05 +0000 (16:29 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 19 Jul 2011 13:29:05 +0000 (16:29 +0300)
12 files changed:
data/balanceVT.cfg
data/defaultVT.cfg
data/effectinfo.txt
data/qcsrc/client/View.qc
data/qcsrc/common/constants.qh
data/qcsrc/menu/voret/crosshairbutton.c
data/qcsrc/menu/voret/dialog_multiplayer_playersetup_weapons.c
data/qcsrc/server/bot/havocbot/vore_ai.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/g_world.qc
data/qcsrc/server/vore.qc
data/qcsrc/server/w_grabber.qc

index 224465747816cb84cfa49c9bd6fb8399d9765bbc..dbe24064d51faa0437489b838c4bc49adb7313fc 100644 (file)
@@ -173,6 +173,7 @@ set g_balance_grabber_primary_grabbered_time_max 0 // infinite
 set g_balance_grabber_primary_grabbered_time_free 1 // 1s being grabbered are free\r
 set g_balance_grabber_primary_grabbered_fuel 5 // fuel per second grabbered\r
 set g_balance_grabber_primary_recoil 2.5\r
+set g_balance_grabber_secondary 1\r
 set g_balance_grabber_secondary_ammo 15\r
 set g_balance_grabber_secondary_refire 1.1\r
 set g_balance_grabber_secondary_animtime 1 // good melee anim\r
index b40744bb191ac40e8d5ecdd7d6bd66c8c9c0be7d..466a0739b3e094229285ef7220c6ce33ea329ff0 100644 (file)
@@ -107,14 +107,16 @@ _cl_color 187
 _cl_name "Player"\r
 _cl_playermodel models/player/vixen.zym\r
 _cl_playerskin 0\r
-crosshair 13\r
+seta crosshair 11\r
+seta crosshair_primary 13\r
+seta crosshair_secondary 14\r
 seta crosshair_color "1 1 0.5"\r
 seta crosshair_alpha 1\r
 seta crosshair_size 0.35\r
 seta crosshair_pickup 0.5 "crosshair grows then shrinks back when picking up an item"\r
 seta crosshair_color_by_health 1 "if enabled, crosshair color will depend on current health"\r
-seta crosshair_unarmed_dim_color 0.5 "dim crosshair color by this amount when we aren't holding a weapon"\r
-seta crosshair_unarmed_dim_alpha 0.5 "dim crosshair alpha by this amount when we aren't holding a weapon"\r
+seta crosshair_unarmed_dim_color 0.75 "dim crosshair color to this amount when we aren't holding a weapon"\r
+seta crosshair_unarmed_dim_alpha 0.75 "dim crosshair alpha to this amount when we aren't holding a weapon"\r
 seta crosshair_pickup_speed 4 "speed of the crosshair pickup effect"\r
 seta crosshair_ring_alpha 0.5 "alpha of the crosshair ammo ring"\r
 seta crosshair_ring_size 2.5 "size of the crosshair ammo ring"\r
index d0d93e572b7373c453fee220d7c8a0f4b51debd5..f4d920037032d30486481b0d4737d51914dde8dc 100644 (file)
@@ -4751,26 +4751,6 @@ velocityjitter 256 256 256
 velocitymultiplier -0.1\r
 \r
 \r
-// grabber melee\r
-// based off morphed's cl_gentle\r
-// used in qcsrc/server/w_grabber.qc\r
-effect grabber_melee\r
-tex 43 43\r
-count 3\r
-type spark\r
-color 0xffffff 0x0033ff\r
-size 8 16\r
-sizeincrease 34\r
-alpha 128 128 292\r
-gravity 0\r
-airfriction 5\r
-liquidfriction 10\r
-velocityjitter 25 25 25\r
-lightradius 200\r
-lightradiusfade 200\r
-lightcolor 0.4 0.7 0.9\r
-\r
-\r
 //torch flame, spawn it as fast as you can  20 times per second or more, supports direction but not required\r
 //fast fire\r
 // used nowhere in code, meant for maps\r
index c5d359ad45d3495f6c4f568be8c19f12b944f01e..aed53ade42fb5300c4baec8435bdb186847f822e 100644 (file)
@@ -1113,7 +1113,15 @@ void CSQC_UpdateView(float w, float h)
                        else if(swallow_indicator < 0)\r
                                wcross_style = "_canswallow_no.tga";\r
                        else\r
-                               wcross_style = cvar_string("crosshair");\r
+                       {\r
+                               // normal crosshair, based on what weapon we have and what firing type we can use\r
+                               if(!activeweapon)\r
+                                       wcross_style = cvar_string("crosshair");\r
+                               else if(getstati(STAT_CROSSHAIR_STYLE))\r
+                                       wcross_style = cvar_string("crosshair_secondary");\r
+                               else\r
+                                       wcross_style = cvar_string("crosshair_primary");\r
+                       }\r
 \r
                        if (wcross_style != "0") {\r
                                vector wcross_color, wcross_size;\r
index ea23f8619dcdc7570a2877d4865ba6d3d090bc50..d2e24ff033a7a23c3f637c1871fd8a6d80da3181 100644 (file)
@@ -286,11 +286,12 @@ const float STAT_VORE_DIGESTING = 54;
 const float STAT_VORE_EATEN = 55;\r
 const float STAT_VORE_CANLEAVE = 56;\r
 const float STAT_VORE_CANSWALLOW = 57;\r
-const float STAT_SBRING1_TYPE = 58;\r
-const float STAT_SBRING1_CLIP = 59;\r
-const float STAT_SBRING2_TYPE = 60;\r
-const float STAT_SBRING2_CLIP = 61;\r
-const float STAT_HUD = 62;\r
+const float STAT_CROSSHAIR_STYLE = 58;\r
+const float STAT_SBRING1_TYPE = 59;\r
+const float STAT_SBRING1_CLIP = 60;\r
+const float STAT_SBRING2_TYPE = 61;\r
+const float STAT_SBRING2_CLIP = 62;\r
+const float STAT_HUD = 63;\r
 const float HUD_NORMAL = 0;\r
 const float CTF_STATE_ATTACK = 1;\r
 const float CTF_STATE_DEFEND = 2;\r
index dd3f91ebbfdd80d52b00e3b16175a1d25d24c79c..228b265287e565b69a4dc160e114b97cd232cd76 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef INTERFACE\r
 CLASS(VoretCrosshairButton) EXTENDS(RadioButton)\r
-       METHOD(VoretCrosshairButton, configureVoretCrosshairButton, void(entity, float, float))\r
+       METHOD(VoretCrosshairButton, configureVoretCrosshairButton, void(entity, float, float, string))\r
        METHOD(VoretCrosshairButton, setChecked, void(entity, float))\r
        METHOD(VoretCrosshairButton, draw, void(entity))\r
        ATTRIB(VoretCrosshairButton, fontSize, float, SKINFONTSIZE_NORMAL)\r
@@ -14,20 +14,20 @@ CLASS(VoretCrosshairButton) EXTENDS(RadioButton)
        METHOD(VoretCrosshairButton, loadCvars, void(entity))\r
        METHOD(VoretCrosshairButton, saveCvars, void(entity))\r
 ENDCLASS(VoretCrosshairButton)\r
-entity makeVoretCrosshairButton(float, float);\r
+entity makeVoretCrosshairButton(float, float, string);\r
 #endif\r
 \r
 #ifdef IMPLEMENTATION\r
-entity makeVoretCrosshairButton(float theGroup, float theCrosshair)\r
+entity makeVoretCrosshairButton(float theGroup, float theCrosshair, string theCvar)\r
 {\r
        entity me;\r
        me = spawnVoretCrosshairButton();\r
-       me.configureVoretCrosshairButton(me, theGroup, theCrosshair);\r
+       me.configureVoretCrosshairButton(me, theGroup, theCrosshair, theCvar);\r
        return me;\r
 }\r
-void configureVoretCrosshairButtonVoretCrosshairButton(entity me, float theGroup, float theCrosshair)\r
+void configureVoretCrosshairButtonVoretCrosshairButton(entity me, float theGroup, float theCrosshair, string theCvar)\r
 {\r
-       me.cvarName = "crosshair";\r
+       me.cvarName = theCvar;\r
        me.cvarValueFloat = theCrosshair;\r
        me.loadCvars(me);\r
        me.configureRadioButton(me, string_null, me.fontSize, me.image, theGroup, 0);\r
index c25086211e27d2db0a53a675cad6bfeb7e44c878..cd9659e3113c3d8c18433e18a34205173a0a5dcd 100644 (file)
@@ -5,9 +5,9 @@ CLASS(VoretWeaponsDialog) EXTENDS(VoretDialog)
        METHOD(VoretWeaponsDialog, showNotify, void(entity))\r
        ATTRIB(VoretWeaponsDialog, title, string, "Weapon & Crosshair settings")\r
        ATTRIB(VoretWeaponsDialog, color, vector, SKINCOLOR_DIALOG_WEAPONS)\r
-       ATTRIB(VoretWeaponsDialog, intendedWidth, float, 0.7)\r
+       ATTRIB(VoretWeaponsDialog, intendedWidth, float, 1)\r
        ATTRIB(VoretWeaponsDialog, rows, float, 20)\r
-       ATTRIB(VoretWeaponsDialog, columns, float, 4)\r
+       ATTRIB(VoretWeaponsDialog, columns, float, 8)\r
        ATTRIB(VoretWeaponsDialog, weaponsList, entity, NULL)\r
 ENDCLASS(VoretWeaponsDialog)\r
 #endif\r
@@ -51,16 +51,41 @@ void fillVoretWeaponsDialog(entity me)
        me.TD(me, 1, 3, makeVoretTextLabel(0, "Weapon crosshair settings:"));\r
        me.TR(me);\r
                me.TDempty(me, 0.3);\r
-               me.TD(me, 1, 1, e = makeVoretTextLabel(0, "Crosshair:"));\r
+               me.TD(me, 1, 1, e = makeVoretTextLabel(0, "Unarmed style:"));\r
                for(i = 1; i <= 10; ++i) {\r
-                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(3, i), '1 1 0');\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(1, i, "crosshair"), '1 1 0');\r
                }\r
        me.TR(me);\r
                me.TDempty(me, 0.3);\r
                me.TDempty(me, 1);\r
                for(i = 11; i <= 20; ++i) {\r
-                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(3, i), '1 1 0');\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(1, i, "crosshair"), '1 1 0');\r
                }\r
+       me.TR(me);\r
+               me.TDempty(me, 0.3);\r
+               me.TD(me, 1, 1, e = makeVoretTextLabel(0, "Primary style:"));\r
+               for(i = 1; i <= 10; ++i) {\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(2, i, "crosshair_primary"), '1 1 0');\r
+               }\r
+       me.TR(me);\r
+               me.TDempty(me, 0.3);\r
+               me.TDempty(me, 1);\r
+               for(i = 11; i <= 20; ++i) {\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(2, i, "crosshair_primary"), '1 1 0');\r
+               }\r
+       me.TR(me);\r
+               me.TDempty(me, 0.3);\r
+               me.TD(me, 1, 1, e = makeVoretTextLabel(0, "Secondary style:"));\r
+               for(i = 1; i <= 10; ++i) {\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(3, i, "crosshair_secondary"), '1 1 0');\r
+               }\r
+       me.TR(me);\r
+               me.TDempty(me, 0.3);\r
+               me.TDempty(me, 1);\r
+               for(i = 11; i <= 20; ++i) {\r
+                       me.TDNoMargin(me, 1, 2.5 / 10, e = makeVoretCrosshairButton(3, i, "crosshair_secondary"), '1 1 0');\r
+               }\r
+       me.TR(me);\r
        me.TR(me);\r
                me.TDempty(me, 0.3);\r
                me.TD(me, 1, 1.25, e = makeVoretTextLabel(0, "Crosshair Size:"));\r
@@ -90,7 +115,9 @@ void fillVoretWeaponsDialog(entity me)
        me.TR(me);\r
                me.TDempty(me, 0.6);\r
                me.TD(me, 1, 2, e = makeVoretCheckBox(0, "crosshair_color_by_health", "Colorize by health"));\r
-       me.TR(me);\r
+\r
+       me.gotoRC(me, 0, 4); me.setFirstColumn(me, me.currentColumn);\r
+       me.TD(me, 1, 3, makeVoretTextLabel(0, "Crosshair effects:"));\r
        me.TR(me);\r
                me.TDempty(me, 0.3);\r
                me.TD(me, 1, 1.25, e = makeVoretTextLabel(0, "Hit test:"));\r
index 7c35ff944e003894938f6318019af41659d696bf..52be2a4120dac13b74109c7a984be3c7ef433fbd 100644 (file)
@@ -1,5 +1,5 @@
 .float status_teamhealing; // 0 = can't team heal, 1 = can team heal, 2 = team healing right now
-.float hold_BUTTON_ATCK; // marks the bot holding the fire button after having decided on his prey
+.float hold_BUTTON_ATCK2; // marks the bot holding the fire button after having decided on his prey
 
 float Swallow_condition_check_bot(entity prey)
 {
@@ -81,18 +81,18 @@ void Vore_AI_Teamheal(entity prey)
        if(prey.health < cvar("g_balance_vore_teamheal_stable"))
        if not(prey.digesting) // if our team mate is digesting someone, he likely wouldn't want us ruining his frag
        if not(prey.flagcarried) // don't eat the flag carrier and ruin his job
-       if not(prey.BUTTON_ATCK || prey.BUTTON_ATCK2) // our team mate wouldn't want us eating him while he's firing
+       if not(prey.BUTTON_ATCK || prey.BUTTON_ATCK2) // our team mate wouldn't want us eating him while he's attacking
        {
                if(time > self.decide_swallow)
                {
                        // base the decision around HOW damaged the team mate is, centered around 100 health
                        if(skill * (100 / prey.health) >= random() * 10) // there are 10 bot skill steps
-                               self.hold_BUTTON_ATCK = TRUE; // swallow the team mate
+                               self.hold_BUTTON_ATCK2 = TRUE; // swallow the team mate
                        self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly
                }
        }
        else
-               self.hold_BUTTON_ATCK = FALSE;
+               self.hold_BUTTON_ATCK2 = FALSE;
 }
 
 void Vore_AI()
@@ -169,18 +169,18 @@ void Vore_AI()
                                if(skill / fear >= randomtry)
                                if not(teams_matter && prey.team == self.team)
                                {
-                                       self.hold_BUTTON_ATCK = TRUE; // swallow
+                                       self.hold_BUTTON_ATCK2 = TRUE; // swallow
                                        self.decide_pred = time + decide_pred_time; // time before the bot decides what to do with his prey
                                }
                                self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly
                        }
                }
                else
-                       self.hold_BUTTON_ATCK = FALSE;
+                       self.hold_BUTTON_ATCK2 = FALSE;
 
                // if the bot is holding the firing button, apply that to the actual fire key
-               if(self.hold_BUTTON_ATCK)
-                       self.BUTTON_ATCK = TRUE;
+               if(self.hold_BUTTON_ATCK2)
+                       self.BUTTON_ATCK2 = TRUE;
 
                // deciding what to do with a victim:
 
index 11d295d25c38c62a3523f210b5b8c5690bcab154..2857578f835b99a174089c5c587a03beaee7e130 100644 (file)
@@ -608,6 +608,7 @@ string matchid;
 .float stats_fired[WEP_MAXCOUNT];  // for hitscan bullets fired\r
 \r
 .float stat_sbring1_type, stat_sbring1_clip, stat_sbring2_type, stat_sbring2_clip;\r
+.float stat_crosshair_style;\r
 \r
 .float stat_leadlimit;\r
 \r
index 331e3a685333246da39732e92820c4d11ea2fb88..13ad0071b5eeadf572f11409fd86491908e26b4b 100644 (file)
@@ -664,6 +664,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_VORE_DIGESTING, AS_INT, stat_digesting);\r
        addstat(STAT_VORE_EATEN, AS_INT, stat_eaten);\r
        addstat(STAT_VORE_CANLEAVE, AS_INT, stat_canleave);\r
+       addstat(STAT_CROSSHAIR_STYLE, AS_INT, stat_crosshair_style);\r
        addstat(STAT_SBRING1_TYPE, AS_INT, stat_sbring1_type);\r
        addstat(STAT_SBRING1_CLIP, AS_FLOAT, stat_sbring1_clip);\r
        addstat(STAT_SBRING2_TYPE, AS_INT, stat_sbring2_type);\r
index febc062e7cf86f2410a66f90941a1357992c6c31..855b402eb1f5d5d92a90f4cd384d677d47b204da 100644 (file)
@@ -60,7 +60,7 @@ float Swallow_condition_check(entity prey)
 \r
                if(swallow_complain != "")\r
                {\r
-                       if(time > self.complain_vore && self.BUTTON_ATCK)\r
+                       if(time > self.complain_vore && self.BUTTON_ATCK2)\r
                        {\r
                                play2(self, "misc/forbidden.wav");\r
                                sprint(self, swallow_complain);\r
@@ -782,7 +782,7 @@ void Vore()
                else\r
                        self.stat_canswallow = 1;\r
 \r
-               if(self.BUTTON_ATCK)\r
+               if(self.BUTTON_ATCK2)\r
                        Vore_SwallowStep(prey);\r
        }\r
        else if(prey != world)\r
index 7e931f33f4d3f74502488e1adbb3d4295782ad2f..bd5f3431e72603f42ea254fa50e602580fe61b6c 100644 (file)
@@ -41,9 +41,7 @@ void W_Grabber_Attack2()
 \r
        WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));\r
 \r
-       pointparticles(particleeffectnum("grabber_melee"), w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), '0 0 0', 1);\r
-\r
-       if (trace_fraction < 1)\r
+       if(trace_fraction < 1) // should always be true, but just in case\r
        {\r
                Damage(trace_ent, self, self, cvar("g_balance_grabber_secondary_damage"), WEP_GRABBER | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_grabber_secondary_force") * w_shotdir);\r
                pointparticles(particleeffectnum("grabber_impact2"), trace_endpos, '0 0 0', 1);\r
@@ -80,6 +78,14 @@ float w_grabber(float req)
        }\r
        else if (req == WR_THINK)\r
        {\r
+               // determine by distance if this will be primary fire or alternate fire\r
+               W_SetupShot (self, TRUE, 0, "", 0); // do this to update w_shotorg\r
+               WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_grabber_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));\r
+               if(cvar("g_balance_grabber_secondary") && trace_fraction < 1 && !self.grabber) // not if hooked or firing the hook\r
+                       self.stat_crosshair_style = 1;\r
+               else\r
+                       self.stat_crosshair_style = 0;\r
+\r
                grabbered_fuel = cvar("g_balance_grabber_primary_grabbered_fuel");\r
                // forced reload\r
                if(cvar("g_balance_grabber_reload_ammo") && self.clip_load < min(cvar("g_balance_grabber_primary_ammo"), cvar("g_balance_grabber_secondary_ammo"))\r
@@ -88,12 +94,10 @@ float w_grabber(float req)
                        if(self.ammo_fuel >= 1) // we only have one weapon in VT, so nothing else to switch to if we're out of ammo\r
                                weapon_action(self.weapon, WR_RELOAD);\r
                }\r
-               else if not(self.clip_load < 0) // we're not currently reloading\r
+               else if(self.clip_load >= 0 && !self.stat_eaten) // we're not currently reloading or eaten\r
                {\r
-                       if (self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO1))\r
+                       if(!self.stat_crosshair_style && self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO1)) // primary attack\r
                        {\r
-                               if(self.stat_eaten) // we can't use weapons while in the stomach\r
-                                       return FALSE;\r
                                if(time < self.weapon_delay)\r
                                        return FALSE;\r
 \r
@@ -110,11 +114,8 @@ float w_grabber(float req)
                                        weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_grabber_primary_animtime"), w_ready);                               \r
                                }\r
                        }\r
-                       if (self.BUTTON_ATCK2 && weapon_action(self.weapon, WR_CHECKAMMO2))\r
+                       else if (self.BUTTON_ATCK && weapon_action(self.weapon, WR_CHECKAMMO2)) // secondary attack\r
                        {\r
-                       \r
-                               if(self.stat_eaten) // we can't use weapons while in the stomach\r
-                                       return FALSE;\r
                                if (weapon_prepareattack(1, cvar("g_balance_grabber_secondary_refire")))\r
                                {\r
                                        W_Grabber_Attack2();\r