]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/sv_main.qc
Include gmqcc binaries for Windows and Linux
[voretournament/voretournament.git] / data / qcsrc / server / sv_main.qc
index 53c8d95f18daa06acf1a3eebec8d4bc0a17029cf..eb4bb6b4bc68dbb94a8913e31aa693a4e296d7de 100644 (file)
@@ -69,18 +69,18 @@ void CreatureFrame (void)
                        // check for falling damage\r
                        if(!(g_cts && !cvar("g_cts_selfdamage")))\r
                        {\r
+                               // if we are smaller or larger, take more or less falling damage\r
+                               float scalefac;\r
+                               scalefac = cvar("g_healthsize") ? pow(self.scale, cvar("g_healthsize_falldamagefactor")) : 1;\r
+\r
                                dm = vlen(self.oldvelocity) - vlen(self.velocity); // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.\r
                                if (self.deadflag)\r
-                                       dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * cvar("g_balance_falldamage_factor");\r
+                                       dm = (dm - cvar("g_balance_falldamage_deadminspeed") * scalefac) * cvar("g_balance_falldamage_factor");\r
                                else\r
-                                       dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage"));\r
+                                       dm = min((dm - cvar("g_balance_falldamage_minspeed") * scalefac) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage"));\r
+                               dm /= scalefac;\r
                                if (dm > 0)\r
-                               {\r
                                        Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0');\r
-                                       // this must be allowed to cut the normal pain sounds (played after them and on the same channel)\r
-                                       // there's no way to detect falling damage and prevent the pain sounds for this to be played instead\r
-                                       PlayerSound(self, playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
-                               }\r
                                else if(vlen(self.velocity) > 100000 && cvar("developer"))\r
                                {\r
                                        dprint(strcat(self.netname, " became too fast, please investigate: ", vtos(self.spawnorigin), "\n"));\r
@@ -109,10 +109,49 @@ void CreatureFrame (void)
                                        */\r
                                        if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)\r
                                        {\r
-                                               if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
-                                                       GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+                                               // if healthsize is enabled, play effects based on player size\r
+                                               if(cvar("g_healthsize"))\r
+                                               {\r
+                                                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
+                                                               GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                                       else\r
+                                                               GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                                       sound(self, CHAN_AUTO, "misc/macro_footstep.wav", bound(0, VOL_BASE * playersize_macro(self), 1), ATTN_NORM);\r
+\r
+                                                       // earthquake effect for nearby players when a macro walks by\r
+                                                       if(cvar("g_healthsize_quake_step"))\r
+                                                       {\r
+                                                               entity head;\r
+                                                               for(head = findradius(self.origin, cvar("g_healthsize_quake_step_radius")); head; head = head.chain)\r
+                                                               {\r
+                                                                       if not(head.classname == "player" || head.classname == "spectator")\r
+                                                                               continue;\r
+                                                                       if(head == self || head.spectatee_status == num_for_edict(self))\r
+                                                                               continue; // not for self\r
+                                                                       if not(head.flags & FL_ONGROUND)\r
+                                                                               continue; // we only feel the ground shaking if we are sitting on it\r
+                                                                       if(head.stat_eaten)\r
+                                                                               continue; // not for prey\r
+\r
+                                                                       float shake;\r
+                                                                       shake = vlen(head.origin - self.origin);\r
+                                                                       if(shake)\r
+                                                                               shake = 1 - bound(0, shake / cvar("g_healthsize_quake_step_radius"), 1);\r
+                                                                       shake *= playersize_macro(self) * cvar("g_healthsize_quake_step");\r
+\r
+                                                                       head.punchvector_x += crandom() * shake;\r
+                                                                       head.punchvector_y += crandom() * shake;\r
+                                                                       head.punchvector_z += crandom() * shake;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
                                                else\r
-                                                       GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+                                               {\r
+                                                       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
+                                                               GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE);\r
+                                                       else\r
+                                                               GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE);\r
+                                               }\r
                                        }\r
                                }\r
                        }\r