0

Hello Lombok!

This commit is contained in:
2018-03-06 23:05:47 +03:00
parent 5e9fbd0478
commit 513358fb03
34 changed files with 248 additions and 297 deletions

View File

@@ -1,3 +1,7 @@
plugins {
id 'net.ltgt.apt' version '0.10'
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'idea'
@@ -27,6 +31,9 @@ dependencies {
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-slf4j-impl', version: log4jVersion
compileOnly 'org.projectlombok:lombok:1.16.20'
apt "org.projectlombok:lombok:1.16.20"
}
sourceSets {

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -45,9 +46,6 @@ import lwjake2.sys.Sys;
import lwjake2.sys.Timer;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.RandomAccessFile;
@@ -57,9 +55,8 @@ import java.nio.ByteOrder;
/**
* CL
*/
@Slf4j
public final class CL {
private static final Logger logger = LoggerFactory.getLogger(CL.class);
static int precache_check; // for autodownload of precache items
static int precache_spawncount;
@@ -112,7 +109,7 @@ public final class CL {
int len;
if (!Globals.cls.demorecording) {
logger.info("Not recording a demo.");
log.info("Not recording a demo.");
return;
}
@@ -122,7 +119,7 @@ public final class CL {
Globals.cls.demofile.close();
Globals.cls.demofile = null;
Globals.cls.demorecording = false;
logger.info("Stopped demo.");
log.info("Stopped demo.");
} catch (IOException e) {
}
}
@@ -146,17 +143,17 @@ public final class CL {
entity_state_t ent;
if (Cmd.Argc() != 2) {
logger.info("record <demoname>");
log.info("record <demoname>");
return;
}
if (Globals.cls.demorecording) {
logger.info("Already recording.");
log.info("Already recording.");
return;
}
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;
}
@@ -165,11 +162,11 @@ public final class CL {
//
name = FS.Gamedir() + "/demos/" + Cmd.Argv(1) + ".dm2";
logger.info("recording to {}", name);
log.info("recording to {}", name);
FS.CreatePath(name);
Globals.cls.demofile = new RandomAccessFile(name, "rw");
if (Globals.cls.demofile == null) {
logger.error("ERROR: couldn't open.");
log.error("ERROR: couldn't open.");
return;
}
Globals.cls.demorecording = true;
@@ -250,7 +247,7 @@ public final class CL {
public void execute() {
if (Globals.cls.state != Defines.ca_connected
&& 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;
}
@@ -298,7 +295,7 @@ public final class CL {
String server;
if (Cmd.Argc() != 2) {
logger.info("usage: connect <server>");
log.info("usage: connect <server>");
return;
}
@@ -332,7 +329,7 @@ public final class CL {
public void execute() {
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;
}
@@ -362,7 +359,7 @@ public final class CL {
to = Globals.cls.netchan.remote_address;
else {
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;
}
NET.StringToAdr(Globals.rcon_address.string, to);
@@ -397,7 +394,7 @@ public final class CL {
SCR.BeginLoadingPlaque();
Globals.cls.state = Defines.ca_connected; // not active anymore, but
// not disconnected
logger.info("Changing map...");
log.info("Changing map...");
}
};
@@ -416,7 +413,7 @@ public final class CL {
S.StopAllSounds();
if (Globals.cls.state == Defines.ca_connected) {
logger.info("reconnecting...");
log.info("reconnecting...");
Globals.cls.state = Defines.ca_connected;
MSG.WriteChar(Globals.cls.netchan.message,
Defines.clc_stringcmd);
@@ -432,7 +429,7 @@ public final class CL {
Globals.cls.connect_time = -99999; // fire immediately
Globals.cls.state = Defines.ca_connecting;
logger.info("reconnecting...");
log.info("reconnecting...");
}
}
};
@@ -453,7 +450,7 @@ public final class CL {
NET.Config(true); // allow remote
// send a broadcast packet
logger.info("pinging broadcast...");
log.info("pinging broadcast...");
noudp = Cvar.Get("noudp", "0", Defines.CVAR_NOSET);
if (noudp.value == 0.0f) {
@@ -482,9 +479,9 @@ public final class CL {
if (adrstring == null || adrstring.length() == 0)
continue;
logger.info("pinging {} ...", adrstring);
log.info("pinging {} ...", adrstring);
if (!NET.StringToAdr(adrstring, adr)) {
logger.warn("Bad address: {}", adrstring);
log.warn("Bad address: {}", adrstring);
continue;
}
if (adr.port == 0)
@@ -508,7 +505,7 @@ public final class CL {
for (i = 0; i < Defines.MAX_CLIENTS; i++) {
if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i] == null)
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();
Sys.SendKeyEvents(); // pump message loop
CL_parse.ParseClientinfo(i);
@@ -521,7 +518,7 @@ public final class CL {
*/
static xcommand_t Userinfo_f = new xcommand_t() {
public void execute() {
logger.info("User info settings:");
log.info("User info settings:");
Info.Print(Cvar.Userinfo());
}
};
@@ -617,7 +614,7 @@ public final class CL {
int port;
if (!NET.StringToAdr(Globals.cls.servername, adr)) {
logger.warn("Bad server address");
log.warn("Bad server address");
Globals.cls.connect_time = 0;
return;
}
@@ -660,7 +657,7 @@ public final class CL {
return;
if (!NET.StringToAdr(Globals.cls.servername, adr)) {
logger.warn("Bad server address");
log.warn("Bad server address");
Globals.cls.state = Defines.ca_disconnected;
return;
}
@@ -670,7 +667,7 @@ public final class CL {
// for retransmit requests
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");
}
@@ -713,7 +710,7 @@ public final class CL {
time = (int) (Timer.Milliseconds() - Globals.cl.timedemo_start);
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,
(time / 1000.0f),
(Globals.cl.timedemo_frames * 1000.0f / time)
@@ -760,7 +757,7 @@ public final class CL {
s = MSG.ReadString(Globals.net_message);
logger.info(s);
log.info(s);
Menu.AddToServerList(Globals.net_from, s);
}
@@ -782,12 +779,12 @@ public final class CL {
c = Cmd.Argv(0);
logger.info("{}: {}", Globals.net_from.toString(), c);
log.info("{}: {}", Globals.net_from.toString(), c);
// server connection
if (c.equals("client_connect")) {
if (Globals.cls.state == Defines.ca_connected) {
logger.info("Dup connect received. Ignored.");
log.info("Dup connect received. Ignored.");
return;
}
Netchan.Setup(Defines.NS_CLIENT, Globals.cls.netchan,
@@ -807,7 +804,7 @@ public final class CL {
// remote command from gui front end
if (c.equals("cmd")) {
if (!NET.IsLocalAddress(Globals.net_from)) {
logger.info("Command packet from remote host. Ignored.");
log.info("Command packet from remote host. Ignored.");
return;
}
s = MSG.ReadString(Globals.net_message);
@@ -819,7 +816,7 @@ public final class CL {
if (c.equals("print")) {
s = MSG.ReadString(Globals.net_message);
if (s.length() > 0)
logger.info(s);
log.info(s);
return;
}
@@ -843,7 +840,7 @@ public final class CL {
return;
}
logger.warn("Unknown command.");
log.warn("Unknown command.");
}
@@ -871,7 +868,7 @@ public final class CL {
continue; // dump it if not connected
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;
}
@@ -896,7 +893,7 @@ public final class CL {
&& Globals.cls.realtime - Globals.cls.netchan.last_received > Globals.cl_timeout.value * 1000) {
if (++Globals.cl.timeoutcount > 5) // timeoutcount saves debugger
{
logger.info("Server connection timed out.");
log.info("Server connection timed out.");
Disconnect();
return;
}
@@ -1415,7 +1412,7 @@ public final class CL {
path = FS.Gamedir() + "/config.cfg";
f = Lib.fopen(path, "rw");
if (f == null) {
logger.warn("Couldn't write config.cfg.");
log.warn("Couldn't write config.cfg.");
return;
}
try {
@@ -1574,7 +1571,7 @@ public final class CL {
public static void Shutdown() {
if (isdown) {
logger.info("recursive shutdown");
log.info("recursive shutdown");
return;
}
isdown = true;

View File

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

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -28,8 +29,6 @@ import lwjake2.qcommon.FS;
import lwjake2.qcommon.xcommand_t;
import lwjake2.util.Lib;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.RandomAccessFile;
@@ -38,8 +37,8 @@ import java.util.Arrays;
/**
* Console
*/
@Slf4j
public final class Console extends Globals {
private static final Logger logger = LoggerFactory.getLogger(Console.class);
public static xcommand_t ToggleConsole_f = new xcommand_t() {
public void execute() {
SCR.EndLoadingPlaque(); // get rid of loading plaque
@@ -88,7 +87,7 @@ public final class Console extends Globals {
String name;
if (Cmd.Argc() != 2) {
logger.info("usage: condump <filename>");
log.info("usage: condump <filename>");
return;
}
@@ -97,11 +96,11 @@ public final class Console extends Globals {
// Cmd_Argv(1));
name = FS.Gamedir() + "/" + Cmd.Argv(1) + ".txt";
logger.info("Dumped console text to {}", name);
log.info("Dumped console text to {}", name);
FS.CreatePath(name);
f = Lib.fopen(name, "rw");
if (f == null) {
logger.error("ERROR: couldn't open.");
log.error("ERROR: couldn't open.");
return;
}
@@ -151,7 +150,7 @@ public final class Console extends Globals {
CheckResize();
logger.info("Console initialized.");
log.info("Console initialized.");
//
// register our commands

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -26,8 +27,6 @@ import lwjake2.qcommon.Com;
import lwjake2.qcommon.Cvar;
import lwjake2.qcommon.xcommand_t;
import lwjake2.util.Lib;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.RandomAccessFile;
@@ -36,8 +35,8 @@ import java.util.Vector;
/**
* Key
*/
@Slf4j
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
//
@@ -579,7 +578,7 @@ public class Key extends Globals {
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;
history_line = Globals.edit_line;
@@ -677,7 +676,7 @@ public class Key extends Globals {
while (type.endsWith("\n")) { type = type.substring(0, type.lastIndexOf("\n")); }
while (type.endsWith("\r")) { type = type.substring(0, type.lastIndexOf("\r")); }
type = type.trim();
logger.info("{} {}", type, sb.toString());
log.info("{} {}", type, sb.toString());
}
static void CompleteCommand() {

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -33,8 +34,6 @@ import lwjake2.sound.S;
import lwjake2.sys.Timer;
import lwjake2.util.Lib;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.Dimension;
import java.nio.ByteBuffer;
@@ -44,9 +43,8 @@ import java.util.Arrays;
/**
* SCR
*/
@Slf4j
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
static String[][] sb_nums = {
@@ -640,7 +638,7 @@ public final class SCR extends Globals {
stop = Timer.Milliseconds();
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() {
@@ -1760,7 +1758,7 @@ public final class SCR extends Globals {
return;
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;
}
@@ -1827,7 +1825,7 @@ public final class SCR extends Globals {
EndLoadingPlaque();
cls.state = ca_active;
if (size == 0 || cin.pic == null) {
logger.info("{} not found.", name);
log.info("{} not found.", name);
cl.cinematictime = 0;
}
return;

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals;
import lwjake2.game.Cmd;
import lwjake2.game.cvar_t;
@@ -26,9 +27,6 @@ import lwjake2.qcommon.Cvar;
import lwjake2.qcommon.xcommand_t;
import lwjake2.sys.Timer;
import lwjake2.util.Math3D;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.FloatBuffer;
@@ -36,9 +34,8 @@ import java.nio.FloatBuffer;
/**
* V
*/
@Slf4j
public final class V extends Globals {
private static final Logger logger = LoggerFactory.getLogger(V.class);
static cvar_t cl_testblend;
static cvar_t cl_testparticles;
@@ -363,7 +360,7 @@ public final class V extends Globals {
re.RenderFrame(cl.refdef);
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))
try {
log_stats_file.write(r_numentities + "," + r_numdlights + ","
@@ -383,7 +380,7 @@ public final class V extends Globals {
*/
static xcommand_t Viewpos_f = new xcommand_t() {
public void execute() {
logger.info("({} {} {}) : {}",
log.info("({} {} {}) : {}",
(int) cl.refdef.vieworg[0],
(int) cl.refdef.vieworg[1],
(int) cl.refdef.vieworg[2],

View File

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

View File

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

View File

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

View File

@@ -19,18 +19,16 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.StringTokenizer;
@Slf4j
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,
.30f, .00f, Defines.ARMOR_JACKET);
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))
return it;
}
logger.info("Item not found:{}", pickup_name);
log.info("Item not found:{}", pickup_name);
return null;
}

View File

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

View File

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

View File

@@ -18,18 +18,16 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@Slf4j
public class edict_t {
private final Logger logger = LoggerFactory.getLogger(edict_t.class);
/** Constructor. */
public edict_t(int i) {
s.number = i;
@@ -771,6 +769,6 @@ public class edict_t {
// rst's checker :-)
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;
import lombok.extern.slf4j.Slf4j;
import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class gclient_t
{
private final Logger logger = LoggerFactory.getLogger(gclient_t.class);
@Slf4j
public class gclient_t {
public gclient_t(int index)
{
this.index = index;
@@ -305,7 +303,7 @@ public class gclient_t
update_chase = f.readInt() != 0;
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. */

View File

@@ -18,15 +18,13 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.util.QuakeFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
public class level_locals_t
{
private final Logger logger = LoggerFactory.getLogger(level_locals_t.class);
@Slf4j
public class level_locals_t {
// this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames
//
@@ -151,6 +149,6 @@ public class level_locals_t
// rst's checker :-)
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;
import lwjake2.qcommon.Com;
import lombok.extern.slf4j.Slf4j;
import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.RandomAccessFile;
@Slf4j
public class pmove_state_t {
private final Logger logger = LoggerFactory.getLogger(pmove_state_t.class);
// this structure needs to be communicated bit-accurate
// from the server to the client to guarantee that
// prediction stays in sync, so no floats are used.
@@ -132,22 +130,22 @@ public class pmove_state_t {
}
public void dump() {
logger.info("pm_type: {}", pm_type);
log.info("pm_type: {}", pm_type);
logger.info("origin[0]: {}", origin[0]);
logger.info("origin[1]: {}", origin[1]);
logger.info("origin[2]: {}", origin[2]);
log.info("origin[0]: {}", origin[0]);
log.info("origin[1]: {}", origin[1]);
log.info("origin[2]: {}", origin[2]);
logger.info("velocity[0]: {}", velocity[0]);
logger.info("velocity[1]: {}", velocity[1]);
logger.info("velocity[2]: {}", velocity[2]);
log.info("velocity[0]: {}", velocity[0]);
log.info("velocity[1]: {}", velocity[1]);
log.info("velocity[2]: {}", velocity[2]);
logger.info("pmflags: {}", pm_flags);
logger.info("pmtime: {}", pm_time);
logger.info("gravity: {}", gravity);
log.info("pmflags: {}", pm_flags);
log.info("pmtime: {}", pm_time);
log.info("gravity: {}", gravity);
logger.info("delta-angle[0]: {}", delta_angles[0]);
logger.info("delta-angle[1]: {}", delta_angles[1]);
logger.info("delta-angle[2]: {}", delta_angles[2]);
log.info("delta-angle[0]: {}", delta_angles[0]);
log.info("delta-angle[1]: {}", delta_angles[1]);
log.info("delta-angle[2]: {}", delta_angles[2]);
}
}

View File

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

View File

@@ -18,17 +18,15 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.CL;
import lwjake2.client.Console;
import lwjake2.game.Cmd;
import lwjake2.server.SV_MAIN;
import lwjake2.sys.Sys;
import lwjake2.util.PrintfFormat;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@@ -36,9 +34,8 @@ import java.io.IOException;
* Com
*
*/
public final class Com
{
private static final Logger logger = LoggerFactory.getLogger(Com.class);
@Slf4j
public final class Com {
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")); }
msg = msg.trim();
if (!msg.isEmpty()) {
logger.warn(msg);
log.warn(msg);
}
}

View File

@@ -18,13 +18,12 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
import lwjake2.game.cvar_t;
import lwjake2.sys.Sys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
@@ -44,8 +43,8 @@ import java.util.List;
*
* @author cwei
*/
@Slf4j
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) {
File f = new File(path.substring(0, index));
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.files = newfiles;
logger.info("Added packfile {} ({} files)", packfile, numpackfiles);
log.info("Added packfile {} ({} files)", packfile, numpackfiles);
return pack;
}
@@ -685,7 +684,7 @@ public final class FS extends Globals {
if (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;
}
@@ -738,7 +737,7 @@ public final class FS extends Globals {
filelink_t entry = null;
if (Cmd.Argc() != 3) {
logger.info("USAGE: link <from> <to>");
log.info("USAGE: link <from> <to>");
return;
}
@@ -806,8 +805,8 @@ public final class FS extends Globals {
if (tmp != null)
tmp.replaceAll("\\\\", "/");
logger.info("Directory of {}", findname);
logger.info("----");
log.info("Directory of {}", findname);
log.info("----");
dirnames = ListFiles(findname, 0, 0);
@@ -815,9 +814,9 @@ public final class FS extends Globals {
int index = 0;
for (int i = 0; i < dirnames.length; i++) {
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 {
logger.info(dirnames[i]);
log.info(dirnames[i]);
}
}
}
@@ -833,20 +832,20 @@ public final class FS extends Globals {
searchpath_t s;
filelink_t link;
logger.info("Current search path:");
log.info("Current search path:");
for (s = fs_searchpaths; s != null; s = s.next) {
if (s == fs_base_searchpaths)
logger.info("----------");
log.info("----------");
if (s.pack != null)
logger.info("{} ({} files)", s.pack.filename, s.pack.numfiles);
log.info("{} ({} files)", s.pack.filename, s.pack.numfiles);
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();) {
link = it.next();
logger.info("{} : {}", link.from, link.to);
log.info("{} : {}", link.from, link.to);
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Globals;
import lwjake2.client.CL;
import lwjake2.client.Key;
@@ -28,8 +29,6 @@ import lwjake2.sys.NET;
import lwjake2.sys.Sys;
import lwjake2.sys.Timer;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileWriter;
import java.io.IOException;
@@ -38,8 +37,8 @@ import java.io.IOException;
* Qcommon contains some basic routines for the game engine
* namely initialization, shutdown and frame generation.
*/
@Slf4j
public final class Qcommon extends Globals {
private static final Logger logger = LoggerFactory.getLogger(Qcommon.class);
public static final String BUILDSTRING = "Java " + System.getProperty("java.version");;
public static final String CPUSTRING = System.getProperty("os.arch");
@@ -124,7 +123,7 @@ public final class Qcommon extends Globals {
SCR.EndLoadingPlaque();
}
logger.info("====== Quake2 Initialized ======");
log.info("====== Quake2 Initialized ======");
// save config when configuration is completed
CL.WriteConfiguration();
@@ -186,7 +185,7 @@ public final class Qcommon extends Globals {
}
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;
@@ -223,7 +222,7 @@ public final class Qcommon extends Globals {
sv -= gm;
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 (longjmpException e) {

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.viddef_t;
@@ -32,16 +33,14 @@ import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* LWJGLBase
*
* @author dsanders/cwei
*/
@Slf4j
public abstract class LWJGLBase {
private final Logger logger = LoggerFactory.getLogger(LWJGLBase.class);
// IMPORTED FUNCTIONS
protected DisplayMode oldDisplayMode;
@@ -210,7 +209,7 @@ public abstract class LWJGLBase {
Dimension newDim = new Dimension();
logger.info("Initializing OpenGL display");
log.info("Initializing OpenGL display");
/*
* fullscreen handling
@@ -220,11 +219,11 @@ public abstract class LWJGLBase {
}
if (!VID.GetModeInfo(newDim, mode)) {
logger.warn("...setting mode {}: invalid mode", mode);
log.warn("...setting mode {}: invalid mode", 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
GLimp_Shutdown();
@@ -255,7 +254,7 @@ public abstract class LWJGLBase {
return rserr_invalid_fullscreen;
}
logger.info("...setting fullscreen {}", getModeString(displayMode));
log.info("...setting fullscreen {}", getModeString(displayMode));
}
else

View File

@@ -18,6 +18,7 @@
package lwjake2.render.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.VID;
@@ -47,16 +48,14 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBMultitexture;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Main
*
* @author cwei
*/
@Slf4j
public abstract class Main extends Base {
private final Logger logger = LoggerFactory.getLogger(Main.class);
public static int[] d_8to24table = new int[256];
int c_visible_lightmaps;
@@ -1039,19 +1038,19 @@ public abstract class Main extends Base {
if (err == rserr_invalid_fullscreen) {
Cvar.SetValue("vid_fullscreen", 0);
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)
return true;
}
else if (err == rserr_invalid_mode) {
Cvar.SetValue("gl_mode", gl_state.prev_mode);
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
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;
}
}
@@ -1072,7 +1071,7 @@ public abstract class Main extends Base {
r_turbsin[j] = Warp.SIN[j] * 0.5f;
}
logger.info("ref_gl version: {}", REF_VERSION);
log.info("ref_gl version: {}", REF_VERSION);
Draw_GetPalette();
@@ -1083,7 +1082,7 @@ public abstract class Main extends Base {
// create the window and set up the context
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 true;
@@ -1099,13 +1098,13 @@ public abstract class Main extends Base {
** get our various GL strings
*/
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);
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);
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);
logger.info("GL_EXTENSIONS: {}", gl_config.extensions_string);
log.info("GL_EXTENSIONS: {}", gl_config.extensions_string);
gl_config.parseOpenGLVersion();
@@ -1139,7 +1138,7 @@ public abstract class Main extends Base {
if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') {
if (gl_config.renderer == GL_RENDERER_PERMEDIA2) {
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) {
Cvar.Set("gl_monolightmap", "0");
@@ -1174,16 +1173,16 @@ public abstract class Main extends Base {
}
if (gl_config.allow_cds)
logger.info("...allowing CDS");
log.info("...allowing CDS");
else
logger.info("...disabling CDS");
log.info("...disabling CDS");
/*
** grab extensions
*/
if (gl_config.extensions_string.indexOf("GL_EXT_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" );
if (gl_ext_compiled_vertex_array.value != 0.0f)
qglLockArraysEXT = true;
@@ -1193,16 +1192,16 @@ public abstract class Main extends Base {
//qglUnlockArraysEXT = true;
}
else {
logger.info("...GL_EXT_compiled_vertex_array not found");
log.info("...GL_EXT_compiled_vertex_array not found");
qglLockArraysEXT = false;
}
if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) {
qwglSwapIntervalEXT = true;
logger.info("...enabling WGL_EXT_swap_control");
log.info("...enabling WGL_EXT_swap_control");
} else {
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) {
@@ -1210,14 +1209,14 @@ public abstract class Main extends Base {
// qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" );
qglPointParameterfEXT = true;
// qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" );
logger.info("...using GL_EXT_point_parameters");
log.info("...using GL_EXT_point_parameters");
}
else {
logger.info("...ignoring GL_EXT_point_parameters");
log.info("...ignoring GL_EXT_point_parameters");
}
}
else {
logger.info("...GL_EXT_point_parameters not found");
log.info("...GL_EXT_point_parameters not found");
}
// #ifdef __linux__
@@ -1244,26 +1243,26 @@ public abstract class Main extends Base {
&& gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0
&& gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) {
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
}
else {
logger.info("...ignoring GL_EXT_shared_texture_palette");
log.info("...ignoring GL_EXT_shared_texture_palette");
qglColorTableEXT = false;
}
}
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) {
logger.info("...using GL_ARB_multitexture");
log.info("...using GL_ARB_multitexture");
qglActiveTextureARB = true;
GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB;
GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB;
}
else {
logger.info("...GL_ARB_multitexture not found");
log.info("...GL_ARB_multitexture not found");
}
if (!(qglActiveTextureARB))

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -41,8 +42,6 @@ import lwjake2.sys.Sys;
import lwjake2.util.Lib;
import lwjake2.util.QuakeFile;
import lwjake2.util.Vargs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
@@ -50,8 +49,8 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Calendar;
@Slf4j
public class SV_CCMDS {
private static final Logger logger = LoggerFactory.getLogger(SV_CCMDS.class);
/*
===============================================================================
@@ -770,10 +769,10 @@ public class SV_CCMDS {
Com.Printf("No server running.\n");
return;
}
logger.info("map : {}", SV_INIT.sv.name);
log.info("map : {}", SV_INIT.sv.name);
logger.info("num score ping name lastmsg address qport ");
logger.info("--- ----- ---- --------------- ------- --------------------- ------");
log.info("num score ping name lastmsg address qport ");
log.info("--- ----- ---- --------------- ------- --------------------- ------");
for (i = 0; i < SV_MAIN.maxclients.value; i++) {
cl = SV_INIT.svs.clients[i];
if (0 == cl.state)
@@ -807,9 +806,9 @@ public class SV_CCMDS {
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;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.CL;
@@ -38,15 +39,12 @@ import lwjake2.qcommon.SZ;
import lwjake2.sys.NET;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.RandomAccessFile;
@Slf4j
public class SV_INIT {
private static final Logger logger = LoggerFactory.getLogger(SV_INIT.class);
/**
* SV_FindIndex.
*/
@@ -188,7 +186,7 @@ public class SV_INIT {
if (attractloop)
Cvar.Set("paused", "0");
logger.info("------- Server Initialization -------");
log.info("------- Server Initialization -------");
Com.DPrintf("SpawnServer: " + server + "\n");
if (sv.demofile != null)
@@ -323,7 +321,7 @@ public class SV_INIT {
if (Cvar.VariableValue("coop") != 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
| Defines.CVAR_LATCH);
}

View File

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

View File

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

View File

@@ -18,18 +18,16 @@
package lwjake2.sound;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import lwjake2.qcommon.FS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* SND_MEM
*/
@Slf4j
public class WaveLoader {
private static final Logger logger = LoggerFactory.getLogger(WaveLoader.class);
/**
* 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
@@ -230,7 +228,7 @@ public class WaveLoader {
return;
}
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;
last_chunk = data_p + 8 + ((iff_chunk_len + 1) & ~1);

View File

@@ -18,6 +18,7 @@
package lwjake2.sound.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -49,17 +50,14 @@ import org.lwjgl.openal.AL10;
import org.lwjgl.openal.ALC10;
import org.lwjgl.openal.EFX10;
import org.lwjgl.openal.OpenALException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* LWJGLSoundImpl
*
* @author dsanders/cwei
*/
@Slf4j
public final class LWJGLSoundImpl implements Sound {
private final Logger logger = LoggerFactory.getLogger(LWJGLSoundImpl.class);
static {
S.register(new LWJGLSoundImpl());
};
@@ -88,7 +86,7 @@ public final class LWJGLSoundImpl implements Sound {
checkError();
initOpenALExtensions();
} catch (OpenALException e) {
logger.error(e.getMessage());
log.error(e.getMessage());
return false;
} catch (Exception e) {
Com.DPrintf(e.getMessage() + '\n');
@@ -99,7 +97,7 @@ public final class LWJGLSoundImpl implements Sound {
s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);
AL10.alGenBuffers(buffers);
int count = Channel.init(buffers);
logger.info("... using {} channels", count);
log.info("... using {} channels", count);
AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED);
Cmd.AddCommand("play", new xcommand_t() {
public void execute() {
@@ -124,10 +122,10 @@ public final class LWJGLSoundImpl implements Sound {
num_sfx = 0;
logger.info("sound sampling rate: 44100Hz");
log.info("sound sampling rate: 44100Hz");
StopAllSounds();
logger.info("------------------------------------");
log.info("------------------------------------");
return true;
}
@@ -144,7 +142,7 @@ public final class LWJGLSoundImpl implements Sound {
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.
if (ALC10.alcGetError(AL.getDevice()) != ALC10.ALC_NO_ERROR)
@@ -156,7 +154,7 @@ public final class LWJGLSoundImpl implements Sound {
/** Initializes OpenAL EFX effects. */
private void initOpenALExtensions()
{
logger.info("... using EFX effects:");
log.info("... using EFX effects:");
underwaterFilter = new EFXFilterLowPass();
underwaterFilter.setGain(1.0f);
underwaterFilter.setGainHF(0.0f);
@@ -589,26 +587,26 @@ public final class LWJGLSoundImpl implements Sound {
if (sc != null) {
size = sc.length * sc.width * (sc.stereo + 1);
total += size;
logger.info(String.format("%s(%2db) %6d : %s",
log.info(String.format("%s(%2db) %6d : %s",
(sc.loopstart >= 0 ? 'L' : ' '),
(sc.width * 8), size, sfx.name)
);
} else {
if (sfx.name.charAt(0) == '*')
logger.info(" placeholder : {}", sfx.name);
log.info(" placeholder : {}", sfx.name);
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() {
//TODO параметры тут не нужны, сплошная статика
logger.info(String.format("%5d stereo", 1));
logger.info(String.format("%5d samples", 22050));
logger.info(String.format("%5d samplebits", 16));
logger.info(String.format("%5d speed", 44100));
log.info(String.format("%5d stereo", 1));
log.info(String.format("%5d samples", 22050));
log.info(String.format("%5d samplebits", 16));
log.info(String.format("%5d speed", 44100));
}
}

View File

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

View File

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

View File

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

View File

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

View File

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