0

remove VID.Printf(...)

This commit is contained in:
2019-06-04 21:48:40 +03:00
parent 2d068e0b93
commit 744d5cd37e
9 changed files with 69 additions and 70 deletions

View File

@@ -1372,8 +1372,7 @@ public final class SCR {
ByteBuffer raw = UnpackLoader.loadFileAsByteBuffer(filename);
if (raw == null) {
VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename
+ '\n');
log.debug("Bad pcx file {}", filename);
return 0;
}
@@ -1384,7 +1383,7 @@ public final class SCR {
|| pcx.bits_per_pixel != 8 || pcx.xmax >= 640
|| pcx.ymax >= 480) {
VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n');
log.warn("Bad pcx file {}", filename);
return 0;
}

View File

@@ -79,22 +79,6 @@ public class VID {
==========================================================================
*/
public static void Printf(int print_level, String fmt) {
while (fmt.startsWith("\n")) { fmt = fmt.substring(1); }
while (fmt.endsWith("\n")) { fmt = fmt.substring(0, fmt.lastIndexOf("\n")); }
while (fmt.endsWith("\r")) { fmt = fmt.substring(0, fmt.lastIndexOf("\r")); }
fmt = fmt.trim();
log.warn("{}", fmt);
}
public static void Printf(int print_level, String fmt, Vargs vargs) {
// static qboolean inupdate;
if (print_level == Defines.PRINT_ALL)
Com.Printf(fmt, vargs);
else
Com.DPrintf(fmt, vargs);
}
// ==========================================================================
/*

View File

@@ -19,6 +19,7 @@
package lwjake2.render;
import dmx.lwjake2.render.Q2Image;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.VID;
import lwjake2.client.refdef_t;
@@ -34,6 +35,7 @@ import java.awt.Dimension;
*
* @author dsanders/cwei
*/
@Slf4j
final class LWJGLRenderer extends Misc implements refexport_t, Ref {
private LWJGLKBD kbd=new LWJGLKBD();
@@ -63,7 +65,7 @@ final class LWJGLRenderer extends Misc implements refexport_t, Ref {
// post init
boolean ok = R_Init2();
if (!ok) {
VID.Printf(Defines.PRINT_ALL, "Missing multi-texturing for LWJGL renderer\n");
log.warn("Missing multi-texturing for LWJGL renderer");
}
return ok;
}

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.client.VID;
@@ -39,6 +40,7 @@ import static dmx.lwjake2.render.ImageType.PICTURE;
*
* @author cwei
*/
@Slf4j
public abstract class Draw extends Image {
/*
@@ -137,7 +139,7 @@ public abstract class Draw extends Image {
image = Draw_FindPic(pic);
if (image == null)
{
VID.Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n');
log.warn("Can't find pic: {}", pic);
return;
}
@@ -176,7 +178,7 @@ public abstract class Draw extends Image {
image = Draw_FindPic(pic);
if (image == null)
{
VID.Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n');
log.warn("Can't find pic: {}", pic);
return;
}
if (scrap_dirty)
@@ -216,7 +218,7 @@ public abstract class Draw extends Image {
image = Draw_FindPic(pic);
if (image == null)
{
VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n');
log.warn("Can't find pic: {}", pic);
return;
}

View File

@@ -19,6 +19,7 @@
package lwjake2.render.lwjgl;
import dmx.lwjake2.render.ImageType;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import dmx.lwjake2.UnpackLoader;
@@ -38,6 +39,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.Arrays;
import java.util.StringJoiner;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBImaging;
@@ -52,6 +54,7 @@ import static dmx.lwjake2.render.ImageType.*;
*
* @author cwei
*/
@Slf4j
public abstract class Image extends Main {
// private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -251,7 +254,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;
}
@@ -285,7 +288,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;
}
@@ -305,7 +308,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;
}
@@ -323,7 +326,9 @@ public abstract class Image extends Main {
int texels;
final String[] palstrings = { "RGB", "PAL" };
VID.Printf(Defines.PRINT_ALL, "------------------\n");
StringJoiner sj = new StringJoiner("");
sj.add("------------------\n");
texels = 0;
for (int i = 0; i < numgltextures; i++) {
@@ -334,29 +339,31 @@ public abstract class Image extends Main {
texels += image.getUploadWidth() * image.getUploadHeight();
switch (image.getType()) {
case SKIN:
VID.Printf(Defines.PRINT_ALL, "M");
sj.add("M");
break;
case SPRITE:
VID.Printf(Defines.PRINT_ALL, "S");
sj.add("S");
break;
case WALL:
VID.Printf(Defines.PRINT_ALL, "W");
sj.add("W");
break;
case PICTURE:
VID.Printf(Defines.PRINT_ALL, "P");
sj.add("P");
break;
default :
VID.Printf(Defines.PRINT_ALL, " ");
sj.add(" ");
break;
}
VID.Printf(
Defines.PRINT_ALL,
" %3i %3i %s: %s\n",
new Vargs(4).add(image.getUploadWidth()).add(image.getUploadHeight()).add(palstrings[(image.isPaletted()) ? 1 : 0]).add(
image.getName()));
sj.add(String.format(" %d %d %s: %s\n",
image.getUploadWidth(),
image.getUploadHeight(),
palstrings[(image.isPaletted()) ? 1 : 0],
image.getName()
));
}
VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n');
log.warn(sj.toString());
log.warn("Total texel count (not counting mipmaps): {}", texels);
}
/*
@@ -455,7 +462,7 @@ public abstract class Image extends Main {
byte[] raw = UnpackLoader.loadFile(filename);
if (raw == null) {
VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n');
log.debug("Bad pcx file {}", filename);
return null;
}
@@ -471,7 +478,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;
}
@@ -553,7 +560,7 @@ public abstract class Image extends Main {
if (raw == null)
{
VID.Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n');
log.error("Bad tga file {}", name);
return null;
}
@@ -1115,7 +1122,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.warn("Unknown number of texture components {}", samples);
comp = samples;
}
@@ -1433,7 +1440,7 @@ public abstract class Image extends Main {
byte[] raw = UnpackLoader.loadFile(name);
if (raw == null) {
VID.Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n');
log.warn("GL_FindImage: can't load {}", name);
return r_notexture;
}

View File

@@ -861,10 +861,12 @@ public abstract class Main extends Base {
R_Flash();
if (r_speeds.value != 0.0f) {
VID.Printf(
Defines.PRINT_ALL,
"%4i wpoly %4i epoly %i tex %i lmaps\n",
new Vargs(4).add(c_brush_polys).add(c_alias_polys).add(c_visible_textures).add(c_visible_lightmaps));
log.info("{} wpoly {} epoly {} tex {} lmaps",
c_brush_polys,
c_alias_polys,
c_visible_textures,
c_visible_lightmaps
);
}
}
@@ -1259,11 +1261,9 @@ public abstract class Main extends Base {
Draw_InitLocal();
int err = GL11.glGetError();
if (err != GL11.GL_NO_ERROR)
VID.Printf(
Defines.PRINT_ALL,
"glGetError() = 0x%x\n\t%s\n",
new Vargs(2).add(err).add("" + GL11.glGetString(err)));
if (err != GL11.GL_NO_ERROR) {
log.warn("glGetError() = 0x{} : {}", Integer.toHexString(err), GL11.glGetString(err));
}
return true;
}
@@ -1334,7 +1334,7 @@ public abstract class Main extends Base {
Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g );
putenv( envbuffer );
*/
VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt");
log.debug("gamma anpassung fuer VOODOO nicht gesetzt");
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.VID;
import lwjake2.client.entity_t;
@@ -37,6 +38,7 @@ import org.lwjgl.opengl.GL11;
*
* @author cwei
*/
@Slf4j
public abstract class Mesh extends Light {
// g_mesh.c: triangle model functions
@@ -313,11 +315,11 @@ public abstract class Mesh extends Light {
qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata;
if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) {
VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n');
log.warn("R_CullAliasModel {}: no such frame {}", currentmodel.name, e.frame);
e.frame = 0;
}
if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) {
VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n');
log.warn("R_CullAliasModel {}: no such oldframe {}", currentmodel.name, e.oldframe);
e.oldframe = 0;
}
@@ -628,7 +630,7 @@ public abstract class Mesh extends Light {
if ( (currententity.frame >= paliashdr.num_frames)
|| (currententity.frame < 0) )
{
VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n');
log.warn("R_DrawAliasModel {}: no such frame {}", currentmodel.name, currententity.frame);
currententity.frame = 0;
currententity.oldframe = 0;
}
@@ -636,7 +638,7 @@ public abstract class Mesh extends Light {
if ( (currententity.oldframe >= paliashdr.num_frames)
|| (currententity.oldframe < 0))
{
VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n');
log.warn("R_DrawAliasModel {}: no such oldframe {}", currentmodel.name, currententity.oldframe);
currententity.frame = 0;
currententity.oldframe = 0;
}

View File

@@ -18,7 +18,7 @@
package lwjake2.render.lwjgl;
import dmx.lwjake2.render.ImageType;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.VID;
@@ -46,6 +46,7 @@ import static dmx.lwjake2.render.ImageType.WALL;
*
* @author cwei
*/
@Slf4j
public abstract class Misc extends Mesh {
private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -138,7 +139,7 @@ public abstract class Misc extends Mesh {
file = new File(sb.toString());
}
if (i == 100) {
VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n");
log.info("Clean up your screenshots");
return;
}
@@ -190,20 +191,20 @@ public abstract class Misc extends Mesh {
// close the file channel
ch.close();
} catch (IOException e) {
VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n');
log.error("{}", e.getMessage());
}
VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n');
}
log.warn("Wrote {}", file);
}
/*
** GL_Strings_f
*/
void GL_Strings_f() {
VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n');
VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n');
VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n');
VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n');
log.info("GL_VENDOR: {}", gl_config.vendor_string);
log.info("GL_RENDERER: {}", gl_config.renderer_string);
log.info("GL_VERSION: {}", gl_config.version_string);
log.info("GL_EXTENSIONS: {}", gl_config.extensions_string);
}
/*

View File

@@ -19,6 +19,7 @@
package lwjake2.render.lwjgl;
import dmx.lwjake2.render.ModelType;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.client.VID;
@@ -57,6 +58,7 @@ import static dmx.lwjake2.render.ImageType.*;
*
* @author cwei
*/
@Slf4j
public abstract class Model extends Surf {
// private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -185,17 +187,17 @@ public abstract class Model extends Surf {
int total;
total = 0;
VID.Printf(Defines.PRINT_ALL,"Loaded models:\n");
log.info("Loaded models:");
for (i=0; i < mod_numknown ; i++)
{
mod = mod_known[i];
if (mod.name.length() == 0)
continue;
VID.Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name));
log.info("{} : {}", mod.extradatasize, mod.name);
total += mod.extradatasize;
}
VID.Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n');
log.info("Total resident: {}", total);
}
/*
@@ -551,7 +553,7 @@ public abstract class Model extends Surf {
out[i].image = GL_FindImage(name, WALL);
if (out[i].image == null) {
VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n');
log.warn("Couldn't load {}", name);
out[i].image = r_notexture;
}
}