From 711400a2c7497eccc945f2ef85b5364f02e85a5b Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 29 Apr 2017 01:20:15 +1000 Subject: [PATCH] Add a mutator hook to the view model drawing function --- qcsrc/client/mutators/events.qh | 6 ++++++ qcsrc/client/view.qc | 1 + 2 files changed, 7 insertions(+) diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index ddadde897..56947865d 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -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); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 865ddf6a0..185fa3f2b 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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); } -- 2.39.2