Overhaul to console structure, a bit
This commit is contained in:
+50
-50
@@ -187,12 +187,12 @@ static void Host_Maps_f(void) {
|
||||
filelist_item_t *level;
|
||||
|
||||
for (level = extralevels, i = 0; level; level = level->next, i++)
|
||||
Con_SafePrintf(" %s\n", level->name);
|
||||
console::safe_print(" %s\n", level->name);
|
||||
|
||||
if (i)
|
||||
Con_SafePrintf("%i map(s)\n", i);
|
||||
console::safe_print("%i map(s)\n", i);
|
||||
else
|
||||
Con_SafePrintf("no maps found\n");
|
||||
console::safe_print("no maps found\n");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@@ -347,12 +347,12 @@ static void Host_Mods_f(void) {
|
||||
filelist_item_t *mod;
|
||||
|
||||
for (mod = modlist, i = 0; mod; mod = mod->next, i++)
|
||||
Con_SafePrintf(" %s\n", mod->name);
|
||||
console::safe_print(" %s\n", mod->name);
|
||||
|
||||
if (i)
|
||||
Con_SafePrintf("%i mod(s)\n", i);
|
||||
console::safe_print("%i mod(s)\n", i);
|
||||
else
|
||||
Con_SafePrintf("no mods found\n");
|
||||
console::safe_print("no mods found\n");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
@@ -364,16 +364,16 @@ Host_Mapname_f -- johnfitz
|
||||
*/
|
||||
static void Host_Mapname_f(void) {
|
||||
if (sv.active) {
|
||||
Con_Printf("\"mapname\" is \"%s\"\n", sv.name);
|
||||
console::info("\"mapname\" is \"%s\"\n", sv.name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cls.state == ca_connected) {
|
||||
Con_Printf("\"mapname\" is \"%s\"\n", cl.mapname);
|
||||
console::info("\"mapname\" is \"%s\"\n", cl.mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf("no map loaded\n");
|
||||
console::info("no map loaded\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -395,7 +395,7 @@ static void Host_Status_f(void) {
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
print_fn = Con_Printf;
|
||||
print_fn = console::info;
|
||||
} else
|
||||
print_fn = SV_ClientPrintf;
|
||||
|
||||
@@ -460,7 +460,7 @@ static void Host_God_f(void) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Con_Printf("god [value] : toggle god mode. values: 0 = off, 1 = on\n");
|
||||
console::info("god [value] : toggle god mode. values: 0 = off, 1 = on\n");
|
||||
break;
|
||||
}
|
||||
//johnfitz
|
||||
@@ -515,7 +515,7 @@ static void Host_Notarget_f(void) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Con_Printf("notarget [value] : toggle notarget mode. values: 0 = off, 1 = on\n");
|
||||
console::info("notarget [value] : toggle notarget mode. values: 0 = off, 1 = on\n");
|
||||
break;
|
||||
}
|
||||
//johnfitz
|
||||
@@ -562,7 +562,7 @@ static void Host_Noclip_f(void) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Con_Printf("noclip [value] : toggle noclip mode. values: 0 = off, 1 = on\n");
|
||||
console::info("noclip [value] : toggle noclip mode. values: 0 = off, 1 = on\n");
|
||||
break;
|
||||
}
|
||||
//johnfitz
|
||||
@@ -660,7 +660,7 @@ static void Host_Fly_f(void) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Con_Printf("fly [value] : toggle fly mode. values: 0 = off, 1 = on\n");
|
||||
console::info("fly [value] : toggle fly mode. values: 0 = off, 1 = on\n");
|
||||
break;
|
||||
}
|
||||
//johnfitz
|
||||
@@ -719,13 +719,13 @@ static void Host_Map_f(void) {
|
||||
{
|
||||
if (cls.state == ca_dedicated) {
|
||||
if (sv.active)
|
||||
Con_Printf("Current map: %s\n", sv.name);
|
||||
console::info("Current map: %s\n", sv.name);
|
||||
else
|
||||
Con_Printf("Server not active\n");
|
||||
console::info("Server not active\n");
|
||||
} else if (cls.state == ca_connected) {
|
||||
Con_Printf("Current map: %s ( %s )\n", cl.levelname, cl.mapname);
|
||||
console::info("Current map: %s ( %s )\n", cl.levelname, cl.mapname);
|
||||
} else {
|
||||
Con_Printf("map <levelname>: start a new server\n");
|
||||
console::info("map <levelname>: start a new server\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -783,7 +783,7 @@ static void Host_Randmap_f(void) {
|
||||
numlevels++;
|
||||
|
||||
if (numlevels == 0) {
|
||||
Con_Printf("no maps\n");
|
||||
console::info("no maps\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ static void Host_Randmap_f(void) {
|
||||
|
||||
for (level = extralevels, i = 0; level; level = level->next, i++) {
|
||||
if (i == randlevel) {
|
||||
Con_Printf("Starting map %s...\n", level->name);
|
||||
console::info("Starting map %s...\n", level->name);
|
||||
command::buffer::add_text(va("map %s\n", level->name));
|
||||
return;
|
||||
}
|
||||
@@ -809,11 +809,11 @@ static void Host_Changelevel_f(void) {
|
||||
char level[MAX_QPATH];
|
||||
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("changelevel <levelname> : continue game on a new level\n");
|
||||
console::info("changelevel <levelname> : continue game on a new level\n");
|
||||
return;
|
||||
}
|
||||
if (!sv.active || cls.demoplayback) {
|
||||
Con_Printf("Only the server may changelevel\n");
|
||||
console::info("Only the server may changelevel\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -954,33 +954,33 @@ static void Host_Savegame_f(void) {
|
||||
return;
|
||||
|
||||
if (!sv.active) {
|
||||
Con_Printf("Not playing a local game.\n");
|
||||
console::info("Not playing a local game.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl.intermission) {
|
||||
Con_Printf("Can't save in intermission.\n");
|
||||
console::info("Can't save in intermission.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (svs.maxclients != 1) {
|
||||
Con_Printf("Can't save multiplayer games.\n");
|
||||
console::info("Can't save multiplayer games.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("save <savename> : save a game\n");
|
||||
console::info("save <savename> : save a game\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(command::argv(1)->c_str(), "..")) {
|
||||
Con_Printf("Relative pathnames are not allowed.\n");
|
||||
console::info("Relative pathnames are not allowed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < svs.maxclients; i++) {
|
||||
if (svs.clients[i].active && (svs.clients[i].edict->v.health <= 0)) {
|
||||
Con_Printf("Can't savegame with a dead player\n");
|
||||
console::info("Can't savegame with a dead player\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -988,10 +988,10 @@ static void Host_Savegame_f(void) {
|
||||
q_snprintf(name, sizeof(name), "%s/%s", com_gamedir, command::argv(1)->c_str());
|
||||
COM_AddExtension(name, ".sav", sizeof(name));
|
||||
|
||||
Con_Printf("Saving game to %s...\n", name);
|
||||
console::info("Saving game to %s...\n", name);
|
||||
f = fopen(name, "w");
|
||||
if (!f) {
|
||||
Con_Printf("ERROR: couldn't open.\n");
|
||||
console::info("ERROR: couldn't open.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1018,7 @@ static void Host_Savegame_f(void) {
|
||||
fflush(f);
|
||||
}
|
||||
fclose(f);
|
||||
Con_Printf("done.\n");
|
||||
console::info("done.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1041,12 +1041,12 @@ static void Host_Loadgame_f(void) {
|
||||
return;
|
||||
|
||||
if (command::argc() != 2) {
|
||||
Con_Printf("load <savename> : load a game\n");
|
||||
console::info("load <savename> : load a game\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strstr(command::argv(1)->c_str(), "..")) {
|
||||
Con_Printf("Relative pathnames are not allowed.\n");
|
||||
console::info("Relative pathnames are not allowed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1059,7 +1059,7 @@ static void Host_Loadgame_f(void) {
|
||||
// been used. The menu calls it before stuffing loadgame command
|
||||
// SCR_BeginLoadingPlaque ();
|
||||
|
||||
Con_Printf("Loading game from %s...\n", name);
|
||||
console::info("Loading game from %s...\n", name);
|
||||
|
||||
// avoid leaking if the previous Host_Loadgame_f failed with a Host_Error
|
||||
if (start != NULL)
|
||||
@@ -1067,7 +1067,7 @@ static void Host_Loadgame_f(void) {
|
||||
|
||||
start = (char *) COM_LoadMallocFile_TextMode_OSPath(name, NULL);
|
||||
if (start == NULL) {
|
||||
Con_Printf("ERROR: couldn't open.\n");
|
||||
console::info("ERROR: couldn't open.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ static void Host_Loadgame_f(void) {
|
||||
free(start);
|
||||
start = NULL;
|
||||
SCR_EndLoadingPlaque();
|
||||
Con_Printf("Couldn't load map\n");
|
||||
console::info("Couldn't load map\n");
|
||||
return;
|
||||
}
|
||||
sv.paused = true; // pause until all clients connect
|
||||
@@ -1177,7 +1177,7 @@ static void Host_Name_f(void) {
|
||||
char newName[32];
|
||||
|
||||
if (command::argc() == 1) {
|
||||
Con_Printf("\"name\" is \"%s\"\n", cl_name.string);
|
||||
console::info("\"name\" is \"%s\"\n", cl_name.string);
|
||||
return;
|
||||
}
|
||||
if (command::argc() == 2)
|
||||
@@ -1197,7 +1197,7 @@ static void Host_Name_f(void) {
|
||||
|
||||
if (host_client->name[0] && strcmp(host_client->name, "unconnected")) {
|
||||
if (std::strcmp(host_client->name, newName) != 0)
|
||||
Con_Printf("%s renamed to %s\n", host_client->name, newName);
|
||||
console::info("%s renamed to %s\n", host_client->name, newName);
|
||||
}
|
||||
std::strcpy(host_client->name, newName);
|
||||
host_client->edict->v.netname = PR_SetEngineString(host_client->name);
|
||||
@@ -1351,8 +1351,8 @@ static void Host_Color_f(void) {
|
||||
int playercolor;
|
||||
|
||||
if (command::argc() == 1) {
|
||||
Con_Printf("\"color\" is \"%i %i\"\n", ((int) cl_color.value) >> 4, ((int) cl_color.value) & 0x0f);
|
||||
Con_Printf("color <0-13> [0-13]\n");
|
||||
console::info("\"color\" is \"%i %i\"\n", ((int) cl_color.value) >> 4, ((int) cl_color.value) & 0x0f);
|
||||
console::info("color <0-13> [0-13]\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1452,12 +1452,12 @@ Host_PreSpawn_f
|
||||
*/
|
||||
static void Host_PreSpawn_f(void) {
|
||||
if (command::last_source == command::source::command) {
|
||||
Con_Printf("prespawn is not valid from the console\n");
|
||||
console::info("prespawn is not valid from the console\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (host_client->spawned) {
|
||||
Con_Printf("prespawn not valid -- already spawned\n");
|
||||
console::info("prespawn not valid -- already spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1476,12 +1476,12 @@ static void Host_Spawn_f(void) {
|
||||
edict_t *ent;
|
||||
|
||||
if (command::last_source == command::source::command) {
|
||||
Con_Printf("spawn is not valid from the console\n");
|
||||
console::info("spawn is not valid from the console\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (host_client->spawned) {
|
||||
Con_Printf("Spawn not valid -- already spawned\n");
|
||||
console::info("Spawn not valid -- already spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1584,7 +1584,7 @@ Host_Begin_f
|
||||
*/
|
||||
static void Host_Begin_f(void) {
|
||||
if (command::last_source == command::source::command) {
|
||||
Con_Printf("begin is not valid from the console\n");
|
||||
console::info("begin is not valid from the console\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1886,7 +1886,7 @@ static edict_t *FindViewthing(void) {
|
||||
if (!strcmp(PR_GetString(e->v.classname), "viewthing"))
|
||||
return e;
|
||||
}
|
||||
Con_Printf("No viewthing on map\n");
|
||||
console::info("No viewthing on map\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1905,7 +1905,7 @@ static void Host_Viewmodel_f(void) {
|
||||
|
||||
m = Mod_ForName(command::argv(1).value_or("").c_str(), false);
|
||||
if (!m) {
|
||||
Con_Printf("Can't load %s\n", command::argv(1).value_or("").c_str());
|
||||
console::info("Can't load %s\n", command::argv(1).value_or("").c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1944,7 +1944,7 @@ static void PrintFrameName(qmodel_t *m, int frame) {
|
||||
return;
|
||||
pframedesc = &hdr->frames[frame];
|
||||
|
||||
Con_Printf("frame %i: %s\n", frame, pframedesc->name);
|
||||
console::info("frame %i: %s\n", frame, pframedesc->name);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2011,10 +2011,10 @@ static void Host_Startdemos_f(void) {
|
||||
|
||||
c = command::argc() - 1;
|
||||
if (c > MAX_DEMOS) {
|
||||
Con_Printf("Max %i demos in demoloop\n", MAX_DEMOS);
|
||||
console::info("Max %i demos in demoloop\n", MAX_DEMOS);
|
||||
c = MAX_DEMOS;
|
||||
}
|
||||
Con_Printf("%i demo(s) in loop\n", c);
|
||||
console::info("%i demo(s) in loop\n", c);
|
||||
|
||||
for (i = 1; i < c + 1; i++)
|
||||
q_strlcpy(cls.demos[i - 1], command::argv(i)->c_str(), sizeof(cls.demos[0]));
|
||||
|
||||
Reference in New Issue
Block a user