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"
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
// 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"
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();
{
self.note = n;
self.tuba_instrument = i;
- Ent_TubaNote_UpdateSound();
+ upd = 1;
}
}
self.entremove = Ent_TubaNote_StopSound;
self.enemy.think = Ent_TubaNote_Think;
self.enemy.nextthink = time + 10;
+
+ if(upd)
+ Ent_TubaNote_UpdateSound();
}
void Tuba_Precache()
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...
}
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
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...
}
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
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;
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
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);
}
}
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
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);
}
}
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"))));
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
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;
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");
void havocbot_ast_reset_role(entity bot)
{
- local entity head;
- local float c;
-
if(self.deadflag != DEAD_NO)
return;
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
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)
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);
};
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)
{
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))
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:
*
// remove the ent
void CL_WeaponEntity_SetModel(string name)
{
- string animfilename;
- float animfile;
float v_shot_idx;
if (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
{
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);
}
{
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);
-
}
};
if(autocvar_g_loituma)
{
- vector moddir, modup;
vector modangles;
float t;
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;
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;
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);
+ }
}
};
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);
}
}
.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
//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;
+}
/*
==================
self.state = 0;
self.use = multivibrator_toggle;
self.think = multivibrator_send;
- self.nextthink = time;
+ self.nextthink = max(1, time);
IFTARGETED
multivibrator_reset();
string playerstats_last;
string events_last;
.float playerstats_addedglobalinfo;
-float playerstats_requested;
.string playerstats_id;
void PlayerStats_Init()
void trigger_push_touch()
{
- vector move;
-
if (self.active == ACTIVE_NOT)
return;
}
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;
{
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;
}
}
-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)); )
}
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)
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;
if not(self.target) self.target = s;
oldself = self;
- self = self.enemy;
+ self = e;
SUB_UseTargets();
self = oldself;
}
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)
}
}
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))
{