]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Lyberta/PlayerTemplates' into Lyberta/Survival
authorLyberta <lyberta@lyberta.net>
Thu, 1 Jun 2017 13:10:23 +0000 (16:10 +0300)
committerLyberta <lyberta@lyberta.net>
Thu, 1 Jun 2017 13:10:23 +0000 (16:10 +0300)
24 files changed:
.tx/merge-base
common.es.po
common.pt.po
defaultXonotic.cfg
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/shownames.qc
qcsrc/common/constants.qh
qcsrc/common/t_items.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/lib/net.qh
qcsrc/menu/xonotic/credits.qc
qcsrc/server/client.qc
qcsrc/server/pathlib/costs.qc
qcsrc/server/pathlib/expandnode.qc
qcsrc/server/pathlib/main.qc
qcsrc/server/pathlib/main.qh
qcsrc/server/pathlib/movenode.qc
qcsrc/server/pathlib/pathlib.qh
qcsrc/server/pathlib/utility.qc
qcsrc/server/player.qc

index 09536e9897c4e9f7880b489c2c70ca60ab2e9a76..894318d8c216f295820d1beeec8e791dacf8da17 100644 (file)
@@ -1 +1 @@
-Mon May 22 07:24:10 CEST 2017
+Wed May 31 07:24:24 CEST 2017
index e5a731a25a7df72494dc2316c8acd4e0be494249..24872eab45b0e7ebf53edb3bb127adde78b59b0a 100644 (file)
@@ -25,7 +25,7 @@ msgstr ""
 "Project-Id-Version: Xonotic\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-30 07:23+0200\n"
-"PO-Revision-Date: 2017-05-21 09:40+0000\n"
+"PO-Revision-Date: 2017-05-25 19:02+0000\n"
 "Last-Translator: Starfire24680 <starfire24680@gmail.com>\n"
 "Language-Team: Spanish (http://www.transifex.com/team-xonotic/xonotic/"
 "language/es/)\n"
@@ -3333,7 +3333,7 @@ msgstr "^BGSugiriendo a %s^BG que te pase la bandera"
 #: qcsrc/common/notifications/all.inc:567
 #, c-format
 msgid "^BGYou passed the ^TC^TT^BG flag to %s"
-msgstr "^BGHaz pasado la bandera ^TC^TT^BG a %s"
+msgstr "^BGHas pasado la bandera ^TC^TT^BG a %s"
 
 #: qcsrc/common/notifications/all.inc:568
 #, c-format
@@ -3342,7 +3342,7 @@ msgstr "^BGHas pasado la bandera a %s"
 
 #: qcsrc/common/notifications/all.inc:569
 msgid "^BGYou got the ^TC^TT^BG flag!"
-msgstr "^BGHaz obtenido la bandera ^TC^TT^BG!"
+msgstr "^BGHas obtenido la bandera ^TC^TT^BG!"
 
 #: qcsrc/common/notifications/all.inc:570
 msgid "^BGYou got the flag!"
index 30bf593019415aab302f969198a3ffd645dc9e30..82cee75fe6985fa56531f601fbef6dc728725f8b 100644 (file)
@@ -13,7 +13,7 @@ msgstr ""
 "Project-Id-Version: Xonotic\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-30 07:23+0200\n"
-"PO-Revision-Date: 2017-04-04 15:40+0000\n"
+"PO-Revision-Date: 2017-05-31 03:15+0000\n"
 "Last-Translator: Jean Trindade Pereira <jean_trindade2@hotmail.com>\n"
 "Language-Team: Portuguese (http://www.transifex.com/team-xonotic/xonotic/"
 "language/pt/)\n"
@@ -6732,7 +6732,7 @@ msgstr "Permitir que as estatísticas de jogadores usem o seu apelido"
 
 #: qcsrc/menu/xonotic/dialog_multiplayer_profile.qc:145
 msgid "Country"
-msgstr "País"
+msgstr "Idioma"
 
 #: qcsrc/menu/xonotic/dialog_multiplayer_profile.qc:159
 msgid "Gender:"
@@ -8875,7 +8875,7 @@ msgstr "Difícil"
 
 #: qcsrc/menu/xonotic/dialog_singleplayer.qc:135
 msgid "Start Singleplayer!"
-msgstr "Iniciar Um Jogador!"
+msgstr "Iniciar Campanha!"
 
 #: qcsrc/menu/xonotic/dialog_singleplayer.qh:6
 msgid "Singleplayer"
index 33ec16e4e31d1db0e15a1609dab3830ac49444fe..2b431e8fe3a9436e9c7166acc0b848db6a31b6ac 100644 (file)
@@ -321,7 +321,7 @@ seta sv_spectate 1 "if set to 1, new clients are allowed to spectate or observe
 seta sv_defaultcharacter 0 "master switch, if set to 1 the further configuration for replacing all player models, skins and colors is taken from the sv_defaultplayermodel, sv_defaultplayerskin and sv_defaultplayercolors variables"
 seta sv_defaultcharacterskin 0 "if set to 1 the further configuration for replacing all skins is taken from the sv_defaultplayerskin variables"
 seta sv_defaultplayermodel "models/player/erebus.iqm" "default model selection, only works if sv_defaultcharacter is set to 1; you may append a :<skinnumber> suffix to model names; you can specify multiple, separated by space, and a random one will be chosen"
-seta sv_defaultplayerskin 0 "each model has 1 or more skins (combination of model and skin = character), set which skin of the model you wish the default character to have, only works if sv_defaultcharacter is set to 1; can be overriden by :<skinnumber> suffix in sv_defaultplayermodel"
+seta sv_defaultplayerskin 0 "each model has 1 or more skins (combination of model and skin = character), set which skin of the model you wish the default character to have, only works if sv_defaultcharacter is set to 1; can be overridden by :<skinnumber> suffix in sv_defaultplayermodel"
 seta sv_defaultplayermodel_red ""      "\"\" means see sv_defaultplayermodel"
 seta sv_defaultplayerskin_red 0
 seta sv_defaultplayermodel_blue "" "\"\" means see sv_defaultplayermodel"
@@ -788,12 +788,11 @@ alias "g_waypointsprite_team_danger_d"    "impulse 39"
 alias "g_waypointsprite_clear_personal"        "impulse 47"
 alias "g_waypointsprite_clear" "impulse 48"
 alias "g_waypointsprite_toggle"        "toggle cl_hidewaypoints"
-// key for that?
+
 seta cl_hidewaypoints 0 "disable static waypoints, only show team waypoints"
 
 seta g_waypointsprite_turrets 1 "disable turret waypoints"
-seta g_waypointsprite_turrets_maxdist 5000 "max distace for turret sprites"
-seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
+seta g_waypointsprite_turrets_maxdist 5000 "max distance for turret waypoints"
 
 seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
 seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health"
@@ -1152,7 +1151,7 @@ seta sv_gentle 0          "force gentle mode for everyone, also remove references to act
 seta cl_gentle 0               "client side gentle mode, master switch for removing both gibs and messages"
 seta cl_gentle_gibs 0          "client side gentle mode (only replaces gibs); when set to 1, white smoke replaces gibs, when set to 2, colorful clouds replace gibs"
 seta cl_gentle_messages 0      "client side gentle mode (only replaces frag messages/centerprints)"
-seta cl_gentle_damage 0                "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomily colored flash is used instead"
+seta cl_gentle_damage 0        "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomly colored flash is used instead"
 
 set g_jetpack 0 "Jetpack mutator"
 
@@ -1236,7 +1235,7 @@ seta cl_forceplayercolors 0 "make enemies look like your own color (requires ser
 seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
 seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
 seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"
-seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce preceived lag"
+seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
 seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
 
 // campaign internal, set when loading a campaign map1G
@@ -1498,7 +1497,7 @@ seta cl_ghost_items_color "-1 -1 -1" "color of ghosted items, 0 0 0 leaves the c
 set sv_simple_items 1 "allow or forbid client use of simple items"
 seta cl_simple_items 0 "enable simple items (if server allows)"
 set cl_simpleitems_postfix "_luma" "posfix to add fo model name when simple items are enabled"
-set cl_fullbright_items 0 "enable fullbright items (if server allows, controled by g_fullbrightitems)"
+set cl_fullbright_items 0 "enable fullbright items (if server allows, controlled by g_fullbrightitems)"
 set cl_weapon_stay_color "2 0.5 0.5" "Color of picked up weapons when g_weapon_stay > 0"
 set cl_weapon_stay_alpha 0.75 "Alpha of picked up weapons when g_weapon_stay > 0"
 
index 52d04bd93d1d7e1b4e984bd9c175291993d34b19..69fced5320091bc933b715bb6de8d6b59e69173c 100644 (file)
@@ -79,8 +79,8 @@ void HUD_HealthArmor()
        int baralign = autocvar_hud_panel_healtharmor_baralign;
        int iconalign = autocvar_hud_panel_healtharmor_iconalign;
 
-    int maxhealth = autocvar_hud_panel_healtharmor_maxhealth;
-    int maxarmor = autocvar_hud_panel_healtharmor_maxarmor;
+       int maxhealth = autocvar_hud_panel_healtharmor_maxhealth;
+       int maxarmor = autocvar_hud_panel_healtharmor_maxarmor;
        if(autocvar_hud_panel_healtharmor_combined) // combined health and armor display
        {
                vector v;
@@ -88,15 +88,14 @@ void HUD_HealthArmor()
 
                float hp = floor(v.x + 1);
 
-        float maxtotal = maxhealth + maxarmor;
+               float maxtotal = maxhealth + maxarmor;
                string biggercount;
                if(v.z) // NOT fully armored
                {
                        biggercount = "health";
                        if(autocvar_hud_panel_healtharmor_progressbar)
                                HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       if(armor)
-            if(autocvar_hud_panel_healtharmor_text)
+                       if(armor && autocvar_hud_panel_healtharmor_text)
                                drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "armor", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
                }
                else
@@ -104,11 +103,10 @@ void HUD_HealthArmor()
                        biggercount = "armor";
                        if(autocvar_hud_panel_healtharmor_progressbar)
                                HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       if(health)
-            if(autocvar_hud_panel_healtharmor_text)
+                       if(health && autocvar_hud_panel_healtharmor_text)
                                drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "health", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
-        if(autocvar_hud_panel_healtharmor_text)
+               if(autocvar_hud_panel_healtharmor_text)
                        DrawNumIcon(pos, mySize, hp, biggercount, 0, iconalign, HUD_Get_Num_Color(hp, maxtotal), 1);
 
                if(fuel)
index 62de4565e53bff2549a9b361f063ab0791c7004b..cbb0e071dfb87f8eca4e210be493db8e69d95bc1 100644 (file)
@@ -119,12 +119,12 @@ string _drawpic_picpath;
                                _drawpic_oldsz = _drawpic_sz.x;\
                                _drawpic_sz.x = _drawpic_sz.y * _drawpic_imgaspect;\
                                if(_drawpic_sz.x)\
-                                       drawpic(pos + eX * (_drawpic_oldsz - _drawpic_sz.x) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                                       drawpic(pos + eX * 0.5 * (_drawpic_oldsz - _drawpic_sz.x), pic, _drawpic_sz, color, theAlpha, drawflag);\
                        } else {\
                                _drawpic_oldsz = _drawpic_sz.y;\
                                _drawpic_sz.y = _drawpic_sz.x / _drawpic_imgaspect;\
                                if(_drawpic_sz.y)\
-                                       drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
+                                       drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
                        }\
                }\
        } MACRO_END
index 0500652b9a5c6802a442edf091a43857cdf219c7..6920a98d197b9ce595298a0d454dd20accdb7839 100644 (file)
@@ -63,7 +63,6 @@ void Draw_ShowNames(entity this)
                        overlap = 0;
        }
 
-       float dist = vlen(this.origin - view_origin);
        if (overlap == -1 && autocvar_hud_shownames_antioverlap)
        {
                // fade tag out if another tag that is closer to you overlaps
@@ -76,7 +75,7 @@ void Draw_ShowNames(entity this)
                        if (eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight) continue;
                        eo.z = 0;
                        if (vdist(((eX * o.x + eY * o.y) - eo), <, autocvar_hud_shownames_antioverlap_distance)
-                           && vdist((it.origin - view_origin), <, dist))
+                           && vlen2(it.origin - view_origin) < vlen2(this.origin - view_origin))
                        {
                                overlap = 1;
                                break;
@@ -118,6 +117,7 @@ void Draw_ShowNames(entity this)
        }
        if (a < ALPHA_MIN_VISIBLE && gametype != MAPINFO_TYPE_CTS) return;
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
+       float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
        {
                if (dist >= autocvar_hud_shownames_maxdistance) return;
index 910f34e326eaaed24ab4462ef31b5d8321bff4c8..e7c0f946bd5dc75692c4a849a5b1ac7a956934ba 100644 (file)
@@ -251,7 +251,7 @@ const int SERVERFLAG_PLAYERSTATS = 4;
 // FIXME/EXPLAINME: why? Mario: because
 vector autocvar_sv_player_maxs = '16 16 45';
 vector autocvar_sv_player_mins = '-16 -16 -24';
-vector autocvar_sv_player_viewoffset = '0 0 20';
+vector autocvar_sv_player_viewoffset = '0 0 35';
 vector autocvar_sv_player_crouch_maxs = '16 16 25';
 vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
index 6b2428bf7803b4719d304a231d3e8a3525f1a2c1..69f70cd2252a71beea59ca4cf6d5803bf6b02653 100644 (file)
@@ -181,7 +181,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
         setsize(this, '-16 -16 0', (use_bigsize) ? '16 16 48' : '16 16 32');
     }
 
-    if(sf & ISF_STATUS) // need to read/write status frist so model can handle simple, fb etc.
+    if(sf & ISF_STATUS) // need to read/write status first so model can handle simple, fb etc.
     {
         this.ItemStatus = ReadByte();
 
index 4d598db543a1ba0f006702b26f1f31119590eb80..ae8cd5323b49dfcd6a3789089e1396bf601a0b56 100644 (file)
@@ -1245,6 +1245,30 @@ void turret_initparams(entity tur)
        #undef TRY
 }
 
+void turret_findtarget(entity this)
+{
+       entity e = find(NULL, classname, "turret_manager");
+       if(!e)
+       {
+               e = new(turret_manager);
+               setthink(e, turrets_manager_think);
+               e.nextthink = time + 2;
+       }
+       
+       entity targ = find(NULL, targetname, this.target);
+       if(targ.classname == "turret_checkpoint")
+               return; // turrets don't defend checkpoints?
+
+       if (!targ)
+       {
+               this.target = "";
+               LOG_TRACE("Turret has invalid defendpoint!");
+       }
+
+       this.tur_defend = targ;
+       this.idle_aim = this.tur_head.angles + angleofs(this.tur_head, targ);
+}
+
 bool turret_initialize(entity this, Turret tur)
 {
        if(!autocvar_g_turrets)
@@ -1260,14 +1284,6 @@ bool turret_initialize(entity this, Turret tur)
                IL_PUSH(g_bot_targets, this);
        }
 
-       entity e = find(NULL, classname, "turret_manager");
-       if(!e)
-       {
-               e = new(turret_manager);
-               setthink(e, turrets_manager_think);
-               e.nextthink = time + 2;
-       }
-
        if(!(this.spawnflags & TSF_SUSPENDED))
                droptofloor(this);
 
@@ -1341,6 +1357,7 @@ bool turret_initialize(entity this, Turret tur)
        this.takedamage                         = DAMAGE_AIM;
        set_movetype(this, MOVETYPE_NOCLIP);
        this.view_ofs                           = '0 0 0';
+       this.idle_aim                           = '0 0 0';
        this.turret_firecheckfunc       = turret_firecheck;
        this.event_damage                       = turret_damage;
        this.use                                        = turret_use;
@@ -1363,21 +1380,8 @@ bool turret_initialize(entity this, Turret tur)
 
        this.weaponentities[0] = this; // lol
 
-       if(!this.tur_defend)
-       if(this.target != "")
-       {
-               this.tur_defend = find(NULL, targetname, this.target);
-               if (this.tur_defend == NULL)
-               {
-                       this.target = "";
-                       LOG_TRACE("Turret has invalid defendpoint!");
-               }
-       }
-
-       if (this.tur_defend)
-               this.idle_aim = this.tur_head.angles + angleofs(this.tur_head, this.tur_defend);
-       else
-               this.idle_aim = '0 0 0';
+       if(!this.tur_defend && this.target != "")
+               InitializeEntity(this, turret_findtarget, INITPRIO_FINDTARGET);
 
 #ifdef TURRET_DEBUG
        this.tur_debug_start = this.nextthink;
index 0a633c78446431fdb0f0c841d67c5d70e49da369..cf53508b6f63adca3314782182b8739c9bba5b17 100644 (file)
@@ -10,17 +10,18 @@ float autocvar_g_turrets_unit_ewheel_speed_slower;
 float autocvar_g_turrets_unit_ewheel_speed_stop;
 float autocvar_g_turrets_unit_ewheel_turnrate;
 
-const float ewheel_anim_stop = 0;
-const float ewheel_anim_fwd_slow = 1;
-const float ewheel_anim_fwd_fast = 2;
-const float ewheel_anim_bck_slow = 3;
-const float ewheel_anim_bck_fast = 4;
+const int ewheel_anim_stop     = 0;
+const int ewheel_anim_fwd_slow = 1;
+const int ewheel_anim_fwd_fast = 2;
+const int ewheel_anim_bck_slow = 3;
+const int ewheel_anim_bck_fast = 4;
 
 void ewheel_move_path(entity this)
 {
-#ifdef EWHEEL_FANCYPATH
-    // Are we close enougth to a path node to switch to the next?
+    // Are we close enough to a path node to switch to the next?
     if(vdist(this.origin - this.pathcurrent.origin, <, 64))
+    {
+#ifdef EWHEEL_FANCYPATH
         if (this.pathcurrent.path_next == NULL)
         {
             // Path endpoint reached
@@ -43,11 +44,10 @@ void ewheel_move_path(entity this)
         }
         else
             this.pathcurrent = this.pathcurrent.path_next;
-
 #else
-    if(vdist(this.origin - this.pathcurrent.origin, <, 64))
         this.pathcurrent = this.pathcurrent.enemy;
 #endif
+    }
 
     if (this.pathcurrent)
     {
@@ -61,11 +61,11 @@ void ewheel_move_path(entity this)
 
 void ewheel_move_enemy(entity this)
 {
-    float newframe;
+    int newframe;
 
     this.steerto = steerlib_arrive(this, this.enemy.origin,this.target_range_optimal);
 
-    this.moveto  = this.origin + this.steerto * 128;
+    this.moveto = this.origin + this.steerto * 128;
 
     if (this.tur_dist_enemy > this.target_range_optimal)
     {
@@ -113,6 +113,29 @@ void ewheel_move_idle(entity this)
         movelib_brake_simple(this, (autocvar_g_turrets_unit_ewheel_speed_stop));
 }
 
+void ewheel_findtarget(entity this)
+{
+    entity e = find(NULL, targetname, this.target);
+    if (!e)
+    {
+        LOG_TRACE("Initital waypoint for ewheel does NOT exist, fix your map!");
+        this.target = "";
+    }
+
+    if (e.classname != "turret_checkpoint")
+        LOG_TRACE("Warning: not a turret path");
+    else
+    {
+
+#ifdef EWHEEL_FANCYPATH
+        this.pathcurrent = pathlib_astar(this, this.origin, e.origin);
+        this.pathgoal = e;
+#else
+        this.pathcurrent  = e;
+#endif
+    }
+}
+
 spawnfunc(turret_ewheel) { if(!turret_initialize(this, TUR_EWHEEL)) delete(this); }
 
 METHOD(EWheel, tr_think, void(EWheel thistur, entity it))
@@ -162,8 +185,6 @@ METHOD(EWheel, tr_death, void(EWheel this, entity it))
 
 METHOD(EWheel, tr_setup, void(EWheel this, entity it))
 {
-    entity e;
-
     if(it.move_movetype == MOVETYPE_WALK)
     {
         it.velocity = '0 0 0';
@@ -172,27 +193,7 @@ METHOD(EWheel, tr_setup, void(EWheel this, entity it))
         setorigin(it, it.pos1);
 
         if (it.target != "")
-        {
-            e = find(NULL, targetname, it.target);
-            if (!e)
-            {
-                LOG_TRACE("Initital waypoint for ewheel does NOT exsist, fix your map!");
-                it.target = "";
-            }
-
-            if (e.classname != "turret_checkpoint")
-                LOG_TRACE("Warning: not a turrret path");
-            else
-            {
-
-#ifdef EWHEEL_FANCYPATH
-                it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
-                it.pathgoal = e;
-#else
-                it.pathcurrent  = e;
-#endif
-            }
-        }
+            InitializeEntity(it, ewheel_findtarget, INITPRIO_FINDTARGET);
     }
 
     it.iscreature                              = true;
index 0a82a4a7bcef08cd1db7c03cdbcc925ca6c0474f..d8c0a675d5c0b1175be5a3f6d79c6e086df88f3d 100644 (file)
@@ -43,8 +43,6 @@ const int ANIM_ROAM       = 11;
 .float animflag;
 .float idletime;
 
-#define WALKER_PATH(this, s, e) pathlib_astar(this, s, e)
-
 bool walker_firecheck(entity this)
 {
     if (this.animflag == ANIM_MELEE)
@@ -299,7 +297,7 @@ void walker_move_path(entity this)
 
                 if (this.pathgoal.enemy)
                 {
-                    this.pathcurrent = WALKER_PATH(this, this.pathgoal.origin, this.pathgoal.enemy.origin);
+                    this.pathcurrent = pathlib_astar(this, this.pathgoal.origin, this.pathgoal.enemy.origin);
                     this.pathgoal = this.pathgoal.enemy;
                 }
             }
@@ -326,6 +324,30 @@ void walker_move_path(entity this)
 #endif
 }
 
+void walker_findtarget(entity this)
+{
+    entity e = find(NULL, targetname, this.target);
+    if (!e)
+    {
+        LOG_TRACE("Initital waypoint for walker does NOT exist, fix your map!");
+        this.target = "";
+    }
+
+    if (e.classname != "turret_checkpoint")
+        LOG_TRACE("Warning: not a turrret path");
+    else
+    {
+#ifdef WALKER_FANCYPATHING
+        this.pathcurrent = pathlib_astar(this, this.origin, e.origin);
+        this.pathgoal = e;
+#else
+        this.pathcurrent = e;
+#endif
+    }
+
+    // TODO: this doesn't reset target, so tur_defend will be the checkpoint too!
+}
+
 spawnfunc(turret_walker) { if(!turret_initialize(this, TUR_WALKER)) delete(this); }
 
 METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
@@ -550,8 +572,6 @@ METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
 {
     it.ticrate = 0.05;
 
-    entity e;
-
     // Respawn is called & first spawn to, to set team. need to make sure we do not move the initial spawn.
     if(it.move_movetype == MOVETYPE_WALK)
     {
@@ -587,26 +607,7 @@ METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it))
     it.turret_firecheckfunc = walker_firecheck;
 
     if (it.target != "")
-    {
-        e = find(NULL, targetname, it.target);
-        if (!e)
-        {
-            LOG_TRACE("Initital waypoint for walker does NOT exsist, fix your map!");
-            it.target = "";
-        }
-
-        if (e.classname != "turret_checkpoint")
-            LOG_TRACE("Warning: not a turrret path");
-        else
-        {
-#ifdef WALKER_FANCYPATHING
-            it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
-            it.pathgoal = e;
-#else
-            it.pathcurrent = e;
-#endif
-        }
-    }
+        InitializeEntity(it, walker_findtarget, INITPRIO_FINDTARGET);
 }
 
 #endif // SVQC
index 17d055fe4829b5ee0de9a7eb42e41e5233bf95cd..b69b9663229a75f8de6381c458774845eabc5128 100644 (file)
@@ -460,7 +460,7 @@ void W_Shockwave_Attack(entity actor, .entity weaponentity)
                                        );
 
                                // figure out the direction of force
-                               vel = normalize(vec3(head.velocity.x, head.velocity.y, 0));
+                               vel = normalize(vec2(head.velocity));
                                vel *=
                                        (
                                                bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
index 56c80e02d1b13ca5dcf66105aa597bb7c28d67f3..0a3dd8c662a8ac8e1f91e26ab820b8cbe658f842 100644 (file)
@@ -311,14 +311,14 @@ USING(Stream, int);
                        v += ReadByte();          // note: this is unsigned
                        return v;
                }
-               #define ReadInt48_t() vec3(ReadInt24_t(), ReadInt24_t(), 0)
+               #define ReadInt48_t() vec2(ReadInt24_t(), ReadInt24_t())
                #define ReadInt72_t() vec3(ReadInt24_t(), ReadInt24_t(), ReadInt24_t())
 
                noref int _ReadSByte;
                #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
                #define ReadFloat() ReadCoord()
                #define ReadVector() vec3(ReadFloat(), ReadFloat(), ReadFloat())
-               #define ReadVector2D() vec3(ReadFloat(), ReadFloat(), 0)
+               #define ReadVector2D() vec2(ReadFloat(), ReadFloat())
 
                float ReadApproxPastTime()
                {
index 99059a1e485364fa227b5020e09ff546a68cc357..6debcb713dcdfed7c0ca8fbb82040360dec48841 100644 (file)
                NL() \
        NL() \
        TITLE(_("Other Active Contributors")) \
-               PERSON(Erik "Ablu" Schilling) \
+               PERSON(Jeff) \
+               PERSON(Lyberta) \
                PERSON(Mircea "Taoki" Kitsune) \
                PERSON(Penguinum) \
-               PERSON(Jeff) \
        NL() \
        NL() \
        TITLE(_("Translators")) \
                NL() \
                FUNCTION(_("Dutch")) \
                        PERSON(Alexander "freefang" van Dam) \
+                       PERSON(Joeke "Mappack" de Graaf) \
                        PERSON(Jonathan "Jonakeys" van der Steege) \
                        PERSON(PinkRobot) \
                        PERSON(vegiburger) \
                        PERSON(Ruszkai "CuBe0wL" Ákos) \
                        PERSON(xaN1C4n3) \
                NL() \
+               FUNCTION(_("Irish")) \
+                       PERSON(Kevin "kscanne" Scannell) \
+               NL() \
                FUNCTION(_("Italian")) \
                        PERSON(Antonio "terencehill" Piu) \
                        PERSON(Felice "MaidenBeast" Sallustio) \
                        PERSON(Amadeusz "amade/proraide" Sławiński) \
                        PERSON(Artur "artur9010" Motyka) \
                        PERSON(Jakub "KubeQ11" Pędziszewski) \
+                       PERSON(Kriss7475) \
                NL() \
                FUNCTION(_("Portuguese")) \
                        PERSON(Ivan Paulos "greylica" Tomé) \
                        PERSON(Nikoli) \
                        PERSON(Sergej "Clearness High" Lutsyk) \
                NL() \
+               FUNCTION(_("Scottish Gaelic")) \
+                       PERSON_("GunChleoc") \
+               NL() \
                FUNCTION(_("Serbian")) \
                        PERSON_("Саша \"salepetronije\" Петровић") \
+                       PERSON(Marko M. Kostić) \
                        PERSON(Pendulla) \
                        PERSON(Rafael "Ristovski") \
                NL() \
                        PERSON(roader_gentoo) \
                        PERSON(Rodrigo Mouton Laudin) \
                        PERSON(SouL) \
+                       PERSON(Starfire24680) \
                NL() \
                FUNCTION(_("Swedish")) \
                        PERSON(Karl-Oskar "machine" Rikås) \
                PERSON(Edgenetwork) \
                PERSON(Edward "Ed" Holness) \
                PERSON(Eric "Munyul Verminard" Sambach) \
+               PERSON(Erik "Ablu" Schilling) \
                PERSON(Fabien "H. Reaper" Tschirhart) \
                PERSON(Florian Paul "lda17h" Schmidt) \
                PERSON(FrikaC) \
index a51e9fa89eee054c6e4ff567a1ed2a9748581396..e31a83cb09f82e1a676d4fd64ffb6ba020868099 100644 (file)
@@ -1043,6 +1043,9 @@ void FixClientCvars(entity e)
        if(autocvar_sv_gentle)
                stuffcmd(e, "cl_cmd settemp cl_gentle 1\n");
 
+       stuffcmd(e, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min));
+       stuffcmd(e, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max));
+
        MUTATOR_CALLHOOK(FixClientCvars, e);
 }
 
index fdb95d2f608b967be48675f96e549975693e766e..1449e382a6913daffb425bb5d58d5b7e666cb564 100644 (file)
@@ -35,8 +35,7 @@ float pathlib_h_manhattan(vector a,vector b)
 {
     //h(n) = D * (abs(n.x-goal.x) + abs(n.y-goal.y))
 
-    float h;
-    h  = fabs(a.x - b.x);
+    float h  = fabs(a.x - b.x);
     h += fabs(a.y - b.y);
     h *= pathlib_gridsize;
 
@@ -50,11 +49,10 @@ float pathlib_h_manhattan(vector a,vector b)
 float pathlib_h_diagonal(vector a,vector b)
 {
     //h(n) = D * max(abs(n.x-goal.x), abs(n.y-goal.y))
-    float h,x,y;
 
-    x = fabs(a.x - b.x);
-    y = fabs(a.y - b.y);
-    h = pathlib_movecost * max(x,y);
+    float hx = fabs(a.x - b.x);
+    float hy = fabs(a.y - b.y);
+    float h = pathlib_movecost * max(hx,hy);
 
     return h;
 }
@@ -75,21 +73,19 @@ float pathlib_h_euclidean(vector a,vector b)
 **/
 float pathlib_h_diagonal2(vector a,vector b)
 {
-    float h_diag,h_str,h,x,y;
-
     /*
     h_diagonal(n) = min(abs(n.x-goal.x), abs(n.y-goal.y))
     h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
     h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
     */
 
-    x = fabs(a.x - b.x);
-    y = fabs(a.y - b.y);
+    float hx = fabs(a.x - b.x);
+    float hy = fabs(a.y - b.y);
 
-    h_diag = min(x,y);
-    h_str = x + y;
+    float h_diag = min(hx,hy);
+    float h_str = hx + hy;
 
-    h =  pathlib_movecost_diag * h_diag;
+    float h =  pathlib_movecost_diag * h_diag;
     h += pathlib_movecost * (h_str - 2 * h_diag);
 
     return h;
@@ -101,28 +97,23 @@ float pathlib_h_diagonal2(vector a,vector b)
 **/
 float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end)
 {
-    float h_diag,h_str,h,x,y,z;
-
     //h_diagonal(n) = min(abs(n.x-goal.x), abs(n.y-goal.y))
     //h_straight(n) = (abs(n.x-goal.x) + abs(n.y-goal.y))
     //h(n) = D2 * h_diagonal(n) + D * (h_straight(n) - 2*h_diagonal(n)))
 
-    x = fabs(point.x - end.x);
-    y = fabs(point.y - end.y);
-    z = fabs(point.z - end.z);
+    float hx = fabs(point.x - end.x);
+    float hy = fabs(point.y - end.y);
+    float hz = fabs(point.z - end.z);
 
-    h_diag = min3(x,y,z);
-    h_str = x + y + z;
+    float h_diag = min3(hx,hy,hz);
+    float h_str = hx + hy + hz;
 
-    h =  pathlib_movecost_diag * h_diag;
+    float h =  pathlib_movecost_diag * h_diag;
     h += pathlib_movecost * (h_str - 2 * h_diag);
 
-    float m;
-    vector d1,d2;
-
-    d1 = normalize(preprev - point);
-    d2 = normalize(prev    - point);
-    m = vlen(d1-d2);
+    vector d1 = normalize(preprev - point);
+    vector d2 = normalize(prev    - point);
+    float m = vlen(d1-d2);
 
     return h * m;
 }
@@ -130,16 +121,14 @@ float pathlib_h_diagonal2sdp(vector preprev,vector prev,vector point,vector end)
 
 float pathlib_h_diagonal3(vector a,vector b)
 {
-    float h_diag,h_str,h,x,y,z;
-
-    x = fabs(a.x - b.x);
-    y = fabs(a.y - b.y);
-    z = fabs(a.z - b.z);
+    float hx = fabs(a.x - b.x);
+    float hy = fabs(a.y - b.y);
+    float hz = fabs(a.z - b.z);
 
-    h_diag = min3(x,y,z);
-    h_str = x + y + z;
+    float h_diag = min3(hx,hy,hz);
+    float h_str = hx + hy + hz;
 
-    h =  pathlib_movecost_diag * h_diag;
+    float h =  pathlib_movecost_diag * h_diag;
     h += pathlib_movecost * (h_str - 2 * h_diag);
 
     return h;
index 700ba41c0e10ed9d7b203467d3d86f96288e4479..b77736b19ad7c098c5ab3a0c8bf9dfeb7ba2f76c 100644 (file)
@@ -8,14 +8,12 @@ float  plib_fvals[8];
 
 float pathlib_expandnode_starf(entity node, vector start, vector goal)
 {
-    vector where,f,r,t;
-    float fc,c;
-    entity nap;
+    float fc;
 
-    where = node.origin;
+    vector where = node.origin;
 
-    f = PLIB_FORWARD * pathlib_gridsize;
-    r = PLIB_RIGHT   * pathlib_gridsize;
+    vector f = PLIB_FORWARD * pathlib_gridsize;
+    vector r = PLIB_RIGHT   * pathlib_gridsize;
 
     // Forward
     plib_points[0] = where + f;
@@ -43,7 +41,7 @@ float pathlib_expandnode_starf(entity node, vector start, vector goal)
 
     for(int i=0;i < 8; ++i)
     {
-        t = plib_points[i];
+        vector t = plib_points[i];
         fc  = pathlib_heuristic(t,goal) + pathlib_cost(node, t, pathlib_gridsize);
         plib_fvals[i] = fc;
 
@@ -56,13 +54,15 @@ float pathlib_expandnode_starf(entity node, vector start, vector goal)
     int fc2 = 0;
     for(int i = 0; i < 8; ++i)
     {
-        c = 0;
-        nap = pathlib_nodeatpoint(plib_points[i]);
+        bool c = false;
+        entity nap = pathlib_nodeatpoint(plib_points[i]);
         if(nap)
+        {
             if(nap.owner == openlist)
-                c = 1;
+                c = true;
+        }
         else
-            c = 1;
+            c = true;
 
         if(c)
         if(plib_fvals[i] < fc)
@@ -94,12 +94,12 @@ float pathlib_expandnode_starf(entity node, vector start, vector goal)
 
 float pathlib_expandnode_star(entity node, vector start, vector goal)
 {
-    vector point, where, f, r;
+    vector point;
 
-    where = node.origin;
+    vector where = node.origin;
 
-    f = PLIB_FORWARD * pathlib_gridsize;
-    r = PLIB_RIGHT   * pathlib_gridsize;
+    vector f = PLIB_FORWARD * pathlib_gridsize;
+    vector r = PLIB_RIGHT   * pathlib_gridsize;
 
     if (node.pathlib_node_edgeflags == pathlib_node_edgeflag_unknown)
         node.pathlib_node_edgeflags = tile_check_plus2(node, node.origin);
@@ -173,12 +173,12 @@ float pathlib_expandnode_star(entity node, vector start, vector goal)
 
 float pathlib_expandnode_octagon(entity node, vector start, vector goal)
 {
-    vector point,where,f,r;
+    vector point;
 
-    where = node.origin;
+    vector where = node.origin;
 
-    f = PLIB_FORWARD * pathlib_gridsize;
-    r = PLIB_RIGHT   * pathlib_gridsize;
+    vector f = PLIB_FORWARD * pathlib_gridsize;
+    vector r = PLIB_RIGHT   * pathlib_gridsize;
 
     // Forward
     point = where + f;
index 36c7c1d3147968284bf8a478c68f145cb7e965e6..833ad9b3f33bba542bc8cafbfdd2598f14fd79ad 100644 (file)
@@ -13,8 +13,7 @@ void pathlib_deletepath(entity start)
     });
 }
 
-//#define PATHLIB_NODEEXPIRE 0.05
-const float PATHLIB_NODEEXPIRE = 20;
+const float PATHLIB_NODEEXPIRE = 20; // 0.05
 
 void dumpnode(entity n)
 {
@@ -32,9 +31,7 @@ void pathlib_showsquare(vector where,float goodsquare,float _lifetime);
 
 entity pathlib_mknode(vector where,entity parent)
 {
-    entity node;
-
-    node = pathlib_nodeatpoint(where);
+    entity node = pathlib_nodeatpoint(where);
     if(node)
     {
        #ifdef TURRET_DEBUG
@@ -51,7 +48,6 @@ entity pathlib_mknode(vector where,entity parent)
     node.owner        = openlist;
     node.path_prev    = parent;
 
-
     setsize(node, '0 0 0', '0 0 0');
 
     setorigin(node, where);
@@ -64,11 +60,10 @@ entity pathlib_mknode(vector where,entity parent)
     return node;
 }
 
-float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector goal,float cost)
+bool pathlib_makenode_adaptive(entity parent,vector start, vector to, vector goal,float cost)
 {
-    entity node;
-    float h,g,f,doedge = 0;
-    vector where;
+    bool dodge = false;
+    float f, h, g;
 
     ++pathlib_searched_cnt;
 
@@ -94,11 +89,11 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
 
             pathlib_expandnode = pathlib_expandnode_star;
             pathlib_movenode   = pathlib_walknode;
-            doedge = 1;
+            dodge = true;
         }
     }
 
-    node = pathlib_nodeatpoint(to);
+    entity node = pathlib_nodeatpoint(to);
     if(node)
     {
         LOG_TRACE("NodeAtPoint");
@@ -107,7 +102,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
         if(node.owner == openlist)
         {
             h = pathlib_heuristic(node.origin,goal);
-            g = pathlib_cost(parent,node.origin,cost);
+            float g = pathlib_cost(parent,node.origin,cost);
             f = g + h;
 
             if(node.pathlib_node_g > g)
@@ -125,17 +120,17 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
                 best_open_node = node;
         }
 
-        return 1;
+        return true;
     }
 
-    where = pathlib_movenode(parent, parent.origin, to, 0);
+    vector where = pathlib_movenode(parent, parent.origin, to, 0);
 
     if (!pathlib_movenode_goodnode)
     {
         //pathlib_showsquare(where, 0 ,30);
         //pathlib_showsquare(parent.origin, 1 ,30);
         LOG_TRACE("pathlib_movenode_goodnode = 0");
-        return 0;
+        return false;
     }
 
     //pathlib_showsquare(where, 1 ,30);
@@ -145,18 +140,18 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
         LOG_TRACE("NAP WHERE :",vtos(where));
         LOG_TRACE("not NAP TO:",vtos(to));
         LOG_TRACE("NAP-NNAP:",ftos(vlen(to-where)));
-        return 0;
+        return false;
     }
 
 
-    if(doedge)
+    if(dodge)
         if (!tile_check(parent, where))
         {
             LOG_TRACE("tile_check fail");
 #if DEBUGPATHING
             pathlib_showsquare(where, 0 ,30);
 #endif
-            return 0;
+            return false;
         }
 
 
@@ -208,7 +203,7 @@ float pathlib_makenode_adaptive(entity parent,vector start, vector to, vector go
     else if(best_open_node.pathlib_node_f > node.pathlib_node_f)
         best_open_node = node;
 
-    return 1;
+    return true;
 }
 
 entity pathlib_getbestopen()
@@ -235,7 +230,6 @@ entity pathlib_getbestopen()
 
 void pathlib_close_node(entity node,vector goal)
 {
-
     if(node.owner == closedlist)
     {
         LOG_TRACE("Pathlib: Tried to close a closed node!");
@@ -269,22 +263,10 @@ void pathlib_cleanup()
 
     //return;
 
-    entity node;
-
-    node = findfloat(NULL,is_path_node, true);
-    while(node)
+    FOREACH_ENTITY_FLOAT(is_path_node, true,
     {
-        /*
-        node.owner = openlist;
-        node.pathlib_node_g = 0;
-        node.pathlib_node_h = 0;
-        node.pathlib_node_f = 0;
-        node.path_prev = NULL;
-        */
-
-        dumpnode(node);
-        node = findfloat(node,is_path_node, true);
-    }
+       dumpnode(it);
+    });
 
     if(openlist)
         delete(openlist);
@@ -294,60 +276,53 @@ void pathlib_cleanup()
 
     openlist       = NULL;
     closedlist     = NULL;
-
 }
 
 float Cosine_Interpolate(float a, float b, float c)
 {
-    float ft,f;
-
-       ft = c * 3.1415927;
-       f = (1 - cos(ft)) * 0.5;
+       float ft = c * 3.1415927;
+       float f = (1 - cos(ft)) * 0.5;
 
        return  a*(1-f) + b*f;
 }
 
-float buildpath_nodefilter_directional(vector n,vector c,vector p)
+bool buildpath_nodefilter_directional(vector n,vector c,vector p)
 {
-    vector d1,d2;
-
-    d2 = normalize(p - c);
-    d1 = normalize(c - n);
+    vector d2 = normalize(p - c);
+    vector d1 = normalize(c - n);
 
     if(vdist(d1 - d2, <, 0.25))
     {
         //mark_error(c,30);
-        return 1;
+        return true;
     }
     //mark_info(c,30);
-    return 0;
+    return false;
 }
 
-float buildpath_nodefilter_moveskip(entity this, vector n,vector c,vector p)
+bool buildpath_nodefilter_moveskip(entity this, vector n,vector c,vector p)
 {
     pathlib_walknode(this, p, n, 1);
     if(pathlib_movenode_goodnode)
-        return 1;
+        return true;
 
-    return 0;
+    return false;
 }
 
-float buildpath_nodefilter_none(vector n,vector c,vector p)
+bool buildpath_nodefilter_none(vector n,vector c,vector p)
 {
-    return 0;
+    return false;
 }
 
 entity path_build(entity next, vector where, entity prev, entity start)
 {
-    entity path;
-
     if(prev && next)
         if(buildpath_nodefilter)
             if(buildpath_nodefilter(next.origin,where,prev.origin))
                 return next;
 
 
-    path           = spawn();
+    entity path    = spawn();
     path.owner     = start;
     path.path_next = next;
 
@@ -366,12 +341,10 @@ entity path_build(entity next, vector where, entity prev, entity start)
     return path;
 }
 
-entity pathlib_astar(entity this, vector from,vector to)
+entity pathlib_astar(entity this, vector from, vector to)
 {
-    entity path, start, end, open, n, ln;
-    float ptime, ftime, ctime;
-
-    ptime = gettime(GETTIME_REALTIME);
+       entity open;
+    float ptime = gettime(GETTIME_REALTIME);
     pathlib_starttime = ptime;
 
     pathlib_cleanup();
@@ -455,7 +428,7 @@ entity pathlib_astar(entity this, vector from,vector to)
     //to_z += 32;
 
     LOG_TRACE("AStar init");
-    path = pathlib_mknode(from, NULL);
+    entity path = pathlib_mknode(from, NULL);
     pathlib_close_node(path, to);
     if(pathlib_foundgoal)
     {
@@ -479,7 +452,7 @@ entity pathlib_astar(entity this, vector from,vector to)
     }
 
     best_open_node = pathlib_getbestopen();
-    n = best_open_node;
+    entity n = best_open_node;
     pathlib_close_node(best_open_node, to);
     if(inwater(n.origin))
         pathlib_expandnode_box(n, from, to);
@@ -512,12 +485,12 @@ entity pathlib_astar(entity this, vector from,vector to)
         if(pathlib_foundgoal)
         {
             LOG_TRACE("Target found. Rebuilding and filtering path...");
-            ftime = gettime(GETTIME_REALTIME);
+            float ftime = gettime(GETTIME_REALTIME);
             ptime = ftime - ptime;
 
-            start = path_build(NULL,path.origin,NULL,NULL);
-            end   = path_build(NULL,goal_node.origin,NULL,start);
-            ln    = end;
+            entity start = path_build(NULL,path.origin,NULL,NULL);
+            entity end   = path_build(NULL,goal_node.origin,NULL,start);
+            entity ln    = end;
 
             open = goal_node;
             for(open = goal_node; open.path_prev != path; open = open.path_prev)
@@ -530,7 +503,7 @@ entity pathlib_astar(entity this, vector from,vector to)
             n.path_prev = start;
             ftime = gettime(GETTIME_REALTIME) - ftime;
 
-            ctime = gettime(GETTIME_REALTIME);
+            float ctime = gettime(GETTIME_REALTIME);
             pathlib_cleanup();
             ctime = gettime(GETTIME_REALTIME) - ctime;
 
index 6c8e4dc7692304b5bbd29dd85bb291b3557f783d..c867080dd7e336e175eecc95ea4586e18c50b744 100644 (file)
@@ -1,4 +1,4 @@
 #pragma once
 
-float buildpath_nodefilter_none(vector n,vector c,vector p);
+bool buildpath_nodefilter_none(vector n,vector c,vector p);
 entity path_build(entity next, vector where, entity prev, entity start);
index 4a3bfe35c5bee6ba18262a33eff34e3f3a95bc11..ca9180eefa096c6e6f67976354d5bbbabde83ea2 100644 (file)
@@ -9,7 +9,7 @@ vector pathlib_wateroutnode(entity this, vector start, vector end, float doedge)
 {
     vector surface;
 
-    pathlib_movenode_goodnode = 0;
+    pathlib_movenode_goodnode = false;
 
     end.x = fsnap(end.x, pathlib_gridsize);
     end.y = fsnap(end.y, pathlib_gridsize);
@@ -31,17 +31,17 @@ vector pathlib_wateroutnode(entity this, vector start, vector end, float doedge)
 
     tracebox(start + '0 0 64', movenode_boxmin,movenode_boxmax, end + '0 0 64', MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
-        pathlib_movenode_goodnode = 1;
+        pathlib_movenode_goodnode = true;
 
     if(fabs(surface.z - end.z) > 32)
-        pathlib_movenode_goodnode = 0;
+        pathlib_movenode_goodnode = false;
 
     return end;
 }
 
 vector pathlib_swimnode(entity this, vector start, vector end, float doedge)
 {
-    pathlib_movenode_goodnode = 0;
+    pathlib_movenode_goodnode = false;
 
     if(pointcontents(start) != CONTENT_WATER)
         return end;
@@ -54,21 +54,21 @@ vector pathlib_swimnode(entity this, vector start, vector end, float doedge)
 
     tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
-        pathlib_movenode_goodnode = 1;
+        pathlib_movenode_goodnode = true;
 
     return end;
 }
 
 vector pathlib_flynode(entity this, vector start, vector end, float doedge)
 {
-    pathlib_movenode_goodnode = 0;
+    pathlib_movenode_goodnode = false;
 
     end.x = fsnap(end.x, pathlib_gridsize);
     end.y = fsnap(end.y, pathlib_gridsize);
 
     tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, this);
     if(trace_fraction == 1)
-        pathlib_movenode_goodnode = 1;
+        pathlib_movenode_goodnode = true;
 
     return end;
 }
@@ -84,12 +84,11 @@ void a_think(entity this)
 
 vector pathlib_walknode(entity this, vector start, vector end, float doedge)
 {
-    vector direction,point,last_point,s,e;
-    float steps, distance, i;
+    vector point;
 
     LOG_TRACE("Walking node from ", vtos(start), " to ", vtos(end));
 
-    pathlib_movenode_goodnode = 0;
+    pathlib_movenode_goodnode = false;
 
     end.x = fsnap(end.x,pathlib_gridsize);
     end.y = fsnap(end.y,pathlib_gridsize);
@@ -116,15 +115,16 @@ vector pathlib_walknode(entity this, vector start, vector end, float doedge)
     start = trace_endpos;
 
     // Find the direcion, without Z
-    s   = start; e   = end;
+    vector s   = start;
+    vector e   = end;
     //e_z = 0; s_z = 0;
-    direction = normalize(e - s);
+    vector direction = normalize(e - s);
 
-    distance  = vlen(start - end);
-    steps     = rint(distance / movenode_stepsize);
+    float distance  = vlen(start - end);
+    int steps     = rint(distance / movenode_stepsize);
 
-    last_point = start;
-    for(i = 1; i < steps; ++i)
+    vector last_point = start;
+    for(int i = 1; i < steps; ++i)
     {
         point = last_point + (direction * movenode_stepsize);
         traceline(point + movenode_stepup,point - movenode_maxdrop,MOVE_WORLDONLY,this);
@@ -151,6 +151,6 @@ vector pathlib_walknode(entity this, vector start, vector end, float doedge)
     if(trace_fraction != 1.0)
         return trace_endpos;
 
-    pathlib_movenode_goodnode = 1;
+    pathlib_movenode_goodnode = true;
     return last_point;
 }
index 028a2c7e6e5b26eb9b01650327ab8b153bc5617e..a014c7ce2ab0c57874ac0be849538ad4899b8341 100644 (file)
@@ -66,10 +66,10 @@ entity best_open_node;
 vector tile_check_up;
 vector tile_check_down;
 float  tile_check_size;
-float     tile_check_cross(entity this, vector where);
-float     tile_check_plus(entity this, vector where);
-float     tile_check_star(entity this, vector where);
-var float tile_check(entity this, vector where);
+bool     tile_check_cross(entity this, vector where);
+bool     tile_check_plus(entity this, vector where);
+bool     tile_check_star(entity this, vector where);
+var bool tile_check(entity this, vector where);
 
 float  movenode_stepsize;
 vector movenode_stepup;
@@ -77,7 +77,7 @@ vector movenode_maxdrop;
 vector movenode_boxup;
 vector movenode_boxmax;
 vector movenode_boxmin;
-float  pathlib_movenode_goodnode;
+bool  pathlib_movenode_goodnode;
 
 vector     pathlib_wateroutnode(entity this, vector start, vector end, float doedge);
 vector     pathlib_swimnode(entity this, vector start, vector end, float doedge);
@@ -105,7 +105,7 @@ float      pathlib_h_diagonal2sdp(vector preprev, vector prev, vector point, vec
 float      pathlib_h_none(vector preprev, vector prev) { return 0; }
 var float  pathlib_heuristic(vector from, vector to);
 
-var float  pathlib_makenode(entity parent,vector start, vector to, vector goal,float cost);
-var float  buildpath_nodefilter(vector n,vector c,vector p);
+var bool  pathlib_makenode(entity parent,vector start, vector to, vector goal,float cost);
+var bool  buildpath_nodefilter(vector n,vector c,vector p);
 
 var float  pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
index be901f88668e6c2514be47125b9ec05fd0087d4a..9ebaac9f275830a8115f4ac661165cd8f4235a6b 100644 (file)
@@ -23,102 +23,95 @@ bool location_isok(vector point, bool waterok, bool air_isok)
 
 entity pathlib_nodeatpoint(vector where)
 {
-    entity node;
-
     ++pathlib_searched_cnt;
 
     where.x = fsnap(where.x,pathlib_gridsize);
     where.y = fsnap(where.y,pathlib_gridsize);
 
-    node = findradius(where,pathlib_gridsize * 0.5);
-    while(node)
+    FOREACH_ENTITY_RADIUS(where, pathlib_gridsize * 0.5, it.is_path_node,
     {
-        if(node.is_path_node == true)
-            return node;
-
-        node = node.chain;
-    }
+       return it;
+    });
 
     return NULL;
 }
 
-float tile_check_cross(entity this, vector where)
+bool tile_check_cross(entity this, vector where)
 {
-    vector p,f,r;
-
-    f = PLIB_FORWARD * tile_check_size;
-    r = PLIB_RIGHT   * tile_check_size;
+       vector p;
+    vector f = PLIB_FORWARD * tile_check_size;
+    vector r = PLIB_RIGHT   * tile_check_size;
 
 
     // forward-right
     p = where + f + r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
-        return 0;
+        return false;
 
     // Forward-left
     p = where + f - r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
-        return 0;
+        return false;
 
     // Back-right
     p = where - f + r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1 ,0))
-        return 0;
+        return false;
 
     //Back-left
     p = where - f - r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (!location_isok(trace_endpos, 1, 0))
-        return 0;
+        return false;
 
-    return 1;
+    return true;
 }
 
-float tile_check_plus(entity this, vector where)
+bool tile_check_plus(entity this, vector where)
 {
-    vector p,f,r;
+    vector p;
 
-    f = PLIB_FORWARD * tile_check_size;
-    r = PLIB_RIGHT   * tile_check_size;
+    vector f = PLIB_FORWARD * tile_check_size;
+    vector r = PLIB_RIGHT   * tile_check_size;
 
     // forward
     p = where + f;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
-        return 0;
+        return false;
 
 
     //left
     p = where - r;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
-        return 0;
+        return false;
 
     // Right
     p = where + r;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
-        return 0;
+        return false;
 
     //Back
     p = where - f;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (!location_isok(trace_endpos,1,0))
-        return 0;
+        return false;
 
-    return 1;
+    return true;
 }
 
 float tile_check_plus2(entity this, vector where)
 {
-    vector p,f,r;
-    float i = 0, e = 0;
+    vector p;
+    int j = 0, e = 0;
 
-    f = PLIB_FORWARD * pathlib_gridsize;
-    r = PLIB_RIGHT   * pathlib_gridsize;
+    vector f = PLIB_FORWARD * pathlib_gridsize;
+    vector r = PLIB_RIGHT   * pathlib_gridsize;
 
 //#define pathlib_node_edgeflag_left    2
 //#define pathlib_node_edgeflag_right   4
@@ -130,7 +123,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_forward;
     }
 
@@ -140,7 +133,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_left;
     }
 
@@ -150,7 +143,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_right;
     }
 
@@ -159,7 +152,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
     if (location_isok(trace_endpos,1,0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_back;
     }
 
@@ -168,7 +161,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_forwardright;
     }
 
@@ -177,7 +170,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_forwardleft;
     }
 
@@ -186,7 +179,7 @@ float tile_check_plus2(entity this, vector where)
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1 ,0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_backright;
     }
 
@@ -195,22 +188,22 @@ float tile_check_plus2(entity this, vector where)
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
     if (location_isok(trace_endpos, 1, 0))
     {
-       ++i;
+       ++j;
        e |= pathlib_node_edgeflag_backleft;
     }
 
 
-    if(i == 0)
+    if(j == 0)
         e = pathlib_node_edgeflag_none;
 
     return e;
 }
 
-float tile_check_star(entity this, vector where)
+bool tile_check_star(entity this, vector where)
 {
     if(tile_check_plus(this, where))
         return tile_check_cross(this, where);
 
-    return 0;
+    return false;
 }
 
index 98fb79f16a24931389ad977656c918e7e8a49fc2..72802ddd6469a003cdca7f37439ab6474c7ff8f5 100644 (file)
@@ -506,10 +506,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        {
                WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da);
        }
-       if (damage)
-       {
-               MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
-       }
+
+       MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
 
        if (this.health < 1)
        {