rename methods so _ isn't in their names

This commit is contained in:
Bill Currie 2003-08-18 16:48:53 +00:00
parent 17ca25a64a
commit e281e43e53
9 changed files with 153 additions and 152 deletions

View file

@ -50,13 +50,13 @@ float stagger_think;
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
target_onstack targetOnstack
checks to see if an entity is on the bot's stack checks to see if an entity is on the bot's stack
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(integer)target_onstack:(Target)scot -(integer)targetOnstack:(Target)scot
{ {
if (scot == NIL) if (scot == NIL)
return FALSE; return FALSE;
@ -75,18 +75,18 @@ checks to see if an entity is on the bot's stack
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
target_add targetAdd
adds a new entity to the stack, since it's a adds a new entity to the stack, since it's a
LIFO stack, this will be the bot's new target1 LIFO stack, this will be the bot's new target1
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)target_add:(Target)e -(void)targetAdd:(Target)e
{ {
if (e == NIL) if (e == NIL)
return; return;
if ([self target_onstack:e]) if ([self targetOnstack:e])
return; return;
targets[3] = targets[2]; targets[3] = targets[2];
@ -99,7 +99,7 @@ LIFO stack, this will be the bot's new target1
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
target_drop targetDrop
Removes an entity from the bot's target stack. Removes an entity from the bot's target stack.
The stack will empty everything up to the object The stack will empty everything up to the object
@ -109,9 +109,9 @@ is gone too.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)target_drop:(Target)e -(void)targetDrop:(Target)e
{ {
switch ([self target_onstack:e]) { switch ([self targetOnstack:e]) {
case 1: case 1:
targets[0] = targets[1]; targets[0] = targets[1];
targets[1] = targets[2]; targets[1] = targets[2];
@ -149,7 +149,7 @@ Bot has lost its target.
if (!targ) if (!targ)
return; return;
[self target_drop:targ]; [self targetDrop:targ];
if (targ.ent.classname == "waypoint") if (targ.ent.classname == "waypoint")
targ.b_sound &= ~b_clientflag; targ.b_sound &= ~b_clientflag;
@ -162,7 +162,7 @@ Bot has lost its target.
} else { } else {
if (targ.ent.classname == "item_artifact_invisibility") if (targ.ent.classname == "item_artifact_invisibility")
if (ent.items & IT_INVISIBILITY) if (ent.items & IT_INVISIBILITY)
[self start_topic:3]; [self startTopic:3];
if (targ.ent.flags & FL_ITEM) { if (targ.ent.flags & FL_ITEM) {
/*XXX /*XXX
@ -181,14 +181,14 @@ Bot has lost its target.
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bot_check_lost checkLost
decide if my most immediate target should be decide if my most immediate target should be
removed. removed.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)check_lost:(Waypoint)targ -(void)checkLost:(Waypoint)targ
{ {
local vector dist; local vector dist;
@ -233,7 +233,7 @@ removed.
[self walkmove: ent.origin - targ.origin]; [self walkmove: ent.origin - targ.origin];
else { else {
keys &= ~KEY_MOVE; keys &= ~KEY_MOVE;
[self start_topic:4]; [self startTopic:4];
} }
ent.search_time = time + 5; // never time out ent.search_time = time + 5; // never time out
} else if (![self canSee:targ]) } else if (![self canSee:targ])
@ -250,14 +250,14 @@ removed.
if (ent.enemy == targ.ent) if (ent.enemy == targ.ent)
ent.enemy = NIL; ent.enemy = NIL;
// if (target[0]) // if (target[0])
// bot_get_path (target[0], TRUE); // [self getPath:target[0] :TRUE];
} }
} else if ((targ.ent.movetype == MOVETYPE_NONE) && (targ.ent.solid == SOLID_TRIGGER)) { } else if ((targ.ent.movetype == MOVETYPE_NONE) && (targ.ent.solid == SOLID_TRIGGER)) {
// trigger_multiple style triggers are lost if their thinktime changes // trigger_multiple style triggers are lost if their thinktime changes
if (targ.ent.nextthink >= time) { if (targ.ent.nextthink >= time) {
[self lost:targ :TRUE]; [self lost:targ :TRUE];
// if (target[0]) // if (target[0])
// bot_get_path (target[0], TRUE); // [self getPath:target[0] :TRUE];
} }
} }
// lose any target way above the bot's head // lose any target way above the bot's head
@ -267,10 +267,10 @@ removed.
dist_z = 0; dist_z = 0;
if (vlen (dist) < 32) if (vlen (dist) < 32)
if (ent.flags & FL_ONGROUND) if (ent.flags & FL_ONGROUND)
if (![self recognize_plat:FALSE]) if (![self recognizePlat:FALSE])
[self lost:targ :FALSE]; [self lost:targ :FALSE];
} else if (targ.ent.classname == "train") { } else if (targ.ent.classname == "train") {
if ([self recognize_plat:FALSE]) if ([self recognizePlat:FALSE])
[self lost:targ :TRUE]; [self lost:targ :TRUE];
} }
// targets are lost if the bot's search time has expired // targets are lost if the bot's search time has expired
@ -281,14 +281,14 @@ removed.
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bot_handle_ai handleAI
This is a 0.10 addition. Handles any action This is a 0.10 addition. Handles any action
based b_aiflags. based b_aiflags.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)handle_ai -(void)handleAI
{ {
local entity newt; local entity newt;
local vector v; local vector v;
@ -304,7 +304,7 @@ based b_aiflags.
if (b_aiflags & AI_DOORFLAG) { if (b_aiflags & AI_DOORFLAG) {
// was on a door when spawned // was on a door when spawned
// if there is nothing there now // if there is nothing there now
if (![last_way recognize_plat:FALSE]) { if (![last_way recognizePlat:FALSE]) {
newt = [self findThing: "door"]; // this is likely the door responsible (crossfingers) newt = [self findThing: "door"]; // this is likely the door responsible (crossfingers)
if (b_aiflags & AI_DOOR_NO_OPEN) { if (b_aiflags & AI_DOOR_NO_OPEN) {
@ -318,11 +318,11 @@ based b_aiflags.
newt = find (NIL, target, newt.targetname); newt = find (NIL, target, newt.targetname);
if (newt.health > 0) { if (newt.health > 0) {
ent.enemy = newt; ent.enemy = newt;
[self weapon_switch:1]; [self weaponSwitch:1];
} else { } else {
// target_drop (last_way); // targetDrop (last_way);
[self target_add:newt]; //FIXME newt wrong type [self targetAdd:newt]; //FIXME newt wrong type
// bot_get_path (newt, TRUE); // [self getPath:newt :TRUE];
} }
} }
b_aiflags &= ~AI_DOORFLAG; b_aiflags &= ~AI_DOORFLAG;
@ -340,7 +340,7 @@ based b_aiflags.
ent.impulse = 7; ent.impulse = 7;
else if (ent.flags & FL_ONGROUND) { else if (ent.flags & FL_ONGROUND) {
b_aiflags &= ~AI_SUPER_JUMP; b_aiflags &= ~AI_SUPER_JUMP;
if ([self can_rj]) { if ([self canRJ]) {
[self jump]; [self jump];
v_angle.x = b_angle.x = 80; v_angle.x = b_angle.x = 80;
ent.button0 = TRUE; ent.button0 = TRUE;
@ -359,11 +359,11 @@ based b_aiflags.
// simple, but effective // simple, but effective
// this can probably be used for a lot of different // this can probably be used for a lot of different
// things, not just trains (door elevators come to mind) // things, not just trains (door elevators come to mind)
if (![last_way recognize_plat:FALSE]) { if (![last_way recognizePlat:FALSE]) {
// if there is nothing there now // if there is nothing there now
keys &= ~KEY_MOVE; keys &= ~KEY_MOVE;
} else { } else {
if ([self recognize_plat:FALSE]) { if ([self recognizePlat:FALSE]) {
v = realorigin (trace_ent) + trace_ent.origin - ent.origin; v = realorigin (trace_ent) + trace_ent.origin - ent.origin;
v_z = 0; v_z = 0;
if (vlen (v) < 24) if (vlen (v) < 24)
@ -411,7 +411,7 @@ based b_aiflags.
bot_path bot_path
Bot will follow a route generated by the Bot will follow a route generated by the
begin_route set of functions in bot_way.qc. beginRoute set of functions in bot_way.qc.
This code, while it works pretty well, can get This code, while it works pretty well, can get
confused confused
@ -424,12 +424,12 @@ confused
local Waypoint jj, tele; local Waypoint jj, tele;
local entity e; local entity e;
[self check_lost:targets[0]]; [self checkLost:targets[0]];
if (!targets[0]) { if (!targets[0]) {
keys=0; keys=0;
return; return;
} }
if ([self target_onstack:last_way]) if ([self targetOnstack:last_way])
return; // old waypoint still being hunted return; // old waypoint still being hunted
jj = [self findRoute:last_way]; jj = [self findRoute:last_way];
@ -452,12 +452,12 @@ confused
// point types are AI flags that should be executed once reaching a waypoint // point types are AI flags that should be executed once reaching a waypoint
b_aiflags = (jj.flags & AI_READAHEAD_TYPES) | (last_way.flags & AI_POINT_TYPES); b_aiflags = (jj.flags & AI_READAHEAD_TYPES) | (last_way.flags & AI_POINT_TYPES);
[self target_add:jj]; [self targetAdd:jj];
if (last_way) { if (last_way) {
if ([last_way isLinkedTo:jj] == 2) { if ([last_way isLinkedTo:jj] == 2) {
// waypoints are telelinked // waypoints are telelinked
tele = [self findThing:"trigger_teleport"].@this; // this is probbly the teleport responsible FIXME shouldn't use @this here tele = [self findThing:"trigger_teleport"].@this; // this is probbly the teleport responsible FIXME shouldn't use @this here
[self target_add:tele]; [self targetAdd:tele];
} }
traceline (last_way.origin, jj.origin, FALSE, ent); // check for blockage traceline (last_way.origin, jj.origin, FALSE, ent); // check for blockage
if (trace_fraction != 1) { if (trace_fraction != 1) {
@ -468,17 +468,17 @@ confused
trace_ent = trace_ent.owner; trace_ent = trace_ent.owner;
if ((trace_ent.health > 0) && (ent.enemy == NIL)) { if ((trace_ent.health > 0) && (ent.enemy == NIL)) {
ent.enemy = trace_ent; ent.enemy = trace_ent;
[self weapon_switch:1]; [self weaponSwitch:1];
b_aiflags = b_aiflags | AI_BLIND; // nick knack paddy hack b_aiflags = b_aiflags | AI_BLIND; // nick knack paddy hack
} else if (trace_ent.targetname) { } else if (trace_ent.targetname) {
e = find (NIL, target, trace_ent.targetname); e = find (NIL, target, trace_ent.targetname);
if (e.health > 0) { if (e.health > 0) {
ent.enemy = e; ent.enemy = e;
[self weapon_switch:1]; [self weaponSwitch:1];
} else { } else {
// target_drop (jj); // targetDrop (jj);
[self target_add:e]; //FIXME e wrong type [self targetAdd:e]; //FIXME e wrong type
// bot_get_path (tele, TRUE); // [self getPath:tele :TRUE];
b_aiflags |= AI_BLIND; // give a bot a bone b_aiflags |= AI_BLIND; // give a bot a bone
return; return;
} }
@ -510,9 +510,9 @@ the bot finds things it wants to kill/grab.
// 30 - 50 bot will consider this a target worth changing course for // 30 - 50 bot will consider this a target worth changing course for
// 50 - 90 bot will hunt these as vital items // 50 - 90 bot will hunt these as vital items
// *!* Make sure you add code to bot_check_lost to remove the target *!* // *!* Make sure you add code to checkLost to remove the target *!*
-(float)priority_for_thing:(entity)thing -(float)priorityForThing:(entity)thing
{ {
local float thisp; local float thisp;
@ -601,7 +601,7 @@ the bot finds things it wants to kill/grab.
return thisp; return thisp;
} }
-(void)look_for_crap:(integer)scope -(void)lookForCrap:(integer)scope
{ {
local entity foe, best = NIL; local entity foe, best = NIL;
local float thatp, bestp, dist; local float thatp, bestp, dist;
@ -613,7 +613,7 @@ the bot finds things it wants to kill/grab.
bestp = 1; bestp = 1;
while (foe) { while (foe) {
thatp = [self priority_for_thing:foe]; thatp = [self priorityForThing:foe];
if (thatp) if (thatp)
if (!scope) if (!scope)
if (!sisible (ent, foe)) if (!sisible (ent, foe))
@ -627,10 +627,10 @@ the bot finds things it wants to kill/grab.
} }
if (best == NIL) if (best == NIL)
return; return;
if (![self target_onstack:best]) { if (![self targetOnstack:best]) {
[self target_add:best]; //FIXME best wrong type [self targetAdd:best]; //FIXME best wrong type
if (scope) { if (scope) {
[self get_path:best :FALSE]; [self getPath:best :FALSE];
b_aiflags |= AI_WAIT; b_aiflags |= AI_WAIT;
} }
} }
@ -639,7 +639,7 @@ the bot finds things it wants to kill/grab.
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bot_angle_set angleSet
Sets the bots look keys & b_angle to point at Sets the bots look keys & b_angle to point at
the target - used for fighting and just the target - used for fighting and just
@ -647,7 +647,7 @@ generally making the bot look good.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)angle_set -(void)angleSet
{ {
local float h; local float h;
local vector view; local vector view;
@ -699,7 +699,8 @@ generally making the bot look good.
v_angle.x += 360; v_angle.x += 360;
while (v_angle.x > 180) while (v_angle.x > 180)
v_angle.x -= 360; v_angle.x -= 360;
} else if ((ent.enemy == NIL || ent.enemy.movetype == MOVETYPE_PUSH) && targets[0].ent.classname != "player") { } else if ((ent.enemy == NIL || ent.enemy.movetype == MOVETYPE_PUSH)
&& targets[0].ent.classname != "player") {
keys &= ~KEY_LOOK; keys &= ~KEY_LOOK;
v_angle = b_angle; v_angle = b_angle;
while (v_angle.x < -180) while (v_angle.x < -180)
@ -766,7 +767,7 @@ frame, the ai_time limits it's actual updating
return; return;
} }
if (ent.view_ofs == '0 0 0') if (ent.view_ofs == '0 0 0')
[self start_topic:7]; [self startTopic:7];
stagger_think = time; stagger_think = time;
// shut the bot's buttons off, various functions will turn them on by AI end // shut the bot's buttons off, various functions will turn them on by AI end
@ -778,7 +779,7 @@ frame, the ai_time limits it's actual updating
if (route_table == self) { if (route_table == self) {
if (busy_waypoints <= 0) { if (busy_waypoints <= 0) {
if (waypoint_mode < WM_EDITOR) if (waypoint_mode < WM_EDITOR)
[self look_for_crap:TRUE]; [self lookForCrap:TRUE];
} }
b_aiflags = 0; b_aiflags = 0;
keys = 0; keys = 0;
@ -790,8 +791,8 @@ frame, the ai_time limits it's actual updating
if (route_failed) { if (route_failed) {
[self roam]; [self roam];
route_failed = 0; route_failed = 0;
} else if (![self begin_route]) { } else if (![self beginRoute]) {
[self look_for_crap:FALSE]; [self lookForCrap:FALSE];
} }
keys = 0; keys = 0;
} else { } else {
@ -800,18 +801,18 @@ frame, the ai_time limits it's actual updating
} }
} }
// bot_angle_set points the bot at it's goal (ent.enemy or target1) // angleSet points the bot at it's goal (ent.enemy or target1)
[self angle_set]; [self angleSet];
// fight my enemy. Enemy is probably a field QC coders will most likely // fight my enemy. Enemy is probably a field QC coders will most likely
// use a lot for their own needs, since it's unused on a normal player // use a lot for their own needs, since it's unused on a normal player
// FIXME // FIXME
if (ent.enemy) if (ent.enemy)
[self fight_style]; [self fightStyle];
else if (random () < 0.2) else if (random () < 0.2)
if (random () < 0.2) if (random () < 0.2)
[self weapon_switch:-1]; [self weaponSwitch:-1];
[self dodge_stuff]; [self dodgeStuff];
// checks to see if bot needs to start going up for air // checks to see if bot needs to start going up for air
if (ent.waterlevel > 2) { if (ent.waterlevel > 2) {
@ -827,7 +828,7 @@ frame, the ai_time limits it's actual updating
// b_aiflags handling // b_aiflags handling
if (b_aiflags) if (b_aiflags)
[self handle_ai]; [self handleAI];
else else
[self chat]; // don't want chat to screw him up if he's rjing or something [self chat]; // don't want chat to screw him up if he's rjing or something
} }

View file

@ -77,7 +77,7 @@ weapon_range =
}; };
@implementation Bot (Fight) @implementation Bot (Fight)
-(float)size_player:(entity)e -(float)sizePlayer:(entity)e
{ {
local float sz; local float sz;
@ -120,7 +120,7 @@ weapon_range =
return sz; return sz;
} }
-(void)dodge_stuff -(void)dodgeStuff
{ {
local entity foe; local entity foe;
local float foedist, avdist, foesz, flen, tsz; local float foedist, avdist, foesz, flen, tsz;
@ -134,7 +134,7 @@ weapon_range =
if (ent.enemy) { if (ent.enemy) {
v = ent.origin - realorigin (ent.enemy); v = ent.origin - realorigin (ent.enemy);
foedist = vlen (v); foedist = vlen (v);
foesz = [self size_player:ent.enemy]; foesz = [self sizePlayer:ent.enemy];
} else { } else {
foedist = 3000; foedist = 3000;
foesz = 9999999; foesz = 9999999;
@ -184,7 +184,7 @@ weapon_range =
if (foe.health > 0) { if (foe.health > 0) {
flen = vlen (foe.origin - ent.origin); flen = vlen (foe.origin - ent.origin);
if (flen < foedist) { if (flen < foedist) {
tsz = [self size_player:foe]; tsz = [self sizePlayer:foe];
if (tsz < foesz) { if (tsz < foesz) {
if ([self canSee:foe]) { if ([self canSee:foe]) {
ent.enemy = foe; ent.enemy = foe;
@ -210,7 +210,7 @@ weapon_range =
if (!(teamplay && ent.team == foe.ent.team)) { if (!(teamplay && ent.team == foe.ent.team)) {
flen = vlen (foe.ent.origin - ent.origin); flen = vlen (foe.ent.origin - ent.origin);
if (flen < foedist) { if (flen < foedist) {
tsz = [self size_player:foe]; tsz = [self sizePlayer:foe];
if (tsz < foesz) { if (tsz < foesz) {
/*XXX /*XXX
if (fov(foe) || foe.b_sound > time || b_skill == 3) { if (fov(foe) || foe.b_sound > time || b_skill == 3) {
@ -231,11 +231,11 @@ weapon_range =
} }
/* /*
bot_weapon_switch weaponSwitch
Pick a weapon based on range / ammo Pick a weapon based on range / ammo
*/ */
-(void)weapon_switch:(float)brange -(void)weaponSwitch:(float)brange
{ {
local float it, flag = 0, pulse = 0; local float it, flag = 0, pulse = 0;
local vector v; local vector v;
@ -302,12 +302,12 @@ Pick a weapon based on range / ammo
} }
/* /*
Bot_fight_style fightStyle
This is the core of the bot's thinking when This is the core of the bot's thinking when
attacking an enemy. attacking an enemy.
*/ */
-(void)fight_style -(void)fightStyle
{ {
local float foedist, mysz, foesz; local float foedist, mysz, foesz;
local vector v, v1 = '0 0 0', v2 = '0 0 0', org; local vector v, v1 = '0 0 0', v2 = '0 0 0', org;
@ -339,16 +339,16 @@ attacking an enemy.
[self shoot]; [self shoot];
} }
} else } else
[self weapon_switch:foedist]; [self weaponSwitch:foedist];
if (!(b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED))) { if (!(b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED))) {
foesz = [self size_player:ent.enemy]; foesz = [self sizePlayer:ent.enemy];
mysz = [self size_player:self] + 5; mysz = [self sizePlayer:self] + 5;
if (foesz > mysz) { if (foesz > mysz) {
if (teamplay) { if (teamplay) {
if (random () < 0.02) { if (random () < 0.02) {
[self start_topic:5]; [self startTopic:5];
b_chattime = 1; b_chattime = 1;
} }
} }
@ -380,8 +380,8 @@ attacking an enemy.
[self walkmove:v_right * -1]; [self walkmove:v_right * -1];
} }
} else { } else {
foesz = [self size_player:ent.enemy]; foesz = [self sizePlayer:ent.enemy];
mysz = [self size_player:self] + 5; mysz = [self sizePlayer:self] + 5;
if (foesz > mysz) if (foesz > mysz)
return; return;

View file

@ -51,7 +51,7 @@ integer bot_move_linker;
ent.button2 = TRUE; ent.button2 = TRUE;
} }
- (integer) can_rj - (integer) canRJ
{ {
// this returns true of the bot can rocket/superjump/hook // this returns true of the bot can rocket/superjump/hook
// if your mod doesn't have an RL you can just return FALSE all the time // if your mod doesn't have an RL you can just return FALSE all the time
@ -80,11 +80,11 @@ integer bot_move_linker;
return FALSE; return FALSE;
} }
- (integer) recognize_plat: (integer) flag - (integer) recognizePlat: (integer) flag
{ {
local integer ret; local integer ret;
ret = [super recognize_plat:flag]; ret = [super recognizePlat:flag];
if (ret) { if (ret) {
if (flag) { if (flag) {
// afect bot movement too // afect bot movement too
@ -305,7 +305,7 @@ following funtion to move "around" the obstacle
I have no idea how well it will work I have no idea how well it will work
*/ */
-(void)dodge_obstruction -(void)dodgeObstruction
{ {
local vector way, org; local vector way, org;
local float oflags, yaw; local float oflags, yaw;
@ -373,8 +373,8 @@ blah
keys &= ~KEY_MOVE; keys &= ~KEY_MOVE;
keys |= [self keysForDir: way]; keys |= [self keysForDir: way];
[self dodge_obstruction]; [self dodgeObstruction];
[self recognize_plat: TRUE]; [self recognizePlat: TRUE];
if (b_aiflags & AI_PRECISION) { if (b_aiflags & AI_PRECISION) {
g = angcomp (v_angle.x, b_angle.x); g = angcomp (v_angle.x, b_angle.x);
@ -393,8 +393,8 @@ blah
keys &= ~KEY_MOVE; keys &= ~KEY_MOVE;
keys |= [self keysForDir: weird]; keys |= [self keysForDir: weird];
[self dodge_obstruction]; [self dodgeObstruction];
[self recognize_plat: TRUE]; [self recognizePlat: TRUE];
if (b_aiflags & AI_OBSTRUCTED) if (b_aiflags & AI_OBSTRUCTED)
return FALSE; return FALSE;
else else

View file

@ -294,7 +294,7 @@ BotConnect =
name = [Bot randomName]; name = [Bot randomName];
bot = [[Bot alloc] initWithEntity: cl named:name skill:whatskill]; bot = [[Bot alloc] initWithEntity: cl named:name skill:whatskill];
[bot start_topic:1]; [bot startTopic:1];
}; };
/* /*
@ -388,11 +388,11 @@ void () BotImpulses =
if (b_frags != ent.frags) { if (b_frags != ent.frags) {
if (b_frags > ent.frags) { if (b_frags > ent.frags) {
if (pointcontents (ent.origin) == CONTENT_LAVA) if (pointcontents (ent.origin) == CONTENT_LAVA)
[self start_topic:10]; [self startTopic:10];
else else
[self start_topic:9]; [self startTopic:9];
} else } else
[self start_topic:2]; [self startTopic:2];
b_frags = ent.frags; b_frags = ent.frags;
} }
[self dynamicWaypoint]; [self dynamicWaypoint];

View file

@ -136,7 +136,7 @@ in bot_ai.qc
FindRoute, this is a key function in the FindRoute, this is a key function in the
pathing. The name is a bit misleading, this pathing. The name is a bit misleading, this
code finds the closest waypoint that is part code finds the closest waypoint that is part
of a route calculated by the begin_route and of a route calculated by the beginRoute and
end_route routines This is a definite path to end_route routines This is a definite path to
an object. an object.
@ -181,7 +181,7 @@ different bot.
*/ */
-(void)mark_path:(entity)this -(void)markPath:(entity)this
{ {
local Waypoint t; local Waypoint t;
local integer flag; local integer flag;
@ -217,10 +217,10 @@ different bot.
/* /*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
begin_route and bot_get_path beginRoute and getPath
PLEASE NOTE: bot_get_path replaces the old PLEASE NOTE: getPath replaces the old
calls to begin_route. calls to beginRoute.
Routing isn't done all at once now, but in two Routing isn't done all at once now, but in two
stages, the bot will calc a route *THEN* stages, the bot will calc a route *THEN*
@ -231,7 +231,7 @@ Boy it's confusing.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(integer)begin_route -(integer)beginRoute
{ {
if (busy_waypoints > 0) if (busy_waypoints > 0)
return FALSE; return FALSE;
@ -260,7 +260,7 @@ Boy it's confusing.
} }
} }
-(void)get_path:(Waypoint)this :(integer)direct -(void)getPath:(Waypoint)this :(integer)direct
{ {
if (this == NIL) if (this == NIL)
return; return;
@ -268,12 +268,12 @@ Boy it's confusing.
if (route_table == self) { if (route_table == self) {
if (busy_waypoints <= 0) { if (busy_waypoints <= 0) {
route_table = NIL; route_table = NIL;
[self mark_path:this]; [self markPath:this];
} }
return; return;
} }
if (direct) { if (direct) {
if([self begin_route]) if([self beginRoute])
direct_route = TRUE; direct_route = TRUE;
else else
[self lost:this :FALSE]; [self lost:this :FALSE];
@ -301,7 +301,7 @@ Temporary Marker code
[tep setOrigin:org]; [tep setOrigin:org];
tep.search_time = 0; tep.search_time = 0;
[self target_add:tep]; [self targetAdd:tep];
} }
/* /*
@ -429,7 +429,7 @@ very good all things considered.
} }
} }
if ([self recognize_plat:FALSE]) { if ([self recognizePlat:FALSE]) {
if (vlen(trace_ent.velocity) > 0) { if (vlen(trace_ent.velocity) > 0) {
if (dyn_plat) if (dyn_plat)
return; return;
@ -469,7 +469,7 @@ very good all things considered.
dyn_dest = ent.origin + ent.view_ofs; dyn_dest = ent.origin + ent.view_ofs;
if ([self recognize_plat:FALSE]) { if ([self recognizePlat:FALSE]) {
if (trace_ent.classname == "door") if (trace_ent.classname == "door")
t.flags |= AI_DOORFLAG; t.flags |= AI_DOORFLAG;
} }

View file

@ -101,7 +101,7 @@ b_originator == targ
} }
// I didn't like the old code so this is very stripped down // I didn't like the old code so this is very stripped down
-(void)start_topic:(integer)topic -(void)startTopic:(integer)topic
{ {
if (random() < 0.2) { if (random() < 0.2) {
b_topic = topic; b_topic = topic;
@ -131,27 +131,27 @@ b_originator == targ
switch (r) { switch (r) {
case 1: case 1:
[self say:": lo all\n"]; [self say:": lo all\n"];
[self start_topic:8]; [self startTopic:8];
break; break;
case 2: case 2:
[self say:": hey everyone\n"]; [self say:": hey everyone\n"];
[self start_topic:8]; [self startTopic:8];
break; break;
case 3: case 3:
[self say:": prepare to be fragged!\n"]; [self say:": prepare to be fragged!\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 4: case 4:
[self say:": boy this is laggy\n"]; [self say:": boy this is laggy\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
case 5: case 5:
[self say:": #mm getting some lag here\n"]; [self say:": #mm getting some lag here\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
default: default:
[self say:": hi everyone\n"]; [self say:": hi everyone\n"];
[self start_topic:8]; [self startTopic:8];
break; break;
} }
} }
@ -178,7 +178,7 @@ b_originator == targ
[self say:": eat that\n"]; [self say:": eat that\n"];
break; break;
} }
[self start_topic:0]; [self startTopic:0];
} }
break; break;
case 3: case 3:
@ -187,7 +187,7 @@ b_originator == targ
[self sayTeam:": friendly eyes\n"]; [self sayTeam:": friendly eyes\n"];
else else
[self sayTeam:": team eyes\n"]; [self sayTeam:": team eyes\n"];
[self start_topic:0]; [self startTopic:0];
} }
break; break;
case 4: case 4:
@ -196,7 +196,7 @@ b_originator == targ
[self sayTeam:": on your back\n"]; [self sayTeam:": on your back\n"];
else else
[self sayTeam:": I'm with you\n"]; [self sayTeam:": I'm with you\n"];
[self start_topic:0]; [self startTopic:0];
} }
break; break;
case 5: case 5:
@ -205,7 +205,7 @@ b_originator == targ
[self sayTeam:": I need help\n"]; [self sayTeam:": I need help\n"];
else else
[self sayTeam:": need backup\n"]; [self sayTeam:": need backup\n"];
[self start_topic:0]; [self startTopic:0];
} }
break; break;
case 6: case 6:
@ -213,27 +213,27 @@ b_originator == targ
switch (r) { switch (r) {
case 1: case 1:
[self say:": sun got in my eyes\n"]; [self say:": sun got in my eyes\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 2: case 2:
[self say:": mouse needs cleaning\n"]; [self say:": mouse needs cleaning\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 3: case 3:
[self say:": i meant to do that\n"]; [self say:": i meant to do that\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 4: case 4:
[self say:": lag\n"]; [self say:": lag\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
case 5: case 5:
[self say:": killer lag\n"]; [self say:": killer lag\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
default: default:
[self say:": 100% lag\n"]; [self say:": 100% lag\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
} }
} }
@ -259,40 +259,40 @@ b_originator == targ
[self say:": hrm\n"]; [self say:": hrm\n"];
break; break;
} }
[self start_topic:0]; [self startTopic:0];
break; break;
case 8: case 8:
if (b_originator != self) { if (b_originator != self) {
switch (r) { switch (r) {
case 1: case 1:
[self say:": heya\n"]; [self say:": heya\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 2: case 2:
[self say:": welcome\n"]; [self say:": welcome\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 3: case 3:
[self sayInit]; [self sayInit];
[self say2:": hi "]; [self say2:": hi "];
[self say2:b_originator.ent.netname]; [self say2:b_originator.ent.netname];
[self say2:"\n"]; [self say2:"\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 5: case 5:
[self sayInit]; [self sayInit];
[self say2:": hey "]; [self say2:": hey "];
[self say2:b_originator.ent.netname]; [self say2:b_originator.ent.netname];
[self say2:"\n"]; [self say2:"\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 6: case 6:
[self say:": howdy\n"]; [self say:": howdy\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
default: default:
[self say:": lo\n"]; [self say:": lo\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
} }
} }
@ -367,27 +367,27 @@ b_originator == targ
[self say2:": yeah right "]; [self say2:": yeah right "];
[self say2:b_originator.ent.netname]; [self say2:b_originator.ent.netname];
[self say2:"\n"]; [self say2:"\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 2: case 2:
[self say:": ping\n"]; [self say:": ping\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 3: case 3:
[self say:": shuddup, you're an lpb\n"]; [self say:": shuddup, you're an lpb\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 4: case 4:
[self say:": lag my eye\n"]; [self say:": lag my eye\n"];
[self start_topic:0]; [self startTopic:0];
break; break;
case 5: case 5:
[self say:": yeah\n"]; [self say:": yeah\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
default: default:
[self say:": totally\n"]; [self say:": totally\n"];
[self start_topic:11]; [self startTopic:11];
break; break;
} }
} }

View file

@ -16,7 +16,7 @@ typedef struct bot_data_t bot_data_t;
-(vector)origin; -(vector)origin;
-(integer)canSee:(Target)targ ignoring:(entity)ignore; -(integer)canSee:(Target)targ ignoring:(entity)ignore;
-(void)setOrigin:(vector) org; -(void)setOrigin:(vector) org;
-(integer)recognize_plat:(integer)flag; -(integer)recognizePlat:(integer)flag;
@end @end
@interface Waypoint: Target @interface Waypoint: Target
@ -49,7 +49,7 @@ typedef struct bot_data_t bot_data_t;
-(integer)teleLinkWay:(Waypoint)way; -(integer)teleLinkWay:(Waypoint)way;
-(void)unlinkWay:(Waypoint)way; -(void)unlinkWay:(Waypoint)way;
-(void)followLink:(Waypoint)e2 :(integer)b_bit; -(void)followLink:(Waypoint)e2 :(integer)bBit;
-(void)waypointThink; -(void)waypointThink;
-(void)clearRoute; -(void)clearRoute;
@ -128,37 +128,37 @@ typedef struct bot_data_t bot_data_t;
@interface Bot (Move) @interface Bot (Move)
- (void)jump; - (void)jump;
- (integer)can_rj; - (integer)canRJ;
- (integer)recognize_plat: (integer) flag; - (integer)recognizePlat: (integer) flag;
- (integer)keysForDir: (vector) sdir; - (integer)keysForDir: (vector) sdir;
- (void)obstructed: (vector) whichway : (integer) danger; - (void)obstructed: (vector) whichway : (integer) danger;
- (void)obstacles; - (void)obstacles;
- (void)dodge_obstruction; - (void)dodgeObstruction;
- (void)movetogoal; - (void)movetogoal;
- (integer)walkmove: (vector) weird; - (integer)walkmove: (vector) weird;
- (void)roam; - (void)roam;
@end @end
@interface Bot (AI) @interface Bot (AI)
-(integer)target_onstack:(Target)scot; -(integer)targetOnstack:(Target)scot;
-(void)target_add:(Target)e; -(void)targetAdd:(Target)e;
-(void)target_drop:(Target)e; -(void)targetDrop:(Target)e;
-(void)lost:(Waypoint)targ :(integer)success; -(void)lost:(Waypoint)targ :(integer)success;
-(void)check_lost:(Waypoint)targ; -(void)checkLost:(Waypoint)targ;
-(void)handle_ai; -(void)handleAI;
-(void)path; -(void)path;
-(float)priority_for_thing:(entity)thing; -(float)priorityForThing:(entity)thing;
-(void)look_for_crap:(integer)scope; -(void)lookForCrap:(integer)scope;
-(void)angle_set; -(void)angleSet;
-(void)AI; -(void)AI;
@end @end
@interface Bot (Fight) @interface Bot (Fight)
-(float)size_player:(entity)e; -(float)sizePlayer:(entity)e;
-(void)dodge_stuff; -(void)dodgeStuff;
-(void)weapon_switch:(float)brange; -(void)weaponSwitch:(float)brange;
-(void)shoot; -(void)shoot;
-(void)fight_style; -(void)fightStyle;
@end @end
@interface Bot (Way) @interface Bot (Way)
@ -166,9 +166,9 @@ typedef struct bot_data_t bot_data_t;
-(void)deleteWaypoint:(Waypoint)what; -(void)deleteWaypoint:(Waypoint)what;
-(entity)findThing:(string)s; -(entity)findThing:(string)s;
-(Waypoint)findRoute:(Waypoint)lastone; -(Waypoint)findRoute:(Waypoint)lastone;
-(void)mark_path:(entity)this; -(void)markPath:(entity)this;
-(void)get_path:(Waypoint)this :(integer)direct; -(void)getPath:(Waypoint)this :(integer)direct;
-(integer)begin_route; -(integer)beginRoute;
-(void)spawnTempWaypoint:(vector)org; -(void)spawnTempWaypoint:(vector)org;
-(void)dynamicWaypoint; -(void)dynamicWaypoint;
@ -176,7 +176,7 @@ typedef struct bot_data_t bot_data_t;
@end @end
@interface Bot (Chat) @interface Bot (Chat)
-(void)start_topic:(integer)topic; -(void)startTopic:(integer)topic;
-(void)say:(string)msg; -(void)say:(string)msg;
-(void)say2:(string)msg; -(void)say2:(string)msg;
-(void)sayTeam:(string)msg; -(void)sayTeam:(string)msg;

View file

@ -80,7 +80,7 @@ this notice in its entirety.
{ {
} }
- (integer) recognize_plat: (integer) flag - (integer) recognizePlat: (integer) flag
{ {
local vector org = [self origin]; local vector org = [self origin];
traceline (org, org - '0 0 64', TRUE, ent); traceline (org, org - '0 0 64', TRUE, ent);

View file

@ -263,18 +263,18 @@ tripping the runaway loop counter
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/ */
-(void)followLink:(Waypoint)e2 :(integer)b_bit -(void)followLink:(Waypoint)e2 :(integer)bBit
{ {
local float dist; local float dist;
if (flags & b_bit) if (flags & bBit)
dist = items; dist = items;
else else
dist = vlen(origin - e2.origin) + items; dist = vlen(origin - e2.origin) + items;
// check if this is an RJ link // check if this is an RJ link
if (e2.flags & AI_SUPER_JUMP) { if (e2.flags & AI_SUPER_JUMP) {
if (![route_table can_rj]) if (![route_table canRJ])
return; return;
} }
if (e2.flags & AI_DIFFICULT) if (e2.flags & AI_DIFFICULT)
@ -320,7 +320,7 @@ tripping the runaway loop counter
if (busy_waypoints <= 0) { if (busy_waypoints <= 0) {
if (direct_route) { if (direct_route) {
[route_table get_path:route_table.targets[0] :FALSE]; [route_table getPath:route_table.targets[0] :FALSE];
direct_route = FALSE; direct_route = FALSE;
} }
} }