添加文件到工程.
======================================================================================
client.cpp
加上:
#include "AutoRoute.h"
找到:
HUD_AddEntity函数
加上:
if (cvar.routedraw && cvar.drawmode == 2){autoroute.DrawRouteLine();}
例如:
void HUD_AddEntity (int type, struct cl_entity_s *ent, const char *modelname)
{
int retval = 1;
static int beamindex = 0;
if(bNewFrame)
{
bNewFrame = false;
if (cvar.routedraw && cvar.drawmode == 2){autoroute.DrawRouteLine();}
}
..................
找到HUD_Redraw函数
加上:
if (cvar.routedraw && cvar.drawmode == 1){autoroute.DrawRouteLine();}
例如:
if (cvar.radar) { drawRadarFrame (); }
if (menu_active) { drawMenu (); }
if (cvar.soundfilter) { drawSound (); }
if (cvar.routedraw && cvar.drawmode == 1){autoroute.DrawRouteLine();}
找到CL_CreateMove函数
加上:
autoroute.CreateMove(usercmd);
注册命令的时间到了:
void func_route_load()
{
autoroute.LoadFromFile();
}
void func_route_save()
{
autoroute.SaveToFile();
}
void func_route_add_point()
{
autoroute.AddPoint();
}
void func_route_record_line()
{
int index = cmd.argI(1) - 1;
autoroute.RecordLine(index);
}
void func_route_clear_line()
{
int index = cmd.argI(1) - 1;
autoroute.ClearLine(index);
}
void func_route_clear()
{
autoroute.ClearRoute();
}
void func_route_record_stop()
{
autoroute.RecordStop();
}
void func_route_record_add()
{
autoroute.AddPoint();
}
在Init_Command_Interpreter()里:
REGISTER_COMMAND(route_load )
REGISTER_COMMAND(route_save )
REGISTER_COMMAND(route_record_line)
REGISTER_COMMAND(route_clear_line)
REGISTER_COMMAND(route_clear)
REGISTER_COMMAND(route_record_stop)
REGISTER_COMMAND(route_record_add)
=================================================================
cvar.h
加上:
int autoroute;
int routerecord;
int routedraw;
float routedist;
float drawdist;
float finddist;
float routeangle;
int pointcount;
int linecount;
int routemode;
int routeautoadd;
int drawmode;
int routepursue;
cvar.cpp
加上:
REGISTER_CVAR_INT( autoroute , 0);
REGISTER_CVAR_INT( routerecord , 0);
REGISTER_CVAR_INT( routedraw, 1);
REGISTER_CVAR_FLOAT( routedist, 42.0);
REGISTER_CVAR_FLOAT( drawdist, 800.0);
REGISTER_CVAR_FLOAT( finddist, 120.0);
REGISTER_CVAR_FLOAT( routeangle, 120.0);
REGISTER_CVAR_INT ( pointcount, 300);
REGISTER_CVAR_INT ( linecount, 5);
REGISTER_CVAR_INT ( routemode, 1);
REGISTER_CVAR_INT ( routeautoadd, 1);
REGISTER_CVAR_INT ( routepursue, 1);
REGISTER_CVAR_INT ( drawmode, 2);
==================================================================================
ok了!
routeadd.rar[点击下载](4 K) 下载次数:109 累计下载获得 DB 2 刀