0

VID.Printf() -> slf4j

This commit is contained in:
2018-12-18 13:33:26 +03:00
parent de15110118
commit 55cef5057e
8 changed files with 52 additions and 57 deletions

View File

@@ -1367,8 +1367,7 @@ public final class SCR extends Globals {
ByteBuffer raw = fileSystem.loadMappedFile(filename);
if (raw == null) {
VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename
+ '\n');
log.debug(MARKER_VIDEO, "Bad pcx file {}", filename);
return 0;
}
@@ -1379,7 +1378,7 @@ public final class SCR extends Globals {
|| pcx.bits_per_pixel != 8 || pcx.xmax >= 640
|| pcx.ymax >= 480) {
VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n');
log.info(MARKER_VIDEO, "Bad pcx file {}", filename);
return 0;
}

View File

@@ -68,32 +68,6 @@ public class VID extends Globals {
static boolean reflib_active = false;
// const char so_file[] = "/etc/quake2.conf";
/*
==========================================================================
DLL GLUE
==========================================================================
*/
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);
}
// ==========================================================================
/*
============
VID_Restart_f

View File

@@ -18,6 +18,7 @@
package lwjake2.render;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.VID;
import lwjake2.client.refdef_t;
@@ -28,11 +29,14 @@ import lwjake2.sys.LWJGLKBD;
import java.awt.Dimension;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* LWJGLRenderer
*
* @author dsanders/cwei
*/
@Slf4j
final class LWJGLRenderer extends Misc implements refexport_t, Ref {
private LWJGLKBD kbd=new LWJGLKBD();
@@ -62,7 +66,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.info(MARKER_VIDEO, "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.client.VID;
import lwjake2.qcommon.Com;
@@ -30,12 +31,15 @@ import java.nio.IntBuffer;
import org.lwjgl.opengl.GL11;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* Draw
* (gl_draw.c)
*
* @author cwei
*/
@Slf4j
public abstract class Draw extends Image {
/*
@@ -134,7 +138,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.info(MARKER_VIDEO, "Can't find pic: {}", pic);
return;
}
@@ -173,7 +177,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.info(MARKER_VIDEO, "Can't find pic: {}", pic);
return;
}
if (scrap_dirty)
@@ -213,7 +217,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.info(MARKER_VIDEO, "Can't find pic: {}", pic);
return;
}

View File

@@ -48,6 +48,8 @@ import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* Main
*
@@ -861,10 +863,9 @@ 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(MARKER_VIDEO,
"{} wpoly {} epoly {} tex {} lmaps",
c_brush_polys, c_alias_polys, c_visible_textures, c_visible_lightmaps);
}
}
@@ -1260,10 +1261,10 @@ public abstract class Main extends Base {
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)));
log.info(MARKER_VIDEO,
"glGetError() = 0x{}: {}",
Integer.toHexString(err),
GL11.glGetString(err));
return true;
}
@@ -1334,7 +1335,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(MARKER_VIDEO, "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;
@@ -32,11 +33,14 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.GL11;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* Mesh
*
* @author cwei
*/
@Slf4j
public abstract class Mesh extends Light {
// g_mesh.c: triangle model functions
@@ -313,11 +317,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.info(MARKER_VIDEO, "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.info(MARKER_VIDEO, "R_CullAliasModel {}: no such oldframe {}", currentmodel.name, e.frame);
e.oldframe = 0;
}
@@ -628,7 +632,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.info(MARKER_VIDEO, "R_DrawAliasModel {}: no such frame {}", currentmodel.name, currententity.frame);
currententity.frame = 0;
currententity.oldframe = 0;
}
@@ -636,7 +640,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.info(MARKER_VIDEO, "R_DrawAliasModel {}: no such oldframe {}", currentmodel.name, currententity.oldframe);
currententity.frame = 0;
currententity.oldframe = 0;
}

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.VID;
import lwjake2.qcommon.BaseQ2FileSystem;
@@ -37,11 +38,14 @@ import org.lwjgl.opengl.EXTSharedTexturePalette;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* Misc
*
* @author cwei
*/
@Slf4j
public abstract class Misc extends Mesh {
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
@@ -134,7 +138,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(MARKER_VIDEO, "Clean up your screenshots");
return;
}
@@ -186,20 +190,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(MARKER_VIDEO, "", e);
}
VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n');
log.info(MARKER_VIDEO, "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(MARKER_VIDEO, "GL_VENDOR: {}", gl_config.vendor_string);
log.info(MARKER_VIDEO, "GL_RENDERER: {}", gl_config.renderer_string);
log.info(MARKER_VIDEO, "GL_VERSION: {}", gl_config.version_string);
log.info(MARKER_VIDEO, "GL_EXTENSIONS: {}", gl_config.extensions_string);
}
/*

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.VID;
import lwjake2.game.cplane_t;
@@ -49,11 +50,14 @@ import java.util.Vector;
import org.lwjgl.BufferUtils;
import static lwjake2.Defines.MARKER_VIDEO;
/**
* Model
*
* @author cwei
*/
@Slf4j
public abstract class Model extends Surf {
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
@@ -182,17 +186,18 @@ public abstract class Model extends Surf {
int total;
total = 0;
VID.Printf(Defines.PRINT_ALL,"Loaded models:\n");
StringBuilder sb = new StringBuilder("Loaded models:\n");
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));
sb.append(String.format("\t%d : %s\n", mod.extradatasize, mod.name));
total += mod.extradatasize;
}
VID.Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n');
sb.append("Total resident: ").append(total);
log.info(MARKER_VIDEO, sb.toString());
}
/*
@@ -548,7 +553,7 @@ public abstract class Model extends Surf {
out[i].image = GL_FindImage(name, it_wall);
if (out[i].image == null) {
VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n');
log.info(MARKER_VIDEO, "Couldn't load {}", name);
out[i].image = r_notexture;
}
}