mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-02 04:32:24 +00:00
tidied up locs code and changed loc commands to loc <args>
This commit is contained in:
parent
a348e15954
commit
6bea8babbe
3 changed files with 202 additions and 256 deletions
|
@ -38,9 +38,16 @@ typedef struct
|
||||||
} location_t;
|
} location_t;
|
||||||
|
|
||||||
location_t *locs_find(vec3_t target);
|
location_t *locs_find(vec3_t target);
|
||||||
void locs_load(char *mapname);
|
void locs_load(char *filename);
|
||||||
void locs_reset();
|
void locs_reset();
|
||||||
void locs_add(vec3_t location, char *name);
|
void locs_add(vec3_t location, char *name);
|
||||||
|
void map_to_loc (char *mapname, char *filename);
|
||||||
|
void locs_del (char *filename, vec3_t loc);
|
||||||
|
void locs_edit (char *filename, vec3_t loc, char *desc);
|
||||||
|
void locs_mark (char *filename, vec3_t loc, char *desc);
|
||||||
|
void locs_save (char *filename);
|
||||||
|
int locs_nearest (vec3_t loc);
|
||||||
|
|
||||||
extern location_t **locations;
|
extern location_t **locations;
|
||||||
extern int locations_count;
|
extern int locations_count;
|
||||||
#ifdef HAVE_ZLIB
|
#ifdef HAVE_ZLIB
|
||||||
|
|
150
source/locs.c
150
source/locs.c
|
@ -41,6 +41,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "locs.h"
|
#include "locs.h"
|
||||||
|
#include "quakefs.h"
|
||||||
#include "qtypes.h"
|
#include "qtypes.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
@ -53,28 +54,36 @@ int location_blocks = 0;
|
||||||
int locisgz = 0;
|
int locisgz = 0;
|
||||||
|
|
||||||
void locs_add (vec3_t location, char *name);
|
void locs_add (vec3_t location, char *name);
|
||||||
void locs_load (char *mapname);
|
void locs_load (char *filename);
|
||||||
void locs_free (void);
|
void locs_free (void);
|
||||||
void locs_more (void);
|
void locs_more (void);
|
||||||
|
|
||||||
|
int
|
||||||
|
locs_nearest (vec3_t loc)
|
||||||
|
{
|
||||||
|
location_t *cur;
|
||||||
|
float best_distance = 9999999, distance;
|
||||||
|
int i, j = -1;
|
||||||
|
|
||||||
|
for (i = 0; i < locations_count; i++) {
|
||||||
|
cur = locations[i];
|
||||||
|
distance = VectorDistance_fast (loc, cur->loc);
|
||||||
|
if ((distance < best_distance)) {
|
||||||
|
best_distance = distance;
|
||||||
|
j = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (j);
|
||||||
|
}
|
||||||
|
|
||||||
location_t *
|
location_t *
|
||||||
locs_find (vec3_t target)
|
locs_find (vec3_t target)
|
||||||
{
|
{
|
||||||
location_t *best = NULL, *cur;
|
int i;
|
||||||
float best_distance = 9999999, distance;
|
i = locs_nearest(target);
|
||||||
int i;
|
if (i == -1)
|
||||||
|
return NULL;
|
||||||
for (i = 0; i < locations_count; i++) {
|
return locations[i];
|
||||||
cur = locations[i];
|
|
||||||
distance = VectorDistance_fast (target, cur->loc);
|
|
||||||
// distance = VectorDistance(target, cur->loc);
|
|
||||||
if ((distance < best_distance) || !best) {
|
|
||||||
best = cur;
|
|
||||||
best_distance = distance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return best;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -99,16 +108,16 @@ locs_add (vec3_t location, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
locs_load (char *mapname)
|
locs_load (char *filename)
|
||||||
{
|
{
|
||||||
QFile *file;
|
QFile *file;
|
||||||
char *line, *t1, *t2;
|
char *line, *t1, *t2;
|
||||||
vec3_t loc;
|
vec3_t loc;
|
||||||
char tmp[PATH_MAX];
|
char tmp[PATH_MAX];
|
||||||
char foundname[MAX_OSPATH];
|
char foundname[MAX_OSPATH];
|
||||||
int templength = 0;
|
int templength = 0;
|
||||||
|
|
||||||
snprintf (tmp, sizeof (tmp), "maps/%s.loc", mapname);
|
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
|
||||||
templength = _COM_FOpenFile (tmp, &file, foundname, 1);
|
templength = _COM_FOpenFile (tmp, &file, foundname, 1);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Con_Printf ("Couldn't load %s\n", tmp);
|
Con_Printf ("Couldn't load %s\n", tmp);
|
||||||
|
@ -123,10 +132,16 @@ locs_load (char *mapname)
|
||||||
while ((line = Qgetline (file))) {
|
while ((line = Qgetline (file))) {
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
loc[0] = strtol (line, &t1, 0) * (1.0 / 8);
|
loc[0] = strtol (line, &t1, 0) * (1.0 / 8);
|
||||||
|
if (line == t1)
|
||||||
|
continue;
|
||||||
loc[1] = strtol (t1, &t2, 0) * (1.0 / 8);
|
loc[1] = strtol (t1, &t2, 0) * (1.0 / 8);
|
||||||
|
if (t2 == t1)
|
||||||
|
continue;
|
||||||
loc[2] = strtol (t2, &t1, 0) * (1.0 / 8);
|
loc[2] = strtol (t2, &t1, 0) * (1.0 / 8);
|
||||||
|
if ((t1 == t2) || (strlen(t1) < 2))
|
||||||
|
continue;
|
||||||
t1++;
|
t1++;
|
||||||
t2 = strrchr (t1, '\n');
|
t2 = strrchr (t1, '\n');
|
||||||
if (t2) {
|
if (t2) {
|
||||||
|
@ -175,3 +190,98 @@ locs_more (void)
|
||||||
if (!locations)
|
if (!locations)
|
||||||
Sys_Error ("ERROR! Can not alloc memory for location block!");
|
Sys_Error ("ERROR! Can not alloc memory for location block!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
locs_save (char *filename)
|
||||||
|
{
|
||||||
|
QFile *locfd;
|
||||||
|
int i;
|
||||||
|
char locfile[MAX_OSPATH];
|
||||||
|
|
||||||
|
if (locisgz) {
|
||||||
|
if (strncmp(filename + strlen(filename) - 3,".gz",3) != 0)
|
||||||
|
snprintf (locfile, sizeof (locfile), "%s.gz",filename);
|
||||||
|
else
|
||||||
|
strcpy(locfile,filename);
|
||||||
|
locfd = Qopen (locfile,"z9w+");
|
||||||
|
} else
|
||||||
|
locfd = Qopen (filename,"w+");
|
||||||
|
if (locfd == 0) {
|
||||||
|
Con_Printf("ERROR: Unable to open %s\n",filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (i=0; i < locations_count; i++)
|
||||||
|
Qprintf(locfd,"%.0f %.0f %.0f %s\n",
|
||||||
|
locations[i]->loc[0] * 8,
|
||||||
|
locations[i]->loc[1] * 8,
|
||||||
|
locations[i]->loc[2] * 8,
|
||||||
|
locations[i]->name);
|
||||||
|
Qclose (locfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
locs_mark (char *filename, vec3_t loc, char *desc)
|
||||||
|
{
|
||||||
|
locs_add (loc,desc);
|
||||||
|
locs_save (filename);
|
||||||
|
Con_Printf ("Marked current location: %s\n",desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
locs_edit
|
||||||
|
call with description to modify location description
|
||||||
|
call with NULL description to modify location vectors
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
locs_edit (char *filename, vec3_t loc, char *desc)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (locations_count) {
|
||||||
|
i = locs_nearest (loc);
|
||||||
|
if (!desc) {
|
||||||
|
VectorCopy (loc,locations[i]->loc);
|
||||||
|
Con_Printf ("Moving location marker for %s\n",
|
||||||
|
locations[i]->name);
|
||||||
|
} else {
|
||||||
|
free ((void *) locations[i]->name);
|
||||||
|
locations[i]->name = strdup (desc);
|
||||||
|
Con_Printf ("Changing location description to %s\n",
|
||||||
|
locations[i]->name);
|
||||||
|
}
|
||||||
|
locs_save (filename);
|
||||||
|
} else
|
||||||
|
Con_Printf ("Error: No location markers to modify!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
locs_del (char *filename, vec3_t loc)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (locations_count) {
|
||||||
|
i = locs_nearest (loc);
|
||||||
|
Con_Printf ("Removing location marker for %s\n",
|
||||||
|
locations[i]->name);
|
||||||
|
free ((void *) locations[i]->name);
|
||||||
|
free ((void *) locations[i]);
|
||||||
|
locations_count--;
|
||||||
|
for (; i < locations_count; i++)
|
||||||
|
locations[i] = locations[i+1];
|
||||||
|
locations[locations_count] = NULL;
|
||||||
|
locs_save(filename);
|
||||||
|
} else
|
||||||
|
Con_Printf ("Error: No location markers to remove\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
map_to_loc (char *mapname, char *filename)
|
||||||
|
{
|
||||||
|
char *t1;
|
||||||
|
|
||||||
|
strcpy(filename, mapname);
|
||||||
|
t1 = strrchr(filename,'.');
|
||||||
|
if (!t1)
|
||||||
|
Sys_Error ("Can't find .!");
|
||||||
|
t1++;
|
||||||
|
strcpy(t1,"loc");
|
||||||
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "locs.h"
|
#include "locs.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "quakefs.h"
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "teamplay.h"
|
#include "teamplay.h"
|
||||||
|
|
||||||
|
@ -314,20 +313,19 @@ Team_NewMap (void)
|
||||||
|
|
||||||
died = false;
|
died = false;
|
||||||
recorded_location = false;
|
recorded_location = false;
|
||||||
|
mapname = strdup(cl.worldmodel->name);
|
||||||
mapname = strdup (cl.worldmodel->name);
|
t2 = malloc(sizeof(cl.worldmodel->name));
|
||||||
if (!mapname)
|
if (!mapname || !t2)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
t1 = strrchr (mapname, '/');
|
map_to_loc(mapname,t2);
|
||||||
t2 = strrchr (mapname, '.');
|
t1 = strrchr (t2, '/');
|
||||||
if (!t1 || !t2)
|
if (!t1)
|
||||||
Sys_Error ("Can't find / or .!");
|
Sys_Error ("Can't find /!");
|
||||||
t1++; // skip over /
|
t1++; // skip over /
|
||||||
t2[0] = '\0';
|
|
||||||
|
|
||||||
locs_reset ();
|
locs_reset ();
|
||||||
locs_load (t1);
|
locs_load (t1);
|
||||||
free (mapname);
|
free (mapname);
|
||||||
|
free (t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -342,252 +340,83 @@ Team_Init_Cvars (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* locs_markloc
|
locs_loc
|
||||||
*
|
Location marker manipulation
|
||||||
* Record the current co-ords plus description into a loc file for current map
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
locs_markloc (void)
|
locs_loc (void)
|
||||||
{
|
{
|
||||||
vec3_t loc;
|
char *mapname;
|
||||||
char *mapname, *t1;
|
char *desc = NULL;
|
||||||
QFile *locfd;
|
char locfile[MAX_OSPATH];
|
||||||
char locfile[MAX_OSPATH];
|
int i;
|
||||||
char *desc = Cmd_Args ();
|
|
||||||
|
//FIXME checking needed to make sure you are actually in the game and a live.
|
||||||
if (Cmd_Argc () == 1) {
|
if (Cmd_Argc () == 1) {
|
||||||
Con_Printf
|
Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] :Modifies location data, add|rename take <description> parameter\n");
|
||||||
("markloc <description> :marks the current location with the description and records the information into a loc file.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VectorCopy (cl.simorg, loc);
|
if (Cmd_Argc () >= 3)
|
||||||
locs_add (loc, desc);
|
desc = Cmd_Args () + strlen(Cmd_Argv(1)) + 1;
|
||||||
#ifdef HAVE_ZLIB
|
mapname = malloc(sizeof(cl.worldmodel->name));
|
||||||
if(locisgz) {
|
|
||||||
Cmd_ExecuteString ("zdumploc");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
loc[0] *= 8;
|
|
||||||
loc[1] *= 8;
|
|
||||||
loc[2] *= 8;
|
|
||||||
mapname = strdup (cl.worldmodel->name);
|
|
||||||
if (!mapname)
|
if (!mapname)
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
Sys_Error ("Can't duplicate mapname!");
|
||||||
t1 = strrchr (mapname, '.');
|
map_to_loc(cl.worldmodel->name,mapname);
|
||||||
if (!t1)
|
|
||||||
Sys_Error ("Can't find .!");
|
|
||||||
t1++; // skip over .
|
|
||||||
t1[0] = 'l';
|
|
||||||
t1[1] = 'o';
|
|
||||||
t1[2] = 'c';
|
|
||||||
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
|
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
|
||||||
locfd = Qopen (locfile, "a+");
|
|
||||||
if (locfd == 0) {
|
|
||||||
locfd = Qopen (locfile, "w+");
|
|
||||||
if (locfd == 0) {
|
|
||||||
Con_Printf ("ERROR: Unable to open %s : %s\n", mapname,
|
|
||||||
strerror (errno));
|
|
||||||
free (mapname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Qprintf (locfd, "%.0f %.0f %.0f %s\n", loc[0], loc[1], loc[2],
|
|
||||||
desc);
|
|
||||||
Qclose (locfd);
|
|
||||||
Con_Printf("Marked Current Location: %s\n", desc);
|
|
||||||
free (mapname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* locs_dumploc
|
|
||||||
*
|
|
||||||
* copies the entire loc data from memory to disk
|
|
||||||
* supports zgip files via zdumploc
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
locs_dumploc (void)
|
|
||||||
{
|
|
||||||
char *mapname, *t1;
|
|
||||||
QFile *locfd = 0;
|
|
||||||
char locfile[MAX_OSPATH];
|
|
||||||
int i;
|
|
||||||
if (Cmd_Argc () != 1) {
|
|
||||||
Con_Printf
|
|
||||||
("markloc <description> :marks the current location with the description and records the information into a loc file.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mapname = strdup (cl.worldmodel->name);
|
|
||||||
if (!mapname)
|
|
||||||
Sys_Error ("Can't duplicate mapname!");
|
|
||||||
t1 = strrchr (mapname, '.');
|
|
||||||
if (!t1)
|
|
||||||
Sys_Error ("Can't find .!");
|
|
||||||
t1++; // skip over .
|
|
||||||
t1[0] = 'l';
|
|
||||||
t1[1] = 'o';
|
|
||||||
t1[2] = 'c';
|
|
||||||
if (strcmp(Cmd_Argv(0),"dumploc") == 0) {
|
|
||||||
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
|
|
||||||
locfd = Qopen (locfile, "w+");
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
} else {
|
|
||||||
snprintf (locfile, sizeof (locfile), "%s/%s.gz", com_gamedir, mapname);
|
|
||||||
locfd = Qopen (locfile, "z9w+");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (locfd == 0) {
|
|
||||||
Con_Printf ("ERROR: Unable to open %s : %s\n", mapname,
|
|
||||||
strerror (errno));
|
|
||||||
free (mapname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(i=0; i < locations_count ;i++)
|
|
||||||
Qprintf (locfd, "%.0f %.0f %.0f %s\n",
|
|
||||||
locations[i]->loc[0] * 8,
|
|
||||||
locations[i]->loc[1] * 8,
|
|
||||||
locations[i]->loc[2] * 8,
|
|
||||||
locations[i]->name);
|
|
||||||
Qclose (locfd);
|
|
||||||
free(mapname);
|
free(mapname);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* locs_search
|
|
||||||
*
|
|
||||||
* used by locs_delloc, locs_editloc, locs_moveloc
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
locs_search (vec3_t target)
|
|
||||||
{
|
|
||||||
location_t *best = NULL, *cur;
|
|
||||||
float best_distance = 9999999, distance;
|
|
||||||
int i, j = -1;
|
|
||||||
|
|
||||||
for (i = 0; i < locations_count; i++) {
|
|
||||||
cur = locations[i];
|
|
||||||
distance = VectorDistance_fast (target, cur->loc);
|
|
||||||
if ((distance < best_distance) || !best) {
|
|
||||||
best = cur;
|
|
||||||
best_distance = distance;
|
|
||||||
j = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (j);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* locs_delloc
|
|
||||||
*
|
|
||||||
* removes nearest location marker
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
locs_delloc (void)
|
|
||||||
{
|
|
||||||
vec3_t loc;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
if (Cmd_Argc () != 1) {
|
if (stricmp(Cmd_Argv(1),"save") == 0) {
|
||||||
Con_Printf("delloc :removes the nearest location marker\n");
|
if (Cmd_Argc () == 2) {
|
||||||
return;
|
i = locisgz;
|
||||||
|
locisgz = 0;
|
||||||
|
locs_save(locfile);
|
||||||
|
locisgz = i;
|
||||||
|
} else
|
||||||
|
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
||||||
}
|
}
|
||||||
if (locations_count) {
|
|
||||||
VectorCopy (cl.simorg, loc);
|
|
||||||
i = locs_search(loc);
|
|
||||||
Con_Printf("Removing Location Marker for %s\n", locations[i]->name);
|
|
||||||
free ((void *) locations[i]->name);
|
|
||||||
free ((void *) locations[i]);
|
|
||||||
locations_count--;
|
|
||||||
for (j = i; j < locations_count; j++)
|
|
||||||
locations[j] = locations[j+1];
|
|
||||||
locations[locations_count] = NULL;
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
if (locisgz)
|
|
||||||
Cmd_ExecuteString ("zdumploc");
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
Cmd_ExecuteString ("dumploc");
|
|
||||||
} else {
|
|
||||||
Con_Printf("Error: No Location Markers to Delete\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (stricmp(Cmd_Argv(1),"zsave") == 0) {
|
||||||
* locs_editloc
|
if (Cmd_Argc () == 2) {
|
||||||
*
|
i = locisgz;
|
||||||
* change the description of nearest location marker
|
locisgz = 1;
|
||||||
*/
|
locs_save(locfile);
|
||||||
void
|
locisgz = i;
|
||||||
locs_editloc (void)
|
} else
|
||||||
{
|
Con_Printf("loc save :saves locs from memory into a .loc file\n");
|
||||||
vec3_t loc;
|
}
|
||||||
int i;
|
|
||||||
char *desc = Cmd_Args ();
|
|
||||||
|
|
||||||
if (Cmd_Argc () == 1) {
|
if (stricmp(Cmd_Argv(1),"add") == 0) {
|
||||||
Con_Printf("editloc <description> :changed the description of the nearest location marker\n");
|
if (Cmd_Argc () >= 3)
|
||||||
return;
|
locs_mark(locfile,cl.simorg,desc);
|
||||||
}
|
|
||||||
if (locations_count) {
|
|
||||||
VectorCopy (cl.simorg, loc);
|
|
||||||
i = locs_search(loc);
|
|
||||||
Con_Printf("Changing location marker from %s to %s\n",
|
|
||||||
locations[i]->name, desc);
|
|
||||||
free ((void *) locations[i]->name);
|
|
||||||
locations[i]->name = strdup (desc);
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
if (locisgz)
|
|
||||||
Cmd_ExecuteString ("zdumploc");
|
|
||||||
else
|
else
|
||||||
#endif
|
Con_Printf("loc add <description> :marks the current location with the description and records the information into a loc file.\n");
|
||||||
Cmd_ExecuteString ("dumploc");
|
|
||||||
} else {
|
|
||||||
Con_Printf("Error: No Location Markers to Edit\n");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (stricmp(Cmd_Argv(1),"rename") == 0) {
|
||||||
* locs_moveloc
|
if (Cmd_Argc () >= 3)
|
||||||
*
|
locs_edit(locfile,cl.simorg,desc);
|
||||||
* Move the nearest location marker to current position
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
locs_moveloc (void)
|
|
||||||
{
|
|
||||||
vec3_t loc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (Cmd_Argc () != 1) {
|
|
||||||
Con_Printf("moveloc :Move the nearest location marker to your current location\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (locations_count) {
|
|
||||||
VectorCopy (cl.simorg, loc);
|
|
||||||
i = locs_search(loc);
|
|
||||||
Con_Printf("Moving location marker for %s to current location\n", locations[i]->name);
|
|
||||||
VectorCopy (cl.simorg,locations[i]->loc);
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
if (locisgz)
|
|
||||||
Cmd_ExecuteString ("zdumploc");
|
|
||||||
else
|
else
|
||||||
#endif
|
Con_Printf("loc rename <description> :changes the description of the nearest location marker\n");
|
||||||
Cmd_ExecuteString ("dumploc");
|
}
|
||||||
} else {
|
|
||||||
Con_Printf("Error: No Location Markers to Move\n");
|
if (stricmp(Cmd_Argv(1),"delete") == 0) {
|
||||||
|
if (Cmd_Argc () == 2)
|
||||||
|
locs_del(locfile,cl.simorg);
|
||||||
|
else
|
||||||
|
Con_Printf("loc delete :removes nearest location marker\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stricmp(Cmd_Argv(1),"move") == 0) {
|
||||||
|
if (Cmd_Argc () == 2)
|
||||||
|
locs_edit(locfile,cl.simorg,NULL);
|
||||||
|
else
|
||||||
|
Con_Printf("loc move :moves the nearest location marker to your current location\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Locs_Init (void)
|
Locs_Init (void)
|
||||||
{
|
{
|
||||||
Cmd_AddCommand ("markloc", locs_markloc, "No Description");
|
Cmd_AddCommand ("loc", locs_loc, "Location marker editing commands: 'loc help' for more");
|
||||||
Cmd_AddCommand ("dumploc", locs_dumploc, "No Description");
|
|
||||||
#ifdef HAVE_ZLIB
|
|
||||||
Cmd_AddCommand ("zdumploc", locs_dumploc, "No Description");
|
|
||||||
#endif
|
|
||||||
Cmd_AddCommand ("delloc",locs_delloc, "No Description");
|
|
||||||
Cmd_AddCommand ("editloc",locs_editloc, "No Description");
|
|
||||||
Cmd_AddCommand ("moveloc",locs_moveloc, "No Description");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue