Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Attempts to dampen the DB (decible) factor depending on pointcontents of ent emitting sound
- float() SUB_Db =
- {
- //float ATTN_NONE = 0;
- //loat ATTN_NORM = 1;
- //float ATTN_IDLE = 2;
- //float ATTN_STATIC = 3;
- //float CONTENT_EMPTY = -1;
- //float CONTENT_SOLID = -2;
- //float CONTENT_WATER = -3;
- //float CONTENT_SLIME = -4;
- //float CONTENT_LAVA = -5;
- //float CONTENT_SKY = -6;
- local float pc;
- pc = pointcontents(self.origin);
- if (pc == -3 || pc == -4)
- return (3);
- if (pc == -2)
- {
- if (self.classname == "debug_marker")
- if (Volume (self.enemy) >= 300)
- return (0);
- else
- return (1);
- }
- if (random () < 0.5)
- return (2);
- else
- return (1);
- };
- // Pick a random sound channel
- float () RND_CHAN =
- {
- local float j;
- j = (rint(random () * 6)) + 1;
- if (j == 1)
- return (RN_CH1);
- if (j == 2)
- return (RN_CH2);
- if (j == 3)
- return (RN_CH3);
- if (j == 4)
- return (RN_CH4);
- if (j == 5)
- return (RN_CH5);
- if (j == 6)
- return (RN_CH6);
- if (j == 7)
- return (RN_CH7);
- };
- void (entity obj) Hitsound =
- {
- local float s,k;
- s = (rint(random () * 149) + 1);
- if (random () < 0.5)
- k = s;
- else
- k = s /15;
- if ((s < 0.25))
- {
- if (random () < 0.5)
- sound (obj, RND_CHAN (), "weapons/tink1.wav", 1, ATTN_IDLE);
- else
- soundpitch (obj, RND_CHAN (), "weapons/tink1.wav", 1, SUB_Db(), k);
- }
- if ((s > 0.75))
- {
- if (random () < 0.5)
- sound (obj, RND_CHAN (), "weapons/ric1.wav", 1, ATTN_IDLE);
- else
- soundpitch (obj, RND_CHAN (), "weapons/ric1.wav", 1, SUB_Db(), k);
- }
- else
- {
- if (((s > 0.25) && (s < 0.5)))
- {
- if (random () < 0.5)
- sound (obj, RND_CHAN (), "weapons/ric2.wav", 1, ATTN_IDLE);
- else
- soundpitch (obj, RND_CHAN (), "weapons/ric2.wav", 1, SUB_Db(), k);
- }
- else
- {
- if (((s > 0.5) && (s < 0.75)))
- {
- if (random () < 0.5)
- sound (obj, RND_CHAN (), "weapons/ric3.wav", 1, ATTN_IDLE);
- else
- soundpitch (obj, RND_CHAN (), "weapons/ric3.wav", 1, SUB_Db(), s);
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement