продолжаем мигрировать из *.Printf в log.*
This commit is contained in:
@@ -73,7 +73,7 @@ public class CL_parse {
|
||||
String name;
|
||||
|
||||
if (filename.indexOf("..") != -1) {
|
||||
Com.Printf("Refusing to download a path with ..\n");
|
||||
log.info("Refusing to download a path with ..");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -113,12 +113,12 @@ public class CL_parse {
|
||||
Globals.cls.download = fp;
|
||||
|
||||
// give the server an offset to start the download
|
||||
Com.Printf("Resuming " + Globals.cls.downloadname + "\n");
|
||||
log.info("Resuming {}", Globals.cls.downloadname);
|
||||
MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
|
||||
MSG.WriteString(Globals.cls.netchan.message, "download "
|
||||
+ Globals.cls.downloadname + " " + len);
|
||||
} else {
|
||||
Com.Printf("Downloading " + Globals.cls.downloadname + "\n");
|
||||
log.info("Downloading {}", Globals.cls.downloadname);
|
||||
MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
|
||||
MSG.WriteString(Globals.cls.netchan.message, "download "
|
||||
+ Globals.cls.downloadname);
|
||||
@@ -138,25 +138,25 @@ public class CL_parse {
|
||||
String filename;
|
||||
|
||||
if (Cmd.Argc() != 2) {
|
||||
Com.Printf("Usage: download <filename>\n");
|
||||
log.info("Usage: download <filename>");
|
||||
return;
|
||||
}
|
||||
|
||||
filename = Cmd.Argv(1);
|
||||
|
||||
if (filename.indexOf("..") != -1) {
|
||||
Com.Printf("Refusing to download a path with ..\n");
|
||||
log.info("Refusing to download a path with ..");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileSystem.loadFile(filename) != null) { // it exists, no need to
|
||||
// download
|
||||
Com.Printf("File already exists.\n");
|
||||
log.info("File already exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
Globals.cls.downloadname = filename;
|
||||
Com.Printf("Downloading " + Globals.cls.downloadname + "\n");
|
||||
log.info("Downloading {}", Globals.cls.downloadname);
|
||||
|
||||
// download to a temp name, and only rename
|
||||
// to the real name when done, so if interrupted
|
||||
@@ -205,7 +205,7 @@ public class CL_parse {
|
||||
int size = MSG.ReadShort(Globals.net_message);
|
||||
int percent = MSG.ReadByte(Globals.net_message);
|
||||
if (size == -1) {
|
||||
Com.Printf("Server does not have this file.\n");
|
||||
log.info("Server does not have this file.");
|
||||
if (Globals.cls.download != null) {
|
||||
// if here, we tried to resume a file but the server said no
|
||||
try {
|
||||
@@ -227,8 +227,7 @@ public class CL_parse {
|
||||
Globals.cls.download = Lib.fopen(name, "rw");
|
||||
if (Globals.cls.download == null) {
|
||||
Globals.net_message.readcount += size;
|
||||
Com.Printf("Failed to open " + Globals.cls.downloadtempname
|
||||
+ "\n");
|
||||
log.info("Failed to open {}", Globals.cls.downloadtempname);
|
||||
CL.RequestNextDownload();
|
||||
return;
|
||||
}
|
||||
@@ -266,7 +265,7 @@ public class CL_parse {
|
||||
newn = DownloadFileName(Globals.cls.downloadname);
|
||||
int r = Lib.rename(oldn, newn);
|
||||
if (r != 0)
|
||||
Com.Printf("failed to rename.\n");
|
||||
log.info("failed to rename.");
|
||||
|
||||
Globals.cls.download = null;
|
||||
Globals.cls.downloadpercent = 0;
|
||||
@@ -343,7 +342,7 @@ public class CL_parse {
|
||||
// Com.Printf(
|
||||
// "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
|
||||
// Com.Printf('\02' + str + "\n");
|
||||
Com.Printf("Levelname:" + str + "\n");
|
||||
log.info("Levelname:{}", str);
|
||||
// need to prep refresh at next oportunity
|
||||
Globals.cl.refresh_prepped = false;
|
||||
}
|
||||
@@ -636,7 +635,7 @@ public class CL_parse {
|
||||
|
||||
public static void SHOWNET(String s) {
|
||||
if (Globals.cl_shownet.value >= 2)
|
||||
Com.Printf(Globals.net_message.readcount - 1 + ":" + s + "\n");
|
||||
log.info("{}:{}", Globals.net_message.readcount - 1, s);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -674,8 +673,7 @@ public class CL_parse {
|
||||
|
||||
if (Globals.cl_shownet.value >= 2) {
|
||||
if (null == svc_strings[cmd])
|
||||
Com.Printf(Globals.net_message.readcount - 1 + ":BAD CMD "
|
||||
+ cmd + "\n");
|
||||
log.info("{}:BAD CMD {}", Globals.net_message.readcount - 1, cmd);
|
||||
else
|
||||
SHOWNET(svc_strings[cmd]);
|
||||
}
|
||||
@@ -696,7 +694,7 @@ public class CL_parse {
|
||||
break;
|
||||
|
||||
case Defines.svc_reconnect:
|
||||
Com.Printf("Server disconnected, reconnecting\n");
|
||||
log.info("Server disconnected, reconnecting");
|
||||
if (Globals.cls.download != null) {
|
||||
//ZOID, close download
|
||||
try {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package lwjake2.client;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lwjake2.Defines;
|
||||
import lwjake2.Globals;
|
||||
import lwjake2.qcommon.CM;
|
||||
@@ -26,6 +27,7 @@ import lwjake2.sys.Sys;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@Slf4j
|
||||
public class CL_view {
|
||||
|
||||
static int num_cl_weaponmodels;
|
||||
@@ -59,16 +61,14 @@ public class CL_view {
|
||||
// cut off ".bsp"
|
||||
|
||||
// register models, pics, and skins
|
||||
Com.Printf("Map: " + mapname + "\r");
|
||||
log.info("Map: {}", mapname);
|
||||
SCR.UpdateScreen();
|
||||
Globals.re.BeginRegistration(mapname);
|
||||
Com.Printf(" \r");
|
||||
|
||||
// precache status bar pics
|
||||
Com.Printf("pics\r");
|
||||
log.info("pics");
|
||||
SCR.UpdateScreen();
|
||||
SCR.TouchPics();
|
||||
Com.Printf(" \r");
|
||||
|
||||
CL_tent.RegisterTEntModels();
|
||||
|
||||
@@ -77,12 +77,10 @@ public class CL_view {
|
||||
|
||||
for (i = 1; i < Defines.MAX_MODELS
|
||||
&& Globals.cl.configstrings[Defines.CS_MODELS + i].length() != 0; i++) {
|
||||
name = new String(Globals.cl.configstrings[Defines.CS_MODELS + i]);
|
||||
if (name.length() > 37)
|
||||
name = name.substring(0, 36);
|
||||
name = Globals.cl.configstrings[Defines.CS_MODELS + i];
|
||||
|
||||
if (name.charAt(0) != '*')
|
||||
Com.Printf(name + "\r");
|
||||
log.info(name);
|
||||
|
||||
SCR.UpdateScreen();
|
||||
Sys.SendKeyEvents(); // pump message loop
|
||||
@@ -104,11 +102,9 @@ public class CL_view {
|
||||
else
|
||||
Globals.cl.model_clip[i] = null;
|
||||
}
|
||||
if (name.charAt(0) != '*')
|
||||
Com.Printf(" \r");
|
||||
}
|
||||
|
||||
Com.Printf("images\r");
|
||||
log.info("images");
|
||||
SCR.UpdateScreen();
|
||||
for (i = 1; i < Defines.MAX_IMAGES
|
||||
&& Globals.cl.configstrings[Defines.CS_IMAGES + i].length() > 0; i++) {
|
||||
@@ -117,22 +113,20 @@ public class CL_view {
|
||||
Sys.SendKeyEvents(); // pump message loop
|
||||
}
|
||||
|
||||
Com.Printf(" \r");
|
||||
for (i = 0; i < Defines.MAX_CLIENTS; i++) {
|
||||
if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i].length() == 0)
|
||||
continue;
|
||||
Com.Printf("client " + i + '\r');
|
||||
log.info("client {}", i);
|
||||
SCR.UpdateScreen();
|
||||
Sys.SendKeyEvents(); // pump message loop
|
||||
CL_parse.ParseClientinfo(i);
|
||||
Com.Printf(" \r");
|
||||
}
|
||||
|
||||
CL_parse.LoadClientinfo(Globals.cl.baseclientinfo,
|
||||
"unnamed\\male/grunt");
|
||||
|
||||
// set sky textures and speed
|
||||
Com.Printf("sky\r");
|
||||
log.info("sky");
|
||||
SCR.UpdateScreen();
|
||||
rotate = Float
|
||||
.parseFloat(Globals.cl.configstrings[Defines.CS_SKYROTATE]);
|
||||
@@ -143,7 +137,6 @@ public class CL_view {
|
||||
axis[2] = Float.parseFloat(st.nextToken());
|
||||
Globals.re.SetSky(Globals.cl.configstrings[Defines.CS_SKY], rotate,
|
||||
axis);
|
||||
Com.Printf(" \r");
|
||||
|
||||
// the renderer can now free unneeded stuff
|
||||
Globals.re.EndRegistration();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package lwjake2.qcommon;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lwjake2.Defines;
|
||||
import lwjake2.Globals;
|
||||
import lwjake2.game.Cmd;
|
||||
@@ -32,6 +33,7 @@ import java.util.Vector;
|
||||
/**
|
||||
* Cvar implements console variables. The original code is located in cvar.c
|
||||
*/
|
||||
@Slf4j
|
||||
public class Cvar extends Globals {
|
||||
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
|
||||
|
||||
@@ -46,7 +48,7 @@ public class Cvar extends Globals {
|
||||
|
||||
if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
|
||||
if (!InfoValidate(var_name)) {
|
||||
Com.Printf("invalid info cvar name\n");
|
||||
log.info("invalid info cvar name");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -62,7 +64,7 @@ public class Cvar extends Globals {
|
||||
|
||||
if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
|
||||
if (!InfoValidate(var_value)) {
|
||||
Com.Printf("invalid info cvar value\n");
|
||||
log.info("invalid info cvar value");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -163,14 +165,14 @@ public class Cvar extends Globals {
|
||||
|
||||
if ((var.flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
|
||||
if (!InfoValidate(value)) {
|
||||
Com.Printf("invalid info cvar value\n");
|
||||
log.info("invalid info cvar value");
|
||||
return var;
|
||||
}
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
if ((var.flags & CVAR_NOSET) != 0) {
|
||||
Com.Printf(var_name + " is write protected.\n");
|
||||
log.info("{} is write protected.", var_name);
|
||||
return var;
|
||||
}
|
||||
|
||||
@@ -185,7 +187,7 @@ public class Cvar extends Globals {
|
||||
}
|
||||
|
||||
if (Globals.server_state != 0) {
|
||||
Com.Printf(var_name + " will be changed for next game.\n");
|
||||
log.info("{} will be changed for next game.", var_name);
|
||||
var.latched_string = value;
|
||||
} else {
|
||||
var.string = value;
|
||||
@@ -235,7 +237,7 @@ public class Cvar extends Globals {
|
||||
|
||||
c = Cmd.Argc();
|
||||
if (c != 3 && c != 4) {
|
||||
Com.Printf("usage: set <variable> <value> [u / s]\n");
|
||||
log.info("usage: set <variable> <value> [u / s]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +247,7 @@ public class Cvar extends Globals {
|
||||
else if (Cmd.Argv(3).equals("s"))
|
||||
flags = CVAR_SERVERINFO;
|
||||
else {
|
||||
Com.Printf("flags can only be 'u' or 's'\n");
|
||||
log.info("flags can only be 'u' or 's'");
|
||||
return;
|
||||
}
|
||||
Cvar.FullSet(Cmd.Argv(1), Cmd.Argv(2), flags);
|
||||
@@ -263,27 +265,34 @@ public class Cvar extends Globals {
|
||||
|
||||
i = 0;
|
||||
for (var = Globals.cvar_vars; var != null; var = var.next, i++) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if ((var.flags & CVAR_ARCHIVE) != 0)
|
||||
Com.Printf("*");
|
||||
sb.append('*');
|
||||
else
|
||||
Com.Printf(" ");
|
||||
sb.append(' ');
|
||||
|
||||
if ((var.flags & CVAR_USERINFO) != 0)
|
||||
Com.Printf("U");
|
||||
sb.append('U');
|
||||
else
|
||||
Com.Printf(" ");
|
||||
sb.append(' ');
|
||||
|
||||
if ((var.flags & CVAR_SERVERINFO) != 0)
|
||||
Com.Printf("S");
|
||||
sb.append('S');
|
||||
else
|
||||
Com.Printf(" ");
|
||||
sb.append(' ');
|
||||
|
||||
if ((var.flags & CVAR_NOSET) != 0)
|
||||
Com.Printf("-");
|
||||
sb.append('-');
|
||||
else if ((var.flags & CVAR_LATCH) != 0)
|
||||
Com.Printf("L");
|
||||
sb.append('L');
|
||||
else
|
||||
Com.Printf(" ");
|
||||
Com.Printf(" " + var.name + " \"" + var.string + "\"\n");
|
||||
sb.append(' ');
|
||||
|
||||
sb.append(" {} \"{}\"");
|
||||
log.info(sb.toString(), var.name, var.string);
|
||||
}
|
||||
Com.Printf(i + " cvars\n");
|
||||
log.info("{} cvars", i);
|
||||
};
|
||||
|
||||
|
||||
@@ -334,7 +343,7 @@ public class Cvar extends Globals {
|
||||
|
||||
// perform a variable print or set
|
||||
if (Cmd.Argc() == 1) {
|
||||
Com.Printf("\"" + v.name + "\" is \"" + v.string + "\"\n");
|
||||
log.info("\"{}\" is \"{}\"", v.name, v.string);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package lwjake2.render.lwjgl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lwjake2.Defines;
|
||||
import lwjake2.client.VID;
|
||||
import lwjake2.client.particle_t;
|
||||
@@ -47,6 +48,7 @@ import org.lwjgl.opengl.GL11;
|
||||
*
|
||||
* @author cwei
|
||||
*/
|
||||
@Slf4j
|
||||
public abstract class Image extends Main {
|
||||
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
|
||||
|
||||
@@ -247,7 +249,7 @@ public abstract class Image extends Main {
|
||||
}
|
||||
|
||||
if (i == NUM_GL_MODES) {
|
||||
VID.Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n");
|
||||
log.warn("bad filter name: [{}]", string);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,7 +283,7 @@ public abstract class Image extends Main {
|
||||
}
|
||||
|
||||
if (i == NUM_GL_ALPHA_MODES) {
|
||||
VID.Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n");
|
||||
log.warn("bad alpha texture mode name: [{}]", string);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -301,7 +303,7 @@ public abstract class Image extends Main {
|
||||
}
|
||||
|
||||
if (i == NUM_GL_SOLID_MODES) {
|
||||
VID.Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n");
|
||||
log.warn("bad solid texture mode name: [{}]", string);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -319,7 +321,7 @@ public abstract class Image extends Main {
|
||||
int texels;
|
||||
final String[] palstrings = { "RGB", "PAL" };
|
||||
|
||||
VID.Printf(Defines.PRINT_ALL, "------------------\n");
|
||||
log.info("------------------");
|
||||
texels = 0;
|
||||
|
||||
for (int i = 0; i < numgltextures; i++) {
|
||||
@@ -327,32 +329,35 @@ public abstract class Image extends Main {
|
||||
if (image.texnum <= 0)
|
||||
continue;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
texels += image.upload_width * image.upload_height;
|
||||
switch (image.type) {
|
||||
case it_skin :
|
||||
VID.Printf(Defines.PRINT_ALL, "M");
|
||||
sb.append("M");
|
||||
break;
|
||||
case it_sprite :
|
||||
VID.Printf(Defines.PRINT_ALL, "S");
|
||||
sb.append("S");
|
||||
break;
|
||||
case it_wall :
|
||||
VID.Printf(Defines.PRINT_ALL, "W");
|
||||
sb.append("W");
|
||||
break;
|
||||
case it_pic :
|
||||
VID.Printf(Defines.PRINT_ALL, "P");
|
||||
sb.append("P");
|
||||
break;
|
||||
default :
|
||||
VID.Printf(Defines.PRINT_ALL, " ");
|
||||
sb.append(" ");
|
||||
break;
|
||||
}
|
||||
|
||||
VID.Printf(
|
||||
Defines.PRINT_ALL,
|
||||
" %3i %3i %s: %s\n",
|
||||
new Vargs(4).add(image.upload_width).add(image.upload_height).add(palstrings[(image.paletted) ? 1 : 0]).add(
|
||||
image.name));
|
||||
sb.append(" {} {} {}: {}");
|
||||
log.info(sb.toString(),
|
||||
image.upload_width,
|
||||
image.upload_height,
|
||||
(image.paletted ? 1 : 0),
|
||||
image.name
|
||||
);
|
||||
}
|
||||
VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n');
|
||||
log.info("Total texel count (not counting mipmaps): {}", texels);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -451,7 +456,7 @@ public abstract class Image extends Main {
|
||||
byte[] raw = fileSystem.loadFile(filename);
|
||||
|
||||
if (raw == null) {
|
||||
VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n');
|
||||
log.debug(/*Defines.PRINT_DEVELOPER*/"Bad pcx file {}", filename);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -467,7 +472,7 @@ public abstract class Image extends Main {
|
||||
|| pcx.xmax >= 640
|
||||
|| pcx.ymax >= 480) {
|
||||
|
||||
VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n');
|
||||
log.warn("Bad pcx file {}", filename);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -549,7 +554,7 @@ public abstract class Image extends Main {
|
||||
|
||||
if (raw == null)
|
||||
{
|
||||
VID.Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n');
|
||||
log.debug(/*Defines.PRINT_DEVELOPER*/"Bad tga file {}", name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -558,6 +563,7 @@ public abstract class Image extends Main {
|
||||
if (targa_header.image_type != 2 && targa_header.image_type != 10)
|
||||
Com.Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n");
|
||||
|
||||
|
||||
if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24))
|
||||
Com.Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n");
|
||||
|
||||
@@ -1113,7 +1119,7 @@ public abstract class Image extends Main {
|
||||
else if (samples == gl_alpha_format)
|
||||
comp = gl_tex_alpha_format;
|
||||
else {
|
||||
VID.Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n');
|
||||
log.info("Unknown number of texture components {}", samples);
|
||||
comp = samples;
|
||||
}
|
||||
|
||||
@@ -1432,7 +1438,7 @@ public abstract class Image extends Main {
|
||||
|
||||
byte[] raw = fileSystem.loadFile(name);
|
||||
if (raw == null) {
|
||||
VID.Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n');
|
||||
log.info("GL_FindImage: can't load {}", name);
|
||||
return r_notexture;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user