Compare commits
3 Commits
4600a03165
...
64a6a9007d
Author | SHA1 | Date |
---|---|---|
Marco Cawthorne | 64a6a9007d | |
Marco Cawthorne | 21c27969f6 | |
Marco Cawthorne | cca461effe |
|
@ -35,6 +35,7 @@ seta net_showUpdates 0 // Enable/disable console prints about entity updates.
|
|||
// game console variables
|
||||
seta g_gravity 800 // Global gravity setting, in unit per second.
|
||||
seta g_mapCycle "mapcycle.txt" // Map cycle file for multiplayer games.
|
||||
seta g_developer 0 // Prints game-logic specific debug messages when 1.
|
||||
|
||||
// input console variables
|
||||
seta in_zoomSensitivity 1.0 // Mouse sensitivity multiplier for when we're using the +zoomin command.
|
||||
|
@ -69,6 +70,8 @@ seta xr_roomScale 1.0 // Scales world<>game translation.
|
|||
seta xr_viewHeight -48.0 // Specifies the head offset when in XR mode.
|
||||
seta xr_testInputs 0 // Send faux XR input signals when enabled.
|
||||
|
||||
seta s_developer 0 // Prints sound-logic specific debug messages when 1.
|
||||
|
||||
// aliases for the older commands (may be removed some day)
|
||||
alias cl_autojump pm_autoJump
|
||||
alias cl_showfps com_showFPS
|
||||
|
|
|
@ -30,7 +30,8 @@ Shoots model entities from its location.
|
|||
- "m_iGibs" : Amount of models shot in total.
|
||||
- "m_flDelay" : Delay before being able to be fired again.
|
||||
- "m_flVelocity" : Speed of the models in units per second.
|
||||
- "m_flVariance" : Delay between shots.
|
||||
- "delay" : Delay between shots.
|
||||
- "m_flVariance" : Variance in shot trajectory.
|
||||
- "m_flGibLife" : Life of the individual model piece.
|
||||
- "scale" : Scale modifier of the model pieces.
|
||||
|
||||
|
@ -177,7 +178,7 @@ env_shooter::SpawnKey(string strKey, string strValue)
|
|||
case "m_iGibs":
|
||||
m_iGibs = stoi(strValue);
|
||||
break;
|
||||
case "m_flDelay":
|
||||
case "delay":
|
||||
m_flDelay = stof(strValue);
|
||||
break;
|
||||
case "m_flVelocity":
|
||||
|
@ -238,19 +239,19 @@ env_shooter::ShootGib(void)
|
|||
|
||||
switch (m_flShootSounds) {
|
||||
case 0: /* glass */
|
||||
StartSoundDef("func_breakable.impact_glass", CHAN_VOICE, false);
|
||||
StartSoundDef("sfx_impact.glass", CHAN_VOICE, false);
|
||||
break;
|
||||
case 1: /* wood */
|
||||
StartSoundDef("func_breakable.impact_wood", CHAN_VOICE, false);
|
||||
StartSoundDef("sfx_impact.wood", CHAN_VOICE, false);
|
||||
break;
|
||||
case 2: /* metal */
|
||||
StartSoundDef("func_breakable.impact_metal", CHAN_VOICE, false);
|
||||
StartSoundDef("sfx_impact.metal", CHAN_VOICE, false);
|
||||
break;
|
||||
case 3: /* flesh */
|
||||
StartSoundDef("func_breakable.impact_flesh", CHAN_VOICE, false);
|
||||
StartSoundDef("sfx_impact.flesh", CHAN_VOICE, false);
|
||||
break;
|
||||
case 4: /* concrete */
|
||||
StartSoundDef("func_breakable.impact_concrete", CHAN_VOICE, false);
|
||||
StartSoundDef("sfx_impact.concrete", CHAN_VOICE, false);
|
||||
break;
|
||||
case -1: /* none */
|
||||
default:
|
||||
|
@ -261,8 +262,11 @@ env_shooter::ShootGib(void)
|
|||
m_flGibLife = 1.0f;
|
||||
|
||||
makevectors(GetAngles());
|
||||
vecThrowVel = v_forward * m_flVelocity;
|
||||
vecThrowVel += [0.0f, 0.0f, 32.0f + (random() * 32.0f)];
|
||||
vecThrowVel = v_forward;
|
||||
vecThrowVel += (random(-1,1) * v_right) * m_flVariance;
|
||||
vecThrowVel += (random(-1,1) * v_up) * m_flVariance;
|
||||
vecThrowVel *= m_flVelocity;
|
||||
|
||||
vecSpinVel[0] = random(-1,1) * 32;
|
||||
vecSpinVel[1] = random(-1,1) * 32;
|
||||
vecSpinVel[2] = random(-1,1) * 32;
|
||||
|
@ -272,8 +276,14 @@ env_shooter::ShootGib(void)
|
|||
|
||||
m_iGibsLeft--;
|
||||
|
||||
/* keep shooting til we're done */
|
||||
if (m_iGibsLeft) {
|
||||
ScheduleThink(ShootGib, m_flVariance);
|
||||
ScheduleThink(ShootGib, m_flDelay);
|
||||
} else {
|
||||
/* no more gibs left, destroy if wanted */
|
||||
if (HasSpawnFlags(EVSHOOTER_REPEATABLE) == false) {
|
||||
ScheduleThink(Destroy, m_flDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,10 +295,12 @@ env_shooter::Trigger(entity act, triggermode_t state)
|
|||
ReleaseThink();
|
||||
break;
|
||||
case TRIG_ON:
|
||||
if (spawnflags & EVSHOOTER_REPEATABLE)
|
||||
/* reset gib count if repeatable. */
|
||||
if (HasSpawnFlags(EVSHOOTER_REPEATABLE) == true) {
|
||||
m_iGibsLeft = m_iGibs;
|
||||
}
|
||||
|
||||
ScheduleThink(ShootGib, m_flVariance);
|
||||
ScheduleThink(ShootGib, m_flDelay);
|
||||
break;
|
||||
default:
|
||||
if (IsThinking() == false)
|
||||
|
|
|
@ -165,8 +165,7 @@ inet_refreshframe(void)
|
|||
|
||||
address = gethostcachestring(srv_fldAdress, i);
|
||||
|
||||
/* skip LAN */
|
||||
if (!address || Server_IsLan(address)) {
|
||||
if (!address) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ lan_refreshframe(void)
|
|||
string ping;
|
||||
|
||||
address = gethostcachestring(srv_fldAdress, i);
|
||||
if (!address || !Server_IsLan(address)) {
|
||||
|
||||
if (!address) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,18 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
static bool
|
||||
Server_IsLan(string address)
|
||||
{
|
||||
tokenizebyseparator(address, ".");
|
||||
|
||||
if (argv(0) == "192" && argv(1) == "168") {
|
||||
return (1);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
Master_Resolve(void)
|
||||
{
|
||||
|
|
|
@ -949,21 +949,24 @@ bool NSEntity::StartSound( string strSample, float channel, float flags, bool br
|
|||
return ( false );
|
||||
|
||||
if ( broadcast ) {
|
||||
sound( this, channel, strSample, 1.0, ATTN_NORM );
|
||||
sound( this, channel, strSample, 1.0f, ATTN_NORM, 0, SOUNDFLAG_FOLLOW );
|
||||
} else {
|
||||
#ifdef SERVER
|
||||
msg_entity = this;
|
||||
sound( this, channel, strSample, 1.0, ATTN_NORM, 0, SOUNDFLAG_UNICAST );
|
||||
sound( this, channel, strSample, 1.0f, ATTN_NORM, 0, SOUNDFLAG_UNICAST | SOUNDFLAG_FOLLOW);
|
||||
msg_entity = __NULL__;
|
||||
#else
|
||||
sound( this, channel, strSample, 1.0, ATTN_NORM );
|
||||
sound( this, channel, strSample, 1.0f, ATTN_NORM, 0, SOUNDFLAG_FOLLOW );
|
||||
#endif
|
||||
}
|
||||
|
||||
SndLog( "^2%s::^3StartSound^7: %s (chan: %d bcast: %d) (%v)", classname, strSample, channel, broadcast, origin );
|
||||
|
||||
return ( true );
|
||||
}
|
||||
|
||||
bool NSEntity::StartSoundDef( string strSample, float channel, bool broadcast ) {
|
||||
NSLog( "^2%s::^3StartSoundDef^7: %s (chan: %d bcast: %d)", classname, strSample, channel, broadcast );
|
||||
SndLog( "^2%s::^3StartSoundDef^7: %s (chan: %d bcast: %d)", classname, strSample, channel, broadcast );
|
||||
Sound_Play( this, channel, strSample );
|
||||
return ( true );
|
||||
}
|
||||
|
|
|
@ -959,23 +959,23 @@ NSRenderableEntity::HandleAnimEvent(float flTimeStamp, int iCode, string strData
|
|||
case 1004: /* plays a sound on CHAN_BODY */
|
||||
#ifdef CLIENT
|
||||
if (substring(strData, 0, 1) == "*")
|
||||
sound(self, CHAN_BODY, substring(strData, 1, -1), 1.0f, ATTN_NORM);
|
||||
StartSound(substring(strData, 1, -1), CHAN_BODY, 0, true);
|
||||
else
|
||||
sound(self, CHAN_BODY, strData, 1.0f, ATTN_NORM);
|
||||
StartSound(strData, CHAN_BODY, 0, true);
|
||||
#endif
|
||||
break;
|
||||
case 1008: /* plays a sound on CHAN_VOICE */
|
||||
#ifdef CLIENT
|
||||
if (substring(strData, 0, 1) == "*")
|
||||
sound(self, CHAN_VOICE, substring(strData, 1, -1), 1.0f, ATTN_NORM);
|
||||
StartSound(substring(strData, 1, -1), CHAN_VOICE, 0, true);
|
||||
else
|
||||
sound(self, CHAN_VOICE, strData, 1.0f, ATTN_NORM);
|
||||
StartSound(strData, CHAN_VOICE, 0, true);
|
||||
#endif
|
||||
break;
|
||||
#ifdef CLIENT
|
||||
case 5004: /* view model sound? */
|
||||
sound(this, CHAN_AUTO, strData, 1.0, ATTN_NORM, 100, SOUNDFLAG_FOLLOW | SOUNDFLAG_NOSPACIALISE);
|
||||
StartSound(strData, CHAN_AUTO, 0, true);
|
||||
break;
|
||||
#ifdef CLIENT
|
||||
case 5001: /* muzzle flash on attachment 0 */
|
||||
EV_MuzzleFlash_Create(this, m_iNumBones, m_flMuzzleScale, m_iMuzzleModel);
|
||||
break;
|
||||
|
@ -993,10 +993,10 @@ NSRenderableEntity::HandleAnimEvent(float flTimeStamp, int iCode, string strData
|
|||
for (entity f = world; (f = find(f, ::targetname, strData));) {
|
||||
NSEntity trigger = (NSEntity)f;
|
||||
if (trigger.Trigger != __NULL__) {
|
||||
trigger.Trigger(self, TRIG_TOGGLE);
|
||||
trigger.Trigger(this, TRIG_TOGGLE);
|
||||
NSLog("^2%s^7::^3ModelEvent^7: " \
|
||||
"Calling trigger '%s'\n",
|
||||
self.classname, strData);
|
||||
classname, strData);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@brief Constants macro loader
|
||||
|
||||
Scripters and level designers are able to define parameters through the use
|
||||
of name-based lookups.
|
||||
of name-based lookups, so they can change them later in one convenient place.
|
||||
|
||||
In the game directory, they are defined within `scripts/constants.txt`.
|
||||
An example file looks like this:
|
||||
|
@ -41,7 +41,7 @@ That would look something like this:
|
|||
The same applies to data read within level files and most routines related to parsing key/value pairs, so it is not limited to usage within EntityDef.
|
||||
*/
|
||||
|
||||
/** Called upon world init internally to populate our look-up table.
|
||||
/** Called upon game init internally to populate our look-up table.
|
||||
*/
|
||||
void Constants_Init(void);
|
||||
|
||||
|
|
|
@ -28,6 +28,15 @@
|
|||
.float maxspeed;
|
||||
.float flags;
|
||||
|
||||
var bool autocvar_s_developer = false;
|
||||
void
|
||||
_Sound_Log(string msg)
|
||||
{
|
||||
if (autocvar_s_developer == true)
|
||||
print(sprintf("%f %s\n", time, msg));
|
||||
}
|
||||
#define SndLog(...) _Sound_Log(sprintf(__VA_ARGS__))
|
||||
|
||||
/** Global hash table for name > soundDef id lookup. */
|
||||
var hashtable g_hashsounds;
|
||||
|
||||
|
|
|
@ -396,9 +396,9 @@ Sound_Precache(string shader)
|
|||
|
||||
index = g_sounds_count;
|
||||
|
||||
dprint("[SOUND] Precaching sound shader ");
|
||||
dprint(shader);
|
||||
dprint("\n");
|
||||
SndLog("Precaching SoundDef ");
|
||||
SndLog(shader);
|
||||
SndLog("\n");
|
||||
|
||||
/* create the hash-table if it doesn't exist */
|
||||
if (!g_hashsounds) {
|
||||
|
@ -411,7 +411,7 @@ Sound_Precache(string shader)
|
|||
cache = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (cache >= 0) {
|
||||
NSLog("^1Sound_Precache: shader %s already precached", shader);
|
||||
SndLog("^1Sound_Precache: def %s already precached", shader);
|
||||
return cache;
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ Sound_Precache(string shader)
|
|||
fclose(fh);
|
||||
}
|
||||
|
||||
print("^1no soundDef found for ");
|
||||
print("^1no SoundDef found for ");
|
||||
print(shader);
|
||||
print("\n");
|
||||
g_sounds_count--;
|
||||
|
@ -481,7 +481,7 @@ Sound_Distance(entity target, string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_Distance: shader %s is not precached\n", shader));
|
||||
crossprint(sprintf("^1Sound_Distance: def %s is not precached\n", shader));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ Sound_DistancePos(vector pos, string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_DistancePos: shader %s is not precached (SERVER)\n", shader));
|
||||
SndLog("^1Sound_DistancePos: def %s is not precached (SERVER)\n", shader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -577,10 +577,7 @@ Sound_DistancePos(vector pos, string shader)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
print(sprintf("Sound_DistancePos: %s\n", argv(r)));
|
||||
#endif
|
||||
|
||||
SndLog(sprintf("Sound_DistancePos: %s\n", argv(r)));
|
||||
pointsound_proper(pos, argv(r), volume, ATTN_NONE, pitch);
|
||||
}
|
||||
|
||||
|
@ -601,7 +598,7 @@ Sound_Play(entity target, int chan, string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_Play: shader %s is not precached\n", shader));
|
||||
SndLog("^1Sound_Play: def %s is not precached\n", shader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -724,7 +721,7 @@ Sound_PlayAt(vector pos, string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_PlayAt: shader %s is not precached\n", shader));
|
||||
SndLog("^1Sound_PlayAt: def %s is not precached\n", shader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -780,7 +777,7 @@ Sound_PlayLocal(string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_PlayLocal: shader %s is not precached\n", shader));
|
||||
SndLog("^1Sound_PlayLocal: def %s is not precached\n", shader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -866,7 +863,7 @@ Sound_Speak(entity target, string shader)
|
|||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||
|
||||
if (sample < 0) {
|
||||
crossprint(sprintf("^1Sound_Speak: shader %s is not precached (SERVER)\n", shader));
|
||||
SndLog("^1Sound_Speak: def %s is not precached (SERVER)\n", shader);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue