self.angles_z = 0;
}
- if(self.flags & FL_ONGROUND)
- if(IS_PLAYER(self)) // no fall sounds for observers thank you very much
- if(self.wasFlying)
- {
- self.wasFlying = 0;
-
- if(self.waterlevel < WATERLEVEL_SWIMMING)
- if(time >= self.ladder_time)
- if not(self.hook)
- {
- self.nextstep = time + 0.3 + random() * 0.1;
- trace_dphitq3surfaceflags = 0;
- tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
- if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)
- {
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
- GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- else
- GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- }
- }
- }
-
if(IsFlying(self))
self.wasFlying = 1;
// Globals
-float g_cloaked, g_footsteps, g_grappling_hook, g_minstagib;
+float g_cloaked, g_grappling_hook, g_minstagib;
float g_warmup_limit;
float g_warmup_allguns;
float g_warmup_allow_timeout;
.float in_swamp; // bool
.entity swampslug; // Uses this to release from swamp ("untouch" fix)
-// footstep interval
-.float nextstep;
-
float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
.float spectatortime; //point in time since the client is spectating or observing
void checkSpectatorBlock();
CHECK_MUTATOR_ADD("g_norecoil", mutator_norecoil, 1);
CHECK_MUTATOR_ADD("g_multijump", mutator_multijump, 1);
CHECK_MUTATOR_ADD("g_jump_grunt", mutator_jump_grunt, 1);
+ CHECK_MUTATOR_ADD("g_footsteps", mutator_footsteps, 1);
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
#undef CHECK_MUTATOR_ADD
g_cloaked = cvar("g_cloaked");
if(g_cts)
g_cloaked = 1; // always enable cloak in CTS
- g_footsteps = cvar("g_footsteps");
g_grappling_hook = cvar("g_grappling_hook");
g_jetpack = cvar("g_jetpack");
sv_maxidle = cvar("sv_maxidle");
precache_playermodel(s);
}
- if (g_footsteps)
- {
- PrecacheGlobalSound((globalsound_step = "misc/footstep0 6"));
- PrecacheGlobalSound((globalsound_metalstep = "misc/metalfootstep0 6"));
- }
-
// gore and miscellaneous sounds
//precache_sound ("misc/h2ohit.wav");
precache_model ("models/hook.md3");
--- /dev/null
+// footstep interval
+.float nextstep;
+
+MUTATOR_HOOKFUNCTION(footsteps_PlayerPhysics)
+{
+ if(self.flags & FL_ONGROUND)
+ if(IS_PLAYER(self)) // no fall sounds for observers thank you very much
+ if(self.wasFlying)
+ {
+ self.wasFlying = 0;
+
+ if(self.waterlevel < WATERLEVEL_SWIMMING)
+ if(time >= self.ladder_time)
+ if not(self.hook)
+ {
+ self.nextstep = time + 0.3 + random() * 0.1;
+ trace_dphitq3surfaceflags = 0;
+ tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
+ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)
+ {
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+ GlobalSound(globalsound_metalfall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ else
+ GlobalSound(globalsound_fall, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(footsteps_StartFrame)
+{
+ entity oldself = self;
+
+ if(gameover)
+ return FALSE;
+
+ for(self = world; (self = findfloat(self, damagedbycontents, TRUE)); )
+ {
+ float velocity_len = vlen(self.velocity);
+ // play stupid sounds
+ if (self.flags & FL_ONGROUND)
+ if (velocity_len > autocvar_sv_maxspeed * 0.6)
+ if (!self.deadflag)
+ if (time < self.lastground + 0.2)
+ {
+ if((time > self.nextstep) || (time < (self.nextstep - 10.0)))
+ {
+ self.nextstep = time + 0.3 + random() * 0.1;
+ trace_dphitq3surfaceflags = 0;
+ tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
+ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)
+ {
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
+ GlobalSound(globalsound_metalstep, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ else
+ GlobalSound(globalsound_step, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ }
+ }
+ }
+ }
+ self = oldself;
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(footsteps_BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":Footsteps");
+ return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_footsteps)
+{
+ MUTATOR_HOOK(PlayerPhysics, footsteps_PlayerPhysics, CBC_ORDER_ANY);
+ MUTATOR_HOOK(SV_StartFrame, footsteps_StartFrame, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, footsteps_BuildMutatorsString, CBC_ORDER_ANY);
+
+ MUTATOR_ONADD
+ {
+ PrecacheGlobalSound((globalsound_step = "misc/footstep0 6"));
+ PrecacheGlobalSound((globalsound_metalstep = "misc/metalfootstep0 6"));
+ }
+
+ return FALSE;
+}
MUTATOR_DEFINITION(mutator_jump_grunt)
{
MUTATOR_HOOK(PlayerJump, grunt_PlayerJump, CBC_ORDER_ANY);
- MUTATOR_HOOK(BuildMutatorsString, norecoil_BuildMutatorsString, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, grunt_BuildMutatorsString, CBC_ORDER_ANY);
return FALSE;
}
MUTATOR_DECLARATION(mutator_norecoil);
MUTATOR_DECLARATION(mutator_multijump);
MUTATOR_DECLARATION(mutator_jump_grunt);
+MUTATOR_DECLARATION(mutator_footsteps);
MUTATOR_DECLARATION(sandbox);
mutators/mutator_norecoil.qc
mutators/mutator_multijump.qc
mutators/mutator_jump_grunt.qc
+mutators/mutator_footsteps.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc
if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
Damage (self, world, world, 100000, DEATH_SHOOTING_STAR, self.origin, '0 0 0');
- // play stupid sounds
- if (g_footsteps)
- if (!gameover)
- if (self.flags & FL_ONGROUND)
- if (velocity_len > autocvar_sv_maxspeed * 0.6)
- if (!self.deadflag)
- if (time < self.lastground + 0.2)
- {
- if((time > self.nextstep) || (time < (self.nextstep - 10.0)))
- {
- self.nextstep = time + 0.3 + random() * 0.1;
- trace_dphitq3surfaceflags = 0;
- tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 1', MOVE_NOMONSTERS, self);
- /*
- if(trace_fraction == 1)
- dprint("nohit\n");
- else
- dprint(ftos(trace_dphitq3surfaceflags), "\n");
- */
- if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)
- {
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
- GlobalSound(globalsound_metalstep, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- else
- GlobalSound(globalsound_step, CH_PLAYER, VOICETYPE_PLAYERSOUND);
- }
- }
- }
}
self.oldvelocity = self.velocity;