Routing: Added ability to nudge existing waypoints along an axis as well as

an option to move the nearest waypoint to the player's position.
This commit is contained in:
Marco Cawthorne 2021-01-03 12:52:51 +01:00
parent 6dc054f94b
commit 6c3814a2b1
2 changed files with 82 additions and 15 deletions

View file

@ -461,6 +461,22 @@ Way_Cmd(void)
case "linkwalk":
Way_FlagWalk();
break;
case "move":
vector p;
int n = Way_FindClosestNode(self.origin);
if (n >= 0) {
p[0] = stof(argv(2));
p[1] = stof(argv(3));
p[2] = stof(argv(4));
g_pWaypoints[n].m_vecOrigin += p;
}
break;
case "movetopos":
int nearest = Way_FindClosestNode(self.origin);
if (nearest >= 0) {
g_pWaypoints[nearest].m_vecOrigin = self.origin;
}
break;
case "save":
Way_SaveFile(argv(2));
break;

View file

@ -27,8 +27,8 @@ Way_Init(void)
"4.\tLink Flags...\n" \
"5.\tRadius Settings...\n" \
"6.\tAuto-Link Settings...\n" \
"7.\tSave/Load...\n" \
"\n" \
"7.\tMove waypoint...\n" \
"8.\tSave/Load...\n" \
"9.\tExit\n";
way_menu.m_flPosX = 0;
way_menu.m_flPosY = -1;
@ -109,7 +109,7 @@ Way_Init(void)
way_flags.m_strMessage = "1.\tFlag ^3JUMP^7 (2 steps)\n" \
"2.\tFlag ^2CROUCH^7 (2 steps)\n" \
"3.\tFlag ^1WALK^7 (2 steps)\n" \
"\n" \
"4.\tFlag ^4AIM^7 (2 steps)\n" \
"\n" \
"\n" \
"\n" \
@ -153,6 +153,23 @@ Way_Init(void)
way_text.m_flPosY = -1;
Titles_AddEntry(way_text);
}
/* add waypoint menu */
{
titles_t way_move;
way_move.m_strName = "WAY_MOVE";
way_move.m_strMessage = "1.\tMove nearest +1 X-axis\n" \
"2.\tMove nearest -1 X-axis\n" \
"3.\tMove nearest +1 Y-axis\n" \
"4.\tMove nearest -1 Y-axis\n" \
"5.\tMove nearest +1 Z-axis\n" \
"6.\tMove nearest -1 Z-axis\n" \
"\n" \
"8.\tMove nearest to player-position\n" \
"9.\tBack\n";
way_move.m_flPosX = 0;
way_move.m_flPosY = -1;
Titles_AddEntry(way_move);
}
}
void
@ -178,6 +195,9 @@ WAY_MENU(int n)
Textmenu_Call("WAY_AUTOLINK");
break;
case 7:
Textmenu_Call("WAY_MOVE");
break;
case 8:
Textmenu_Call("WAY_FILE");
break;
case 9:
@ -343,3 +363,34 @@ WAY_RADIUS(int n)
break;
}
}
void
WAY_MOVE(int n)
{
switch (n) {
case 1:
localcmd("sv way move 1 0 0\n");
break;
case 2:
localcmd("sv way move -1 0 0\n");
break;
case 3:
localcmd("sv way move 0 1 0\n");
break;
case 4:
localcmd("sv way move 0 -1 0\n");
break;
case 5:
localcmd("sv way move 0 0 1\n");
break;
case 6:
localcmd("sv way move 0 0 -1\n");
break;
case 8:
localcmd("sv way movetopos\n");
break;
case 9:
Textmenu_Call("WAY_MENU");
break;
}
}