0

Merge branch 'dev-logger' into dev-baseq2

# Conflicts:
#	src/lwjake2/client/CL.java
#	src/lwjake2/client/CL_parse.java
#	src/lwjake2/client/Console.java
#	src/lwjake2/client/V.java
#	src/lwjake2/game/Cmd.java
#	src/lwjake2/qcommon/Qcommon.java
This commit is contained in:
2018-03-06 23:10:39 +03:00
34 changed files with 248 additions and 295 deletions

View File

@@ -1,3 +1,7 @@
plugins {
id 'net.ltgt.apt' version '0.10'
}
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'application' apply plugin: 'application'
apply plugin: 'idea' apply plugin: 'idea'
@@ -27,6 +31,9 @@ dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: log4jVersion compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: log4jVersion
compileOnly 'org.projectlombok:lombok:1.16.20'
apt "org.projectlombok:lombok:1.16.20"
} }
sourceSets { sourceSets {

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -45,9 +46,6 @@ import lwjake2.sys.Sys;
import lwjake2.sys.Timer; import lwjake2.sys.Timer;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@@ -57,8 +55,8 @@ import java.nio.ByteOrder;
/** /**
* CL * CL
*/ */
@Slf4j
public final class CL { public final class CL {
private static final Logger logger = LoggerFactory.getLogger(CL.class);
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance(); private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
static int precache_check; // for autodownload of precache items static int precache_check; // for autodownload of precache items
@@ -113,7 +111,7 @@ public final class CL {
int len; int len;
if (!Globals.cls.demorecording) { if (!Globals.cls.demorecording) {
logger.info("Not recording a demo."); log.info("Not recording a demo.");
return; return;
} }
@@ -123,7 +121,7 @@ public final class CL {
Globals.cls.demofile.close(); Globals.cls.demofile.close();
Globals.cls.demofile = null; Globals.cls.demofile = null;
Globals.cls.demorecording = false; Globals.cls.demorecording = false;
logger.info("Stopped demo."); log.info("Stopped demo.");
} catch (IOException e) { } catch (IOException e) {
} }
} }
@@ -147,17 +145,17 @@ public final class CL {
entity_state_t ent; entity_state_t ent;
if (Cmd.Argc() != 2) { if (Cmd.Argc() != 2) {
logger.info("record <demoname>"); log.info("record <demoname>");
return; return;
} }
if (Globals.cls.demorecording) { if (Globals.cls.demorecording) {
logger.info("Already recording."); log.info("Already recording.");
return; return;
} }
if (Globals.cls.state != Defines.ca_active) { if (Globals.cls.state != Defines.ca_active) {
logger.info("You must be in a level to record."); log.info("You must be in a level to record.");
return; return;
} }
@@ -166,11 +164,11 @@ public final class CL {
// //
name = fileSystem.getGamedir() + "/demos/" + Cmd.Argv(1) + ".dm2"; name = fileSystem.getGamedir() + "/demos/" + Cmd.Argv(1) + ".dm2";
logger.info("recording to {}", name); log.info("recording to {}", name);
fileSystem.createPath(name); fileSystem.createPath(name);
Globals.cls.demofile = new RandomAccessFile(name, "rw"); Globals.cls.demofile = new RandomAccessFile(name, "rw");
if (Globals.cls.demofile == null) { if (Globals.cls.demofile == null) {
logger.error("ERROR: couldn't open."); log.error("ERROR: couldn't open.");
return; return;
} }
Globals.cls.demorecording = true; Globals.cls.demorecording = true;
@@ -251,7 +249,7 @@ public final class CL {
public void run() { public void run() {
if (Globals.cls.state != Defines.ca_connected if (Globals.cls.state != Defines.ca_connected
&& Globals.cls.state != Defines.ca_active) { && Globals.cls.state != Defines.ca_active) {
logger.warn("Can't \"{}\", not connected", Cmd.Argv(0)); log.warn("Can't \"{}\", not connected", Cmd.Argv(0));
return; return;
} }
@@ -299,7 +297,7 @@ public final class CL {
String server; String server;
if (Cmd.Argc() != 2) { if (Cmd.Argc() != 2) {
logger.info("usage: connect <server>"); log.info("usage: connect <server>");
return; return;
} }
@@ -333,7 +331,7 @@ public final class CL {
public void run() { public void run() {
if (Globals.rcon_client_password.string.length() == 0) { if (Globals.rcon_client_password.string.length() == 0) {
logger.warn("You must set 'rcon_password' before\nissuing an rcon command."); log.warn("You must set 'rcon_password' before\nissuing an rcon command.");
return; return;
} }
@@ -363,7 +361,7 @@ public final class CL {
to = Globals.cls.netchan.remote_address; to = Globals.cls.netchan.remote_address;
else { else {
if (Globals.rcon_address.string.length() == 0) { if (Globals.rcon_address.string.length() == 0) {
logger.warn("You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands"); log.warn("You must either be connected,\nor set the 'rcon_address' cvar\nto issue rcon commands");
return; return;
} }
NET.StringToAdr(Globals.rcon_address.string, to); NET.StringToAdr(Globals.rcon_address.string, to);
@@ -398,7 +396,7 @@ public final class CL {
SCR.BeginLoadingPlaque(); SCR.BeginLoadingPlaque();
Globals.cls.state = Defines.ca_connected; // not active anymore, but Globals.cls.state = Defines.ca_connected; // not active anymore, but
// not disconnected // not disconnected
logger.info("Changing map..."); log.info("Changing map...");
} }
}; };
@@ -417,7 +415,7 @@ public final class CL {
S.StopAllSounds(); S.StopAllSounds();
if (Globals.cls.state == Defines.ca_connected) { if (Globals.cls.state == Defines.ca_connected) {
logger.info("reconnecting..."); log.info("reconnecting...");
Globals.cls.state = Defines.ca_connected; Globals.cls.state = Defines.ca_connected;
MSG.WriteChar(Globals.cls.netchan.message, MSG.WriteChar(Globals.cls.netchan.message,
Defines.clc_stringcmd); Defines.clc_stringcmd);
@@ -433,7 +431,7 @@ public final class CL {
Globals.cls.connect_time = -99999; // fire immediately Globals.cls.connect_time = -99999; // fire immediately
Globals.cls.state = Defines.ca_connecting; Globals.cls.state = Defines.ca_connecting;
logger.info("reconnecting..."); log.info("reconnecting...");
} }
} }
}; };
@@ -454,7 +452,7 @@ public final class CL {
NET.Config(true); // allow remote NET.Config(true); // allow remote
// send a broadcast packet // send a broadcast packet
logger.info("pinging broadcast..."); log.info("pinging broadcast...");
noudp = Cvar.Get("noudp", "0", Defines.CVAR_NOSET); noudp = Cvar.Get("noudp", "0", Defines.CVAR_NOSET);
if (noudp.value == 0.0f) { if (noudp.value == 0.0f) {
@@ -483,9 +481,9 @@ public final class CL {
if (adrstring == null || adrstring.length() == 0) if (adrstring == null || adrstring.length() == 0)
continue; continue;
logger.info("pinging {} ...", adrstring); log.info("pinging {} ...", adrstring);
if (!NET.StringToAdr(adrstring, adr)) { if (!NET.StringToAdr(adrstring, adr)) {
logger.warn("Bad address: {}", adrstring); log.warn("Bad address: {}", adrstring);
continue; continue;
} }
if (adr.port == 0) if (adr.port == 0)
@@ -509,7 +507,7 @@ public final class CL {
for (i = 0; i < Defines.MAX_CLIENTS; i++) { for (i = 0; i < Defines.MAX_CLIENTS; i++) {
if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i] == null) if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i] == null)
continue; continue;
logger.info("client {}: {}", i, Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i]); log.info("client {}: {}", i, Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i]);
SCR.UpdateScreen(); SCR.UpdateScreen();
Sys.SendKeyEvents(); // pump message loop Sys.SendKeyEvents(); // pump message loop
CL_parse.ParseClientinfo(i); CL_parse.ParseClientinfo(i);
@@ -522,7 +520,7 @@ public final class CL {
*/ */
static Runnable Userinfo_f = new Runnable() { static Runnable Userinfo_f = new Runnable() {
public void run() { public void run() {
logger.info("User info settings:"); log.info("User info settings:");
Info.Print(Cvar.Userinfo()); Info.Print(Cvar.Userinfo());
} }
}; };
@@ -618,7 +616,7 @@ public final class CL {
int port; int port;
if (!NET.StringToAdr(Globals.cls.servername, adr)) { if (!NET.StringToAdr(Globals.cls.servername, adr)) {
logger.warn("Bad server address"); log.warn("Bad server address");
Globals.cls.connect_time = 0; Globals.cls.connect_time = 0;
return; return;
} }
@@ -661,7 +659,7 @@ public final class CL {
return; return;
if (!NET.StringToAdr(Globals.cls.servername, adr)) { if (!NET.StringToAdr(Globals.cls.servername, adr)) {
logger.warn("Bad server address"); log.warn("Bad server address");
Globals.cls.state = Defines.ca_disconnected; Globals.cls.state = Defines.ca_disconnected;
return; return;
} }
@@ -671,7 +669,7 @@ public final class CL {
// for retransmit requests // for retransmit requests
Globals.cls.connect_time = Globals.cls.realtime; Globals.cls.connect_time = Globals.cls.realtime;
logger.info("Connecting to {}...", Globals.cls.servername); log.info("Connecting to {}...", Globals.cls.servername);
Netchan.OutOfBandPrint(Defines.NS_CLIENT, adr, "getchallenge\n"); Netchan.OutOfBandPrint(Defines.NS_CLIENT, adr, "getchallenge\n");
} }
@@ -714,7 +712,7 @@ public final class CL {
time = (int) (Timer.Milliseconds() - Globals.cl.timedemo_start); time = (int) (Timer.Milliseconds() - Globals.cl.timedemo_start);
if (time > 0) if (time > 0)
logger.info(String.format("%d frames, %3.1f seconds: %3.1f fps", log.info(String.format("%d frames, %3.1f seconds: %3.1f fps",
Globals.cl.timedemo_frames, Globals.cl.timedemo_frames,
(time / 1000.0f), (time / 1000.0f),
(Globals.cl.timedemo_frames * 1000.0f / time) (Globals.cl.timedemo_frames * 1000.0f / time)
@@ -761,7 +759,7 @@ public final class CL {
s = MSG.ReadString(Globals.net_message); s = MSG.ReadString(Globals.net_message);
logger.info(s); log.info(s);
Menu.AddToServerList(Globals.net_from, s); Menu.AddToServerList(Globals.net_from, s);
} }
@@ -783,12 +781,12 @@ public final class CL {
c = Cmd.Argv(0); c = Cmd.Argv(0);
logger.info("{}: {}", Globals.net_from.toString(), c); log.info("{}: {}", Globals.net_from.toString(), c);
// server connection // server connection
if (c.equals("client_connect")) { if (c.equals("client_connect")) {
if (Globals.cls.state == Defines.ca_connected) { if (Globals.cls.state == Defines.ca_connected) {
logger.info("Dup connect received. Ignored."); log.info("Dup connect received. Ignored.");
return; return;
} }
Netchan.Setup(Defines.NS_CLIENT, Globals.cls.netchan, Netchan.Setup(Defines.NS_CLIENT, Globals.cls.netchan,
@@ -808,7 +806,7 @@ public final class CL {
// remote command from gui front end // remote command from gui front end
if (c.equals("cmd")) { if (c.equals("cmd")) {
if (!NET.IsLocalAddress(Globals.net_from)) { if (!NET.IsLocalAddress(Globals.net_from)) {
logger.info("Command packet from remote host. Ignored."); log.info("Command packet from remote host. Ignored.");
return; return;
} }
s = MSG.ReadString(Globals.net_message); s = MSG.ReadString(Globals.net_message);
@@ -820,7 +818,7 @@ public final class CL {
if (c.equals("print")) { if (c.equals("print")) {
s = MSG.ReadString(Globals.net_message); s = MSG.ReadString(Globals.net_message);
if (s.length() > 0) if (s.length() > 0)
logger.info(s); log.info(s);
return; return;
} }
@@ -844,7 +842,7 @@ public final class CL {
return; return;
} }
logger.warn("Unknown command."); log.warn("Unknown command.");
} }
@@ -872,7 +870,7 @@ public final class CL {
continue; // dump it if not connected continue; // dump it if not connected
if (Globals.net_message.cursize < 8) { if (Globals.net_message.cursize < 8) {
logger.info("{}: Runt packet", NET.AdrToString(Globals.net_from)); log.info("{}: Runt packet", NET.AdrToString(Globals.net_from));
continue; continue;
} }
@@ -897,7 +895,7 @@ public final class CL {
&& Globals.cls.realtime - Globals.cls.netchan.last_received > Globals.cl_timeout.value * 1000) { && Globals.cls.realtime - Globals.cls.netchan.last_received > Globals.cl_timeout.value * 1000) {
if (++Globals.cl.timeoutcount > 5) // timeoutcount saves debugger if (++Globals.cl.timeoutcount > 5) // timeoutcount saves debugger
{ {
logger.info("Server connection timed out."); log.info("Server connection timed out.");
Disconnect(); Disconnect();
return; return;
} }
@@ -1412,7 +1410,7 @@ public final class CL {
path = fileSystem.getGamedir() + "/config.cfg"; path = fileSystem.getGamedir() + "/config.cfg";
f = Lib.fopen(path, "rw"); f = Lib.fopen(path, "rw");
if (f == null) { if (f == null) {
logger.warn("Couldn't write config.cfg."); log.warn("Couldn't write config.cfg.");
return; return;
} }
try { try {
@@ -1571,7 +1569,7 @@ public final class CL {
public static void Shutdown() { public static void Shutdown() {
if (isdown) { if (isdown) {
logger.info("recursive shutdown"); log.info("recursive shutdown");
return; return;
} }
isdown = true; isdown = true;

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -34,8 +35,6 @@ import lwjake2.render.model_t;
import lwjake2.sound.S; import lwjake2.sound.S;
import lwjake2.sys.Sys; import lwjake2.sys.Sys;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@@ -43,8 +42,8 @@ import java.io.RandomAccessFile;
/** /**
* CL_parse * CL_parse
*/ */
@Slf4j
public class CL_parse { public class CL_parse {
private static final Logger logger = LoggerFactory.getLogger(CL_parse.class);
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance(); private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
//// cl_parse.c -- parse a message received from the server //// cl_parse.c -- parse a message received from the server
@@ -726,7 +725,7 @@ public class CL_parse {
while (msg.endsWith("\r")) { msg = msg.substring(0, msg.lastIndexOf("\r")); } while (msg.endsWith("\r")) { msg = msg.substring(0, msg.lastIndexOf("\r")); }
msg = msg.trim(); msg = msg.trim();
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
logger.info(msg); log.info(msg);
} }
Globals.con.ormask = 0; Globals.con.ormask = 0;
break; break;

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -28,8 +29,6 @@ import lwjake2.qcommon.FileSystem;
import lwjake2.qcommon.BaseQ2FileSystem; import lwjake2.qcommon.BaseQ2FileSystem;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@@ -38,8 +37,8 @@ import java.util.Arrays;
/** /**
* Console * Console
*/ */
@Slf4j
public final class Console extends Globals { public final class Console extends Globals {
private static final Logger logger = LoggerFactory.getLogger(Console.class);
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance(); private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
public static Runnable ToggleConsole_f = new Runnable() { public static Runnable ToggleConsole_f = new Runnable() {
public void run() { public void run() {
@@ -89,7 +88,7 @@ public final class Console extends Globals {
String name; String name;
if (Cmd.Argc() != 2) { if (Cmd.Argc() != 2) {
logger.info("usage: condump <filename>"); log.info("usage: condump <filename>");
return; return;
} }
@@ -98,11 +97,11 @@ public final class Console extends Globals {
// Cmd_Argv(1)); // Cmd_Argv(1));
name = fileSystem.getGamedir() + "/" + Cmd.Argv(1) + ".txt"; name = fileSystem.getGamedir() + "/" + Cmd.Argv(1) + ".txt";
logger.info("Dumped console text to {}", name); log.info("Dumped console text to {}", name);
fileSystem.createPath(name); fileSystem.createPath(name);
f = Lib.fopen(name, "rw"); f = Lib.fopen(name, "rw");
if (f == null) { if (f == null) {
logger.error("ERROR: couldn't open."); log.error("ERROR: couldn't open.");
return; return;
} }
@@ -152,7 +151,7 @@ public final class Console extends Globals {
CheckResize(); CheckResize();
logger.info("Console initialized."); log.info("Console initialized.");
// //
// register our commands // register our commands

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -25,8 +26,6 @@ import lwjake2.qcommon.Cbuf;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.qcommon.Cvar; import lwjake2.qcommon.Cvar;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@@ -35,8 +34,8 @@ import java.util.Vector;
/** /**
* Key * Key
*/ */
@Slf4j
public class Key extends Globals { public class Key extends Globals {
private static final Logger logger = LoggerFactory.getLogger(Key.class);
// //
// these are the key numbers that should be passed to Key_Event // these are the key numbers that should be passed to Key_Event
// //
@@ -578,7 +577,7 @@ public class Key extends Globals {
Cbuf.AddText("\n"); Cbuf.AddText("\n");
logger.info(new String(Globals.key_lines[Globals.edit_line], 0, Lib.strlen(Globals.key_lines[Globals.edit_line]))); log.info(new String(Globals.key_lines[Globals.edit_line], 0, Lib.strlen(Globals.key_lines[Globals.edit_line])));
Globals.edit_line = (Globals.edit_line + 1) & 31; Globals.edit_line = (Globals.edit_line + 1) & 31;
history_line = Globals.edit_line; history_line = Globals.edit_line;
@@ -676,7 +675,7 @@ public class Key extends Globals {
while (type.endsWith("\n")) { type = type.substring(0, type.lastIndexOf("\n")); } while (type.endsWith("\n")) { type = type.substring(0, type.lastIndexOf("\n")); }
while (type.endsWith("\r")) { type = type.substring(0, type.lastIndexOf("\r")); } while (type.endsWith("\r")) { type = type.substring(0, type.lastIndexOf("\r")); }
type = type.trim(); type = type.trim();
logger.info("{} {}", type, sb.toString()); log.info("{} {}", type, sb.toString());
} }
static void CompleteCommand() { static void CompleteCommand() {

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -32,8 +33,6 @@ import lwjake2.sound.S;
import lwjake2.sys.Timer; import lwjake2.sys.Timer;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Dimension; import java.awt.Dimension;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@@ -43,9 +42,8 @@ import java.util.Arrays;
/** /**
* SCR * SCR
*/ */
@Slf4j
public final class SCR extends Globals { public final class SCR extends Globals {
private static final Logger logger = LoggerFactory.getLogger(SCR.class);
// cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc // cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc
static String[][] sb_nums = { static String[][] sb_nums = {
@@ -639,7 +637,7 @@ public final class SCR extends Globals {
stop = Timer.Milliseconds(); stop = Timer.Milliseconds();
time = (stop - start) / 1000.0f; time = (stop - start) / 1000.0f;
logger.info(String.format("%f seconds (%f fps)", time, (128.0f / time))); log.info(String.format("%f seconds (%f fps)", time, (128.0f / time)));
} }
static void DirtyScreen() { static void DirtyScreen() {
@@ -1759,7 +1757,7 @@ public final class SCR extends Globals {
return; return;
if (frame > cl.cinematicframe + 1) { if (frame > cl.cinematicframe + 1) {
logger.info("Dropped frame: {} > {}", frame, (cl.cinematicframe + 1)); log.info("Dropped frame: {} > {}", frame, (cl.cinematicframe + 1));
cl.cinematictime = cls.realtime - cl.cinematicframe * 1000 / 14; cl.cinematictime = cls.realtime - cl.cinematicframe * 1000 / 14;
} }
@@ -1826,7 +1824,7 @@ public final class SCR extends Globals {
EndLoadingPlaque(); EndLoadingPlaque();
cls.state = ca_active; cls.state = ca_active;
if (size == 0 || cin.pic == null) { if (size == 0 || cin.pic == null) {
logger.info("{} not found.", name); log.info("{} not found.", name);
cl.cinematictime = 0; cl.cinematictime = 0;
} }
return; return;

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
import lwjake2.game.cvar_t; import lwjake2.game.cvar_t;
@@ -25,9 +26,6 @@ import lwjake2.qcommon.Com;
import lwjake2.qcommon.Cvar; import lwjake2.qcommon.Cvar;
import lwjake2.sys.Timer; import lwjake2.sys.Timer;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
@@ -35,9 +33,8 @@ import java.nio.FloatBuffer;
/** /**
* V * V
*/ */
@Slf4j
public final class V extends Globals { public final class V extends Globals {
private static final Logger logger = LoggerFactory.getLogger(V.class);
static cvar_t cl_testblend; static cvar_t cl_testblend;
static cvar_t cl_testparticles; static cvar_t cl_testparticles;
@@ -362,7 +359,7 @@ public final class V extends Globals {
re.RenderFrame(cl.refdef); re.RenderFrame(cl.refdef);
if (cl_stats.value != 0.0f) if (cl_stats.value != 0.0f)
logger.info("ent:{} lt:{} part:{}", r_numentities, r_numdlights, r_numparticles); log.info("ent:{} lt:{} part:{}", r_numentities, r_numdlights, r_numparticles);
if (log_stats.value != 0.0f && (log_stats_file != null)) if (log_stats.value != 0.0f && (log_stats_file != null))
try { try {
log_stats_file.write(r_numentities + "," + r_numdlights + "," log_stats_file.write(r_numentities + "," + r_numdlights + ","
@@ -382,7 +379,7 @@ public final class V extends Globals {
*/ */
static Runnable Viewpos_f = new Runnable() { static Runnable Viewpos_f = new Runnable() {
public void run() { public void run() {
logger.info("({} {} {}) : {}", log.info("({} {} {}) : {}",
(int) cl.refdef.vieworg[0], (int) cl.refdef.vieworg[0],
(int) cl.refdef.vieworg[1], (int) cl.refdef.vieworg[1],
(int) cl.refdef.vieworg[2], (int) cl.refdef.vieworg[2],

View File

@@ -18,6 +18,7 @@
package lwjake2.client; package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -28,8 +29,6 @@ import lwjake2.render.Renderer;
import lwjake2.sound.S; import lwjake2.sound.S;
import lwjake2.sys.IN; import lwjake2.sys.IN;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.DisplayMode; import java.awt.DisplayMode;
@@ -41,8 +40,8 @@ import java.awt.DisplayMode;
* *
* @author cwei * @author cwei
*/ */
@Slf4j
public class VID extends Globals { public class VID extends Globals {
private static final Logger logger = LoggerFactory.getLogger(VID.class);
// Main windowed and fullscreen graphics interface module. This module // Main windowed and fullscreen graphics interface module. This module
// is used for both the software and OpenGL rendering versions of the // is used for both the software and OpenGL rendering versions of the
// Quake refresh engine. // Quake refresh engine.
@@ -81,7 +80,7 @@ public class VID extends Globals {
while (fmt.endsWith("\n")) { fmt = fmt.substring(0, fmt.lastIndexOf("\n")); } while (fmt.endsWith("\n")) { fmt = fmt.substring(0, fmt.lastIndexOf("\n")); }
while (fmt.endsWith("\r")) { fmt = fmt.substring(0, fmt.lastIndexOf("\r")); } while (fmt.endsWith("\r")) { fmt = fmt.substring(0, fmt.lastIndexOf("\r")); }
fmt = fmt.trim(); fmt = fmt.trim();
logger.warn("{}", fmt); log.warn("{}", fmt);
} }
public static void Printf(int print_level, String fmt, Vargs vargs) { public static void Printf(int print_level, String fmt, Vargs vargs) {
@@ -180,7 +179,7 @@ public class VID extends Globals {
FreeReflib(); FreeReflib();
} }
logger.info("------- Loading {} -------", name); log.info("------- Loading {} -------", name);
boolean found = false; boolean found = false;
@@ -194,11 +193,11 @@ public class VID extends Globals {
} }
if (!found) { if (!found) {
logger.warn("LoadLibrary(\"{}\") failed", name); log.warn("LoadLibrary(\"{}\") failed", name);
return false; return false;
} }
logger.info("LoadLibrary(\"{}\")", name); log.info("LoadLibrary(\"{}\")", name);
Globals.re = Renderer.getDriver(name); Globals.re = Renderer.getDriver(name);
if (Globals.re == null) if (Globals.re == null)
@@ -224,7 +223,7 @@ public class VID extends Globals {
/* Init KBD */ /* Init KBD */
Globals.re.getKeyboardHandler().Init(); Globals.re.getKeyboardHandler().Init();
logger.info("------------------------------------"); log.info("------------------------------------");
reflib_active = true; reflib_active = true;
return true; return true;
} }
@@ -270,10 +269,10 @@ public class VID extends Globals {
} }
if ( vid_ref.string.equals(Renderer.getDefaultName())) { if ( vid_ref.string.equals(Renderer.getDefaultName())) {
renderer = vid_ref.string; renderer = vid_ref.string;
logger.info("Refresh failed"); log.info("Refresh failed");
gl_mode = Cvar.Get( "gl_mode", "0", 0 ); gl_mode = Cvar.Get( "gl_mode", "0", 0 );
if (gl_mode.value != 0.0f) { if (gl_mode.value != 0.0f) {
logger.info("Trying mode 0"); log.info("Trying mode 0");
Cvar.SetValue("gl_mode", 0); Cvar.SetValue("gl_mode", 0);
if ( !LoadRefresh( vid_ref.string ) ) if ( !LoadRefresh( vid_ref.string ) )
Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!"); Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!");

View File

@@ -18,6 +18,7 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.monsters.M_Player; import lwjake2.game.monsters.M_Player;
@@ -30,8 +31,6 @@ import lwjake2.qcommon.SZ;
import lwjake2.qcommon.cmd_function_t; import lwjake2.qcommon.cmd_function_t;
import lwjake2.server.SV_GAME; import lwjake2.server.SV_GAME;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
@@ -40,36 +39,36 @@ import java.util.Vector;
/** /**
* Cmd * Cmd
*/ */
@Slf4j
public final class Cmd { public final class Cmd {
private static final Logger logger = LoggerFactory.getLogger(Cmd.class);
static Runnable List_f = new Runnable() { static Runnable List_f = new Runnable() {
public void run() { public void run() {
cmd_function_t cmd = Cmd.cmd_functions; cmd_function_t cmd = Cmd.cmd_functions;
int i = 0; int i = 0;
while (cmd != null) { while (cmd != null) {
logger.info(cmd.name); log.info(cmd.name);
i++; i++;
cmd = cmd.next; cmd = cmd.next;
} }
logger.info("{} commands", i); log.info("{} commands", i);
} }
}; };
static Runnable Exec_f = new Runnable() { static Runnable Exec_f = new Runnable() {
public void run() { public void run() {
if (Cmd.Argc() != 2) { if (Cmd.Argc() != 2) {
logger.info("exec <filename> : execute a script file"); log.info("exec <filename> : execute a script file");
return; return;
} }
byte[] f = null; byte[] f = null;
f = FS.LoadFile(Cmd.Argv(1)); f = FS.LoadFile(Cmd.Argv(1));
if (f == null) { if (f == null) {
logger.info("couldn't exec {}", Cmd.Argv(1)); log.info("couldn't exec {}", Cmd.Argv(1));
return; return;
} }
logger.info("execing {}", Cmd.Argv(1)); log.info("execing {}", Cmd.Argv(1));
Cbuf.InsertText(new String(f)); Cbuf.InsertText(new String(f));
@@ -83,7 +82,7 @@ public final class Cmd {
for (int i = 1; i < Cmd.Argc(); i++) { for (int i = 1; i < Cmd.Argc(); i++) {
sb.append(Cmd.Argv(i)).append(' '); sb.append(Cmd.Argv(i)).append(' ');
} }
logger.info(sb.toString()); log.info(sb.toString());
} }
}; };
@@ -91,16 +90,16 @@ public final class Cmd {
public void run() { public void run() {
cmdalias_t a = null; cmdalias_t a = null;
if (Cmd.Argc() == 1) { if (Cmd.Argc() == 1) {
logger.info("Current alias commands:"); log.info("Current alias commands:");
for (a = Globals.cmd_alias; a != null; a = a.next) { for (a = Globals.cmd_alias; a != null; a = a.next) {
logger.info("{} : {}", a.name, a.value); log.info("{} : {}", a.name, a.value);
} }
return; return;
} }
String s = Cmd.Argv(1); String s = Cmd.Argv(1);
if (s.length() > Defines.MAX_ALIAS_NAME) { if (s.length() > Defines.MAX_ALIAS_NAME) {
logger.warn("Alias name is too long"); log.warn("Alias name is too long");
return; return;
} }
@@ -194,7 +193,7 @@ public final class Cmd {
scan = text; scan = text;
if (len >= Defines.MAX_STRING_CHARS) { if (len >= Defines.MAX_STRING_CHARS) {
logger.info("Line exceeded {} chars, discarded.", Defines.MAX_STRING_CHARS); log.info("Line exceeded {} chars, discarded.", Defines.MAX_STRING_CHARS);
return null; return null;
} }
@@ -224,7 +223,7 @@ public final class Cmd {
len += j; len += j;
if (len >= Defines.MAX_STRING_CHARS) { if (len >= Defines.MAX_STRING_CHARS) {
logger.warn("Expanded line exceeded {} chars, discarded.", Defines.MAX_STRING_CHARS); log.warn("Expanded line exceeded {} chars, discarded.", Defines.MAX_STRING_CHARS);
return null; return null;
} }
@@ -236,13 +235,13 @@ public final class Cmd {
scan = expanded; scan = expanded;
i--; i--;
if (++count == 100) { if (++count == 100) {
logger.info("Macro expansion loop, discarded."); log.info("Macro expansion loop, discarded.");
return null; return null;
} }
} }
if (inquote) { if (inquote) {
logger.info("Line has unmatched quote, discarded."); log.info("Line has unmatched quote, discarded.");
return null; return null;
} }
@@ -310,14 +309,14 @@ public final class Cmd {
//Com.DPrintf("Cmd_AddCommand: " + cmd_name + "\n"); //Com.DPrintf("Cmd_AddCommand: " + cmd_name + "\n");
// fail if the command is a variable name // fail if the command is a variable name
if ((Cvar.VariableString(cmd_name)).length() > 0) { if ((Cvar.VariableString(cmd_name)).length() > 0) {
logger.warn("Cmd_AddCommand: {} already defined as a var", cmd_name); log.warn("Cmd_AddCommand: {} already defined as a var", cmd_name);
return; return;
} }
// fail if the command already exists // fail if the command already exists
for (cmd = cmd_functions; cmd != null; cmd = cmd.next) { for (cmd = cmd_functions; cmd != null; cmd = cmd.next) {
if (cmd_name.equals(cmd.name)) { if (cmd_name.equals(cmd.name)) {
logger.warn("Cmd_AddCommand: {} already defined", cmd_name); log.warn("Cmd_AddCommand: {} already defined", cmd_name);
return; return;
} }
} }
@@ -341,7 +340,7 @@ public final class Cmd {
while (true) { while (true) {
if (cmd == null) { if (cmd == null) {
logger.info("Cmd_RemoveCommand: {} not added", cmd_name); log.info("Cmd_RemoveCommand: {} not added", cmd_name);
return; return;
} }
if (0 == Lib.strcmp(cmd_name, cmd.name)) { if (0 == Lib.strcmp(cmd_name, cmd.name)) {
@@ -419,7 +418,7 @@ public final class Cmd {
if (cmd_argv[0].equalsIgnoreCase(a.name)) { if (cmd_argv[0].equalsIgnoreCase(a.name)) {
if (++Globals.alias_count == ALIAS_LOOP_COUNT) { if (++Globals.alias_count == ALIAS_LOOP_COUNT) {
logger.info("ALIAS_LOOP_COUNT"); log.info("ALIAS_LOOP_COUNT");
return; return;
} }
Cbuf.InsertText(a.value); Cbuf.InsertText(a.value);
@@ -1164,7 +1163,7 @@ public final class Cmd {
cmd = Cmd.Argv(0); cmd = Cmd.Argv(0);
if (Globals.cls.state <= Defines.ca_connected || cmd.charAt(0) == '-' if (Globals.cls.state <= Defines.ca_connected || cmd.charAt(0) == '-'
|| cmd.charAt(0) == '+') { || cmd.charAt(0) == '+') {
logger.warn("Unknown command \"{}\"", cmd); log.warn("Unknown command \"{}\"", cmd);
return; return;
} }

View File

@@ -20,6 +20,7 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.client.M; import lwjake2.client.M;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
@@ -27,13 +28,11 @@ import lwjake2.server.SV;
import lwjake2.server.SV_WORLD; import lwjake2.server.SV_WORLD;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@Slf4j
public class GameBase { public class GameBase {
private static final Logger logger = LoggerFactory.getLogger(GameBase.class);
public static cplane_t dummyplane = new cplane_t(); public static cplane_t dummyplane = new cplane_t();
public static game_locals_t game = new game_locals_t(); public static game_locals_t game = new game_locals_t();
@@ -242,7 +241,7 @@ public class GameBase {
edict_t choice[] = new edict_t[MAXCHOICES]; edict_t choice[] = new edict_t[MAXCHOICES];
if (targetname == null) { if (targetname == null) {
logger.info("G_PickTarget called with null targetname"); log.info("G_PickTarget called with null targetname");
return null; return null;
} }
@@ -255,7 +254,7 @@ public class GameBase {
} }
if (num_choices == 0) { if (num_choices == 0) {
logger.info("G_PickTarget: target {} not found", targetname); log.info("G_PickTarget: target {} not found", targetname);
return null; return null;
} }
@@ -399,7 +398,7 @@ public class GameBase {
}; };
public static void ShutdownGame() { public static void ShutdownGame() {
logger.info("==== ShutdownGame ===="); log.info("==== ShutdownGame ====");
} }
/** /**

View File

@@ -19,18 +19,16 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@Slf4j
public class GameItems { public class GameItems {
private static final Logger logger = LoggerFactory.getLogger(GameItems.class);
public static gitem_armor_t jacketarmor_info = new gitem_armor_t(25, 50, public static gitem_armor_t jacketarmor_info = new gitem_armor_t(25, 50,
.30f, .00f, Defines.ARMOR_JACKET); .30f, .00f, Defines.ARMOR_JACKET);
public static gitem_armor_t combatarmor_info = new gitem_armor_t(50, 100, public static gitem_armor_t combatarmor_info = new gitem_armor_t(50, 100,
@@ -817,7 +815,7 @@ public class GameItems {
if (it.pickup_name.equalsIgnoreCase(pickup_name)) if (it.pickup_name.equalsIgnoreCase(pickup_name))
return it; return it;
} }
logger.info("Item not found:{}", pickup_name); log.info("Item not found:{}", pickup_name);
return null; return null;
} }

View File

@@ -18,17 +18,15 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.QuakeFile; import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Slf4j
public class GameSave { public class GameSave {
private static final Logger logger = LoggerFactory.getLogger(GameSave.class);
public static void CreateEdicts() { public static void CreateEdicts() {
GameBase.g_edicts = new edict_t[GameBase.game.maxentities]; GameBase.g_edicts = new edict_t[GameBase.game.maxentities];
for (int i = 0; i < GameBase.game.maxentities; i++) for (int i = 0; i < GameBase.game.maxentities; i++)
@@ -117,7 +115,7 @@ public class GameSave {
* a new game is started or a save game is loaded. * a new game is started or a save game is loaded.
*/ */
public static void InitGame() { public static void InitGame() {
logger.info("==== InitGame ===="); log.info("==== InitGame ====");
// preload all classes to register the adapters // preload all classes to register the adapters
for ( int n=0; n < preloadclasslist.length; n++) for ( int n=0; n < preloadclasslist.length; n++)

View File

@@ -18,6 +18,7 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.game.monsters.M_Actor; import lwjake2.game.monsters.M_Actor;
import lwjake2.game.monsters.M_Berserk; import lwjake2.game.monsters.M_Berserk;
@@ -42,11 +43,9 @@ import lwjake2.game.monsters.M_Supertank;
import lwjake2.game.monsters.M_Tank; import lwjake2.game.monsters.M_Tank;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Slf4j
public class GameSpawn { public class GameSpawn {
private static final Logger logger = LoggerFactory.getLogger(GameSpawn.class);
static EntThinkAdapter SP_item_health = new EntThinkAdapter() { static EntThinkAdapter SP_item_health = new EntThinkAdapter() {
public String getID(){ return "SP_item_health"; } public String getID(){ return "SP_item_health"; }
public boolean think(edict_t ent) { public boolean think(edict_t ent) {
@@ -354,7 +353,7 @@ public class GameSpawn {
static void ED_ParseField(String key, String value, edict_t ent) { static void ED_ParseField(String key, String value, edict_t ent) {
if (key.equals("nextmap")) if (key.equals("nextmap"))
logger.info("nextmap: {}", value); log.info("nextmap: {}", value);
if (!GameBase.st.set(key, value)) if (!GameBase.st.set(key, value))
if (!ent.setField(key, value)) if (!ent.setField(key, value))
GameBase.gi.dprintf("??? The key [" + key GameBase.gi.dprintf("??? The key [" + key

View File

@@ -18,18 +18,16 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.QuakeFile; import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
@Slf4j
public class edict_t { public class edict_t {
private final Logger logger = LoggerFactory.getLogger(edict_t.class);
/** Constructor. */ /** Constructor. */
public edict_t(int i) { public edict_t(int i) {
s.number = i; s.number = i;
@@ -771,6 +769,6 @@ public class edict_t {
// rst's checker :-) // rst's checker :-)
if (f.readInt() != 9876) if (f.readInt() != 9876)
logger.error("ent load check failed for num {}", index); log.error("ent load check failed for num {}", index);
} }
} }

View File

@@ -18,15 +18,13 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.util.QuakeFile; import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
public class gclient_t @Slf4j
{ public class gclient_t {
private final Logger logger = LoggerFactory.getLogger(gclient_t.class);
public gclient_t(int index) public gclient_t(int index)
{ {
this.index = index; this.index = index;
@@ -305,7 +303,7 @@ public class gclient_t
update_chase = f.readInt() != 0; update_chase = f.readInt() != 0;
if (f.readInt() != 8765) if (f.readInt() != 8765)
logger.error("game client load failed for num={}", index); log.error("game client load failed for num={}", index);
} }
/** Writes a game_client_t (a player) to a file. */ /** Writes a game_client_t (a player) to a file. */

View File

@@ -18,15 +18,13 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.util.QuakeFile; import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
public class level_locals_t @Slf4j
{ public class level_locals_t {
private final Logger logger = LoggerFactory.getLogger(level_locals_t.class);
// this structure is cleared as each map is entered // this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames // it is read/written to the level.sav file for savegames
// //
@@ -151,6 +149,6 @@ public class level_locals_t
// rst's checker :-) // rst's checker :-)
if (f.readInt()!= 4711) if (f.readInt()!= 4711)
logger.error("error in reading level_locals."); log.error("error in reading level_locals.");
} }
} }

View File

@@ -18,16 +18,14 @@
package lwjake2.game; package lwjake2.game;
import lwjake2.qcommon.Com; import lombok.extern.slf4j.Slf4j;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@Slf4j
public class pmove_state_t { public class pmove_state_t {
private final Logger logger = LoggerFactory.getLogger(pmove_state_t.class);
// this structure needs to be communicated bit-accurate // this structure needs to be communicated bit-accurate
// from the server to the client to guarantee that // from the server to the client to guarantee that
// prediction stays in sync, so no floats are used. // prediction stays in sync, so no floats are used.
@@ -132,22 +130,22 @@ public class pmove_state_t {
} }
public void dump() { public void dump() {
logger.info("pm_type: {}", pm_type); log.info("pm_type: {}", pm_type);
logger.info("origin[0]: {}", origin[0]); log.info("origin[0]: {}", origin[0]);
logger.info("origin[1]: {}", origin[1]); log.info("origin[1]: {}", origin[1]);
logger.info("origin[2]: {}", origin[2]); log.info("origin[2]: {}", origin[2]);
logger.info("velocity[0]: {}", velocity[0]); log.info("velocity[0]: {}", velocity[0]);
logger.info("velocity[1]: {}", velocity[1]); log.info("velocity[1]: {}", velocity[1]);
logger.info("velocity[2]: {}", velocity[2]); log.info("velocity[2]: {}", velocity[2]);
logger.info("pmflags: {}", pm_flags); log.info("pmflags: {}", pm_flags);
logger.info("pmtime: {}", pm_time); log.info("pmtime: {}", pm_time);
logger.info("gravity: {}", gravity); log.info("gravity: {}", gravity);
logger.info("delta-angle[0]: {}", delta_angles[0]); log.info("delta-angle[0]: {}", delta_angles[0]);
logger.info("delta-angle[1]: {}", delta_angles[1]); log.info("delta-angle[1]: {}", delta_angles[1]);
logger.info("delta-angle[2]: {}", delta_angles[2]); log.info("delta-angle[2]: {}", delta_angles[2]);
} }
} }

View File

@@ -18,18 +18,17 @@
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Cbuf * Cbuf
*/ */
@Slf4j
public final class Cbuf { public final class Cbuf {
private static final Logger logger = LoggerFactory.getLogger(Cbuf.class);
private static final byte[] line = new byte[1024]; private static final byte[] line = new byte[1024];
private static final byte[] tmp = new byte[8192]; private static final byte[] tmp = new byte[8192];
@@ -137,7 +136,7 @@ public final class Cbuf {
int l = text.length(); int l = text.length();
if (Globals.cmd_text.cursize + l >= Globals.cmd_text.maxsize) { if (Globals.cmd_text.cursize + l >= Globals.cmd_text.maxsize) {
logger.warn("Cbuf_AddText: overflow"); log.warn("Cbuf_AddText: overflow");
return; return;
} }
SZ.Write(Globals.cmd_text, Lib.stringToBytes(text), l); SZ.Write(Globals.cmd_text, Lib.stringToBytes(text), l);

View File

@@ -18,17 +18,15 @@
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.CL; import lwjake2.client.CL;
import lwjake2.client.Console;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
import lwjake2.server.SV_MAIN; import lwjake2.server.SV_MAIN;
import lwjake2.sys.Sys; import lwjake2.sys.Sys;
import lwjake2.util.PrintfFormat; import lwjake2.util.PrintfFormat;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
@@ -36,9 +34,8 @@ import java.io.IOException;
* Com * Com
* *
*/ */
public final class Com @Slf4j
{ public final class Com {
private static final Logger logger = LoggerFactory.getLogger(Com.class);
static String debugContext = ""; static String debugContext = "";
static String _debugContext = ""; static String _debugContext = "";
@@ -349,7 +346,7 @@ public final class Com
while (msg.endsWith("\r")) { msg = msg.substring(0, msg.lastIndexOf("\r")); } while (msg.endsWith("\r")) { msg = msg.substring(0, msg.lastIndexOf("\r")); }
msg = msg.trim(); msg = msg.trim();
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
logger.warn(msg); log.warn(msg);
} }
} }

View File

@@ -18,13 +18,12 @@
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
import lwjake2.game.cvar_t; import lwjake2.game.cvar_t;
import lwjake2.sys.Sys; import lwjake2.sys.Sys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -44,8 +43,8 @@ import java.util.List;
* *
* @author cwei * @author cwei
*/ */
@Slf4j
public final class FS extends Globals { public final class FS extends Globals {
private static final Logger logger = LoggerFactory.getLogger(FS.class);
/* /*
* ================================================== * ==================================================
* *
@@ -145,7 +144,7 @@ public final class FS extends Globals {
if (index > 0) { if (index > 0) {
File f = new File(path.substring(0, index)); File f = new File(path.substring(0, index));
if (!f.mkdirs() && !f.isDirectory()) { if (!f.mkdirs() && !f.isDirectory()) {
logger.warn("can't create path \"{}\"", path); log.warn("can't create path \"{}\"", path);
} }
} }
} }
@@ -583,7 +582,7 @@ public final class FS extends Globals {
pack.numfiles = numpackfiles; pack.numfiles = numpackfiles;
pack.files = newfiles; pack.files = newfiles;
logger.info("Added packfile {} ({} files)", packfile, numpackfiles); log.info("Added packfile {} ({} files)", packfile, numpackfiles);
return pack; return pack;
} }
@@ -685,7 +684,7 @@ public final class FS extends Globals {
if (dir.indexOf("..") != -1 || dir.indexOf("/") != -1 if (dir.indexOf("..") != -1 || dir.indexOf("/") != -1
|| dir.indexOf("\\") != -1 || dir.indexOf(":") != -1) { || dir.indexOf("\\") != -1 || dir.indexOf(":") != -1) {
logger.warn("Gamedir should be a single filename, not a path"); log.warn("Gamedir should be a single filename, not a path");
return; return;
} }
@@ -738,7 +737,7 @@ public final class FS extends Globals {
filelink_t entry = null; filelink_t entry = null;
if (Cmd.Argc() != 3) { if (Cmd.Argc() != 3) {
logger.info("USAGE: link <from> <to>"); log.info("USAGE: link <from> <to>");
return; return;
} }
@@ -806,8 +805,8 @@ public final class FS extends Globals {
if (tmp != null) if (tmp != null)
tmp.replaceAll("\\\\", "/"); tmp.replaceAll("\\\\", "/");
logger.info("Directory of {}", findname); log.info("Directory of {}", findname);
logger.info("----"); log.info("----");
dirnames = ListFiles(findname, 0, 0); dirnames = ListFiles(findname, 0, 0);
@@ -815,9 +814,9 @@ public final class FS extends Globals {
int index = 0; int index = 0;
for (int i = 0; i < dirnames.length; i++) { for (int i = 0; i < dirnames.length; i++) {
if ((index = dirnames[i].lastIndexOf('/')) > 0) { if ((index = dirnames[i].lastIndexOf('/')) > 0) {
logger.info(dirnames[i].substring(index + 1, dirnames[i].length())); log.info(dirnames[i].substring(index + 1, dirnames[i].length()));
} else { } else {
logger.info(dirnames[i]); log.info(dirnames[i]);
} }
} }
} }
@@ -833,20 +832,20 @@ public final class FS extends Globals {
searchpath_t s; searchpath_t s;
filelink_t link; filelink_t link;
logger.info("Current search path:"); log.info("Current search path:");
for (s = fs_searchpaths; s != null; s = s.next) { for (s = fs_searchpaths; s != null; s = s.next) {
if (s == fs_base_searchpaths) if (s == fs_base_searchpaths)
logger.info("----------"); log.info("----------");
if (s.pack != null) if (s.pack != null)
logger.info("{} ({} files)", s.pack.filename, s.pack.numfiles); log.info("{} ({} files)", s.pack.filename, s.pack.numfiles);
else else
logger.info(s.filename); log.info(s.filename);
} }
logger.info("Links:"); log.info("Links:");
for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = it.next(); link = it.next();
logger.info("{} : {}", link.from, link.to); log.info("{} : {}", link.from, link.to);
} }
} }

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.CL; import lwjake2.client.CL;
import lwjake2.client.Key; import lwjake2.client.Key;
@@ -28,8 +29,6 @@ import lwjake2.sys.NET;
import lwjake2.sys.Sys; import lwjake2.sys.Sys;
import lwjake2.sys.Timer; import lwjake2.sys.Timer;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
@@ -38,8 +37,8 @@ import java.io.IOException;
* Qcommon contains some basic routines for the game engine * Qcommon contains some basic routines for the game engine
* namely initialization, shutdown and frame generation. * namely initialization, shutdown and frame generation.
*/ */
@Slf4j
public final class Qcommon extends Globals { public final class Qcommon extends Globals {
private static final Logger logger = LoggerFactory.getLogger(Qcommon.class);
private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance(); private static final FileSystem fileSystem = BaseQ2FileSystem.getInstance();
public static final String BUILDSTRING = "Java " + System.getProperty("java.version");; public static final String BUILDSTRING = "Java " + System.getProperty("java.version");;
public static final String CPUSTRING = System.getProperty("os.arch"); public static final String CPUSTRING = System.getProperty("os.arch");
@@ -125,7 +124,7 @@ public final class Qcommon extends Globals {
SCR.EndLoadingPlaque(); SCR.EndLoadingPlaque();
} }
logger.info("====== Quake2 Initialized ======"); log.info("====== Quake2 Initialized ======");
// save config when configuration is completed // save config when configuration is completed
CL.WriteConfiguration(); CL.WriteConfiguration();
@@ -187,7 +186,7 @@ public final class Qcommon extends Globals {
} }
if (Globals.showtrace.value != 0.0f) { if (Globals.showtrace.value != 0.0f) {
logger.info(String.format("%4d traces %4d points", Globals.c_traces, Globals.c_pointcontents)); log.info(String.format("%4d traces %4d points", Globals.c_traces, Globals.c_pointcontents));
Globals.c_traces= 0; Globals.c_traces= 0;
@@ -224,7 +223,7 @@ public final class Qcommon extends Globals {
sv -= gm; sv -= gm;
cl -= rf; cl -= rf;
logger.info(String.format("all:%3d sv:%3d gm:%3d cl:%3d rf:%3d", all, sv, gm, cl, rf)); log.info(String.format("all:%3d sv:%3d gm:%3d cl:%3d rf:%3d", all, sv, gm, cl, rf));
} }
} catch (IllegalStateException e) { } catch (IllegalStateException e) {

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl; package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.client.VID; import lwjake2.client.VID;
import lwjake2.client.viddef_t; import lwjake2.client.viddef_t;
@@ -31,16 +32,14 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* LWJGLBase * LWJGLBase
* *
* @author dsanders/cwei * @author dsanders/cwei
*/ */
@Slf4j
public abstract class LWJGLBase { public abstract class LWJGLBase {
private final Logger logger = LoggerFactory.getLogger(LWJGLBase.class);
// IMPORTED FUNCTIONS // IMPORTED FUNCTIONS
protected DisplayMode oldDisplayMode; protected DisplayMode oldDisplayMode;
@@ -209,7 +208,7 @@ public abstract class LWJGLBase {
Dimension newDim = new Dimension(); Dimension newDim = new Dimension();
logger.info("Initializing OpenGL display"); log.info("Initializing OpenGL display");
/* /*
* fullscreen handling * fullscreen handling
@@ -219,11 +218,11 @@ public abstract class LWJGLBase {
} }
if (!VID.GetModeInfo(newDim, mode)) { if (!VID.GetModeInfo(newDim, mode)) {
logger.warn("...setting mode {}: invalid mode", mode); log.warn("...setting mode {}: invalid mode", mode);
return rserr_invalid_mode; return rserr_invalid_mode;
} }
logger.info("...setting mode {}: {} {}", mode, newDim.width, newDim.height); log.info("...setting mode {}: {} {}", mode, newDim.width, newDim.height);
// destroy the existing window // destroy the existing window
GLimp_Shutdown(); GLimp_Shutdown();
@@ -254,7 +253,7 @@ public abstract class LWJGLBase {
return rserr_invalid_fullscreen; return rserr_invalid_fullscreen;
} }
logger.info("...setting fullscreen {}", getModeString(displayMode)); log.info("...setting fullscreen {}", getModeString(displayMode));
} }
else else

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl; package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.VID; import lwjake2.client.VID;
@@ -46,16 +47,14 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBMultitexture; import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL13;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Main * Main
* *
* @author cwei * @author cwei
*/ */
@Slf4j
public abstract class Main extends Base { public abstract class Main extends Base {
private final Logger logger = LoggerFactory.getLogger(Main.class);
public static int[] d_8to24table = new int[256]; public static int[] d_8to24table = new int[256];
int c_visible_lightmaps; int c_visible_lightmaps;
@@ -1038,19 +1037,19 @@ public abstract class Main extends Base {
if (err == rserr_invalid_fullscreen) { if (err == rserr_invalid_fullscreen) {
Cvar.SetValue("vid_fullscreen", 0); Cvar.SetValue("vid_fullscreen", 0);
vid_fullscreen.modified = false; vid_fullscreen.modified = false;
logger.warn("ref_gl::R_SetMode() - fullscreen unavailable in this mode"); log.warn("ref_gl::R_SetMode() - fullscreen unavailable in this mode");
if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok) if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok)
return true; return true;
} }
else if (err == rserr_invalid_mode) { else if (err == rserr_invalid_mode) {
Cvar.SetValue("gl_mode", gl_state.prev_mode); Cvar.SetValue("gl_mode", gl_state.prev_mode);
gl_mode.modified = false; gl_mode.modified = false;
logger.warn("ref_gl::R_SetMode() - invalid mode"); log.warn("ref_gl::R_SetMode() - invalid mode");
} }
// try setting it back to something safe // try setting it back to something safe
if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) {
logger.warn("ref_gl::R_SetMode() - could not revert to safe mode"); log.warn("ref_gl::R_SetMode() - could not revert to safe mode");
return false; return false;
} }
} }
@@ -1071,7 +1070,7 @@ public abstract class Main extends Base {
r_turbsin[j] = Warp.SIN[j] * 0.5f; r_turbsin[j] = Warp.SIN[j] * 0.5f;
} }
logger.info("ref_gl version: {}", REF_VERSION); log.info("ref_gl version: {}", REF_VERSION);
Draw_GetPalette(); Draw_GetPalette();
@@ -1082,7 +1081,7 @@ public abstract class Main extends Base {
// create the window and set up the context // create the window and set up the context
if (!R_SetMode()) { if (!R_SetMode()) {
logger.info("ref_gl::R_Init() - could not R_SetMode()"); log.info("ref_gl::R_Init() - could not R_SetMode()");
return false; return false;
} }
return true; return true;
@@ -1098,13 +1097,13 @@ public abstract class Main extends Base {
** get our various GL strings ** get our various GL strings
*/ */
gl_config.vendor_string = GL11.glGetString(GL11.GL_VENDOR); gl_config.vendor_string = GL11.glGetString(GL11.GL_VENDOR);
logger.info("GL_VENDOR: {}", gl_config.vendor_string); log.info("GL_VENDOR: {}", gl_config.vendor_string);
gl_config.renderer_string = GL11.glGetString(GL11.GL_RENDERER); gl_config.renderer_string = GL11.glGetString(GL11.GL_RENDERER);
logger.info("GL_RENDERER: {}", gl_config.renderer_string); log.info("GL_RENDERER: {}", gl_config.renderer_string);
gl_config.version_string = GL11.glGetString(GL11.GL_VERSION); gl_config.version_string = GL11.glGetString(GL11.GL_VERSION);
logger.info("GL_VERSION: {}", gl_config.version_string); log.info("GL_VERSION: {}", gl_config.version_string);
gl_config.extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); gl_config.extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS);
logger.info("GL_EXTENSIONS: {}", gl_config.extensions_string); log.info("GL_EXTENSIONS: {}", gl_config.extensions_string);
gl_config.parseOpenGLVersion(); gl_config.parseOpenGLVersion();
@@ -1138,7 +1137,7 @@ public abstract class Main extends Base {
if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') { if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') {
if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) {
Cvar.Set("gl_monolightmap", "A"); Cvar.Set("gl_monolightmap", "A");
logger.info("...using gl_monolightmap 'a'"); log.info("...using gl_monolightmap 'a'");
} }
else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) {
Cvar.Set("gl_monolightmap", "0"); Cvar.Set("gl_monolightmap", "0");
@@ -1173,16 +1172,16 @@ public abstract class Main extends Base {
} }
if (gl_config.allow_cds) if (gl_config.allow_cds)
logger.info("...allowing CDS"); log.info("...allowing CDS");
else else
logger.info("...disabling CDS"); log.info("...disabling CDS");
/* /*
** grab extensions ** grab extensions
*/ */
if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0 if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0
|| gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) { || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) {
logger.info("...enabling GL_EXT_compiled_vertex_array"); log.info("...enabling GL_EXT_compiled_vertex_array");
// qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" ); // qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" );
if (gl_ext_compiled_vertex_array.value != 0.0f) if (gl_ext_compiled_vertex_array.value != 0.0f)
qglLockArraysEXT = true; qglLockArraysEXT = true;
@@ -1192,16 +1191,16 @@ public abstract class Main extends Base {
//qglUnlockArraysEXT = true; //qglUnlockArraysEXT = true;
} }
else { else {
logger.info("...GL_EXT_compiled_vertex_array not found"); log.info("...GL_EXT_compiled_vertex_array not found");
qglLockArraysEXT = false; qglLockArraysEXT = false;
} }
if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) { if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) {
qwglSwapIntervalEXT = true; qwglSwapIntervalEXT = true;
logger.info("...enabling WGL_EXT_swap_control"); log.info("...enabling WGL_EXT_swap_control");
} else { } else {
qwglSwapIntervalEXT = false; qwglSwapIntervalEXT = false;
logger.info("...WGL_EXT_swap_control not found"); log.info("...WGL_EXT_swap_control not found");
} }
if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) { if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) {
@@ -1209,14 +1208,14 @@ public abstract class Main extends Base {
// qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" ); // qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" );
qglPointParameterfEXT = true; qglPointParameterfEXT = true;
// qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" ); // qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" );
logger.info("...using GL_EXT_point_parameters"); log.info("...using GL_EXT_point_parameters");
} }
else { else {
logger.info("...ignoring GL_EXT_point_parameters"); log.info("...ignoring GL_EXT_point_parameters");
} }
} }
else { else {
logger.info("...GL_EXT_point_parameters not found"); log.info("...GL_EXT_point_parameters not found");
} }
// #ifdef __linux__ // #ifdef __linux__
@@ -1243,26 +1242,26 @@ public abstract class Main extends Base {
&& gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0
&& gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) { && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) {
if (gl_ext_palettedtexture.value != 0.0f) { if (gl_ext_palettedtexture.value != 0.0f) {
logger.info("...using GL_EXT_shared_texture_palette"); log.info("...using GL_EXT_shared_texture_palette");
qglColorTableEXT = false; // true; TODO jogl bug qglColorTableEXT = false; // true; TODO jogl bug
} }
else { else {
logger.info("...ignoring GL_EXT_shared_texture_palette"); log.info("...ignoring GL_EXT_shared_texture_palette");
qglColorTableEXT = false; qglColorTableEXT = false;
} }
} }
else { else {
logger.info("...GL_EXT_shared_texture_palette not found"); log.info("...GL_EXT_shared_texture_palette not found");
} }
if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) { if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) {
logger.info("...using GL_ARB_multitexture"); log.info("...using GL_ARB_multitexture");
qglActiveTextureARB = true; qglActiveTextureARB = true;
GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB; GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB;
GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB; GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB;
} }
else { else {
logger.info("...GL_ARB_multitexture not found"); log.info("...GL_ARB_multitexture not found");
} }
if (!(qglActiveTextureARB)) if (!(qglActiveTextureARB))

View File

@@ -18,6 +18,7 @@
package lwjake2.server; package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -40,8 +41,6 @@ import lwjake2.sys.Sys;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.QuakeFile; import lwjake2.util.QuakeFile;
import lwjake2.util.Vargs; import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@@ -49,8 +48,8 @@ import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.util.Calendar; import java.util.Calendar;
@Slf4j
public class SV_CCMDS { public class SV_CCMDS {
private static final Logger logger = LoggerFactory.getLogger(SV_CCMDS.class);
/* /*
=============================================================================== ===============================================================================
@@ -769,10 +768,10 @@ public class SV_CCMDS {
Com.Printf("No server running.\n"); Com.Printf("No server running.\n");
return; return;
} }
logger.info("map : {}", SV_INIT.sv.name); log.info("map : {}", SV_INIT.sv.name);
logger.info("num score ping name lastmsg address qport "); log.info("num score ping name lastmsg address qport ");
logger.info("--- ----- ---- --------------- ------- --------------------- ------"); log.info("--- ----- ---- --------------- ------- --------------------- ------");
for (i = 0; i < SV_MAIN.maxclients.value; i++) { for (i = 0; i < SV_MAIN.maxclients.value; i++) {
cl = SV_INIT.svs.clients[i]; cl = SV_INIT.svs.clients[i];
if (0 == cl.state) if (0 == cl.state)
@@ -806,9 +805,9 @@ public class SV_CCMDS {
sb.append(String.format("%5d", cl.netchan.qport)); sb.append(String.format("%5d", cl.netchan.qport));
logger.info(sb.toString()); log.info(sb.toString());
} }
logger.info(""); log.info("");
} }
/* /*
================== ==================

View File

@@ -18,6 +18,7 @@
package lwjake2.server; package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.CL; import lwjake2.client.CL;
@@ -38,15 +39,12 @@ import lwjake2.qcommon.SZ;
import lwjake2.sys.NET; import lwjake2.sys.NET;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@Slf4j
public class SV_INIT { public class SV_INIT {
private static final Logger logger = LoggerFactory.getLogger(SV_INIT.class);
/** /**
* SV_FindIndex. * SV_FindIndex.
*/ */
@@ -188,7 +186,7 @@ public class SV_INIT {
if (attractloop) if (attractloop)
Cvar.Set("paused", "0"); Cvar.Set("paused", "0");
logger.info("------- Server Initialization -------"); log.info("------- Server Initialization -------");
Com.DPrintf("SpawnServer: " + server + "\n"); Com.DPrintf("SpawnServer: " + server + "\n");
if (sv.demofile != null) if (sv.demofile != null)
@@ -323,7 +321,7 @@ public class SV_INIT {
if (Cvar.VariableValue("coop") != 0 if (Cvar.VariableValue("coop") != 0
&& Cvar.VariableValue("deathmatch") != 0) { && Cvar.VariableValue("deathmatch") != 0) {
logger.info("Deathmatch and Coop both set, disabling Coop"); log.info("Deathmatch and Coop both set, disabling Coop");
Cvar.FullSet("coop", "0", Defines.CVAR_SERVERINFO Cvar.FullSet("coop", "0", Defines.CVAR_SERVERINFO
| Defines.CVAR_LATCH); | Defines.CVAR_LATCH);
} }

View File

@@ -18,6 +18,7 @@
package lwjake2.server; package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -36,14 +37,11 @@ import lwjake2.qcommon.netadr_t;
import lwjake2.sys.NET; import lwjake2.sys.NET;
import lwjake2.sys.Timer; import lwjake2.sys.Timer;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
@Slf4j
public class SV_MAIN { public class SV_MAIN {
private static final Logger logger = LoggerFactory.getLogger(SV_MAIN.class);
/** Address of group servers. */ /** Address of group servers. */
public static netadr_t master_adr[] = new netadr_t[Defines.MAX_MASTERS]; public static netadr_t master_adr[] = new netadr_t[Defines.MAX_MASTERS];

View File

@@ -18,12 +18,11 @@
package lwjake2.sound; package lwjake2.sound;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.game.cvar_t; import lwjake2.game.cvar_t;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.qcommon.Cvar; import lwjake2.qcommon.Cvar;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Vector; import java.util.Vector;
@@ -31,8 +30,8 @@ import java.util.Vector;
/** /**
* S * S
*/ */
@Slf4j
public class S { public class S {
private static final Logger logger = LoggerFactory.getLogger(S.class);
static Sound impl; static Sound impl;
static cvar_t s_impl; static cvar_t s_impl;
@@ -95,11 +94,11 @@ public class S {
*/ */
public static void Init() { public static void Init() {
logger.info("------- sound initialization -------"); log.info("------- sound initialization -------");
cvar_t cv = Cvar.Get("s_initsound", "1", 0); cvar_t cv = Cvar.Get("s_initsound", "1", 0);
if (cv.value == 0.0f) { if (cv.value == 0.0f) {
logger.info("not initializing."); log.info("not initializing.");
useDriver("dummy"); useDriver("dummy");
return; return;
} }
@@ -121,7 +120,7 @@ public class S {
useDriver("dummy"); useDriver("dummy");
} }
logger.info("------- use sound driver \"{}\" -------", impl.getName()); log.info("------- use sound driver \"{}\" -------", impl.getName());
StopAllSounds(); StopAllSounds();
} }

View File

@@ -18,18 +18,16 @@
package lwjake2.sound; package lwjake2.sound;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.qcommon.FS; import lwjake2.qcommon.FS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* SND_MEM * SND_MEM
*/ */
@Slf4j
public class WaveLoader { public class WaveLoader {
private static final Logger logger = LoggerFactory.getLogger(WaveLoader.class);
/** /**
* The ResampleSfx can squeeze and stretch samples to a default sample rate. * The ResampleSfx can squeeze and stretch samples to a default sample rate.
* Since Joal and lwjgl sound drivers support this, we don't need it and the samples * Since Joal and lwjgl sound drivers support this, we don't need it and the samples
@@ -230,7 +228,7 @@ public class WaveLoader {
return; return;
} }
if (iff_chunk_len > 1024*1024) { if (iff_chunk_len > 1024*1024) {
logger.warn("Warning: FindNextChunk: length is past the 1 meg sanity limit"); log.warn("Warning: FindNextChunk: length is past the 1 meg sanity limit");
} }
data_p -= 8; data_p -= 8;
last_chunk = data_p + 8 + ((iff_chunk_len + 1) & ~1); last_chunk = data_p + 8 + ((iff_chunk_len + 1) & ~1);

View File

@@ -18,6 +18,7 @@
package lwjake2.sound.lwjgl; package lwjake2.sound.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
@@ -48,17 +49,14 @@ import org.lwjgl.openal.AL10;
import org.lwjgl.openal.ALC10; import org.lwjgl.openal.ALC10;
import org.lwjgl.openal.EFX10; import org.lwjgl.openal.EFX10;
import org.lwjgl.openal.OpenALException; import org.lwjgl.openal.OpenALException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* LWJGLSoundImpl * LWJGLSoundImpl
* *
* @author dsanders/cwei * @author dsanders/cwei
*/ */
@Slf4j
public final class LWJGLSoundImpl implements Sound { public final class LWJGLSoundImpl implements Sound {
private final Logger logger = LoggerFactory.getLogger(LWJGLSoundImpl.class);
static { static {
S.register(new LWJGLSoundImpl()); S.register(new LWJGLSoundImpl());
}; };
@@ -87,7 +85,7 @@ public final class LWJGLSoundImpl implements Sound {
checkError(); checkError();
initOpenALExtensions(); initOpenALExtensions();
} catch (OpenALException e) { } catch (OpenALException e) {
logger.error(e.getMessage()); log.error(e.getMessage());
return false; return false;
} catch (Exception e) { } catch (Exception e) {
Com.DPrintf(e.getMessage() + '\n'); Com.DPrintf(e.getMessage() + '\n');
@@ -98,7 +96,7 @@ public final class LWJGLSoundImpl implements Sound {
s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE); s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);
AL10.alGenBuffers(buffers); AL10.alGenBuffers(buffers);
int count = Channel.init(buffers); int count = Channel.init(buffers);
logger.info("... using {} channels", count); log.info("... using {} channels", count);
AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED);
Cmd.AddCommand("play", new Runnable() { Cmd.AddCommand("play", new Runnable() {
public void run() { public void run() {
@@ -123,10 +121,10 @@ public final class LWJGLSoundImpl implements Sound {
num_sfx = 0; num_sfx = 0;
logger.info("sound sampling rate: 44100Hz"); log.info("sound sampling rate: 44100Hz");
StopAllSounds(); StopAllSounds();
logger.info("------------------------------------"); log.info("------------------------------------");
return true; return true;
} }
@@ -143,7 +141,7 @@ public final class LWJGLSoundImpl implements Sound {
String defaultSpecifier = ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER); String defaultSpecifier = ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER);
logger.info("{} using {}", os, ((deviceName == null) ? defaultSpecifier : deviceName)); log.info("{} using {}", os, ((deviceName == null) ? defaultSpecifier : deviceName));
// Check for an error. // Check for an error.
if (ALC10.alcGetError(AL.getDevice()) != ALC10.ALC_NO_ERROR) if (ALC10.alcGetError(AL.getDevice()) != ALC10.ALC_NO_ERROR)
@@ -155,7 +153,7 @@ public final class LWJGLSoundImpl implements Sound {
/** Initializes OpenAL EFX effects. */ /** Initializes OpenAL EFX effects. */
private void initOpenALExtensions() private void initOpenALExtensions()
{ {
logger.info("... using EFX effects:"); log.info("... using EFX effects:");
underwaterFilter = new EFXFilterLowPass(); underwaterFilter = new EFXFilterLowPass();
underwaterFilter.setGain(1.0f); underwaterFilter.setGain(1.0f);
underwaterFilter.setGainHF(0.0f); underwaterFilter.setGainHF(0.0f);
@@ -588,26 +586,26 @@ public final class LWJGLSoundImpl implements Sound {
if (sc != null) { if (sc != null) {
size = sc.length * sc.width * (sc.stereo + 1); size = sc.length * sc.width * (sc.stereo + 1);
total += size; total += size;
logger.info(String.format("%s(%2db) %6d : %s", log.info(String.format("%s(%2db) %6d : %s",
(sc.loopstart >= 0 ? 'L' : ' '), (sc.loopstart >= 0 ? 'L' : ' '),
(sc.width * 8), size, sfx.name) (sc.width * 8), size, sfx.name)
); );
} else { } else {
if (sfx.name.charAt(0) == '*') if (sfx.name.charAt(0) == '*')
logger.info(" placeholder : {}", sfx.name); log.info(" placeholder : {}", sfx.name);
else else
logger.info(" not loaded : {}", sfx.name); log.info(" not loaded : {}", sfx.name);
} }
} }
logger.info("Total resident: {}", total); log.info("Total resident: {}", total);
} }
void SoundInfo_f() { void SoundInfo_f() {
//TODO параметры тут не нужны, сплошная статика //TODO параметры тут не нужны, сплошная статика
logger.info(String.format("%5d stereo", 1)); log.info(String.format("%5d stereo", 1));
logger.info(String.format("%5d samples", 22050)); log.info(String.format("%5d samples", 22050));
logger.info(String.format("%5d samplebits", 16)); log.info(String.format("%5d samplebits", 16));
logger.info(String.format("%5d speed", 44100)); log.info(String.format("%5d speed", 44100));
} }
} }

View File

@@ -18,19 +18,17 @@
package lwjake2.sound.lwjgl; package lwjake2.sound.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* PlaySound * PlaySound
* *
* @author cwei * @author cwei
*/ */
@Slf4j
public class PlaySound { public class PlaySound {
private static final Logger logger = LoggerFactory.getLogger(PlaySound.class);
final static int MAX_PLAYSOUNDS = 128; final static int MAX_PLAYSOUNDS = 128;
// list with sentinel // list with sentinel
@@ -158,7 +156,7 @@ public class PlaySound {
ps.beginTime = Globals.cl.time + (long)(timeoffset * 1000); ps.beginTime = Globals.cl.time + (long)(timeoffset * 1000);
PlaySound.add(ps); PlaySound.add(ps);
} else { } else {
logger.error("PlaySounds out of Limit"); log.error("PlaySounds out of Limit");
} }
} }
} }

View File

@@ -18,6 +18,7 @@
package lwjake2.sys; package lwjake2.sys;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.cvar_t; import lwjake2.game.cvar_t;
@@ -26,8 +27,6 @@ import lwjake2.qcommon.Cvar;
import lwjake2.qcommon.netadr_t; import lwjake2.qcommon.netadr_t;
import lwjake2.qcommon.sizebuf_t; import lwjake2.qcommon.sizebuf_t;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.net.DatagramSocket; import java.net.DatagramSocket;
@@ -37,8 +36,8 @@ import java.net.SocketAddress;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel; import java.nio.channels.DatagramChannel;
@Slf4j
public final class NET { public final class NET {
private static final Logger logger = LoggerFactory.getLogger(NET.class);
private final static int MAX_LOOPBACK = 4; private final static int MAX_LOOPBACK = 4;
/** Local loopback adress. */ /** Local loopback adress. */
@@ -138,7 +137,7 @@ public final class NET {
a.port = Lib.atoi(address[1]); a.port = Lib.atoi(address[1]);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); log.error(e.getMessage());
return false; return false;
} }
} }
@@ -229,7 +228,7 @@ public final class NET {
int packetLength = receiveBuffer.position(); int packetLength = receiveBuffer.position();
if (packetLength > net_message.maxsize) { if (packetLength > net_message.maxsize) {
logger.info("Oversize packet from {}", AdrToString(net_from)); log.info("Oversize packet from {}", AdrToString(net_from));
return false; return false;
} }
@@ -267,7 +266,7 @@ public final class NET {
SocketAddress dstSocket = new InetSocketAddress(to.getInetAddress(), to.port); SocketAddress dstSocket = new InetSocketAddress(to.getInetAddress(), to.port);
ip_channels[sock].send(ByteBuffer.wrap(data, 0, length), dstSocket); ip_channels[sock].send(ByteBuffer.wrap(data, 0, length), dstSocket);
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("NET_SendPacket: %s to %s", e.getMessage(), AdrToString(to)), e); log.error(String.format("NET_SendPacket: %s to %s", e.getMessage(), AdrToString(to)), e);
} }
} }
@@ -347,7 +346,7 @@ public final class NET {
// the socket have to be broadcastable // the socket have to be broadcastable
newsocket.setBroadcast(true); newsocket.setBroadcast(true);
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("Error: %s", e.getMessage()), e); log.error(String.format("Error: %s", e.getMessage()), e);
newsocket = null; newsocket = null;
} }
return newsocket; return newsocket;

View File

@@ -18,12 +18,11 @@
package lwjake2.sys; package lwjake2.sys;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.CL; import lwjake2.client.CL;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
@@ -33,9 +32,8 @@ import java.util.regex.PatternSyntaxException;
/** /**
* Sys * Sys
*/ */
@Slf4j
public final class Sys extends Defines { public final class Sys extends Defines {
private static final Logger logger = LoggerFactory.getLogger(Sys.class);
public static void Error(String error) { public static void Error(String error) {
CL.Shutdown(); CL.Shutdown();

View File

@@ -18,14 +18,11 @@
package lwjake2.sys; package lwjake2.sys;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.qcommon.Com;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Slf4j
public abstract class Timer { public abstract class Timer {
private static final Logger logger = LoggerFactory.getLogger(Timer.class);
abstract public long currentTimeMillis(); abstract public long currentTimeMillis();
static Timer t; static Timer t;
@@ -36,7 +33,7 @@ public abstract class Timer {
} catch (Throwable e) { } catch (Throwable e) {
t = new StandardTimer(); t = new StandardTimer();
} }
logger.info("using {}", t.getClass().getName()); log.info("using {}", t.getClass().getName());
} }
public static int Milliseconds() { public static int Milliseconds() {

View File

@@ -18,11 +18,10 @@
package lwjake2.util; package lwjake2.util;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.qcommon.Com; import lwjake2.qcommon.Com;
import lwjake2.qcommon.FS; import lwjake2.qcommon.FS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -33,9 +32,8 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
@Slf4j
public class Lib { public class Lib {
private static final Logger logger = LoggerFactory.getLogger(Lib.class);
/** Converts a vector to a string. */ /** Converts a vector to a string. */
public static String vtos(float[] v) { public static String vtos(float[] v) {
return (int) v[0] + " " + (int) v[1] + " " + (int) v[2]; return (int) v[0] + " " + (int) v[1] + " " + (int) v[2];
@@ -199,7 +197,7 @@ public class Lib {
/** Prints a vector to the quake console. */ /** Prints a vector to the quake console. */
public static void printv(String in, float arr[]) { public static void printv(String in, float arr[]) {
for (int n = 0; n < arr.length; n++) { for (int n = 0; n < arr.length; n++) {
logger.info("{}[{}]: {}", in, n, arr[n]); log.info("{}[{}]: {}", in, n, arr[n]);
} }
} }