mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-24 21:02:06 +00:00
Various compile fixes for the new qfcc.
This commit is contained in:
parent
a8fab74a2c
commit
7d1f271764
58 changed files with 468 additions and 411 deletions
|
@ -5,7 +5,7 @@ SRC= buttons.r builtins.r client.r combat.r defs.r doors.r dynlight.r \
|
|||
|
||||
HEADERS = client.rh paroxysm.rh config.rh
|
||||
|
||||
RFLAGS += -DQUAKEWORLD -Wall -Werror -g
|
||||
RFLAGS += -DQUAKEWORLD -Wall -Werror -g -Cvector-components
|
||||
QFCC = qfcc
|
||||
|
||||
INSTALLDIR = $(HOME)/.quake/paroxysm/
|
||||
|
|
|
@ -103,6 +103,7 @@ entity() FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil;
|
||||
};
|
||||
|
||||
void() GotoNextMap =
|
||||
|
@ -385,6 +386,7 @@ float(entity e) ValidateUser =
|
|||
}
|
||||
return true;
|
||||
*/
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -83,7 +83,7 @@ void (entity targ, entity attacker) Killed =
|
|||
ClientObituary (@self, attacker);
|
||||
|
||||
@self.takedamage = DAMAGE_NO;
|
||||
@self.touch = NIL;
|
||||
@self.touch = nil;
|
||||
@self.effects = 0;
|
||||
|
||||
/*SERVER
|
||||
|
|
|
@ -403,9 +403,9 @@ weapon_touch
|
|||
|
||||
void() weapon_touch =
|
||||
{
|
||||
local float hadammo, best, new = NIL, old;
|
||||
local float hadammo, best, new = nil, old;
|
||||
local entity stemp;
|
||||
local float leave = NIL;
|
||||
local float leave = nil;
|
||||
// For client weapon_switch
|
||||
local float w_switch;
|
||||
if (!(other.flags & FL_CLIENT))
|
||||
|
@ -1218,7 +1218,7 @@ void() Spawn_QuadCore =
|
|||
@self.quadcore = qcore;
|
||||
|
||||
qcore.nextthink = time + 999999999;
|
||||
qcore.think = NIL;
|
||||
qcore.think = nil;
|
||||
};
|
||||
|
||||
/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
|
||||
|
|
|
@ -21,6 +21,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
@self.angles = '0 0 0';
|
||||
return nil;
|
||||
};
|
||||
/*
|
||||
================
|
||||
|
|
|
@ -54,7 +54,7 @@ void() multi_trigger =
|
|||
// we can't just remove (@self) here, because this is a touch function
|
||||
// called wheil C code is looping through area links...
|
||||
|
||||
@self.touch = NIL;
|
||||
@self.touch = nil;
|
||||
@self.nextthink = time + 0.1;
|
||||
@self.think = SUB_Remove;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void () brik_touch =
|
|||
if (@self.velocity == '0 0 0') {
|
||||
@self.avelocity = '0 0 0';
|
||||
@self.solid = SOLID_NOT;
|
||||
@self.touch = NIL;
|
||||
@self.touch = nil;
|
||||
@self.think = SUB_Remove;
|
||||
@self.nextthink = time + (2 * random());
|
||||
return;
|
||||
|
|
|
@ -1069,7 +1069,7 @@ W_ChangeWeapon
|
|||
void() W_ChangeWeapon =
|
||||
{
|
||||
local float no_ammo = 0;
|
||||
local float selected = NIL;
|
||||
local float selected = nil;
|
||||
|
||||
@self.which_ammo = 0; // Default ammo to shells for SuperShotgun
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: qwprogs.dat
|
||||
qwprogs.dat: progs.src *.qc
|
||||
qfcc -Werror -Wall -g --advanced
|
||||
qfcc -Cvector-components -Werror -Wall -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h
|
||||
|
|
|
@ -213,6 +213,7 @@ FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil; //FIXME need no return
|
||||
};
|
||||
|
||||
void ()
|
||||
|
@ -488,6 +489,7 @@ ValidateUser =
|
|||
|
||||
return true;
|
||||
*/
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -47,6 +47,7 @@ SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return nil;
|
||||
};
|
||||
|
||||
void ()
|
||||
|
|
|
@ -220,6 +220,7 @@ entity() FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return world; //FIXME need noreturn
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return '0 0 0';
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -366,6 +366,7 @@ float(float color) TeamColorIsLegal =
|
|||
return TRUE;
|
||||
if( (color == TEAM_COLOR2) && (TEAM_COLOR2 >= 0) )
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
float(float t) TeamGetShirt =
|
||||
|
|
|
@ -57,9 +57,9 @@ checks to see if an entity is on the bot's stack
|
|||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(integer)targetOnstack:(Target)scot
|
||||
-(integer)targetOnstack:(Target *)scot
|
||||
{
|
||||
if (scot == NIL)
|
||||
if (scot == nil)
|
||||
return FALSE;
|
||||
else if (targets[0] == scot)
|
||||
return 1;
|
||||
|
@ -83,9 +83,9 @@ LIFO stack, this will be the bot's new targets[0]
|
|||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)targetAdd:(Target)e
|
||||
-(void)targetAdd:(Target *)e
|
||||
{
|
||||
if (e == NIL)
|
||||
if (e == nil)
|
||||
return;
|
||||
if ([self targetOnstack:e])
|
||||
return;
|
||||
|
@ -110,26 +110,26 @@ is gone too.
|
|||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)targetDrop:(Target)e
|
||||
-(void)targetDrop:(Target *)e
|
||||
{
|
||||
switch ([self targetOnstack:e]) {
|
||||
case 1:
|
||||
targets[0] = targets[1];
|
||||
targets[1] = targets[2];
|
||||
targets[2] = targets[3];
|
||||
targets[3] = NIL;
|
||||
targets[3] = nil;
|
||||
break;
|
||||
case 2:
|
||||
targets[0] = targets[2];
|
||||
targets[1] = targets[3];
|
||||
targets[2] = targets[3] = NIL;
|
||||
targets[2] = targets[3] = nil;
|
||||
break;
|
||||
case 3:
|
||||
targets[0] = targets[3];
|
||||
targets[1] = targets[2] = targets[3] = NIL;
|
||||
targets[1] = targets[2] = targets[3] = nil;
|
||||
break;
|
||||
case 4:
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = NIL;
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = nil;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ is gone too.
|
|||
|
||||
-(void)targetClearAll
|
||||
{
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = NIL;
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = nil;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -150,18 +150,18 @@ Bot has lost its target.
|
|||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)lost:(Target)targ :(integer)success
|
||||
-(void)lost:(Target *)targ :(integer)success
|
||||
{
|
||||
if (!targ)
|
||||
return;
|
||||
|
||||
[self targetDrop:targ];
|
||||
if ([targ classname] == "waypoint")
|
||||
[(Waypoint)targ clearRouteForBot:self];
|
||||
[(Waypoint *)targ clearRouteForBot:self];
|
||||
|
||||
// find a new route
|
||||
if (!success) {
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = NIL;
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = nil;
|
||||
last_way = [self findWaypoint:current_way];
|
||||
[Waypoint clearMyRoute:self];
|
||||
b_aiflags = 0;
|
||||
|
@ -172,7 +172,7 @@ Bot has lost its target.
|
|||
|
||||
if (targ.ent.flags & FL_ITEM) {
|
||||
if (!targ.ent.model)
|
||||
targ._last = NIL;
|
||||
targ._last = nil;
|
||||
else
|
||||
targ._last = self;
|
||||
}
|
||||
|
@ -192,19 +192,19 @@ removed.
|
|||
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
-(void)checkLost:(Target)targ
|
||||
-(void)checkLost:(Target *)targ
|
||||
{
|
||||
local vector dist;
|
||||
|
||||
if (targ == NIL)
|
||||
if (targ == nil)
|
||||
return;
|
||||
|
||||
dist = [targ realorigin] - ent.origin;
|
||||
dist_z = 0;
|
||||
dist.z = 0;
|
||||
|
||||
// waypoints and items are lost if you get close enough to them
|
||||
if ([targ isKindOfClass:[Waypoint class]]) {
|
||||
local Waypoint way = (Waypoint) targ;
|
||||
local Waypoint *way = (Waypoint *) targ;
|
||||
if ([way classname] == "waypoint") {
|
||||
if (!(b_aiflags & (AI_SNIPER | AI_AMBUSH))) {
|
||||
if (b_aiflags & AI_RIDE_TRAIN) {
|
||||
|
@ -222,7 +222,7 @@ removed.
|
|||
[self lost:way :TRUE];
|
||||
}
|
||||
} else if ([targ isKindOfClass:[Bot class]]) {
|
||||
local Bot bot = (Bot) targ;
|
||||
local Bot *bot = (Bot *) targ;
|
||||
if (bot.ent.health <= 0)
|
||||
[self lost:bot :TRUE];
|
||||
else if ((coop) || (teamplay && bot.ent.team == ent.team)) {
|
||||
|
@ -258,7 +258,7 @@ removed.
|
|||
if (targ.ent.frame) {
|
||||
[self lost:targ :TRUE];
|
||||
if (ent.enemy == targ.ent)
|
||||
ent.enemy = NIL;
|
||||
ent.enemy = nil;
|
||||
// if (target[0])
|
||||
// [self getPath:target[0] :TRUE];
|
||||
}
|
||||
|
@ -275,9 +275,9 @@ removed.
|
|||
}
|
||||
// lose any target way above the bot's head
|
||||
// FIXME: if the bot can fly in your mod..
|
||||
if ((targ.ent.origin_z - ent.origin_z) > 64) {
|
||||
if ((targ.ent.origin.z - ent.origin.z) > 64) {
|
||||
dist = targ.ent.origin - ent.origin;
|
||||
dist_z = 0;
|
||||
dist.z = 0;
|
||||
if (vlen (dist) < 32)
|
||||
if (ent.flags & FL_ONGROUND)
|
||||
if (![self recognizePlat:FALSE])
|
||||
|
@ -328,7 +328,7 @@ based b_aiflags.
|
|||
}
|
||||
} else {
|
||||
if (newt.targetname) {
|
||||
newt = find (NIL, target, newt.targetname);
|
||||
newt = find (nil, target, newt.targetname);
|
||||
if (newt.health > 0) {
|
||||
ent.enemy = newt;
|
||||
[self weaponSwitch:1];
|
||||
|
@ -355,7 +355,7 @@ based b_aiflags.
|
|||
b_aiflags &= ~AI_SUPER_JUMP;
|
||||
if ([self canRJ]) {
|
||||
[self jump];
|
||||
ent.v_angle_x = b_angle.x = 80;
|
||||
ent.v_angle.x = b_angle.x = 80;
|
||||
buttons |= 1;
|
||||
} else
|
||||
[self lost: targets[0] :FALSE];
|
||||
|
@ -378,7 +378,7 @@ based b_aiflags.
|
|||
} else {
|
||||
if ([self recognizePlat:FALSE]) {
|
||||
v = realorigin (trace_ent) + trace_ent.origin - ent.origin;
|
||||
v_z = 0;
|
||||
v.z = 0;
|
||||
if (vlen (v) < 24)
|
||||
keys &= ~KEY_MOVE;
|
||||
else {
|
||||
|
@ -392,7 +392,7 @@ based b_aiflags.
|
|||
newt = [self findThing:"plat"];
|
||||
if (newt.state != 1) {
|
||||
v = ent.origin - realorigin (newt);
|
||||
v_z = 0;
|
||||
v.z = 0;
|
||||
if (vlen (v) > 96)
|
||||
keys &= ~KEY_MOVE;
|
||||
else
|
||||
|
@ -434,7 +434,7 @@ confused
|
|||
-(void)path
|
||||
{
|
||||
|
||||
local Waypoint jj;
|
||||
local Waypoint *jj;
|
||||
local entity e, tele;
|
||||
|
||||
[self checkLost:targets[0]];
|
||||
|
@ -480,12 +480,12 @@ confused
|
|||
// linked doors fix
|
||||
if (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;
|
||||
[self weaponSwitch:1];
|
||||
b_aiflags |= AI_BLIND; // nick knack paddy hack
|
||||
} else if (trace_ent.targetname) {
|
||||
e = find (NIL, target, trace_ent.targetname);
|
||||
e = find (nil, target, trace_ent.targetname);
|
||||
if (e.health > 0) {
|
||||
ent.enemy = e;
|
||||
[self weaponSwitch:1];
|
||||
|
@ -525,7 +525,7 @@ the bot finds things it wants to kill/grab.
|
|||
// 50 - 90 bot will hunt these as vital items
|
||||
|
||||
// *!* Make sure you add code to checkLost to remove the target *!*
|
||||
-(integer)priority:(Bot)bot
|
||||
-(integer)priority:(Bot *)bot
|
||||
{
|
||||
local integer p;
|
||||
|
||||
|
@ -551,7 +551,7 @@ the bot finds things it wants to kill/grab.
|
|||
return p;
|
||||
}
|
||||
|
||||
-(integer)priorityForThing:(Target)thing
|
||||
-(integer)priorityForThing:(Target *)thing
|
||||
{
|
||||
local integer p;
|
||||
// This is the most executed function in the bot. Careful what you do here.
|
||||
|
@ -572,8 +572,8 @@ the bot finds things it wants to kill/grab.
|
|||
|
||||
-(void)lookForCrap:(integer)scope
|
||||
{
|
||||
local Target foe, best = NIL;
|
||||
local Waypoint way;
|
||||
local Target *foe, *best = nil;
|
||||
local Waypoint *way;
|
||||
local integer thatp, bestp;
|
||||
local float radius;
|
||||
|
||||
|
@ -604,7 +604,7 @@ the bot finds things it wants to kill/grab.
|
|||
thatp = [self priorityForThing:way];
|
||||
if (thatp)
|
||||
if (!scope)
|
||||
if (!sisible (ent, NIL, way.origin))
|
||||
if (!sisible (ent, nil, way.origin))
|
||||
thatp = 0;
|
||||
if (thatp > bestp) {
|
||||
bestp = thatp;
|
||||
|
@ -613,7 +613,7 @@ the bot finds things it wants to kill/grab.
|
|||
way = way.chain;
|
||||
}
|
||||
|
||||
if (best == NIL)
|
||||
if (best == nil)
|
||||
return;
|
||||
if (![self targetOnstack:best]) {
|
||||
[self targetAdd:best];
|
||||
|
@ -665,7 +665,7 @@ generally making the bot look good.
|
|||
view = normalize (view - ent.origin);
|
||||
}
|
||||
view = vectoangles (view);
|
||||
view_x = view_x * -1;
|
||||
view.x = view.x * -1;
|
||||
b_angle = view;
|
||||
} else if (targets[0]) {
|
||||
view = [targets[0] realorigin];
|
||||
|
@ -673,7 +673,7 @@ generally making the bot look good.
|
|||
view = view + '0 0 48';
|
||||
view -= (ent.origin + ent.view_ofs);
|
||||
view = vectoangles (view);
|
||||
view_x = -view_x;
|
||||
view.x = -view.x;
|
||||
b_angle = view;
|
||||
} else
|
||||
b_angle.x = 0;
|
||||
|
@ -687,7 +687,7 @@ generally making the bot look good.
|
|||
ent.v_angle.x += 360;
|
||||
while (ent.v_angle.x > 180)
|
||||
ent.v_angle.x -= 360;
|
||||
} else if ((ent.enemy == NIL || ent.enemy.movetype == MOVETYPE_PUSH)
|
||||
} else if ((ent.enemy == nil || ent.enemy.movetype == MOVETYPE_PUSH)
|
||||
&& (targets[0] ? [targets[0] classname] != "player" : 1)) {
|
||||
keys &= ~KEY_LOOK;
|
||||
ent.v_angle = b_angle;
|
||||
|
@ -734,9 +734,9 @@ frame, the ai_time limits it's actual updating
|
|||
keys = 0;
|
||||
b_aiflags = 0;
|
||||
[Waypoint clearMyRoute:self];
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = NIL;
|
||||
ent.enemy = NIL;
|
||||
last_way = NIL;
|
||||
targets[0] = targets[1] = targets[2] = targets[3] = nil;
|
||||
ent.enemy = nil;
|
||||
last_way = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,9 @@ integer bot_fight_linker;
|
|||
/*
|
||||
weapon_range
|
||||
|
||||
_x "sweet spot range" - try to maintain this range if possible
|
||||
_y minimum range bot can be to be effective (rl/gl) (move away)
|
||||
_z maximum range bot can be to be effective (lg/axe) (move in)
|
||||
.x "sweet spot range" - try to maintain this range if possible
|
||||
.y minimum range bot can be to be effective (rl/gl) (move away)
|
||||
.z maximum range bot can be to be effective (lg/axe) (move in)
|
||||
*/
|
||||
vector (integer wep)
|
||||
weapon_range =
|
||||
|
@ -77,7 +77,7 @@ weapon_range =
|
|||
};
|
||||
|
||||
@implementation Bot (Fight)
|
||||
-(float)sizePlayer:(Target)targ
|
||||
-(float)sizePlayer:(Target *)targ
|
||||
{
|
||||
local float sz;
|
||||
local entity e = targ.ent;
|
||||
|
@ -130,7 +130,7 @@ weapon_range =
|
|||
if (waypoint_mode > WM_LOADED)
|
||||
return;
|
||||
|
||||
avoid = NIL;
|
||||
avoid = nil;
|
||||
|
||||
if (ent.enemy) {
|
||||
v = ent.origin - realorigin (ent.enemy);
|
||||
|
@ -142,7 +142,7 @@ weapon_range =
|
|||
}
|
||||
avdist = 256;
|
||||
|
||||
foe = find (NIL, classname, "grenade");
|
||||
foe = find (nil, classname, "grenade");
|
||||
while (foe) {
|
||||
flen = vlen (foe.origin - ent.origin);
|
||||
if (flen < avdist) {
|
||||
|
@ -152,7 +152,7 @@ weapon_range =
|
|||
foe = find (foe, classname, "grenade");
|
||||
}
|
||||
if (!avoid) {
|
||||
foe = find (NIL, classname, "missile");
|
||||
foe = find (nil, classname, "missile");
|
||||
while (foe) {
|
||||
if (foe.owner != ent) {
|
||||
flen = vlen (foe.origin - ent.origin);
|
||||
|
@ -164,7 +164,7 @@ weapon_range =
|
|||
foe = find(foe, classname, "missile");
|
||||
}
|
||||
if (!avoid) {
|
||||
foe = find(NIL, classname, "spike");
|
||||
foe = find(nil, classname, "spike");
|
||||
while (foe) {
|
||||
if (foe.owner != ent) {
|
||||
flen = vlen(foe.origin - ent.origin);
|
||||
|
@ -185,7 +185,7 @@ weapon_range =
|
|||
if (foe.health > 0) {
|
||||
flen = vlen (foe.origin - ent.origin);
|
||||
if (flen < foedist) {
|
||||
local Target targ = [Target forEntity:foe];
|
||||
local Target *targ = [Target forEntity:foe];
|
||||
tsz = [self sizePlayer:targ];
|
||||
if (tsz < foesz) {
|
||||
if ([self canSee:targ]) {
|
||||
|
@ -202,7 +202,7 @@ weapon_range =
|
|||
}
|
||||
} else {
|
||||
local integer i = 0;
|
||||
local Bot foe;
|
||||
local Bot *foe;
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!(foe = players[i])) continue;
|
||||
if (foe == self) continue;
|
||||
|
@ -271,7 +271,7 @@ Pick a weapon based on range / ammo
|
|||
}
|
||||
|
||||
v = weapon_range (flag);
|
||||
if (brange < v_y || brange > v_z)
|
||||
if (brange < v.y || brange > v.z)
|
||||
it &= ~flag;
|
||||
else {
|
||||
if (pulse)
|
||||
|
@ -286,10 +286,10 @@ Pick a weapon based on range / ammo
|
|||
// quick little function to stop making him shoot the wrong way ! Argh
|
||||
local float g;
|
||||
|
||||
g = angcomp (ent.v_angle_x, b_angle.x);
|
||||
g = angcomp (ent.v_angle.x, b_angle.x);
|
||||
if (fabs (g) > 30)
|
||||
return; // argh, too far away
|
||||
g = angcomp (ent.v_angle_y, b_angle.y);
|
||||
g = angcomp (ent.v_angle.y, b_angle.y);
|
||||
if (fabs (g) > 30)
|
||||
return; // not again!
|
||||
buttons |= 1;
|
||||
|
@ -307,13 +307,13 @@ attacking an enemy.
|
|||
local vector v, v1 = '0 0 0', v2 = '0 0 0', org;
|
||||
|
||||
if (ent.enemy.health <= 0) {
|
||||
ent.enemy = NIL;
|
||||
ent.enemy = nil;
|
||||
return;
|
||||
} else if (!ent.enemy.takedamage) {
|
||||
ent.enemy = NIL;
|
||||
ent.enemy = nil;
|
||||
return;
|
||||
} else if (![self canSee:[Target forEntity:ent.enemy]]) {
|
||||
ent.enemy = NIL;
|
||||
ent.enemy = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,10 +323,10 @@ attacking an enemy.
|
|||
// decide if I should shoot
|
||||
foedist = vlen (org - ent.origin);
|
||||
v = weapon_range ((integer)ent.weapon);
|
||||
if (foedist > v_y && foedist < v_z) {
|
||||
if (foedist > v.y && foedist < v.z) {
|
||||
traceline (ent.origin + ent.view_ofs,
|
||||
ent.origin + ent.view_ofs + v_forward * v_z, FALSE, ent);
|
||||
if (vlen(trace_endpos - (ent.origin + ent.view_ofs)) >= v_y) {
|
||||
ent.origin + ent.view_ofs + v_forward * v.z, FALSE, ent);
|
||||
if (vlen(trace_endpos - (ent.origin + ent.view_ofs)) >= v.y) {
|
||||
// try to avoid shooting teammates
|
||||
if (trace_ent.classname == "player")
|
||||
if ((trace_ent.team == ent.team && teamplay) || (coop))
|
||||
|
@ -355,19 +355,19 @@ attacking an enemy.
|
|||
v = avoid.velocity;
|
||||
else
|
||||
v = normalize (avoid.origin - ent.origin);
|
||||
v1_x = v_y;
|
||||
v1_y = v_y * -1;
|
||||
v2_x = v_y;
|
||||
v2_y = v_y * -1;
|
||||
v1.x = v.y;
|
||||
v1.y = v.y * -1;
|
||||
v2.x = v.y;
|
||||
v2.y = v.y * -1;
|
||||
foedist = vlen (avoid.origin - (ent.origin + v1));
|
||||
if (foedist < vlen (avoid.origin - (ent.origin + v2)))
|
||||
[self walkmove:v2];
|
||||
else
|
||||
[self walkmove:v1];
|
||||
} else if (!(ent.enemy.flags & FL_MONSTER)) {
|
||||
if (foedist + 32 < v_x)
|
||||
if (foedist + 32 < v.x)
|
||||
[self walkmove:ent.origin - org];
|
||||
else if (foedist - 32 > v_x)
|
||||
else if (foedist - 32 > v.x)
|
||||
[self walkmove:org - ent.origin];
|
||||
else if (wallhug)
|
||||
[self walkmove:v_right];
|
||||
|
|
|
@ -43,7 +43,7 @@ this notice in its entirety.
|
|||
#include "libfrikbot.h"
|
||||
#include "Array.h"
|
||||
|
||||
bot_data_t [32] bot_data = {
|
||||
bot_data_t bot_data[32] = {
|
||||
{"Vincent", 11, 0},
|
||||
{"Bishop", 1, 3},
|
||||
{"Nomad", 13, 2},
|
||||
|
@ -78,7 +78,7 @@ bot_data_t [32] bot_data = {
|
|||
{"Mercury", 10, 5},
|
||||
};
|
||||
|
||||
Array bot_array;
|
||||
Array *bot_array;
|
||||
|
||||
@implementation Bot (Misc)
|
||||
/*
|
||||
|
@ -86,31 +86,31 @@ BotName
|
|||
|
||||
Sets bot's name and colors
|
||||
*/
|
||||
+(bot_data_t [])name:(integer)r
|
||||
+(bot_data_t *)name:(integer)r
|
||||
{
|
||||
if (r < 0 || r >= 32)
|
||||
return NIL;
|
||||
return nil;
|
||||
return &bot_data[r];
|
||||
}
|
||||
|
||||
+(bot_data_t [])randomName
|
||||
+(bot_data_t *)randomName
|
||||
{
|
||||
local integer test;
|
||||
local bot_data_t [] h;
|
||||
local bot_data_t *h;
|
||||
local entity t;
|
||||
|
||||
while (1) {
|
||||
test = (integer) (32 * random ());
|
||||
h = [Bot name:test];
|
||||
t = find (NIL, netname, h.name);
|
||||
if (t == NIL)
|
||||
t = find (nil, netname, h.name);
|
||||
if (t == nil)
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
||||
+(void)kick
|
||||
{
|
||||
local Bot ty;
|
||||
local Bot *ty;
|
||||
|
||||
if ([bot_array count]) {
|
||||
ty = [bot_array objectAtIndex:0];
|
||||
|
@ -141,10 +141,10 @@ is the entity in the bot's field of view
|
|||
yawn = (yawn + targ.view_ofs) - (ent.origin + ent.view_ofs);
|
||||
yawn = normalize (yawn);
|
||||
yawn = vectoangles (yawn);
|
||||
g = angcomp (ent.v_angle_x, yawn_x);
|
||||
g = angcomp (ent.v_angle.x, yawn.x);
|
||||
if (fabs (g) > 45)
|
||||
return FALSE;
|
||||
g = angcomp (ent.v_angle_y, yawn_y);
|
||||
g = angcomp (ent.v_angle.y, yawn.y);
|
||||
if (fabs (g) > 60)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
@ -183,6 +183,7 @@ sisible =
|
|||
return TRUE;
|
||||
else if (trace_fraction == 1)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -79,17 +79,17 @@ void (vector start, vector mins, vector maxs, vector end, float type,
|
|||
// use mouse emulation
|
||||
anglespeed = 1.5 * real_frametime;
|
||||
// 1.5 is the default cl_anglespeedkey & bot always has +speed
|
||||
ent.v_angle_y += anglespeed * key_state (keys, KEY_LOOKLEFT) * 140;
|
||||
ent.v_angle.y += anglespeed * key_state (keys, KEY_LOOKLEFT) * 140;
|
||||
// 140 is default cl_yawspeed
|
||||
ent.v_angle_y -= anglespeed * key_state (keys, KEY_LOOKRIGHT) * 140;
|
||||
ent.v_angle.y -= anglespeed * key_state (keys, KEY_LOOKRIGHT) * 140;
|
||||
// 140 is default cl_yawspeed
|
||||
ent.v_angle_x -= anglespeed * key_state (keys, KEY_LOOKUP) * 150;
|
||||
ent.v_angle.x -= anglespeed * key_state (keys, KEY_LOOKUP) * 150;
|
||||
// 150 is default cl_pitchspeed
|
||||
ent.v_angle_x += anglespeed * key_state (keys, KEY_LOOKDOWN) * 150;
|
||||
ent.v_angle.x += anglespeed * key_state (keys, KEY_LOOKDOWN) * 150;
|
||||
// 150 is default cl_pitchspeed
|
||||
} else {
|
||||
view.x = angcomp (b_angle.x, ent.v_angle_x);
|
||||
view.y = angcomp (b_angle.y, ent.v_angle_y);
|
||||
view.x = angcomp (b_angle.x, ent.v_angle.x);
|
||||
view.y = angcomp (b_angle.y, ent.v_angle.y);
|
||||
view.z = 0;
|
||||
if (vlen (view) > 30) {
|
||||
mouse_emu += (view * 30);
|
||||
|
@ -172,10 +172,10 @@ void (vector start, vector mins, vector maxs, vector end, float type,
|
|||
if (ret && flag) {
|
||||
// afect bot movement too
|
||||
if (keys & KEY_MOVEUP) {
|
||||
if (trace_ent.velocity_z > 0)
|
||||
if (trace_ent.velocity.z > 0)
|
||||
keys &= ~KEY_MOVE;
|
||||
} else if (keys & KEY_MOVEDOWN) {
|
||||
if (trace_ent.velocity_z < 0)
|
||||
if (trace_ent.velocity.z < 0)
|
||||
keys &= ~KEY_MOVE;
|
||||
}
|
||||
}
|
||||
|
@ -189,13 +189,13 @@ void (vector start, vector mins, vector maxs, vector end, float type,
|
|||
local vector keydir;
|
||||
|
||||
outkeys = 0;
|
||||
if (sdir_x || sdir_y) {
|
||||
if (sdir.x || sdir.y) {
|
||||
// Everything is tested against 60 degrees, this allows the bot to
|
||||
// overlap the keys 30 degrees on each diagonal 45 degrees might look
|
||||
// more realistic
|
||||
|
||||
keydir = vectoangles (sdir);
|
||||
tang = angcomp (keydir_y, ent.v_angle_y);
|
||||
tang = angcomp (keydir.y, ent.v_angle.y);
|
||||
if ((tang <= 150) && (tang >= 30))
|
||||
outkeys |= KEY_MOVELEFT;
|
||||
else if ((tang >= -150) && (tang <= -30))
|
||||
|
@ -205,9 +205,9 @@ void (vector start, vector mins, vector maxs, vector end, float type,
|
|||
else if (fabs(tang) >= 120)
|
||||
outkeys |= KEY_MOVEBACK;
|
||||
}
|
||||
if (sdir_z > 0.7)
|
||||
if (sdir.z > 0.7)
|
||||
outkeys |= KEY_MOVEUP;
|
||||
else if (sdir_z < 0.7)
|
||||
else if (sdir.z < 0.7)
|
||||
outkeys |= KEY_MOVEDOWN;
|
||||
return outkeys;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ manuever around.
|
|||
if (b_aiflags & AI_PRECISION)
|
||||
return;
|
||||
|
||||
disway_z = 0;
|
||||
disway.z = 0;
|
||||
|
||||
if (targets[0]) {
|
||||
if (b_aiflags & AI_OBSTRUCTED) {
|
||||
|
@ -246,20 +246,20 @@ manuever around.
|
|||
}
|
||||
org = [targets[0] realorigin];
|
||||
obs_dir = whichway;
|
||||
disway_x = whichway_y * -1;
|
||||
disway_y = whichway_x;
|
||||
disway.x = whichway.y * -1;
|
||||
disway.y = whichway.x;
|
||||
dist = vlen (org - (ent.origin + disway));
|
||||
disway_x = whichway_y;
|
||||
disway_y = whichway_x * -1;
|
||||
disway.x = whichway.y;
|
||||
disway.y = whichway.x * -1;
|
||||
wallhug = (vlen (org - (ent.origin + disway)) > dist);
|
||||
b_aiflags |= AI_OBSTRUCTED;
|
||||
|
||||
} else {
|
||||
disway_x = whichway_y * -1;
|
||||
disway_y = whichway_x;
|
||||
disway.x = whichway.y * -1;
|
||||
disway.y = whichway.x;
|
||||
dist = vlen (disway - obs_dir);
|
||||
disway_x = whichway_y;
|
||||
disway_y = whichway_x * -1;
|
||||
disway.x = whichway.y;
|
||||
disway.y = whichway.x * -1;
|
||||
wallhug = (vlen (disway - obs_dir) < dist);
|
||||
obs_dir = whichway;
|
||||
|
||||
|
@ -285,15 +285,15 @@ Also responsible for jumping gaps.
|
|||
return;
|
||||
|
||||
ang = normalize(ent.velocity);
|
||||
ang_z = 0;
|
||||
ang.z = 0;
|
||||
start = ent.origin + ang * 32; // ahem
|
||||
start_z = ent.origin_z + ent.maxs_z;
|
||||
start.z = ent.origin.z + ent.maxs.z;
|
||||
stop = start;
|
||||
stop_z = ent.origin_z + ent.mins_z;
|
||||
stop.z = ent.origin.z + ent.mins.z;
|
||||
traceline (start, stop - '0 0 256', TRUE, ent);
|
||||
if (trace_allsolid || trace_startsolid)
|
||||
return;
|
||||
hgt = trace_endpos_z - stop_z;
|
||||
hgt = trace_endpos.z - stop.z;
|
||||
|
||||
if (hgt > 18) {
|
||||
[self jump];
|
||||
|
@ -309,14 +309,14 @@ Also responsible for jumping gaps.
|
|||
test = vlen(trace_endpos - start);
|
||||
if (test <= 20)
|
||||
return; // it's a walkable gap, do nothing
|
||||
ang_x = ent.velocity_y * -1;
|
||||
ang_y = ent.velocity_x;
|
||||
ang.x = ent.velocity.y * -1;
|
||||
ang.y = ent.velocity.x;
|
||||
ang = normalize (ang);
|
||||
traceline (start - (ang * 10), start + (ang * 10), TRUE, ent);
|
||||
if ((trace_fraction != 1) || trace_startsolid)
|
||||
return; // gap is only 20 wide, walkable
|
||||
ang = ent.velocity;
|
||||
ang_z = 0;
|
||||
ang.z = 0;
|
||||
dist = ((540 / sv_gravity) * vlen (ang))/* + 32*/;
|
||||
if (test > dist) {
|
||||
// I can't make it
|
||||
|
@ -327,7 +327,7 @@ Also responsible for jumping gaps.
|
|||
} else {
|
||||
if (targets[0]) {
|
||||
stop = [targets[0] realorigin];
|
||||
if ((stop_z - ent.origin_z) < -32)
|
||||
if ((stop.z - ent.origin.z) < -32)
|
||||
return; // safe to fall
|
||||
}
|
||||
[self obstructed: ang :FALSE];
|
||||
|
@ -345,7 +345,7 @@ Also responsible for jumping gaps.
|
|||
} else {
|
||||
if (targets[0]) {
|
||||
stop = [targets[0] realorigin];
|
||||
if ((stop_z - ent.origin_z) < -32)
|
||||
if ((stop.z - ent.origin.z) < -32)
|
||||
return; // safe to fall
|
||||
}
|
||||
[self obstructed: ang :FALSE];
|
||||
|
@ -372,7 +372,7 @@ Also responsible for jumping gaps.
|
|||
if (hgt < -18) {
|
||||
if (targets[0]) {
|
||||
stop = [targets[0] realorigin];
|
||||
if ((stop_z - ent.origin_z) < -32)
|
||||
if ((stop.z - ent.origin.z) < -32)
|
||||
return; // safe to fall
|
||||
}
|
||||
[self jump];
|
||||
|
@ -420,7 +420,7 @@ I have no idea how well it will work
|
|||
way.x = obs_dir.y;
|
||||
way.y = obs_dir.x * -1;
|
||||
}
|
||||
way_z = 0;
|
||||
way.z = 0;
|
||||
keys &= ~KEY_MOVE;
|
||||
keys |= [self keysForDir: way];
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ blah
|
|||
local vector way;
|
||||
local float g;
|
||||
|
||||
if (targets[0] == NIL) {
|
||||
if (targets[0] == nil) {
|
||||
makevectors(ent.v_angle);
|
||||
[self walkmove: v_forward];
|
||||
return;
|
||||
|
@ -459,10 +459,10 @@ blah
|
|||
[self recognizePlat: TRUE];
|
||||
|
||||
if (b_aiflags & AI_PRECISION) {
|
||||
g = angcomp (ent.v_angle_x, b_angle.x);
|
||||
g = angcomp (ent.v_angle.x, b_angle.x);
|
||||
if (fabs (g) > 10)
|
||||
keys &= ~KEY_MOVE;
|
||||
g = angcomp (ent.v_angle_y, b_angle.y);
|
||||
g = angcomp (ent.v_angle.y, b_angle.y);
|
||||
if (fabs(g) > 10)
|
||||
keys &= ~KEY_MOVE;
|
||||
}
|
||||
|
@ -506,14 +506,14 @@ own waypoints.
|
|||
loopcount--;
|
||||
org = ent.origin + ent.view_ofs;
|
||||
ang = ent.angles;
|
||||
ang_y = frik_anglemod (ang_y - 90 + (180 * random ()));
|
||||
ang_x = 0; // avoid upward sloping
|
||||
ang.y = frik_anglemod (ang.y - 90 + (180 * random ()));
|
||||
ang.x = 0; // avoid upward sloping
|
||||
makevectors (ang);
|
||||
traceline (org, org + v_forward * 2300, TRUE, ent);
|
||||
if (trace_fraction != 1) {
|
||||
org1 = trace_endpos;
|
||||
ang = normalize (trace_plane_normal);
|
||||
ang_z = 0; // avoid upward sloping
|
||||
ang.z = 0; // avoid upward sloping
|
||||
traceline (org1, org1 + (ang * 2300), TRUE, ent);
|
||||
if ((trace_fraction != 1) && (vlen(trace_endpos - org1) >= 64)) {
|
||||
org = trace_endpos;
|
||||
|
@ -530,6 +530,6 @@ own waypoints.
|
|||
}
|
||||
}
|
||||
}
|
||||
b_angle.y = ent.v_angle_y + 10;
|
||||
b_angle.y = ent.v_angle.y + 10;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -77,11 +77,11 @@ ClientDisconnected(); // FrikBot
|
|||
#include "cmd.h"
|
||||
#include "editor.h"
|
||||
|
||||
integer []bot_way_ref;
|
||||
integer []bot_move_ref;
|
||||
integer []bot_chat_ref;
|
||||
float []stagger_think_ref;
|
||||
integer []bot_fight_ref;
|
||||
integer *bot_way_ref;
|
||||
integer *bot_move_ref;
|
||||
integer *bot_chat_ref;
|
||||
float *stagger_think_ref;
|
||||
integer *bot_fight_ref;
|
||||
|
||||
void ()
|
||||
bot_map_load =
|
||||
|
@ -119,7 +119,7 @@ for all variable in the bot...
|
|||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
|
||||
Bot [32] players;
|
||||
Bot *players[32];
|
||||
|
||||
// -------globals-----
|
||||
float real_frametime;
|
||||
|
@ -127,7 +127,7 @@ float bot_count, b_options, lasttime;
|
|||
float waypoint_mode, dump_mode;
|
||||
float direct_route;
|
||||
float sv_gravity;
|
||||
Bot route_table;
|
||||
Bot *route_table;
|
||||
integer busy_waypoints;
|
||||
|
||||
float coop = 0; // hack
|
||||
|
@ -161,7 +161,7 @@ direct messages to the bots, it crashes quake :-(
|
|||
void (entity e)
|
||||
setspawnparms =
|
||||
{
|
||||
if (((Bot)e.@this).ishuman)
|
||||
if (((Bot *)e.@this).ishuman)
|
||||
frik_setspawnparms (e);
|
||||
else
|
||||
SetNewParms ();
|
||||
|
@ -170,7 +170,7 @@ setspawnparms =
|
|||
vector (entity e, float sped)
|
||||
aim =
|
||||
{
|
||||
((Bot)e.@this).missile_speed = sped;
|
||||
((Bot *)e.@this).missile_speed = sped;
|
||||
return frik_aim (e, sped);
|
||||
};
|
||||
|
||||
|
@ -181,9 +181,9 @@ sound =
|
|||
if (samp == "items/inv3.wav")
|
||||
return;
|
||||
else if (e.classname == "player")
|
||||
((Bot)e.@this).b_sound = time + 1;
|
||||
((Bot *)e.@this).b_sound = time + 1;
|
||||
else if (other.classname == "player")
|
||||
((Bot)other.@this).b_sound = time + 1;
|
||||
((Bot *)other.@this).b_sound = time + 1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -212,10 +212,10 @@ void ()
|
|||
ClientDisconnected =
|
||||
{
|
||||
local integer cl_no = ClientNumber (@self);
|
||||
local Bot p = NIL;
|
||||
local Bot *p = nil;
|
||||
|
||||
p = players[cl_no];
|
||||
players[cl_no] = NIL;
|
||||
players[cl_no] = nil;
|
||||
if (p) {
|
||||
local entity e = p.ent;
|
||||
local integer i;
|
||||
|
@ -235,7 +235,7 @@ ClientDisconnected =
|
|||
integer (entity cl)
|
||||
ClientNumber =
|
||||
{
|
||||
local entity e = NIL;
|
||||
local entity e = nil;
|
||||
local integer f = -1;
|
||||
|
||||
do {
|
||||
|
@ -247,17 +247,16 @@ ClientNumber =
|
|||
return f;
|
||||
};
|
||||
|
||||
Bot (integer whatbot, integer whatskill)
|
||||
BotConnect =
|
||||
Bot *BotConnect (integer whatbot, integer whatskill)
|
||||
{
|
||||
local entity cl;
|
||||
local Bot bot;
|
||||
local bot_data_t [] name;
|
||||
local Bot *bot;
|
||||
local bot_data_t *name;
|
||||
|
||||
cl = SV_AllocClient ();
|
||||
if (!cl) {
|
||||
bprint (PRINT_HIGH, "Unable to connect a bot, server is full.\n");
|
||||
return NIL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
if (whatbot)
|
||||
|
@ -278,14 +277,14 @@ void () BotImpulses =
|
|||
{
|
||||
local integer f;
|
||||
local string h;
|
||||
local Target t = @self.@this;
|
||||
local Target *t = @self.@this;
|
||||
|
||||
if (t.editor)
|
||||
[EditorState impulse];
|
||||
|
||||
switch (@self.impulse) {
|
||||
case 100:
|
||||
h = infokey (NIL, "skill");
|
||||
h = infokey (nil, "skill");
|
||||
f = (integer) stof (h);
|
||||
BotConnect (0, f);
|
||||
break;
|
||||
|
@ -309,7 +308,7 @@ bot_add_f =
|
|||
local integer c = Cmd_Argc ();
|
||||
|
||||
if (c == 1) {
|
||||
skill = (integer) stof (infokey (NIL, "skill"));
|
||||
skill = (integer) stof (infokey (nil, "skill"));
|
||||
} else if (c == 2) {
|
||||
skill = (integer) stof (Cmd_Argv (1));
|
||||
} else {
|
||||
|
@ -364,7 +363,7 @@ signs on to the server.
|
|||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
|
||||
void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
|
||||
void DeveloperLightning (Waypoint *e1, Waypoint *e2, integer flag)
|
||||
{
|
||||
// used to show waypoint links for debugging
|
||||
WriteByte (MSG_BROADCAST, 23);
|
||||
|
@ -383,7 +382,7 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
|
|||
return [super init];
|
||||
}
|
||||
|
||||
- (id) initWithEntity:(entity) e named:(bot_data_t [])name skill:(integer)skill
|
||||
- (id) initWithEntity:(entity) e named:(bot_data_t *)name skill:(integer)skill
|
||||
{
|
||||
local integer cl_no = ClientNumber (e);
|
||||
local entity uself;
|
||||
|
@ -391,7 +390,7 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
|
|||
SV_Spawn (e);
|
||||
|
||||
if (!(self = [super initWithEntity:e]))
|
||||
return NIL;
|
||||
return nil;
|
||||
|
||||
[self add];
|
||||
|
||||
|
@ -434,7 +433,7 @@ void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning =
|
|||
local integer cno;
|
||||
|
||||
if (!(self = [super initWithEntity:e]))
|
||||
return NIL;
|
||||
return nil;
|
||||
|
||||
cno = (integer)e.colormap - 1;
|
||||
b_clientno = cno;
|
||||
|
@ -521,7 +520,7 @@ BotFrame =
|
|||
local string h;
|
||||
local integer i;
|
||||
|
||||
h = infokey (NIL, "bot_options");
|
||||
h = infokey (nil, "bot_options");
|
||||
b_options = stof (h);
|
||||
|
||||
// for the sake of speed
|
||||
|
|
|
@ -52,10 +52,10 @@ integer bot_way_linker;
|
|||
|
||||
@implementation Bot (Way)
|
||||
|
||||
-(void)deleteWaypoint:(Waypoint)what
|
||||
-(void)deleteWaypoint:(Waypoint *)what
|
||||
{
|
||||
if (current_way == what)
|
||||
current_way = NIL;
|
||||
current_way = nil;
|
||||
[waypoint_array removeObject:what];
|
||||
[what release];
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ in bot_ai.qc
|
|||
local float tdst, dst;
|
||||
local entity best;
|
||||
dst = 100000;
|
||||
best = NIL;
|
||||
t = find (NIL, classname, s);
|
||||
while (t != NIL) {
|
||||
best = nil;
|
||||
t = find (nil, classname, s);
|
||||
while (t != nil) {
|
||||
tdst = vlen(((t.absmin + t.absmax) * 0.5) - ent.origin);
|
||||
if (tdst < dst) {
|
||||
dst = tdst;
|
||||
|
@ -102,23 +102,23 @@ an object.
|
|||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
|
||||
-(Waypoint)findRoute:(Waypoint)lastone
|
||||
-(Waypoint *)findRoute:(Waypoint *)lastone
|
||||
{
|
||||
// kinda like FindWaypoint, only of this bots route though
|
||||
local Waypoint t, best;
|
||||
local Waypoint *t, *best;
|
||||
local float dst, tdst;
|
||||
local integer flag;
|
||||
local integer count, i;
|
||||
|
||||
flag = b_clientflag;
|
||||
dst = 100000;
|
||||
best = NIL;
|
||||
best = nil;
|
||||
count = [waypoint_array count];
|
||||
for (i = 0; i < count; i++) {
|
||||
t = [waypoint_array objectAtIndex:i];
|
||||
tdst = vlen(t.origin - ent.origin);
|
||||
if ((tdst < dst) && (t.bot_bits & flag)) {
|
||||
if ((lastone == NIL) || ([lastone isLinkedTo:t])) {
|
||||
if ((lastone == nil) || ([lastone isLinkedTo:t])) {
|
||||
dst = tdst;
|
||||
best = t;
|
||||
}
|
||||
|
@ -140,9 +140,9 @@ different bot.
|
|||
*/
|
||||
|
||||
|
||||
-(void)markPath:(Target)this
|
||||
-(void)markPath:(Target *)this
|
||||
{
|
||||
local Waypoint t;
|
||||
local Waypoint *t;
|
||||
local integer flag;
|
||||
|
||||
[Waypoint clearMyRoute:self];
|
||||
|
@ -153,7 +153,7 @@ different bot.
|
|||
if ([this classname] != "player")
|
||||
this.current_way = t;
|
||||
|
||||
if (t.enemy == NIL) {
|
||||
if (t.enemy == nil) {
|
||||
[self lost:this :FALSE];
|
||||
if (waypoint_mode == WM_DYNAMIC)
|
||||
route_failed = TRUE;
|
||||
|
@ -205,27 +205,27 @@ Boy it's confusing.
|
|||
[Waypoint clearRouteTable];
|
||||
last_way = [self findWaypoint:current_way];
|
||||
|
||||
if (last_way != NIL) {
|
||||
if (last_way != nil) {
|
||||
last_way.distance = vlen(last_way.origin - ent.origin);
|
||||
[last_way queueForThink];
|
||||
last_way.busy = TRUE;
|
||||
busy_waypoints = 1;
|
||||
return TRUE;
|
||||
} else {
|
||||
route_table = NIL;
|
||||
route_table = nil;
|
||||
busy_waypoints = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)getPath:(Target)this :(integer)direct
|
||||
-(void)getPath:(Target *)this :(integer)direct
|
||||
{
|
||||
if (this == NIL)
|
||||
if (this == nil)
|
||||
return;
|
||||
|
||||
if (route_table == self) {
|
||||
if (busy_waypoints <= 0) {
|
||||
route_table = NIL;
|
||||
route_table = nil;
|
||||
[self markPath:this];
|
||||
}
|
||||
return;
|
||||
|
@ -249,7 +249,7 @@ Temporary Marker code
|
|||
|
||||
-(void)spawnTempWaypoint:(vector)org
|
||||
{
|
||||
local Waypoint tep;
|
||||
local Waypoint *tep;
|
||||
|
||||
if (!temp_way)
|
||||
temp_way = tep = [[Waypoint alloc] init];
|
||||
|
@ -269,7 +269,7 @@ very good all things considered.
|
|||
*/
|
||||
-(void)dynamicWaypoint
|
||||
{
|
||||
local Waypoint t;
|
||||
local Waypoint *t;
|
||||
local float dist, dynlink = 0, dynpoint = 0, editor = 0;
|
||||
|
||||
if (teleport_time > portal_time) {
|
||||
|
@ -277,7 +277,7 @@ very good all things considered.
|
|||
dyn_flags = 2;
|
||||
if (!ishuman) {
|
||||
[self lost:targets[0] :TRUE];
|
||||
ent.enemy = NIL;
|
||||
ent.enemy = nil;
|
||||
}
|
||||
}
|
||||
portal_time = teleport_time;
|
||||
|
@ -322,7 +322,7 @@ very good all things considered.
|
|||
}
|
||||
}
|
||||
dyn_dest = '0 0 0';
|
||||
current_way = NIL;
|
||||
current_way = nil;
|
||||
dyn_flags = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ very good all things considered.
|
|||
// display the links for editor mode
|
||||
if (editor) {
|
||||
if (current_way) {
|
||||
local Waypoint way = current_way;
|
||||
local Waypoint *way = current_way;
|
||||
local integer i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
@ -435,7 +435,7 @@ very good all things considered.
|
|||
}
|
||||
}
|
||||
|
||||
-(integer)canSee:(Target)targ
|
||||
-(integer)canSee:(Target *)targ
|
||||
{
|
||||
local float thruwater = 0, pc1 = 0, pc2 = 0;
|
||||
local vector spot1, org;
|
||||
|
|
|
@ -44,7 +44,7 @@ this notice in its entirety.
|
|||
|
||||
integer bot_chat_linker;
|
||||
|
||||
@static Bot b_originator;
|
||||
@static Bot *b_originator;
|
||||
@static integer b_topic;
|
||||
/* FBX Topics
|
||||
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
|
||||
@interface EditorState: Object
|
||||
{
|
||||
ImpulseMenu menu;
|
||||
ImpulseMenu prev_menu;
|
||||
ImpulseMenu *menu;
|
||||
ImpulseMenu *prev_menu;
|
||||
float menu_time;
|
||||
string confirm_text;
|
||||
string confirm_cmd;
|
||||
|
||||
Target owner;
|
||||
Waypoint last_way;
|
||||
Target *owner;
|
||||
Waypoint *last_way;
|
||||
integer hold_select;
|
||||
Bot test_bot;
|
||||
Bot *test_bot;
|
||||
integer edit_mode;
|
||||
}
|
||||
+main_menu;
|
||||
|
@ -62,11 +62,11 @@
|
|||
+(integer)getHoldSelectState;
|
||||
+(void)toggleHoldSelectState;
|
||||
+(string)getConfirmText;
|
||||
+(Waypoint)current_way;
|
||||
-(Waypoint)current_way;
|
||||
+(Waypoint *)current_way;
|
||||
-(Waypoint *)current_way;
|
||||
|
||||
+(void)impulse;
|
||||
-(id)initWithOwner:(Target)owner;
|
||||
-(id)initWithOwner:(Target *)owner;
|
||||
-(void)refresh;
|
||||
@end
|
||||
|
||||
|
|
178
fbxa/editor.r
178
fbxa/editor.r
|
@ -47,11 +47,11 @@
|
|||
|
||||
-(integer) impulse:(integer)imp
|
||||
{
|
||||
local Waypoint way = NIL;
|
||||
local Waypoint *way = nil;
|
||||
if ((imp = [super impulse:imp]) == 104) {
|
||||
imp = 0;
|
||||
if (value)
|
||||
way = (Waypoint) [waypoint_array objectAtIndex:value - 1];
|
||||
way = (Waypoint *) [waypoint_array objectAtIndex:value - 1];
|
||||
value = 0;
|
||||
if (way)
|
||||
setorigin (@self, way.origin - @self.view_ofs);
|
||||
|
@ -143,7 +143,7 @@
|
|||
|
||||
-(integer) state
|
||||
{
|
||||
local Waypoint way = [EditorState current_way];
|
||||
local Waypoint *way = [EditorState current_way];
|
||||
if (!way)
|
||||
return 0;
|
||||
return !!(way.flags & mask);
|
||||
|
@ -151,7 +151,7 @@
|
|||
|
||||
-(void) toggle
|
||||
{
|
||||
local Waypoint way = [EditorState current_way];
|
||||
local Waypoint *way = [EditorState current_way];
|
||||
if (way)
|
||||
way.flags ^= mask;
|
||||
}
|
||||
|
@ -165,16 +165,16 @@
|
|||
}
|
||||
@end
|
||||
|
||||
@static ImpulseListMenu main_menu;
|
||||
@static ImpulseListMenu waypoint_menu;
|
||||
@static ImpulseListMenu link_menu;
|
||||
@static ImpulseListMenu ai_flags_menu;
|
||||
@static ImpulseListMenu ai_flag2_menu;
|
||||
@static ImpulseListMenu bot_menu;
|
||||
@static ImpulseListMenu waylist_menu;
|
||||
@static ImpulseListMenu *main_menu;
|
||||
@static ImpulseListMenu *waypoint_menu;
|
||||
@static ImpulseListMenu *link_menu;
|
||||
@static ImpulseListMenu *ai_flags_menu;
|
||||
@static ImpulseListMenu *ai_flag2_menu;
|
||||
@static ImpulseListMenu *bot_menu;
|
||||
@static ImpulseListMenu *waylist_menu;
|
||||
|
||||
@static ConfirmationMenu confirm_menu;
|
||||
@static TeleportMenu teleport_menu;
|
||||
@static ConfirmationMenu *confirm_menu;
|
||||
@static TeleportMenu *teleport_menu;
|
||||
|
||||
@static void init_menus (void)
|
||||
{
|
||||
|
@ -466,77 +466,88 @@
|
|||
}
|
||||
|
||||
@implementation EditorState: Object
|
||||
+setMenu:(ImpulseMenu)item
|
||||
+setMenu:(ImpulseMenu *)item
|
||||
{
|
||||
((Target) @self.@this).editor.menu = item;
|
||||
((Target) @self.@this).editor.menu_time = time;
|
||||
((Target *) @self.@this).editor.menu = item;
|
||||
((Target *) @self.@this).editor.menu_time = time;
|
||||
return self;
|
||||
}
|
||||
|
||||
+main_menu
|
||||
{
|
||||
[EditorState setMenu: main_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+waypoint_menu
|
||||
{
|
||||
[EditorState setMenu: waypoint_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+link_menu
|
||||
{
|
||||
[EditorState setMenu: link_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+ai_flags_menu
|
||||
{
|
||||
dprint ("ai_flags_menu\n");
|
||||
[EditorState setMenu: ai_flags_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+ai_flag2_menu
|
||||
{
|
||||
dprint ("ai_flag2_menu\n");
|
||||
[EditorState setMenu: ai_flag2_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+bot_menu
|
||||
{
|
||||
[EditorState setMenu: bot_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+waylist_menu
|
||||
{
|
||||
[EditorState setMenu: waylist_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+teleport_to_way
|
||||
{
|
||||
[EditorState setMenu: teleport_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+close_menu
|
||||
{
|
||||
local Target player = (Target) @self.@this;
|
||||
[EditorState setMenu: NIL];
|
||||
local Target *player = (Target *) @self.@this;
|
||||
[EditorState setMenu: nil];
|
||||
[Waypoint hideAll];
|
||||
waypoint_mode = WM_LOADED;
|
||||
[player.editor release];
|
||||
player.editor = NIL;
|
||||
player.editor = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+move_waypoint
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way)
|
||||
[way setOrigin: @self.origin + @self.view_ofs];
|
||||
return self;
|
||||
}
|
||||
|
||||
+delete_waypoint
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Delete Waypoint --\n\nAre you sure?";
|
||||
|
@ -544,49 +555,54 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+make_waypoint
|
||||
{
|
||||
[[Waypoint alloc] initAt: @self.origin + @self.view_ofs];
|
||||
return self;
|
||||
}
|
||||
|
||||
+make_waypoint_link
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local Waypoint new = [[Waypoint alloc]
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
local Waypoint *new = [[Waypoint alloc]
|
||||
initAt: @self.origin + @self.view_ofs];
|
||||
if (!way || ![way linkWay: new])
|
||||
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
+make_way_link_x2
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local Waypoint new = [[Waypoint alloc]
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
local Waypoint *new = [[Waypoint alloc]
|
||||
initAt: @self.origin + @self.view_ofs];
|
||||
if (!way || ![way linkWay: new])
|
||||
sprint (@self, PRINT_HIGH, "Unable to link old to new\n");
|
||||
if (!way || ![new linkWay: way])
|
||||
sprint (@self, PRINT_HIGH, "Unable to link new to old\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
+make_way_telelink
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local Waypoint new = [[Waypoint alloc]
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
local Waypoint *new = [[Waypoint alloc]
|
||||
initAt: @self.origin + @self.view_ofs];
|
||||
if (!way || ![way teleLinkWay: new])
|
||||
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
+show_waypoint_info
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
local integer i;
|
||||
if (!way)
|
||||
return self;
|
||||
|
@ -603,21 +619,23 @@
|
|||
i + 1, [way.links[i] id]));
|
||||
}
|
||||
sprint (@self, PRINT_HIGH, "\n\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+unlink_waypoint
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way)
|
||||
[way clearLinks];
|
||||
return self;
|
||||
}
|
||||
|
||||
+create_link
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Link Ways --\n\nSelect another way";
|
||||
|
@ -625,12 +643,13 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+create_telelink
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Telelink Ways --\n\nSelect another way";
|
||||
|
@ -638,12 +657,13 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+delete_link
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Delete Link --\n\nSelect another way";
|
||||
|
@ -651,12 +671,13 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+create_link_x2
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Create Link X2 --\n\nSelect another way";
|
||||
|
@ -664,12 +685,13 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+delete_link_x2
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way) {
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Delete Link X2 --\n\nSelect another way";
|
||||
|
@ -677,12 +699,13 @@
|
|||
[EditorState setMenu:confirm_menu];
|
||||
editor.last_way = way;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+add_test_bot
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local integer f;
|
||||
local string h;
|
||||
|
||||
|
@ -690,71 +713,79 @@
|
|||
sprint (@self, PRINT_HIGH, "already have test bot\n");
|
||||
return self;
|
||||
}
|
||||
h = infokey (NIL, "skill");
|
||||
h = infokey (nil, "skill");
|
||||
f = (integer) stof (h);
|
||||
editor.test_bot = BotConnect (0, f);
|
||||
return self;
|
||||
}
|
||||
|
||||
+call_test_bot
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
if (editor.test_bot)
|
||||
[editor.test_bot getPath:[Target forEntity:@self] :TRUE];
|
||||
return self;
|
||||
}
|
||||
|
||||
+remove_test_bot
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
if (editor.test_bot)
|
||||
[editor.test_bot disconnect];
|
||||
return self;
|
||||
}
|
||||
|
||||
+stop_test_bot
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
if (editor.test_bot) {
|
||||
[editor.test_bot targetClearAll];
|
||||
route_table = NIL;
|
||||
route_table = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+teleport_bot
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local Waypoint way = [editor current_way];
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
local Waypoint *way = [editor current_way];
|
||||
if (way && editor.test_bot)
|
||||
setorigin (editor.test_bot.ent, [way origin]);
|
||||
if (!way)
|
||||
sprint(@self, PRINT_HIGH, "select a waypoint first\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+delete_all_waypoints
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
editor.prev_menu = editor.menu;
|
||||
editor.confirm_text = "-- Delete ALL Ways --\n\nAre you sure?";
|
||||
editor.confirm_cmd = "delete all ways";
|
||||
[EditorState setMenu:confirm_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+dump_waypoints
|
||||
{
|
||||
local PLItem plist = [Waypoint plist];
|
||||
local PLItem *plist = [Waypoint plist];
|
||||
bprint (PRINT_HIGH, [plist write]);
|
||||
bprint (PRINT_HIGH, "\n");
|
||||
[plist release];
|
||||
return self;
|
||||
}
|
||||
|
||||
+check_for_errors
|
||||
{
|
||||
[Waypoint check:[Target forEntity:@self]];
|
||||
return self;
|
||||
}
|
||||
|
||||
+save_waypoints
|
||||
{
|
||||
local QFile file;
|
||||
local PLItem plist;
|
||||
local PLItem *plist;
|
||||
|
||||
file = QFS_Open ("temp.way", "wt");
|
||||
if (!file) {
|
||||
|
@ -766,13 +797,14 @@
|
|||
[plist release];
|
||||
Qclose (file);
|
||||
sprint (@self, PRINT_HIGH, "waypoints saved to temp.way\n");
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+confirm
|
||||
{
|
||||
local Target player = (Target) @self.@this;
|
||||
local EditorState editor = player.editor;
|
||||
local Target *player = (Target *) @self.@this;
|
||||
local EditorState *editor = player.editor;
|
||||
switch (editor.confirm_cmd) {
|
||||
case "link ways":
|
||||
if (player.current_way) {
|
||||
|
@ -807,57 +839,59 @@
|
|||
break;
|
||||
case "delete all ways":
|
||||
[Waypoint clearAll];
|
||||
player.current_way = editor.last_way = NIL;
|
||||
player.current_way = editor.last_way = nil;
|
||||
break;
|
||||
case "delete waypoint":
|
||||
[waypoint_array removeObject:editor.last_way];
|
||||
if (player.current_way == editor.last_way)
|
||||
player.current_way = NIL;
|
||||
editor.last_way = NIL;
|
||||
player.current_way = nil;
|
||||
editor.last_way = nil;
|
||||
break;
|
||||
}
|
||||
[EditorState setMenu: editor.prev_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
+cancel
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
[EditorState setMenu: editor.prev_menu];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+(integer)getHoldSelectState
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
return editor.hold_select != 0;
|
||||
}
|
||||
|
||||
+(void)toggleHoldSelectState
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
editor.hold_select = !editor.hold_select;
|
||||
}
|
||||
|
||||
+(string)getConfirmText
|
||||
{
|
||||
local EditorState editor = ((Target) @self.@this).editor;
|
||||
local EditorState *editor = ((Target *) @self.@this).editor;
|
||||
return editor.confirm_text;
|
||||
}
|
||||
|
||||
+(Waypoint)current_way
|
||||
+(Waypoint *)current_way
|
||||
{
|
||||
return ((Target) @self.@this).current_way;
|
||||
return ((Target *) @self.@this).current_way;
|
||||
}
|
||||
|
||||
-(Waypoint)current_way
|
||||
-(Waypoint *)current_way
|
||||
{
|
||||
return owner.current_way;
|
||||
}
|
||||
|
||||
+(void)impulse
|
||||
{
|
||||
local Target player = (Target) @self.@this;
|
||||
local EditorState editor = player.editor;
|
||||
local Target *player = (Target *) @self.@this;
|
||||
local EditorState *editor = player.editor;
|
||||
|
||||
if (!editor) {
|
||||
if (@self.impulse != 104)
|
||||
|
@ -874,7 +908,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
-(id)initWithOwner:(Target)owner
|
||||
-(id)initWithOwner:(Target *)owner
|
||||
{
|
||||
if (!main_menu)
|
||||
init_menus ();
|
||||
|
|
|
@ -49,9 +49,9 @@
|
|||
|
||||
@interface ImpulseListMenu: ImpulseMenu
|
||||
{
|
||||
MenuItem [10]items;
|
||||
MenuItem *items[10];
|
||||
}
|
||||
- (void) addItem:(MenuItem)item;
|
||||
- (void) addItem:(MenuItem *)item;
|
||||
@end
|
||||
|
||||
#endif//__impulse_menu_h
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
local string str = text;
|
||||
local string s;
|
||||
local integer i;
|
||||
local string [10] is;
|
||||
local string is[10];
|
||||
local integer max_len = 0, len;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
|
@ -139,7 +139,7 @@
|
|||
return str;
|
||||
}
|
||||
|
||||
- (void) addItem:(MenuItem) item
|
||||
- (void) addItem:(MenuItem *) item
|
||||
{
|
||||
local integer i;
|
||||
|
||||
|
|
|
@ -15,20 +15,20 @@ typedef struct bot_data_t bot_data_t;
|
|||
@interface Target: Entity
|
||||
{
|
||||
@public
|
||||
Waypoint current_way;
|
||||
Waypoint *current_way;
|
||||
integer hold_select;
|
||||
Target _last;
|
||||
EditorState editor;
|
||||
Target *_last;
|
||||
EditorState *editor;
|
||||
}
|
||||
+(Target)forEntity:(entity)e;
|
||||
+(Target *)forEntity:(entity)e;
|
||||
-(vector)realorigin;
|
||||
-(vector)origin;
|
||||
-(integer)canSee:(Target)targ ignoring:(entity)ignore;
|
||||
-(integer)canSee:(Target *)targ ignoring:(entity)ignore;
|
||||
-(void)setOrigin:(vector) org;
|
||||
-(integer)recognizePlat:(integer)flag;
|
||||
-(integer)ishuman;
|
||||
-(integer)priority:(Bot)bot;
|
||||
-(Waypoint)findWaypoint:(Waypoint)start;
|
||||
-(integer)priority:(Bot *)bot;
|
||||
-(Waypoint *)findWaypoint:(Waypoint *)start;
|
||||
-(float)searchTime;
|
||||
-(void)setSearchTime:(float)st;
|
||||
-(string)classname;
|
||||
|
@ -37,7 +37,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
@interface Waypoint: Target
|
||||
{
|
||||
@public
|
||||
Waypoint [4] links;
|
||||
Waypoint *links[4];
|
||||
integer flags;
|
||||
vector origin;
|
||||
|
||||
|
@ -46,21 +46,21 @@ typedef struct bot_data_t bot_data_t;
|
|||
integer bot_bits;
|
||||
integer busy; //???
|
||||
float distance;
|
||||
Waypoint enemy;
|
||||
Waypoint *enemy;
|
||||
float search_time;
|
||||
|
||||
Waypoint chain;
|
||||
Waypoint *chain;
|
||||
}
|
||||
+(void)loadFile:(string)path;
|
||||
+(void)clearAll;
|
||||
+(Waypoint)waypointForNum:(integer)num;
|
||||
+(Waypoint *)waypointForNum:(integer)num;
|
||||
+(void)fixWaypoints;
|
||||
+(PLItem)plist;
|
||||
+(void)check:(Target)ent;
|
||||
+(PLItem *)plist;
|
||||
+(void)check:(Target *)ent;
|
||||
|
||||
+(void)clearRouteTable;
|
||||
+(void)clearMyRoute:(Bot) bot;
|
||||
+(Waypoint)find:(vector)org radius:(float)rad;
|
||||
+(void)clearMyRoute:(Bot *) bot;
|
||||
+(Waypoint *)find:(vector)org radius:(float)rad;
|
||||
|
||||
+(void)showAll;
|
||||
+(void)hideAll;
|
||||
|
@ -72,22 +72,22 @@ typedef struct bot_data_t bot_data_t;
|
|||
-(id)initAt:(vector)org;
|
||||
-(id)initFromEntity:(entity)ent;
|
||||
|
||||
-(integer)isLinkedTo:(Waypoint)way;
|
||||
-(integer)linkWay:(Waypoint)way;
|
||||
-(integer)teleLinkWay:(Waypoint)way;
|
||||
-(void)unlinkWay:(Waypoint)way;
|
||||
-(integer)isLinkedTo:(Waypoint *)way;
|
||||
-(integer)linkWay:(Waypoint *)way;
|
||||
-(integer)teleLinkWay:(Waypoint *)way;
|
||||
-(void)unlinkWay:(Waypoint *)way;
|
||||
|
||||
-(void)followLink:(Waypoint)e2 :(integer)bBit;
|
||||
-(void)followLink:(Waypoint *)e2 :(integer)bBit;
|
||||
-(void)waypointThink;
|
||||
|
||||
-(void)clearLinks;
|
||||
-(void)clearRoute;
|
||||
-(void)clearRouteForBot:(Bot)bot;
|
||||
-(void)clearRouteForBot:(Bot *)bot;
|
||||
|
||||
-(id)queueForThink;
|
||||
@end
|
||||
@class Array;
|
||||
@extern Array waypoint_array;
|
||||
@extern Array *waypoint_array;
|
||||
|
||||
@interface Bot: Target
|
||||
{
|
||||
|
@ -119,9 +119,9 @@ typedef struct bot_data_t bot_data_t;
|
|||
integer dyn_flags;
|
||||
integer dyn_plat;
|
||||
float dyn_time;
|
||||
Waypoint temp_way;
|
||||
Waypoint last_way;
|
||||
Target [4] targets;
|
||||
Waypoint *temp_way;
|
||||
Waypoint *last_way;
|
||||
Target *targets[4];
|
||||
entity avoid;
|
||||
vector obs_dir;
|
||||
vector b_dir;
|
||||
|
@ -132,7 +132,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
float portal_time;
|
||||
}
|
||||
- (id) init;
|
||||
- (id) initWithEntity: (entity) e named:(bot_data_t [])name skill:(integer)skill;
|
||||
- (id) initWithEntity: (entity) e named:(bot_data_t *)name skill:(integer)skill;
|
||||
- (id) initFromPlayer: (entity) e;
|
||||
- (void) preThink;
|
||||
- (void) postThink;
|
||||
|
@ -144,8 +144,8 @@ typedef struct bot_data_t bot_data_t;
|
|||
@end
|
||||
|
||||
@interface Bot (Misc)
|
||||
+(bot_data_t [])name:(integer)r;
|
||||
+(bot_data_t [])randomName;
|
||||
+(bot_data_t *)name:(integer)r;
|
||||
+(bot_data_t *)randomName;
|
||||
-(integer)fov:(entity)targ;
|
||||
|
||||
+(void)kick;
|
||||
|
@ -167,22 +167,22 @@ typedef struct bot_data_t bot_data_t;
|
|||
@end
|
||||
|
||||
@interface Bot (AI)
|
||||
-(integer)targetOnstack:(Target)scot;
|
||||
-(void)targetAdd:(Target)e;
|
||||
-(void)targetDrop:(Target)e;
|
||||
-(integer)targetOnstack:(Target *)scot;
|
||||
-(void)targetAdd:(Target *)e;
|
||||
-(void)targetDrop:(Target *)e;
|
||||
-(void)targetClearAll;
|
||||
-(void)lost:(Target)targ :(integer)success;
|
||||
-(void)checkLost:(Target)targ;
|
||||
-(void)lost:(Target *)targ :(integer)success;
|
||||
-(void)checkLost:(Target *)targ;
|
||||
-(void)handleAI;
|
||||
-(void)path;
|
||||
-(void)lookForCrap:(integer)scope;
|
||||
-(void)angleSet;
|
||||
-(void)AI;
|
||||
-(integer)priorityForThing:(Target)thing;
|
||||
-(integer)priorityForThing:(Target *)thing;
|
||||
@end
|
||||
|
||||
@interface Bot (Fight)
|
||||
-(float)sizePlayer:(Target)targ;
|
||||
-(float)sizePlayer:(Target *)targ;
|
||||
-(void)dodgeStuff;
|
||||
-(void)weaponSwitch:(float)brange;
|
||||
-(void)shoot;
|
||||
|
@ -190,16 +190,16 @@ typedef struct bot_data_t bot_data_t;
|
|||
@end
|
||||
|
||||
@interface Bot (Way)
|
||||
-(void)deleteWaypoint:(Waypoint)what;
|
||||
-(void)deleteWaypoint:(Waypoint *)what;
|
||||
-(entity)findThing:(string)s;
|
||||
-(Waypoint)findRoute:(Waypoint)lastone;
|
||||
-(void)markPath:(Target)this;
|
||||
-(void)getPath:(Target)this :(integer)direct;
|
||||
-(Waypoint *)findRoute:(Waypoint *)lastone;
|
||||
-(void)markPath:(Target *)this;
|
||||
-(void)getPath:(Target *)this :(integer)direct;
|
||||
-(integer)beginRoute;
|
||||
-(void)spawnTempWaypoint:(vector)org;
|
||||
-(void)dynamicWaypoint;
|
||||
|
||||
-(integer)canSee:(Target)targ;
|
||||
-(integer)canSee:(Target *)targ;
|
||||
@end
|
||||
|
||||
@interface Bot (Chat)
|
||||
|
@ -285,7 +285,7 @@ typedef struct bot_data_t bot_data_t;
|
|||
#define OPT_NOCHAT 2
|
||||
|
||||
// -------globals-----
|
||||
@extern Bot [32] players;
|
||||
@extern Bot *players[32];
|
||||
@extern float real_frametime;
|
||||
@extern float bot_count, b_options;
|
||||
@extern float lasttime;
|
||||
|
@ -293,14 +293,14 @@ typedef struct bot_data_t bot_data_t;
|
|||
@extern float dump_mode;
|
||||
@extern float direct_route;
|
||||
@extern float sv_gravity;
|
||||
@extern Bot route_table;
|
||||
@extern Bot *route_table;
|
||||
@extern integer busy_waypoints;
|
||||
|
||||
@extern float coop;
|
||||
|
||||
// -------ProtoTypes------
|
||||
// external, in main code
|
||||
@extern Bot (integer whatbot, integer whatskill) BotConnect;
|
||||
@extern Bot *BotConnect (integer whatbot, integer whatskill);
|
||||
@extern void() ClientConnect;
|
||||
@extern void() ClientDisconnect;
|
||||
@extern void() SetNewParms;
|
||||
|
@ -318,13 +318,13 @@ typedef struct bot_data_t bot_data_t;
|
|||
@extern void () map_dm6;
|
||||
|
||||
// ai & misc
|
||||
@extern Array bot_array;
|
||||
@extern Array *bot_array;
|
||||
@extern float(float y1, float y2) angcomp;
|
||||
@extern float(entity ent, entity targ, vector targ_origin) sisible;
|
||||
@extern vector(entity ent) realorigin;
|
||||
@extern float(float v) frik_anglemod;
|
||||
|
||||
@extern void(Waypoint e1, Waypoint e2, integer flag) DeveloperLightning;
|
||||
@extern void DeveloperLightning(Waypoint *e1, Waypoint *e2, integer flag);
|
||||
|
||||
/*
|
||||
angles is pitch yaw roll
|
||||
|
|
|
@ -53,34 +53,35 @@ struct target_s {
|
|||
@defs (Target)
|
||||
};
|
||||
|
||||
@static unsigned (void []ele, void []unused) target_get_hash =
|
||||
@static unsigned target_get_hash (void *ele, void *unused)
|
||||
{
|
||||
local Target t = ele;
|
||||
return ((unsigned[])&t.ent)[0];
|
||||
local Target *t = ele;
|
||||
//return ((unsigned*)&t.ent)[0];
|
||||
return nil;//FIXME
|
||||
};
|
||||
|
||||
@static integer (void []e1, void[]e2, void []unused) target_compare =
|
||||
@static integer target_compare (void *e1, void*e2, void *unused)
|
||||
{
|
||||
local Target t1 = e1;
|
||||
local Target t2 = e2;
|
||||
local Target *t1 = e1;
|
||||
local Target *t2 = e2;
|
||||
return t1.ent == t2.ent;
|
||||
};
|
||||
|
||||
@implementation Target
|
||||
|
||||
+(Target)forEntity:(entity)e
|
||||
+(Target *)forEntity:(entity)e
|
||||
{
|
||||
local Target t;
|
||||
local Target *t;
|
||||
local struct target_s ele;
|
||||
|
||||
if (!e)
|
||||
return NIL;
|
||||
return nil;
|
||||
|
||||
if (e.classname == "player")
|
||||
return e.@this;
|
||||
|
||||
if (!target_tab) {
|
||||
target_tab = Hash_NewTable (1021, NIL, NIL, NIL);
|
||||
target_tab = Hash_NewTable (1021, nil, nil, nil);
|
||||
Hash_SetHashCompare (target_tab, target_get_hash, target_compare);
|
||||
}
|
||||
ele.ent = e;
|
||||
|
@ -103,7 +104,7 @@ struct target_s {
|
|||
return ent.origin;
|
||||
}
|
||||
|
||||
-(integer)canSee:(Target)targ ignoring:(entity)ignore
|
||||
-(integer)canSee:(Target *)targ ignoring:(entity)ignore
|
||||
{
|
||||
local vector spot1, spot2;
|
||||
|
||||
|
@ -129,7 +130,7 @@ struct target_s {
|
|||
{
|
||||
local vector org = [self origin];
|
||||
traceline (org, org - '0 0 64', TRUE, ent);
|
||||
if (trace_ent != NIL)
|
||||
if (trace_ent != nil)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -140,7 +141,7 @@ struct target_s {
|
|||
return 0;
|
||||
}
|
||||
|
||||
-(integer)priority:(Bot)bot
|
||||
-(integer)priority:(Bot *)bot
|
||||
{
|
||||
if ((ent.flags & FL_ITEM) && ent.model && ent.search_time < time) {
|
||||
// ugly hack
|
||||
|
@ -203,9 +204,9 @@ functions big lag causer
|
|||
|
||||
Finds the closest, fisible, waypoint to e
|
||||
*/
|
||||
-(Waypoint)findWaypoint:(Waypoint)start
|
||||
-(Waypoint *)findWaypoint:(Waypoint *)start
|
||||
{
|
||||
local Waypoint best, t;
|
||||
local Waypoint *best, *t;
|
||||
local float dst, tdst;
|
||||
local vector org;
|
||||
local integer count, i;
|
||||
|
@ -218,7 +219,7 @@ Finds the closest, fisible, waypoint to e
|
|||
best = start;
|
||||
} else {
|
||||
dst = 100000;
|
||||
best = NIL;
|
||||
best = nil;
|
||||
}
|
||||
count = [waypoint_array count];
|
||||
for (i = 0; i < count; i++) {
|
||||
|
@ -229,7 +230,7 @@ Finds the closest, fisible, waypoint to e
|
|||
if (!(t.flags & AI_IGNORE_TYPES) || ishuman) {
|
||||
tdst = vlen (t.origin - org);
|
||||
if (tdst < dst) {
|
||||
if (sisible (ent, NIL, t.origin)) {
|
||||
if (sisible (ent, nil, t.origin)) {
|
||||
dst = tdst;
|
||||
best = t;
|
||||
}
|
||||
|
|
105
fbxa/waypoint.r
105
fbxa/waypoint.r
|
@ -50,9 +50,9 @@ this notice in its entirety.
|
|||
#include "string.h"
|
||||
#include "PropertyList.h"
|
||||
|
||||
Array waypoint_array;
|
||||
Array *waypoint_array;
|
||||
@static entity waypoint_thinker;
|
||||
@static List waypoint_queue;
|
||||
@static List *waypoint_queue;
|
||||
|
||||
@static void () waypoint_init =
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ Array waypoint_array;
|
|||
{
|
||||
if (!waypoint_array)
|
||||
waypoint_init ();
|
||||
return [super initWithEntity:NIL];
|
||||
return [super initWithEntity:nil];
|
||||
}
|
||||
|
||||
-(id)initAt:(vector)org
|
||||
|
@ -93,13 +93,13 @@ Array waypoint_array;
|
|||
return self;
|
||||
}
|
||||
|
||||
-(id)initAt:(vector)org linkedTo:(integer[])link flags:(integer)flag
|
||||
-(id)initAt:(vector)org linkedTo:(integer*)link flags:(integer)flag
|
||||
{
|
||||
self = [self initAt:org];
|
||||
links[0] = (Waypoint) link[0];
|
||||
links[1] = (Waypoint) link[1];
|
||||
links[2] = (Waypoint) link[2];
|
||||
links[3] = (Waypoint) link[3];
|
||||
links[0] = (Waypoint *) link[0];
|
||||
links[1] = (Waypoint *) link[1];
|
||||
links[2] = (Waypoint *) link[2];
|
||||
links[3] = (Waypoint *) link[3];
|
||||
flags = flag;
|
||||
return self;
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ Array waypoint_array;
|
|||
{
|
||||
[self initAt:ent.origin];
|
||||
//FIXME do entity based init
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc
|
||||
|
@ -136,10 +137,10 @@ Array waypoint_array;
|
|||
|
||||
-(void)clearLinks
|
||||
{
|
||||
links[0] = links[1] = links[2] = links[3] = NIL;
|
||||
links[0] = links[1] = links[2] = links[3] = nil;
|
||||
}
|
||||
|
||||
-(integer)isLinkedTo:(Waypoint)way
|
||||
-(integer)isLinkedTo:(Waypoint *)way
|
||||
{
|
||||
local integer i;
|
||||
|
||||
|
@ -156,7 +157,7 @@ Array waypoint_array;
|
|||
return 0;
|
||||
}
|
||||
|
||||
-(integer)linkWay:(Waypoint)way
|
||||
-(integer)linkWay:(Waypoint *)way
|
||||
{
|
||||
local integer i;
|
||||
|
||||
|
@ -175,7 +176,7 @@ Array waypoint_array;
|
|||
}
|
||||
|
||||
// Link Ways part 2, used only for teleporters
|
||||
-(integer)teleLinkWay:(Waypoint)way
|
||||
-(integer)teleLinkWay:(Waypoint *)way
|
||||
{
|
||||
local integer i;
|
||||
|
||||
|
@ -194,7 +195,7 @@ Array waypoint_array;
|
|||
return 0;
|
||||
}
|
||||
|
||||
-(void)unlinkWay:(Waypoint)way
|
||||
-(void)unlinkWay:(Waypoint *)way
|
||||
{
|
||||
local integer i;
|
||||
|
||||
|
@ -206,7 +207,7 @@ Array waypoint_array;
|
|||
for (i = 0; i < 4; i++) {
|
||||
if (links[i] == way) {
|
||||
flags &= ~(AI_TELELINK_1 << i);
|
||||
links[i] = NIL;
|
||||
links[i] = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ Waypoint Loading from file
|
|||
+(void)loadFile:(string)path
|
||||
{
|
||||
local QFile file;
|
||||
local PLItem plist;
|
||||
local PLItem *plist;
|
||||
local string plist_data;
|
||||
local integer i, count;
|
||||
|
||||
|
@ -238,26 +239,26 @@ Waypoint Loading from file
|
|||
|
||||
[Waypoint clearAll];
|
||||
|
||||
count = [(PLArray)plist numObjects];
|
||||
count = [(PLArray *)plist numObjects];
|
||||
dprint (sprintf ("%i waypoints\n", count));
|
||||
for (i = 0; i < count; i++) {
|
||||
local PLDictionary way = (PLDictionary) [(PLArray) plist getObjectAtIndex:i];
|
||||
local PLString s = (PLString) [way getObjectForKey:"origin"];
|
||||
local PLDictionary *way = (PLDictionary *) [(PLArray *) plist getObjectAtIndex:i];
|
||||
local PLString *s = (PLString *) [way getObjectForKey:"origin"];
|
||||
local vector org = stov (sprintf ("'%s'", [s string]));
|
||||
local PLArray links = (PLArray) [way getObjectForKey:"link"];
|
||||
local PLArray *links = (PLArray *) [way getObjectForKey:"link"];
|
||||
//FIXME compiler/vm "bug" makes passing pointers to locals dangerous
|
||||
|
||||
s = (PLString) [way getObjectForKey:"flags"];
|
||||
s = (PLString *) [way getObjectForKey:"flags"];
|
||||
local integer flags = stoi ([s string]);
|
||||
|
||||
@static integer[4] link;
|
||||
s = (PLString) [links getObjectAtIndex:0];
|
||||
@static integer link[4];
|
||||
s = (PLString *) [links getObjectAtIndex:0];
|
||||
link[0] = stoi ([s string]);
|
||||
s = (PLString) [links getObjectAtIndex:1];
|
||||
s = (PLString *) [links getObjectAtIndex:1];
|
||||
link[1] = stoi ([s string]);
|
||||
s = (PLString) [links getObjectAtIndex:2];
|
||||
s = (PLString *) [links getObjectAtIndex:2];
|
||||
link[2] = stoi ([s string]);
|
||||
s = (PLString) [links getObjectAtIndex:3];
|
||||
s = (PLString *) [links getObjectAtIndex:3];
|
||||
link[3] = stoi ([s string]);
|
||||
|
||||
[[Waypoint alloc] initAt:org linkedTo:link flags:flags];
|
||||
|
@ -273,10 +274,10 @@ Waypoint Loading from file
|
|||
waypoint_init ();
|
||||
}
|
||||
|
||||
+(Waypoint)waypointForNum:(integer)num
|
||||
+(Waypoint *)waypointForNum:(integer)num
|
||||
{
|
||||
if (!num)
|
||||
return NIL;
|
||||
return nil;
|
||||
return [waypoint_array objectAtIndex:num - 1];
|
||||
}
|
||||
|
||||
|
@ -326,10 +327,10 @@ Waypoint Loading from file
|
|||
//[waypoint_array makeObjectsPerformSelector:@selector(debug)];
|
||||
}
|
||||
|
||||
-(void)plitem:(PLItem)list
|
||||
-(void)plitem:(PLItem *)list
|
||||
{
|
||||
local PLDictionary way = (PLDictionary) [PLItem newDictionary];
|
||||
local PLArray l = (PLArray) [PLItem newArray];
|
||||
local PLDictionary *way = (PLDictionary *) [PLItem newDictionary];
|
||||
local PLArray *l = (PLArray *) [PLItem newArray];
|
||||
local integer i;
|
||||
|
||||
[way addKey:"origin" value:[PLItem newString:sprintf ("%g %g %g",
|
||||
|
@ -344,18 +345,18 @@ Waypoint Loading from file
|
|||
}
|
||||
[way addKey:"link" value:l];
|
||||
[way addKey:"flags" value:[PLItem newString:itos (flags)]];
|
||||
[(PLArray) list addObject:way];
|
||||
[(PLArray *) list addObject:way];
|
||||
}
|
||||
|
||||
+(PLItem) plist
|
||||
+(PLItem *) plist
|
||||
{
|
||||
local PLItem list = [PLItem newArray];
|
||||
local PLItem *list = [PLItem newArray];
|
||||
[waypoint_array makeObjectsPerformSelector:@selector(plitem:)
|
||||
withObject:list];
|
||||
return list;
|
||||
}
|
||||
|
||||
-(void) checkWay:(Target)ent
|
||||
-(void) checkWay:(Target *)ent
|
||||
{
|
||||
local integer i;
|
||||
for (i = 0; i < 4; i++)
|
||||
|
@ -372,18 +373,18 @@ Waypoint Loading from file
|
|||
sprintf ("Waypoitn %i links to itself\n", [self id]));
|
||||
}
|
||||
|
||||
+(void) check:(Target)ent
|
||||
+(void) check:(Target *)ent
|
||||
{
|
||||
[waypoint_array makeObjectsPerformSelector:@selector(checkWay)
|
||||
withObject:ent];
|
||||
}
|
||||
|
||||
+(Waypoint)find:(vector)org radius:(float)rad
|
||||
+(Waypoint *)find:(vector)org radius:(float)rad
|
||||
{
|
||||
local vector dif;
|
||||
local float dist;
|
||||
local integer i, count;
|
||||
local Waypoint way = NIL, w;
|
||||
local Waypoint *way = nil, *w;
|
||||
|
||||
rad = rad * rad; // radius squared
|
||||
|
||||
|
@ -423,7 +424,7 @@ Waypoint Loading from file
|
|||
{
|
||||
if (ent) {
|
||||
remove (ent);
|
||||
ent = NIL;
|
||||
ent = nil;
|
||||
own = 0;
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +459,7 @@ Route & path table management
|
|||
-(void)clearRoute
|
||||
{
|
||||
busy = FALSE;
|
||||
enemy = NIL;
|
||||
enemy = nil;
|
||||
distance = -1; // not in table
|
||||
}
|
||||
|
||||
|
@ -468,12 +469,12 @@ Route & path table management
|
|||
[waypoint_array makeObjectsPerformSelector:@selector (clearRoute)];
|
||||
}
|
||||
|
||||
-(void)clearRouteForBot:(Bot)bot
|
||||
-(void)clearRouteForBot:(Bot *)bot
|
||||
{
|
||||
bot_bits &= ~bot.b_clientflag;
|
||||
}
|
||||
|
||||
+(void)clearMyRoute:(Bot) bot
|
||||
+(void)clearMyRoute:(Bot *) bot
|
||||
{
|
||||
[waypoint_array makeObjectsPerformSelector:@selector (clearRouteForBot:)
|
||||
withObject:bot];
|
||||
|
@ -490,7 +491,7 @@ tripping the runaway loop counter
|
|||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
*/
|
||||
|
||||
-(void)followLink:(Waypoint)e2 :(integer)bBit
|
||||
-(void)followLink:(Waypoint *)e2 :(integer)bBit
|
||||
{
|
||||
local float dist;
|
||||
|
||||
|
@ -529,7 +530,7 @@ tripping the runaway loop counter
|
|||
if (flags & AI_TRACE_TEST) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (links[i]) {
|
||||
traceline (origin, links[i].origin, TRUE, /*self*/NIL);
|
||||
traceline (origin, links[i].origin, TRUE, /*self*/nil);
|
||||
if (trace_fraction == 1)
|
||||
[self followLink:links[i] :AI_TELELINK_1 << i];
|
||||
}
|
||||
|
@ -554,7 +555,7 @@ tripping the runaway loop counter
|
|||
if ((waypoint_thinker.@this = [waypoint_queue removeItemAtHead])) {
|
||||
local id obj = waypoint_thinker.@this;
|
||||
local IMP imp = [obj methodForSelector: @selector (waypointThink)];
|
||||
waypoint_thinker.think = (void ()) imp;
|
||||
waypoint_thinker.think = (void ()()) imp;
|
||||
waypoint_thinker.nextthink = time;
|
||||
}
|
||||
}
|
||||
|
@ -565,14 +566,14 @@ tripping the runaway loop counter
|
|||
[waypoint_queue addItemAtTail: self];
|
||||
} else {
|
||||
local IMP imp = [self methodForSelector: @selector (waypointThink)];
|
||||
waypoint_thinker.think = (void ()) imp;
|
||||
waypoint_thinker.think = (void ()()) imp;
|
||||
waypoint_thinker.nextthink = time;
|
||||
waypoint_thinker.@this = self;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(integer)priority:(Bot)bot
|
||||
-(integer)priority:(Bot *)bot
|
||||
{
|
||||
if (flags & AI_SNIPER)
|
||||
return 30;
|
||||
|
@ -609,7 +610,7 @@ BSP/QC Waypoint loading
|
|||
|
||||
void() waypoint =
|
||||
{
|
||||
local Waypoint way = [[Waypoint alloc] initFromEntity: @self];
|
||||
local Waypoint *way = [[Waypoint alloc] initFromEntity: @self];
|
||||
};
|
||||
|
||||
/* create a new waypoint using frikbot style info
|
||||
|
@ -623,11 +624,11 @@ void() waypoint =
|
|||
*/
|
||||
void(vector org, vector bit1, integer bit4, integer flargs) make_way =
|
||||
{
|
||||
local Waypoint y = [[Waypoint alloc] initAt:org];
|
||||
local Waypoint *y = [[Waypoint alloc] initAt:org];
|
||||
waypoint_mode = WM_LOADED;
|
||||
y.flags = flargs;
|
||||
y.links[0] = (Waypoint) (integer) bit1_x;
|
||||
y.links[1] = (Waypoint) (integer) bit1_y;
|
||||
y.links[2] = (Waypoint) (integer) bit1_z;
|
||||
y.links[3] = (Waypoint) (integer) bit4;
|
||||
y.links[0] = (Waypoint *) (integer) bit1.x;
|
||||
y.links[1] = (Waypoint *) (integer) bit1.y;
|
||||
y.links[2] = (Waypoint *) (integer) bit1.z;
|
||||
y.links[3] = (Waypoint *) (integer) bit4;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ CPP=cpp
|
|||
CPPFLAGS=-I. -Iweapons -Imdl -Iact -Imapents
|
||||
|
||||
QFCC=qfcc
|
||||
QFCCFLAGS=-qg -Wall -Werror $(CPPFLAGS)
|
||||
QFCCFLAGS=-qg -Cvector-components -Wall -Werror $(CPPFLAGS)
|
||||
|
||||
###############################################
|
||||
|
||||
|
|
|
@ -686,8 +686,8 @@ player_takeitem =
|
|||
local float eid;
|
||||
|
||||
nitem = 0;
|
||||
str1 = NIL;
|
||||
str2 = NIL;
|
||||
str1 = nil;
|
||||
str2 = nil;
|
||||
|
||||
while ((eid = equip_iter (other)) != -1) {
|
||||
if (equip_query (self, eid))
|
||||
|
@ -714,7 +714,7 @@ player_takeitem =
|
|||
self.armortype = other.armortype;
|
||||
|
||||
_item_xprint_strs (nitem, str1, str2);
|
||||
str2 = NIL;
|
||||
str2 = nil;
|
||||
if (self.armortype >= 0.8)
|
||||
str1 = "strong armor";
|
||||
else if (self.armortype >= 0.6)
|
||||
|
|
|
@ -259,6 +259,6 @@ ClientDisconnect =
|
|||
" frags\n");
|
||||
|
||||
override_set_th_kill (self, NOTHING_function);
|
||||
self.deathmsg1 = NIL;
|
||||
self.deathmsg1 = nil;
|
||||
damage (self, self, self, DAMAGE_MUSTDIE, NOTHING_function);
|
||||
};
|
||||
|
|
|
@ -319,7 +319,7 @@ trigger_counter =
|
|||
{
|
||||
util_map_entity_init ();
|
||||
|
||||
self.model = NIL;
|
||||
self.model = nil;
|
||||
self.modelindex = 0;
|
||||
|
||||
if (!self.count)
|
||||
|
|
|
@ -239,8 +239,8 @@ float(float d) _movewall_door_takedamage = {
|
|||
/* Use target if you need it to go more
|
||||
than once */
|
||||
self.message = "";
|
||||
self.noise1 = NIL;
|
||||
self.noise2 = NIL;
|
||||
self.noise1 = nil;
|
||||
self.noise2 = nil;
|
||||
}
|
||||
|
||||
self = self.enemy;
|
||||
|
@ -277,8 +277,8 @@ void() _movewall_door_touch = {
|
|||
/* Use target if you need it to go more
|
||||
than once */
|
||||
self.message = "";
|
||||
self.noise1 = NIL;
|
||||
self.noise2 = NIL;
|
||||
self.noise1 = nil;
|
||||
self.noise2 = nil;
|
||||
}
|
||||
self = self.enemy;
|
||||
}
|
||||
|
@ -337,12 +337,12 @@ void() _door_link = {
|
|||
|
||||
tail.message = "";
|
||||
|
||||
tail.noise1 = NIL;
|
||||
tail.noise2 = NIL;
|
||||
tail.noise3 = NIL;
|
||||
tail.noise4 = NIL;
|
||||
tail.noise5 = NIL;
|
||||
tail.noise6 = NIL;
|
||||
tail.noise1 = nil;
|
||||
tail.noise2 = nil;
|
||||
tail.noise3 = nil;
|
||||
tail.noise4 = nil;
|
||||
tail.noise5 = nil;
|
||||
tail.noise6 = nil;
|
||||
}
|
||||
|
||||
tail.enemy = world;
|
||||
|
@ -730,8 +730,8 @@ void() _movewall_secret_use = {
|
|||
void() _movewall_secret_think = {
|
||||
if (floor (self.state) != self.state) {
|
||||
if (self.count == 0 && self.state == 0.5) {
|
||||
self.message = NIL;
|
||||
self.noise2 = NIL;
|
||||
self.message = nil;
|
||||
self.noise2 = nil;
|
||||
|
||||
if (!util_use_targets ()) {
|
||||
self.velocity = '0 0 0';
|
||||
|
|
|
@ -82,7 +82,7 @@ void() _powerup_think = {
|
|||
|
||||
if (powerup.noise) {
|
||||
sound(self, CHAN_AUTO, powerup.noise, 1, ATTN_NORM);
|
||||
powerup.noise = NIL;
|
||||
powerup.noise = nil;
|
||||
}
|
||||
|
||||
powerup.air_finished += 1;
|
||||
|
@ -410,7 +410,7 @@ void() _ring_think = {
|
|||
|
||||
if (powerup.noise) {
|
||||
sound(self, CHAN_AUTO, powerup.noise, 1, ATTN_NORM);
|
||||
powerup.noise = NIL;
|
||||
powerup.noise = nil;
|
||||
}
|
||||
|
||||
powerup.air_finished += 1;
|
||||
|
|
|
@ -89,13 +89,13 @@ void() trap_spikeshooter = {
|
|||
} else if (self.spawnflags & SPAWNFLAG_SUPERSPIKE) {
|
||||
self.weaponmodel = "progs/s_spike.mdl";
|
||||
self.noise1 = "weapons/spike2.wav";
|
||||
self.noise2 = NIL;
|
||||
self.noise2 = nil;
|
||||
self.speed = 1000;
|
||||
self.dmg = 18;
|
||||
} else {
|
||||
self.weaponmodel = "progs/spike.mdl";
|
||||
self.noise1 = "weapons/spike2.wav";
|
||||
self.noise2 = NIL;
|
||||
self.noise2 = nil;
|
||||
self.speed = 1000;
|
||||
self.dmg = 9;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ void() trigger_teleport = {
|
|||
self.noise = "ambience/hum1.wav";
|
||||
setmodel(self, self.model);
|
||||
|
||||
self.model = NIL;
|
||||
self.model = nil;
|
||||
self.modelindex = 0;
|
||||
|
||||
util_map_entity_init();
|
||||
|
|
|
@ -131,9 +131,9 @@ float() util_use_targets = {
|
|||
if (self.count > 0) {
|
||||
self.count--;
|
||||
if (!self.count) {
|
||||
self.targetname = NIL;
|
||||
self.target = NIL;
|
||||
self.killtarget = NIL;
|
||||
self.targetname = nil;
|
||||
self.target = nil;
|
||||
self.killtarget = nil;
|
||||
|
||||
self.use = NOTHING_function;
|
||||
self.touch = NOTHING_function;
|
||||
|
|
|
@ -33,7 +33,7 @@ safe_remove =
|
|||
{
|
||||
e.takedamage = DAMAGE_NO;
|
||||
e.solid = SOLID_NOT;
|
||||
e.model = NIL;
|
||||
e.model = nil;
|
||||
e.modelindex = 0;
|
||||
|
||||
e.think = SUB_remove;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: spprogs.dat
|
||||
spprogs.dat: progs.src *.qc
|
||||
qfcc -Werror -g --advanced
|
||||
qfcc -Cvector-components -Werror -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h
|
||||
|
|
|
@ -121,6 +121,7 @@ FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil; //FIXME need noreturn
|
||||
};
|
||||
|
||||
void ()
|
||||
|
@ -567,6 +568,7 @@ ValidateUser =
|
|||
|
||||
return true;
|
||||
*/
|
||||
return 1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -18,6 +18,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return nil;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -158,6 +158,7 @@ float() WizardAttackFinished =
|
|||
self.attack_state = AS_SLIDING;
|
||||
self.think = wiz_side1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
// FAST ATTACKS ===============================================================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: progs.dat
|
||||
progs.dat: progs.src *.qc
|
||||
qfcc -Werror -g --advanced
|
||||
qfcc -Cvector-components -Werror -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h
|
||||
|
|
|
@ -30,7 +30,7 @@ float (string st) check_bot_name =
|
|||
}
|
||||
botname = find(botname, classname, "bot");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
string() bot_name =
|
||||
|
|
|
@ -99,6 +99,7 @@ entity() FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return nil;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: qwprogs.dat
|
||||
qwprogs.dat: progs.src *.qc
|
||||
qfcc -Werror -g --advanced
|
||||
qfcc -Cvector-components -Werror -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h
|
||||
|
|
|
@ -94,6 +94,7 @@ entity() FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil;
|
||||
};
|
||||
|
||||
void() GotoNextMap =
|
||||
|
@ -385,6 +386,7 @@ float(entity e) ValidateUser =
|
|||
}
|
||||
return true;
|
||||
*/
|
||||
return 1;
|
||||
};
|
||||
/*
|
||||
===========
|
||||
|
|
|
@ -18,6 +18,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return nil;
|
||||
};
|
||||
/*
|
||||
================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: progs.dat
|
||||
progs.dat: progs.src *.qc
|
||||
qfcc -Nwarn -Wall -Werror -g --advanced
|
||||
qfcc -Cvector-components -Nwarn -Wall -Werror -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h *.i? *.p
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
if (random() < 0.5)
|
||||
{
|
||||
//Not PO'd anymore.
|
||||
self.enemy = NIL;
|
||||
self.enemy = nil;
|
||||
self.th_walk();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -124,6 +124,7 @@ entity() FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil; //FIXME need noreturn
|
||||
};
|
||||
|
||||
string nextmap;
|
||||
|
|
|
@ -491,8 +491,6 @@ float AS_MISSILE = 4;
|
|||
.string mdl;
|
||||
.vector mangle; // angle at start
|
||||
|
||||
.vector oldorigin; // only used by secret door
|
||||
|
||||
.float t_length, t_width;
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ vector() SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return '0 0 0';
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -177,6 +177,7 @@ float() WizardAttackFinished =
|
|||
self.attack_state = AS_SLIDING;
|
||||
self.think = wiz_side1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
all: qwprogs.dat
|
||||
qwprogs.dat: progs.src *.qc
|
||||
qfcc -Werror -Wall -g --advanced
|
||||
qfcc -Cvector-components -Werror -Wall -g --advanced
|
||||
clean:
|
||||
rm -f core *.dat *.sym progdefs.h *.p *.i1 *.i2
|
||||
|
|
|
@ -113,6 +113,7 @@ FindIntermission =
|
|||
return spot;
|
||||
|
||||
objerror ("FindIntermission: no spot");
|
||||
return nil; //FIXME need noreturn
|
||||
};
|
||||
|
||||
void ()
|
||||
|
@ -378,8 +379,8 @@ ValidateUser =
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
*/
|
||||
return 1;
|
||||
};
|
||||
|
||||
void () DecodeLevelParms;
|
||||
|
|
|
@ -23,6 +23,7 @@ SetMovedir =
|
|||
}
|
||||
|
||||
self.angles = '0 0 0';
|
||||
return '0 0 0';
|
||||
};
|
||||
|
||||
void ()
|
||||
|
|
Loading…
Reference in a new issue