0

remove Com.Printf(...), etc.

This commit is contained in:
2019-06-05 23:17:41 +03:00
parent 744d5cd37e
commit a0b04e49f1
51 changed files with 533 additions and 528 deletions

View File

@@ -19,7 +19,7 @@
package lwjake2;
import lombok.NonNull;
import lwjake2.qcommon.Com;
import lombok.extern.slf4j.Slf4j;
import lwjake2.qcommon.Cvar;
import lwjake2.qcommon.Qcommon;
import lwjake2.sys.Timer;
@@ -27,6 +27,7 @@ import lwjake2.sys.Timer;
/**
* Jake2 is the main class of Quake2 for Java.
*/
@Slf4j
public final class LWJake2 {
/**
@@ -55,7 +56,7 @@ public final class LWJake2 {
if (args[n].equals("1") || args[n].equals("\"1\""))
{
Com.Printf("Starting in dedicated mode.\n");
log.warn("Starting in dedicated mode.");
dedicated = true;
}
}

View File

@@ -845,10 +845,8 @@ public final class CL {
//
// packet from server
//
if (!NET.CompareAdr(Globals.net_from,
Globals.cls.netchan.remote_address)) {
Com.DPrintf(NET.AdrToString(Globals.net_from)
+ ":sequenced packet without connection\n");
if (!NET.CompareAdr(Globals.net_from, Globals.cls.netchan.remote_address)) {
log.debug("{}:sequenced packet without connection", NET.AdrToString(Globals.net_from));
continue;
}
if (!Netchan.Process(Globals.cls.netchan, Globals.net_message))

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -40,6 +41,7 @@ import lwjake2.util.Math3D;
*
* =========================================================================
*/
@Slf4j
public class CL_ents {
private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -271,8 +273,9 @@ public class CL_ents {
while (oldnum < newnum) { // one or more entities from the old
// packet are unchanged
if (Globals.cl_shownet.value == 3)
Com.Printf(" unchanged: " + oldnum + "\n");
if (Globals.cl_shownet.value == 3) {
log.warn(" unchanged: {}", oldnum);
}
DeltaEntity(newframe, oldnum, oldstate, 0);
oldindex++;
@@ -288,10 +291,12 @@ public class CL_ents {
if ((bits & Defines.U_REMOVE) != 0) { // the entity present in
// oldframe is not in the
// current frame
if (Globals.cl_shownet.value == 3)
Com.Printf(" remove: " + newnum + "\n");
if (oldnum != newnum)
Com.Printf("U_REMOVE: oldnum != newnum\n");
if (Globals.cl_shownet.value == 3) {
log.warn(" remove: {}", newnum);
}
if (oldnum != newnum) {
log.warn("U_REMOVE: oldnum != newnum");
}
oldindex++;
@@ -306,7 +311,7 @@ public class CL_ents {
if (oldnum == newnum) { // delta from previous state
if (Globals.cl_shownet.value == 3)
Com.Printf(" delta: " + newnum + "\n");
log.warn(" delta: {}", newnum);
DeltaEntity(newframe, newnum, oldstate, bits);
oldindex++;
@@ -321,8 +326,9 @@ public class CL_ents {
}
if (oldnum > newnum) { // delta from baseline
if (Globals.cl_shownet.value == 3)
Com.Printf(" baseline: " + newnum + "\n");
if (Globals.cl_shownet.value == 3) {
log.warn(" baseline: {}", newnum);
}
DeltaEntity(newframe, newnum, Globals.cl_entities[newnum].baseline, bits);
continue;
}
@@ -330,10 +336,11 @@ public class CL_ents {
}
// any remaining entities in the old frame are copied over
while (oldnum != 99999) { // one or more entities from the old packet
while (oldnum != 99999/*FIXME magic number*/) { // one or more entities from the old packet
// are unchanged
if (Globals.cl_shownet.value == 3)
Com.Printf(" unchanged: " + oldnum + "\n");
if (Globals.cl_shownet.value == 3) {
log.warn(" unchanged: {}", oldnum);
}
DeltaEntity(newframe, oldnum, oldstate, 0);
oldindex++;
@@ -501,8 +508,9 @@ public class CL_ents {
if (Globals.cls.serverProtocol != 26)
Globals.cl.surpressCount = MSG.ReadByte(Globals.net_message);
if (Globals.cl_shownet.value == 3)
Com.Printf(" frame:" + Globals.cl.frame.serverframe + " delta:" + Globals.cl.frame.deltaframe + "\n");
if (Globals.cl_shownet.value == 3) {
log.warn(" frame:{} delta:{}", Globals.cl.frame.serverframe, Globals.cl.frame.deltaframe);
}
// If the frame is delta compressed from data that we
// no longer have available, we must suck up the rest of
@@ -515,7 +523,7 @@ public class CL_ents {
} else {
old = Globals.cl.frames[Globals.cl.frame.deltaframe & Defines.UPDATE_MASK];
if (!old.valid) { // should never happen
Com.Printf("Delta from invalid frame (not supposed to happen!).\n");
log.warn("Delta from invalid frame (not supposed to happen!).\n");
}
if (old.serverframe != Globals.cl.frame.deltaframe) { // The frame
// that the
@@ -523,9 +531,9 @@ public class CL_ents {
// the delta
// from
// is too old, so we can't reconstruct it properly.
Com.Printf("Delta frame too old.\n");
log.warn("Delta frame too old.");
} else if (Globals.cl.parse_entities - old.parse_entities > Defines.MAX_PARSE_ENTITIES - 128) {
Com.Printf("Delta parse_entities too old.\n");
log.warn("Delta parse_entities too old.");
} else
Globals.cl.frame.valid = true; // valid delta parse
}
@@ -1165,13 +1173,15 @@ public class CL_ents {
return;
if (Globals.cl.time > Globals.cl.frame.servertime) {
if (Globals.cl_showclamp.value != 0)
Com.Printf("high clamp " + (Globals.cl.time - Globals.cl.frame.servertime) + "\n");
if (Globals.cl_showclamp.value != 0) {
log.warn("high clamp {}", Globals.cl.time - Globals.cl.frame.servertime);
}
Globals.cl.time = Globals.cl.frame.servertime;
Globals.cl.lerpfrac = 1.0f;
} else if (Globals.cl.time < Globals.cl.frame.servertime - 100) {
if (Globals.cl_showclamp.value != 0)
Com.Printf("low clamp " + (Globals.cl.frame.servertime - 100 - Globals.cl.time) + "\n");
if (Globals.cl_showclamp.value != 0) {
log.warn("low clamp {}", Globals.cl.frame.servertime - 100 - Globals.cl.time);
}
Globals.cl.time = Globals.cl.frame.servertime - 100;
Globals.cl.lerpfrac = 0;
} else

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -36,6 +37,7 @@ import lwjake2.util.Math3D;
/**
* CL_input
*/
@Slf4j
public class CL_input {
static long frame_msec;
@@ -120,7 +122,7 @@ public class CL_input {
else if (b.down[1] == 0)
b.down[1] = k;
else {
Com.Printf("Three keys down for a button!\n");
log.warn("Three keys down for a button!");
return;
}

View File

@@ -77,7 +77,7 @@ public class CL_parse {
String name;
if (filename.indexOf("..") != -1) {
Com.Printf("Refusing to download a path with ..\n");
log.warn("Refusing to download a path with ..");
return true;
}
@@ -117,12 +117,11 @@ public class CL_parse {
Globals.cls.download = fp;
// give the server an offset to start the download
Com.Printf("Resuming " + Globals.cls.downloadname + "\n");
log.warn("Resuming {}", Globals.cls.downloadname);
MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
MSG.WriteString(Globals.cls.netchan.message, "download "
+ Globals.cls.downloadname + " " + len);
MSG.WriteString(Globals.cls.netchan.message, "download " + Globals.cls.downloadname + " " + len);
} else {
Com.Printf("Downloading " + Globals.cls.downloadname + "\n");
log.warn("Downloading {}", Globals.cls.downloadname);
MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
MSG.WriteString(Globals.cls.netchan.message, "download "
+ Globals.cls.downloadname);
@@ -142,25 +141,25 @@ public class CL_parse {
String filename;
if (Cmd.Argc() != 2) {
Com.Printf("Usage: download <filename>\n");
log.warn("Usage: download <filename>");
return;
}
filename = Cmd.Argv(1);
if (filename.indexOf("..") != -1) {
Com.Printf("Refusing to download a path with ..\n");
log.warn("Refusing to download a path with ..");
return;
}
if (UnpackLoader.loadFile(filename) != null) { // it exists, no need to
// download
Com.Printf("File already exists.\n");
log.warn("File already exists.");
return;
}
Globals.cls.downloadname = filename;
Com.Printf("Downloading " + Globals.cls.downloadname + "\n");
log.warn("Downloading {}", Globals.cls.downloadname);
// download to a temp name, and only rename
// to the real name when done, so if interrupted
@@ -209,7 +208,7 @@ public class CL_parse {
int size = MSG.ReadShort(Globals.net_message);
int percent = MSG.ReadByte(Globals.net_message);
if (size == -1) {
Com.Printf("Server does not have this file.\n");
log.warn("Server does not have this file.");
if (Globals.cls.download != null) {
// if here, we tried to resume a file but the server said no
try {
@@ -231,8 +230,7 @@ public class CL_parse {
Globals.cls.download = Lib.fopen(name, "rw");
if (Globals.cls.download == null) {
Globals.net_message.readcount += size;
Com.Printf("Failed to open " + Globals.cls.downloadtempname
+ "\n");
log.warn("Failed to open {}", Globals.cls.downloadtempname);
CL.RequestNextDownload();
return;
}
@@ -269,8 +267,9 @@ public class CL_parse {
oldn = DownloadFileName(Globals.cls.downloadtempname);
newn = DownloadFileName(Globals.cls.downloadname);
int r = Lib.rename(oldn, newn);
if (r != 0)
Com.Printf("failed to rename.\n");
if (r != 0) {
log.warn("failed to rename.");
}
Globals.cls.download = null;
Globals.cls.downloadpercent = 0;
@@ -298,7 +297,7 @@ public class CL_parse {
String str;
int i;
Com.DPrintf("ParseServerData():Serverdata packet received.\n");
log.debug("ParseServerData():Serverdata packet received.");
//
// wipe the client_state_t struct
//
@@ -321,7 +320,7 @@ public class CL_parse {
// game directory
str = MSG.ReadString(Globals.net_message);
Globals.cl.gamedir = str;
Com.dprintln("gamedir=" + str);
log.debug("gamedir={}", str);
// set gamedir
cvar_t gamedirVar = Cvar.Get("game", "", CVAR_LATCH | CVAR_SERVERINFO);
@@ -334,10 +333,10 @@ public class CL_parse {
// parse player entity number
Globals.cl.playernum = MSG.ReadShort(Globals.net_message);
Com.dprintln("numplayers=" + Globals.cl.playernum);
log.debug("numplayers={}", Globals.cl.playernum);
// get the full level name
str = MSG.ReadString(Globals.net_message);
Com.dprintln("levelname=" + str);
log.debug("levelname={}", str);
if (Globals.cl.playernum == -1) { // playing a cinematic or showing a
// pic, not a level
@@ -347,7 +346,7 @@ public class CL_parse {
// Com.Printf(
// "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
// Com.Printf('\02' + str + "\n");
Com.Printf("Levelname:" + str + "\n");
log.warn("Levelname:{}", str);
// need to prep refresh at next oportunity
Globals.cl.refresh_prepped = false;
}
@@ -639,8 +638,9 @@ public class CL_parse {
}
public static void SHOWNET(String s) {
if (Globals.cl_shownet.value >= 2)
Com.Printf(Globals.net_message.readcount - 1 + ":" + s + "\n");
if (Globals.cl_shownet.value >= 2) {
log.warn("{}:{}", Globals.net_message.readcount - 1, s);
}
}
/*
@@ -677,11 +677,11 @@ public class CL_parse {
}
if (Globals.cl_shownet.value >= 2) {
if (null == svc_strings[cmd])
Com.Printf(Globals.net_message.readcount - 1 + ":BAD CMD "
+ cmd + "\n");
else
if (null == svc_strings[cmd]) {
log.warn("{}:BAD CMD {}", Globals.net_message.readcount, cmd);
} else {
SHOWNET(svc_strings[cmd]);
}
}
// other commands
@@ -700,7 +700,7 @@ public class CL_parse {
break;
case Defines.svc_reconnect:
Com.Printf("Server disconnected, reconnecting\n");
log.warn("Server disconnected, reconnecting");
if (Globals.cls.download != null) {
//ZOID, close download
try {
@@ -738,7 +738,7 @@ public class CL_parse {
case Defines.svc_stufftext:
s = MSG.ReadString(Globals.net_message);
Com.DPrintf("stufftext: " + s + "\n");
log.debug("stufftext: {}", s);
Cbuf.AddText(s);
break;

View File

@@ -18,6 +18,7 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.cmodel_t;
@@ -27,13 +28,13 @@ import lwjake2.game.pmove_t;
import lwjake2.game.trace_t;
import lwjake2.game.usercmd_t;
import lwjake2.qcommon.CM;
import lwjake2.qcommon.Com;
import lwjake2.qcommon.PMove;
import lwjake2.util.Math3D;
/**
* CL_pred
*/
@Slf4j
public class CL_pred {
/*
@@ -63,10 +64,9 @@ public class CL_pred {
{ // a teleport or something
Math3D.VectorClear(Globals.cl.prediction_error);
} else {
if (Globals.cl_showmiss.value != 0.0f
&& (delta[0] != 0 || delta[1] != 0 || delta[2] != 0))
Com.Printf("prediction miss on " + Globals.cl.frame.serverframe
+ ": " + (delta[0] + delta[1] + delta[2]) + "\n");
if (Globals.cl_showmiss.value != 0.0f && (delta[0] != 0 || delta[1] != 0 || delta[2] != 0)) {
log.warn("prediction miss on {}: {}", Globals.cl.frame.serverframe, delta[0] + delta[1] + delta[2]);
}
Math3D.VectorCopy(Globals.cl.frame.playerstate.pmove.origin,
Globals.cl.predicted_origins[frame]);
@@ -229,8 +229,9 @@ public class CL_pred {
// if we are too far out of date, just freeze
if (current - ack >= Defines.CMD_BACKUP) {
if (Globals.cl_showmiss.value != 0.0f)
Com.Printf("exceeded CMD_BACKUP\n");
if (Globals.cl_showmiss.value != 0.0f) {
log.warn("exceeded CMD_BACKUP");
}
return;
}

View File

@@ -29,11 +29,14 @@ import lwjake2.sound.S;
import lwjake2.sound.sfx_t;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* CL_tent
*/
public class CL_tent {
private static final Logger log = LoggerFactory.getLogger(CL_tent.class);
static class explosion_t {
int type;
@@ -421,7 +424,7 @@ public class CL_tent {
return ent;
}
}
Com.Printf("beam list overflow!\n");
log.warn("beam list overflow!");
return ent;
}
@@ -470,7 +473,7 @@ public class CL_tent {
return ent;
}
}
Com.Printf("beam list overflow!\n");
log.warn("beam list overflow!");
return ent;
}
@@ -532,7 +535,7 @@ public class CL_tent {
return ent;
}
}
Com.Printf("beam list overflow!\n");
log.warn("beam list overflow!");
return ent;
}
@@ -586,7 +589,7 @@ public class CL_tent {
return srcEnt;
}
}
Com.Printf("beam list overflow!\n");
log.warn("beam list overflow!");
return srcEnt;
}

View File

@@ -18,14 +18,15 @@
package lwjake2.client;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.qcommon.CM;
import lwjake2.qcommon.Com;
import lwjake2.sys.Sys;
import java.util.StringTokenizer;
@Slf4j
public class CL_view {
static int num_cl_weaponmodels;
@@ -59,16 +60,14 @@ public class CL_view {
// cut off ".bsp"
// register models, pics, and skins
Com.Printf("Map: " + mapname + "\r");
log.warn("Map: {}", mapname);
SCR.UpdateScreen();
Globals.re.BeginRegistration(mapname);
Com.Printf(" \r");
// precache status bar pics
Com.Printf("pics\r");
log.warn("pics");
SCR.UpdateScreen();
SCR.TouchPics();
Com.Printf(" \r");
CL_tent.RegisterTEntModels();
@@ -81,8 +80,9 @@ public class CL_view {
if (name.length() > 37)
name = name.substring(0, 36);
if (name.charAt(0) != '*')
Com.Printf(name + "\r");
if (name.charAt(0) != '*') {
log.warn(name);
}
SCR.UpdateScreen();
Sys.SendKeyEvents(); // pump message loop
@@ -104,11 +104,9 @@ public class CL_view {
else
Globals.cl.model_clip[i] = null;
}
if (name.charAt(0) != '*')
Com.Printf(" \r");
}
Com.Printf("images\r");
log.warn("images");
SCR.UpdateScreen();
for (i = 1; i < Defines.MAX_IMAGES
&& Globals.cl.configstrings[Defines.CS_IMAGES + i].length() > 0; i++) {
@@ -117,22 +115,20 @@ public class CL_view {
Sys.SendKeyEvents(); // pump message loop
}
Com.Printf(" \r");
for (i = 0; i < Defines.MAX_CLIENTS; i++) {
if (Globals.cl.configstrings[Defines.CS_PLAYERSKINS + i].length() == 0)
continue;
Com.Printf("client " + i + '\r');
log.warn("client {}", i);
SCR.UpdateScreen();
Sys.SendKeyEvents(); // pump message loop
CL_parse.ParseClientinfo(i);
Com.Printf(" \r");
}
CL_parse.LoadClientinfo(Globals.cl.baseclientinfo,
"unnamed\\male/grunt");
// set sky textures and speed
Com.Printf("sky\r");
log.warn("sky");
SCR.UpdateScreen();
rotate = Float
.parseFloat(Globals.cl.configstrings[Defines.CS_SKYROTATE]);
@@ -143,7 +139,6 @@ public class CL_view {
axis[2] = Float.parseFloat(st.nextToken());
Globals.re.SetSky(Globals.cl.configstrings[Defines.CS_SKY], rotate,
axis);
Com.Printf(" \r");
// the renderer can now free unneeded stuff
Globals.re.EndRegistration();

View File

@@ -306,8 +306,9 @@ public class Key {
&& !(Globals.cls.state == Defines.ca_disconnected))
return; // ignore most autorepeats
if (key >= 200 && Globals.keybindings[key] == null)
Com.Printf(Key.KeynumToString(key) + " is unbound, hit F4 to set.\n");
if (key >= 200 && Globals.keybindings[key] == null) {
log.warn("{} is unbound, hit F4 to set.", Key.KeynumToString(key));
}
}
else {
key_repeats[key] = 0;
@@ -721,20 +722,21 @@ public class Key {
int c = Cmd.Argc();
if (c < 2) {
Com.Printf("bind <key> [command] : attach a command to a key\n");
log.warn("bind <key> [command] : attach a command to a key");
return;
}
int b = StringToKeynum(Cmd.Argv(1));
if (b == -1) {
Com.Printf("\"" + Cmd.Argv(1) + "\" isn't a valid key\n");
log.warn("\"{}\" isn't a valid key", Cmd.Argv(1));
return;
}
if (c == 2) {
if (Globals.keybindings[b] != null)
Com.Printf("\"" + Cmd.Argv(1) + "\" = \"" + Globals.keybindings[b] + "\"\n");
else
Com.Printf("\"" + Cmd.Argv(1) + "\" is not bound\n");
if (Globals.keybindings[b] != null) {
log.warn("\"{}\" = \"{}\"", Cmd.Argv(1), Globals.keybindings[b]);
} else {
log.warn("\"{}\" is not bound", Cmd.Argv(1));
}
return;
}
@@ -764,13 +766,13 @@ public class Key {
static void Key_Unbind_f() {
if (Cmd.Argc() != 2) {
Com.Printf("unbind <key> : remove commands from a key\n");
log.warn("unbind <key> : remove commands from a key");
return;
}
int b = Key.StringToKeynum(Cmd.Argv(1));
if (b == -1) {
Com.Printf("\"" + Cmd.Argv(1) + "\" isn't a valid key\n");
log.warn("\"{}\" isn't a valid key", Cmd.Argv(1));
return;
}
@@ -788,8 +790,9 @@ public class Key {
static void Key_Bindlist_f() {
for (int i = 0; i < 256; i++)
if (Globals.keybindings[i] != null && Globals.keybindings[i].length() != 0)
Com.Printf(Key.KeynumToString(i) + " \"" + Globals.keybindings[i] + "\"\n");
if (Globals.keybindings[i] != null && Globals.keybindings[i].length() != 0) {
log.warn("{} \"{}\"", Key.KeynumToString(i), Globals.keybindings[i]);
}
}
static void ClearStates() {

View File

@@ -242,9 +242,9 @@ public final class SCR {
s++;
}
//TODO what the hell this?!
// echo it to the console
Com
.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
//Com.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
s = 0;
@@ -264,7 +264,7 @@ public final class SCR {
line.append('\n');
Com.Printf(line.toString());
log.warn(line.toString());
while (s < str.length() && str.charAt(s) != '\n')
s++;
@@ -274,8 +274,8 @@ public final class SCR {
s++; // skip the \n
} while (true);
}
Com
.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
//TODO what the hell this?!
//Com.Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
Console.ClearNotify();
}
@@ -393,7 +393,7 @@ public final class SCR {
float[] axis = { 0, 0, 0 };
if (Cmd.Argc() < 2) {
Com.Printf("Usage: sky <basename> <rotate> <axis x y z>\n");
log.warn("Usage: sky <basename> <rotate> <axis x y z>");
return;
}
if (Cmd.Argc() > 2)
@@ -1158,7 +1158,7 @@ public final class SCR {
if (cls.disable_screen != 0) {
if (Timer.Milliseconds() - cls.disable_screen > 120000) {
cls.disable_screen = 0;
Com.Printf("Loading plaque timed out.\n");
log.warn("Loading plaque timed out.");
}
return;
}
@@ -1656,7 +1656,7 @@ public final class SCR {
}
if (input != size && input != size + 1) {
Com.Printf("Decompression overread by " + (input - size));
log.warn("Decompression overread by {}", input - size);
}
return out;

View File

@@ -239,14 +239,14 @@ public final class V {
static Runnable Gun_Next_f = () -> {
gun_frame++;
Com.Printf("frame " + gun_frame + "\n");
log.warn("frame {}", gun_frame);
};
static Runnable Gun_Prev_f = () -> {
gun_frame--;
if (gun_frame < 0)
gun_frame = 0;
Com.Printf("frame " + gun_frame + "\n");
log.warn("frame {}", gun_frame);
};
static Runnable Gun_Model_f = () -> {

View File

@@ -636,7 +636,7 @@ public final class Cmd {
s = Cmd.Args();
it = GameItems.FindItem(s);
Com.dprintln("using:" + s);
log.debug("using:{}", s);
if (it == null) {
SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\n");
return;

View File

@@ -171,7 +171,7 @@ public class GameBase {
for (; from.i < num_edicts; from.i++) {
from.o = g_edicts[from.i];
if (from.o.classname == null) {
Com.Printf("edict with classname = null" + from.o.index);
log.warn("edict with classname = null{}", from.o.index);
}
if (!from.o.inuse)

View File

@@ -18,11 +18,12 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.qcommon.Com;
import lwjake2.util.Math3D;
@Slf4j
public class GameCombat {
/**
@@ -92,9 +93,8 @@ public class GameCombat {
/**
* Killed.
*/
public static void Killed(edict_t targ, edict_t inflictor,
edict_t attacker, int damage, float[] point) {
Com.DPrintf("Killing a " + targ.classname + "\n");
public static void Killed(edict_t targ, edict_t inflictor, edict_t attacker, int damage, float[] point) {
log.debug("Killing a {}", targ.classname);
if (targ.health < -999)
targ.health = -999;

View File

@@ -243,9 +243,9 @@ public class GameItems {
if (!taken)
return;
Com.dprintln("Picked up:" + ent.classname);
log.debug("Picked up:{}", ent.classname);
if (!((GameBase.coop.value != 0) && (ent.item.flags & Defines.IT_STAY_COOP) != 0)
|| 0 != (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM))) {
if ((ent.flags & Defines.FL_RESPAWN) != 0)

View File

@@ -18,8 +18,8 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import java.io.IOException;
@@ -27,6 +27,7 @@ import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.util.StringTokenizer;
@Slf4j
public class GameSVCmds {
/**
@@ -261,7 +262,7 @@ public class GameSVCmds {
}
} catch (IOException e) {
Com.Printf("IOError in SVCmd_WriteIP_f:" + e);
log.error("IOError in SVCmd_WriteIP_f: {}", e.getMessage());
}
Lib.fclose(f);

View File

@@ -120,13 +120,10 @@ public class GameSave {
// preload all classes to register the adapters
for ( int n=0; n < preloadclasslist.length; n++)
{
try
{
try {
Class.forName(preloadclasslist[n]);
}
catch(Exception e)
{
Com.DPrintf("error loading class: " + e.getMessage());
} catch (ClassNotFoundException e) {
log.error("error loading class: " + e.getMessage());
}
}

View File

@@ -464,10 +464,8 @@ public class GameSpawn {
* entity definitions out of an ent file.
*/
public static void SpawnEntities(String mapname, String entities,
String spawnpoint) {
Com.dprintln("SpawnEntities(), mapname=" + mapname);
public static void SpawnEntities(String mapname, String entities, String spawnpoint) {
log.debug("SpawnEntities(), mapname={}", mapname);
edict_t ent;
int inhibit;
String com_token;
@@ -517,9 +515,12 @@ public class GameSpawn {
ent = GameUtil.G_Spawn();
ED_ParseEdict(ph, ent);
Com.DPrintf("spawning ent[" + ent.index + "], classname=" +
ent.classname + ", flags= " + Integer.toHexString(ent.spawnflags));
log.debug("spawning ent[{}], classname={}, flags= {}",
ent.index,
ent.classname,
Integer.toHexString(ent.spawnflags)
);
// yet another map hack
if (0 == Lib.Q_stricmp(GameBase.level.mapname, "command")
&& 0 == Lib.Q_stricmp(ent.classname, "trigger_once")
@@ -531,8 +532,7 @@ public class GameSpawn {
if (ent != GameBase.g_edicts[0]) {
if (GameBase.deathmatch.value != 0) {
if ((ent.spawnflags & Defines.SPAWNFLAG_NOT_DEATHMATCH) != 0) {
Com.DPrintf("->inhibited.\n");
log.debug("->inhibited.");
GameUtil.G_FreeEdict(ent);
inhibit++;
continue;
@@ -545,8 +545,7 @@ public class GameSpawn {
((GameBase.skill.value == 0) && (ent.spawnflags & Defines.SPAWNFLAG_NOT_EASY) != 0)
|| ((GameBase.skill.value == 1) && (ent.spawnflags & Defines.SPAWNFLAG_NOT_MEDIUM) != 0)
|| (((GameBase.skill.value == 2) || (GameBase.skill.value == 3)) && (ent.spawnflags & Defines.SPAWNFLAG_NOT_HARD) != 0)) {
Com.DPrintf("->inhibited.\n");
log.debug("->inhibited.");
GameUtil.G_FreeEdict(ent);
inhibit++;
@@ -560,10 +559,9 @@ public class GameSpawn {
| Defines.SPAWNFLAG_NOT_COOP | Defines.SPAWNFLAG_NOT_DEATHMATCH);
}
ED_CallSpawn(ent);
Com.DPrintf("\n");
}
Com.DPrintf("player skill level:" + GameBase.skill.value + "\n");
Com.DPrintf(inhibit + " entities inhibited.\n");
log.debug("player skill level:{}", GameBase.skill.value);
log.debug("{} entities inhibited.", inhibit);
i = 1;
G_FindTeams();
PlayerTrail.Init();

View File

@@ -18,19 +18,20 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.M;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
@Slf4j
public class GameUtil {
public static void checkClassname(edict_t ent) {
if (ent.classname == null) {
Com.Printf("edict with classname = null: " + ent.index);
log.warn("edict with classname = null: {}", ent.index);
}
}

View File

@@ -18,11 +18,12 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import java.util.StringTokenizer;
@Slf4j
public class Info {
/**
@@ -36,7 +37,7 @@ public class Info {
String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n");
log.warn("MISSING VALUE");
return s;
}
String value1 = tk.nextToken();
@@ -57,23 +58,23 @@ public class Info {
return s;
if (key.indexOf('\\') != -1 || value.indexOf('\\') != -1) {
Com.Printf("Can't use keys or values with a \\\n");
log.warn("Can't use keys or values with a \\");
return s;
}
if (key.indexOf(';') != -1) {
Com.Printf("Can't use keys or values with a semicolon\n");
log.warn("Can't use keys or values with a semicolon");
return s;
}
if (key.indexOf('"') != -1 || value.indexOf('"') != -1) {
Com.Printf("Can't use keys or values with a \"\n");
log.warn("Can't use keys or values with a \"");
return s;
}
if (key.length() > Defines.MAX_INFO_KEY - 1
|| value.length() > Defines.MAX_INFO_KEY - 1) {
Com.Printf("Keys and values must be < 64 characters.\n");
log.warn("Keys and values must be < 64 characters.");
return s;
}
@@ -81,7 +82,7 @@ public class Info {
if (sb.length() + 2 + key.length() + value.length() > Defines.MAX_INFO_STRING) {
Com.Printf("Info string length exceeded\n");
log.warn("Info string length exceeded");
return s;
}
@@ -98,7 +99,7 @@ public class Info {
StringBuffer sb = new StringBuffer(512);
if (key.indexOf('\\') != -1) {
Com.Printf("Can't use a key with a \\\n");
log.warn("Can't use a key with a \\");
return s;
}
@@ -108,7 +109,7 @@ public class Info {
String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n");
log.warn("MISSING VALUE");
return s;
}
String value1 = tk.nextToken();
@@ -141,7 +142,7 @@ public class Info {
String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n");
log.warn("MISSING VALUE");
return;
}
@@ -156,6 +157,6 @@ public class Info {
}
sb.append('=').append(value1).append('\n');
}
Com.Printf(sb.toString());
log.warn(sb.toString());
}
}

View File

@@ -18,12 +18,13 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.client.M;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
@Slf4j
public class Monster {
// FIXME monsters should call these with a totally accurate direction
@@ -204,7 +205,7 @@ public class Monster {
notcombat = false;
fixup = false;
/*
* if (true) { Com.Printf("all entities:\n");
* if (true) { log.warn("all entities:");
*
* for (int n = 0; n < Game.globals.num_edicts; n++) { edict_t ent =
* GameBase.g_edicts[n]; Com.Printf( "|%4i | %25s
@@ -345,7 +346,7 @@ public class Monster {
public String getID() { return "monster_triggered_start";}
public boolean think(edict_t self) {
if (self.index == 312)
Com.Printf("monster_triggered_start\n");
log.warn("monster_triggered_start");
self.solid = Defines.SOLID_NOT;
self.movetype = Defines.MOVETYPE_NONE;
self.svflags |= Defines.SVF_NOCLIENT;

View File

@@ -18,10 +18,11 @@
package lwjake2.game;
import lwjake2.qcommon.Com;
import lombok.extern.slf4j.Slf4j;
import java.util.Hashtable;
@Slf4j
public abstract class SuperAdapter {
/** Constructor, does the adapter registration. */
@@ -43,7 +44,7 @@ public abstract class SuperAdapter {
// try to create the adapter
if (sa == null) {
Com.DPrintf("SuperAdapter.getFromID():adapter not found->" + key + "\n");
log.debug("SuperAdapter.getFromID():adapter not found->{}", key);
}
return sa;

View File

@@ -346,7 +346,7 @@ public class edict_t {
if (key.equals("team")) {
team = GameSpawn.ED_NewString(value);
Com.dprintln("Monster Team:" + team);
log.debug("Monster Team:{}", team);
return true;
} // F_LSTRING),

View File

@@ -18,13 +18,14 @@
package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.qcommon.Com;
import lwjake2.util.QuakeFile;
import java.io.IOException;
import java.util.Date;
@Slf4j
public class game_locals_t {
//
// this structure is left intact through an entire game
@@ -77,8 +78,9 @@ public class game_locals_t {
autosaved = f.readInt() != 0;
// rst's checker :-)
if (f.readInt() != 1928)
Com.DPrintf("error in loading game_locals, 1928\n");
if (f.readInt() != 1928/*FIXME magic number*/) {
log.debug("error in loading game_locals, 1928");
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.game.monsters;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.game.EntDieAdapter;
import lwjake2.game.EntDodgeAdapter;
@@ -33,10 +34,10 @@ import lwjake2.game.edict_t;
import lwjake2.game.mframe_t;
import lwjake2.game.mmove_t;
import lwjake2.game.monsters.M_Flash;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
@Slf4j
public class M_Soldier {
// This file generated by ModelGen - Do NOT Modify
@@ -680,11 +681,8 @@ public class M_Soldier {
public static EntThinkAdapter SP_monster_soldier = new EntThinkAdapter() {
public String getID(){ return "SP_monster_soldier"; }
public boolean think(edict_t self) {
Com.DPrintf("Spawning a soldier at " + self.s.origin[0] + " " +
self.s.origin[1] + " " +
self.s.origin[2] + " " +
"\n");
log.debug("Spawning a soldier at {} {} {}", self.s.origin[0], self.s.origin[1], self.s.origin[2]);
if (GameBase.deathmatch.value != 0) {
GameUtil.G_FreeEdict(self);
return true;

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -29,7 +30,6 @@ import lwjake2.game.mapsurface_t;
import lwjake2.game.trace_t;
import lwjake2.util.Lib;
import lwjake2.util.Math3D;
import lwjake2.util.Vargs;
import lwjake2.util.Vec3Cache;
import java.io.RandomAccessFile;
@@ -38,6 +38,7 @@ import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.Arrays;
@Slf4j
public class CM {
private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -209,9 +210,8 @@ public class CM {
/**
* Loads in the map and all submodels.
*/
public static cmodel_t CM_LoadMap(String name, boolean clientload,
int checksum[]) {
Com.DPrintf("CM_LoadMap(" + name + ")...\n");
public static cmodel_t CM_LoadMap(String name, boolean clientload, int checksum[]) {
log.debug("CM_LoadMap({})...", name);
byte buf[];
qfiles.dheader_t header;
int length;
@@ -300,7 +300,7 @@ public class CM {
/** Loads Submodels. */
public static void CMod_LoadSubmodels(lump_t l) {
Com.DPrintf("CMod_LoadSubmodels()\n");
log.debug("CMod_LoadSubmodels()");
qfiles.dmodel_t in;
cmodel_t out;
int i, j, count;
@@ -315,11 +315,11 @@ public class CM {
if (count > Defines.MAX_MAP_MODELS)
Com.Error(ErrorCode.ERR_DROP, "Map has too many models");
Com.DPrintf(" numcmodels=" + count + "\n");
log.debug(" numcmodels={}", count);
numcmodels = count;
if (debugloadmap) {
Com.DPrintf("submodles(headnode, <origin>, <mins>, <maxs>)\n");
log.debug("submodles(headnode, <origin>, <mins>, <maxs>)");
}
for (i = 0; i < count; i++) {
in = new qfiles.dmodel_t(ByteBuffer.wrap(cmod_base, i
@@ -333,15 +333,13 @@ public class CM {
}
out.headnode = in.headnode;
if (debugloadmap) {
Com
.DPrintf(
"|%6i|%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|\n",
new Vargs().add(out.headnode)
.add(out.origin[0]).add(out.origin[1])
.add(out.origin[2]).add(out.mins[0])
.add(out.mins[1]).add(out.mins[2]).add(
out.maxs[0]).add(out.maxs[1])
.add(out.maxs[2]));
// "|%6i|%8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f| %8.2f|%8.2f|%8.2f|"
log.debug("|{}|{}|{}|{}| {}|{}|{}| {}|{}|{}|",
out.headnode,
out.origin[0], out.origin[1], out.origin[2],
out.mins[0], out.mins[1], out.mins[2],
out.maxs[0], out.maxs[1], out.maxs[2]
);
}
}
}
@@ -350,7 +348,7 @@ public class CM {
/** Loads surfaces. */
public static void CMod_LoadSurfaces(lump_t l) {
Com.DPrintf("CMod_LoadSurfaces()\n");
log.debug("CMod_LoadSurfaces()");
texinfo_t in;
mapsurface_t out;
int i, count;
@@ -365,9 +363,9 @@ public class CM {
Com.Error(ErrorCode.ERR_DROP, "Map has too many surfaces");
numtexinfo = count;
Com.DPrintf(" numtexinfo=" + count + "\n");
log.debug(" numtexinfo={}", count);
if (debugloadmap)
Com.DPrintf("surfaces:\n");
log.debug("surfaces:");
for (i = 0; i < count; i++) {
out = map_surfaces[i] = new mapsurface_t();
@@ -380,9 +378,13 @@ public class CM {
out.c.value = in.value;
if (debugloadmap) {
Com.DPrintf("|%20s|%20s|%6i|%6i|\n", new Vargs()
.add(out.c.name).add(out.rname).add(out.c.value).add(
out.c.flags));
// "|%20s|%20s|%6i|%6i|"
log.debug("|{}|{}|{}|{}|",
out.c.name,
out.rname,
out.c.value,
out.c.flags
);
}
}
@@ -390,7 +392,7 @@ public class CM {
/** Loads nodes. */
public static void CMod_LoadNodes(lump_t l) {
Com.DPrintf("CMod_LoadNodes()\n");
log.debug("CMod_LoadNodes()");
qfiles.dnode_t in;
int child;
cnode_t out;
@@ -407,10 +409,10 @@ public class CM {
Com.Error(ErrorCode.ERR_DROP, "Map has too many nodes");
numnodes = count;
Com.DPrintf(" numnodes=" + count + "\n");
log.debug(" numnodes={}", count);
if (debugloadmap) {
Com.DPrintf("nodes(planenum, child[0], child[1])\n");
log.debug("nodes(planenum, child[0], child[1])");
}
for (i = 0; i < count; i++) {
@@ -424,15 +426,19 @@ public class CM {
out.children[j] = child;
}
if (debugloadmap) {
Com.DPrintf("|%6i| %6i| %6i|\n", new Vargs().add(in.planenum)
.add(out.children[0]).add(out.children[1]));
// "|%6i| %6i| %6i|"
log.debug("|{}| {}| {}|",
in.planenum,
out.children[0],
out.children[1]
);
}
}
}
/** Loads brushes. */
public static void CMod_LoadBrushes(lump_t l) {
Com.DPrintf("CMod_LoadBrushes()\n");
log.debug("CMod_LoadBrushes()");
qfiles.dbrush_t in;
cbrush_t out;
int i, count;
@@ -446,9 +452,9 @@ public class CM {
Com.Error(ErrorCode.ERR_DROP, "Map has too many brushes");
numbrushes = count;
Com.DPrintf(" numbrushes=" + count + "\n");
log.debug(" numbrushes={}", count);
if (debugloadmap) {
Com.DPrintf("brushes:(firstbrushside, numsides, contents)\n");
log.debug("brushes:(firstbrushside, numsides, contents)");
}
for (i = 0; i < count; i++) {
in = new qfiles.dbrush_t(ByteBuffer.wrap(cmod_base, i
@@ -459,17 +465,19 @@ public class CM {
out.contents = in.contents;
if (debugloadmap) {
Com
.DPrintf("| %6i| %6i| %8X|\n", new Vargs().add(
out.firstbrushside).add(out.numsides).add(
out.contents));
// "| %6i| %6i| %8X|"
log.debug("| {}| {}| {}|",
out.firstbrushside,
out.numsides,
out.contents
);
}
}
}
/** Loads leafs. */
public static void CMod_LoadLeafs(lump_t l) {
Com.DPrintf("CMod_LoadLeafs()\n");
log.debug("CMod_LoadLeafs()");
int i;
cleaf_t out;
qfiles.dleaf_t in;
@@ -487,12 +495,13 @@ public class CM {
if (count > Defines.MAX_MAP_PLANES)
Com.Error(ErrorCode.ERR_DROP, "Map has too many planes");
Com.DPrintf(" numleafes=" + count + "\n");
log.debug(" numleafes={}", count);
numleafs = count;
numclusters = 0;
if (debugloadmap)
Com.DPrintf("cleaf-list:(contents, cluster, area, firstleafbrush, numleafbrushes)\n");
if (debugloadmap) {
log.debug("cleaf-list:(contents, cluster, area, firstleafbrush, numleafbrushes)");
}
for (i = 0; i < count; i++) {
in = new qfiles.dleaf_t(cmod_base, i * qfiles.dleaf_t.SIZE
+ l.fileofs, qfiles.dleaf_t.SIZE);
@@ -509,14 +518,19 @@ public class CM {
numclusters = out.cluster + 1;
if (debugloadmap) {
Com.DPrintf("|%8x|%6i|%6i|%6i|\n", new Vargs()
.add(out.contents).add(out.cluster).add(out.area).add(
out.firstleafbrush).add(out.numleafbrushes));
// "|%8x|%6i|%6i|%6i|?|"
log.debug("|{}|{}|{}|{}|{}|",
out.contents,
out.cluster,
out.area,
out.firstleafbrush,
out.numleafbrushes
);
}
}
Com.DPrintf(" numclusters=" + numclusters + "\n");
log.debug(" numclusters={}", numclusters);
if (map_leafs[0].contents != Defines.CONTENTS_SOLID)
Com.Error(ErrorCode.ERR_DROP, "Map leaf 0 is not CONTENTS_SOLID");
@@ -537,7 +551,7 @@ public class CM {
/** Loads planes. */
public static void CMod_LoadPlanes(lump_t l) {
Com.DPrintf("CMod_LoadPlanes()\n");
log.debug("CMod_LoadPlanes()");
int i, j;
cplane_t out;
qfiles.dplane_t in;
@@ -556,12 +570,11 @@ public class CM {
if (count > Defines.MAX_MAP_PLANES)
Com.Error(ErrorCode.ERR_DROP, "Map has too many planes");
Com.DPrintf(" numplanes=" + count + "\n");
log.debug(" numplanes={}", count);
numplanes = count;
if (debugloadmap) {
Com
.DPrintf("cplanes(normal[0],normal[1],normal[2], dist, type, signbits)\n");
log.debug("cplanes(normal[0],normal[1],normal[2], dist, type, signbits)");
}
for (i = 0; i < count; i++) {
@@ -583,17 +596,20 @@ public class CM {
out.signbits = (byte) bits;
if (debugloadmap) {
Com.DPrintf("|%6.2f|%6.2f|%6.2f| %10.2f|%3i| %1i|\n",
new Vargs().add(out.normal[0]).add(out.normal[1]).add(
out.normal[2]).add(out.dist).add(out.type).add(
out.signbits));
// "|%6.2f|%6.2f|%6.2f| %10.2f|%3i| %1i|"
log.debug("|{}|{}|{}| {}|{}| {}|",
out.normal[0], out.normal[1], out.normal[2],
out.dist,
out.type,
out.signbits
);
}
}
}
/** Loads leaf brushes. */
public static void CMod_LoadLeafBrushes(lump_t l) {
Com.DPrintf("CMod_LoadLeafBrushes()\n");
log.debug("CMod_LoadLeafBrushes()");
int i;
int out[];
int count;
@@ -603,7 +619,7 @@ public class CM {
count = l.filelen / 2;
Com.DPrintf(" numbrushes=" + count + "\n");
log.debug(" numbrushes={}", count);
if (count < 1)
Com.Error(ErrorCode.ERR_DROP, "Map with no planes");
@@ -619,20 +635,21 @@ public class CM {
ByteOrder.LITTLE_ENDIAN);
if (debugloadmap) {
Com.DPrintf("map_brushes:\n");
log.debug("map_brushes:");
}
for (i = 0; i < count; i++) {
out[i] = bb.getShort();
if (debugloadmap) {
Com.DPrintf("|%6i|%6i|\n", new Vargs().add(i).add(out[i]));
// "|%6i|%6i|"
log.debug("|{}|{}|", i, out[i]);
}
}
}
/** Loads brush sides. */
public static void CMod_LoadBrushSides(lump_t l) {
Com.DPrintf("CMod_LoadBrushSides()\n");
log.debug("CMod_LoadBrushSides()");
int i, j;
cbrushside_t out;
qfiles.dbrushside_t in;
@@ -649,10 +666,10 @@ public class CM {
numbrushsides = count;
Com.DPrintf(" numbrushsides=" + count + "\n");
log.debug(" numbrushsides={}", count);
if (debugloadmap) {
Com.DPrintf("brushside(planenum, surfacenum):\n");
log.debug("brushside(planenum, surfacenum):");
}
for (i = 0; i < count; i++) {
@@ -678,14 +695,15 @@ public class CM {
out.surface = map_surfaces[j];
if (debugloadmap) {
Com.DPrintf("| %6i| %6i|\n", new Vargs().add(num).add(j));
// "| %6i| %6i|"
log.debug("| {}| {}|", num, j);
}
}
}
/** Loads areas. */
public static void CMod_LoadAreas(lump_t l) {
Com.DPrintf("CMod_LoadAreas()\n");
log.debug("CMod_LoadAreas()");
int i;
carea_t out;
qfiles.darea_t in;
@@ -699,11 +717,11 @@ public class CM {
if (count > Defines.MAX_MAP_AREAS)
Com.Error(ErrorCode.ERR_DROP, "Map has too many areas");
Com.DPrintf(" numareas=" + count + "\n");
log.debug(" numareas={}", count);
numareas = count;
if (debugloadmap) {
Com.DPrintf("areas(numportals, firstportal)\n");
log.debug("areas(numportals, firstportal)");
}
for (i = 0; i < count; i++) {
@@ -717,15 +735,15 @@ public class CM {
out.floodvalid = 0;
out.floodnum = 0;
if (debugloadmap) {
Com.DPrintf("| %6i| %6i|\n", new Vargs()
.add(out.numareaportals).add(out.firstareaportal));
// "| %6i| %6i|"
log.debug("| {}| {}|", out.numareaportals, out.firstareaportal);
}
}
}
/** Loads area portals. */
public static void CMod_LoadAreaPortals(lump_t l) {
Com.DPrintf("CMod_LoadAreaPortals()\n");
log.debug("CMod_LoadAreaPortals()");
int i;
qfiles.dareaportal_t out;
qfiles.dareaportal_t in;
@@ -739,9 +757,9 @@ public class CM {
Com.Error(ErrorCode.ERR_DROP, "Map has too many areas");
numareaportals = count;
Com.DPrintf(" numareaportals=" + count + "\n");
log.debug(" numareaportals={}", count);
if (debugloadmap) {
Com.DPrintf("areaportals(portalnum, otherarea)\n");
log.debug("areaportals(portalnum, otherarea)");
}
for (i = 0; i < count; i++) {
in = new qfiles.dareaportal_t(ByteBuffer.wrap(cmod_base, i
@@ -754,19 +772,19 @@ public class CM {
out.otherarea = in.otherarea;
if (debugloadmap) {
Com.DPrintf("|%6i|%6i|\n", new Vargs().add(out.portalnum).add(
out.otherarea));
// "|%6i|%6i|"
log.debug("|{}|{}|", out.portalnum, out.otherarea);
}
}
}
/** Loads visibility data. */
public static void CMod_LoadVisibility(lump_t l) {
Com.DPrintf("CMod_LoadVisibility()\n");
log.debug("CMod_LoadVisibility()");
numvisibility = l.filelen;
Com.DPrintf(" numvisibility=" + numvisibility + "\n");
log.debug(" numvisibility={}", numvisibility);
if (l.filelen > Defines.MAX_MAP_VISIBILITY)
Com.Error(ErrorCode.ERR_DROP, "Map has too large visibility lump");
@@ -782,7 +800,7 @@ public class CM {
/** Loads entity strings. */
public static void CMod_LoadEntityString(lump_t l) {
Com.DPrintf("CMod_LoadEntityString()\n");
log.debug("CMod_LoadEntityString()");
numentitychars = l.filelen;
@@ -793,9 +811,10 @@ public class CM {
for (; x < l.filelen && cmod_base[x + l.fileofs] != 0; x++);
map_entitystring = new String(cmod_base, l.fileofs, x).trim();
Com.dprintln("entitystring=" + map_entitystring.length() +
" bytes, [" + map_entitystring.substring(0, Math.min (
map_entitystring.length(), 15)) + "...]" );
log.debug("entitystring={} bytes, [{}...]",
map_entitystring.length(),
map_entitystring.substring(0, Math.min (map_entitystring.length(), 15))
);
}
/** Returns the model with a given id "*" + <number> */
@@ -992,7 +1011,7 @@ public class CM {
while (true) {
if (nodenum < 0) {
if (leaf_count >= leaf_maxcount) {
Com.DPrintf("CM_BoxLeafnums_r: overflow\n");
log.debug("CM_BoxLeafnums_r: overflow");
return;
}
leaf_list[leaf_count++] = -1 - nodenum;
@@ -1612,7 +1631,7 @@ public class CM {
inp += 2;
if (outp + c > row) {
c = row - (outp);
Com.DPrintf("warning: Vis decompression overrun\n");
log.debug("warning: Vis decompression overrun");
}
while (c != 0) {
out[outp++] = 0;
@@ -1674,7 +1693,7 @@ public class CM {
* ==================== FloodAreaConnections ====================
*/
public static void FloodAreaConnections() {
Com.DPrintf("FloodAreaConnections...\n");
log.debug("FloodAreaConnections...");
int i;
carea_t area;
@@ -1770,8 +1789,7 @@ public class CM {
else
os.writeInt(0);
} catch (Exception e) {
Com.Printf("ERROR:" + e);
e.printStackTrace();
log.error("", e);
}
}

View File

@@ -232,7 +232,7 @@ public final class Com {
} while (c > 32);
if (len == Defines.MAX_TOKEN_CHARS) {
Com.Printf("Token exceeded " + Defines.MAX_TOKEN_CHARS + " chars, discarded.\n");
log.warn("Token exceeded {} chars, discarded.", Defines.MAX_TOKEN_CHARS);
len = 0;
}
@@ -267,7 +267,7 @@ public final class Com {
}
else if (code == ErrorCode.ERR_DROP)
{
Com.Printf("********************\nERROR: " + msg + "\n********************\n");
log.error(msg);
SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false);
CL.Drop();
recursive= false;
@@ -304,47 +304,6 @@ public final class Com {
}
}
public static void DPrintf(String fmt)
{
_debugContext = debugContext;
DPrintf(fmt, null);
_debugContext = "";
}
public static void dprintln(String fmt)
{
DPrintf(_debugContext + fmt + "\n", null);
}
public static void Printf(String fmt)
{
Printf(_debugContext + fmt, null);
}
public static void DPrintf(String fmt, Vargs vargs)
{
if (Globals.developer == null || Globals.developer.value == 0)
return; // don't confuse non-developers with techie stuff...
_debugContext = debugContext;
Printf(fmt, vargs);
_debugContext="";
}
/** Prints out messages, which can also be redirected to a remote client. */
public static void Printf(String fmt, Vargs vargs)
{
String msg= sprintf(_debugContext + fmt, vargs);
// also echo to debugging console
while (msg.startsWith("\n")) { msg = msg.substring(1); }
while (msg.endsWith("\n")) { msg = msg.substring(0, msg.lastIndexOf("\n")); }
while (msg.endsWith("\r")) { msg = msg.substring(0, msg.lastIndexOf("\r")); }
msg = msg.trim();
if (!msg.isEmpty()) {
log.warn(msg);
}
}
public static String sprintf(String fmt, Vargs vargs)
{
String msg= "";

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.Cmd;
@@ -30,11 +31,12 @@ import java.io.RandomAccessFile;
import java.util.Vector;
import static lwjake2.Defines.*;
import static lwjake2.Globals.cvar_vars;
import static lwjake2.Globals.*;
/**
* Cvar implements console variables. The original code is located in cvar.c
*/
@Slf4j
public class Cvar {
private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -49,7 +51,7 @@ public class Cvar {
if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
if (!InfoValidate(var_name)) {
Com.Printf("invalid info cvar name\n");
log.warn("invalid info cvar name");
return null;
}
}
@@ -65,7 +67,7 @@ public class Cvar {
if ((flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
if (!InfoValidate(var_value)) {
Com.Printf("invalid info cvar value\n");
log.warn("invalid info cvar value");
return null;
}
}
@@ -166,14 +168,14 @@ public class Cvar {
if ((var.flags & (CVAR_USERINFO | CVAR_SERVERINFO)) != 0) {
if (!InfoValidate(value)) {
Com.Printf("invalid info cvar value\n");
log.warn("invalid info cvar value");
return var;
}
}
if (!force) {
if ((var.flags & CVAR_NOSET) != 0) {
Com.Printf(var_name + " is write protected.\n");
log.warn("{} is write protected.", var_name);
return var;
}
@@ -188,7 +190,7 @@ public class Cvar {
}
if (Globals.server_state != 0) {
Com.Printf(var_name + " will be changed for next game.\n");
log.warn("{} will be changed for next game.", var_name);
var.latched_string = value;
} else {
var.string = value;
@@ -238,7 +240,7 @@ public class Cvar {
c = Cmd.Argc();
if (c != 3 && c != 4) {
Com.Printf("usage: set <variable> <value> [u / s]\n");
log.warn("usage: set <variable> <value> [u / s]");
return;
}
@@ -248,7 +250,7 @@ public class Cvar {
else if (Cmd.Argv(3).equals("s"))
flags = CVAR_SERVERINFO;
else {
Com.Printf("flags can only be 'u' or 's'\n");
log.warn("flags can only be 'u' or 's'");
return;
}
Cvar.FullSet(Cmd.Argv(1), Cmd.Argv(2), flags);
@@ -266,27 +268,20 @@ public class Cvar {
i = 0;
for (var = cvar_vars; var != null; var = var.next, i++) {
if ((var.flags & CVAR_ARCHIVE) != 0)
Com.Printf("*");
else
Com.Printf(" ");
if ((var.flags & CVAR_USERINFO) != 0)
Com.Printf("U");
else
Com.Printf(" ");
if ((var.flags & CVAR_SERVERINFO) != 0)
Com.Printf("S");
else
Com.Printf(" ");
if ((var.flags & CVAR_NOSET) != 0)
Com.Printf("-");
else if ((var.flags & CVAR_LATCH) != 0)
Com.Printf("L");
else
Com.Printf(" ");
Com.Printf(" " + var.name + " \"" + var.string + "\"\n");
log.warn((var.flags & CVAR_ARCHIVE) != 0 ? "*" : " ");
log.warn((var.flags & CVAR_USERINFO) != 0 ? "U" : " ");
log.warn((var.flags & CVAR_SERVERINFO) != 0 ? "S" : " ");
if ((var.flags & CVAR_NOSET) != 0) {
log.warn("-");
} else if ((var.flags & CVAR_LATCH) != 0) {
log.warn("L");
} else {
log.warn(" ");
}
log.warn(" {} \"{}\"", var.name, var.string);
}
Com.Printf(i + " cvars\n");
log.warn("{} cvars", i);
};
@@ -337,7 +332,7 @@ public class Cvar {
// perform a variable print or set
if (Cmd.Argc() == 1) {
Com.Printf("\"" + v.name + "\" is \"" + v.string + "\"\n");
log.warn("\"{}\" is \"{}\"", v.name, v.string);
return true;
}

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.game.entity_state_t;
import lwjake2.game.usercmd_t;
import lwjake2.util.Lib;
@@ -28,6 +29,7 @@ import static lwjake2.ErrorCode.ERR_DROP;
import static lwjake2.ErrorCode.ERR_FATAL;
import static lwjake2.Globals.bytedirs;
@Slf4j
public class MSG {
//
@@ -441,7 +443,7 @@ public class MSG {
int c;
if (msg_read.readcount + 4 > msg_read.cursize) {
Com.Printf("buffer underrun in ReadLong!");
log.warn("buffer underrun in ReadLong!");
c = -1;
}
@@ -497,7 +499,7 @@ public class MSG {
} while (l < 2047);
String ret = new String(readbuf, 0, l).trim();
Com.dprintln("MSG.ReadStringLine:[" + ret.replace('\0', '@') + "]");
log.debug("MSG.ReadStringLine:[{}]", ret.replace('\0', '@'));
return ret;
}

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.cvar_t;
@@ -29,6 +30,7 @@ import lwjake2.util.Lib;
/**
* Netchan
*/
@Slf4j
public final class Netchan extends SV_MAIN {
/*
@@ -206,8 +208,7 @@ public final class Netchan extends SV_MAIN {
// check for message overflow
if (chan.message.overflowed) {
chan.fatal_error = true;
Com.Printf(NET.AdrToString(chan.remote_address)
+ ":Outgoing message overflow\n");
log.warn("{}:Outgoing message overflow", NET.AdrToString(chan.remote_address));
return;
}
@@ -248,27 +249,30 @@ public final class Netchan extends SV_MAIN {
if (send.maxsize - send.cursize >= length)
SZ.Write(send, data, length);
else
Com.Printf("Netchan_Transmit: dumped unreliable\n");
log.warn("Netchan_Transmit: dumped unreliable");
// send the datagram
NET.SendPacket(chan.sock, send.cursize, send.data, chan.remote_address);
if (showpackets.value != 0) {
if (send_reliable != 0)
Com.Printf(
if (send_reliable != 0) {
//"send %4i : s=%i reliable=%i ack=%i rack=%i\n"
"send " + send.cursize + " : s="
+ (chan.outgoing_sequence - 1) + " reliable="
+ chan.reliable_sequence + " ack="
+ chan.incoming_sequence + " rack="
+ chan.incoming_reliable_sequence + "\n");
else
Com.Printf(
log.warn("send {} : s={} reliable={} ack={} rack={}",
send.cursize,
chan.outgoing_sequence - 1,
chan.reliable_sequence,
chan.incoming_sequence,
chan.incoming_reliable_sequence
);
} else {
//"send %4i : s=%i ack=%i rack=%i\n"
"send " + send.cursize + " : s="
+ (chan.outgoing_sequence - 1) + " ack="
+ chan.incoming_sequence + " rack="
+ chan.incoming_reliable_sequence + "\n");
log.warn("send {} : s={} ack={} rack={}",
send.cursize,
chan.outgoing_sequence - 1,
chan.incoming_sequence,
chan.incoming_reliable_sequence
);
}
}
}
@@ -299,30 +303,37 @@ public final class Netchan extends SV_MAIN {
sequence_ack &= ~(1 << 31);
if (showpackets.value != 0) {
if (reliable_message != 0)
Com.Printf(
if (reliable_message != 0) {
//"recv %4i : s=%i reliable=%i ack=%i rack=%i\n"
"recv " + msg.cursize + " : s=" + sequence
+ " reliable="
+ (chan.incoming_reliable_sequence ^ 1)
+ " ack=" + sequence_ack + " rack="
+ reliable_ack + "\n");
else
Com
.Printf(
//"recv %4i : s=%i ack=%i rack=%i\n"
"recv " + msg.cursize + " : s=" + sequence + " ack="
+ sequence_ack + " rack=" + reliable_ack + "\n");
log.warn("recv {} : s={} reliable={} ack={} rack={}",
msg.cursize,
sequence,
chan.incoming_reliable_sequence ^ 1,
sequence_ack,
reliable_ack
);
} else {
//"recv %4i : s=%i ack=%i rack=%i\n"
log.warn("recv {} : s={} ack={} rack={}",
msg.cursize,
sequence,
sequence_ack,
reliable_ack
);
}
}
//
// discard stale or duplicated packets
//
if (sequence <= chan.incoming_sequence) {
if (showdrop.value != 0)
Com.Printf(NET.AdrToString(chan.remote_address)
+ ":Out of order packet " + sequence + " at "
+ chan.incoming_sequence + "\n");
if (showdrop.value != 0) {
log.warn("{}:Out of order packet {} at {}",
NET.AdrToString(chan.remote_address),
sequence,
chan.incoming_sequence
);
}
return false;
}
@@ -331,9 +342,13 @@ public final class Netchan extends SV_MAIN {
//
chan.dropped = sequence - (chan.incoming_sequence + 1);
if (chan.dropped > 0) {
if (showdrop.value != 0)
Com.Printf(NET.AdrToString(chan.remote_address) + ":Dropped "
+ chan.dropped + " packets at " + sequence + "\n");
if (showdrop.value != 0) {
log.warn("{}:Dropped {} packets at {}",
NET.AdrToString(chan.remote_address),
chan.dropped,
sequence
);
}
}
//

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.game.csurface_t;
@@ -26,6 +27,7 @@ import lwjake2.game.trace_t;
import lwjake2.server.SV;
import lwjake2.util.Math3D;
@Slf4j
public class PMove {
// all of the locals will be zeroed before each
@@ -957,7 +959,7 @@ public class PMove {
}
}
Com.DPrintf("Bad InitialSnapPosition\n");
log.debug("Bad InitialSnapPosition");
}
/**

View File

@@ -236,7 +236,7 @@ public final class Qcommon {
}
} catch (IllegalStateException e) {
Com.DPrintf("lonjmp exception:" + e);
log.debug("lonjmp exception:{}", e.getMessage());
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.util.Lib;
@@ -25,6 +26,7 @@ import lwjake2.util.Lib;
/**
* SZ
*/
@Slf4j
public final class SZ {
public static void Clear(sizebuf_t buf) {
@@ -55,7 +57,7 @@ public final class SZ {
if (length > buf.maxsize)
Com.Error(ErrorCode.ERR_FATAL, "SZ_GetSpace: " + length + " is > full buffer size");
Com.Printf("SZ_GetSpace: overflow\n");
log.warn("SZ_GetSpace: overflow");
Clear(buf);
buf.overflowed = true;
}
@@ -83,7 +85,7 @@ public final class SZ {
//
public static void Print(sizebuf_t buf, String data) {
Com.dprintln("SZ.print():<" + data + ">" );
log.debug("SZ.print():<{}>", data );
int length = data.length();
byte str[] = Lib.stringToBytes(data);

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -33,6 +34,7 @@ import lwjake2.util.Math3D;
/**
* SV
*/
@Slf4j
public final class SV {
///////////////////////////////////////
@@ -1002,7 +1004,7 @@ public final class SV {
//FIXME: how did we get here with no enemy
if (enemy == null) {
Com.DPrintf("SV_NewChaseDir without enemy!\n");
log.debug("SV_NewChaseDir without enemy!");
return;
}
olddir = Math3D.anglemod((int) (actor.ideal_yaw / 45) * 45);

View File

@@ -73,7 +73,7 @@ public class SV_CCMDS {
// only dedicated servers send heartbeats
if (Globals.dedicated.value == 0) {
Com.Printf("Only dedicated servers use masters.\n");
log.warn("Only dedicated servers use masters.");
return;
}
@@ -89,14 +89,14 @@ public class SV_CCMDS {
break;
if (!NET.StringToAdr(Cmd.Argv(i), SV_MAIN.master_adr[i])) {
Com.Printf("Bad address: " + Cmd.Argv(i) + "\n");
log.warn("Bad address: {}", Cmd.Argv(i));
continue;
}
if (SV_MAIN.master_adr[slot].port == 0)
SV_MAIN.master_adr[slot].port = Defines.PORT_MASTER;
Com.Printf("Master server at " + NET.AdrToString(SV_MAIN.master_adr[slot]) + "\n");
Com.Printf("Sending a ping.\n");
log.warn("Master server at {}", NET.AdrToString(SV_MAIN.master_adr[slot]));
log.warn("Sending a ping.");
Netchan.OutOfBandPrint(Defines.NS_SERVER, SV_MAIN.master_adr[slot], "ping");
@@ -127,14 +127,14 @@ public class SV_CCMDS {
if (s.charAt(0) >= '0' && s.charAt(0) <= '9') {
idnum = Lib.atoi(Cmd.Argv(1));
if (idnum < 0 || idnum >= SV_MAIN.maxclients.value) {
Com.Printf("Bad client slot: " + idnum + "\n");
log.warn("Bad client slot: {}", idnum);
return false;
}
SV_MAIN.sv_client = SV_INIT.svs.clients[idnum];
SV_USER.sv_player = SV_MAIN.sv_client.edict;
if (0 == SV_MAIN.sv_client.state) {
Com.Printf("Client " + idnum + " is not active\n");
log.warn("Client {} is not active", idnum);
return false;
}
return true;
@@ -152,7 +152,7 @@ public class SV_CCMDS {
}
}
Com.Printf("Userid " + s + " is not on the server\n");
log.warn("Userid {} is not on the server", s);
return false;
}
/*
@@ -176,7 +176,7 @@ public class SV_CCMDS {
String name;
Com.DPrintf("SV_WipeSaveGame(" + savename + ")\n");
log.debug("SV_WipeSaveGame({})", savename);
name = Globals.BASEDIRNAME + "/save/" + savename + "/server.ssv";
remove(name);
@@ -278,7 +278,7 @@ public class SV_CCMDS {
String name, name2;
Com.DPrintf("SV_CopySaveGame(" + src + "," + dst + ")\n");
log.debug("SV_CopySaveGame({},{})", src, dst);
SV_WipeSavegame(dst);
@@ -324,7 +324,7 @@ public class SV_CCMDS {
String name;
QuakeFile f;
Com.DPrintf("SV_WriteLevelFile()\n");
log.debug("SV_WriteLevelFile()");
name = Globals.BASEDIRNAME + "/save/current/" + SV_INIT.sv.name + ".sv2";
@@ -338,8 +338,7 @@ public class SV_CCMDS {
f.close();
}
catch (Exception e) {
Com.Printf("Failed to open " + name + "\n");
e.printStackTrace();
log.error("Failed to open {}", name, e);
}
name = Globals.BASEDIRNAME + "/save/current/" + SV_INIT.sv.name + ".sav";
@@ -356,7 +355,7 @@ public class SV_CCMDS {
String name;
QuakeFile f;
Com.DPrintf("SV_ReadLevelFile()\n");
log.debug("SV_ReadLevelFile()");
name = Globals.BASEDIRNAME + "/save/current/" + SV_INIT.sv.name + ".sv2";
try {
@@ -370,8 +369,7 @@ public class SV_CCMDS {
f.close();
}
catch (IOException e1) {
Com.Printf("Failed to open " + name + "\n");
e1.printStackTrace();
log.error("Failed to open {}", name, e1);
}
name = Globals.BASEDIRNAME + "/save/current/" + SV_INIT.sv.name + ".sav";
@@ -389,7 +387,7 @@ public class SV_CCMDS {
String filename, name, string, comment;
Com.DPrintf("SV_WriteServerFile(" + (autosave ? "true" : "false") + ")\n");
log.debug("SV_WriteServerFile({})", autosave ? "true" : "false");
filename = Globals.BASEDIRNAME + "/save/current/server.ssv";
try {
@@ -421,7 +419,7 @@ public class SV_CCMDS {
if (0 == (var.flags & Defines.CVAR_LATCH))
continue;
if (var.name.length() >= Defines.MAX_OSPATH - 1 || var.string.length() >= 128 - 1) {
Com.Printf("Cvar too long: " + var.name + " = " + var.string + "\n");
log.warn("Cvar too long: {} = {}", var.name, var.string);
continue;
}
@@ -440,7 +438,7 @@ public class SV_CCMDS {
f.close();
}
catch (Exception e) {
Com.Printf("Couldn't write " + filename + "\n");
log.warn("Couldn't write {}", filename);
}
// write game state
@@ -460,7 +458,7 @@ public class SV_CCMDS {
mapcmd = "";
Com.DPrintf("SV_ReadServerFile()\n");
log.debug("SV_ReadServerFile()");
filename = Globals.BASEDIRNAME + "/save/current/server.ssv";
@@ -477,7 +475,7 @@ public class SV_CCMDS {
break;
string = f.readString();
Com.DPrintf("Set " + name + " = " + string + "\n");
log.debug("Set {} = {}", name, string);
Cvar.ForceSet(name, string);
}
@@ -493,8 +491,7 @@ public class SV_CCMDS {
GameSave.ReadGame(filename);
}
catch (Exception e) {
Com.Printf("Couldn't read file " + filename + "\n");
e.printStackTrace();
log.warn("Couldn't read file {}", filename, e);
}
}
//=========================================================
@@ -534,11 +531,11 @@ public class SV_CCMDS {
boolean savedInuse[];
if (Cmd.Argc() != 2) {
Com.Printf("USAGE: gamemap <map>\n");
log.warn("USAGE: gamemap <map>");
return;
}
Com.DPrintf("SV_GameMap(" + Cmd.Argv(1) + ")\n");
log.debug("SV_GameMap({})", Cmd.Argv(1));
// fileSystem.createPath(Globals.BASEDIRNAME + "/save/current/");
@@ -603,7 +600,7 @@ public class SV_CCMDS {
expanded = "maps/" + map + ".bsp";
if (UnpackLoader.loadFile(expanded) == null) {
Com.Printf("Can't find " + expanded + "\n");
log.warn("Can't find {}", expanded);
return;
}
}
@@ -634,15 +631,15 @@ public class SV_CCMDS {
String dir;
if (Cmd.Argc() != 2) {
Com.Printf("USAGE: loadgame <directory>\n");
log.warn("USAGE: loadgame <directory>");
return;
}
Com.Printf("Loading game...\n");
log.warn("Loading game...");
dir = Cmd.Argv(1);
if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) {
Com.Printf("Bad savedir.\n");
log.warn("Bad savedir.");
}
// make sure the server.ssv file exists
@@ -651,7 +648,7 @@ public class SV_CCMDS {
f = new RandomAccessFile(name, "r");
}
catch (FileNotFoundException e) {
Com.Printf("No such savegame: " + name + "\n");
log.error("No such savegame: {}", name);
return;
}
@@ -679,36 +676,36 @@ public class SV_CCMDS {
String dir;
if (SV_INIT.sv.state != Defines.ss_game) {
Com.Printf("You must be in a game to save.\n");
log.warn("You must be in a game to save.");
return;
}
if (Cmd.Argc() != 2) {
Com.Printf("USAGE: savegame <directory>\n");
log.warn("USAGE: savegame <directory>");
return;
}
if (Cvar.VariableValue("deathmatch") != 0) {
Com.Printf("Can't savegame in a deathmatch\n");
log.warn("Can't savegame in a deathmatch");
return;
}
if (0 == Lib.strcmp(Cmd.Argv(1), "current")) {
Com.Printf("Can't save to 'current'\n");
log.warn("Can't save to 'current'");
return;
}
if (SV_MAIN.maxclients.value == 1 && SV_INIT.svs.clients[0].edict.client.ps.stats[Defines.STAT_HEALTH] <= 0) {
Com.Printf("\nCan't savegame while dead!\n");
log.warn("\nCan't savegame while dead!");
return;
}
dir = Cmd.Argv(1);
if ( (dir.indexOf("..") > -1) || (dir.indexOf("/") > -1) || (dir.indexOf("\\") > -1)) {
Com.Printf("Bad savedir.\n");
log.warn("Bad savedir.");
}
Com.Printf("Saving game...\n");
log.warn("Saving game...");
// archive current level, including all client edicts.
// when the level is reloaded, they will be shells awaiting
@@ -720,12 +717,12 @@ public class SV_CCMDS {
SV_WriteServerFile(false);
}
catch (Exception e) {
Com.Printf("IOError in SV_WriteServerFile: " + e);
log.error("IOError in SV_WriteServerFile: {}", e.getMessage(), e);
}
// copy it off
SV_CopySaveGame("current", dir);
Com.Printf("Done.\n");
log.warn("Done.");
}
//===============================================================
/*
@@ -737,12 +734,12 @@ public class SV_CCMDS {
*/
public static void SV_Kick_f() {
if (!SV_INIT.svs.initialized) {
Com.Printf("No server running.\n");
log.warn("No server running.");
return;
}
if (Cmd.Argc() != 2) {
Com.Printf("Usage: kick <userid>\n");
log.warn("Usage: kick <userid>");
return;
}
@@ -767,7 +764,7 @@ public class SV_CCMDS {
String s;
int ping;
if (SV_INIT.svs.clients == null) {
Com.Printf("No server running.\n");
log.warn("No server running.");
return;
}
log.info("map : {}", SV_INIT.sv.name);
@@ -857,7 +854,7 @@ public class SV_CCMDS {
===========
*/
public static void SV_Serverinfo_f() {
Com.Printf("Server info settings:\n");
log.warn("Server info settings:");
Info.Print(Cvar.Serverinfo());
}
/*
@@ -869,15 +866,15 @@ public class SV_CCMDS {
*/
public static void SV_DumpUser_f() {
if (Cmd.Argc() != 2) {
Com.Printf("Usage: info <userid>\n");
log.warn("Usage: info <userid>");
return;
}
if (!SV_SetPlayer())
return;
Com.Printf("userinfo\n");
Com.Printf("--------\n");
log.warn("userinfo");
log.warn("--------");
Info.Print(SV_MAIN.sv_client.userinfo);
}
@@ -898,17 +895,17 @@ public class SV_CCMDS {
int i;
if (Cmd.Argc() != 2) {
Com.Printf("serverrecord <demoname>\n");
log.warn("serverrecord <demoname>");
return;
}
if (SV_INIT.svs.demofile != null) {
Com.Printf("Already recording.\n");
log.warn("Already recording.");
return;
}
if (SV_INIT.sv.state != Defines.ss_game) {
Com.Printf("You must be in a level to record.\n");
log.warn("You must be in a level to record.");
return;
}
@@ -917,13 +914,13 @@ public class SV_CCMDS {
//
name = Globals.BASEDIRNAME + "/demos/" + Cmd.Argv(1) + ".dm2";
Com.Printf("recording to " + name + ".\n");
log.warn("recording to {}.", name);
fileSystem.createPath(name);
try {
SV_INIT.svs.demofile = new RandomAccessFile(name, "rw");
}
catch (Exception e) {
Com.Printf("ERROR: couldn't open.\n");
log.warn("ERROR: couldn't open.");
return;
}
@@ -958,7 +955,7 @@ public class SV_CCMDS {
}
// write it to the demo file
Com.DPrintf("signon message length: " + buf.cursize + "\n");
log.debug("signon message length: {}", buf.cursize);
len = EndianHandler.swapInt(buf.cursize);
//fwrite(len, 4, 1, svs.demofile);
//fwrite(buf.data, buf.cursize, 1, svs.demofile);
@@ -982,7 +979,7 @@ public class SV_CCMDS {
*/
public static void SV_ServerStop_f() {
if (SV_INIT.svs.demofile == null) {
Com.Printf("Not doing a serverrecord.\n");
log.warn("Not doing a serverrecord.");
return;
}
try {
@@ -992,7 +989,7 @@ public class SV_CCMDS {
e.printStackTrace();
}
SV_INIT.svs.demofile = null;
Com.Printf("Recording completed.\n");
log.warn("Recording completed.");
}
/*
===============

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.game.EndianHandler;
@@ -34,6 +35,7 @@ import lwjake2.util.Math3D;
import java.io.IOException;
@Slf4j
public class SV_ENTS {
/**
@@ -517,7 +519,7 @@ public class SV_ENTS {
% SV_INIT.svs.num_client_entities;
state = SV_INIT.svs.client_entities[ix];
if (ent.s.number != e) {
Com.DPrintf("FIXING ENT.S.NUMBER!!!\n");
log.debug("FIXING ENT.S.NUMBER!!!");
ent.s.number = e;
}
@@ -589,7 +591,7 @@ public class SV_ENTS {
//fwrite (buf.data, buf.cursize, 1, svs.demofile);
SV_INIT.svs.demofile.write(buf.data, 0, buf.cursize);
} catch (IOException e1) {
Com.Printf("Error writing demo file:" + e);
log.error("Error writing demo file:{}", e, e1);
}
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -32,6 +33,7 @@ import lwjake2.qcommon.MSG;
import lwjake2.qcommon.SZ;
import lwjake2.util.Math3D;
@Slf4j
public class SV_GAME {
/**
@@ -68,7 +70,7 @@ public class SV_GAME {
* Debug print to server console.
*/
public static void PF_dprintf(String fmt) {
Com.Printf(fmt);
log.debug(fmt);
}
@@ -96,8 +98,9 @@ public class SV_GAME {
if (ent != null)
SV_SEND.SV_ClientPrintf(SV_INIT.svs.clients[n - 1], level, fmt);
else
Com.Printf(fmt);
else {
log.warn(fmt);
}
}
/**

View File

@@ -189,7 +189,7 @@ public class SV_INIT {
log.info("------- Server Initialization -------");
Com.DPrintf("SpawnServer: " + server + "\n");
log.debug("SpawnServer: {}", server);
if (sv.demofile != null)
try {
sv.demofile.close();

View File

@@ -174,8 +174,7 @@ public class SV_MAIN {
* SVC_Ack
*/
public static void SVC_Ack() {
Com.Printf("Ping acknowledge from " + NET.AdrToString(Globals.net_from)
+ "\n");
log.warn("Ping acknowledge from {}", NET.AdrToString(Globals.net_from));
}
/**
@@ -267,13 +266,13 @@ public class SV_MAIN {
adr = Globals.net_from;
Com.DPrintf("SVC_DirectConnect ()\n");
log.debug("SVC_DirectConnect ()");
version = Lib.atoi(Cmd.Argv(1));
if (version != Defines.PROTOCOL_VERSION) {
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr,
"print\nServer is version " + Globals.VERSION + "\n");
Com.DPrintf(" rejected connect from version " + version + "\n");
log.debug(" rejected connect from version {}", version);
return;
}
@@ -287,7 +286,7 @@ public class SV_MAIN {
// attractloop servers are ONLY for local clients
if (SV_INIT.sv.attractloop) {
if (!NET.IsLocalAddress(adr)) {
Com.Printf("Remote connect in attract loop. Ignored.\n");
log.warn("Remote connect in attract loop. Ignored.");
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr,
"print\nConnection refused.\n");
return;
@@ -323,11 +322,10 @@ public class SV_MAIN {
&& (cl.netchan.qport == qport || adr.port == cl.netchan.remote_address.port)) {
if (!NET.IsLocalAddress(adr)
&& (SV_INIT.svs.realtime - cl.lastconnect) < ((int) SV_MAIN.sv_reconnect_limit.value * 1000)) {
Com.DPrintf(NET.AdrToString(adr)
+ ":reconnect rejected : too soon\n");
log.debug("{}:reconnect rejected : too soon", NET.AdrToString(adr));
return;
}
Com.Printf(NET.AdrToString(adr) + ":reconnect\n");
log.warn("{}:reconnect", NET.AdrToString(adr));
gotnewcl(i, challenge, userinfo, adr, qport);
return;
@@ -345,9 +343,8 @@ public class SV_MAIN {
}
}
if (index == -1) {
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr,
"print\nServer is full.\n");
Com.DPrintf("Rejected a connection.\n");
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr, "print\nServer is full.\n");
log.debug("Rejected a connection.");
return;
}
gotnewcl(index, challenge, userinfo, adr, qport);
@@ -377,14 +374,15 @@ public class SV_MAIN {
// get the game a chance to reject this connection or modify the
// userinfo
if (!(PlayerClient.ClientConnect(ent, userinfo))) {
if (Info.Info_ValueForKey(userinfo, "rejmsg") != null)
if (Info.Info_ValueForKey(userinfo, "rejmsg") != null) {
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr, "print\n"
+ Info.Info_ValueForKey(userinfo, "rejmsg")
+ "\nConnection refused.\n");
else
} else {
Netchan.OutOfBandPrint(Defines.NS_SERVER, adr,
"print\nConnection refused.\n");
Com.DPrintf("Game rejected a connection.\n");
}
log.debug("Game rejected a connection.");
return;
}
@@ -406,7 +404,7 @@ public class SV_MAIN {
SV_INIT.svs.clients[i].datagram.allowoverflow = true;
SV_INIT.svs.clients[i].lastmessage = SV_INIT.svs.realtime; // don't timeout
SV_INIT.svs.clients[i].lastconnect = SV_INIT.svs.realtime;
Com.DPrintf("new client added.\n");
log.debug("new client added.");
}
@@ -435,12 +433,11 @@ public class SV_MAIN {
String msg = Lib.CtoJava(Globals.net_message.data, 4, 1024);
if (i == 0)
Com.Printf("Bad rcon from " + NET.AdrToString(Globals.net_from)
+ ":\n" + msg + "\n");
else
Com.Printf("Rcon from " + NET.AdrToString(Globals.net_from) + ":\n"
+ msg + "\n");
if (i == 0) {
log.warn("Bad rcon from {}: {}", NET.AdrToString(Globals.net_from), msg);
} else {
log.debug("Rcon from {}: {}", NET.AdrToString(Globals.net_from), msg);
}
Com.BeginRedirect(Defines.RD_PACKET, SV_SEND.sv_outputbuf,
Defines.SV_OUTPUTBUF_LENGTH, new Com.RD_Flusher() {
@@ -450,7 +447,7 @@ public class SV_MAIN {
});
if (0 == Rcon_Validate()) {
Com.Printf("Bad rcon_password.\n");
log.warn("Bad rcon_password.");
} else {
remaining = "";
@@ -502,10 +499,9 @@ public class SV_MAIN {
else if (0 == Lib.strcmp(c, "rcon"))
SVC_RemoteCommand();
else {
Com.Printf("bad connectionless packet from "
+ NET.AdrToString(Globals.net_from) + "\n");
Com.Printf("[" + s + "]\n");
Com.Printf("" + Lib.hexDump(Globals.net_message.data, 128, false));
log.warn("bad connectionless packet from {}", NET.AdrToString(Globals.net_from));
log.warn("[{}]", s);
log.warn("{}", Lib.hexDump(Globals.net_message.data, 128, false));
}
}
@@ -598,7 +594,7 @@ public class SV_MAIN {
if (cl.netchan.qport != qport)
continue;
if (cl.netchan.remote_address.port != Globals.net_from.port) {
Com.Printf("SV_ReadPackets: fixing up a translated port\n");
log.warn("SV_ReadPackets: fixing up a translated port");
cl.netchan.remote_address.port = Globals.net_from.port;
}
@@ -694,7 +690,7 @@ public class SV_MAIN {
// never get more than one tic behind
if (SV_INIT.sv.time < SV_INIT.svs.realtime) {
if (SV_MAIN.sv_showclamp.value != 0)
Com.Printf("sv highclamp\n");
log.warn("sv highclamp");
SV_INIT.svs.realtime = SV_INIT.sv.time;
}
}
@@ -734,7 +730,7 @@ public class SV_MAIN {
// never let the time get too far off
if (SV_INIT.sv.time - SV_INIT.svs.realtime > 100) {
if (SV_MAIN.sv_showclamp.value != 0)
Com.Printf("sv lowclamp\n");
log.warn("sv lowclamp");
SV_INIT.svs.realtime = SV_INIT.sv.time - 100;
}
NET.Sleep(SV_INIT.sv.time - SV_INIT.svs.realtime);
@@ -791,8 +787,7 @@ public class SV_MAIN {
// send to group master
for (i = 0; i < Defines.MAX_MASTERS; i++)
if (SV_MAIN.master_adr[i].port != 0) {
Com.Printf("Sending heartbeat to "
+ NET.AdrToString(SV_MAIN.master_adr[i]) + "\n");
log.warn("Sending heartbeat to {}", NET.AdrToString(SV_MAIN.master_adr[i]));
Netchan.OutOfBandPrint(Defines.NS_SERVER,
SV_MAIN.master_adr[i], "heartbeat\n" + string);
}
@@ -816,11 +811,10 @@ public class SV_MAIN {
// send to group master
for (i = 0; i < Defines.MAX_MASTERS; i++)
if (SV_MAIN.master_adr[i].port != 0) {
if (i > 0)
Com.Printf("Sending heartbeat to "
+ NET.AdrToString(SV_MAIN.master_adr[i]) + "\n");
Netchan.OutOfBandPrint(Defines.NS_SERVER,
SV_MAIN.master_adr[i], "shutdown");
if (i > 0) {
log.warn("Sending heartbeat to {}", NET.AdrToString(SV_MAIN.master_adr[i]));
}
Netchan.OutOfBandPrint(Defines.NS_SERVER, SV_MAIN.master_adr[i], "shutdown");
}
}

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -34,6 +35,7 @@ import lwjake2.util.Math3D;
import java.io.IOException;
@Slf4j
public class SV_SEND {
/*
=============================================================================
@@ -93,8 +95,7 @@ public class SV_SEND {
// echo to console
if (Globals.dedicated.value != 0) {
Com.Printf(s);
log.warn(s);
}
for (int i = 0; i < SV_MAIN.maxclients.value; i++) {
@@ -379,14 +380,14 @@ public class SV_SEND {
// for this client out to the message
// it is necessary for this to be after the WriteEntities
// so that entity references will be current
if (client.datagram.overflowed)
Com.Printf("WARNING: datagram overflowed for " + client.name + "\n");
else
if (client.datagram.overflowed) {
log.warn("datagram overflowed for {}", client.name);
} else
SZ.Write(msg, client.datagram.data, client.datagram.cursize);
SZ.Clear(client.datagram);
if (msg.overflowed) { // must have room left for the packet header
Com.Printf("WARNING: msg overflowed for " + client.name + "\n");
log.warn("msg overflowed for {}", client.name);
SZ.Clear(msg);
}
@@ -409,7 +410,7 @@ public class SV_SEND {
SV_INIT.sv.demofile.close();
}
catch (IOException e) {
Com.Printf("IOError closing d9emo fiele:" + e);
log.error("IOError closing demo fiele:{}", e.getMessage(), e);
}
SV_INIT.sv.demofile = null;
}
@@ -490,7 +491,7 @@ public class SV_SEND {
r = SV_INIT.sv.demofile.read(msgbuf, 0, msglen);
}
catch (IOException e1) {
Com.Printf("IOError: reading demo file, " + e1);
log.error("IOError: reading demo file, {}", e1.getMessage(), e1);
}
if (r != msglen) {
SV_DemoCompleted();

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -32,6 +33,7 @@ import lwjake2.game.usercmd_t;
import lwjake2.qcommon.*;
import lwjake2.util.Lib;
@Slf4j
public class SV_USER {
// private static final FileSystem fileSystem = null/*BaseQ2FileSystem.getInstance()*/;
@@ -100,10 +102,10 @@ public class SV_USER {
int playernum;
edict_t ent;
Com.DPrintf("New() from " + SV_MAIN.sv_client.name + "\n");
log.debug("New() from {}", SV_MAIN.sv_client.name);
if (SV_MAIN.sv_client.state != Defines.cs_connected) {
Com.Printf("New not valid -- already spawned\n");
log.warn("New not valid -- already spawned");
return;
}
@@ -169,16 +171,16 @@ public class SV_USER {
public static void SV_Configstrings_f() {
int start;
Com.DPrintf("Configstrings() from " + SV_MAIN.sv_client.name + "\n");
log.debug("Configstrings() from {}", SV_MAIN.sv_client.name);
if (SV_MAIN.sv_client.state != Defines.cs_connected) {
Com.Printf("configstrings not valid -- already spawned\n");
log.warn("configstrings not valid -- already spawned");
return;
}
// handle the case of a level changing while a client was connecting
if (Lib.atoi(Cmd.Argv(1)) != SV_INIT.svs.spawncount) {
Com.Printf("SV_Configstrings_f from different level\n");
log.warn("SV_Configstrings_f from different level");
SV_New_f();
return;
}
@@ -224,16 +226,16 @@ public class SV_USER {
entity_state_t nullstate;
entity_state_t base;
Com.DPrintf("Baselines() from " + SV_MAIN.sv_client.name + "\n");
log.debug("Baselines() from {}", SV_MAIN.sv_client.name);
if (SV_MAIN.sv_client.state != Defines.cs_connected) {
Com.Printf("baselines not valid -- already spawned\n");
log.warn("baselines not valid -- already spawned");
return;
}
// handle the case of a level changing while a client was connecting
if (Lib.atoi(Cmd.Argv(1)) != SV_INIT.svs.spawncount) {
Com.Printf("SV_Baselines_f from different level\n");
log.warn("SV_Baselines_f from different level");
SV_New_f();
return;
}
@@ -276,11 +278,11 @@ public class SV_USER {
* ================== SV_Begin_f ==================
*/
public static void SV_Begin_f() {
Com.DPrintf("Begin() from " + SV_MAIN.sv_client.name + "\n");
log.debug("Begin() from {}", SV_MAIN.sv_client.name);
// handle the case of a level changing while a client was connecting
if (Lib.atoi(Cmd.Argv(1)) != SV_INIT.svs.spawncount) {
Com.Printf("SV_Begin_f from different level\n");
log.warn("SV_Begin_f from different level");
SV_New_f();
return;
}
@@ -389,8 +391,7 @@ public class SV_USER {
// allow
// download ZOID
|| (name.startsWith("maps/") /*&& fileSystem.getFileFromPak() != 0*/)) {
Com.DPrintf("Couldn't download " + name + " to "
+ SV_MAIN.sv_client.name + "\n");
log.debug("Couldn't download {} to {}", name, SV_MAIN.sv_client.name);
if (SV_MAIN.sv_client.download != null) {
SV_MAIN.sv_client.download = null;
}
@@ -403,8 +404,7 @@ public class SV_USER {
}
SV_NextDownload_f();
Com.DPrintf("Downloading " + name + " to " + SV_MAIN.sv_client.name
+ "\n");
log.debug("Downloading {} to {}", name, SV_MAIN.sv_client.name);
}
//============================================================================
@@ -458,12 +458,11 @@ public class SV_USER {
*/
public static void SV_Nextserver_f() {
if (Lib.atoi(Cmd.Argv(1)) != SV_INIT.svs.spawncount) {
Com.DPrintf("Nextserver() from wrong level, from "
+ SV_MAIN.sv_client.name + "\n");
log.debug("Nextserver() from wrong level, from {}", SV_MAIN.sv_client.name);
return; // leftover from last server
}
Com.DPrintf("Nextserver() from " + SV_MAIN.sv_client.name + "\n");
log.debug("Nextserver() from {}", SV_MAIN.sv_client.name);
SV_Nextserver();
}
@@ -472,8 +471,8 @@ public class SV_USER {
* ================== SV_ExecuteUserCommand ==================
*/
public static void SV_ExecuteUserCommand(String s) {
Com.dprintln("SV_ExecuteUserCommand:" + s );
log.debug("SV_ExecuteUserCommand:{}", s);
SV_USER.ucmd_t u = null;
Cmd.TokenizeString(s.toCharArray(), true);
@@ -508,7 +507,7 @@ public class SV_USER {
cl.commandMsec -= cmd.msec & 0xFF;
if (cl.commandMsec < 0 && SV_MAIN.sv_enforcetime.value != 0) {
Com.DPrintf("commandMsec underflow from " + cl.name + "\n");
log.debug("commandMsec underflow from {}", cl.name);
return;
}
@@ -543,8 +542,8 @@ public class SV_USER {
while (true) {
if (Globals.net_message.readcount > Globals.net_message.cursize) {
Com.Printf("SV_ReadClientMessage: bad read:\n");
Com.Printf(Lib.hexDump(Globals.net_message.data, 32, false));
log.warn("SV_ReadClientMessage: bad read:");
log.warn("{}", Lib.hexDump(Globals.net_message.data, 32, false));
SV_MAIN.SV_DropClient(cl);
return;
}
@@ -555,7 +554,7 @@ public class SV_USER {
switch (c) {
default:
Com.Printf("SV_ReadClientMessage: unknown command char\n");
log.warn("SV_ReadClientMessage: unknown command char");
SV_MAIN.SV_DropClient(cl);
return;
@@ -604,9 +603,12 @@ public class SV_USER {
cl.netchan.incoming_sequence);
if ((calculatedChecksum & 0xff) != checksum) {
Com.DPrintf("Failed command checksum for " + cl.name + " ("
+ calculatedChecksum + " != " + checksum + ")/"
+ cl.netchan.incoming_sequence + "\n");
log.debug("Failed command checksum for {} ({} != {})/{}",
cl.name,
calculatedChecksum,
checksum,
cl.netchan.incoming_sequence
);
return;
}

View File

@@ -18,6 +18,7 @@
package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.ErrorCode;
import lwjake2.Globals;
@@ -30,6 +31,7 @@ import lwjake2.qcommon.CM;
import lwjake2.qcommon.Com;
import lwjake2.util.Math3D;
@Slf4j
public class SV_WORLD {
// world.c -- world query functions
//
@@ -248,11 +250,9 @@ public class SV_WORLD {
// doors may legally straggle two areas,
// but nothing should evern need more than that
if (ent.areanum != 0 && ent.areanum != area) {
if (ent.areanum2 != 0 && ent.areanum2 != area
&& SV_INIT.sv.state == Defines.ss_loading)
Com.DPrintf("Object touching 3 areas at "
+ ent.absmin[0] + " " + ent.absmin[1] + " "
+ ent.absmin[2] + "\n");
if (ent.areanum2 != 0 && ent.areanum2 != area && SV_INIT.sv.state == Defines.ss_loading) {
log.debug("Object touching 3 areas at {} {} {}", ent.absmin[0], ent.absmin[1], ent.absmin[2]);
}
ent.areanum2 = area;
} else
ent.areanum = area;
@@ -333,7 +333,7 @@ public class SV_WORLD {
|| check.absmax[2] < SV_WORLD.area_mins[2])
continue; // not touching
if (SV_WORLD.area_count == SV_WORLD.area_maxcount) {
Com.Printf("SV_AreaEdicts: MAXCOUNT\n");
log.warn("SV_AreaEdicts: MAXCOUNT");
return;
}
SV_WORLD.area_list[SV_WORLD.area_count] = check;

View File

@@ -42,13 +42,13 @@ public class S {
*/
static {
// dummy driver (no sound)
try {
try {
Class.forName("lwjake2.sound.DummyDriver");
// initialize impl with the default value
// this is necessary for dedicated mode
useDriver("dummy");
} catch (Throwable e) {
Com.DPrintf("could not init dummy sound driver class.");
log.debug("could not init dummy sound driver class.");
}
try {
@@ -56,7 +56,7 @@ public class S {
Class.forName("lwjake2.sound.lwjgl.LWJGLSoundImpl");
} catch (Throwable e) {
// ignore the lwjgl driver if runtime not in classpath
Com.DPrintf("could not init lwjgl sound driver class.");
log.debug("could not init lwjgl sound driver class.");
}
};

View File

@@ -71,7 +71,7 @@ public class WaveLoader {
byte[] data = UnpackLoader.loadFile(namebuffer);
if (data == null) {
Com.DPrintf("Couldn't load " + namebuffer + "\n");
log.debug("Couldn't load {}", namebuffer);
return null;
}
@@ -81,7 +81,7 @@ public class WaveLoader {
if (info.channels != 1)
{
Com.Printf(s.name + " is a stereo sample - ignoring\n");
log.warn("{} is a stereo sample - ignoring", s.name);
return null;
}
@@ -97,7 +97,7 @@ public class WaveLoader {
// TODO: handle max sample bytes with a cvar
if (len >= maxsamplebytes)
{
Com.Printf(s.name + " is too long: " + len + " bytes?! ignoring.\n");
log.warn("{} is too long: {} bytes?! ignoring.", s.name, len);
return null;
}
@@ -267,7 +267,7 @@ public class WaveLoader {
FindChunk("RIFF");
String s = new String(data_b, data_p + 8, 4);
if (!s.equals("WAVE")) {
Com.Printf("Missing RIFF/WAVE chunks\n");
log.warn("Missing RIFF/WAVE chunks");
return info;
}
@@ -277,13 +277,13 @@ public class WaveLoader {
FindChunk("fmt ");
if (data_p == 0) {
Com.Printf("Missing fmt chunk\n");
log.warn("Missing fmt chunk");
return info;
}
data_p += 8;
format = GetLittleShort();
if (format != 1) {
Com.Printf("Microsoft PCM format only\n");
log.warn("Microsoft PCM format only");
return info;
}
@@ -319,7 +319,7 @@ public class WaveLoader {
// find data chunk
FindChunk("data");
if (data_p == 0) {
Com.Printf("Missing data chunk\n");
log.warn("Missing data chunk");
return info;
}

View File

@@ -18,11 +18,11 @@
package lwjake2.sound.lwjgl;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines;
import lwjake2.Globals;
import lwjake2.client.CL_ents;
import lwjake2.game.entity_state_t;
import lwjake2.qcommon.Com;
import lwjake2.sound.Sound;
import lwjake2.sound.sfx_t;
import lwjake2.sound.sfxcache_t;
@@ -45,6 +45,7 @@ import org.lwjgl.openal.EFX10;
*
* @author dsanders/cwei
*/
@Slf4j
public class Channel {
final static int LISTENER = 0;
@@ -155,7 +156,7 @@ public class Channel {
AL10.alSourcef(source, AL10.AL_GAIN, 1.0f);
channels[numChannels].volumeChanged = true;
Com.DPrintf("streaming enabled\n");
log.debug("streaming enabled");
}
static void disableStreaming() {
@@ -167,7 +168,7 @@ public class Channel {
// free the last source
//numChannels++;
streamingEnabled = false;
Com.DPrintf("streaming disabled\n");
log.debug("streaming disabled");
}
static void unqueueStreams() {
@@ -177,7 +178,7 @@ public class Channel {
// stop streaming
AL10.alSourceStop(source);
int count = AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED);
Com.DPrintf("unqueue " + count + " buffers\n");
log.debug("unqueue {} buffers", count);
while (count-- > 0) {
AL10.alSourceUnqueueBuffers(source, tmp);
}
@@ -196,12 +197,12 @@ public class Channel {
if (interupted) {
unqueueStreams();
buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++));
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
log.debug("queue {}", streamQueue - 1);
} else if (processed < 2) {
// check queue overrun
if (streamQueue >= Sound.STREAM_QUEUE) return;
buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++));
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
log.debug("queue {}", streamQueue - 1);
} else {
// reuse the buffer
AL10.alSourceUnqueueBuffers(source, buffer);
@@ -213,7 +214,7 @@ public class Channel {
AL10.alSourceQueueBuffers(source, buffer);
if (streamQueue > 1 && !playing) {
Com.DPrintf("start sound\n");
log.debug("start sound");
AL10.alSourcePlay(source);
}
}

View File

@@ -84,14 +84,11 @@ public final class LWJGLSoundImpl implements Sound {
initOpenAL();
checkError();
initOpenALExtensions();
} catch (OpenALException e) {
} catch (Exception e) {
log.error(e.getMessage());
return false;
} catch (Exception e) {
Com.DPrintf(e.getMessage() + '\n');
return false;
}
// set the listerner (master) volume
s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);
AL10.alGenBuffers(buffers);
@@ -128,9 +125,8 @@ public final class LWJGLSoundImpl implements Sound {
log.info("{} using {}", os, ((deviceName == null) ? defaultSpecifier : deviceName));
// Check for an error.
if (ALC10.alcGetError(AL.getDevice()) != ALC10.ALC_NO_ERROR)
{
Com.DPrintf("Error with SoundDevice");
if (ALC10.alcGetError(AL.getDevice()) != ALC10.ALC_NO_ERROR) {
log.debug("Error with SoundDevice");
}
}
@@ -168,7 +164,7 @@ public final class LWJGLSoundImpl implements Sound {
}
private void checkError() {
Com.DPrintf("AL Error: " + alErrorString() +'\n');
log.debug("AL Error: {}", alErrorString());
}
private String alErrorString(){
@@ -490,7 +486,7 @@ public final class LWJGLSoundImpl implements Sound {
sfx = RegisterSound(sound);
if (sfx == null) {
Com.Printf("S_StartLocalSound: can't cache " + sound + "\n");
log.warn("S_StartLocalSound: can't cache {}", sound);
return;
}
StartSound(null, Globals.cl.playernum + 1, 0, sfx, 1, 1, 0);

View File

@@ -240,8 +240,7 @@ public final class NET {
return true;
} catch (IOException e) {
Com.DPrintf("NET_GetPacket: " + e + " from "
+ AdrToString(net_from) + "\n");
log.debug("NET_GetPacket: {} from {}", e.getMessage(), AdrToString(net_from));
return false;
}
}

View File

@@ -157,7 +157,7 @@ public final class Sys {
try {
Pattern.compile(regexpr);
} catch (PatternSyntaxException e) {
Com.Printf("invalid file pattern ( *.* is used instead )\n");
log.warn("invalid file pattern ( *.* is used instead )");
return ".*"; // the default
}
return regexpr;

View File

@@ -224,7 +224,7 @@ public class Lib {
return new RandomAccessFile(name, mode);
}
catch (Exception e) {
Com.DPrintf("Could not open file:" + name);
log.debug("Could not open file:{}", name);
return null;
}
}

View File

@@ -18,12 +18,12 @@
package lwjake2.util;
import lombok.extern.slf4j.Slf4j;
import lwjake2.game.GameBase;
import lwjake2.game.GameItemList;
import lwjake2.game.SuperAdapter;
import lwjake2.game.edict_t;
import lwjake2.game.gitem_t;
import lwjake2.qcommon.Com;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -33,6 +33,7 @@ import java.io.RandomAccessFile;
* RandomAccessFile, but handles readString/WriteString specially and offers
* other helper functions
*/
@Slf4j
public class QuakeFile extends RandomAccessFile {
/** Standard Constructor. */
@@ -105,7 +106,7 @@ public class QuakeFile extends RandomAccessFile {
return null;
if (i > GameBase.g_edicts.length) {
Com.DPrintf("jake2: illegal edict num:" + i + "\n");
log.debug("lwjake2: illegal edict num:{}", i);
return null;
}
@@ -121,7 +122,7 @@ public class QuakeFile extends RandomAccessFile {
else {
String str = a.getID();
if (str == null) {
Com.DPrintf("writeAdapter: invalid Adapter id for " + a + "\n");
log.debug("writeAdapter: invalid Adapter id for {}", a);
}
writeString(str);
}
@@ -129,8 +130,9 @@ public class QuakeFile extends RandomAccessFile {
/** Reads the adapter id and returns the adapter. */
public SuperAdapter readAdapter() throws IOException {
if (readInt() != 3988)
Com.DPrintf("wrong read position: readadapter 3988 \n");
if (readInt() != 3988/*FIXME magic number*/) {
log.debug("wrong read position: readadapter 3988");
}
String id = readString();

View File

@@ -12,7 +12,7 @@
</File>
</Appenders>
<Loggers>
<Root level="all">
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="QConsole"/>
<AppenderRef ref="File"/>