From 61f3d32eae8032d09ea8ade9a3d8d0d1d4a6b68c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 24 Aug 2003 08:18:50 +0000 Subject: [PATCH] get closer to working waypoints --- fbxa/libfrikbot.h | 2 +- fbxa/waypoint.r | 41 +++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/fbxa/libfrikbot.h b/fbxa/libfrikbot.h index 6677660..31e6fe6 100644 --- a/fbxa/libfrikbot.h +++ b/fbxa/libfrikbot.h @@ -32,7 +32,7 @@ typedef struct bot_data_t bot_data_t; integer flags; vector origin; - integer b_pants, b_skill, b_shirt, b_frags, b_sound; + integer b_sound; integer keys; float items; Waypoint enemy; diff --git a/fbxa/waypoint.r b/fbxa/waypoint.r index 48c826e..12c53ff 100644 --- a/fbxa/waypoint.r +++ b/fbxa/waypoint.r @@ -74,6 +74,13 @@ Array waypoint_array; { [self init]; [waypoint_array addItem: self]; + + if ([waypoint_array count] == 2) { + local id obj = [Waypoint class]; + local IMP imp = [obj methodForSelector: @selector (fixWaypoints)]; + waypoint_thinker.think = (void ()) imp; + waypoint_thinker.nextthink = time; + } return self; } @@ -208,10 +215,12 @@ Waypoint Loading from file -(void)fix { - links[0] = [Waypoint waypointForNum:b_pants]; - links[1] = [Waypoint waypointForNum:b_skill]; - links[2] = [Waypoint waypointForNum:b_shirt]; - links[3] = [Waypoint waypointForNum:b_frags]; + local integer i, tmp; + + for (i = 0; i < 3; i++) { + tmp = (integer)links[i]; + links[i] = [Waypoint waypointForNum:tmp]; + } } +(void) fixWaypoints @@ -271,7 +280,7 @@ Route & path table management +(void)clearMyRoute:(Bot) bot { - [waypoint_array makeObjectsPerformSelector:@selector (clearRoute) + [waypoint_array makeObjectsPerformSelector:@selector (clearRouteForBot) withObject:bot]; } @@ -350,7 +359,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)]; - (IMP)waypoint_thinker.think = imp; + waypoint_thinker.think = (void ()) imp; waypoint_thinker.nextthink = time; } } @@ -361,7 +370,7 @@ tripping the runaway loop counter [waypoint_queue addItemAtTail: self]; } else { local IMP imp = [self methodForSelector: @selector (waypointThink)]; - (IMP)waypoint_thinker.think = imp; + waypoint_thinker.think = (void ()) imp; waypoint_thinker.nextthink = time; waypoint_thinker.@this = self; } @@ -420,18 +429,10 @@ void() waypoint = void(vector org, vector bit1, integer bit4, integer flargs) make_way = { local Waypoint y = [[Waypoint alloc] initAt:org]; - //local entity y; - //waypoint_mode = WM_LOADED; - //y = make_waypoint(org); + waypoint_mode = WM_LOADED; y.flags = flargs; - y.b_pants = (integer)bit1_x; - y.b_skill = (integer)bit1_y; - y.b_shirt = (integer)bit1_z; - y.b_frags = bit4; - /* - if (y.count == 1) { - y.think = FixWaypoints; // wait until all qc loaded points are spawned - y.nextthink = time; - } - */ + 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; };