// hit testing/tracing for special effects for the crosshair
set g_trueaim_minrange 44 "TrueAim minimum range (TrueAim adjusts shots so they hit the crosshair point even though the gun is not at the screen center)"
-seta crosshair_hittest 1 "do a crosshair hit evaluation, applying effects from the _blur, _scale, and _showipact cvars"
+seta crosshair_hittest 1 "do a crosshair hit evaluation, applying effects from the _blur and _scale cvars"
seta crosshair_hittest_blur 1 "blur the crosshair if the shot is obstructed"
seta crosshair_hittest_scale 1.25 "shrink crosshair if shot is obstructed or aiming at a teammate"
-seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed"
+seta crosshair_hittest_showimpact 0 "move the crosshair to the actual impact location if obstructed (debug setting, very glitchy!)"
// change color based on special case
seta crosshair_color_special 1 "special color handling for crosshair... 1 = per-weapon crosshair color (see crosshair_per_weapon), 2 = crosshair changes color based on health, 3 = rainbow/random color selection"
$(eval DAT=$(PROG)-$(VER).dat)
$(eval LNO=$(PROG)-$(VER).lno)
@ echo "http://xonotic.org" > $(TXT)
- @ ln -f $(PROGS_OUT)/$(PROG).dat $(DAT)
- @ ln -f $(PROGS_OUT)/$(PROG).lno $(LNO)
+ @ cp -f $(PROGS_OUT)/$(PROG).dat $(DAT)
+ @ cp -f $(PROGS_OUT)/$(PROG).lno $(LNO)
@ $(RM) *.pk3
$(ZIP) $(PK3) $(TXT) $(DAT) $(LNO)
@ $(RM) $(TXT) $(DAT) $(LNO)
#define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
float autocvar_cl_viewmodel_scale;
-float autocvar_cl_viewmodel_alpha;
+float autocvar_cl_viewmodel_alpha = 1;
bool autocvar_cl_bobmodel;
float autocvar_cl_bobmodel_speed;
/**/ o(string, MUTATOR_ARGV_1_string) \
/**/
MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
+
+/** decides whether a player can crouch or not */
+#define EV_PlayerCanCrouch(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** do_crouch */ i(bool, MUTATOR_ARGV_1_bool) \
+ /**/ o(bool, MUTATOR_ARGV_1_bool) \
+ /**/
+MUTATOR_HOOKABLE(PlayerCanCrouch, EV_PlayerCanCrouch);
// generated file; do not modify
-#ifdef SVQC
- #include <common/mutators/mutator/bloodloss/sv_bloodloss.qc>
-#endif
+#include <common/mutators/mutator/bloodloss/bloodloss.qc>
// generated file; do not modify
-#ifdef SVQC
- #include <common/mutators/mutator/bloodloss/sv_bloodloss.qh>
-#endif
+#include <common/mutators/mutator/bloodloss/bloodloss.qh>
--- /dev/null
+#include "bloodloss.qh"
+
+#ifdef GAMEQC
+#ifdef SVQC
+REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss);
+#elif defined(CSQC)
+REGISTER_MUTATOR(bloodloss, true);
+#endif
+
+#ifdef SVQC
+.float bloodloss_timer;
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(game_stopped)
+ return; // during intermission, the player's health changes to strange values for the engine, let's not cause damage during this phase!
+
+ if(IS_PLAYER(player))
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player) && time >= player.bloodloss_timer)
+ {
+ if(player.vehicle)
+ vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick!
+ if(player.event_damage)
+ player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
+ player.bloodloss_timer = time + 0.5 + random() * 0.5;
+ }
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ entity player = M_ARGV(0, entity);
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
+ M_ARGV(1, bool) = true; // do_crouch
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
+ return true;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
+{
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
+{
+ M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
+}
+#endif
+
+#ifdef CSQC
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ if(STAT(HEALTH) <= STAT(BLOODLOSS))
+ M_ARGV(1, bool) = true; // do_crouch
+}
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
+{
+ if(STAT(HEALTH) <= STAT(BLOODLOSS))
+ return true;
+}
+#endif
+
+#endif
--- /dev/null
+#pragma once
+++ /dev/null
-#include "sv_bloodloss.qh"
-
-float autocvar_g_bloodloss;
-REGISTER_MUTATOR(bloodloss, autocvar_g_bloodloss);
-
-.float bloodloss_timer;
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
-{
- entity player = M_ARGV(0, entity);
-
- if(IS_PLAYER(player))
- if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
- {
- PHYS_INPUT_BUTTON_CROUCH(player) = true;
-
- if(time >= player.bloodloss_timer)
- {
- if(player.vehicle)
- vehicles_exit(player.vehicle, VHEF_RELEASE);
- if(player.event_damage)
- player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
- player.bloodloss_timer = time + 0.5 + random() * 0.5;
- }
- }
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
-{
- entity player = M_ARGV(0, entity);
-
- if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
- return true;
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsString)
-{
- M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
-}
-
-MUTATOR_HOOKFUNCTION(bloodloss, BuildMutatorsPrettyString)
-{
- M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
-}
+++ /dev/null
-#pragma once
gettouch(this)(this, oth);
if(oth.solid != SOLID_NOT && gettouch(oth))
- {
- trace_endpos = oth.origin;
- trace_plane_normal = -trace_plane_normal;
- trace_plane_dist = -trace_plane_dist;
- trace_ent = this;
- trace_dpstartcontents = 0;
- trace_dphitcontents = 0;
- trace_dphitq3surfaceflags = 0;
- trace_dphittexturename = string_null;
gettouch(oth)(oth, this);
- }
}
void _Movetype_LinkEdict_TouchAreaGrid(entity this) // SV_LinkEdict_TouchAreaGrid
entity this = _Movetype_TestEntityPosition_ent;
vector org = this.origin + ofs;
- int cont = this.dphitcontentsmask;
- this.dphitcontentsmask = DPCONTENTS_SOLID;
+ //int cont = this.dphitcontentsmask;
+ //this.dphitcontentsmask = DPCONTENTS_SOLID;
tracebox(org, this.mins, this.maxs, org, ((this.move_movetype == MOVETYPE_FLY_WORLDONLY) ? MOVE_WORLDONLY : MOVE_NOMONSTERS), this);
- this.dphitcontentsmask = cont;
+ //this.dphitcontentsmask = cont;
if(trace_startsolid)
return true;
if(vdist(trace_endpos - this.origin, >, 0.0001))
- this.origin = trace_endpos;
+ {
+ tracebox(trace_endpos, this.mins, this.maxs, trace_endpos, MOVE_NOMONSTERS, this);
+ if(!trace_startsolid)
+ this.origin = trace_endpos;
+ }
return false;
}
return UNSTICK_FINE;
}
#define X(v) if (_Movetype_TestEntityPosition(v))
+ X('0 0 -1') X(' 0 0 1')
X('-1 0 0') X(' 1 0 0')
X(' 0 -1 0') X(' 0 1 0')
X('-1 -1 0') X(' 1 -1 0')
#define X(i) \
if (_Movetype_TestEntityPosition('0 0 -1' * i)) \
if (_Movetype_TestEntityPosition('0 0 1' * i))
- X(1) X(2) X(3) X(4) X(5) X(6) X(7) X(8)
+ X(2) X(3) X(4) X(5) X(6) X(7) X(8)
X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16)
X(17)
#undef X
}
LOG_DEBUGF("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)",
etof(this), this.classname, vtos(this.origin));
- _Movetype_LinkEdict(this, true);
+ _Movetype_LinkEdict(this, false);
return UNSTICK_FIXED;
}
do_crouch = false;
}
+ MUTATOR_CALLHOOK(PlayerCanCrouch, this, do_crouch);
+ do_crouch = M_ARGV(1, bool);
+
if (do_crouch) {
if (!IS_DUCKED(this)) {
SET_DUCKED(this);
REGISTER_STAT(WALLJUMP_FORCE, float, autocvar_g_walljump_force)
REGISTER_STAT(LASTWJ, float)
+#ifdef SVQC
+float autocvar_g_bloodloss;
+#endif
+REGISTER_STAT(BLOODLOSS, float, autocvar_g_bloodloss)
+
// freeze tag, clan arena
REGISTER_STAT(REDALIVE, int)
REGISTER_STAT(BLUEALIVE, int)
float autocvar_v_deathtiltangle;
void CSQCPlayer_ApplyDeathTilt(entity this)
{
- if(!IS_DEAD(this) || !autocvar_v_deathtilt)
+ if(!this.csqcmodel_isdead || !autocvar_v_deathtilt)
return;
view_angles.z = autocvar_v_deathtiltangle;
}
float bob2_smooth;
vector CSQCPlayer_ApplyBobbing(entity this, vector v)
{
- if(IS_DEAD(this))
+ if(this.csqcmodel_isdead)
return v;
// bounded XY speed, used by several effects below
me.checkMarkOrigin = eY + eX * (me.columnCheckMarkOrigin + me.columnCheckMarkSize) - me.checkMarkSize;
+ me.typeIconOrigin = vec3(me.columnPreviewSize - me.checkMarkSize.x, me.checkMarkOrigin.y, 0);
+ me.typeIconSize = me.checkMarkSize;
+
rewrapCampaign(me.columnNameSize, me.rowsPerItem - 3, me.emptyLineHeight, me.realFontSize);
}
void XonoticCampaignList_doubleClickListBoxItem(entity me, float i, vector where)
else
draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", campaign_mapname[i]), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
+ s = strcat("/gfx/menu/", cvar_string("menu_skin"), "/gametype_", campaign_gametype[i]);
+ if(i <= me.campaignIndex && draw_PictureSize(s) != '0 0 0')
+ draw_Picture(me.typeIconOrigin, s, me.typeIconSize, '1 1 1', 1);
+
if(i < me.campaignIndex)
draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
if(i <= me.campaignIndex)
ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0);
ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0');
ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0');
+ ATTRIB(XonoticCampaignList, typeIconOrigin, vector, '0 0 0');
+ ATTRIB(XonoticCampaignList, typeIconSize, vector, '0 0 0');
ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0);
ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "0", _("1st person perspective")));
- makeMulti(e, "crosshair_hittest_showimpact");
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "cl_eventchase_death", _("Slide to third person upon death")));
me.TR(me);
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticRadioButton(1, "chase_active", "1", _("3rd person perspective")));
- makeMulti(e, "crosshair_hittest_showimpact");
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Back distance")));
#include "weaponslist.qh"
#include "commandbutton.qh"
#include "textlabel.qh"
+#include "textslider.qh"
#include "checkbox.qh"
#include "button.qh"
#include "radiobutton.qh"
me.TD(me, 1, 1.0, e = makeXonoticRadioButton_T(1, "cl_gunalign", "3", _("Right align"),
_("Position of the weapon model; requires reconnect")));
setDependent(e, "r_drawviewmodel", 1, 1);
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Weapon model opacity:")));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+
+ me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_viewmodel_alpha"));
+ setDependent(e, "r_drawviewmodel", 1, 1);
+ e.addValue(e, "15%", "0.15");
+ e.addValue(e, "25%", "0.25");
+ e.addValue(e, "50%", "0.5");
+ e.addValue(e, "75%", "0.75");
+ e.addValue(e, "100%", "1");
+ e.configureXonoticTextSliderValues(e);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);
me.gotoRC(me, me.rows - 2, 0);
me.TD(me, 1, 2, e = makeXonoticTextLabel(0.5, _("Campaign Difficulty:")));
me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-2", ZCTX(_("CSKL^Easy"))));
- me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "-1", ZCTX(_("CSKL^Medium"))));
- me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Hard"))));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "0", ZCTX(_("CSKL^Medium"))));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "g_campaign_skill", "2", ZCTX(_("CSKL^Hard"))));
me.TR(me);
me.TD(me, 1, me.columns, e = makeXonoticButton(_("Start Singleplayer!"), '0 0 0'));
e.onClick = CampaignList_LoadMap;
return;
}
- baseskill = autocvar_g_campaign_skill;
- baseskill = baseskill + campaign_botskill[0];
- if(baseskill < 0)
- baseskill = 0;
-
+ baseskill = max(0, autocvar_g_campaign_skill + campaign_botskill[0]);
campaign_forcewin = false;
cvar_set("sv_public", "0");
#include "campaign.qh"
#include "command/common.qh"
#include "scores_rules.qh"
+#include "weapons/common.qh"
#include "bot/api.qh"
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
- entity oldwep = this.(weaponentity);
CL_SpawnWeaponentity(this, weaponentity);
- if(oldwep && oldwep.owner == this)
- this.(weaponentity).m_gunalign = oldwep.m_gunalign;
}
this.alpha = default_player_alpha;
this.colormod = '1 1 1' * autocvar_g_player_brightness;
if (CS(this).impulse) ImpulseCommands(this);
+ W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
.int items_added;
.string shootfromfixedorigin;
+.bool dualwielding_prev;
bool PlayerThink(entity this)
{
if (game_stopped || intermission_running) {
stuffcmd(this, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
}
+ // reset gun alignment when dual wielding status changes
+ // to ensure guns are always aligned right and left
+ bool dualwielding = W_DualWielding(this);
+ if(this.dualwielding_prev != dualwielding)
+ {
+ W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
+ this.dualwielding_prev = dualwielding;
+ }
+
// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
//if(frametime)
{
if(weaponLocked(actor)) return;
if(actor.vehicle) return;
- // TODO: offhand hook shoots from eye
+ int s = W_GunAlign(actor.(weaponentity), STAT(GUNALIGN, actor)) - 1;
+ vector vs = hook_shotorigin[s];
+ vector oldmovedir = actor.(weaponentity).movedir;
+ actor.(weaponentity).movedir = vs;
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', true, 0, SND_HOOK_FIRE, CH_WEAPON_B, 0, WEP_HOOK.m_id);
Send_Effect(EFFECT_HOOK_MUZZLEFLASH, w_shotorg, '0 0 0', 1);
+ actor.(weaponentity).movedir = oldmovedir;
entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
missile.owner = missile.realowner = actor;
}
if (s == "cl_allow_uidtracking")
PlayerStats_GameReport_AddPlayer(this);
+ //if (s == "cl_gunalign")
+ //W_ResetGunAlign(this, store.cvar_cl_gunalign);
}
}
return false;
}
+void W_ResetGunAlign(entity player, int preferred_alignment)
+{
+ if(W_DualWielding(player))
+ preferred_alignment = 3; // right align, the second gun will default to left
+
+ // clear current weapon slots' alignments so we can redo the calculations!
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ if (player.(weaponentity))
+ player.(weaponentity).m_gunalign = 0;
+ }
+
+ // now set the new values
+ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+ {
+ .entity weaponentity = weaponentities[slot];
+ if (player.(weaponentity))
+ player.(weaponentity).m_gunalign = W_GunAlign(player.(weaponentity), preferred_alignment);
+ }
+}
+
.bool hook_switchweapon;
void W_WeaponFrame(Player actor, .entity weaponentity)
void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sent_sound);
+void W_ResetGunAlign(entity player, int preferred_alignment);
+
void W_WeaponFrame(Player actor, .entity weaponentity);
float W_WeaponRateFactor(entity this);
seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
-seta cl_viewmodel_alpha 0 "Maximum transparency of the view model, set to 0 to disable"
+seta cl_viewmodel_alpha 1 "Maximum opacity of the view model, use a value between 0 and 1"
set debugdraw 0
set debugdraw_filter ""
set g_campaign 0
set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink"
seta g_campaign_name "xonoticbeta"
-seta g_campaign_skill -1 // -2 easy -1 medium 0 hard
+seta g_campaign_skill 0 // -2 easy, 0 medium, 2 hard
alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0"
alias singleplayer_continue "set scmenu_campaign_goto -1"