]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some minor tweaks and extra mutator hooks
authorMario <mario@smbclan.net>
Sat, 20 Aug 2016 12:36:33 +0000 (22:36 +1000)
committerMario <mario@smbclan.net>
Sat, 20 Aug 2016 12:36:33 +0000 (22:36 +1000)
16 files changed:
qcsrc/client/autocvars.qh
qcsrc/client/main.qh
qcsrc/client/mutators/events.qh
qcsrc/client/view.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/campcheck/campcheck.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc
qcsrc/common/stats.qh
qcsrc/common/triggers/triggers.qc
qcsrc/common/triggers/triggers.qh
qcsrc/server/defs.qh
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_domination.qh
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index 0ac857754bd8f8867709ada63c3acc6573e369a7..65a21972074e6806c5a864db6ed6dbe118fa421f 100644 (file)
@@ -396,7 +396,6 @@ float autocvar_hud_shownames_offset;
 string autocvar_hud_skin;
 float autocvar_menu_mouse_speed;
 string autocvar_menu_skin;
-float autocvar_r_drawviewmodel;
 int autocvar_r_fakelight;
 int autocvar_r_fullbright;
 float autocvar_r_letterbox;
@@ -456,4 +455,5 @@ vector autocvar_crosshair_rpc_color = '0.2 1.0 0.2';
 float autocvar_crosshair_rpc_alpha = 1;
 float autocvar_crosshair_rpc_size = 1;
 int autocvar_cl_nade_timer;
+bool autocvar_r_drawviewmodel;
 bool autocvar_cl_items_nofade;
index afd0b5e38c96be69d22b400022a0be49429a786a..e736d9d4463732353e3f4608dce038424a9bcd5f 100644 (file)
@@ -126,7 +126,7 @@ const int HOOK_END =      2;
 
 float g_trueaim_minrange;
 
-float hud;
+int hud;
 float view_quality;
 
 int num_spectators;
index b72f7abe1a3bdcb8cef50d10333d6f997259299a..a852fdbe472437e96c4ffbbf9a2f5bd498f2335a 100644 (file)
@@ -142,3 +142,6 @@ MUTATOR_HOOKABLE(DrawGrapplingHook, EV_DrawGrapplingHook);
        /** is new to client */ i(bool, MUTATOR_ARGV_1_bool) \
        /**/
 MUTATOR_HOOKABLE(Ent_Update, EV_Ent_Update);
+
+/** Return true to not draw crosshair */
+MUTATOR_HOOKABLE(DrawCrosshair, EV_NO_ARGS);
index 339d05209d2e891dbc195458fecfd2ed7574838e..db6df4dadfc972de58f3c8f2c4effbd1f563c883 100644 (file)
@@ -937,7 +937,7 @@ void HUD_Crosshair(entity this)
        float f, i, j;
        vector v;
        if(!scoreboard_active && !camera_active && intermission != 2 &&
-               spectatee_status != -1 && !csqcplayer.viewloc &&
+               spectatee_status != -1 && !csqcplayer.viewloc && !MUTATOR_CALLHOOK(DrawCrosshair) &&
                !HUD_MinigameMenu_IsOpened() )
        {
                if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
@@ -1337,6 +1337,11 @@ void HUD_Draw(entity this)
                DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * STAT(NADE_TIMER)) - ('0 1 1' * STAT(NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
                drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
        }
+       else if(STAT(CAPTURE_PROGRESS))
+       {
+               DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(CAPTURE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+               drawstring_aspect(eY * 0.64 * vid_conheight, _("Capture progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+       }
        else if(STAT(REVIVE_PROGRESS))
        {
                DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", STAT(REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
@@ -1368,6 +1373,7 @@ float oldr_useportalculling;
 float oldr_useinfinitefarclip;
 
 void cl_notice_run();
+
 float prev_myteam;
 int lasthud;
 float vh_notice_time;
@@ -1825,8 +1831,7 @@ void CSQC_UpdateView(entity this, float w, float h)
        else if(csqcplayer.viewloc) { setproperty(VF_FOV, GetViewLocationFOV(110)); } // enforce 110 fov, so things dont look odd
        else { setproperty(VF_FOV, GetCurrentFov(fov)); }
 
-       // Camera for demo playback
-       if(camera_active)
+       if(camera_active) // Camera for demo playback
        {
                if(autocvar_camera_enable)
                        CSQC_Demo_Camera();
index 713c5d7de06e3abf40c19b27f211d0759aef5a1e..a0225f6249feeee8f308dbfaebaa900f96f85deb 100644 (file)
@@ -76,8 +76,6 @@ bool ons_stalemate;
 
 .float teleport_antispam;
 
-.bool ons_roundlost = _STAT(ROUNDLOST);
-
 // waypoint sprites
 .entity bot_basewaypoint; // generator waypointsprite
 
@@ -1250,7 +1248,7 @@ bool Onslaught_CheckWinner()
        round_handler_Init(7, autocvar_g_onslaught_warmup, autocvar_g_onslaught_round_timelimit);
 
        FOREACH_CLIENT(IS_PLAYER(it), {
-               it.ons_roundlost = true;
+               STAT(ROUNDLOST, it) = true;
                it.player_blocked = true;
 
                nades_Clear(it);
@@ -1733,7 +1731,7 @@ bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effe
 MUTATOR_HOOKFUNCTION(ons, reset_map_global)
 {
        FOREACH_CLIENT(IS_PLAYER(it), {
-               it.ons_roundlost = false;
+               STAT(ROUNDLOST, it) = false;
                it.ons_deathloc = '0 0 0';
                PutClientInServer(it);
        });
@@ -2008,7 +2006,7 @@ MUTATOR_HOOKFUNCTION(ons, SpectateCopy)
        entity spectatee = M_ARGV(0, entity);
        entity client = M_ARGV(1, entity);
 
-       client.ons_roundlost = spectatee.ons_roundlost; // make spectators see it too
+       STAT(ROUNDLOST, client) = STAT(ROUNDLOST, spectatee); // make spectators see it too
 }
 
 MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
index ea46be5f12e7343152b8920cc2f7089d9f6253bf..c72c7461ed5e039f39b949c0c5a6543803e3b9f8 100644 (file)
@@ -94,6 +94,7 @@ bool Monster_ValidTarget(entity this, entity targ)
        || (SAME_TEAM(targ, this))
        || (STAT(FROZEN, targ))
        || (targ.alpha != 0 && targ.alpha < 0.5)
+       || (MUTATOR_CALLHOOK(MonsterValidTarget, this, targ))
        )
        {
                // if any of the above checks fail, target is not valid
index 1ab6fb4624eb246b027319a8685f12dc54081bac..8be3215498f3ce7a34245121e616edff2af73a03 100644 (file)
@@ -39,6 +39,7 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
        if(IS_PLAYER(player))
        if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
        if(!IS_DEAD(player))
+       if(!forbidWeaponUse(player))
        if(!STAT(FROZEN, player))
        if(!PHYS_INPUT_BUTTON_CHAT(player))
        if(autocvar_g_campcheck_interval)
index b16a6c9acf7b82df8f15445d009b56d3cf69da05..20f07e9e4eac53bd5957a98f7ed77aa2f27cf271 100644 (file)
@@ -88,6 +88,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                        if(it.msnt_timer < time)
                        if(SAME_TEAM(player, it))
                        if(time > it.spawnshieldtime) // spawn shielding
+                       if(!forbidWeaponUse(it))
                        if(STAT(FROZEN, it) == 0)
                        if(it != player)
                        {
index a24243bb6d4ec659532b39018fe458f7fc4078ea..c8822926f2bd7892df35470dd543836e635ec83d 100644 (file)
@@ -121,6 +121,7 @@ REGISTER_STAT(REVIVE_PROGRESS, float)
 REGISTER_STAT(ROUNDLOST, int)
 REGISTER_STAT(BUFF_TIME, float)
 REGISTER_STAT(CTF_FLAGSTATUS, int)
+REGISTER_STAT(CAPTURE_PROGRESS, float)
 REGISTER_STAT(ENTRAP_ORB, float)
 REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
 REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
index 849d3e8acb27ef9efba748c6ab5bab0b14178ab7..81144aae7f883b382cdf903aabd6cc64e32ca084 100644 (file)
@@ -163,6 +163,7 @@ void trigger_remove_generic(entity this)
 }
 #endif
 
+
 /*
 ==============================
 SUB_UseTargets
@@ -182,7 +183,8 @@ match (string)this.target and call their .use function
 
 ==============================
 */
-void SUB_UseTargets(entity this, entity actor, entity trigger)
+
+void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse)
 {
 //
 // check for a delay
@@ -253,7 +255,7 @@ void SUB_UseTargets(entity this, entity actor, entity trigger)
                        int aw_flag = this.antiwall_flag;
                        for(entity t = NULL; (t = find(t, targetname, s)); )
                        {
-                               if(t.use)
+                               if(t.use && (t.sub_target_used != time || !preventReuse))
                                {
                                        if(this.target_random)
                                        {
@@ -265,6 +267,8 @@ void SUB_UseTargets(entity this, entity actor, entity trigger)
                                                        t.antiwall_flag = aw_flag;
 
                                                t.use(t, actor, this);
+                                               if(preventReuse)
+                                                       t.sub_target_used = time;
                                        }
                                }
                        }
@@ -272,9 +276,16 @@ void SUB_UseTargets(entity this, entity actor, entity trigger)
        }
 
        if(this.target_random && RandomSelection_chosen_ent)
+       {
                RandomSelection_chosen_ent.use(RandomSelection_chosen_ent, actor, this);
+               if(preventReuse)
+                       RandomSelection_chosen_ent.sub_target_used = time;
+       }
 }
 
+void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false); }
+void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true); }
+
 void SUB_UseTargets_self(entity this)
 {
        SUB_UseTargets(this, NULL, NULL);
index 8a8eb566c19b2ed844035390e6236e78fd1e18b3..bc4047fe93785fb194e91b3f257adaf755283ace 100644 (file)
@@ -27,8 +27,14 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay,
 
 void target_voicescript_next(entity pl);
 void target_voicescript_clear(entity pl);
+
+void SUB_ForEachTarget_Init();
+void SUB_ForEachTarget(entity s, void(entity, float, vector, string, entity) cback, float recursive, float fdata, vector vdata, string sdata, entity edata);
+void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger);
 #endif
 
+.float sub_target_used;
+
 .float volume, atten;
 
 .vector dest;
index 53aa317e6874c97cba35cde6a7f3276284a9de3b..d2b4b148efffff48763f65ffe292132d05887ce6 100644 (file)
@@ -430,7 +430,6 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
 
-
 ////
 
 .entity player_stats;
index 0d53e054f48513fbdd716e289f5ad402f3c679be..29b1b7abd4094c7e3e2b269717008e12e2c7936b 100644 (file)
@@ -271,6 +271,15 @@ MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
 /** called when a monster looks for another target */
 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
 
+/**
+ * called when validating a monster's target
+ */
+#define EV_MonsterValidTarget(i, o) \
+    /** monster */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** target */        i(entity, MUTATOR_ARGV_1_entity) \
+    /**/
+MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
+
 /** called to change a random monster to a miniboss */
 #define EV_MonsterCheckBossFlag(i, o) \
     /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
@@ -837,3 +846,11 @@ MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
        /** data */     i(string, MUTATOR_ARGV_2_string) \
     /**/
 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
+
+/**
+ * return true to prevent weapon use for a player
+ */
+ #define EV_ForbidWeaponUse(i, o) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/
+MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
index 399830dad294adb0eb6ca0ca71fe6af6e0976604..9a0a1262f671d75b977df33c8d0dd6bb6104a055 100644 (file)
@@ -1,3 +1,5 @@
 #pragma once
 
 #include "../gamemode.qh"
+
+void AnimateDomPoint(entity this);
index c0ed81e68173da34f4c819e6701e924cf2f6f748..2efea3ff5ee3da4c36bde9914ebe0b98615304e6 100644 (file)
@@ -412,6 +412,7 @@ bool forbidWeaponUse(entity player)
        if (gameover) return true;
        if (STAT(FROZEN, player)) return true;
        if (player.weapon_blocked) return true;
+       if (MUTATOR_CALLHOOK(ForbidWeaponUse, player)) return true;
        return false;
 }
 
index d0ba63412198f1d6c016484965a0aba1c610fc87..b7ca597046fea210e290d2a00af5b10ef6a3367b 100644 (file)
@@ -8,7 +8,7 @@ void CL_SpawnWeaponentity(entity e, .entity weaponentity);
 
 vector CL_Weapon_GetShotOrg(float wpn);
 
-float forbidWeaponUse(entity player);
+bool forbidWeaponUse(entity player);
 
 void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector offset);