float autocvar_cl_hitsound_nom_damage = 25;
float autocvar_cl_hitsound_antispam_time;
int autocvar_cl_eventchase_death = 1;
-vector autocvar_cl_eventchase_generator_viewoffset = '0 0 80';
-float autocvar_cl_eventchase_generator_distance = 400;
float autocvar_cl_eventchase_distance = 140;
float autocvar_cl_eventchase_speed = 1.3;
vector autocvar_cl_eventchase_maxs = '12 12 8';
/**/
MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
+/** allow customizing 3rd person mode effect */
+#define EV_CustomizeEventchase(i, o) \
+ /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
+ /* current_view_origin_override */ o(vector, MUTATOR_ARGV_0_vector) \
+ /* view_offset_override */ o(vector, MUTATOR_ARGV_1_vector) \
+ /* chase_distance_override */ o(float, MUTATOR_ARGV_0_float) \
+ /**/
+MUTATOR_HOOKABLE(CustomizeEventchase, EV_CustomizeEventchase);
+
#define EV_AnnouncerOption(i, o) \
/** announcer string */ i(string, MUTATOR_ARGV_0_string) \
/** announcer string */ o(string, MUTATOR_ARGV_0_string) \
cvar_set("chase_active", "0");
float vehicle_chase = (hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0));
- float ons_roundlost = (gametype == MAPINFO_TYPE_ONSLAUGHT && STAT(ROUNDLOST));
- entity gen = NULL;
float vehicle_viewdist = 0;
vector vehicle_viewofs = '0 0 0';
}
}
- if(ons_roundlost) // TODO: move this junk to a client mutator for onslaught (possible using the WantEventchase hook)
+ if(WantEventchase(this))
{
- IL_EACH(g_onsgenerators, it.health <= 0,
+ vector current_view_origin_override = '0 0 0';
+ vector view_offset_override = '0 0 0';
+ float chase_distance_override = 0;
+ bool custom_eventchase = MUTATOR_CALLHOOK(CustomizeEventchase, this);
+ if(custom_eventchase)
{
- gen = it;
- break;
- });
- if(!gen)
- ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
- }
- if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
- {
+ current_view_origin_override = M_ARGV(0, vector);
+ view_offset_override = M_ARGV(1, vector);
+ chase_distance_override = M_ARGV(0, float);
+ }
eventchase_running = true;
entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
// make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
- if(ons_roundlost) { current_view_origin = gen.origin; }
+ if (custom_eventchase)
+ current_view_origin = current_view_origin_override;
// detect maximum viewoffset and use it
vector view_offset = autocvar_cl_eventchase_viewoffset;
else
view_offset = autocvar_cl_eventchase_vehicle_viewoffset;
}
- if(ons_roundlost) { view_offset = autocvar_cl_eventchase_generator_viewoffset; }
+ if (custom_eventchase)
+ view_offset = view_offset_override;
if(view_offset)
{
else
chase_distance = autocvar_cl_eventchase_vehicle_distance;
}
- if(ons_roundlost) { chase_distance = autocvar_cl_eventchase_generator_distance; }
+ if (custom_eventchase)
+ chase_distance = chase_distance_override;
if(autocvar_cl_eventchase_speed && eventchase_current_distance < chase_distance)
eventchase_current_distance += autocvar_cl_eventchase_speed * (chase_distance - eventchase_current_distance) * frametime; // slow down the further we get
#include "onslaught.qh"
+
+#ifdef CSQC
+
+REGISTER_MUTATOR(cl_ons, true);
+
+float ons_roundlost;
+vector generator_origin;
+vector autocvar_cl_eventchase_generator_viewoffset = '0 0 80';
+float autocvar_cl_eventchase_generator_distance = 400;
+MUTATOR_HOOKFUNCTION(cl_ons, WantEventchase)
+{
+ ons_roundlost = STAT(ROUNDLOST);
+ entity gen = NULL;
+ if(ons_roundlost)
+ {
+ IL_EACH(g_onsgenerators, it.health <= 0,
+ {
+ gen = it;
+ break;
+ });
+ if(!gen)
+ ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
+ }
+
+ if(ons_roundlost)
+ {
+ generator_origin = gen.origin;
+ return true;
+ }
+ return false;
+}
+
+MUTATOR_HOOKFUNCTION(cl_ons, CustomizeEventchase)
+{
+ if(ons_roundlost)
+ {
+ M_ARGV(0, vector) = generator_origin;
+ M_ARGV(1, vector) = autocvar_cl_eventchase_generator_viewoffset;
+ M_ARGV(0, float) = autocvar_cl_eventchase_generator_distance;
+ return true;
+ }
+ return false;
+}
+
+#endif