]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/waypoint_on_items' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 10 Aug 2019 17:53:50 +0000 (17:53 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 10 Aug 2019 17:53:50 +0000 (17:53 +0000)
Waypoint on items

See merge request xonotic/xonotic-data.pk3dir!672

29 files changed:
qcsrc/common/mapobjects/misc/corner.qc
qcsrc/common/mapobjects/misc/dynlight.qc
qcsrc/common/mapobjects/target/music.qc
qcsrc/common/mapobjects/trigger/counter.qc
qcsrc/common/mapobjects/trigger/heal.qc
qcsrc/common/mapobjects/trigger/magicear.qc
qcsrc/common/mapobjects/trigger/swamp.qc
qcsrc/common/mapobjects/trigger/swamp.qh
qcsrc/common/models/model.qh
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/monsters/sv_spawner.qc
qcsrc/common/sounds/sound.qh
qcsrc/common/turrets/checkpoint.qc
qcsrc/common/weapons/weapon/tuba.qh
qcsrc/lib/spawnfunc.qh
qcsrc/server/autocvars.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/havocbot.qh
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/havocbot/roles.qh
qcsrc/server/client.qc
qcsrc/server/defs.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_hook.qh
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/sv_main.qc
qcsrc/server/sv_main.qh
xonotic-server.cfg

index a0f67b759b9981c72d7e2e27a5394479c111a275..729f7e236e697e2aaef3a696b2f8d3f94a694e31 100644 (file)
@@ -10,12 +10,26 @@ bool corner_send(entity this, entity to, int sf)
 
        WriteVector(MSG_ENTITY, this.origin);
 
-       WriteString(MSG_ENTITY, this.target);
-       WriteString(MSG_ENTITY, this.target2);
-       WriteString(MSG_ENTITY, this.target3);
-       WriteString(MSG_ENTITY, this.target4);
-       WriteString(MSG_ENTITY, this.targetname);
-       WriteByte(MSG_ENTITY, this.target_random);
+       sf = 0;
+       sf = BITSET(sf, BIT(0), this.target_random);
+
+       sf = BITSET(sf, BIT(1), this.target && this.target != "");
+       sf = BITSET(sf, BIT(2), this.target2 && this.target2 != "");
+       sf = BITSET(sf, BIT(3), this.target3 && this.target3 != "");
+       sf = BITSET(sf, BIT(4), this.target4 && this.target4 != "");
+       sf = BITSET(sf, BIT(5), this.targetname && this.targetname != "");
+
+       WriteByte(MSG_ENTITY, sf);
+       if(sf & BIT(1))
+               WriteString(MSG_ENTITY, this.target);
+       if(sf & BIT(2))
+               WriteString(MSG_ENTITY, this.target2);
+       if(sf & BIT(3))
+               WriteString(MSG_ENTITY, this.target3);
+       if(sf & BIT(4))
+               WriteString(MSG_ENTITY, this.target4);
+       if(sf & BIT(5))
+               WriteString(MSG_ENTITY, this.targetname);
 
        WriteByte(MSG_ENTITY, this.wait);
 
@@ -54,12 +68,14 @@ NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
        this.origin = ReadVector();
        setorigin(this, this.origin);
 
-       this.target = strzone(ReadString());
-       this.target2 = strzone(ReadString());
-       this.target3 = strzone(ReadString());
-       this.target4 = strzone(ReadString());
-       this.targetname = strzone(ReadString());
-       this.target_random = ReadByte();
+       int targbits = ReadByte();
+       this.target_random = (targbits & BIT(0));
+
+       this.target = ((targbits & BIT(1)) ? strzone(ReadString()) : string_null);
+       this.target2 = ((targbits & BIT(2)) ? strzone(ReadString()) : string_null);
+       this.target3 = ((targbits & BIT(3)) ? strzone(ReadString()) : string_null);
+       this.target4 = ((targbits & BIT(4)) ? strzone(ReadString()) : string_null);
+       this.targetname = ((targbits & BIT(5)) ? strzone(ReadString()) : string_null);
 
        this.wait = ReadByte();
 
index 7c70b8444e0fac5490ff7a0d5cf8882ef1dd59a7..6e9f02b874a2c51610282c881121da037dbfc2c5 100644 (file)
@@ -46,7 +46,7 @@ void dynlight_think(entity this)
 void dynlight_find_aiment(entity this)
 {
        entity targ;
-       if (!this.target)
+       if (!this.target || this.target == "")
                objerror (this, "dynlight: no target to follow");
 
        targ = find(NULL, targetname, this.target);
@@ -62,7 +62,7 @@ void dynlight_find_aiment(entity this)
 void dynlight_find_path(entity this)
 {
        entity targ;
-       if (!this.target)
+       if (!this.target || this.target == "")
                objerror (this, "dynlight: no target to follow");
 
        targ = find(NULL, targetname, this.target);
@@ -74,7 +74,7 @@ void dynlight_find_path(entity this)
 void dynlight_find_target(entity this)
 {
        entity targ;
-       if (!this.target)
+       if (!this.target || this.target == "")
                objerror (this, "dynlight: no target to follow");
 
        targ = find(NULL, targetname, this.target);
index 5a63872dbd6c46b6742b3534be7b4531c0d38ef2..55ccf41fbf2db9da6b46b1e3008a027795d16878 100644 (file)
@@ -272,7 +272,7 @@ void Net_TargetMusic()
 
 void Ent_TriggerMusic_Think(entity this)
 {
-       if(this.active == ACTIVE_NOT)
+       if(this.active == ACTIVE_NOT || intermission)
        {
                return;
        }
index 9156439f99e3bf19bb9bdc8425efe1fdcd06d53d..db255ebb7aff0d80f596dfeb91cdf35a43cf988d 100644 (file)
@@ -5,7 +5,7 @@ void counter_reset(entity this);
 void counter_use(entity this, entity actor, entity trigger)
 {
        entity store = this;
-       if(this.spawnflags & COUNTER_PER_PLAYER)
+       if(this.spawnflags & COUNTER_PER_PLAYER) // FIXME: multiple counters in the map will not function correctly, and upon trigger reset the player won't be able to use it again!
        {
                if(!IS_PLAYER(actor))
                        return;
index 94abd4041d3d1ff9a1a6f24f5a7db8284819244e..b110d9913fd97baa5b1d628b69c78fd173d32578 100644 (file)
@@ -18,7 +18,7 @@ void trigger_heal_touch(entity this, entity toucher)
                                toucher.triggerhealtime = time + this.delay;
 
                        bool playthesound = (this.spawnflags & HEAL_SOUND_ALWAYS);
-                       bool healed = Heal(toucher, this, GetResource(this, RES_HEALTH), this.max_health);
+                       bool healed = Heal(toucher, this, this.health, this.max_health);
 
                        if(playthesound || healed)
                                _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
@@ -36,8 +36,8 @@ void trigger_heal_init(entity this)
        this.active = ACTIVE_ACTIVE;
        if(!this.delay)
                this.delay = 1;
-       if(!GetResource(this, RES_HEALTH))
-               SetResourceExplicit(this, RES_HEALTH, 10); // TODO: use a special field for this, it doesn't have actual health!
+       if(!this.health)
+               this.health = 10;
        if(!this.max_health)
                this.max_health = 200; // max health topoff for field
        if(this.noise == "")
index 16118cb9d6e54906ea35f5634d095ad879f2a96f..7321fe23f996a4e50b885194fb3c98fd26e2d8a3 100644 (file)
@@ -1,7 +1,7 @@
 #include "magicear.qh"
 #ifdef SVQC
-float magicear_matched;
-float W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
+#include <common/weapons/weapon/tuba.qh>
+bool magicear_matched;
 string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
 {
        float domatch, dotrigger, matchstart, l;
index 0717f4beadd4eeb4aa0ae1c2a7cfcc94af38a0f9..f7d9df2900c4c8c40403ede1f45bc71ea3fcf326 100644 (file)
 
 /*
 *              t_swamp.c
-*              Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+
+*              Adds spawnfunc_trigger_swamp and support routines for nexuiz 1.2.1+ and xonotic
 *              Author tZork (Jakob MG)
 *              jakob@games43.se
 *              2005 11 29
 */
 
-.float swamp_interval; //Hurt players in swamp with this interval
-.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
-.float swamp_lifetime;  // holds the points remaining until slug dies (not quite health!) 
-.entity swampslug;
-
-#ifdef SVQC
-spawnfunc(trigger_swamp);
-#endif
-void swamp_touch(entity this, entity toucher);
-void swampslug_think(entity this);
-
 
 /*
 * Uses a entity calld swampslug to handle players in the swamp
@@ -46,7 +35,11 @@ void swampslug_think(entity this)
        //Slug dead? then remove curses.
        if(GetResource(this, RES_HEALTH) <= 0)
        {
-               this.owner.in_swamp = 0;
+               if(this.owner.swampslug == this)
+               {
+                       this.owner.in_swamp = false;
+                       this.owner.swampslug = NULL;
+               }
                delete(this);
                //centerprint(this.owner,"Killing slug...\n");
                return;
@@ -72,11 +65,12 @@ void swamp_touch(entity this, entity toucher)
        EXACTTRIGGER_TOUCH(this, toucher);
 
        // Chech if player alredy got a swampslug.
-       if(toucher.in_swamp != 1)
+       if(!toucher.in_swamp)
        {
                // If not attach one.
                //centerprint(toucher,"Entering swamp!\n");
-               toucher.swampslug = spawn();
+               if(!toucher.swampslug) // just incase
+                       toucher.swampslug = spawn();
                toucher.swampslug.swamp_lifetime = 2;
                setthink(toucher.swampslug, swampslug_think);
                toucher.swampslug.nextthink = time;
@@ -84,11 +78,11 @@ void swamp_touch(entity this, entity toucher)
                toucher.swampslug.dmg = this.dmg;
                toucher.swampslug.swamp_interval = this.swamp_interval;
                toucher.swamp_slowdown = this.swamp_slowdown;
-               toucher.in_swamp = 1;
+               toucher.in_swamp = true;
                return;
        }
 
-       //toucher.in_swamp = 1;
+       //toucher.in_swamp = true;
 
        //Revitalize players swampslug
        toucher.swampslug.swamp_lifetime = 2;
@@ -116,8 +110,8 @@ void swamp_link(entity this)
 }
 
 /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
-Players gettin into the swamp will
-get slowd down and damaged
+Players in the swamp will be
+slowed down and damaged over time
 */
 spawnfunc(trigger_swamp)
 {
index f4df98378d544659b1c22f0c663919fb95f90c17..bfe860ed03af9561d2c4e37720adb873a4f83438 100644 (file)
@@ -2,7 +2,16 @@
 
 .float swamp_interval; //Hurt players in swamp with this interval
 .float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
-.entity swampslug;
 
-.float in_swamp;              // bool
+.bool in_swamp;
 .entity swampslug;            // Uses this to release from swamp ("untouch" fix)
+
+.float swamp_interval; //Hurt players in swamp with this interval
+.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
+.float swamp_lifetime;  // holds the points remaining until slug dies (not quite health!)
+
+#ifdef SVQC
+spawnfunc(trigger_swamp);
+#endif
+void swamp_touch(entity this, entity toucher);
+void swampslug_think(entity this);
index 38aa4e33ada8d62930db4634610e5f2cb8610221..c6a1c2199b62b1c5a6ec305cbf81a28bbe3803e0 100644 (file)
@@ -17,7 +17,7 @@ CLASS(Model, Object)
             LOG_WARNF("Missing model: \"%s\"", s);
             return;
         }
-        profile(sprintf("precache_model(\"%s\")", s));
+        //profile(sprintf("precache_model(\"%s\")", s));
         precache_model(s);
         strcpy(this.model_str_, s);
     }
index 97a68b5f8f92877e95d115b0bf6c50d03b804088..c707f8c38e5ede6509fd6620456bbbd7288468e7 100644 (file)
@@ -1095,15 +1095,12 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
        if(trace_ent && IS_MONSTER(trace_ent))
                reverse = true;
 
-       // TODO: fix this... tracing is broken if the floor is thin
-       /*
-       if(!allow_jumpoff)
+       if(!allow_jumpoff && IS_ONGROUND(this))
        {
-               a = b - '0 0 32';
-               traceline(b, a, MOVE_WORLDONLY, this);
+               traceline(b, b - '0 0 32', MOVE_NORMAL, this);
                if(trace_fraction == 1.0)
                        reverse = true;
-       } */
+       }
 
        if(reverse)
        {
index d3f4ee740ab1543d2bf8fae2090e111842f251de..13c98e93fa1f64e75271e79cba146614c1b6dd94 100644 (file)
@@ -16,6 +16,7 @@ void spawner_use(entity this, entity actor, entity trigger)
        e.noalign = this.noalign;
        e.angles = this.angles;
        e.monster_skill = this.monster_skill;
+       e.skin = this.skin;
        e = spawnmonster(e, this.spawnmob, 0, this, this, this.origin, false, true, this.monster_moveflags);
 }
 
index af85fa1a332082b48d3d2d5c33345141ee274588..45cd41f15e1041e28acdfe95d0265749db116b7f 100644 (file)
@@ -130,7 +130,7 @@ CLASS(Sound, Object)
                TC(Sound, this);
                string s = _Sound_fixpath(this.sound_str());
                if (!s) return;
-               profile(sprintf("precache_sound(\"%s\")", s));
+               //profile(sprintf("precache_sound(\"%s\")", s));
                precache_sound(s);
                strcpy(this.sound_str_, s);
        }
index f5ba71477982d4ec6b727d1312aaf36633269a1c..25c61b4b67b19c1192a7752b23a77f8cd7945581 100644 (file)
@@ -2,43 +2,6 @@
 
 #ifdef SVQC
 
-/**
-    turret_checkpoint
-**/
-
-
-//.entity checkpoint_target;
-
-/*
-#define checkpoint_cache_who  flagcarried
-#define checkpoint_cache_from lastrocket
-#define checkpoint_cache_to   selected_player
-*/
-
-/*
-entity path_makeorcache(entity forwho,entity start, entity end)
-{
-    entity pth;
-
-    //pth = pathlib_makepath(forwho, start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR);
-
-    return pth;
-}
-*/
-
-void turret_checkpoint_use()
-{
-}
-
-#if 0
-void turret_checkpoint_think(entity this)
-{
-    if(this.enemy)
-        te_lightning1(this,this.origin, this.enemy.origin);
-
-    this.nextthink = time + 0.25;
-}
-#endif
 /*QUAKED turret_checkpoint (1 0 1) (-32 -32 -32) (32 32 32)
 -----------KEYS------------
 target: .targetname of next waypoint in chain.
@@ -46,30 +9,25 @@ wait:   Pause at this point # seconds.
 -----------SPAWNFLAGS-----------
 ---------NOTES----------
 If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly.
-If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached.
+If the checkpoint chain is not looped, the unit will go "Roaming" when the last point is reached.
 */
-//float tc_acum;
 void turret_checkpoint_init(entity this)
 {
     traceline(this.origin + '0 0 16', this.origin - '0 0 1024', MOVE_WORLDONLY, this);
     setorigin(this, trace_endpos + '0 0 32');
 
-    if(this.target != "")
+    if(this.target && this.target != "")
     {
         this.enemy = find(NULL, targetname, this.target);
-        if(this.enemy == NULL)
-            LOG_TRACE("A turret_checkpoint faild to find its target!");
+        if(!this.enemy)
+            LOG_TRACE("A turret_checkpoint failed to find its target!");
     }
-    //setthink(this, turret_checkpoint_think);
-    //this.nextthink = time + tc_acum + 0.25;
-    //tc_acum += 0.25;
 }
 
 spawnfunc(turret_checkpoint)
 {
     setorigin(this, this.origin);
-    setthink(this, turret_checkpoint_init);
-    this.nextthink = time + 0.2;
+    InitializeEntity(this, turret_checkpoint_init, INITPRIO_FINDTARGET);
 }
 
 // Compat.
index f0cb6d2493a471c6724dc31e3ad701f34206d4b6..335326514d76fdfb85dbe49a43734737a11696dd 100644 (file)
@@ -51,3 +51,7 @@ classfield(Tuba) .float tuba_volume;
 classfield(Tuba) .float tuba_volume_initial;
 classfield(Tuba) .int tuba_instrument;
 #endif
+
+#ifdef SVQC
+bool W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo);
+#endif
index e2a25cbc76ef3ec1b8e2f674b1793f0d2eccc744..244665cc5f3c4cf47cf3062e7dd27660701f9244 100644 (file)
@@ -146,12 +146,14 @@ noref bool require_spawnfunc_prefix;
                FIELD_SCALAR(fld, health) \
                FIELD_SCALAR(fld, height) \
                FIELD_SCALAR(fld, impulse) \
+               FIELD_SCALAR(fld, item_pickupsound) \
                FIELD_SCALAR(fld, killtarget) \
                FIELD_SCALAR(fld, lerpfrac) \
                FIELD_SCALAR(fld, light_lev) \
                FIELD_SCALAR(fld, lip) \
                FIELD_SCALAR(fld, loddistance1) \
                FIELD_SCALAR(fld, lodmodel1) \
+               FIELD_SCALAR(fld, lodmodel2) \
                FIELD_SCALAR(fld, ltime) \
                FIELD_SCALAR(fld, map) \
                FIELD_SCALAR(fld, max_health) \
index 4d33e9b52a6464ee802e5d80135b03f955a55cde..4b71e28e8b4e74153e93bbf5c07f8a2497b9c692 100644 (file)
@@ -180,6 +180,7 @@ float autocvar_g_items_maxdist;
 int autocvar_g_pickup_items;
 float autocvar_g_player_alpha;
 float autocvar_g_player_brightness;
+float autocvar_g_player_damageforcescale = 2;
 bool autocvar_g_playerclip_collisions;
 int autocvar_g_powerups;
 int autocvar_g_projectiles_damage;
index 57b4c310e37ed33760c7500f81c5fa1d8089d7f3..2b2dfbf3cf5e86a4d9d3b19af56fd676be07c06b 100644 (file)
@@ -1,5 +1,7 @@
 #include "havocbot.qh"
 
+#include "roles.qh"
+
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
 #include "../cvars.qh"
@@ -24,8 +26,6 @@
 
 #include <lib/warpzone/common.qh>
 
-.float speed;
-
 void havocbot_ai(entity this)
 {
        if(this.draggedby)
@@ -193,82 +193,76 @@ void havocbot_ai(entity this)
 
 void havocbot_keyboard_movement(entity this, vector destorg)
 {
-       vector keyboard;
+       if(time <= this.havocbot_keyboardtime)
+               return;
 
-       if (time > this.havocbot_keyboardtime)
+       float sk = skill + this.bot_moveskill;
+       this.havocbot_keyboardtime =
+               max(
+                       this.havocbot_keyboardtime
+                               + 0.05 / max(1, sk + this.havocbot_keyboardskill)
+                               + random() * 0.025 / max(0.00025, skill + this.havocbot_keyboardskill)
+               , time);
+       vector keyboard = CS(this).movement / autocvar_sv_maxspeed;
+
+       float trigger = autocvar_bot_ai_keyboard_threshold;
+
+       // categorize forward movement
+       // at skill < 1.5 only forward
+       // at skill < 2.5 only individual directions
+       // at skill < 4.5 only individual directions, and forward diagonals
+       // at skill >= 4.5, all cases allowed
+       if (keyboard.x > trigger)
        {
-               float sk = skill + this.bot_moveskill;
-               this.havocbot_keyboardtime =
-                       max(
-                               this.havocbot_keyboardtime
-                                       + 0.05 / max(1, sk + this.havocbot_keyboardskill)
-                                       + random() * 0.025 / max(0.00025, skill + this.havocbot_keyboardskill)
-                       , time);
-               keyboard = CS(this).movement / autocvar_sv_maxspeed;
-
-               float trigger = autocvar_bot_ai_keyboard_threshold;
-
-               // categorize forward movement
-               // at skill < 1.5 only forward
-               // at skill < 2.5 only individual directions
-               // at skill < 4.5 only individual directions, and forward diagonals
-               // at skill >= 4.5, all cases allowed
-               if (keyboard.x > trigger)
-               {
-                       keyboard.x = 1;
-                       if (sk < 2.5)
-                               keyboard.y = 0;
-               }
-               else if (keyboard.x < -trigger && sk > 1.5)
-               {
-                       keyboard.x = -1;
-                       if (sk < 4.5)
-                               keyboard.y = 0;
-               }
-               else
-               {
-                       keyboard.x = 0;
-                       if (sk < 1.5)
-                               keyboard.y = 0;
-               }
+               keyboard.x = 1;
+               if (sk < 2.5)
+                       keyboard.y = 0;
+       }
+       else if (keyboard.x < -trigger && sk > 1.5)
+       {
+               keyboard.x = -1;
                if (sk < 4.5)
-                       keyboard.z = 0;
-
-               if (keyboard.y > trigger)
-                       keyboard.y = 1;
-               else if (keyboard.y < -trigger)
-                       keyboard.y = -1;
-               else
                        keyboard.y = 0;
+       }
+       else
+       {
+               keyboard.x = 0;
+               if (sk < 1.5)
+                       keyboard.y = 0;
+       }
+       if (sk < 4.5)
+               keyboard.z = 0;
 
-               if (keyboard.z > trigger)
-                       keyboard.z = 1;
-               else if (keyboard.z < -trigger)
-                       keyboard.z = -1;
-               else
-                       keyboard.z = 0;
+       if (keyboard.y > trigger)
+               keyboard.y = 1;
+       else if (keyboard.y < -trigger)
+               keyboard.y = -1;
+       else
+               keyboard.y = 0;
 
-               // make sure bots don't get stuck if havocbot_keyboardtime is very high
-               if (keyboard == '0 0 0')
-                       this.havocbot_keyboardtime = min(this.havocbot_keyboardtime, time + 0.2);
+       if (keyboard.z > trigger)
+               keyboard.z = 1;
+       else if (keyboard.z < -trigger)
+               keyboard.z = -1;
+       else
+               keyboard.z = 0;
 
-               this.havocbot_keyboard = keyboard * autocvar_sv_maxspeed;
-               if (this.havocbot_ducktime > time)
-                       PHYS_INPUT_BUTTON_CROUCH(this) = true;
+       // make sure bots don't get stuck if havocbot_keyboardtime is very high
+       if (keyboard == '0 0 0')
+               this.havocbot_keyboardtime = min(this.havocbot_keyboardtime, time + 0.2);
 
-               keyboard = this.havocbot_keyboard;
-               float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
-               //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
-               CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
-       }
+       this.havocbot_keyboard = keyboard * autocvar_sv_maxspeed;
+       if (this.havocbot_ducktime > time)
+               PHYS_INPUT_BUTTON_CROUCH(this) = true;
+
+       keyboard = this.havocbot_keyboard;
+       float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
+       //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+       CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
 }
 
 void havocbot_bunnyhop(entity this, vector dir)
 {
-       float bunnyhopdistance;
-       vector deviation;
-       float maxspeed;
-
        // Don't jump when attacking
        if(this.aistatus & AI_STATUS_ATTACKING)
                return;
@@ -276,10 +270,8 @@ void havocbot_bunnyhop(entity this, vector dir)
        if(IS_PLAYER(this.goalcurrent))
                return;
 
-       maxspeed = autocvar_sv_maxspeed;
-
-       if(this.aistatus & AI_STATUS_RUNNING && vdist(this.velocity, <, autocvar_sv_maxspeed * 0.75)
-               || this.aistatus & AI_STATUS_DANGER_AHEAD)
+       if((this.aistatus & AI_STATUS_RUNNING) && vdist(this.velocity, <, autocvar_sv_maxspeed * 0.75)
+               || (this.aistatus & AI_STATUS_DANGER_AHEAD))
        {
                this.aistatus &= ~AI_STATUS_RUNNING;
                PHYS_INPUT_BUTTON_JUMP(this) = false;
@@ -301,110 +293,80 @@ void havocbot_bunnyhop(entity this, vector dir)
        }
 
        vector gco = get_closer_dest(this.goalcurrent, this.origin);
-       bunnyhopdistance = vlen(this.origin - gco);
 
        // Run only to visible goals
        if(IS_ONGROUND(this))
-       if(vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed)) // if -really- running
+       if(vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed))
        if(checkpvs(this.origin + this.view_ofs, this.goalcurrent))
        {
-                       this.bot_lastseengoal = this.goalcurrent;
+               this.bot_lastseengoal = this.goalcurrent;
 
-                       // seen it before
-                       if(this.bot_timelastseengoal)
+               // seen it before
+               if(this.bot_timelastseengoal)
+               {
+                       // for a period of time
+                       if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
                        {
-                               // for a period of time
-                               if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
-                               {
-                                       float checkdistance;
-                                       checkdistance = true;
+                               bool checkdistance = true;
 
-                                       // don't run if it is too close
-                                       if(this.bot_canruntogoal==0)
-                                       {
-                                               if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_startdistance)
-                                                       this.bot_canruntogoal = 1;
-                                               else
-                                                       this.bot_canruntogoal = -1;
-                                       }
+                               // don't run if it is too close
+                               if(this.bot_canruntogoal==0)
+                               {
+                                       if(vdist(this.origin - gco, >, autocvar_bot_ai_bunnyhop_startdistance))
+                                               this.bot_canruntogoal = 1;
+                                       else
+                                               this.bot_canruntogoal = -1;
+                               }
 
-                                       if(this.bot_canruntogoal != 1)
-                                               return;
+                               if(this.bot_canruntogoal != 1)
+                                       return;
 
-                                       if(this.aistatus & AI_STATUS_ROAMING)
-                                       if(this.goalcurrent.classname=="waypoint")
-                                       if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
-                                       if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
-                                       if(this.goalstack01 && !wasfreed(this.goalstack01))
+                               if(this.aistatus & AI_STATUS_ROAMING)
+                               if(this.goalcurrent.classname == "waypoint")
+                               if(!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
+                               if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
+                               if(this.goalstack01 && !wasfreed(this.goalstack01))
+                               {
+                                       vector gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
+                                       vector deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
+                                       while (deviation.y < -180) deviation.y = deviation.y + 360;
+                                       while (deviation.y > 180) deviation.y = deviation.y - 360;
+
+                                       if(fabs(deviation.y) < 20)
+                                       if(vlen2(this.origin - gco) < vlen2(this.origin - gno))
+                                       if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
                                        {
-                                               vector gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
-                                               deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
-                                               while (deviation.y < -180) deviation.y = deviation.y + 360;
-                                               while (deviation.y > 180) deviation.y = deviation.y - 360;
-
-                                               if(fabs(deviation.y) < 20)
-                                               if(bunnyhopdistance < vlen(this.origin - gno))
-                                               if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
+                                               if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
+                                               if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
                                                {
-                                                       if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
-                                                       if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
-                                                       {
-                                                               checkdistance = false;
-                                                       }
+                                                       checkdistance = false;
                                                }
                                        }
+                               }
 
-                                       if(checkdistance)
-                                       {
-                                               this.aistatus &= ~AI_STATUS_RUNNING;
-                                               // increase stop distance in case the goal is on a slope or a lower platform
-                                               if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z))
-                                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
-                                       }
-                                       else
-                                       {
-                                               this.aistatus |= AI_STATUS_RUNNING;
+                               if(checkdistance)
+                               {
+                                       this.aistatus &= ~AI_STATUS_RUNNING;
+                                       // increase stop distance in case the goal is on a slope or a lower platform
+                                       if(vdist(this.origin - gco, >, autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z)))
                                                PHYS_INPUT_BUTTON_JUMP(this) = true;
-                                       }
+                               }
+                               else
+                               {
+                                       this.aistatus |= AI_STATUS_RUNNING;
+                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
                                }
                        }
-                       else
-                       {
-                               this.bot_timelastseengoal = time;
-                       }
+               }
+               else
+               {
+                       this.bot_timelastseengoal = time;
+               }
        }
        else
        {
                this.bot_timelastseengoal = 0;
        }
-
-#if 0
-       // Release jump button
-       if(!cvar("sv_pogostick"))
-       if((IS_ONGROUND(this)) == 0)
-       {
-               if(this.velocity.z < 0 || vlen(this.velocity)<maxspeed)
-                       PHYS_INPUT_BUTTON_JUMP(this) = false;
-
-               // Strafe
-               if(this.aistatus & AI_STATUS_RUNNING)
-               if(vlen(this.velocity)>maxspeed)
-               {
-                       deviation = vectoangles(dir) - vectoangles(this.velocity);
-                       while (deviation.y < -180) deviation.y = deviation.y + 360;
-                       while (deviation.y > 180) deviation.y = deviation.y - 360;
-
-                       if(fabs(deviation.y)>10)
-                               CS(this).movement_x = 0;
-
-                       if(deviation.y>10)
-                               CS(this).movement_y = maxspeed * -1;
-                       else if(deviation.y<10)
-                               CS(this).movement_y = maxspeed;
-
-               }
-       }
-#endif
 }
 
 // return true when bot isn't getting closer to the current goal
index 2ec6316917f73f32c74ccedaf8ce28d4b4774044..d1a36a117260027569b229cb291cc78e2cd0a70a 100644 (file)
@@ -51,9 +51,6 @@ float havocbot_moveto_refresh_route(entity this);
 
 vector havocbot_dodge(entity this);
 
-.void(entity this) havocbot_role;
-.void(entity this) havocbot_previous_role;
-
 void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
 void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
 
index b72153c95cb0bc371c5e9808b544b785861be7de..84c597329ea5fda0eb0930dfec079be15e7edb22 100644 (file)
 #include "../bot.qh"
 #include "../navigation.qh"
 
-.float bot_ratingscale;
-.float bot_ratingscale_time;
-.float max_armorvalue;
-.float havocbot_role_timeout;
-
-.void(entity this) havocbot_previous_role;
-.void(entity this) havocbot_role;
-
 void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
 {
        // rate waypoints only if there's no alternative goal
@@ -68,10 +60,10 @@ bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, en
        if(!teamplay)
                return true;
 
-       // actually these variables hold the squared distances in order to optimize code
-       float friend_distance = FLOAT_MAX;
-       float enemy_distance = FLOAT_MAX;
-       float dist;
+       // these variables hold squared distances in order to optimize code
+       float friend_dist2 = FLOAT_MAX;
+       float enemy_dist2 = FLOAT_MAX;
+       float dist2;
 
        FOREACH_CLIENT(IS_PLAYER(it) && it != this && !(IS_DEAD(it) || STAT(FROZEN, it)),
        {
@@ -80,13 +72,13 @@ bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, en
                        if (!IS_REAL_CLIENT(it))
                                continue;
 
-                       dist = vlen2(it.origin - item_org);
-                       if(dist > friend_distance)
+                       dist2 = vlen2(it.origin - item_org);
+                       if (dist2 > friend_dist2)
                                continue;
 
                        if(havocbot_goalrating_item_can_be_left_to_teammate(this, it, item))
                        {
-                               friend_distance = dist;
+                               friend_dist2 = dist2;
                                continue;
                        }
                }
@@ -94,25 +86,23 @@ bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, en
                {
                        // If enemy only track distances
                        // TODO: track only if visible ?
-                       dist = vlen2(it.origin - item_org);
-                       if(dist < enemy_distance)
-                               enemy_distance = dist;
+                       dist2 = vlen2(it.origin - item_org);
+                       if (dist2 < enemy_dist2)
+                               enemy_dist2 = dist2;
                }
        });
 
        // Rate the item only if no one needs it, or if an enemy is closer to it
-       dist = vlen2(item_org - org);
-       if ((enemy_distance < friend_distance && dist < enemy_distance) ||
-               (friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ** 2) ||
-               (dist < friend_distance && dist < 200 ** 2))
+       dist2 = vlen2(item_org - org);
+       if ((enemy_dist2 < friend_dist2 && dist2 < enemy_dist2)
+               || (friend_dist2 > autocvar_bot_ai_friends_aware_pickup_radius ** 2)
+               || (dist2 < friend_dist2 && dist2 < 200 ** 2))
                return true;
        return false;
 };
 
 void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
 {
-       float rating;
-       vector o;
        ratingscale = ratingscale * 0.0001;
 
        IL_EACH(g_items, it.bot_pickup,
@@ -144,7 +134,7 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
                        it.bot_pickup_respawning = true;
                }
-               o = (it.absmin + it.absmax) * 0.5;
+               vector o = (it.absmin + it.absmax) * 0.5;
                if(vdist(o - org, >, sradius) || (it == this.ignoregoal && time < this.ignoregoaltime) )
                        continue;
 
@@ -175,25 +165,23 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float
 
                it.bot_ratingscale_time = time;
                it.bot_ratingscale = ratingscale;
-               rating = it.bot_pickupevalfunc(this, it);
+               float rating = it.bot_pickupevalfunc(this, it);
                if(rating > 0)
                        navigation_routerating(this, it, rating * ratingscale, 2000);
        });
 }
 
-#define BOT_RATING_ENEMY 2500
 void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
 {
        if (autocvar_bot_nofire)
                return;
 
        // don't chase players if we're under water
-       if(this.waterlevel>WATERLEVEL_WETFEET)
+       if(this.waterlevel > WATERLEVEL_WETFEET)
                return;
 
        ratingscale = ratingscale * 0.0001;
 
-       float t;
        FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), {
                // TODO: Merge this logic with the bot_shouldattack function
                if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius))
@@ -208,7 +196,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                        continue;
                */
 
-               t = ((GetResource(this, RES_HEALTH) + GetResource(this, RES_ARMOR)) - (GetResource(it, RES_HEALTH) + GetResource(it, RES_ARMOR))) / 150;
+               float t = ((GetResource(this, RES_HEALTH) + GetResource(this, RES_ARMOR)) - (GetResource(it, RES_HEALTH) + GetResource(it, RES_ARMOR))) / 150;
                t = bound(0, 1 + t, 3);
                if (skill > 3)
                {
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..23a23759a98a9588fb7e693cbef4f8b45588b7fd 100644 (file)
@@ -1 +1,10 @@
 #pragma once
+
+const float BOT_RATING_ENEMY = 2500;
+
+.float bot_ratingscale;
+.float bot_ratingscale_time;
+.float havocbot_role_timeout;
+
+.void(entity this) havocbot_previous_role;
+.void(entity this) havocbot_role;
index 3afa06d1279c0df404c6174cb3b415d391ea96cb..209958389b1fa0f5057f75c54dbec7e395991fc1 100644 (file)
@@ -40,6 +40,7 @@
 #include "../common/mapobjects/teleporters.qh"
 #include "../common/mapobjects/target/spawnpoint.qh"
 #include <common/mapobjects/trigger/counter.qh>
+#include <common/mapobjects/trigger/swamp.qh>
 
 #include "../common/vehicles/all.qh"
 
@@ -604,7 +605,7 @@ void PutPlayerInServer(entity this)
                this.pauseregen_finished += f;
        }
 
-       this.damageforcescale = 2;
+       this.damageforcescale = autocvar_g_player_damageforcescale;
        this.death_time = 0;
        this.respawn_flags = 0;
        this.respawn_time = 0;
@@ -678,6 +679,9 @@ void PutPlayerInServer(entity this)
        if(this.conveyor)
                IL_REMOVE(g_conveyed, this);
        this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+       if(this.swampslug)
+               delete(this.swampslug);
+       this.in_swamp = false;
        STAT(HUD, this) = HUD_NORMAL;
 
        this.event_damage = PlayerDamage;
index 28a61cf1cd4120e270bd8fa491049d9f9e2e8f21..b52649a34ead3389310bb9ef544b4c3e4e1bc3d2 100644 (file)
@@ -298,11 +298,6 @@ string matchid;
 
 bool radar_showennemies;
 
-#ifdef PROFILING
-float client_cefc_accumulator;
-float client_cefc_accumulatortime;
-#endif
-
 .float weapon_load[Weapons_MAX];
 .int ammo_none; // used by the reloading system, must always be 0
 .int clip_load;
index 453cfc1e70d3664d1725e795c685c36c1e00cb69..b2b91bc02baf71cea1adf089e8236eea2a397667 100644 (file)
@@ -21,8 +21,6 @@
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
-.int state;
-
 /*============================================
 
       Wazat's Xonotic Grappling Hook
@@ -72,8 +70,6 @@ And you should be done!
 
 ============================================*/
 
-.float hook_length;
-
 void RemoveGrapplingHooks(entity pl)
 {
        if(pl.move_movetype == MOVETYPE_FLY)
index c0df31662a7d5cea6c95584dd7a13bfd7d969dad..1ed78e2745d9d4a4cdfff18792f9399af50fb7e6 100644 (file)
@@ -8,12 +8,16 @@ void RemoveHook(entity this);
 // (note: you can change the hook impulse #'s to whatever you please)
 .float hook_time;
 
+.float hook_length;
+
 const float HOOK_FIRING = BIT(0);
 const float HOOK_REMOVING = BIT(1);
 const float HOOK_PULLING = BIT(2);
 const float HOOK_RELEASING = BIT(3);
 const float HOOK_WAITING_FOR_RELEASE = BIT(4);
 .float hook_state;
+.int state;
 
 void GrappleHookInit();
 vector hook_shotorigin[4];
+
index 98c274282e1219c28820ba97524e3da514451dc0..8680b83a58b596665d6052d2003f3317310a8aab 100644 (file)
@@ -860,8 +860,14 @@ spawnfunc(worldspawn)
                                        continue;
                                if(argv(0) == "cd")
                                {
+                                       string trackname = argv(2);
                                        LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:");
-                                       LOG_INFO("  cdtrack ", argv(2));
+                                       LOG_INFO("  cdtrack ", trackname);
+                                       if (cvar_value_issafe(trackname))
+                                       {
+                                               string newstuff = strcat(clientstuff, "cd loop \"", trackname, "\"\n");
+                                               strcpy(clientstuff, newstuff);
+                                       }
                                }
                                else if(argv(0) == "fog")
                                {
@@ -984,22 +990,27 @@ float Map_Count, Map_Current;
 string Map_Current_Name;
 
 // NOTE: this now expects the map list to be already tokenized and the count in Map_Count
-float GetMaplistPosition()
+int GetMaplistPosition()
 {
-       float pos, idx;
-       string map;
-
-       map = GetMapname();
-       idx = autocvar_g_maplist_index;
+       string map = GetMapname();
+       int idx = autocvar_g_maplist_index;
 
        if(idx >= 0)
+       {
                if(idx < Map_Count)
+               {
                        if(map == argv(idx))
+                       {
                                return idx;
+                       }
+               }
+       }
 
-       for(pos = 0; pos < Map_Count; ++pos)
+       for(int pos = 0; pos < Map_Count; ++pos)
+       {
                if(map == argv(pos))
                        return pos;
+       }
 
        // resume normal maplist rotation if current map is not in g_maplist
        return idx;
@@ -1234,10 +1245,8 @@ void Maplist_Init()
 
 string GetNextMap()
 {
-       float nextMap;
-
        Maplist_Init();
-       nextMap = -1;
+       float nextMap = -1;
 
        if(nextMap == -1)
                if(autocvar_g_maplist_shuffle > 0)
@@ -1332,9 +1341,7 @@ void GotoNextMap(float reinit)
                return;
        alreadychangedlevel = true;
 
-       string nextMap;
-
-       nextMap = GetNextMap();
+       string nextMap = GetNextMap();
        if(nextMap == "")
                error("Everything is broken - cannot find a next map. Please report this to the developers.");
        Map_Goto(reinit);
index bc0b49ca027ece50fb41bbccc35723b3252886d7..167a75ae2c371ad5e833099cc962ada6889affac 100644 (file)
@@ -499,7 +499,7 @@ float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still ne
        allow_mutatorblocked = M_ARGV(3, bool);
 
        if(allguns)
-               d = boolean(weaponinfo.spawnflags & WEP_FLAG_NORMAL);
+               d = boolean((weaponinfo.spawnflags & WEP_FLAG_NORMAL) && !(weaponinfo.spawnflags & WEP_FLAG_HIDDEN));
        else if(!mutator_returnvalue)
                d = !(!weaponinfo.weaponstart);
 
index 9be3c18f6017183f8d81319e0cdb75e4a2d16e51..a281e9054be8a17ebebcb44efa0454a1a2e7a947 100644 (file)
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
-.float lastground;
-.int state;
-
 void CreatureFrame_hotliquids(entity this)
 {
-       if (this.dmgtime < time)
+       if (this.dmgtime > time)
        {
-               this.dmgtime = time + autocvar_g_balance_contents_damagerate;
+               return;
+       }
 
-               if (this.flags & FL_PROJECTILE)
-               {
-                       if (this.watertype == CONTENT_LAVA)
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
-                       else if (this.watertype == CONTENT_SLIME)
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
-               }
-               else
+       this.dmgtime = time + autocvar_g_balance_contents_damagerate;
+
+       if (this.flags & FL_PROJECTILE)
+       {
+               if (this.watertype == CONTENT_LAVA)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
+               else if (this.watertype == CONTENT_SLIME)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
+       }
+       else
+       {
+               if (this.watertype == CONTENT_LAVA)
                {
-                       if (this.watertype == CONTENT_LAVA)
+                       if (this.watersound_finished < time)
                        {
-                               if (this.watersound_finished < time)
-                               {
-                                       this.watersound_finished = time + 0.5;
-                                       sound (this, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM);
-                               }
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
-                               if(autocvar_g_balance_contents_playerdamage_lava_burn)
-                                       Fire_AddDamage(this, NULL, autocvar_g_balance_contents_playerdamage_lava_burn * this.waterlevel, autocvar_g_balance_contents_playerdamage_lava_burn_time * this.waterlevel, DEATH_LAVA.m_id);
+                               this.watersound_finished = time + 0.5;
+                               sound (this, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM);
                        }
-                       else if (this.watertype == CONTENT_SLIME)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
+                       if(autocvar_g_balance_contents_playerdamage_lava_burn)
+                               Fire_AddDamage(this, NULL, autocvar_g_balance_contents_playerdamage_lava_burn * this.waterlevel, autocvar_g_balance_contents_playerdamage_lava_burn_time * this.waterlevel, DEATH_LAVA.m_id);
+               }
+               else if (this.watertype == CONTENT_SLIME)
+               {
+                       if (this.watersound_finished < time)
                        {
-                               if (this.watersound_finished < time)
-                               {
-                                       this.watersound_finished = time + 0.5;
-                                       sound (this, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM);
-                               }
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
+                               this.watersound_finished = time + 0.5;
+                               sound (this, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM);
                        }
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
                }
        }
 }
@@ -96,35 +95,36 @@ void CreatureFrame_Liquids(entity this)
 
 void CreatureFrame_FallDamage(entity this)
 {
-       if(!IS_VEHICLE(this) && !(this.flags & FL_PROJECTILE)) // vehicles don't get falling damage
-       if(this.velocity || this.oldvelocity) // moving or has moved
+       if(IS_VEHICLE(this) || (this.flags & FL_PROJECTILE))
+               return; // vehicles and projectiles don't receive fall damage
+       if(!(this.velocity || this.oldvelocity))
+               return; // if the entity hasn't moved and isn't moving, then don't do anything
+
+       // check for falling damage
+       float velocity_len = vlen(this.velocity);
+       bool have_hook = false;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
-               // check for falling damage
-               float velocity_len = vlen(this.velocity);
-               bool have_hook = false;
-               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+           .entity weaponentity = weaponentities[slot];
+           if(this.(weaponentity).hook && this.(weaponentity).hook.state)
            {
-               .entity weaponentity = weaponentities[slot];
-               if(this.(weaponentity).hook && this.(weaponentity).hook.state)
-               {
-                       have_hook = true;
-                       break;
-               }
+               have_hook = true;
+               break;
            }
-               if(!have_hook)
-               {
-                       float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
-                       if (IS_DEAD(this))
-                               dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
-                       else
-                               dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
-                       if (dm > 0)
-                               Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
-               }
-
-               if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
-                       Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0');
        }
+       if(!have_hook)
+       {
+               float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
+               if (IS_DEAD(this))
+                       dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
+               else
+                       dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
+               if (dm > 0)
+                       Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+       }
+
+       if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
+               Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0');
 }
 
 void CreatureFrame_All()
index 93480cf282ec6c5377ac13197eea0dbe009ddfd2..46284fde2e51f134609dc067532d25428d8de487 100644 (file)
@@ -2,6 +2,11 @@
 
 bool expr_evaluate(string s);
 
+#ifdef PROFILING
+float client_cefc_accumulator;
+float client_cefc_accumulatortime;
+#endif
+
 /*
 ==================
 main
index 9613e7e773811aa9163de3f1e1365729dba3f30f..d261e262eab2a9351d4542b7969afa1fbd72f680 100644 (file)
@@ -222,6 +222,7 @@ set g_grab_range 200 "distance at which dragable objects can be grabbed"
 set g_cloaked 0 "display all players mostly invisible"
 set g_player_alpha 1 "default opacity of players"
 set g_player_brightness 0      "set to 2 for brighter players"
+set g_player_damageforcescale 2 "push multiplier of attacks against players"
 set g_balance_cloaked_alpha 0.25 "opacity of cloaked players"
 
 set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps"