2010-12-16 12:24:53 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <PropertyList.h>
|
|
|
|
#include <qfile.h>
|
|
|
|
#include <qfs.h>
|
|
|
|
#include <Array.h>
|
|
|
|
|
2006-12-16 14:42:55 +00:00
|
|
|
#include "impulse_menu.h"
|
|
|
|
#include "libfrikbot.h"
|
2006-12-19 14:17:58 +00:00
|
|
|
#include "editor.h"
|
2006-12-16 14:42:55 +00:00
|
|
|
|
|
|
|
@interface TeleportMenu: ImpulseValueMenu
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NoclipFlag: Object <FlagMenuItem>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface GodmodeFlag: Object <FlagMenuItem>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface HoldSelectFlag: Object <FlagMenuItem>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface DynamicFlag: Object <FlagMenuItem>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface DynamicLinkFlag: Object <FlagMenuItem>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface ConfirmationMenu: ImpulseListMenu
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface FlagCluster: Object <FlagMenuItem>
|
|
|
|
{
|
|
|
|
integer mask;
|
|
|
|
}
|
|
|
|
- initWithMask:(integer)msk;
|
|
|
|
@end
|
|
|
|
|
2006-12-19 14:17:58 +00:00
|
|
|
@implementation TeleportMenu
|
2006-12-16 14:42:55 +00:00
|
|
|
-(id) init
|
|
|
|
{
|
|
|
|
return [super initWithText:"-- Teleport to Way # --\n\n"
|
|
|
|
"Enter way number and press\n"
|
|
|
|
"impulse 104 to warp\n\n"
|
|
|
|
"Waypoint #"];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(integer) impulse:(integer)imp
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Waypoint *way = nil;
|
2006-12-16 14:42:55 +00:00
|
|
|
if ((imp = [super impulse:imp]) == 104) {
|
|
|
|
imp = 0;
|
|
|
|
if (value)
|
2011-03-20 08:27:47 +00:00
|
|
|
way = (Waypoint *) [waypoint_array objectAtIndex:value - 1];
|
2006-12-16 14:42:55 +00:00
|
|
|
value = 0;
|
|
|
|
if (way)
|
|
|
|
setorigin (@self, way.origin - @self.view_ofs);
|
|
|
|
else
|
|
|
|
sprint (@self, PRINT_HIGH, "No waypoint with that number\n");
|
|
|
|
[EditorState main_menu];
|
|
|
|
}
|
|
|
|
return imp;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NoclipFlag
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
return @self.movetype == MOVETYPE_NOCLIP;
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
if (@self.movetype == MOVETYPE_NOCLIP)
|
|
|
|
@self.movetype = MOVETYPE_WALK;
|
|
|
|
else
|
|
|
|
@self.movetype = MOVETYPE_NOCLIP;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation GodmodeFlag
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
return !!(@self.flags & FL_GODMODE);
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
@self.flags ^= FL_GODMODE;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation HoldSelectFlag
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
return [EditorState getHoldSelectState];
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
2006-12-19 14:17:58 +00:00
|
|
|
[EditorState toggleHoldSelectState];
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DynamicFlag
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
return waypoint_mode == WM_EDITOR_DYNAMIC;
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
if (waypoint_mode == WM_EDITOR_DYNAMIC)
|
|
|
|
waypoint_mode = WM_EDITOR;
|
|
|
|
else
|
|
|
|
waypoint_mode = WM_EDITOR_DYNAMIC;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation DynamicLinkFlag
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
local integer mode = waypoint_mode;
|
|
|
|
return mode == WM_EDITOR_DYNAMIC || mode == WM_EDITOR_DYNLINK;
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
|
|
|
if (waypoint_mode == WM_EDITOR_DYNLINK)
|
|
|
|
waypoint_mode = WM_EDITOR;
|
|
|
|
else
|
|
|
|
waypoint_mode = WM_EDITOR_DYNLINK;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation FlagCluster
|
|
|
|
-(id) initWithMask:(integer)msk
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
mask = msk;
|
2006-12-20 10:51:16 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(integer) state
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Waypoint *way = [EditorState current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (!way)
|
|
|
|
return 0;
|
|
|
|
return !!(way.flags & mask);
|
|
|
|
}
|
|
|
|
|
2010-08-23 05:08:37 +00:00
|
|
|
-(void) toggle
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Waypoint *way = [EditorState current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way)
|
|
|
|
way.flags ^= mask;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation ConfirmationMenu
|
|
|
|
-(string) text
|
|
|
|
{
|
|
|
|
text = [EditorState getConfirmText];
|
|
|
|
return [super text];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2011-03-20 08:27:47 +00:00
|
|
|
@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;
|
2006-12-16 14:42:55 +00:00
|
|
|
|
2011-03-20 08:27:47 +00:00
|
|
|
@static ConfirmationMenu *confirm_menu;
|
|
|
|
@static TeleportMenu *teleport_menu;
|
2006-12-16 14:42:55 +00:00
|
|
|
|
|
|
|
@static void init_menus (void)
|
|
|
|
{
|
|
|
|
main_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- Main Menu --"];
|
|
|
|
waypoint_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- Waypoint Management --"];
|
|
|
|
link_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- Link Management --"];
|
|
|
|
ai_flags_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- AI Flag Management Menu --"];
|
|
|
|
ai_flag2_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- AI Flag pg. 2 --"];
|
|
|
|
bot_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- Bot Management Menu --"];
|
|
|
|
waylist_menu = [[ImpulseListMenu alloc]
|
|
|
|
initWithText:"-- Waylist Management --"];
|
|
|
|
|
|
|
|
confirm_menu = [[ConfirmationMenu alloc] init];
|
2006-12-19 14:17:58 +00:00
|
|
|
teleport_menu = [[TeleportMenu alloc] init];
|
2006-12-16 14:42:55 +00:00
|
|
|
|
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Waypoint Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(waypoint_menu)]];
|
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Link Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(link_menu)]];
|
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>AI Flag Management"
|
|
|
|
object:[EditorState class]
|
2006-12-19 14:17:58 +00:00
|
|
|
selector:@selector(ai_flags_menu)]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Bot Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(bot_menu)]];
|
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Waylist Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(waylist_menu)]];
|
|
|
|
[main_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Noclip"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[NoclipFlag alloc] init]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[main_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Godmode"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[GodmodeFlag alloc] init]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[main_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Hold Select"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[HoldSelectFlag alloc] init]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Teleport to Way #"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(teleport_to_way)]];
|
|
|
|
[main_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Close Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(close_menu)]];
|
|
|
|
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Move Waypoint"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(move_waypoint)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Delete Waypoint"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(delete_waypoint)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Make Waypoint"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(make_waypoint)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Make Waypoint + Link"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(make_waypoint_link)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Make Way + Link X2"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(make_way_link_x2)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Make Way + Telelink"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(make_way_telelink)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Show waypoint info"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(show_waypoint_info)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Link Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(link_menu)]];
|
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>AI Flag Management"
|
|
|
|
object:[EditorState class]
|
2006-12-19 14:17:58 +00:00
|
|
|
selector:@selector(ai_flags_menu)]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[waypoint_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Unlink Waypoint"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(unlink_waypoint)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Create Link"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(create_link)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Create Telelink"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(create_telelink)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Delete Link"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(delete_link)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Create Link X2"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(create_link_x2)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Delete Link X2"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(delete_link_x2)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Make Waypoint"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(make_waypoint)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Waypoint Management"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(waypoint_menu)]];
|
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>AI Flag Management"
|
|
|
|
object:[EditorState class]
|
2006-12-19 14:17:58 +00:00
|
|
|
selector:@selector(ai_flags_menu)]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[link_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
|
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Door Flag"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_DOORFLAG]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Precision"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_PRECISION]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Surface for Air"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_SURFACE]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Blind mode"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_BLIND]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Jump"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_JUMP]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Directional"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_DIRECTIONAL]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Super Jump"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_SUPER_JUMP]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flags_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[ai_flags_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>AI Flags page 2"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(ai_flag2_menu)]];
|
|
|
|
[ai_flags_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
|
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Difficult"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_DIFFICULT]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Wait for plat"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_PLAT_BOTTOM]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Ride train"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_RIDE_TRAIN]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Door flag no open"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_DOOR_NO_OPEN]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Ambush"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_AMBUSH]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Snipe"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_SNIPER]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Trace Test"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[FlagCluster alloc]
|
|
|
|
initWithMask:AI_TRACE_TEST]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[ai_flag2_menu addItem:[[CommandMenuItem alloc]
|
2006-12-20 10:51:16 +00:00
|
|
|
initWithText:">>AI Flag Management"
|
2006-12-16 14:42:55 +00:00
|
|
|
object:[EditorState class]
|
2006-12-20 10:51:16 +00:00
|
|
|
selector:@selector(ai_flags_menu)]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[ai_flag2_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Add a Test Bot"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(add_test_bot)]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Order Test Bot here"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(call_test_bot)]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Remove Test Bot"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(remove_test_bot)]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Stop Test Bot"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(stop_test_bot)]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Teleport Bot here"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(teleport_bot)]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Teleport to Way #"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(teleport_to_way)]];
|
|
|
|
[bot_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[bot_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[bot_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[bot_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
|
|
|
|
[waylist_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Delete ALL Waypoints"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(delete_all_waypoints)]];
|
|
|
|
[waylist_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Dump Waypoints"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(dump_waypoints)]];
|
|
|
|
[waylist_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Check For Errors"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(check_for_errors)]];
|
|
|
|
[waylist_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Save Waypoints"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(save_waypoints)]];
|
|
|
|
[main_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Dynamic Mode"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[DynamicFlag alloc] init]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[main_menu addItem:[[FlagMenuItem alloc]
|
|
|
|
initWithText:"Dynamic Link"
|
2006-12-19 14:17:58 +00:00
|
|
|
flagObject:[[DynamicLinkFlag alloc] init]]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[waylist_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[waylist_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[waylist_menu addItem:[[MenuItem alloc] initWithText:""]];
|
2006-12-19 14:23:03 +00:00
|
|
|
[waylist_menu addItem:[[MenuItem alloc] initWithText:""]];
|
|
|
|
[waylist_menu addItem:[[MenuItem alloc] initWithText:""]];
|
2006-12-16 14:42:55 +00:00
|
|
|
[waylist_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:">>Main Menu"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(main_menu)]];
|
|
|
|
[confirm_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"OK"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(confirm)]];
|
|
|
|
[confirm_menu addItem:[[CommandMenuItem alloc]
|
|
|
|
initWithText:"Cancel"
|
|
|
|
object:[EditorState class]
|
|
|
|
selector:@selector(cancel)]];
|
|
|
|
}
|
|
|
|
|
|
|
|
@implementation EditorState: Object
|
2011-03-20 08:27:47 +00:00
|
|
|
+setMenu:(ImpulseMenu *)item
|
2006-12-19 14:17:58 +00:00
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
((Target *) @self.@this).editor.menu = item;
|
|
|
|
((Target *) @self.@this).editor.menu_time = time;
|
|
|
|
return self;
|
2006-12-19 14:17:58 +00:00
|
|
|
}
|
|
|
|
|
2006-12-16 14:42:55 +00:00
|
|
|
+main_menu
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: main_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+waypoint_menu
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: waypoint_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+link_menu
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: link_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ai_flags_menu
|
|
|
|
{
|
2006-12-20 10:51:16 +00:00
|
|
|
dprint ("ai_flags_menu\n");
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: ai_flags_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ai_flag2_menu
|
|
|
|
{
|
2006-12-20 10:51:16 +00:00
|
|
|
dprint ("ai_flag2_menu\n");
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: ai_flag2_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+bot_menu
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: bot_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+waylist_menu
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: waylist_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+teleport_to_way
|
|
|
|
{
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: teleport_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+close_menu
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Target *player = (Target *) @self.@this;
|
|
|
|
[EditorState setMenu: nil];
|
2006-12-19 14:17:58 +00:00
|
|
|
[Waypoint hideAll];
|
|
|
|
waypoint_mode = WM_LOADED;
|
2006-12-20 08:46:36 +00:00
|
|
|
[player.editor release];
|
2011-03-20 08:27:47 +00:00
|
|
|
player.editor = nil;
|
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+move_waypoint
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way)
|
|
|
|
[way setOrigin: @self.origin + @self.view_ofs];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+delete_waypoint
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Delete Waypoint --\n\nAre you sure?";
|
2006-12-20 11:41:11 +00:00
|
|
|
editor.confirm_cmd = "delete waypoint";
|
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+make_waypoint
|
|
|
|
{
|
|
|
|
[[Waypoint alloc] initAt: @self.origin + @self.view_ofs];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+make_waypoint_link
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
|
|
|
local Waypoint *new = [[Waypoint alloc]
|
2006-12-16 14:42:55 +00:00
|
|
|
initAt: @self.origin + @self.view_ofs];
|
|
|
|
if (!way || ![way linkWay: new])
|
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+make_way_link_x2
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
|
|
|
local Waypoint *new = [[Waypoint alloc]
|
2006-12-16 14:42:55 +00:00
|
|
|
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");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+make_way_telelink
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
|
|
|
local Waypoint *new = [[Waypoint alloc]
|
2006-12-16 14:42:55 +00:00
|
|
|
initAt: @self.origin + @self.view_ofs];
|
|
|
|
if (!way || ![way teleLinkWay: new])
|
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+show_waypoint_info
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
local integer i;
|
|
|
|
if (!way)
|
|
|
|
return self;
|
|
|
|
sprint (@self, PRINT_HIGH,
|
|
|
|
sprintf ("\nwaypoint info for waypoint #%i", [way id]));
|
|
|
|
sprint (@self, PRINT_HIGH,
|
2006-12-20 10:51:16 +00:00
|
|
|
sprintf ("\nAI Flag value: %#x", way.flags));
|
2006-12-16 14:42:55 +00:00
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (!way.links[i])
|
|
|
|
continue;
|
|
|
|
sprint (@self, PRINT_HIGH,
|
|
|
|
sprintf ("\n%s%d to: %i",
|
|
|
|
way.flags & (AI_TELELINK_1 << i) ? "Telelink" : "Link",
|
|
|
|
i + 1, [way.links[i] id]));
|
|
|
|
}
|
|
|
|
sprint (@self, PRINT_HIGH, "\n\n");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+unlink_waypoint
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way)
|
|
|
|
[way clearLinks];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+create_link
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Link Ways --\n\nSelect another way";
|
|
|
|
editor.confirm_cmd = "link ways";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+create_telelink
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Telelink Ways --\n\nSelect another way";
|
|
|
|
editor.confirm_cmd = "telelink ways";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+delete_link
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Delete Link --\n\nSelect another way";
|
|
|
|
editor.confirm_cmd = "delete link";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+create_link_x2
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Create Link X2 --\n\nSelect another way";
|
|
|
|
editor.confirm_cmd = "create link x2";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+delete_link_x2
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way) {
|
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Delete Link X2 --\n\nSelect another way";
|
|
|
|
editor.confirm_cmd = "delete link x2";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.last_way = way;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+add_test_bot
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
local integer f;
|
|
|
|
local string h;
|
|
|
|
|
|
|
|
if (editor.test_bot) {
|
|
|
|
sprint (@self, PRINT_HIGH, "already have test bot\n");
|
|
|
|
return self;
|
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
h = infokey (nil, "skill");
|
2006-12-16 14:42:55 +00:00
|
|
|
f = (integer) stof (h);
|
|
|
|
editor.test_bot = BotConnect (0, f);
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+call_test_bot
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
if (editor.test_bot)
|
2010-12-16 12:24:53 +00:00
|
|
|
[editor.test_bot getPath:[Target forEntity:@self] :TRUE];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+remove_test_bot
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
if (editor.test_bot)
|
|
|
|
[editor.test_bot disconnect];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+stop_test_bot
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
if (editor.test_bot) {
|
|
|
|
[editor.test_bot targetClearAll];
|
2011-03-20 08:27:47 +00:00
|
|
|
route_table = nil;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+teleport_bot
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
|
|
|
local Waypoint *way = [editor current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
if (way && editor.test_bot)
|
|
|
|
setorigin (editor.test_bot.ent, [way origin]);
|
|
|
|
if (!way)
|
|
|
|
sprint(@self, PRINT_HIGH, "select a waypoint first\n");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+delete_all_waypoints
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.prev_menu = editor.menu;
|
|
|
|
editor.confirm_text = "-- Delete ALL Ways --\n\nAre you sure?";
|
|
|
|
editor.confirm_cmd = "delete all ways";
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu:confirm_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+dump_waypoints
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local PLItem *plist = [Waypoint plist];
|
2006-12-16 14:42:55 +00:00
|
|
|
bprint (PRINT_HIGH, [plist write]);
|
|
|
|
bprint (PRINT_HIGH, "\n");
|
|
|
|
[plist release];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+check_for_errors
|
|
|
|
{
|
|
|
|
[Waypoint check:[Target forEntity:@self]];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+save_waypoints
|
|
|
|
{
|
|
|
|
local QFile file;
|
2011-03-20 08:27:47 +00:00
|
|
|
local PLItem *plist;
|
2006-12-16 14:42:55 +00:00
|
|
|
|
2006-12-20 12:09:31 +00:00
|
|
|
file = QFS_Open ("temp.way", "wt");
|
2006-12-16 14:42:55 +00:00
|
|
|
if (!file) {
|
|
|
|
sprint (@self, PRINT_HIGH, "cound not create file temp.way\n");
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
plist = [Waypoint plist];
|
|
|
|
Qputs (file, [plist write]);
|
|
|
|
[plist release];
|
|
|
|
Qclose (file);
|
|
|
|
sprint (@self, PRINT_HIGH, "waypoints saved to temp.way\n");
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+confirm
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Target *player = (Target *) @self.@this;
|
|
|
|
local EditorState *editor = player.editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
switch (editor.confirm_cmd) {
|
|
|
|
case "link ways":
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way) {
|
|
|
|
if (![editor.last_way linkWay:player.current_way])
|
2006-12-16 14:42:55 +00:00
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "telelink ways":
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way) {
|
|
|
|
if (![editor.last_way teleLinkWay:player.current_way])
|
2006-12-16 14:42:55 +00:00
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link them\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "delete link":
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way) {
|
|
|
|
[editor.last_way unlinkWay:player.current_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "create link x2":
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way) {
|
|
|
|
if (![editor.last_way teleLinkWay:player.current_way])
|
2006-12-16 14:42:55 +00:00
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link 1 to 2\n");
|
2006-12-20 09:53:32 +00:00
|
|
|
if (![player.current_way teleLinkWay:editor.last_way])
|
2006-12-16 14:42:55 +00:00
|
|
|
sprint (@self, PRINT_HIGH, "Unable to link 2 to 1\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "delete link x2":
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way) {
|
|
|
|
[editor.last_way unlinkWay:player.current_way];
|
|
|
|
[player.current_way unlinkWay:editor.last_way];
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "delete all ways":
|
|
|
|
[Waypoint clearAll];
|
2011-03-20 08:27:47 +00:00
|
|
|
player.current_way = editor.last_way = nil;
|
2006-12-16 14:42:55 +00:00
|
|
|
break;
|
|
|
|
case "delete waypoint":
|
2010-12-16 12:24:53 +00:00
|
|
|
[waypoint_array removeObject:editor.last_way];
|
2006-12-20 09:53:32 +00:00
|
|
|
if (player.current_way == editor.last_way)
|
2011-03-20 08:27:47 +00:00
|
|
|
player.current_way = nil;
|
|
|
|
editor.last_way = nil;
|
2006-12-16 14:42:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: editor.prev_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+cancel
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-20 11:41:11 +00:00
|
|
|
[EditorState setMenu: editor.prev_menu];
|
2011-03-20 08:27:47 +00:00
|
|
|
return self;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+(integer)getHoldSelectState
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
return editor.hold_select != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+(void)toggleHoldSelectState
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
editor.hold_select = !editor.hold_select;
|
|
|
|
}
|
|
|
|
|
|
|
|
+(string)getConfirmText
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local EditorState *editor = ((Target *) @self.@this).editor;
|
2006-12-16 14:42:55 +00:00
|
|
|
return editor.confirm_text;
|
|
|
|
}
|
|
|
|
|
2011-03-20 08:27:47 +00:00
|
|
|
+(Waypoint *)current_way
|
2006-12-16 14:42:55 +00:00
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
return ((Target *) @self.@this).current_way;
|
2006-12-20 08:46:36 +00:00
|
|
|
}
|
|
|
|
|
2011-03-20 08:27:47 +00:00
|
|
|
-(Waypoint *)current_way
|
2006-12-20 08:46:36 +00:00
|
|
|
{
|
|
|
|
return owner.current_way;
|
2006-12-16 14:42:55 +00:00
|
|
|
}
|
|
|
|
|
2006-12-19 14:17:58 +00:00
|
|
|
+(void)impulse
|
|
|
|
{
|
2011-03-20 08:27:47 +00:00
|
|
|
local Target *player = (Target *) @self.@this;
|
|
|
|
local EditorState *editor = player.editor;
|
2006-12-19 14:17:58 +00:00
|
|
|
|
|
|
|
if (!editor) {
|
|
|
|
if (@self.impulse != 104)
|
|
|
|
return;
|
2006-12-20 08:46:36 +00:00
|
|
|
player.editor = [[EditorState alloc] initWithOwner:player];
|
2006-12-19 14:17:58 +00:00
|
|
|
[EditorState main_menu];
|
|
|
|
@self.impulse = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
@self.impulse = [editor.menu impulse:@self.impulse];
|
|
|
|
if (editor.menu_time < time) {
|
|
|
|
centerprint (@self, [editor.menu text]);
|
|
|
|
editor.menu_time = time + 1.25;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-20 08:27:47 +00:00
|
|
|
-(id)initWithOwner:(Target *)owner
|
2006-12-19 14:17:58 +00:00
|
|
|
{
|
|
|
|
if (!main_menu)
|
|
|
|
init_menus ();
|
|
|
|
self = [super init];
|
2006-12-20 08:46:36 +00:00
|
|
|
self.owner = owner;
|
2006-12-19 14:17:58 +00:00
|
|
|
waypoint_mode = WM_EDITOR;
|
|
|
|
[Waypoint showAll];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2006-12-20 10:51:16 +00:00
|
|
|
-(void)refresh
|
|
|
|
{
|
|
|
|
menu_time = time;
|
|
|
|
}
|
2006-12-16 14:42:55 +00:00
|
|
|
@end
|