-Mon May 22 07:24:10 CEST 2017
+Wed May 31 07:24:24 CEST 2017
"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"
#: 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
#: 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!"
"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"
#: 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:"
#: 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"
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"
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"
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"
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
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"
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;
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
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)
_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
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
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;
}
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;
// 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';
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();
#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)
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);
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;
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;
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
}
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)
{
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)
{
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))
METHOD(EWheel, tr_setup, void(EWheel this, entity it))
{
- entity e;
-
if(it.move_movetype == MOVETYPE_WALK)
{
it.velocity = '0 0 0';
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;
.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)
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;
}
}
#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))
{
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)
{
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
);
// 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)
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()
{
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) \
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);
}
{
//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;
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;
}
**/
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;
**/
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;
}
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;
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;
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;
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)
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);
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;
});
}
-//#define PATHLIB_NODEEXPIRE 0.05
-const float PATHLIB_NODEEXPIRE = 20;
+const float PATHLIB_NODEEXPIRE = 20; // 0.05
void dumpnode(entity n)
{
entity pathlib_mknode(vector where,entity parent)
{
- entity node;
-
- node = pathlib_nodeatpoint(where);
+ entity node = pathlib_nodeatpoint(where);
if(node)
{
#ifdef TURRET_DEBUG
node.owner = openlist;
node.path_prev = parent;
-
setsize(node, '0 0 0', '0 0 0');
setorigin(node, where);
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;
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");
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)
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);
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;
}
else if(best_open_node.pathlib_node_f > node.pathlib_node_f)
best_open_node = node;
- return 1;
+ return true;
}
entity pathlib_getbestopen()
void pathlib_close_node(entity node,vector goal)
{
-
if(node.owner == closedlist)
{
LOG_TRACE("Pathlib: Tried to close a closed node!");
//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);
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;
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();
//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)
{
}
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);
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)
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;
#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);
{
vector surface;
- pathlib_movenode_goodnode = 0;
+ pathlib_movenode_goodnode = false;
end.x = fsnap(end.x, pathlib_gridsize);
end.y = fsnap(end.y, pathlib_gridsize);
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;
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;
}
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);
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);
if(trace_fraction != 1.0)
return trace_endpos;
- pathlib_movenode_goodnode = 1;
+ pathlib_movenode_goodnode = true;
return last_point;
}
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;
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);
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);
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
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
{
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)
{