From: Mario Date: Fri, 28 Apr 2017 15:20:15 +0000 (+1000) Subject: Add a mutator hook to the view model drawing function X-Git-Tag: xonotic-v0.8.5~2825 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=711400a2c7497eccc945f2ef85b5364f02e85a5b Add a mutator hook to the view model drawing function --- 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); }