mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-10 14:41:57 +00:00
rename methods so _ isn't in their names
This commit is contained in:
parent
17ca25a64a
commit
e281e43e53
9 changed files with 153 additions and 152 deletions
115
fbxa/bot_ai.qc
115
fbxa/bot_ai.qc
|
@ -50,13 +50,13 @@ float stagger_think;
|
|||
/*
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
target_onstack
|
||||
targetOnstack
|
||||
|
||||
checks to see if an entity is on the bot's stack
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(integer)target_onstack:(Target)scot
|
||||
-(integer)targetOnstack:(Target)scot
|
||||
{
|
||||
if (scot == NIL)
|
||||
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
|
||||
LIFO stack, this will be the bot's new target1
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)target_add:(Target)e
|
||||
-(void)targetAdd:(Target)e
|
||||
{
|
||||
if (e == NIL)
|
||||
return;
|
||||
if ([self target_onstack:e])
|
||||
if ([self targetOnstack:e])
|
||||
return;
|
||||
|
||||
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.
|
||||
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:
|
||||
targets[0] = targets[1];
|
||||
targets[1] = targets[2];
|
||||
|
@ -149,7 +149,7 @@ Bot has lost its target.
|
|||
if (!targ)
|
||||
return;
|
||||
|
||||
[self target_drop:targ];
|
||||
[self targetDrop:targ];
|
||||
if (targ.ent.classname == "waypoint")
|
||||
targ.b_sound &= ~b_clientflag;
|
||||
|
||||
|
@ -162,7 +162,7 @@ Bot has lost its target.
|
|||
} else {
|
||||
if (targ.ent.classname == "item_artifact_invisibility")
|
||||
if (ent.items & IT_INVISIBILITY)
|
||||
[self start_topic:3];
|
||||
[self startTopic:3];
|
||||
|
||||
if (targ.ent.flags & FL_ITEM) {
|
||||
/*XXX
|
||||
|
@ -181,14 +181,14 @@ Bot has lost its target.
|
|||
/*
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
bot_check_lost
|
||||
checkLost
|
||||
|
||||
decide if my most immediate target should be
|
||||
removed.
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)check_lost:(Waypoint)targ
|
||||
-(void)checkLost:(Waypoint)targ
|
||||
{
|
||||
local vector dist;
|
||||
|
||||
|
@ -233,7 +233,7 @@ removed.
|
|||
[self walkmove: ent.origin - targ.origin];
|
||||
else {
|
||||
keys &= ~KEY_MOVE;
|
||||
[self start_topic:4];
|
||||
[self startTopic:4];
|
||||
}
|
||||
ent.search_time = time + 5; // never time out
|
||||
} else if (![self canSee:targ])
|
||||
|
@ -250,14 +250,14 @@ removed.
|
|||
if (ent.enemy == targ.ent)
|
||||
ent.enemy = NIL;
|
||||
// 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)) {
|
||||
// trigger_multiple style triggers are lost if their thinktime changes
|
||||
if (targ.ent.nextthink >= time) {
|
||||
[self lost:targ :TRUE];
|
||||
// if (target[0])
|
||||
// bot_get_path (target[0], TRUE);
|
||||
// [self getPath:target[0] :TRUE];
|
||||
}
|
||||
}
|
||||
// lose any target way above the bot's head
|
||||
|
@ -267,10 +267,10 @@ removed.
|
|||
dist_z = 0;
|
||||
if (vlen (dist) < 32)
|
||||
if (ent.flags & FL_ONGROUND)
|
||||
if (![self recognize_plat:FALSE])
|
||||
if (![self recognizePlat:FALSE])
|
||||
[self lost:targ :FALSE];
|
||||
} else if (targ.ent.classname == "train") {
|
||||
if ([self recognize_plat:FALSE])
|
||||
if ([self recognizePlat:FALSE])
|
||||
[self lost:targ :TRUE];
|
||||
}
|
||||
// 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
|
||||
based b_aiflags.
|
||||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)handle_ai
|
||||
-(void)handleAI
|
||||
{
|
||||
local entity newt;
|
||||
local vector v;
|
||||
|
@ -304,7 +304,7 @@ based b_aiflags.
|
|||
if (b_aiflags & AI_DOORFLAG) {
|
||||
// was on a door when spawned
|
||||
// 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)
|
||||
|
||||
if (b_aiflags & AI_DOOR_NO_OPEN) {
|
||||
|
@ -318,11 +318,11 @@ based b_aiflags.
|
|||
newt = find (NIL, target, newt.targetname);
|
||||
if (newt.health > 0) {
|
||||
ent.enemy = newt;
|
||||
[self weapon_switch:1];
|
||||
[self weaponSwitch:1];
|
||||
} else {
|
||||
// target_drop (last_way);
|
||||
[self target_add:newt]; //FIXME newt wrong type
|
||||
// bot_get_path (newt, TRUE);
|
||||
// targetDrop (last_way);
|
||||
[self targetAdd:newt]; //FIXME newt wrong type
|
||||
// [self getPath:newt :TRUE];
|
||||
}
|
||||
}
|
||||
b_aiflags &= ~AI_DOORFLAG;
|
||||
|
@ -340,7 +340,7 @@ based b_aiflags.
|
|||
ent.impulse = 7;
|
||||
else if (ent.flags & FL_ONGROUND) {
|
||||
b_aiflags &= ~AI_SUPER_JUMP;
|
||||
if ([self can_rj]) {
|
||||
if ([self canRJ]) {
|
||||
[self jump];
|
||||
v_angle.x = b_angle.x = 80;
|
||||
ent.button0 = TRUE;
|
||||
|
@ -359,11 +359,11 @@ based b_aiflags.
|
|||
// simple, but effective
|
||||
// this can probably be used for a lot of different
|
||||
// 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
|
||||
keys &= ~KEY_MOVE;
|
||||
} else {
|
||||
if ([self recognize_plat:FALSE]) {
|
||||
if ([self recognizePlat:FALSE]) {
|
||||
v = realorigin (trace_ent) + trace_ent.origin - ent.origin;
|
||||
v_z = 0;
|
||||
if (vlen (v) < 24)
|
||||
|
@ -411,7 +411,7 @@ based b_aiflags.
|
|||
bot_path
|
||||
|
||||
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
|
||||
confused
|
||||
|
||||
|
@ -424,12 +424,12 @@ confused
|
|||
local Waypoint jj, tele;
|
||||
local entity e;
|
||||
|
||||
[self check_lost:targets[0]];
|
||||
[self checkLost:targets[0]];
|
||||
if (!targets[0]) {
|
||||
keys=0;
|
||||
return;
|
||||
}
|
||||
if ([self target_onstack:last_way])
|
||||
if ([self targetOnstack:last_way])
|
||||
return; // old waypoint still being hunted
|
||||
|
||||
jj = [self findRoute:last_way];
|
||||
|
@ -452,12 +452,12 @@ confused
|
|||
// 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);
|
||||
[self target_add:jj];
|
||||
[self targetAdd:jj];
|
||||
if (last_way) {
|
||||
if ([last_way isLinkedTo:jj] == 2) {
|
||||
// waypoints are telelinked
|
||||
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
|
||||
if (trace_fraction != 1) {
|
||||
|
@ -468,17 +468,17 @@ confused
|
|||
trace_ent = trace_ent.owner;
|
||||
if ((trace_ent.health > 0) && (ent.enemy == NIL)) {
|
||||
ent.enemy = trace_ent;
|
||||
[self weapon_switch:1];
|
||||
[self weaponSwitch:1];
|
||||
b_aiflags = b_aiflags | AI_BLIND; // nick knack paddy hack
|
||||
} else if (trace_ent.targetname) {
|
||||
e = find (NIL, target, trace_ent.targetname);
|
||||
if (e.health > 0) {
|
||||
ent.enemy = e;
|
||||
[self weapon_switch:1];
|
||||
[self weaponSwitch:1];
|
||||
} else {
|
||||
// target_drop (jj);
|
||||
[self target_add:e]; //FIXME e wrong type
|
||||
// bot_get_path (tele, TRUE);
|
||||
// targetDrop (jj);
|
||||
[self targetAdd:e]; //FIXME e wrong type
|
||||
// [self getPath:tele :TRUE];
|
||||
b_aiflags |= AI_BLIND; // give a bot a bone
|
||||
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
|
||||
// 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;
|
||||
|
||||
|
@ -601,7 +601,7 @@ the bot finds things it wants to kill/grab.
|
|||
return thisp;
|
||||
}
|
||||
|
||||
-(void)look_for_crap:(integer)scope
|
||||
-(void)lookForCrap:(integer)scope
|
||||
{
|
||||
local entity foe, best = NIL;
|
||||
local float thatp, bestp, dist;
|
||||
|
@ -613,7 +613,7 @@ the bot finds things it wants to kill/grab.
|
|||
|
||||
bestp = 1;
|
||||
while (foe) {
|
||||
thatp = [self priority_for_thing:foe];
|
||||
thatp = [self priorityForThing:foe];
|
||||
if (thatp)
|
||||
if (!scope)
|
||||
if (!sisible (ent, foe))
|
||||
|
@ -627,10 +627,10 @@ the bot finds things it wants to kill/grab.
|
|||
}
|
||||
if (best == NIL)
|
||||
return;
|
||||
if (![self target_onstack:best]) {
|
||||
[self target_add:best]; //FIXME best wrong type
|
||||
if (![self targetOnstack:best]) {
|
||||
[self targetAdd:best]; //FIXME best wrong type
|
||||
if (scope) {
|
||||
[self get_path:best :FALSE];
|
||||
[self getPath:best :FALSE];
|
||||
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
|
||||
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 vector view;
|
||||
|
@ -699,7 +699,8 @@ generally making the bot look good.
|
|||
v_angle.x += 360;
|
||||
while (v_angle.x > 180)
|
||||
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;
|
||||
v_angle = b_angle;
|
||||
while (v_angle.x < -180)
|
||||
|
@ -766,7 +767,7 @@ frame, the ai_time limits it's actual updating
|
|||
return;
|
||||
}
|
||||
if (ent.view_ofs == '0 0 0')
|
||||
[self start_topic:7];
|
||||
[self startTopic:7];
|
||||
stagger_think = time;
|
||||
|
||||
// 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 (busy_waypoints <= 0) {
|
||||
if (waypoint_mode < WM_EDITOR)
|
||||
[self look_for_crap:TRUE];
|
||||
[self lookForCrap:TRUE];
|
||||
}
|
||||
b_aiflags = 0;
|
||||
keys = 0;
|
||||
|
@ -790,8 +791,8 @@ frame, the ai_time limits it's actual updating
|
|||
if (route_failed) {
|
||||
[self roam];
|
||||
route_failed = 0;
|
||||
} else if (![self begin_route]) {
|
||||
[self look_for_crap:FALSE];
|
||||
} else if (![self beginRoute]) {
|
||||
[self lookForCrap:FALSE];
|
||||
}
|
||||
keys = 0;
|
||||
} 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)
|
||||
[self angle_set];
|
||||
// angleSet points the bot at it's goal (ent.enemy or target1)
|
||||
[self angleSet];
|
||||
|
||||
// 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
|
||||
// FIXME
|
||||
if (ent.enemy)
|
||||
[self fight_style];
|
||||
[self fightStyle];
|
||||
else if (random () < 0.2)
|
||||
if (random () < 0.2)
|
||||
[self weapon_switch:-1];
|
||||
[self dodge_stuff];
|
||||
[self weaponSwitch:-1];
|
||||
[self dodgeStuff];
|
||||
|
||||
// checks to see if bot needs to start going up for air
|
||||
if (ent.waterlevel > 2) {
|
||||
|
@ -827,7 +828,7 @@ frame, the ai_time limits it's actual updating
|
|||
|
||||
// b_aiflags handling
|
||||
if (b_aiflags)
|
||||
[self handle_ai];
|
||||
[self handleAI];
|
||||
else
|
||||
[self chat]; // don't want chat to screw him up if he's rjing or something
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ weapon_range =
|
|||
};
|
||||
|
||||
@implementation Bot (Fight)
|
||||
-(float)size_player:(entity)e
|
||||
-(float)sizePlayer:(entity)e
|
||||
{
|
||||
local float sz;
|
||||
|
||||
|
@ -120,7 +120,7 @@ weapon_range =
|
|||
return sz;
|
||||
}
|
||||
|
||||
-(void)dodge_stuff
|
||||
-(void)dodgeStuff
|
||||
{
|
||||
local entity foe;
|
||||
local float foedist, avdist, foesz, flen, tsz;
|
||||
|
@ -134,7 +134,7 @@ weapon_range =
|
|||
if (ent.enemy) {
|
||||
v = ent.origin - realorigin (ent.enemy);
|
||||
foedist = vlen (v);
|
||||
foesz = [self size_player:ent.enemy];
|
||||
foesz = [self sizePlayer:ent.enemy];
|
||||
} else {
|
||||
foedist = 3000;
|
||||
foesz = 9999999;
|
||||
|
@ -184,7 +184,7 @@ weapon_range =
|
|||
if (foe.health > 0) {
|
||||
flen = vlen (foe.origin - ent.origin);
|
||||
if (flen < foedist) {
|
||||
tsz = [self size_player:foe];
|
||||
tsz = [self sizePlayer:foe];
|
||||
if (tsz < foesz) {
|
||||
if ([self canSee:foe]) {
|
||||
ent.enemy = foe;
|
||||
|
@ -210,7 +210,7 @@ weapon_range =
|
|||
if (!(teamplay && ent.team == foe.ent.team)) {
|
||||
flen = vlen (foe.ent.origin - ent.origin);
|
||||
if (flen < foedist) {
|
||||
tsz = [self size_player:foe];
|
||||
tsz = [self sizePlayer:foe];
|
||||
if (tsz < foesz) {
|
||||
/*XXX
|
||||
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
|
||||
*/
|
||||
-(void)weapon_switch:(float)brange
|
||||
-(void)weaponSwitch:(float)brange
|
||||
{
|
||||
local float it, flag = 0, pulse = 0;
|
||||
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
|
||||
attacking an enemy.
|
||||
*/
|
||||
-(void)fight_style
|
||||
-(void)fightStyle
|
||||
{
|
||||
local float foedist, mysz, foesz;
|
||||
local vector v, v1 = '0 0 0', v2 = '0 0 0', org;
|
||||
|
@ -339,16 +339,16 @@ attacking an enemy.
|
|||
[self shoot];
|
||||
}
|
||||
} else
|
||||
[self weapon_switch:foedist];
|
||||
[self weaponSwitch:foedist];
|
||||
|
||||
if (!(b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED))) {
|
||||
foesz = [self size_player:ent.enemy];
|
||||
mysz = [self size_player:self] + 5;
|
||||
foesz = [self sizePlayer:ent.enemy];
|
||||
mysz = [self sizePlayer:self] + 5;
|
||||
|
||||
if (foesz > mysz) {
|
||||
if (teamplay) {
|
||||
if (random () < 0.02) {
|
||||
[self start_topic:5];
|
||||
[self startTopic:5];
|
||||
b_chattime = 1;
|
||||
}
|
||||
}
|
||||
|
@ -380,8 +380,8 @@ attacking an enemy.
|
|||
[self walkmove:v_right * -1];
|
||||
}
|
||||
} else {
|
||||
foesz = [self size_player:ent.enemy];
|
||||
mysz = [self size_player:self] + 5;
|
||||
foesz = [self sizePlayer:ent.enemy];
|
||||
mysz = [self sizePlayer:self] + 5;
|
||||
|
||||
if (foesz > mysz)
|
||||
return;
|
||||
|
|
|
@ -51,7 +51,7 @@ integer bot_move_linker;
|
|||
ent.button2 = TRUE;
|
||||
}
|
||||
|
||||
- (integer) can_rj
|
||||
- (integer) canRJ
|
||||
{
|
||||
// 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
|
||||
|
@ -80,11 +80,11 @@ integer bot_move_linker;
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
- (integer) recognize_plat: (integer) flag
|
||||
- (integer) recognizePlat: (integer) flag
|
||||
{
|
||||
local integer ret;
|
||||
|
||||
ret = [super recognize_plat:flag];
|
||||
ret = [super recognizePlat:flag];
|
||||
if (ret) {
|
||||
if (flag) {
|
||||
// afect bot movement too
|
||||
|
@ -305,7 +305,7 @@ following funtion to move "around" the obstacle
|
|||
|
||||
I have no idea how well it will work
|
||||
*/
|
||||
-(void)dodge_obstruction
|
||||
-(void)dodgeObstruction
|
||||
{
|
||||
local vector way, org;
|
||||
local float oflags, yaw;
|
||||
|
@ -373,8 +373,8 @@ blah
|
|||
keys &= ~KEY_MOVE;
|
||||
keys |= [self keysForDir: way];
|
||||
|
||||
[self dodge_obstruction];
|
||||
[self recognize_plat: TRUE];
|
||||
[self dodgeObstruction];
|
||||
[self recognizePlat: TRUE];
|
||||
|
||||
if (b_aiflags & AI_PRECISION) {
|
||||
g = angcomp (v_angle.x, b_angle.x);
|
||||
|
@ -393,8 +393,8 @@ blah
|
|||
keys &= ~KEY_MOVE;
|
||||
keys |= [self keysForDir: weird];
|
||||
|
||||
[self dodge_obstruction];
|
||||
[self recognize_plat: TRUE];
|
||||
[self dodgeObstruction];
|
||||
[self recognizePlat: TRUE];
|
||||
if (b_aiflags & AI_OBSTRUCTED)
|
||||
return FALSE;
|
||||
else
|
||||
|
|
|
@ -294,7 +294,7 @@ BotConnect =
|
|||
name = [Bot randomName];
|
||||
|
||||
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 (pointcontents (ent.origin) == CONTENT_LAVA)
|
||||
[self start_topic:10];
|
||||
[self startTopic:10];
|
||||
else
|
||||
[self start_topic:9];
|
||||
[self startTopic:9];
|
||||
} else
|
||||
[self start_topic:2];
|
||||
[self startTopic:2];
|
||||
b_frags = ent.frags;
|
||||
}
|
||||
[self dynamicWaypoint];
|
||||
|
|
|
@ -136,7 +136,7 @@ in bot_ai.qc
|
|||
FindRoute, this is a key function in the
|
||||
pathing. The name is a bit misleading, this
|
||||
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
|
||||
an object.
|
||||
|
||||
|
@ -181,7 +181,7 @@ different bot.
|
|||
*/
|
||||
|
||||
|
||||
-(void)mark_path:(entity)this
|
||||
-(void)markPath:(entity)this
|
||||
{
|
||||
local Waypoint t;
|
||||
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
|
||||
calls to begin_route.
|
||||
PLEASE NOTE: getPath replaces the old
|
||||
calls to beginRoute.
|
||||
|
||||
Routing isn't done all at once now, but in two
|
||||
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)
|
||||
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)
|
||||
return;
|
||||
|
@ -268,12 +268,12 @@ Boy it's confusing.
|
|||
if (route_table == self) {
|
||||
if (busy_waypoints <= 0) {
|
||||
route_table = NIL;
|
||||
[self mark_path:this];
|
||||
[self markPath:this];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (direct) {
|
||||
if([self begin_route])
|
||||
if([self beginRoute])
|
||||
direct_route = TRUE;
|
||||
else
|
||||
[self lost:this :FALSE];
|
||||
|
@ -301,7 +301,7 @@ Temporary Marker code
|
|||
[tep setOrigin:org];
|
||||
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 (dyn_plat)
|
||||
return;
|
||||
|
@ -469,7 +469,7 @@ very good all things considered.
|
|||
|
||||
dyn_dest = ent.origin + ent.view_ofs;
|
||||
|
||||
if ([self recognize_plat:FALSE]) {
|
||||
if ([self recognizePlat:FALSE]) {
|
||||
if (trace_ent.classname == "door")
|
||||
t.flags |= AI_DOORFLAG;
|
||||
}
|
||||
|
|
60
fbxa/chat.r
60
fbxa/chat.r
|
@ -101,7 +101,7 @@ b_originator == targ
|
|||
}
|
||||
|
||||
// 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) {
|
||||
b_topic = topic;
|
||||
|
@ -131,27 +131,27 @@ b_originator == targ
|
|||
switch (r) {
|
||||
case 1:
|
||||
[self say:": lo all\n"];
|
||||
[self start_topic:8];
|
||||
[self startTopic:8];
|
||||
break;
|
||||
case 2:
|
||||
[self say:": hey everyone\n"];
|
||||
[self start_topic:8];
|
||||
[self startTopic:8];
|
||||
break;
|
||||
case 3:
|
||||
[self say:": prepare to be fragged!\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 4:
|
||||
[self say:": boy this is laggy\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
case 5:
|
||||
[self say:": #mm getting some lag here\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
default:
|
||||
[self say:": hi everyone\n"];
|
||||
[self start_topic:8];
|
||||
[self startTopic:8];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ b_originator == targ
|
|||
[self say:": eat that\n"];
|
||||
break;
|
||||
}
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
@ -187,7 +187,7 @@ b_originator == targ
|
|||
[self sayTeam:": friendly eyes\n"];
|
||||
else
|
||||
[self sayTeam:": team eyes\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
@ -196,7 +196,7 @@ b_originator == targ
|
|||
[self sayTeam:": on your back\n"];
|
||||
else
|
||||
[self sayTeam:": I'm with you\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
@ -205,7 +205,7 @@ b_originator == targ
|
|||
[self sayTeam:": I need help\n"];
|
||||
else
|
||||
[self sayTeam:": need backup\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
|
@ -213,27 +213,27 @@ b_originator == targ
|
|||
switch (r) {
|
||||
case 1:
|
||||
[self say:": sun got in my eyes\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 2:
|
||||
[self say:": mouse needs cleaning\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 3:
|
||||
[self say:": i meant to do that\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 4:
|
||||
[self say:": lag\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
case 5:
|
||||
[self say:": killer lag\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
default:
|
||||
[self say:": 100% lag\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -259,40 +259,40 @@ b_originator == targ
|
|||
[self say:": hrm\n"];
|
||||
break;
|
||||
}
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 8:
|
||||
if (b_originator != self) {
|
||||
switch (r) {
|
||||
case 1:
|
||||
[self say:": heya\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 2:
|
||||
[self say:": welcome\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 3:
|
||||
[self sayInit];
|
||||
[self say2:": hi "];
|
||||
[self say2:b_originator.ent.netname];
|
||||
[self say2:"\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 5:
|
||||
[self sayInit];
|
||||
[self say2:": hey "];
|
||||
[self say2:b_originator.ent.netname];
|
||||
[self say2:"\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 6:
|
||||
[self say:": howdy\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
default:
|
||||
[self say:": lo\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -367,27 +367,27 @@ b_originator == targ
|
|||
[self say2:": yeah right "];
|
||||
[self say2:b_originator.ent.netname];
|
||||
[self say2:"\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 2:
|
||||
[self say:": ping\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 3:
|
||||
[self say:": shuddup, you're an lpb\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 4:
|
||||
[self say:": lag my eye\n"];
|
||||
[self start_topic:0];
|
||||
[self startTopic:0];
|
||||
break;
|
||||
case 5:
|
||||
[self say:": yeah\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
default:
|
||||
[self say:": totally\n"];
|
||||
[self start_topic:11];
|
||||
[self startTopic:11];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
-(vector)origin;
|
||||
-(integer)canSee:(Target)targ ignoring:(entity)ignore;
|
||||
-(void)setOrigin:(vector) org;
|
||||
-(integer)recognize_plat:(integer)flag;
|
||||
-(integer)recognizePlat:(integer)flag;
|
||||
@end
|
||||
|
||||
@interface Waypoint: Target
|
||||
|
@ -49,7 +49,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
-(integer)teleLinkWay:(Waypoint)way;
|
||||
-(void)unlinkWay:(Waypoint)way;
|
||||
|
||||
-(void)followLink:(Waypoint)e2 :(integer)b_bit;
|
||||
-(void)followLink:(Waypoint)e2 :(integer)bBit;
|
||||
-(void)waypointThink;
|
||||
|
||||
-(void)clearRoute;
|
||||
|
@ -128,37 +128,37 @@ typedef struct bot_data_t bot_data_t;
|
|||
|
||||
@interface Bot (Move)
|
||||
- (void)jump;
|
||||
- (integer)can_rj;
|
||||
- (integer)recognize_plat: (integer) flag;
|
||||
- (integer)canRJ;
|
||||
- (integer)recognizePlat: (integer) flag;
|
||||
- (integer)keysForDir: (vector) sdir;
|
||||
- (void)obstructed: (vector) whichway : (integer) danger;
|
||||
- (void)obstacles;
|
||||
- (void)dodge_obstruction;
|
||||
- (void)dodgeObstruction;
|
||||
- (void)movetogoal;
|
||||
- (integer)walkmove: (vector) weird;
|
||||
- (void)roam;
|
||||
@end
|
||||
|
||||
@interface Bot (AI)
|
||||
-(integer)target_onstack:(Target)scot;
|
||||
-(void)target_add:(Target)e;
|
||||
-(void)target_drop:(Target)e;
|
||||
-(integer)targetOnstack:(Target)scot;
|
||||
-(void)targetAdd:(Target)e;
|
||||
-(void)targetDrop:(Target)e;
|
||||
-(void)lost:(Waypoint)targ :(integer)success;
|
||||
-(void)check_lost:(Waypoint)targ;
|
||||
-(void)handle_ai;
|
||||
-(void)checkLost:(Waypoint)targ;
|
||||
-(void)handleAI;
|
||||
-(void)path;
|
||||
-(float)priority_for_thing:(entity)thing;
|
||||
-(void)look_for_crap:(integer)scope;
|
||||
-(void)angle_set;
|
||||
-(float)priorityForThing:(entity)thing;
|
||||
-(void)lookForCrap:(integer)scope;
|
||||
-(void)angleSet;
|
||||
-(void)AI;
|
||||
@end
|
||||
|
||||
@interface Bot (Fight)
|
||||
-(float)size_player:(entity)e;
|
||||
-(void)dodge_stuff;
|
||||
-(void)weapon_switch:(float)brange;
|
||||
-(float)sizePlayer:(entity)e;
|
||||
-(void)dodgeStuff;
|
||||
-(void)weaponSwitch:(float)brange;
|
||||
-(void)shoot;
|
||||
-(void)fight_style;
|
||||
-(void)fightStyle;
|
||||
@end
|
||||
|
||||
@interface Bot (Way)
|
||||
|
@ -166,9 +166,9 @@ typedef struct bot_data_t bot_data_t;
|
|||
-(void)deleteWaypoint:(Waypoint)what;
|
||||
-(entity)findThing:(string)s;
|
||||
-(Waypoint)findRoute:(Waypoint)lastone;
|
||||
-(void)mark_path:(entity)this;
|
||||
-(void)get_path:(Waypoint)this :(integer)direct;
|
||||
-(integer)begin_route;
|
||||
-(void)markPath:(entity)this;
|
||||
-(void)getPath:(Waypoint)this :(integer)direct;
|
||||
-(integer)beginRoute;
|
||||
-(void)spawnTempWaypoint:(vector)org;
|
||||
-(void)dynamicWaypoint;
|
||||
|
||||
|
@ -176,7 +176,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
@end
|
||||
|
||||
@interface Bot (Chat)
|
||||
-(void)start_topic:(integer)topic;
|
||||
-(void)startTopic:(integer)topic;
|
||||
-(void)say:(string)msg;
|
||||
-(void)say2:(string)msg;
|
||||
-(void)sayTeam:(string)msg;
|
||||
|
|
|
@ -80,7 +80,7 @@ this notice in its entirety.
|
|||
{
|
||||
}
|
||||
|
||||
- (integer) recognize_plat: (integer) flag
|
||||
- (integer) recognizePlat: (integer) flag
|
||||
{
|
||||
local vector org = [self origin];
|
||||
traceline (org, org - '0 0 64', TRUE, ent);
|
||||
|
|
|
@ -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;
|
||||
|
||||
if (flags & b_bit)
|
||||
if (flags & bBit)
|
||||
dist = items;
|
||||
else
|
||||
dist = vlen(origin - e2.origin) + items;
|
||||
|
||||
// check if this is an RJ link
|
||||
if (e2.flags & AI_SUPER_JUMP) {
|
||||
if (![route_table can_rj])
|
||||
if (![route_table canRJ])
|
||||
return;
|
||||
}
|
||||
if (e2.flags & AI_DIFFICULT)
|
||||
|
@ -320,7 +320,7 @@ tripping the runaway loop counter
|
|||
|
||||
if (busy_waypoints <= 0) {
|
||||
if (direct_route) {
|
||||
[route_table get_path:route_table.targets[0] :FALSE];
|
||||
[route_table getPath:route_table.targets[0] :FALSE];
|
||||
direct_route = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue