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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -171,7 +171,7 @@ public class GameBase {
for (; from.i < num_edicts; from.i++) { for (; from.i < num_edicts; from.i++) {
from.o = g_edicts[from.i]; from.o = g_edicts[from.i];
if (from.o.classname == null) { 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) if (!from.o.inuse)

View File

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

View File

@@ -244,7 +244,7 @@ public class GameItems {
if (!taken) if (!taken)
return; 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) if (!((GameBase.coop.value != 0) && (ent.item.flags & Defines.IT_STAY_COOP) != 0)
|| 0 != (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM))) { || 0 != (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM))) {

View File

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

View File

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

View File

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

View File

@@ -18,19 +18,20 @@
package lwjake2.game; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.client.M; import lwjake2.client.M;
import lwjake2.qcommon.Com;
import lwjake2.util.Lib; import lwjake2.util.Lib;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
@Slf4j
public class GameUtil { public class GameUtil {
public static void checkClassname(edict_t ent) { public static void checkClassname(edict_t ent) {
if (ent.classname == null) { 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; package lwjake2.game;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.qcommon.Com;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@Slf4j
public class Info { public class Info {
/** /**
@@ -36,7 +37,7 @@ public class Info {
String key1 = tk.nextToken(); String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) { if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n"); log.warn("MISSING VALUE");
return s; return s;
} }
String value1 = tk.nextToken(); String value1 = tk.nextToken();
@@ -57,23 +58,23 @@ public class Info {
return s; return s;
if (key.indexOf('\\') != -1 || value.indexOf('\\') != -1) { 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; return s;
} }
if (key.indexOf(';') != -1) { 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; return s;
} }
if (key.indexOf('"') != -1 || value.indexOf('"') != -1) { 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; return s;
} }
if (key.length() > Defines.MAX_INFO_KEY - 1 if (key.length() > Defines.MAX_INFO_KEY - 1
|| value.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; return s;
} }
@@ -81,7 +82,7 @@ public class Info {
if (sb.length() + 2 + key.length() + value.length() > Defines.MAX_INFO_STRING) { 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; return s;
} }
@@ -98,7 +99,7 @@ public class Info {
StringBuffer sb = new StringBuffer(512); StringBuffer sb = new StringBuffer(512);
if (key.indexOf('\\') != -1) { 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; return s;
} }
@@ -108,7 +109,7 @@ public class Info {
String key1 = tk.nextToken(); String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) { if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n"); log.warn("MISSING VALUE");
return s; return s;
} }
String value1 = tk.nextToken(); String value1 = tk.nextToken();
@@ -141,7 +142,7 @@ public class Info {
String key1 = tk.nextToken(); String key1 = tk.nextToken();
if (!tk.hasMoreTokens()) { if (!tk.hasMoreTokens()) {
Com.Printf("MISSING VALUE\n"); log.warn("MISSING VALUE");
return; return;
} }
@@ -156,6 +157,6 @@ public class Info {
} }
sb.append('=').append(value1).append('\n'); sb.append('=').append(value1).append('\n');
} }
Com.Printf(sb.toString()); log.warn(sb.toString());
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -232,7 +232,7 @@ public final class Com {
} while (c > 32); } while (c > 32);
if (len == Defines.MAX_TOKEN_CHARS) { 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; len = 0;
} }
@@ -267,7 +267,7 @@ public final class Com {
} }
else if (code == ErrorCode.ERR_DROP) else if (code == ErrorCode.ERR_DROP)
{ {
Com.Printf("********************\nERROR: " + msg + "\n********************\n"); log.error(msg);
SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false); SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false);
CL.Drop(); CL.Drop();
recursive= false; 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) public static String sprintf(String fmt, Vargs vargs)
{ {
String msg= ""; String msg= "";

View File

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

View File

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

View File

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

View File

@@ -18,6 +18,7 @@
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.csurface_t; import lwjake2.game.csurface_t;
@@ -26,6 +27,7 @@ import lwjake2.game.trace_t;
import lwjake2.server.SV; import lwjake2.server.SV;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
@Slf4j
public class PMove { public class PMove {
// all of the locals will be zeroed before each // 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) { } catch (IllegalStateException e) {
Com.DPrintf("lonjmp exception:" + e); log.debug("lonjmp exception:{}", e.getMessage());
} }
} }

View File

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

View File

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

View File

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

View File

@@ -18,6 +18,7 @@
package lwjake2.server; package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.ErrorCode; import lwjake2.ErrorCode;
import lwjake2.game.EndianHandler; import lwjake2.game.EndianHandler;
@@ -34,6 +35,7 @@ import lwjake2.util.Math3D;
import java.io.IOException; import java.io.IOException;
@Slf4j
public class SV_ENTS { public class SV_ENTS {
/** /**
@@ -517,7 +519,7 @@ public class SV_ENTS {
% SV_INIT.svs.num_client_entities; % SV_INIT.svs.num_client_entities;
state = SV_INIT.svs.client_entities[ix]; state = SV_INIT.svs.client_entities[ix];
if (ent.s.number != e) { if (ent.s.number != e) {
Com.DPrintf("FIXING ENT.S.NUMBER!!!\n"); log.debug("FIXING ENT.S.NUMBER!!!");
ent.s.number = e; ent.s.number = e;
} }
@@ -589,7 +591,7 @@ public class SV_ENTS {
//fwrite (buf.data, buf.cursize, 1, svs.demofile); //fwrite (buf.data, buf.cursize, 1, svs.demofile);
SV_INIT.svs.demofile.write(buf.data, 0, buf.cursize); SV_INIT.svs.demofile.write(buf.data, 0, buf.cursize);
} catch (IOException e1) { } 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; package lwjake2.server;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.ErrorCode; import lwjake2.ErrorCode;
import lwjake2.Globals; import lwjake2.Globals;
@@ -32,6 +33,7 @@ import lwjake2.qcommon.MSG;
import lwjake2.qcommon.SZ; import lwjake2.qcommon.SZ;
import lwjake2.util.Math3D; import lwjake2.util.Math3D;
@Slf4j
public class SV_GAME { public class SV_GAME {
/** /**
@@ -68,7 +70,7 @@ public class SV_GAME {
* Debug print to server console. * Debug print to server console.
*/ */
public static void PF_dprintf(String fmt) { public static void PF_dprintf(String fmt) {
Com.Printf(fmt); log.debug(fmt);
} }
@@ -96,8 +98,9 @@ public class SV_GAME {
if (ent != null) if (ent != null)
SV_SEND.SV_ClientPrintf(SV_INIT.svs.clients[n - 1], level, fmt); SV_SEND.SV_ClientPrintf(SV_INIT.svs.clients[n - 1], level, fmt);
else else {
Com.Printf(fmt); log.warn(fmt);
}
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -48,7 +48,7 @@ public class S {
// this is necessary for dedicated mode // this is necessary for dedicated mode
useDriver("dummy"); useDriver("dummy");
} catch (Throwable e) { } catch (Throwable e) {
Com.DPrintf("could not init dummy sound driver class."); log.debug("could not init dummy sound driver class.");
} }
try { try {
@@ -56,7 +56,7 @@ public class S {
Class.forName("lwjake2.sound.lwjgl.LWJGLSoundImpl"); Class.forName("lwjake2.sound.lwjgl.LWJGLSoundImpl");
} catch (Throwable e) { } catch (Throwable e) {
// ignore the lwjgl driver if runtime not in classpath // 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); byte[] data = UnpackLoader.loadFile(namebuffer);
if (data == null) { if (data == null) {
Com.DPrintf("Couldn't load " + namebuffer + "\n"); log.debug("Couldn't load {}", namebuffer);
return null; return null;
} }
@@ -81,7 +81,7 @@ public class WaveLoader {
if (info.channels != 1) 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; return null;
} }
@@ -97,7 +97,7 @@ public class WaveLoader {
// TODO: handle max sample bytes with a cvar // TODO: handle max sample bytes with a cvar
if (len >= maxsamplebytes) 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; return null;
} }
@@ -267,7 +267,7 @@ public class WaveLoader {
FindChunk("RIFF"); FindChunk("RIFF");
String s = new String(data_b, data_p + 8, 4); String s = new String(data_b, data_p + 8, 4);
if (!s.equals("WAVE")) { if (!s.equals("WAVE")) {
Com.Printf("Missing RIFF/WAVE chunks\n"); log.warn("Missing RIFF/WAVE chunks");
return info; return info;
} }
@@ -277,13 +277,13 @@ public class WaveLoader {
FindChunk("fmt "); FindChunk("fmt ");
if (data_p == 0) { if (data_p == 0) {
Com.Printf("Missing fmt chunk\n"); log.warn("Missing fmt chunk");
return info; return info;
} }
data_p += 8; data_p += 8;
format = GetLittleShort(); format = GetLittleShort();
if (format != 1) { if (format != 1) {
Com.Printf("Microsoft PCM format only\n"); log.warn("Microsoft PCM format only");
return info; return info;
} }
@@ -319,7 +319,7 @@ public class WaveLoader {
// find data chunk // find data chunk
FindChunk("data"); FindChunk("data");
if (data_p == 0) { if (data_p == 0) {
Com.Printf("Missing data chunk\n"); log.warn("Missing data chunk");
return info; return info;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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