]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a mutator hook to the view model drawing function
authorMario <mario@smbclan.net>
Fri, 28 Apr 2017 15:20:15 +0000 (01:20 +1000)
committerMario <mario@smbclan.net>
Fri, 28 Apr 2017 15:20:15 +0000 (01:20 +1000)
qcsrc/client/mutators/events.qh
qcsrc/client/view.qc

index ddadde8977165dc21d9845fec70d50e24a433b56..56947865db01bfcdc9876ac886ad9ee6e2a1342e 100644 (file)
@@ -170,3 +170,9 @@ MUTATOR_HOOKABLE(DrawInfoMessages, EV_DrawInfoMessages);
        /** file */                     i(float, MUTATOR_ARGV_0_float) \
        /**/
 MUTATOR_HOOKABLE(HUD_WriteCvars, EV_HUD_WriteCvars);
+
+/** Called when the view model is being animated (setorigin is called after the hook, so you only need to modify origin here if desired) */
+#define EV_DrawViewModel(i, o) \
+       /** entity id */                i(entity, MUTATOR_ARGV_0_entity) \
+       /**/
+MUTATOR_HOOKABLE(DrawViewModel, EV_DrawViewModel);
index 865ddf6a029dfa87362acc2b7c23c5162fbbffe6..185fa3f2b76fe7fbc2630481fbf289306f97212a 100644 (file)
@@ -356,6 +356,7 @@ void viewmodel_draw(entity this)
        this.angles = this.viewmodel_angles;
        this.angles_x = (-90 * f * f);
        viewmodel_animate(this);
+       MUTATOR_CALLHOOK(DrawViewModel, this);
        setorigin(this, this.origin);
 }