argc = tokenize_console(strMessage);
// Acquire Command
- local string strCmd;
+ string strCmd;
strCmd = argv(0);
if(strCmd == "hud_configure") { // config hud
// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
{
- local float bSkipKey;
+ float bSkipKey;
bSkipKey = false;
if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
float CSQC_Parse_TempEntity()
{
- local float bHandled;
+ float bHandled;
bHandled = true;
// Acquire TE ID
- local float nTEID;
+ float nTEID;
nTEID = ReadByte();
// NOTE: Could just do return instead of break...
wcross_color = stov(cvar_string(strcat("crosshair_", wcross_wep, "_color")));
else if(autocvar_crosshair_color_by_health)
{
- local float x = getstati(STAT_HEALTH);
+ float x = getstati(STAT_HEALTH);
//x = red
//y = green
if(autocvar_camera_look_player)
{
- local vector dir;
- local float n;
+ vector dir;
+ float n;
dir = normalize(view_origin - current_position);
n = mouse_angles_z;
void() order_menu_render =
{
- local vector ps, po;
- local float i, p, n;
- local string frags, color;
+ vector ps, po;
+ float i, p, n;
+ string frags, color;
ps = '0 200 0';
po = '0 8 0';
float(float bInputType, float nPrimary, float nSecondary) order_menu_action =
{
- local string arg;
- local float p, i, n, chose;
- local string frags, color;
+ string arg;
+ float p, i, n, chose;
+ string frags, color;
if(bInputType != 0) // key down wanted
return FALSE;
void() ctf_menu_render =
{
- local vector ps, po;
+ vector ps, po;
ps = '0 200 0';
po = '0 8 0';
float(float bInputType, float nPrimary, float nSecondary) ctf_menu_action =
{
- local string arg;
+ string arg;
if(bInputType != 0) // key down wanted
return FALSE;
void() ctf_view =
{
- local float stat;
+ float stat;
stat = getstati(STAT_CTF_STATE);
if(stat == CTF_STATE_ATTACK) {
drawpic('0 0 0', "gfx/ctf_ic_atk.tga", '64 64 0', '1 1 1', 1, 0);
mySize -= '2 2 0' * panel_bg_padding;
}
- local float color2;
- local entity tm;
+ float color2;
+ entity tm;
float scale2d, normalsize, bigsize;
float f;
string unescape(string in)
{
- local float i, len;
- local string str, s;
+ float i, len;
+ string str, s;
// but it doesn't seem to be necessary in my tests at least
in = strzone(in);
void wordwrap_cb(string s, float l, void(string) callback)
{
- local string c;
- local float lleft, i, j, wlen;
+ string c;
+ float lleft, i, j, wlen;
s = strzone(s);
lleft = l;
draw_Picture( '0 0 0', strcat( "/", me.texturePath ),
drawSize, '1 1 1', 1.0 );
} else {
- local vector fontsize;
+ vector fontsize;
fontsize_x = fontsize_y = 1.0 / 30.0;
fontsize_z = 0.0;
draw_Text( '0 0 0', _("Browser not initialized!"), fontsize, '1 1 1', 1.0, 0 );
void assault_setenemytoobjective()
{
- local entity objective;
+ entity objective;
for(objective = world; (objective = find(objective, targetname, self.target)); ) {
if(objective.classname == "target_objective") {
if(self.enemy == world)
}
- local entity ent;
+ entity ent;
for(ent = world; (ent = nextent(ent)); )
{
if(clienttype(ent) == CLIENTTYPE_NOTACLIENT)
float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, float shotspeed, float shotspeedupward, float maxtime, float shotdelay, entity ignore)
{
- local float c, savesolid, shottime;
- local vector dir, end, v, o;
+ float c, savesolid, shottime;
+ vector dir, end, v, o;
if (shotspeed < 1)
return FALSE; // could cause division by zero if calculated
if (targ.solid < SOLID_BBOX) // SOLID_NOT and SOLID_TRIGGER
float bot_aimdir(vector v, float maxfiredeviation)
{
- local float dist, delta_t, blend;
- local vector desiredang, diffang;
+ float dist, delta_t, blend;
+ vector desiredang, diffang;
//dprint("aim ", self.netname, ": old:", vtos(self.v_angle));
// make sure v_angle is sane first
//diffang = diffang + randomvec() * (dist * 0.05 * (3.5 - bound(0, skill, 3)));
// turn
- local float r, fixedrate, blendrate;
+ float r, fixedrate, blendrate;
fixedrate = autocvar_bot_ai_aimskill_fixedrate / bound(1,dist,1000);
blendrate = autocvar_bot_ai_aimskill_blendrate;
r = max(fixedrate, blendrate);
float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
{
- local float f, r, hf, distanceratio;
- local vector v;
+ float f, r, hf, distanceratio;
+ vector v;
/*
eprint(self);
dprint("bot_aim(", ftos(shotspeed));
entity bot_spawn()
{
- local entity oldself, bot;
+ entity oldself, bot;
bot = spawnclient();
if (bot)
{
void bot_custom_weapon_priority_setup()
{
- local float tokens, i, c, w;
+ float tokens, i, c, w;
bot_custom_weapon = FALSE;
void bot_endgame()
{
- local entity e;
+ entity e;
//dprint("bot_endgame\n");
e = bot_list;
while (e)
void bot_relinkplayerlist()
{
- local entity e;
- local entity prevbot;
+ entity e;
+ entity prevbot;
player_count = 0;
currentbots = 0;
player_list = e = findchainflags(flags, FL_CLIENT);
void bot_removefromlargestteam()
{
- local float besttime, bestcount, thiscount;
- local entity best, head;
+ float besttime, bestcount, thiscount;
+ entity best, head;
CheckAllowedTeams(world);
GetTeamCounts(world);
head = findchainfloat(isbot, TRUE);
void bot_removenewest()
{
- local float besttime;
- local entity best, head;
+ float besttime;
+ entity best, head;
if(teamplay)
{
else
{
// TODO: Make this check cleaner
- local entity wp = findchain(classname, "waypoint");
+ entity wp = findchain(classname, "waypoint");
if(time - wp.nextthink > 10)
waypoint_save_links();
}
if (botframe_nextdangertime < time)
{
- local float interval;
+ float interval;
interval = autocvar_bot_ai_dangerdetectioninterval;
if (botframe_nextdangertime < time - interval * 1.5)
botframe_nextdangertime = time;
if(self.waterlevel==WATERLEVEL_SWIMMING || self.aistatus & AI_STATUS_OUT_WATER)
{
// Look for the closest waypoint out of water
- local entity newgoal, head;
- local float bestdistance, distance;
+ entity newgoal, head;
+ float bestdistance, distance;
newgoal = world;
bestdistance = 10000;
self.aistatus |= AI_STATUS_ROAMING;
self.aistatus &~= AI_STATUS_ATTACKING;
- local vector now,v,next;//,heading;
- local float aimdistance,skillblend,distanceblend,blend;
+ vector now,v,next;//,heading;
+ float aimdistance,skillblend,distanceblend,blend;
next = now = ( (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5) - (self.origin + self.view_ofs);
aimdistance = vlen(now);
//heading = self.velocity;
void havocbot_keyboard_movement(vector destorg)
{
- local vector keyboard;
- local float blend, maxspeed;
+ vector keyboard;
+ float blend, maxspeed;
float sk;
sk = skill + self.bot_moveskill;
, time);
keyboard = self.movement * (1.0 / maxspeed);
- local float trigger, trigger1;
+ float trigger, trigger1;
blend = bound(0,sk*0.1,1);
trigger = autocvar_bot_ai_keyboard_threshold;
trigger1 = 0 - trigger;
void havocbot_bunnyhop(vector dir)
{
- local float bunnyhopdistance;
- local vector deviation;
- local float maxspeed;
+ float bunnyhopdistance;
+ vector deviation;
+ float maxspeed;
vector gco, gno;
if(autocvar_g_midair)
// for a period of time
if(time - self.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
{
- local float checkdistance;
+ float checkdistance;
checkdistance = TRUE;
// don't run if it is too close
void havocbot_movetogoal()
{
- local vector destorg;
- local vector diff;
- local vector dir;
- local vector flatdir;
- local vector m1;
- local vector m2;
- local vector evadeobstacle;
- local vector evadelava;
- local float s;
- local float maxspeed;
- local vector gco;
- //local float dist;
- local vector dodge;
+ vector destorg;
+ vector diff;
+ vector dir;
+ vector flatdir;
+ vector m1;
+ vector m2;
+ vector evadeobstacle;
+ vector evadelava;
+ float s;
+ float maxspeed;
+ vector gco;
+ //float dist;
+ vector dodge;
//if (self.goalentity)
// te_lightning2(self, self.origin, (self.goalentity.absmin + self.goalentity.absmax) * 0.5);
self.movement = '0 0 0';
{
if(fabs(self.velocity_z)<50)
{
- local entity head, newgoal;
- local float distance, bestdistance;
+ entity head, newgoal;
+ float distance, bestdistance;
for (head = findchain(classname, "waypoint"); head; head = head.chain)
{
else
dir = normalize(( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - self.origin);
- local vector xyvelocity = self.velocity; xyvelocity_z = 0;
- local float xyspeed = xyvelocity * dir;
+ vector xyvelocity = self.velocity; xyvelocity_z = 0;
+ float xyspeed = xyvelocity * dir;
if(xyspeed < (maxspeed / 2))
{
}
// avoiding dangers and obstacles
- local vector dst_ahead, dst_down;
+ vector dst_ahead, dst_down;
makevectors(self.v_angle_y * '0 1 0');
dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3);
dst_down = dst_ahead + '0 0 -1500';
void havocbot_chooseenemy()
{
- local entity head, best, head2;
- local float rating, bestrating, i, hf;
- local vector eye, v;
+ entity head, best, head2;
+ float rating, bestrating, i, hf;
+ vector eye, v;
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
{
self.enemy = world;
// if this weapon is scheduled for reloading, don't switch to it during combat
if (self.weapon_load[new_weapon] < 0)
{
- local float i, other_weapon_available;
+ float i, other_weapon_available;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
// if we are out of ammo for all other weapons, it's an emergency to switch to anything else
void havocbot_chooseweapon()
{
- local float i;
+ float i;
// ;)
if(g_weaponarena == WEPBIT_TUBA)
if(i < 1)
return;
- local float w;
- local float distance; distance=bound(10,vlen(self.origin-self.enemy.origin)-200,10000);
+ float w;
+ float distance; distance=bound(10,vlen(self.origin-self.enemy.origin)-200,10000);
// Should it do a weapon combo?
- local float af, ct, combo_time, combo;
+ float af, ct, combo_time, combo;
af = ATTACK_FINISHED(self);
ct = autocvar_bot_ai_weapon_combo_threshold;
void havocbot_aim()
{
- local vector selfvel, enemyvel;
+ vector selfvel, enemyvel;
// if(self.flags & FL_INWATER)
// return;
if (time < self.nextaim)
float havocbot_moveto(vector pos)
{
- local entity wp;
+ entity wp;
if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
{
debuggoalstack();
// Heading
- local vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
+ vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
dir_z = 0;
bot_aimdir(dir, -1);
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
- local entity head;
- local vector dodge, v, n;
- local float danger, bestdanger, vl, d;
+ entity head;
+ vector dodge, v, n;
+ float danger, bestdanger, vl, d;
dodge = '0 0 0';
bestdanger = -20;
// check for dangerous objects near bot or approaching bot
void havocbot_goalrating_ctf_ourflag(float ratingscale)
{
- local entity head;
+ entity head;
head = ctf_worldflaglist;
while (head)
{
void havocbot_goalrating_ctf_ourbase(float ratingscale)
{
- local entity head;
+ entity head;
head = ctf_worldflaglist;
while (head)
{
void havocbot_goalrating_ctf_enemyflag(float ratingscale)
{
- local entity head;
+ entity head;
head = ctf_worldflaglist;
while (head)
{
return;
}
- local entity head;
+ entity head;
head = havocbot_ctf_find_enemy_flag(self);
void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
{
- local entity mf;
+ entity mf;
mf = havocbot_ctf_find_flag(self);
void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float radius)
{
- local entity head;
+ entity head;
head = ctf_worldflaglist;
while (head)
{
void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
{
- local entity head;
- local float t;
+ entity head;
+ float t;
head = findchainfloat(bot_pickup, TRUE);
while (head)
{
void havocbot_role_ctf_escort()
{
- local entity mf, ef;
+ entity mf, ef;
if(self.deadflag != DEAD_NO)
{
void havocbot_role_ctf_offense()
{
- local entity mf, ef;
- local vector pos;
+ entity mf, ef;
+ vector pos;
if(self.deadflag != DEAD_NO)
{
// Retriever (temporary role):
void havocbot_role_ctf_retriever()
{
- local entity mf;
+ entity mf;
if(self.deadflag != DEAD_NO)
{
if (self.bot_strategytime < time)
{
- local float radius;
+ float radius;
radius = 10000;
self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
void havocbot_role_ctf_middle()
{
- local entity mf;
+ entity mf;
if(self.deadflag != DEAD_NO)
{
if (self.bot_strategytime < time)
{
- local vector org;
+ vector org;
org = havocbot_ctf_middlepoint;
org_z = self.origin_z;
void havocbot_role_ctf_defense()
{
- local entity mf;
+ entity mf;
if(self.deadflag != DEAD_NO)
{
}
if (self.bot_strategytime < time)
{
- local float radius;
- local vector org;
+ float radius;
+ vector org;
org = mf.dropped_origin;
radius = havocbot_ctf_middlepoint_radius;
navigation_goalrating_start();
// if enemies are closer to our base, go there
- local entity head, closestplayer;
- local float distance, bestdistance;
+ entity head, closestplayer;
+ float distance, bestdistance;
distance = 10000;
FOR_EACH_PLAYER(head)
{
void havocbot_ctf_reset_role(entity bot)
{
- local float cdefense, cmiddle, coffense;
- local entity mf, ef, head;
- local float c;
+ float cdefense, cmiddle, coffense;
+ entity mf, ef, head;
+ float c;
if(bot.deadflag != DEAD_NO)
return;
void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius)
{
- local entity head;
+ entity head;
float distance;
FOR_EACH_PLAYER(head)
void havocbot_role_ft_offense()
{
- local entity head;
+ entity head;
float unfrozen;
if(self.deadflag != DEAD_NO)
void havocbot_goalrating_ball(float ratingscale, vector org)
{
- local float t;
- local entity ball_owner;
+ float t;
+ entity ball_owner;
ball_owner = ka_ball.owner;
if (ball_owner == self)
void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
{
- local entity head;
+ entity head;
for (head = kh_worldkeylist; head; head = head.kh_worldkeynext)
{
if(head.owner == self)
void havocbot_chooserole_kh()
{
- local float r;
+ float r;
if(self.deadflag != DEAD_NO)
return;
void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
{
- local entity head;
- local float t, i, c, needarmor, needweapons;
+ entity head;
+ float t, i, c, needarmor, needweapons;
// Needs armor/health?
if(self.health<100)
float havocbot_ons_teamcount(entity bot, float role)
{
- local float c;
- local entity head;
+ float c;
+ entity head;
FOR_EACH_PLAYER(head)
if(head.team==self.team)
float havocbot_goalrating_ons_generator_attack(float ratingscale)
{
- local entity g, wp, bestwp;
- local float found, best;
+ entity g, wp, bestwp;
+ float found, best;
for (g = findchain(classname, "onslaught_generator"); g; g = g.chain)
{
void havocbot_ons_reset_role(entity bot)
{
- local entity head;
- local float c;
+ entity head;
+ float c;
if(self.deadflag != DEAD_NO)
return;
void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
{
- local entity head;
- local entity player;
- local float rating, d, discard, distance, friend_distance, enemy_distance;
+ entity head;
+ entity player;
+ float rating, d, discard, distance, friend_distance, enemy_distance;
vector o;
ratingscale = ratingscale * 0.0001; // items are rated around 10000 already
head = findchainfloat(bot_pickup, TRUE);
void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius)
{
- local entity head;
+ entity head;
head = findchain(classname, "dom_controlpoint");
while (head)
{
void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
{
- local entity head;
- local float t, noteam, distance;
+ entity head;
+ float t, noteam, distance;
noteam = ((self.team == 0) || !teamplay); // fteqcc sucks
if (autocvar_bot_nofire)
float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode)
{
- local vector org;
- local vector move;
- local vector dir;
- local float dist;
- local float totaldist;
- local float stepdist;
- local float yaw;
- local float ignorehazards;
- local float swimming;
+ vector org;
+ vector move;
+ vector dir;
+ float dist;
+ float totaldist;
+ float stepdist;
+ float yaw;
+ float ignorehazards;
+ float swimming;
if(autocvar_bot_debug_tracewalk)
{
traceline( org, move, movemode, e);
if ( trace_ent.classname == "door_rotating" || trace_ent.classname == "door")
{
- local vector nextmove;
+ vector nextmove;
move = trace_endpos;
while(trace_ent.classname == "door_rotating" || trace_ent.classname == "door")
{
// moved successfully
if(swimming)
{
- local float c;
+ float c;
c = pointcontents(org + '0 0 1');
if not(c == CONTENT_WATER || c == CONTENT_LAVA || c == CONTENT_SLIME)
swimming = FALSE;
// find the spawnfunc_waypoint near a dynamic goal such as a dropped weapon
entity navigation_findnearestwaypoint(entity ent, float walkfromwp)
{
- local entity waylist, w, best;
- local float dist, bestdist;
- local vector v, org, pm1, pm2;
+ entity waylist, w, best;
+ float dist, bestdist;
+ vector v, org, pm1, pm2;
pm1 = ent.origin + ent.mins;
pm2 = ent.origin + ent.maxs;
waylist = findchain(classname, "waypoint");
{
if (w.wpisbox)
{
- local vector wm1, wm2;
+ vector wm1, wm2;
wm1 = w.origin + w.mins;
wm2 = w.origin + w.maxs;
v_x = bound(wm1_x, org_x, wm2_x);
// finds the waypoints near the bot initiating a navigation query
float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
{
- local entity head;
- local vector v, m1, m2, diff;
- local float c;
+ entity head;
+ vector v, m1, m2, diff;
+ float c;
// navigation_testtracewalk = TRUE;
c = 0;
head = waylist;
// updates a path link if a spawnfunc_waypoint link is better than the current one
void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p)
{
- local vector m1;
- local vector m2;
- local vector v;
+ vector m1;
+ vector m2;
+ vector v;
if (wp.wpisbox)
{
m1 = wp.absmin;
// queries the entire spawnfunc_waypoint network for pathes leading away from the bot
void navigation_markroutes(entity fixed_source_waypoint)
{
- local entity w, wp, waylist;
- local float searching, cost, cost2;
- local vector p;
+ entity w, wp, waylist;
+ float searching, cost, cost2;
+ vector p;
w = waylist = findchain(classname, "waypoint");
while (w)
{
{
// try a short range search for the nearest waypoints, and expand the search repeatedly if none are found
// as this search is expensive we will use lower values if the bot is on the air
- local float i, increment, maxdistance;
+ float i, increment, maxdistance;
if(self.flags & FL_ONGROUND)
{
increment = 750;
// queries the entire spawnfunc_waypoint network for pathes leading to the bot
void navigation_markroutes_inverted(entity fixed_source_waypoint)
{
- local entity w, wp, waylist;
- local float searching, cost, cost2;
- local vector p;
+ entity w, wp, waylist;
+ float searching, cost, cost2;
+ vector p;
w = waylist = findchain(classname, "waypoint");
while (w)
{
// dprint("jetpack ai: can bridge these two points\n");
// Lower the altitude of these points as much as possible
- local float zdistance, xydistance, cost, t, fuel;
- local vector down, npa, npb;
+ float zdistance, xydistance, cost, t, fuel;
+ vector down, npa, npb;
down = '0 0 -1' * (PL_MAX_z - PL_MIN_z) * 10;
// (this is how bots detect if they reached a goal)
void navigation_poptouchedgoals()
{
- local vector org, m1, m2;
+ vector org, m1, m2;
org = self.origin;
m1 = org + self.mins;
m2 = org + self.maxs;
void botframe_updatedangerousobjects(float maxupdate)
{
- local entity head, bot_dodgelist;
- local vector m1, m2, v, o;
- local float c, d, danger;
+ entity head, bot_dodgelist;
+ vector m1, m2, v, o;
+ float c, d, danger;
c = 0;
bot_dodgelist = findchainfloat(bot_dodge, TRUE);
botframe_dangerwaypoint = find(botframe_dangerwaypoint, classname, "waypoint");
// Debug the goal stack visually
void debuggoalstack()
{
- local entity goal;
- local vector org, go;
+ entity goal;
+ vector org, go;
if(self.goalcounter==0)goal=self.goalcurrent;
else if(self.goalcounter==1)goal=self.goalstack01;
// Returns first bot with matching name
entity find_bot_by_name(string name)
{
- local entity bot;
+ entity bot;
bot = findchainflags(flags, FL_CLIENT);
while (bot)
// Returns a bot by number on list
entity find_bot_by_number(float number)
{
- local entity bot;
- local float c;
+ entity bot;
+ float c;
if(!number)
return world;
float bot_decodecommand(string cmdstring)
{
- local float cmd_parm_type, i;
+ float cmd_parm_type, i;
float sp;
string parm;
void bot_cmdhelp(string scmd)
{
- local float i, ntype;
- local string stype;
+ float i, ntype;
+ string stype;
if(!bot_cmds_initialized)
bot_commands_init();
void bot_list_commands()
{
- local float i;
- local string ptype;
+ float i;
+ string ptype;
if(!bot_cmds_initialized)
bot_commands_init();
float bot_cmd_select_weapon()
{
- local float id;
+ float id;
id = bot_cmd.bot_cmd_parm_float;
float bot_cmd_if()
{
- local string expr, val_a, val_b;
- local float cmpofs;
+ string expr, val_a, val_b;
+ float cmpofs;
if(self.bot_cmd_condition_status != CMD_CONDITION_NONE)
{
// Current direction
if(self.bot_cmd_aim_endtime)
{
- local float progress;
+ float progress;
progress = min(1 - (self.bot_cmd_aim_endtime - time) / (self.bot_cmd_aim_endtime - self.bot_cmd_aim_begintime),1);
self.v_angle = self.bot_cmd_aim_begin + ((self.bot_cmd_aim_end - self.bot_cmd_aim_begin) * progress);
}
// New aiming direction
- local string parms;
- local float tokens, step;
+ string parms;
+ float tokens, step;
parms = bot_cmd.bot_cmd_parm_string;
return bot_cmd_aim();
}
- local entity e;
- local string parms;
- local vector v;
- local float tokens, step;
+ entity e;
+ string parms;
+ vector v;
+ float tokens, step;
parms = bot_cmd.bot_cmd_parm_string;
float bot_cmd_presskey()
{
- local string key;
+ string key;
key = bot_cmd.bot_cmd_parm_string;
float bot_cmd_releasekey()
{
- local string key;
+ string key;
key = bot_cmd.bot_cmd_parm_string;
// NOTE: Of course you need to include your commands here too :)
float bot_execute_commands_once()
{
- local float status, ispressingkey;
+ float status, ispressingkey;
// Find command
bot_setcurrentcommand();
{
if(autocvar_g_debug_bot_commands)
{
- local string parms;
+ string parms;
switch(bot_cmd_parm_type[bot_cmd.bot_cmd_type])
{
// (suitable for spawnfunc_waypoint editor)
entity waypoint_spawn(vector m1, vector m2, float f)
{
- local entity w;
+ entity w;
w = find(world, classname, "waypoint");
if not(f & WAYPOINTFLAG_PERSONAL)
// add a new link to the spawnfunc_waypoint, replacing the furthest link it already has
void waypoint_addlink(entity from, entity to)
{
- local float c;
+ float c;
if (from == to)
return;
{
// if either is a box we have to find the nearest points on them to
// calculate the distance properly
- local vector v1, v2, m1, m2;
+ vector v1, v2, m1, m2;
v1 = from.origin;
m1 = to.absmin;
m2 = to.absmax;
// (SLOW!)
void waypoint_think()
{
- local entity e;
- local vector sv, sm1, sm2, ev, em1, em2, dv;
+ entity e;
+ vector sv, sm1, sm2, ev, em1, em2, dv;
bot_calculate_stepheightvec();
void waypoint_clearlinks(entity wp)
{
// clear links to other waypoints
- local float f;
+ float f;
f = 10000000;
wp.wp00 = wp.wp01 = wp.wp02 = wp.wp03 = wp.wp04 = wp.wp05 = wp.wp06 = wp.wp07 = world;
wp.wp08 = wp.wp09 = wp.wp10 = wp.wp11 = wp.wp12 = wp.wp13 = wp.wp14 = wp.wp15 = world;
// TODO: add some sort of visible box in edit mode for box waypoints
if (autocvar_g_waypointeditor)
{
- local vector m1, m2;
+ vector m1, m2;
m1 = wp.mins;
m2 = wp.maxs;
setmodel(wp, "models/runematch/rune.mdl"); wp.effects = EF_LOWPRECISION;
// empties the map of waypoints
void waypoint_removeall()
{
- local entity head, next;
+ entity head, next;
head = findchain(classname, "waypoint");
while (head)
{
// (is this useful at all?)
void waypoint_schedulerelinkall()
{
- local entity head;
+ entity head;
relink_total = relink_walkculled = relink_pvsculled = relink_lengthculled = 0;
head = findchain(classname, "waypoint");
while (head)
// Load waypoint links from file
float waypoint_load_links()
{
- local string filename, s;
- local float file, tokens, c, found;
- local entity wp_from, wp_to;
- local vector wp_to_pos, wp_from_pos;
+ string filename, s;
+ float file, tokens, c, found;
+ entity wp_from, wp_to;
+ vector wp_to_pos, wp_from_pos;
filename = strcat("maps/", mapname);
filename = strcat(filename, ".waypoints.cache");
file = fopen(filename, FILE_READ);
void waypoint_load_links_hardwired()
{
- local string filename, s;
- local float file, tokens, c, found;
- local entity wp_from, wp_to;
- local vector wp_to_pos, wp_from_pos;
+ string filename, s;
+ float file, tokens, c, found;
+ entity wp_from, wp_to;
+ vector wp_to_pos, wp_from_pos;
filename = strcat("maps/", mapname);
filename = strcat(filename, ".waypoints.hardwired");
file = fopen(filename, FILE_READ);
// Save all waypoint links to a file
void waypoint_save_links()
{
- local string filename, s;
- local float file, c, i;
- local entity w, link;
+ string filename, s;
+ float file, c, i;
+ entity w, link;
filename = strcat("maps/", mapname);
filename = strcat(filename, ".waypoints.cache");
file = fopen(filename, FILE_WRITE);
// save waypoints to gamedir/data/maps/mapname.waypoints
void waypoint_saveall()
{
- local string filename, s;
- local float file, c;
- local entity w;
+ string filename, s;
+ float file, c;
+ entity w;
filename = strcat("maps/", mapname);
filename = strcat(filename, ".waypoints");
file = fopen(filename, FILE_WRITE);
// load waypoints from file
float waypoint_loadall()
{
- local string filename, s;
- local float file, cwp, cwb, fl;
- local vector m1, m2;
+ string filename, s;
+ float file, cwp, cwb, fl;
+ vector m1, m2;
cwp = 0;
cwb = 0;
filename = strcat("maps/", mapname);
void waypoint_spawnforitem_force(entity e, vector org)
{
- local entity w;
+ entity w;
// Fix the waypoint altitude if necessary
org = waypoint_fixorigin(org);
void waypoint_spawnforteleporter_boxes(entity e, vector org1, vector org2, vector destination1, vector destination2, float timetaken)
{
- local entity w;
- local entity dw;
+ entity w;
+ entity dw;
w = waypoint_spawn(org1, org2, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK);
dw = waypoint_spawn(destination1, destination2, WAYPOINTFLAG_GENERATED);
// one way link to the destination
void botframe_showwaypointlinks()
{
- local entity player, head, w;
+ entity player, head, w;
if (time < botframe_waypointeditorlightningtime)
return;
botframe_waypointeditorlightningtime = time + 0.5;
entity head;
float won;
float lost;
- local string savevar;
+ string savevar;
won = 0;
// filter out spots for assault
if(spot.target != "") {
- local entity ent;
+ entity ent;
float good, found;
ent = find(world, targetname, spot.target);
float spawn_allgood;
entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindist, float teamcheck, float anypoint)
{
- local entity spot, spotlist, spotlistend;
+ entity spot, spotlist, spotlistend;
spawn_allgood = TRUE;
spawn_allbad = TRUE;
{
// weight of a point: bound(lower, mindisttoplayer, upper)^exponent
// multiplied by spot.cnt (useful if you distribute many spawnpoints in a small area)
- local entity spot;
+ entity spot;
RandomSelection_Init();
for(spot = firstspot; spot; spot = spot.chain)
*/
entity SelectSpawnPoint (float anypoint)
{
- local float teamcheck;
- local entity firstspot_new;
- local entity spot, firstspot, playerlist;
+ float teamcheck;
+ entity firstspot_new;
+ entity spot, firstspot, playerlist;
spot = find (world, classname, "testplayerstart");
if (spot)
void FixPlayermodel()
{
- local string defaultmodel;
- local float defaultskin, chmdl, oldskin;
- local vector m1, m2;
+ string defaultmodel;
+ float defaultskin, chmdl, oldskin;
+ vector m1, m2;
defaultmodel = "";
// added to the model skins
/*void UpdateColorModHack()
{
- local float c;
+ float c;
c = self.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
if (!teamplay) self.colormod = '0 0 0';
return FALSE; // forced spectators can never join
// TODO simplify this
- local entity e;
+ entity e;
- local float totalClients;
+ float totalClients;
FOR_EACH_CLIENT(e)
totalClients += 1;
if (!autocvar_g_maxplayers)
return maxclients - totalClients + includeMe;
- local float currentlyPlaying;
+ float currentlyPlaying;
FOR_EACH_REALPLAYER(e)
currentlyPlaying += 1;
void ImpulseCommands (void)
{
- local float imp;
+ float imp;
vector org;
float i;
float m;
}
void CheckWaterJump()
{
- local vector start, end;
+ vector start, end;
// check for a jump-out-of-water
makevectors (self.angles);
float speedaward_lastsent;
void SV_PlayerPhysics()
{
- local vector wishvel, wishdir, v;
- local float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod, buttons;
+ vector wishvel, wishdir, v;
+ float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod, buttons;
string temps;
float buttons_prev;
float not_allowed_to_move;
void CopyBody(float keepvelocity)
{
- local entity oldself;
+ entity oldself;
if (self.effects & EF_NODRAW)
return;
oldself = self;
void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- local float take, save;
+ float take, save;
vector v;
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- local float take, save, waves, sdelay, dh, da, j;
+ float take, save, waves, sdelay, dh, da, j;
vector v;
float valid_damage_for_weaponstats;
float excess;
}
// throw off bot aim temporarily
- local float shake;
+ float shake;
shake = damage * 5 / (bound(0,skill,100) + 1);
self.v_angle_x = self.v_angle_x + (random() * 2 - 1) * shake;
self.v_angle_y = self.v_angle_y + (random() * 2 - 1) * shake;
// toss current weapon
void W_ThrowWeapon(vector velo, vector delta, float doreduce)
{
- local float w, wb;
+ float w, wb;
string a;
w = self.weapon;
// call the think code which may fire the weapon
// and do so multiple times to resolve framerate dependency issues if the
// server framerate is very low and the weapon fire rate very high
- local float c;
+ float c;
c = 0;
while (c < W_TICSPERFRAME)
{
void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range)
{
float nudge = 1; // added to traceline target and subtracted from result
- local float oldsolid;
+ float oldsolid;
vector vecs, dv;
oldsolid = ent.dphitcontentsmask;
if(ent.weapon == WEP_RIFLE)
}
self.angles = '0 0 0';
- local float f;
+ float f;
f = 0;
if (self.state == WS_RAISE && !intermission_running)
{
float client_hasweapon(entity cl, float wpn, float andammo, float complain)
{
- local float weaponbit, f;
- local entity oldself;
+ float weaponbit, f;
+ entity oldself;
if(time < self.hasweapon_complain_spam)
complain = 0;
f = f + weapon_action(wpn, WR_CHECKAMMO2);
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
- local entity mine;
+ entity mine;
if(wpn == WEP_MINE_LAYER)
for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
f = 1;
if (!weapon_action(self.weapon, WR_CHECKAMMO1 + secondary))
{
// always keep the Mine Layer if we placed mines, so that we can detonate them
- local entity mine;
+ entity mine;
if(self.weapon == WEP_MINE_LAYER)
for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
return FALSE;
} else if(cmd == "autoswitch") {
// be backwards compatible with older clients (enabled)
self.autoswitch = ("0" != argv(1));
- local string autoswitchmsg;
+ string autoswitchmsg;
if (self.autoswitch) {
autoswitchmsg = "on";
} else {
void ReadyRestartForce()
{
- local entity e;
+ entity e;
bprint("^1Server is restarting...\n");
*/
void ReadyCount()
{
- local entity e;
- local float r, p;
+ entity e;
+ float r, p;
r = p = 0;
//if the map uses a timelimit make sure that timeout cannot be called right before the map ends
if (autocvar_timelimit) {
//a timelimit was used
- local float myTl;
+ float myTl;
myTl = autocvar_timelimit;
- local float lastPossibleTimeout;
+ float lastPossibleTimeout;
lastPossibleTimeout = (myTl*60) - autocvar_sv_timeout_leadtime - 1;
if (lastPossibleTimeout < time - game_starttime)
void DropFlag(entity e, entity penalty_receiver, entity attacker)
{
- local entity p;
+ entity p;
if(e.classname != "item_flag_team")
{
void FlagThink()
{
- local entity e;
+ entity e;
self.nextthink = time + 0.1;
{
if(gameover) return;
- local float t;
- local entity player;
- local string s, s0, h0, h1;
+ float t;
+ entity player;
+ string s, s0, h0, h1;
if (other.classname != "player")
return;
if (other.health < 1) // ignore dead players
// code from here on is just to support maps that don't have control point and team entities
void ctf_spawnteam (string teamname, float teamcolor)
{
- local entity oldself;
+ entity oldself;
oldself = self;
self = spawn();
self.classname = "ctf_team";
self.items &~= IT_BLUE_FLAG_LOST;
self.items &~= IT_CTF_SHIELDED;
- local entity flag;
+ entity flag;
float redflags, blueflags;
if(self.ctf_captureshielded)
void dompoint_captured ()
{
- local entity head;
- local float old_delay, old_team, real_team;
+ entity head;
+ float old_delay, old_team, real_team;
// now that the delay has expired, switch to the latest team to lay claim to this point
head = self.owner;
void dompointthink()
{
- local float fragamt;
+ float fragamt;
self.nextthink = time + 0.1;
void dompointtouch()
{
- local entity head;
+ entity head;
if (other.classname != "player")
return;
if (other.health < 1)
void dom_controlpoint_setup()
{
- local entity head;
+ entity head;
// find the spawnfunc_dom_team representing unclaimed points
head = find(world, classname, "dom_team");
while(head && head.netname != "")
// code from here on is just to support maps that don't have control point and team entities
void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage)
{
- local entity oldself;
+ entity oldself;
oldself = self;
self = spawn();
self.classname = "dom_team";
void dom_spawnpoint(vector org)
{
- local entity oldself;
+ entity oldself;
oldself = self;
self = spawn();
self.classname = "dom_controlpoint";
void dom_delayedinit()
{
- local entity head;
+ entity head;
// if no teams are found, spawn defaults, if custom teams are set, use them
if (find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
entity attach_entcs()
{
- local entity ent;
+ entity ent;
ent = spawn();
ent.classname = "entcs_sender_v2";
//How to use:
/*
// to spawn a bot
- local entity oldself;
+ entity oldself;
oldself = self;
self = spawnclient();
if (!self)
self = oldself;
// to remove all bots
- local entity head;
+ entity head;
head = find(world, classname, "player");
while (head)
{
//"leftarm" (which is a child of "torso") which would return 2 instead...
float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
{
- local string bonename;
+ string bonename;
while (bonenum >= 0)
{
bonename = skel_get_bonename(skel, bonenum);
// apply a different framegroup animation to bones with a specified parent
void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
{
- local float bonenum;
- local float numbones;
+ float bonenum;
+ float numbones;
self.frame = framegroup;
self.frame2 = 0;
self.frame3 = 0;
// make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
{
- local float bonenum;
- local vector ang;
- local vector oldforward, oldright, oldup;
- local vector relforward, relright, relup, relorg;
- local vector boneforward, boneright, boneup, boneorg;
- local vector parentforward, parentright, parentup, parentorg;
- local vector u, v;
- local vector modeleyetarget;
+ float bonenum;
+ vector ang;
+ vector oldforward, oldright, oldup;
+ vector relforward, relright, relup, relorg;
+ vector boneforward, boneright, boneup, boneorg;
+ vector parentforward, parentright, parentup, parentorg;
+ vector u, v;
+ vector modeleyetarget;
bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
if (bonenum < 0)
return;
void func_breakable_look_destroyed()
{
- local float floor_z;
+ float floor_z;
if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
self.dropped_origin = self.origin;
if (gameover || targ.killcount == -666)
return;
- local entity oldself;
+ entity oldself;
oldself = self;
self = targ;
damage_targ = targ;
finaldmg = coredamage * power + edgedamage * (1 - power);
if (finaldmg > 0)
{
- local float a;
- local float c;
- local float hits;
- local float total;
- local float hitratio;
- local vector hitloc;
- local vector myblastorigin;
+ float a;
+ float c;
+ float hits;
+ float total;
+ float hitratio;
+ vector hitloc;
+ vector myblastorigin;
myblastorigin = WarpZone_TransformOrigin(targ, blastorigin);
center = targ.origin + (targ.mins + targ.maxs) * 0.5;
// if it's a player, use the view origin as reference
void FireGrapplingHook (void)
{
- local entity missile;
- local vector org;
+ entity missile;
+ vector org;
float s;
vector vs;
};
void dynlight_find_aiment()
{
- local entity targ;
+ entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
};
void dynlight_find_path()
{
- local entity targ;
+ entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
};
void dynlight_find_target()
{
- local entity targ;
+ entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
*/
void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma, vector v2, float nomonst, entity forent, float lag, float wz)
{
- local entity player;
- local float oldsolid;
+ entity player;
+ float oldsolid;
// check whether antilagged traces are enabled
if (lag < 0.001)
float pnum(float num, float dig)
{
- local float f, i;
+ float f, i;
if (num < 0)
{
WriteChar(MSG_ONE, 173);
y1 = frik_anglemoda(y1);
y2 = frik_anglemoda(y2);
- local float answer;
+ float answer;
answer = y1 - y2;
if (answer > 180)
answer = answer - 360;
*/
void SUB_UseTargets()
{
- local entity t, stemp, otemp, act;
+ entity t, stemp, otemp, act;
string s;
float i;
* players. Also plays reminder sounds.
*/
void timeoutHandler_Think() {
- local entity plr;
+ entity plr;
if (timeoutStatus == 1) {
if (remainingLeadTime > 0) {
//centerprint the information to every player
allowed_to_spawn = TRUE;
- local entity head;
+ entity head;
head = nextent(world);
maxclients = 0;
while(head)
void GotoNextMap()
{
- //local string nextmap;
- //local float n, nummaps;
- //local string s;
+ //string nextmap;
+ //float n, nummaps;
+ //string s;
if (alreadychangedlevel)
return;
alreadychangedlevel = TRUE;
float WinningCondition_Onslaught()
{
entity head;
- local float t1, t2, t3, t4;
+ float t1, t2, t3, t4;
WinningConditionHelper(); // set worldstatus
void assault_new_round();
float WinningCondition_Assault()
{
- local float status;
+ float status;
WinningConditionHelper(); // set worldstatus
SetWinners(team, COLOR_TEAM1);
}
- local entity ent;
+ entity ent;
ent = find(world, classname, "target_assault_roundend");
if(ent)
{
}
else
{
- local entity oldself;
+ entity oldself;
oldself = self;
self = ent;
assault_new_round();
if (argv(0) == "nospectators")
{
blockSpectators = 1;
- local entity plr;
+ entity plr;
FOR_EACH_CLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
{
if(plr.classname == "spectator" || plr.classname == "observer")
if(argv(0) == "bot_cmd")
{
- local entity bot;
+ entity bot;
if(argv(1) == "help")
{
vector randompos(vector m1, vector m2)
{
- local vector v;
+ vector v;
m2 = m2 - m1;
v_x = m2_x * random() + m1_x;
v_y = m2_y * random() + m1_y;
void play2team(float t, string filename)
{
- local entity head;
+ entity head;
if (autocvar_bot_sound_monopoly)
return;
if(autocvar_sv_precacheweapons)
{
//precache weapon models/sounds
- local float wep;
+ float wep;
wep = WEP_FIRST;
while (wep <= WEP_LAST)
{
void ons_throwgib(vector v_from, vector v_to, string smodel, float f_lifetime, float b_burn)
{
- local entity gib;
+ entity gib;
gib = spawn();
void onslaught_updatelinks()
{
- local entity l, links;
- local float stop, t1, t2, t3, t4;
+ entity l, links;
+ float stop, t1, t2, t3, t4;
// first check if the game has ended
dprint("--- updatelinks ---\n");
links = findchain(classname, "onslaught_link");
float overtime_msg_time;
void onslaught_generator_think()
{
- local float d;
- local entity e;
+ float d;
+ entity e;
self.nextthink = ceil(time + 1);
if (!gameover)
{
void onslaught_generator_deaththink()
{
- local vector org;
- local float i;
+ vector org;
+ float i;
if not (self.count)
self.count = 40;
void onslaught_generator_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- local float i;
+ float i;
if (damage <= 0)
return;
if(inWarmupStage)
return;
}
- local entity e;
+ entity e;
precache_model("models/onslaught/generator.md3");
precache_model("models/onslaught/generator_shield.md3");
precache_model("models/onslaught/generator_dmg1.md3");
void onslaught_controlpoint_icon_buildthink()
{
- local entity oself;
+ entity oself;
float a;
self.nextthink = time + sys_frametime;
void onslaught_controlpoint_touch()
{
- local entity e;
+ entity e;
float a;
if (other.classname != "player")
return;
*/
void spawnfunc_onslaught_controlpoint()
{
- local entity e;
+ entity e;
if (!g_onslaught)
{
remove(self);
*/
void() t_movetarget =
{
- local entity temp;
+ entity temp;
if (other.health < 1)
return;
void() monster_wanderpaththink =
{
- local vector v, v1;
- local float b, c;
+ vector v, v1;
+ float b, c;
self.nextthink = time + random() * 10 + 1;
if (self.owner.health < 1) // dead, also handled in death code
{
{
//#NO AUTOCVARS START
#if 0
- local float healthboost;
- local float r;
+ float healthboost;
+ float r;
// monsterbosses cvar or spawnflag 64 causes a monster to be a miniboss
if ((self.spawnflags & 64) || (random() * 100 < cvar("monsterbosspercent")))
*/
float(entity targ) range =
{
- local float r;
+ float r;
r = vlen ((self.origin + self.view_ofs) - (targ.origin + targ.view_ofs));
if (r < 120)
return RANGE_MELEE;
*/
float(entity targ) infront =
{
- local float dot;
+ float dot;
makevectors (self.angles);
dot = normalize (targ.origin - self.origin) * v_forward;
// returns 0 if not infront, or the dotproduct if infront
float(vector dir, entity targ) infront2 =
{
- local float dot;
+ float dot;
dir = normalize(dir);
dot = normalize (targ.origin - self.origin) * dir;
void() ChangeYaw =
{
- local float ideal, move;
+ float ideal, move;
//current_yaw = self.ideal_yaw;
// mod down the current angle
entity() checkplayer =
{
- local entity check;
- local float worldcount;
+ entity check;
+ float worldcount;
// we can just fallback on checkclient if there are no bots
if (!havocbot_list)
return checkclient();
.float findtarget;
float() FindTarget =
{
- local entity client;
- local float r;
+ entity client;
+ float r;
if (self.health < 1)
return FALSE;
*/
void(vector pDestvec) ChooseTurn =
{
- local vector dir, newdir;
+ vector dir, newdir;
dir = self.origin - pDestvec;
*/
float() FacingIdeal =
{
- local float delta;
+ float delta;
delta = anglemod(self.angles_y - self.ideal_yaw);
if (delta > 45 && delta < 315)
*/
void(float dist) ai_run =
{
- local float ofs;
+ float ofs;
if (self.health < 1)
return;
movedist = dist;
*/
float() GenericCheckAttack =
{
- local vector spot1, spot2;
- local entity targ;
- local float chance;
+ vector spot1, spot2;
+ entity targ;
+ float chance;
if (self.health < 1)
return FALSE;
{
if (self.health < 1)
return;
- local vector dtemp;
- local float heading;
+ vector dtemp;
+ float heading;
// aim to the left of the enemy for a flyby
*/
void() ai_melee =
{
- local vector delta;
- local float ldmg;
+ vector delta;
+ float ldmg;
if (self.health < 1)
return;
void() ai_melee_side =
{
- local vector delta;
- local float ldmg;
+ vector delta;
+ float ldmg;
if (self.health < 1)
return;
void() monsterinwall =
{
- local entity e;
+ entity e;
if (!autocvar_developer)
return;
// this is handy for level designers,
void(vector org, float bodydamage, float armordamage, vector force, float damgtype) genericbleedfunc =
{
- local vector v;
+ vector v;
v = '0 0 0' - force * 0.05;
if (armordamage > 0)
te_spark(org, v, armordamage * 3);
void nexball_setstatus (void)
{
- local entity oldself;
+ entity oldself;
self.items &~= IT_KEY1;
if (self.ballcarried)
{
void DropOwner (void)
{
- local entity ownr;
+ entity ownr;
ownr = self.owner;
DropBall(self, ownr.origin, ownr.velocity);
makevectors(ownr.v_angle_y * '0 1 0');
void GiveBall (entity plyr, entity ball)
{
- local entity ownr;
+ entity ownr;
if ((ownr = ball.owner))
{
void nb_spawnteam (string teamname, float teamcolor)
{
dprint("^2spawned team ", teamname, "\n");
- local entity e;
+ entity e;
e = spawn();
e.classname = "nexball_team";
e.netname = teamname;
void W_Nexball_Touch (void)
{
- local entity ball, attacker;
+ entity ball, attacker;
attacker = self.owner;
PROJECTILE_TOUCH;
void W_Nexball_Attack (float t)
{
- local entity ball;
- local float mul, mi, ma;
+ entity ball;
+ float mul, mi, ma;
if (!(ball = self.ballcarried))
return;
void W_Nexball_Attack2 (void)
{
- local entity missile;
+ entity missile;
if (!(balls & BALL_BASKET))
return;
W_SetupShot (self, FALSE, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
*/
void minstagib_items (float itemid)
{
- local float rnd;
+ float rnd;
self.classname = "minstagib";
// replace rocket launchers and nex guns with ammo cells
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht)
{
- local float grav, sdist, zdist, vs, vz, jumpheight;
- local vector sdir, torg;
+ float grav, sdist, zdist, vs, vz, jumpheight;
+ vector sdir, torg;
torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM);
self.pushltime = time + 0.2;
}
- local float ct;
+ float ct;
ct = clienttype(other);
if( ct == CLIENTTYPE_REAL || ct == CLIENTTYPE_BOT)
{
- local float i;
- local float found;
+ float i;
+ float found;
found = FALSE;
for(i = 0; i < other.jumppadcount && i < NUM_JUMPPADSUSED; ++i)
if(other.(jumppadsused[i]) == self)
.vector dest;
void trigger_push_findtarget()
{
- local entity e, t;
- local vector org;
+ entity e, t;
+ vector org;
// first calculate a typical start point for the jump
org = (self.absmin + self.absmax) * 0.5;
void plat_spawn_inside_trigger()
{
- local entity trigger;
- local vector tmin, tmax;
+ entity trigger;
+ vector tmin, tmax;
trigger = spawn();
trigger.touch = plat_center_touch;
void train_next()
{
- local entity targ;
+ entity targ;
targ = find(world, targetname, self.target);
self.enemy = targ;
self.target = targ.target;
void func_train_find()
{
- local entity targ;
+ entity targ;
targ = find(world, targetname, self.target);
self.target = targ.target;
if (!self.target)
.float height;
void func_bobbing_controller_think()
{
- local vector v;
+ vector v;
self.nextthink = time + 0.1;
if not (self.owner.active == ACTIVE_ACTIVE)
*/
void spawnfunc_func_bobbing()
{
- local entity controller;
+ entity controller;
if (self.noise != "")
{
precache_sound(self.noise);
.float freq;
void func_pendulum_controller_think()
{
- local float v;
+ float v;
self.nextthink = time + 0.1;
if not (self.owner.active == ACTIVE_ACTIVE)
void spawnfunc_func_pendulum()
{
- local entity controller;
+ entity controller;
if (self.noise != "")
{
precache_sound(self.noise);
void door_fire()
{
- local entity oself;
- local entity starte;
+ entity oself;
+ entity starte;
if (self.owner != self)
objerror ("door_fire: self.owner != self");
void door_use()
{
- local entity oself;
+ entity oself;
//dprint("door_use (model: ");dprint(self.model);dprint(")\n");
if (self.owner)
void door_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
- local entity oself;
+ entity oself;
if(self.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
entity spawn_field(vector fmins, vector fmaxs)
{
- local entity trigger;
- local vector t1, t2;
+ entity trigger;
+ vector t1, t2;
trigger = spawn();
trigger.classname = "doortriggerfield";
*/
void LinkDoors()
{
- local entity t, starte;
- local vector cmins, cmaxs;
+ entity t, starte;
+ vector cmins, cmaxs;
if (self.enemy)
return; // already linked by another door
void fd_secret_use()
{
- local float temp;
+ float temp;
string message_save;
self.health = 10000;
void func_fourier_controller_think()
{
- local vector v;
+ vector v;
float n, i, t;
self.nextthink = time + 0.1;
void spawnfunc_func_fourier()
{
- local entity controller;
+ entity controller;
if (self.noise != "")
{
precache_sound(self.noise);
self.destvec = self.origin - func_vectormamamam_origin(self.owner, 0);
- local entity controller;
+ entity controller;
controller = spawn();
controller.classname = "func_vectormamamam_controller";
controller.owner = self;
}
string GetClientVersionMessage() {
- local string versionmsg;
+ string versionmsg;
if (self.version_mismatch) {
if(self.version < autocvar_gameversion) {
versionmsg = "^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8";
modifications = strcat(modifications, ", Jet pack");
modifications = substring(modifications, 2, strlen(modifications) - 2);
- local string versionmessage;
+ string versionmessage;
versionmessage = GetClientVersionMessage();
s = strcat("This is Xonotic ", autocvar_g_xonoticversion, "\n", versionmessage);
// code from here on is just to support maps that don't have team entities
void tdm_spawnteam (string teamname, float teamcolor)
{
- local entity e;
+ entity e;
e = spawn();
e.classname = "tdm_team";
e.netname = teamname;
float bforce, float f_dmg, float f_velfactor, float deathtype)
{
- local vector hitloc, force, endpoint, dir;
- local entity ent;
+ vector hitloc, force, endpoint, dir;
+ entity ent;
dir = normalize(end - start);
force = dir * bforce;
void turret_flac_attack()
{
- local entity proj;
+ entity proj;
turret_tag_fire_update();
void turret_hk_attack()
{
- local entity missile;
- //local entity flash2;
+ entity missile;
+ //entity flash2;
sound (self, CH_WEAPON_A, "weapons/rocket_fire.wav", VOL_BASE, ATTN_NORM);
}
float GameCommand_Vote(string s, entity e) {
- local float playercount;
+ float playercount;
float argc;
argc = tokenize_console(s);
if(argv(0) == "help") {
else if(votecalled) {
print_to(e, "^1There is already a vote called.");
} else {
- local string vote;
+ string vote;
vote = VoteParse(s, argc);
if(vote == "") {
print_to(e, "^1Your vote is empty. See 'vhelp' for more info.");
VoteCount(); // needed if you are the only one
msg_entity = e;
- local entity player;
+ entity player;
FOR_EACH_REALCLIENT(player)
{
++playercount;
}
} else if(argv(1) == "do") {
if(!e || e.vote_master) {
- local string dovote;
+ string dovote;
dovote = VoteParse(s, argc);
if(dovote == "") {
print_to(e, "^1Your command was empty. See 'vhelp' for more info.");
print_to(e, "^1You are NOT a master. You might need to login or vote to become master first. See 'vhelp' for more info.");
}
} else if(argv(1) == "login") {
- local string masterpwd;
+ string masterpwd;
masterpwd = autocvar_sv_vote_master_password;
if(masterpwd != "") {
- local float granted;
+ float granted;
granted = (masterpwd == argv(2));
if (e)
e.vote_master = granted;
}
void VoteHelp(entity e) {
- local string vmasterdis;
+ string vmasterdis;
if(!autocvar_sv_vote_master) {
vmasterdis = " ^1(disabled)";
}
- local string vlogindis;
+ string vlogindis;
if("" == autocvar_sv_vote_master_password) {
vlogindis = " ^1(disabled)";
}
- local string vcalldis;
+ string vcalldis;
if(!autocvar_sv_vote_call) {
vcalldis = " ^1(disabled)";
}
}
void VoteReset() {
- local entity player;
+ entity player;
FOR_EACH_CLIENT(player)
{
}
void VoteCount() {
- local float playercount;
+ float playercount;
playercount = 0;
vote_yescount = 0;
vote_nocount = 0;
vote_abstaincount = 0;
- local entity player;
+ entity player;
//same for real players
- local float realplayercount;
- local float realplayeryescount;
- local float realplayernocount;
- local float realplayerabstaincount;
+ float realplayercount;
+ float realplayeryescount;
+ float realplayernocount;
+ float realplayerabstaincount;
realplayercount = realplayernocount = realplayerabstaincount = realplayeryescount = 0;
Nagger_VoteCountChanged();
.vector railgunforce;
void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, float deathtype)
{
- local vector hitloc, force, endpoint, dir;
- local entity ent, endent;
- local float endq3surfaceflags;
+ vector hitloc, force, endpoint, dir;
+ entity ent, endent;
+ float endq3surfaceflags;
float totaldmg;
entity o;
void W_Crylink_Attack (void)
{
- local float counter, shots;
- local entity proj, prevproj, firstproj;
- local vector s;
+ float counter, shots;
+ entity proj, prevproj, firstproj;
+ vector s;
vector forward, right, up;
float maxdmg;
void W_Crylink_Attack2 (void)
{
- local float counter, shots;
- local entity proj, prevproj, firstproj;
+ float counter, shots;
+ entity proj, prevproj, firstproj;
float maxdmg;
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_crylink_secondary_ammo, autocvar_g_balance_crylink_reload_ammo);
void W_Plasma_TriggerCombo(vector org, float rad, entity own)
{
- local entity e;
+ entity e;
e = WarpZone_FindRadius(org, rad, TRUE);
while (e)
{
void W_Electro_Attack()
{
- local entity proj;
+ entity proj;
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_reload_ammo);
void W_Electro_Attack2()
{
- local entity proj;
+ entity proj;
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_electro_secondary_ammo, autocvar_g_balance_electro_reload_ammo);
void W_Fireball_Attack1()
{
- local entity proj;
+ entity proj;
W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", CH_WEAPON_A, autocvar_g_balance_fireball_primary_damage + autocvar_g_balance_fireball_primary_bfgdamage);
void W_Fireball_Attack2()
{
- local entity proj;
+ entity proj;
vector f_diff;
float c;
void W_Grenade_Attack (void)
{
- local entity gren;
+ entity gren;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_reload_ammo);
void W_Grenade_Attack2 (void)
{
- local entity gren;
+ entity gren;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_grenadelauncher_secondary_ammo, autocvar_g_balance_grenadelauncher_reload_ammo);
void W_Hagar_Attack (void)
{
- local entity missile;
+ entity missile;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_primary_ammo, autocvar_g_balance_hagar_reload_ammo);
void W_Hagar_Attack2 (void)
{
- local entity missile;
+ entity missile;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo, autocvar_g_balance_hagar_reload_ammo);
{
// time to release the rockets we've loaded
- local entity missile;
- local float counter, shots, spread_pershot;
- local vector s;
+ entity missile;
+ float counter, shots, spread_pershot;
+ vector s;
vector forward, right, up;
if(!self.hagar_load)
{
// loadable hagar secondary attack, must always run each frame
- local float loaded, enough_ammo;
+ float loaded, enough_ammo;
loaded = self.hagar_load >= autocvar_g_balance_hagar_secondary_load_max;
// this is different than WR_CHECKAMMO when it comes to reloading
}
else if (req == WR_THINK)
{
- local float loadable_secondary;
+ float loadable_secondary;
loadable_secondary = autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary;
if (loadable_secondary)
void W_HLAC_Attack (void)
{
- local entity missile;
+ entity missile;
float spread;
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_reload_ammo);
void W_HLAC_Attack2f (void)
{
- local entity missile;
+ entity missile;
float spread;
spread = autocvar_g_balance_hlac_secondary_spread;
void W_Hook_Attack2()
{
- local entity gren;
+ entity gren;
W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hook_secondary_ammo, FALSE);
W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, autocvar_g_balance_hook_secondary_damage);
void W_Laser_Attack (float issecondary)
{
- local entity missile;
+ entity missile;
vector s_forward;
float a;
float nodamage;
float w_laser(float req)
{
- local float r1;
- local float r2;
+ float r1;
+ float r2;
if (req == WR_AIM)
{
if(autocvar_g_balance_laser_secondary)
void W_Porto_Attack (void)
{
- local entity gren;
+ entity gren;
if not(self.items & IT_UNLIMITED_SUPERWEAPONS)
self.weapons = self.weapons - (self.weapons & WEPBIT_PORTO);
void W_Rocket_Attack (void)
{
- local entity missile;
- local entity flash;
+ entity missile;
+ entity flash;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_rocketlauncher_ammo, autocvar_g_balance_rocketlauncher_reload_ammo);
if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
{
// decide whether to detonate rockets
- local entity missile, targetlist, targ;
- local float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
- local float selfdamage, teamdamage, enemydamage;
+ entity missile, targetlist, targ;
+ float edgedamage, coredamage, edgeradius, recipricoledgeradius, d;
+ float selfdamage, teamdamage, enemydamage;
edgedamage = autocvar_g_balance_rocketlauncher_edgedamage;
coredamage = autocvar_g_balance_rocketlauncher_damage;
edgeradius = autocvar_g_balance_rocketlauncher_radius;
}
missile = find(missile, classname, "rocket");
}
- local float desirabledamage;
+ float desirabledamage;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
targ = targ.chain;
}
}else{
- local float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
+ float distance; distance= bound(300,vlen(self.origin-self.enemy.origin),30000);
//As the distance gets larger, a correct detonation gets near imposible
//Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
if(v_forward * normalize(missile.origin - self.enemy.origin)< 0.1)
void Seeker_Fire_Missile(vector f_diff, entity m_target)
{
- local entity missile;
+ entity missile;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_reload_ammo);
void Seeker_Fire_Flac()
{
- local entity missile;
+ entity missile;
vector f_diff;
float c;
void Seeker_Fire_Tag()
{
- local entity missile;
+ entity missile;
W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_tag_ammo, autocvar_g_balance_seeker_reload_ammo);
W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, autocvar_g_balance_seeker_missile_damage * autocvar_g_balance_seeker_missile_count);
float spread;
float bulletspeed;
float bulletconstant;
- local entity flash;
+ entity flash;
ammoamount = autocvar_g_balance_shotgun_primary_ammo;
bullets = autocvar_g_balance_shotgun_primary_bullets;