]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' of git://de.git.xonotic.org/xonotic/xonotic-data.pk3dir
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 10 Oct 2011 10:06:31 +0000 (12:06 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 10 Oct 2011 10:06:31 +0000 (12:06 +0200)
18 files changed:
defaultXonotic.cfg
models/gibs/chunk.mdl_0.tga
qcsrc/client/tuba.qc
qcsrc/common/util.qc
qcsrc/menu/xonotic/dialog_settings_audio.c
qcsrc/server/autocvars.qh
qcsrc/server/bot/havocbot/role_assault.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/defs.qh
qcsrc/server/g_subs.qc
qcsrc/server/g_triggers.qc
qcsrc/server/playerstats.qc
qcsrc/server/t_jumppads.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/w_shotgun.qc

index 7f18fa9c8fbdffab306afbe49c1c2d3fb62aa86f..e6b22dfa5b722cbe08428daec24045a79c6b33b3 100644 (file)
@@ -353,7 +353,6 @@ set sv_timeout_resumetime 3 "how long the remaining timeout-time will be after a
 
 set g_allow_oldnexbeam 0 "If enabled, clients are allowed to use old v2.3 Nexgun beam"
 seta cl_particles_oldnexbeam 0 "Uses the old v2.3 Nexgun beam instead of the new beam, only works if server allows it (g_allow_oldnexbeam 1)"
-set sv_qcweaponanimation 0
 
 set g_telefrags 1 "telefragging, i.e. killing someone who stands in the way of someone who is teleporting"
 set g_telefrags_teamplay 1 "never telefrag team mates"
@@ -387,6 +386,7 @@ set sv_doublejump 0 "allow Quake 2-style double jumps"
 set sv_jumpspeedcap_min "" "lower bound on the baseline velocity of a jump; final velocity will be >= (jumpheight * min + jumpheight)"
 set sv_jumpspeedcap_max "" "upper bound on the baseline velocity of a jump; final velocity will be <= (jumpheight * max + jumpheight)"
 set sv_jumpspeedcap_max_disable_on_ramps 0 "disable upper baseline velocity bound on ramps to preserve the old rampjump style"
+set sv_player_jumpanim_minfall 48 "minimum distance player has to have below their feet before the jump animation will be activated (only when falling, +jump will play anim instantly)"
 
 seta sv_precacheplayermodels 1
 seta sv_precacheweapons 0
@@ -2160,6 +2160,11 @@ set g_playerstats_debug 0 "when 1, player stats are dumped to the console too"
 
 // create this cvar in case the engine did not
 set snd_soundradius 1200
+seta menu_snd_attenuation_method 1 "Use exponential instead of linear falloff for sound attenuation"
+alias snd_attenuation_method_0 "set menu_snd_attenuation_method 0; set snd_soundradius 1200; set snd_attenuation_exponent 1; set snd_attenuation_decibel 0" // Quake default
+alias snd_attenuation_method_1 "set menu_snd_attenuation_method 1; set snd_soundradius 2400; set snd_attenuation_exponent 4; set snd_attenuation_decibel 0" // nice approximation for method 2
+alias snd_attenuation_method_2 "set menu_snd_attenuation_method 2; set snd_soundradius 1200; set snd_attenuation_exponent 0; set snd_attenuation_decibel 10" // warning: plays sounds within up to 6000qu
+snd_attenuation_method_1
 
 // declare the channels we use
 seta snd_channel8volume 1 "QuakeC controlled background music volume"
index 4f4dd290027b7de669704449c36b110cd3acd5c9..4192b709db08d7e17f557ad4f18b02fd7e75e741 100644 (file)
Binary files a/models/gibs/chunk.mdl_0.tga and b/models/gibs/chunk.mdl_0.tga differ
index 6e1c1f9bd78b2ab3480a1054020fbec475edbc86..13e37f0e770fc748366256a94e877804ede48aaa 100644 (file)
@@ -117,9 +117,11 @@ void Ent_TubaNote_StopSound()
 
 void Ent_TubaNote(float bIsNew)
 {
-       float f, n, i, att;
+       float f, n, i, att, upd;
        f = ReadByte();
 
+       upd = 0;
+
        if(f & 1)
        {
                n = ReadChar();
@@ -151,7 +153,7 @@ void Ent_TubaNote(float bIsNew)
                {
                        self.note = n;
                        self.tuba_instrument = i;
-                       Ent_TubaNote_UpdateSound();
+                       upd = 1;
                }
        }
 
@@ -169,6 +171,9 @@ void Ent_TubaNote(float bIsNew)
        self.entremove = Ent_TubaNote_StopSound;
        self.enemy.think = Ent_TubaNote_Think;
        self.enemy.nextthink = time + 10;
+
+       if(upd)
+               Ent_TubaNote_UpdateSound();
 }
 
 void Tuba_Precache()
index 23d4f3431941958bbf188467aa90ab8ede62061e..eb1ef20bf9fe2fa6e9d411e6d111222057c5fb71 100644 (file)
@@ -1153,11 +1153,6 @@ float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) {retu
 
 float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLengthUpToWidth_widthFunction_t w)
 {
-       float ICanHasKallerz;
-
-       // detect color codes support in the width function
-       ICanHasKallerz = (w("^7", theSize) == 0);
-
        // STOP.
        // The following function is SLOW.
        // For your safety and for the protection of those around you...
@@ -1181,7 +1176,7 @@ float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLe
        }
        while(left < right - 1);
 
-       if(ICanHasKallerz)
+       if(w("^7", theSize) == 0) // detect color codes support in the width function
        {
                // NOTE: when color codes are involved, this binary search is,
                // mathematically, BROKEN. However, it is obviously guaranteed to
@@ -1222,11 +1217,6 @@ float textLengthUpToWidth(string theText, float maxWidth, vector theSize, textLe
 
 float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t w)
 {
-       float ICanHasKallerz;
-
-       // detect color codes support in the width function
-       ICanHasKallerz = (w("^7") == 0);
-
        // STOP.
        // The following function is SLOW.
        // For your safety and for the protection of those around you...
@@ -1250,7 +1240,7 @@ float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_
        }
        while(left < right - 1);
 
-       if(ICanHasKallerz)
+       if(w("^7") == 0) // detect color codes support in the width function
        {
                // NOTE: when color codes are involved, this binary search is,
                // mathematically, BROKEN. However, it is obviously guaranteed to
@@ -1289,6 +1279,42 @@ float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_
        return left;
 }
 
+string find_last_color_code(string s)
+{
+       float start, len, i, carets;
+       start = strstrofs(s, "^", 0);
+       if (start == -1) // no caret found
+               return "";
+       len = strlen(s)-1;
+       for(i = len; i >= start; --i)
+       {
+               if(substring(s, i, 1) != "^")
+                       continue;
+
+               carets = 1;
+               while (i-carets >= start && substring(s, i-carets, 1) == "^")
+                       ++carets;
+
+               // check if carets aren't all escaped
+               if (carets == 1 || mod(carets, 2) == 1) // first check is just an optimization
+               {
+                       if(i+1 <= len)
+                       if(strstrofs("0123456789", substring(s, i+1, 1), 0) >= 0)
+                               return substring(s, i, 2);
+
+                       if(i+4 <= len)
+                       if(substring(s, i+1, 1) == "x")
+                       if(strstrofs("0123456789abcdefABCDEF", substring(s, i+2, 1), 0) >= 0)
+                       if(strstrofs("0123456789abcdefABCDEF", substring(s, i+3, 1), 0) >= 0)
+                       if(strstrofs("0123456789abcdefABCDEF", substring(s, i+4, 1), 0) >= 0)
+                               return substring(s, i, 5);
+               }
+               i -= carets; // this also skips one char before the carets
+       }
+
+       return "";
+}
+
 string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
 {
        float cantake;
@@ -1308,6 +1334,8 @@ string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunc
                        getWrappedLine_remaining = substring(s, cantake, strlen(s) - cantake);
                        if(getWrappedLine_remaining == "")
                                getWrappedLine_remaining = string_null;
+                       else if (tw("^7", theFontSize) == 0)
+                               getWrappedLine_remaining = strcat(find_last_color_code(substring(s, 0, cantake)), getWrappedLine_remaining);
                        return substring(s, 0, cantake);
                }
                else
@@ -1315,6 +1343,8 @@ string getWrappedLine(float w, vector theFontSize, textLengthUpToWidth_widthFunc
                        getWrappedLine_remaining = substring(s, take + 1, strlen(s) - take);
                        if(getWrappedLine_remaining == "")
                                getWrappedLine_remaining = string_null;
+                       else if (tw("^7", theFontSize) == 0)
+                               getWrappedLine_remaining = strcat(find_last_color_code(substring(s, 0, take)), getWrappedLine_remaining);
                        return substring(s, 0, take);
                }
        }
@@ -1344,6 +1374,8 @@ string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw)
                        getWrappedLine_remaining = substring(s, cantake, strlen(s) - cantake);
                        if(getWrappedLine_remaining == "")
                                getWrappedLine_remaining = string_null;
+                       else if (tw("^7") == 0)
+                               getWrappedLine_remaining = strcat(find_last_color_code(substring(s, 0, cantake)), getWrappedLine_remaining);
                        return substring(s, 0, cantake);
                }
                else
@@ -1351,6 +1383,8 @@ string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw)
                        getWrappedLine_remaining = substring(s, take + 1, strlen(s) - take);
                        if(getWrappedLine_remaining == "")
                                getWrappedLine_remaining = string_null;
+                       else if (tw("^7") == 0)
+                               getWrappedLine_remaining = strcat(find_last_color_code(substring(s, 0, take)), getWrappedLine_remaining);
                        return substring(s, 0, take);
                }
        }
index f85c2877cc6f8c82e44be48ed91582eb634eea20..bf3406142c4c91f188a09f2c98e66267adfcdb80 100644 (file)
@@ -127,6 +127,8 @@ void XonoticAudioSettingsTab_fill(entity me)
                me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "snd_spatialization_control", _("Headphone friendly mode")));
                setDependent(e, "snd_channels", 1.5, 0.5);
        me.TR(me);
+       me.TR(me);
+               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
        me.TR(me);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Spatial voices:")));
                me.TD(me, 1, 2/3, e = makeXonoticRadioButton(1, "cl_voice_directional", "0", ZCTX(_("VOCS^None"))));
@@ -170,6 +172,6 @@ void XonoticAudioSettingsTab_fill(entity me)
                me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "menu_sounds", _("Menu sounds")));
 
        me.gotoRC(me, me.rows - 1, 0);
-               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "snd_restart; sendcvar cl_hitsound; sendcvar cl_autotaunt; sendcvar cl_voice_directional; sendcvar cl_voice_directional_taunt_attenuation", COMMANDBUTTON_APPLY));
+               me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "snd_restart; snd_attenuation_method_$menu_snd_attenuation_method; sendcvar cl_hitsound; sendcvar cl_autotaunt; sendcvar cl_voice_directional; sendcvar cl_voice_directional_taunt_attenuation", COMMANDBUTTON_APPLY));
 }
 #endif
index 485a4ed250a08fe0672bb4add6d0d4bec3a748f7..c9db0455ead0419bebae2bdb57aeedbd02c298ab 100644 (file)
@@ -1155,10 +1155,10 @@ string autocvar_sv_player_headsize;
 string autocvar_sv_player_maxs;
 string autocvar_sv_player_mins;
 string autocvar_sv_player_viewoffset;
+float autocvar_sv_player_jumpanim_minfall;
 float autocvar_sv_precacheplayermodels;
 float autocvar_sv_precacheweapons;
 float autocvar_sv_q3acompat_machineshotgunswap;
-float autocvar_sv_qcweaponanimation;
 float autocvar_sv_ready_restart;
 float autocvar_sv_ready_restart_after_countdown;
 float autocvar_sv_ready_restart_repeatable;
index 5c0be477cc45ed81c1fd228060093f64af0537a0..6f0f3e2c037f304f774bde6fb2c07eba834aacf7 100644 (file)
@@ -19,8 +19,8 @@ void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplay
 
 void havocbot_goalrating_ast_targets(float ratingscale)
 {
-       entity ad, best, pl, wp, tod;
-       float radius, found, bestvalue, c;
+       entity ad, best, wp, tod;
+       float radius, found, bestvalue;
        vector p;
 
        ad = findchain(classname, "func_assault_destructible");
@@ -190,9 +190,6 @@ void havocbot_role_ast_setrole(entity bot, float role)
 
 void havocbot_ast_reset_role(entity bot)
 {
-       local entity head;
-       local float c;
-
        if(self.deadflag != DEAD_NO)
                return;
 
index 8eef87f9601905188c224420bb8ea061541300e2..c1667ce92597765e970f00aa04bfef53887e983c 100644 (file)
@@ -2948,14 +2948,14 @@ void PlayerPreThink (void)
 
                self.prevorigin = self.origin;
 
-               if ((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss)
+               if (((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss) && self.animstate_startframe != self.anim_melee_x) // prevent crouching if using melee attack
                {
                        if (!self.crouch)
                        {
                                self.crouch = TRUE;
                                self.view_ofs = PL_CROUCH_VIEW_OFS;
                                setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX);
-                               setanim(self, self.anim_duck, FALSE, TRUE, TRUE);
+                               // setanim(self, self.anim_duck, FALSE, TRUE, TRUE); // this anim is BROKEN anyway
                        }
                }
                else
index 689bfe0a2c437596e0635c8a48ef6b404a8f0955..5e1ce239f5ad4549c530e83285de0aa09017872d 100644 (file)
@@ -171,7 +171,7 @@ void PlayerJump (void)
 
        if (self.crouch)
                setanim(self, self.anim_duckjump, FALSE, TRUE, TRUE);
-       else
+       else if (self.animstate_startframe != self.anim_melee_x || (self.animstate_startframe == self.anim_melee_x && time - self.animstate_starttime >= 21/20)) // jump animation shouldn't override melee until we have animation blending (or until the anim finished, 21/20 = numframes/fps)
                setanim(self, self.anim_jump, FALSE, TRUE, TRUE);
 
        if(g_jump_grunt)
index 277338c5cafc7ee78ac03b5bf1f5fad9d50f2dfb..f8beba94db82768f2a4345e902dae9b9e9508591 100644 (file)
@@ -202,71 +202,32 @@ float player_getspecies()
 
 void player_setupanimsformodel()
 {
-       local string animfilename;
-       local float animfile;
        // defaults for legacy .zym models without animinfo files
-       self.anim_die1 = '0 1 0.5'; // 2 seconds
-       self.anim_die2 = '1 1 0.5'; // 2 seconds
-       self.anim_draw = '2 1 3'; // TODO: analyze models and set framerate
-       self.anim_duck = '3 1 100'; // this anim seems bogus in most models, so make it play VERY briefly!
-       self.anim_duckwalk = '4 1 1';
-       self.anim_duckjump = '5 1 100'; // zym anims keep playing until changed, so this only has to start the anim, landing will end it
-       self.anim_duckidle = '6 1 1';
-       self.anim_idle = '7 1 1';
-       self.anim_jump = '8 1 100'; // zym anims keep playing until changed, so this only has to start the anim, landing will end it
-       self.anim_pain1 = '9 1 2'; // 0.5 seconds
-       self.anim_pain2 = '10 1 2'; // 0.5 seconds
-       self.anim_shoot = '11 1 5'; // TODO: analyze models and set framerate
-       self.anim_taunt = '12 1 0.33'; // FIXME?  there is no code using this anim
-       self.anim_run = '13 1 1';
-       self.anim_runbackwards = '14 1 1';
-       self.anim_strafeleft = '15 1 1';
-       self.anim_straferight = '16 1 1';
-       self.anim_dead1 = '17 1 1';
-       self.anim_dead2 = '18 1 1';
-       self.anim_forwardright = '19 1 1';
-       self.anim_forwardleft = '20 1 1';
-       self.anim_backright = '21 1 1';
-       self.anim_backleft  = '22 1 1';
-       self.anim_melee = '23 1 1';
-       animparseerror = FALSE;
-       animfilename = strcat(self.model, ".animinfo");
-       animfile = fopen(animfilename, FILE_READ);
-       if (animfile >= 0)
-       {
-               self.anim_die1         = animparseline(animfile);
-               self.anim_die2         = animparseline(animfile);
-               self.anim_draw         = animparseline(animfile);
-               self.anim_duck         = animparseline(animfile);
-               self.anim_duckwalk     = animparseline(animfile);
-               self.anim_duckjump     = animparseline(animfile);
-               self.anim_duckidle     = animparseline(animfile);
-               self.anim_idle         = animparseline(animfile);
-               self.anim_jump         = animparseline(animfile);
-               self.anim_pain1        = animparseline(animfile);
-               self.anim_pain2        = animparseline(animfile);
-               self.anim_shoot        = animparseline(animfile);
-               self.anim_taunt        = animparseline(animfile);
-               self.anim_run          = animparseline(animfile);
-               self.anim_runbackwards = animparseline(animfile);
-               self.anim_strafeleft   = animparseline(animfile);
-               self.anim_straferight  = animparseline(animfile);
-               self.anim_forwardright = animparseline(animfile);
-               self.anim_forwardleft  = animparseline(animfile);
-               self.anim_backright    = animparseline(animfile);
-               self.anim_backleft     = animparseline(animfile);
-               self.anim_melee        = animparseline(animfile);
-               fclose(animfile);
-
-               // derived anims
-               self.anim_dead1 = '0 1 1' + '1 0 0' * (self.anim_die1_x + self.anim_die1_y - 1);
-               self.anim_dead2 = '0 1 1' + '1 0 0' * (self.anim_die2_x + self.anim_die2_y - 1);
-
-               if (animparseerror)
-                       print("Parse error in ", animfilename, ", some player animations are broken\n");
-       }
-       else
-               dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n");
+       self.anim_die1 = animfixfps(self, '0 1 0.5'); // 2 seconds
+       self.anim_die2 = animfixfps(self, '1 1 0.5'); // 2 seconds
+       self.anim_draw = animfixfps(self, '2 1 3');
+       // self.anim_duck = '3 1 100'; // This anim is broken, use slot 3 as a new free slot in the future ;)
+       self.anim_duckwalk = animfixfps(self, '4 1 1');
+       self.anim_duckjump = '5 1 100'; // NOTE: zym anims keep playing until changed, so this only has to start the anim, landing will end it
+       self.anim_duckidle = animfixfps(self, '6 1 1');
+       self.anim_idle = animfixfps(self, '7 1 1');
+       self.anim_jump = '8 1 100'; // NOTE: zym anims keep playing until changed, so this only has to start the anim, landing will end it
+       self.anim_pain1 = animfixfps(self, '9 1 2'); // 0.5 seconds
+       self.anim_pain2 = animfixfps(self, '10 1 2'); // 0.5 seconds
+       self.anim_shoot = animfixfps(self, '11 1 5'); // analyze models and set framerate
+       self.anim_taunt = animfixfps(self, '12 1 0.33');
+       self.anim_run = animfixfps(self, '13 1 1');
+       self.anim_runbackwards = animfixfps(self, '14 1 1');
+       self.anim_strafeleft = animfixfps(self, '15 1 1');
+       self.anim_straferight = animfixfps(self, '16 1 1');
+       self.anim_dead1 = animfixfps(self, '17 1 1');
+       self.anim_dead2 = animfixfps(self, '18 1 1');
+       self.anim_forwardright = animfixfps(self, '19 1 1');
+       self.anim_forwardleft = animfixfps(self, '20 1 1');
+       self.anim_backright = animfixfps(self, '21 1 1');
+       self.anim_backleft  = animfixfps(self, '22 1 1');
+       self.anim_melee = animfixfps(self, '23 1 1');
+       // TODO introspect models for finding right "fps" value (1/duration)
        // reset animstate now
        setanim(self, self.anim_idle, TRUE, FALSE, TRUE);
 };
@@ -293,13 +254,32 @@ void player_anim (void)
 
        if (!self.animstate_override)
        {
-               if (!(self.flags & FL_ONGROUND))
+               if (!(self.flags & FL_ONGROUND) || self.BUTTON_JUMP)
                {
                        if (self.crouch)
-                               setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);
+                       {
+                               if (self.animstate_startframe != self.anim_duckjump_x) // don't perform another trace if already playing the crouch jump anim
+                               {
+                                       traceline(self.origin + '0 0 1' * PL_CROUCH_MIN_z, self.origin + '0 0 1' * (PL_CROUCH_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
+                                       if(!trace_startsolid && trace_fraction == 1 || !(self.animstate_startframe == self.anim_duckwalk_x || self.animstate_startframe == self.anim_duckidle_x)) // don't get stuck on non-crouch anims
+                                       {
+                                               setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);
+                                               self.restart_jump = FALSE;
+                                       }
+                               }
+                       }
                        else
-                               setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
-                       self.restart_jump = FALSE;
+                       {
+                if (self.animstate_startframe != self.anim_jump_x) // don't perform another trace if already playing the jump anim
+                {
+                    traceline(self.origin + '0 0 1' * PL_MIN_z, self.origin + '0 0 1' * (PL_MIN_z - autocvar_sv_player_jumpanim_minfall), TRUE, self);
+                    if(!trace_startsolid && trace_fraction == 1 || self.animstate_startframe == self.anim_idle_x || (self.animstate_startframe == self.anim_melee_x && time - self.animstate_starttime >= 21/20)) // don't get stuck on idle animation in midair, nor melee after it finished
+                    {
+                        setanim(self, self.anim_jump, FALSE, TRUE, self.restart_jump);
+                        self.restart_jump = FALSE;
+                    }
+                }
+                       }
                }
                else if (self.crouch)
                {
@@ -522,10 +502,13 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                                if(sv_gentle < 1) {
                                        if(self.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
                                        {
-                                               if (random() > 0.5)
-                                                       setanim(self, self.anim_pain1, FALSE, TRUE, TRUE);
-                                               else
-                                                       setanim(self, self.anim_pain2, FALSE, TRUE, TRUE);
+                                               if (!self.animstate_override)
+                                               {
+                                                       if (random() > 0.5)
+                                                               setanim(self, self.anim_pain1, FALSE, TRUE, TRUE);
+                                                       else
+                                                               setanim(self, self.anim_pain2, FALSE, TRUE, TRUE);
+                                               }
                                        }
 
                                        if(sound_allowed(MSG_BROADCAST, attacker))
index 62eb0b6f91cc182bca1168f08ae0d3b98789b3dc..db6ef79913938c8d625b42614ca9a28389a5fed2 100644 (file)
@@ -278,26 +278,6 @@ float CL_Weaponentity_CustomizeEntityForClient()
        return TRUE;
 }
 
-float qcweaponanimation;
-vector weapon_offset = '0 -10 0';
-vector weapon_adjust = '10 0 -15';
-.vector weapon_morph0origin;
-.vector weapon_morph0angles;
-.float  weapon_morph0time;
-.vector weapon_morph1origin;
-.vector weapon_morph1angles;
-.float  weapon_morph1time;
-.vector weapon_morph2origin;
-.vector weapon_morph2angles;
-.float  weapon_morph2time;
-.vector weapon_morph3origin;
-.vector weapon_morph3angles;
-.float  weapon_morph3time;
-.vector weapon_morph4origin;
-.vector weapon_morph4angles;
-.float  weapon_morph4time;
-#define QCWEAPONANIMATION_ORIGIN(e) ((weapon_offset_x + e.view_ofs_x) * v_forward - (weapon_offset_y + e.view_ofs_y) * v_right + (weapon_offset_z + e.view_ofs_z) * v_up + weapon_adjust)
-
 /*
  * supported formats:
  *
@@ -351,8 +331,6 @@ vector weapon_adjust = '10 0 -15';
 //   remove the ent
 void CL_WeaponEntity_SetModel(string name)
 {
-       string animfilename;
-       float animfile;
        float v_shot_idx;
        if (name != "")
        {
@@ -364,140 +342,115 @@ void CL_WeaponEntity_SetModel(string name)
                if(!v_shot_idx)
                        v_shot_idx = gettagindex(self, "tag_shot");
 
-               if(qcweaponanimation)
+               setmodel(self, strcat("models/weapons/h_", name, ".iqm")); // precision set below
+               // preset some defaults that work great for renamed zym files (which don't need an animinfo)
+               self.anim_fire1  = animfixfps(self, '0 1 0.01');
+               self.anim_fire2  = animfixfps(self, '1 1 0.01');
+               self.anim_idle   = animfixfps(self, '2 1 0.01');
+               self.anim_reload = animfixfps(self, '3 1 0.01');
+
+               // if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
+               // if we don't, this is a "real" animated model
+               if(gettagindex(self, "weapon"))
+               {
+                       if (!self.weaponentity)
+                               self.weaponentity = spawn();
+                       setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
+                       setattachment(self.weaponentity, self, "weapon");
+               }
+               else if(gettagindex(self, "tag_weapon"))
                {
-                       self.angles = '0 0 0';
-                       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-                       self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
-                       self.movedir_x += 32;
-                       self.spawnorigin = self.movedir;
-                       // oldorigin - not calculated here
+                       if (!self.weaponentity)
+                               self.weaponentity = spawn();
+                       setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
+                       setattachment(self.weaponentity, self, "tag_weapon");
                }
                else
                {
-                       setmodel(self, strcat("models/weapons/h_", name, ".iqm")); // precision set below
-                       animfilename = strcat("models/weapons/h_", name, ".iqm.animinfo");
-                       animfile = fopen(animfilename, FILE_READ);
-                       // preset some defaults that work great for renamed zym files (which don't need an animinfo)
-                       self.anim_fire1  = '0 1 0.01';
-                       self.anim_fire2  = '1 1 0.01';
-                       self.anim_idle   = '2 1 0.01';
-                       self.anim_reload = '3 1 0.01';
-                       if (animfile >= 0)
-                       {
-                               animparseerror = FALSE;
-                               self.anim_fire1  = animparseline(animfile);
-                               self.anim_fire2  = animparseline(animfile);
-                               self.anim_idle   = animparseline(animfile);
-                               self.anim_reload = animparseline(animfile);
-                               fclose(animfile);
-                               if (animparseerror)
-                                       print("Parse error in ", animfilename, ", some player animations are broken\n");
-                       }
-
-                       // if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
-                       // if we don't, this is a "real" animated model
-                       if(gettagindex(self, "weapon"))
-                       {
-                               if (!self.weaponentity)
-                                       self.weaponentity = spawn();
-                               setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
-                               setattachment(self.weaponentity, self, "weapon");
-                       }
-                       else if(gettagindex(self, "tag_weapon"))
-                       {
-                               if (!self.weaponentity)
-                                       self.weaponentity = spawn();
-                               setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
-                               setattachment(self.weaponentity, self, "tag_weapon");
-                       }
-                       else
-                       {
-                               if(self.weaponentity)
-                                       remove(self.weaponentity);
-                               self.weaponentity = world;
-                       }
+                       if(self.weaponentity)
+                               remove(self.weaponentity);
+                       self.weaponentity = world;
+               }
 
-                       setorigin(self,'0 0 0');
-                       self.angles = '0 0 0';
-                       self.frame = 0;
-                       self.viewmodelforclient = world;
+               setorigin(self,'0 0 0');
+               self.angles = '0 0 0';
+               self.frame = 0;
+               self.viewmodelforclient = world;
 
-                       float idx;
+               float idx;
 
-                       if(v_shot_idx) // v_ model attached to invisible h_ model
+               if(v_shot_idx) // v_ model attached to invisible h_ model
+               {
+                       self.movedir = gettaginfo(self.weaponentity, v_shot_idx);
+               }
+               else
+               {
+                       idx = gettagindex(self, "shot");
+                       if(!idx)
+                               idx = gettagindex(self, "tag_shot");
+                       if(idx)
+                               self.movedir = gettaginfo(self, idx);
+                       else
                        {
-                               self.movedir = gettaginfo(self.weaponentity, v_shot_idx);
+                               print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
+                               self.movedir = '0 0 0';
                        }
+               }
+
+               if(self.weaponentity) // v_ model attached to invisible h_ model
+               {
+                       idx = gettagindex(self.weaponentity, "shell");
+                       if(!idx)
+                               idx = gettagindex(self.weaponentity, "tag_shell");
+                       if(idx)
+                               self.spawnorigin = gettaginfo(self.weaponentity, idx);
+               }
+               else
+                       idx = 0;
+               if(!idx)
+               {
+                       idx = gettagindex(self, "shell");
+                       if(!idx)
+                               idx = gettagindex(self, "tag_shell");
+                       if(idx)
+                               self.spawnorigin = gettaginfo(self, idx);
                        else
                        {
-                               idx = gettagindex(self, "shot");
-                               if(!idx)
-                                       idx = gettagindex(self, "tag_shot");
-                               if(idx)
-                                       self.movedir = gettaginfo(self, idx);
-                               else
-                               {
-                                       print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
-                                       self.movedir = '0 0 0';
-                               }
+                               print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
+                               self.spawnorigin = self.movedir;
                        }
+               }
 
-                       if(self.weaponentity) // v_ model attached to invisible h_ model
+               if(v_shot_idx)
+               {
+                       self.oldorigin = '0 0 0'; // use regular attachment
+               }
+               else
+               {
+                       if(self.weaponentity)
                        {
-                               idx = gettagindex(self.weaponentity, "shell");
+                               idx = gettagindex(self, "weapon");
                                if(!idx)
-                                       idx = gettagindex(self.weaponentity, "tag_shell");
-                               if(idx)
-                                       self.spawnorigin = gettaginfo(self.weaponentity, idx);
+                                       idx = gettagindex(self, "tag_weapon");
                        }
                        else
-                               idx = 0;
-                       if(!idx)
                        {
-                               idx = gettagindex(self, "shell");
+                               idx = gettagindex(self, "handle");
                                if(!idx)
-                                       idx = gettagindex(self, "tag_shell");
-                               if(idx)
-                                       self.spawnorigin = gettaginfo(self, idx);
-                               else
-                               {
-                                       print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
-                                       self.spawnorigin = self.movedir;
-                               }
+                                       idx = gettagindex(self, "tag_handle");
                        }
-
-                       if(v_shot_idx)
+                       if(idx)
                        {
-                               self.oldorigin = '0 0 0'; // use regular attachment
+                               self.oldorigin = self.movedir - gettaginfo(self, idx);
                        }
                        else
                        {
-                               if(self.weaponentity)
-                               {
-                                       idx = gettagindex(self, "weapon");
-                                       if(!idx)
-                                               idx = gettagindex(self, "tag_weapon");
-                               }
-                               else
-                               {
-                                       idx = gettagindex(self, "handle");
-                                       if(!idx)
-                                               idx = gettagindex(self, "tag_handle");
-                               }
-                               if(idx)
-                               {
-                                       self.oldorigin = self.movedir - gettaginfo(self, idx);
-                               }
-                               else
-                               {
-                                       print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
-                                       self.oldorigin = '0 0 0'; // there is no way to recover from this
-                               }
+                               print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
+                               self.oldorigin = '0 0 0'; // there is no way to recover from this
                        }
-
-                       self.viewmodelforclient = self.owner;
                }
+
+               self.viewmodelforclient = self.owner;
        }
        else
        {
@@ -529,24 +482,9 @@ void CL_WeaponEntity_SetModel(string name)
        self.spawnorigin += self.view_ofs; // offset the casings origin by the same amount
 
        // check if an instant weapon switch occurred
-       if (qcweaponanimation)
-       {
-               if (self.state == WS_READY)
-               {
-                       self.angles = '0 0 0';
-                       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-                       setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
-               }
-       }
-       else
-               setorigin(self, self.view_ofs);
+       setorigin(self, self.view_ofs);
        // reset animstate now
        self.wframe = WFRAME_IDLE;
-       self.weapon_morph0time = 0;
-       self.weapon_morph1time = 0;
-       self.weapon_morph2time = 0;
-       self.weapon_morph3time = 0;
-       self.weapon_morph4time = 0;
        setanim(self, self.anim_idle, TRUE, FALSE, TRUE);
 }
 
@@ -626,153 +564,16 @@ void CL_Weaponentity_Think()
        {
                f = (self.owner.weapon_nextthink - time) * g_weaponratefactor / autocvar_g_balance_weaponswitchdelay;
                self.angles_x = -90 * f * f;
-               if (qcweaponanimation)
-               {
-                       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-                       setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
-               }
        }
        else if (self.state == WS_DROP && !intermission_running)
        {
                f = 1 - (self.owner.weapon_nextthink - time) * g_weaponratefactor / autocvar_g_balance_weaponswitchdelay;
                self.angles_x = -90 * f * f;
-               if (qcweaponanimation)
-               {
-                       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-                       setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
-               }
        }
        else if (self.state == WS_CLEAR)
        {
                f = 1;
                self.angles_x = -90 * f * f;
-               if (qcweaponanimation)
-               {
-                       makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
-                       setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
-               }
-       }
-       else if (qcweaponanimation && time < self.owner.weapon_morph1time)
-       {
-               f = (time - self.owner.weapon_morph0time) / (self.owner.weapon_morph1time - self.owner.weapon_morph0time);
-               f = 1 - pow(1 - f, 3);
-               self.angles = self.owner.weapon_morph0angles * (1 - f) + self.owner.weapon_morph1angles * f;
-               setorigin(self, self.owner.weapon_morph0origin * (1 - f) + self.owner.weapon_morph1origin * f);
-       }
-       else if (qcweaponanimation && time < self.owner.weapon_morph2time)
-       {
-               f = (time - self.owner.weapon_morph1time) / (self.owner.weapon_morph2time - self.owner.weapon_morph1time);
-               f = 1 - pow(1 - f, 3);
-               self.angles = self.owner.weapon_morph1angles * (1 - f) + self.owner.weapon_morph2angles * f;
-               setorigin(self, self.owner.weapon_morph1origin * (1 - f) + self.owner.weapon_morph2origin * f);
-       }
-       else if (qcweaponanimation && time < self.owner.weapon_morph3time)
-       {
-               f = (time - self.owner.weapon_morph2time) / (self.owner.weapon_morph3time - self.owner.weapon_morph2time);
-               f = 1 - pow(1 - f, 3);
-               self.angles = self.owner.weapon_morph2angles * (1 - f) + self.owner.weapon_morph3angles * f;
-               setorigin(self, self.owner.weapon_morph2origin * (1 - f) + self.owner.weapon_morph3origin * f);
-       }
-       else if (qcweaponanimation && time < self.owner.weapon_morph4time)
-       {
-               f = (time - self.owner.weapon_morph3time) / (self.owner.weapon_morph4time - self.owner.weapon_morph3time);
-               f = 1 - pow(1 - f, 3);
-               self.angles = self.owner.weapon_morph3angles * (1 - f) + self.owner.weapon_morph4angles * f;
-               setorigin(self, self.owner.weapon_morph3origin * (1 - f) + self.owner.weapon_morph4origin * f);
-       }
-       else if (qcweaponanimation)
-       {
-               // begin a new idle morph
-               self.owner.weapon_morph0time   = time;
-               self.owner.weapon_morph0angles = self.angles;
-               self.owner.weapon_morph0origin = self.origin;
-
-               float r;
-               float t;
-
-               r = random();
-               if (r < 0.1)
-               {
-                       // turn gun to the left to look at it
-                       t = 2;
-                       self.owner.weapon_morph1time   = time + t * 0.2;
-                       self.owner.weapon_morph1angles = randomvec() * 3 + '-5 30 0';
-                       makevectors(self.owner.weapon_morph1angles_x * '-1 0 0' + self.owner.weapon_morph1angles_y * '0 1 0' + self.owner.weapon_morph1angles_z * '0 0 1');
-                       self.owner.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph2time   = time + t * 0.6;
-                       self.owner.weapon_morph2angles = randomvec() * 3 + '-5 30 0';
-                       makevectors(self.owner.weapon_morph2angles_x * '-1 0 0' + self.owner.weapon_morph2angles_y * '0 1 0' + self.owner.weapon_morph2angles_z * '0 0 1');
-                       self.owner.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph3time   = time + t;
-                       self.owner.weapon_morph3angles = '0 0 0';
-                       makevectors(self.owner.weapon_morph3angles_x * '-1 0 0' + self.owner.weapon_morph3angles_y * '0 1 0' + self.owner.weapon_morph3angles_z * '0 0 1');
-                       self.owner.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self);
-               }
-               else if (r < 0.2)
-               {
-                       // raise the gun a bit
-                       t = 2;
-                       self.owner.weapon_morph1time   = time + t * 0.2;
-                       self.owner.weapon_morph1angles = randomvec() * 3 + '30 -10 0';
-                       makevectors(self.owner.weapon_morph1angles_x * '-1 0 0' + self.owner.weapon_morph1angles_y * '0 1 0' + self.owner.weapon_morph1angles_z * '0 0 1');
-                       self.owner.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph2time   = time + t * 0.5;
-                       self.owner.weapon_morph2angles = randomvec() * 3 + '30 -10 5';
-                       makevectors(self.owner.weapon_morph2angles_x * '-1 0 0' + self.owner.weapon_morph2angles_y * '0 1 0' + self.owner.weapon_morph2angles_z * '0 0 1');
-                       self.owner.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph3time   = time + t;
-                       self.owner.weapon_morph3angles = '0 0 0';
-                       makevectors(self.owner.weapon_morph3angles_x * '-1 0 0' + self.owner.weapon_morph3angles_y * '0 1 0' + self.owner.weapon_morph3angles_z * '0 0 1');
-                       self.owner.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self);
-               }
-               else if (r < 0.3)
-               {
-                       // tweak it a bit
-                       t = 5;
-                       self.owner.weapon_morph1time   = time + t * 0.3;
-                       self.owner.weapon_morph1angles = randomvec() * 6;
-                       makevectors(self.owner.weapon_morph1angles_x * '-1 0 0' + self.owner.weapon_morph1angles_y * '0 1 0' + self.owner.weapon_morph1angles_z * '0 0 1');
-                       self.owner.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph2time   = time + t * 0.7;
-                       self.owner.weapon_morph2angles = randomvec() * 6;
-                       makevectors(self.owner.weapon_morph2angles_x * '-1 0 0' + self.owner.weapon_morph2angles_y * '0 1 0' + self.owner.weapon_morph2angles_z * '0 0 1');
-                       self.owner.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph3time   = time + t;
-                       self.owner.weapon_morph3angles = '0 0 0';
-                       makevectors(self.owner.weapon_morph3angles_x * '-1 0 0' + self.owner.weapon_morph3angles_y * '0 1 0' + self.owner.weapon_morph3angles_z * '0 0 1');
-                       self.owner.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self);
-               }
-               else
-               {
-                       // hold it mostly steady
-                       t = random() * 6 + 4;
-                       self.owner.weapon_morph1time   = time + t * 0.2;
-                       self.owner.weapon_morph1angles = randomvec() * 1;
-                       makevectors(self.owner.weapon_morph1angles_x * '-1 0 0' + self.owner.weapon_morph1angles_y * '0 1 0' + self.owner.weapon_morph1angles_z * '0 0 1');
-                       self.owner.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph2time   = time + t * 0.5;
-                       self.owner.weapon_morph2angles = randomvec() * 1;
-                       makevectors(self.owner.weapon_morph2angles_x * '-1 0 0' + self.owner.weapon_morph2angles_y * '0 1 0' + self.owner.weapon_morph2angles_z * '0 0 1');
-                       self.owner.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self);
-
-                       self.owner.weapon_morph3time   = time + t * 0.7;
-                       self.owner.weapon_morph3angles = randomvec() * 1;
-                       makevectors(self.owner.weapon_morph3angles_x * '-1 0 0' + self.owner.weapon_morph3angles_y * '0 1 0' + self.owner.weapon_morph3angles_z * '0 0 1');
-                       self.owner.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self);
-               }
-
-               self.owner.weapon_morph4time   = time + t;
-               self.owner.weapon_morph4angles = '0 0 0';
-               makevectors(self.owner.weapon_morph4angles_x * '-1 0 0' + self.owner.weapon_morph4angles_y * '0 1 0' + self.owner.weapon_morph4angles_z * '0 0 1');
-               self.owner.weapon_morph4origin = QCWEAPONANIMATION_ORIGIN(self);
-
        }
 };
 
@@ -859,7 +660,6 @@ void CL_ExteriorWeaponentity_Think()
 
                if(autocvar_g_loituma)
                {
-                       vector moddir, modup;
                        vector modangles;
                        float t;
 
@@ -1048,7 +848,6 @@ void w_ready()
 void weapon_setup(float windex)
 {
        entity e;
-       qcweaponanimation = autocvar_sv_qcweaponanimation;
        e = get_weaponinfo(windex);
        self.items &~= IT_AMMO;
        self.items = self.items | e.items;
@@ -1180,82 +979,16 @@ void weapon_thinkf(float fr, float t, void() func)
        if (self.weaponentity)
        {
                self.weaponentity.wframe = fr;
-               if (qcweaponanimation)
-               {
-                       if (fr != WFRAME_IDLE)
-                       {
-                               self.weapon_morph0time = time;
-                               self.weapon_morph0angles = self.weaponentity.angles;
-                               self.weapon_morph0origin = self.weaponentity.origin;
-
-                               self.weapon_morph1angles = '0 0 0';
-                               self.weapon_morph1time = time + t;
-                               makevectors(self.weapon_morph1angles_x * '-1 0 0' + self.weapon_morph1angles_y * '0 1 0' + self.weapon_morph1angles_z * '0 0 1');
-                               self.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                               self.weapon_morph2angles = '0 0 0';
-                               self.weapon_morph2time = time + t;
-                               makevectors(self.weapon_morph2angles_x * '-1 0 0' + self.weapon_morph2angles_y * '0 1 0' + self.weapon_morph2angles_z * '0 0 1');
-                               self.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                               self.weapon_morph3angles = '0 0 0';
-                               self.weapon_morph3time = time + t;
-                               makevectors(self.weapon_morph3angles_x * '-1 0 0' + self.weapon_morph3angles_y * '0 1 0' + self.weapon_morph3angles_z * '0 0 1');
-                               self.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                               self.weapon_morph4angles = '0 0 0';
-                               self.weapon_morph4time = time + t;
-                               makevectors(self.weapon_morph4angles_x * '-1 0 0' + self.weapon_morph4angles_y * '0 1 0' + self.weapon_morph4angles_z * '0 0 1');
-                               self.weapon_morph4origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                               if (fr == WFRAME_FIRE1)
-                               {
-                                       self.weapon_morph1angles = '5 0 0';
-                                       self.weapon_morph1time = time + t * 0.1;
-                                       makevectors(self.weapon_morph1angles_x * '-1 0 0' + self.weapon_morph1angles_y * '0 1 0' + self.weapon_morph1angles_z * '0 0 1');
-                                       self.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-                                       self.weapon_morph4time = time + t + 1; // delay idle effect
-                               }
-                               else if (fr == WFRAME_FIRE2)
-                               {
-                                       self.weapon_morph1angles = '10 0 0';
-                                       self.weapon_morph1time = time + t * 0.1;
-                                       makevectors(self.weapon_morph1angles_x * '-1 0 0' + self.weapon_morph1angles_y * '0 1 0' + self.weapon_morph1angles_z * '0 0 1');
-                                       self.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-                                       self.weapon_morph4time = time + t + 1; // delay idle effect
-                               }
-                               else if (fr == WFRAME_RELOAD)
-                               {
-                                       self.weapon_morph1time = time + t * 0.05;
-                                       self.weapon_morph1angles = '-10 40 0';
-                                       makevectors(self.weapon_morph1angles_x * '-1 0 0' + self.weapon_morph1angles_y * '0 1 0' + self.weapon_morph1angles_z * '0 0 1');
-                                       self.weapon_morph1origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                                       self.weapon_morph2time = time + t * 0.15;
-                                       self.weapon_morph2angles = '-10 40 5';
-                                       makevectors(self.weapon_morph2angles_x * '-1 0 0' + self.weapon_morph2angles_y * '0 1 0' + self.weapon_morph2angles_z * '0 0 1');
-                                       self.weapon_morph2origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-
-                                       self.weapon_morph3time = time + t * 0.25;
-                                       self.weapon_morph3angles = '-10 40 0';
-                                       makevectors(self.weapon_morph3angles_x * '-1 0 0' + self.weapon_morph3angles_y * '0 1 0' + self.weapon_morph3angles_z * '0 0 1');
-                                       self.weapon_morph3origin = QCWEAPONANIMATION_ORIGIN(self.weaponentity);
-                               }
-                       }
-               }
-               else
-               {
-                       if (fr == WFRAME_IDLE)
-                               a = self.weaponentity.anim_idle;
-                       else if (fr == WFRAME_FIRE1)
-                               a = self.weaponentity.anim_fire1;
-                       else if (fr == WFRAME_FIRE2)
-                               a = self.weaponentity.anim_fire2;
-                       else if (fr == WFRAME_RELOAD)
-                               a = self.weaponentity.anim_reload;
-                       a_z *= g_weaponratefactor;
-                       setanim(self.weaponentity, a, restartanim == FALSE, restartanim, restartanim);
-               }
+               if (fr == WFRAME_IDLE)
+                       a = self.weaponentity.anim_idle;
+               else if (fr == WFRAME_FIRE1)
+                       a = self.weaponentity.anim_fire1;
+               else if (fr == WFRAME_FIRE2)
+                       a = self.weaponentity.anim_fire2;
+               else if (fr == WFRAME_RELOAD)
+                       a = self.weaponentity.anim_reload;
+               a_z *= g_weaponratefactor;
+               setanim(self.weaponentity, a, restartanim == FALSE, restartanim, restartanim);
        }
 
        v_forward = of;
@@ -1297,6 +1030,12 @@ void weapon_thinkf(float fr, float t, void() func)
                        anim_z = anim_y / (t + sys_frametime);
                        setanim(self, anim, FALSE, TRUE, TRUE);
                }
+               else if (self.animstate_startframe == self.anim_idle_x) // only allow shoot anim to override idle animation until we have animation blending
+               {
+                       anim = self.anim_shoot;
+                       anim_z = anim_y / (t + sys_frametime);
+                       setanim(self, anim, FALSE, TRUE, TRUE);
+               }
        }
 };
 
@@ -1382,38 +1121,30 @@ void W_AttachToShotorg(entity flash, vector offset)
        entity xflash;
        flash.owner = self;
        flash.angles_z = random() * 360;
-       if(qcweaponanimation)
-       {
-               setorigin(flash, w_shotorg + w_shotdir * 50);
-               flash.angles = vectoangles(w_shotdir);
-               flash.angles_z = random() * 360;
-       }
+
+       if(gettagindex(self.weaponentity, "shot"))
+               setattachment(flash, self.weaponentity, "shot");
        else
-       {
-               if(gettagindex(self.weaponentity, "shot"))
-                       setattachment(flash, self.weaponentity, "shot");
-               else
-                       setattachment(flash, self.weaponentity, "tag_shot");
-               setorigin(flash, offset);
+               setattachment(flash, self.weaponentity, "tag_shot");
+       setorigin(flash, offset);
 
-               xflash = spawn();
-               copyentity(flash, xflash);
+       xflash = spawn();
+       copyentity(flash, xflash);
 
-               flash.viewmodelforclient = self;
+       flash.viewmodelforclient = self;
 
-               if(self.weaponentity.oldorigin_x > 0)
-               {
-                       setattachment(xflash, self.exteriorweaponentity, "");
-                       setorigin(xflash, self.weaponentity.oldorigin + offset);
-               }
+       if(self.weaponentity.oldorigin_x > 0)
+       {
+               setattachment(xflash, self.exteriorweaponentity, "");
+               setorigin(xflash, self.weaponentity.oldorigin + offset);
+       }
+       else
+       {
+               if(gettagindex(self.exteriorweaponentity, "shot"))
+                       setattachment(xflash, self.exteriorweaponentity, "shot");
                else
-               {
-                       if(gettagindex(self.exteriorweaponentity, "shot"))
-                               setattachment(xflash, self.exteriorweaponentity, "shot");
-                       else
-                               setattachment(xflash, self.exteriorweaponentity, "tag_shot");
-                       setorigin(xflash, offset);
-               }
+                       setattachment(xflash, self.exteriorweaponentity, "tag_shot");
+               setorigin(xflash, offset);
        }
 }
 
index 9c2e843d1a6089fe4640134128232b46ac2d4840..6c37ac92d8b3f1f83436a1264731716c50908dd5 100644 (file)
@@ -128,7 +128,7 @@ float maxclients;
 .vector anim_die1; // player dies
 .vector anim_die2; // player dies differently
 .vector anim_draw; // player pulls out a weapon
-.vector anim_duck; // player crouches (from idle to duckidle)
+// .vector anim_duck; // player crouches (from idle to duckidle)
 .vector anim_duckwalk; // player walking while crouching
 .vector anim_duckjump; // player jumping from a crouch
 .vector anim_duckidle; // player idling while crouching
index c311f3774f45f59c7ad934e6b5992e673c1b4f54..c397079e91d9381e9f81d4306dad0426ff8545da 100644 (file)
@@ -58,29 +58,18 @@ void updateanim(entity e)
        //print(ftos(time), " -> ", ftos(e.frame), "\n");
 };
 
-float animparseerror;
-vector animparseline(float animfile)
-{
-       local string line;
-       local float c;
-       local vector anim;
-       if (animfile < 0)
-               return '0 1 2';
-       line = fgets(animfile);
-       c = tokenize_console(line);
-       if (c < 3)
+vector animfixfps(entity e, vector a)
+{
+       // multi-frame anim: keep as-is
+       if(a_y == 1)
        {
-               animparseerror = TRUE;
-               return '0 1 2';
+               float dur;
+               dur = frameduration(e.modelindex, a_x);
+               if(dur > 0)
+                       a_z = 1.0 / dur;
        }
-       anim_x = stof(argv(0));
-       anim_y = stof(argv(1));
-       anim_z = stof(argv(2));
-       // don't allow completely bogus values
-       if (anim_x < 0 || anim_y < 1 || anim_z < 0.001)
-               anim = '0 1 2';
-       return anim;
-};
+       return a;
+}
 
 /*
 ==================
index 6407cefaa901351ada791a7e5e2dffb084d0fb18..19442cd6c23fbc9a40ec3b36154bba27faa8d157 100644 (file)
@@ -1642,7 +1642,7 @@ void spawnfunc_trigger_multivibrator()
        self.state = 0;
        self.use = multivibrator_toggle;
        self.think = multivibrator_send;
-       self.nextthink = time;
+       self.nextthink = max(1, time);
 
        IFTARGETED
                multivibrator_reset();
index c6e7701e0c0bfa6e4c3543e1eca7bcbafdc0ef2f..c611e819561e677c31b2d57250ccbcb8b8fbca6d 100644 (file)
@@ -3,7 +3,6 @@ string teamstats_last;
 string playerstats_last;
 string events_last;
 .float playerstats_addedglobalinfo;
-float playerstats_requested;
 .string playerstats_id;
 
 void PlayerStats_Init()
index 888b94456ff6496223698d7a2bce47054f7276d6..07ed967fe3e700055cc2fb02afd10014d30c61b2 100644 (file)
@@ -127,8 +127,6 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
 
 void trigger_push_touch()
 {
-       vector move;
-
        if (self.active == ACTIVE_NOT)
                return;
 
@@ -200,6 +198,14 @@ void trigger_push_touch()
                        }
                        else
                                other.lastteleporttime = time;
+
+                       if (!other.animstate_override)
+                       {
+                               if (other.crouch)
+                                       setanim(other, other.anim_duckjump, FALSE, TRUE, TRUE);
+                               else
+                                       setanim(other, other.anim_jump, FALSE, TRUE, TRUE);
+                       }
                }
                else
                        other.jumppadcount = TRUE;
@@ -248,7 +254,6 @@ void trigger_push_findtarget()
 {
        local entity e, t;
        local vector org;
-       local float flighttime;
 
        // first calculate a typical start point for the jump
        org = (self.absmin + self.absmax) * 0.5;
index e069aec9f3d7e18c1d2f9af5cfecc21aa745cd80..6a7787d7decd063c0dda54ddca06cc50537a5723 100644 (file)
@@ -141,14 +141,18 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        }
 }
 
-void Simple_TeleportPlayer(entity teleporter, entity player)
+entity Simple_TeleportPlayer(entity teleporter, entity player)
 {
        vector locout;
        entity e;
        float p;
        
        // Find the output teleporter
-       if(!teleporter.enemy)
+       if(teleporter.enemy)
+       {
+               e = teleporter.enemy;
+       }
+       else
        { 
                RandomSelection_Init();
                for(e = world; (e = find(e, targetname, teleporter.target)); )
@@ -162,23 +166,25 @@ void Simple_TeleportPlayer(entity teleporter, entity player)
                        }
                        RandomSelection_Add(e, 0, string_null, (e.cnt ? e.cnt : 1), p);
                }
-               teleporter.enemy = RandomSelection_chosen_ent;
+               e = RandomSelection_chosen_ent;
        }
 
-       if(!teleporter.enemy) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
+       if(!e) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
        
-       makevectors(teleporter.enemy.mangle);
+       makevectors(e.mangle);
 
-       if(teleporter.enemy.speed)
-               if(vlen(player.velocity) > teleporter.enemy.speed)
-                       player.velocity = normalize(player.velocity) * max(0, teleporter.enemy.speed);
+       if(e.speed)
+               if(vlen(player.velocity) > e.speed)
+                       player.velocity = normalize(player.velocity) * max(0, e.speed);
                        
        if(autocvar_g_teleport_maxspeed)
                if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
                        player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
 
-       locout = teleporter.enemy.origin + '0 0 1' * (1 - player.mins_z - 24);
-       TeleportPlayer(teleporter, player, locout, teleporter.enemy.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+       locout = e.origin + '0 0 1' * (1 - player.mins_z - 24);
+       TeleportPlayer(teleporter, player, locout, e.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+
+       return e;
 }
 
 void Teleport_Touch (void)
@@ -209,7 +215,8 @@ void Teleport_Touch (void)
        if(other.classname == "player")
                RemoveGrapplingHook(other);
                
-       Simple_TeleportPlayer(self, other);
+       entity e;
+       e = Simple_TeleportPlayer(self, other);
 
        activator = other;
        s = self.target; self.target = string_null;
@@ -217,7 +224,7 @@ void Teleport_Touch (void)
        if not(self.target) self.target = s;
 
        oldself = self;
-       self = self.enemy;
+       self = e;
        SUB_UseTargets();
        self = oldself;
 }
@@ -324,7 +331,11 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl)
        UpdateCSQCProjectileAfterTeleport(pl);
        // "disown" projectiles after teleport
        if(pl.owner == pl.realowner)
+       {
+               if(!(pl.flags & FL_PROJECTILE))
+                       print("A non-projectile got through a warpzone and its owner cleared. It's a \n", pl.classname, ".\n");
                pl.owner = world;
+       }
        if(pl.classname == "player")
        {
                // reset tracking of oldvelocity for impact damage (sudden velocity changes)
index 5cbd2fc5d19a08b40b70c47d9097588ea5b5a835..b21a5f50a745581435c0012bd2fcb9605678a021 100644 (file)
@@ -195,6 +195,7 @@ float w_shotgun(float req)
                        }
                }
                if (self.clip_load >= 0) // we are not currently reloading
+               if (!self.crouch) // we are not currently crouching; this fixes an exploit where your melee anim is not visible, and besides wouldn't make much sense
                if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
                if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
                {