Update of /cvsroot/jake2/jake2/src/jake2/qcommon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8896/src/jake2/qcommon Modified Files: Tag: RST SZ.java Cbuf.java Qcommon.java CM.java Com.java Netchan.java MSG.java Log Message: added debug messages, fixed cooperative multiplayer bugs. Index: SZ.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/SZ.java,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -C2 -d -r1.3 -r1.3.6.1 *** SZ.java 10 Sep 2004 19:02:53 -0000 1.3 --- SZ.java 23 Jan 2005 21:31:17 -0000 1.3.6.1 *************** *** 40,44 **** public static void Init(sizebuf_t buf, byte data[], int length) { ! buf.data = data; buf.maxsize = length; buf.cursize = 0; --- 40,47 ---- public static void Init(sizebuf_t buf, byte data[], int length) { ! // TODO check this. cwei ! buf.readcount = 0; ! ! buf.data = data; buf.maxsize = length; buf.cursize = 0; *************** *** 86,89 **** --- 89,93 ---- // public static void Print(sizebuf_t buf, String data) { + Com.dprintln("SZ.print():<" + data + ">" ); int length = data.length(); byte str[] = data.getBytes(); Index: Com.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Com.java,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -C2 -d -r1.6.6.1 -r1.6.6.2 *** Com.java 16 Jan 2005 21:20:59 -0000 1.6.6.1 --- Com.java 23 Jan 2005 21:31:17 -0000 1.6.6.2 *************** *** 44,47 **** --- 44,50 ---- { + static String debugContext = ""; + static String _debugContext = ""; + static int com_argc; static String[] com_argv= new String[Defines.MAX_NUM_ARGVS]; *************** *** 337,346 **** public static void DPrintf(String fmt) { DPrintf(fmt, null); } public static void Printf(String fmt) { ! Printf(fmt, null); } --- 340,356 ---- 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); } *************** *** 349,360 **** if (Globals.developer == null || Globals.developer.value == 0) return; // don't confuse non-developers with techie stuff... ! Printf(fmt, vargs); } public static void Printf(String fmt, Vargs vargs) { ! // TODO Com.Printf ist nur zum testen ! String msg= sprintf(fmt, vargs); if (rd_target != 0) --- 359,371 ---- if (Globals.developer == null || Globals.developer.value == 0) return; // don't confuse non-developers with techie stuff... ! _debugContext = debugContext; Printf(fmt, vargs); + _debugContext=""; } public static void Printf(String fmt, Vargs vargs) { ! // Com.Printf is for testing only. ! String msg= sprintf(_debugContext + fmt, vargs); if (rd_target != 0) *************** *** 422,426 **** public static void Println(String fmt) { ! Printf(fmt + "\n"); } --- 433,437 ---- public static void Println(String fmt) { ! Printf(_debugContext + fmt + "\n"); } Index: MSG.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/MSG.java,v retrieving revision 1.5 retrieving revision 1.5.6.1 diff -C2 -d -r1.5 -r1.5.6.1 *** MSG.java 22 Sep 2004 19:22:09 -0000 1.5 --- MSG.java 23 Jan 2005 21:31:17 -0000 1.5.6.1 *************** *** 88,91 **** --- 88,92 ---- SZ.Write(sb, x.getBytes()); WriteByte(sb, 0); + Com.dprintln("MSG.WriteString:" + s.replace('\0', '@')); } *************** *** 416,419 **** --- 417,421 ---- else c = msg_read.data[msg_read.readcount] & 0xff; + msg_read.readcount++; *************** *** 473,478 **** l++; } while (l < 2047); ! ! return new String(readbuf, 0, l); } --- 475,482 ---- l++; } while (l < 2047); ! ! String ret = new String(readbuf, 0, l); ! Com.dprintln("MSG.ReadString:[" + ret + "]"); ! return ret; } *************** *** 490,495 **** l++; } while (l < 2047); ! ! return new String(readbuf, 0, l).trim(); } --- 494,501 ---- l++; } while (l < 2047); ! ! String ret = new String(readbuf, 0, l).trim(); ! Com.dprintln("MSG.ReadStringLine:[" + ret.replace('\0', '@') + "]"); ! return ret; } *************** *** 556,559 **** for (int i = 0; i < len; i++) data[i] = (byte) ReadByte(msg_read); ! } } \ No newline at end of file --- 562,566 ---- for (int i = 0; i < len; i++) data[i] = (byte) ReadByte(msg_read); ! } ! } \ No newline at end of file Index: Qcommon.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Qcommon.java,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -C2 -d -r1.12.2.2 -r1.12.2.3 *** Qcommon.java 16 Jan 2005 21:20:59 -0000 1.12.2.2 --- Qcommon.java 23 Jan 2005 21:31:17 -0000 1.12.2.3 *************** *** 92,96 **** Globals.host_speeds= Cvar.Get("host_speeds", "0", 0); Globals.log_stats= Cvar.Get("log_stats", "0", 0); ! Globals.developer= Cvar.Get("developer", "0", 0); Globals.timescale= Cvar.Get("timescale", "0", 0); Globals.fixedtime= Cvar.Get("fixedtime", "0", 0); --- 92,96 ---- Globals.host_speeds= Cvar.Get("host_speeds", "0", 0); Globals.log_stats= Cvar.Get("log_stats", "0", 0); ! Globals.developer= Cvar.Get("developer", "0", CVAR_ARCHIVE); Globals.timescale= Cvar.Get("timescale", "0", 0); Globals.fixedtime= Cvar.Get("fixedtime", "0", 0); *************** *** 207,216 **** if (Globals.host_speeds.value != 0.0f) time_before= Sys.Milliseconds(); ! SV_MAIN.SV_Frame(msec); if (Globals.host_speeds.value != 0.0f) time_between= Sys.Milliseconds(); ! CL.Frame(msec); --- 207,218 ---- if (Globals.host_speeds.value != 0.0f) time_before= Sys.Milliseconds(); ! ! Com.debugContext = "SV:"; SV_MAIN.SV_Frame(msec); if (Globals.host_speeds.value != 0.0f) time_between= Sys.Milliseconds(); ! ! Com.debugContext = "CL:"; CL.Frame(msec); Index: Cbuf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Cbuf.java,v retrieving revision 1.5 retrieving revision 1.5.6.1 diff -C2 -d -r1.5 -r1.5.6.1 *** Cbuf.java 22 Sep 2004 19:22:09 -0000 1.5 --- Cbuf.java 23 Jan 2005 21:31:17 -0000 1.5.6.1 *************** *** 36,39 **** --- 36,42 ---- public final class Cbuf { + private static final byte[] line = new byte[1024]; + private static final byte[] tmp = new byte[8192]; + /** * *************** *** 46,50 **** public static void InsertText(String text) { - byte[] temp = null; int templen = 0; --- 49,52 ---- *************** *** 52,57 **** templen = Globals.cmd_text.cursize; if (templen != 0) { ! temp = new byte[templen]; ! System.arraycopy(Globals.cmd_text.data, 0, temp, 0, templen); SZ.Clear(Globals.cmd_text); } --- 54,58 ---- templen = Globals.cmd_text.cursize; if (templen != 0) { ! System.arraycopy(Globals.cmd_text.data, 0, tmp, 0, templen); SZ.Clear(Globals.cmd_text); } *************** *** 62,67 **** // add the copied off data if (templen != 0) { ! SZ.Write(Globals.cmd_text, temp, templen); ! temp = null; } } --- 63,67 ---- // add the copied off data if (templen != 0) { ! SZ.Write(Globals.cmd_text, tmp, templen); } } *************** *** 157,161 **** byte[] text = null; - byte[] line = new byte[1024]; Globals.alias_count = 0; // don't allow infinite alias loops --- 157,160 ---- *************** *** 191,195 **** i++; Globals.cmd_text.cursize -= i; ! byte[] tmp = new byte[Globals.cmd_text.cursize]; System.arraycopy(text, i, tmp, 0, Globals.cmd_text.cursize); --- 190,194 ---- i++; Globals.cmd_text.cursize -= i; ! //byte[] tmp = new byte[Globals.cmd_text.cursize]; System.arraycopy(text, i, tmp, 0, Globals.cmd_text.cursize); Index: Netchan.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Netchan.java,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -C2 -d -r1.4 -r1.4.6.1 *** Netchan.java 22 Sep 2004 19:22:09 -0000 1.4 --- Netchan.java 23 Jan 2005 21:31:17 -0000 1.4.6.1 *************** *** 119,122 **** --- 119,124 ---- } + private static final byte send_buf[] = new byte[Defines.MAX_MSGLEN]; + private static final sizebuf_t send = new sizebuf_t(); /* * =============== Netchan_OutOfBand *************** *** 127,132 **** public static void Netchan_OutOfBand(int net_socket, netadr_t adr, int length, byte data[]) { - sizebuf_t send = new sizebuf_t(); - byte send_buf[] = new byte[Defines.MAX_MSGLEN]; // write the packet header --- 129,132 ---- *************** *** 195,198 **** --- 195,200 ---- } + // private static final byte send_buf[] = new byte[Defines.MAX_MSGLEN]; + // private static final sizebuf_t send = new sizebuf_t(); /* * =============== Netchan_Transmit *************** *** 205,210 **** */ public static void Transmit(netchan_t chan, int length, byte data[]) { - sizebuf_t send = new sizebuf_t(); - byte send_buf[] = new byte[Defines.MAX_MSGLEN]; int send_reliable; int w1, w2; --- 207,210 ---- Index: CM.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/CM.java,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -C2 -d -r1.6.6.1 -r1.6.6.2 *** CM.java 16 Jan 2005 21:20:59 -0000 1.6.6.1 --- CM.java 23 Jan 2005 21:31:17 -0000 1.6.6.2 *************** *** 217,221 **** public static cmodel_t CM_LoadMap(String name, boolean clientload, int checksum[]) { ! Com.DPrintf("CM_LoadMap...\n"); byte buf[]; int i; --- 217,221 ---- public static cmodel_t CM_LoadMap(String name, boolean clientload, int checksum[]) { ! Com.DPrintf("CM_LoadMap(" + name + ")...\n"); byte buf[]; int i; *************** *** 280,284 **** // load into heap ! CMod_LoadSurfaces(header.lumps[Defines.LUMP_TEXINFO]); // ok. CMod_LoadLeafs(header.lumps[Defines.LUMP_LEAFS]); CMod_LoadLeafBrushes(header.lumps[Defines.LUMP_LEAFBRUSHES]); --- 280,284 ---- // load into heap ! CMod_LoadSurfaces(header.lumps[Defines.LUMP_TEXINFO]); // ok CMod_LoadLeafs(header.lumps[Defines.LUMP_LEAFS]); CMod_LoadLeafBrushes(header.lumps[Defines.LUMP_LEAFBRUSHES]); *************** *** 289,297 **** CMod_LoadNodes(header.lumps[Defines.LUMP_NODES]); ! CMod_LoadAreas(header.lumps[Defines.LUMP_AREAS]); ! CMod_LoadAreaPortals(header.lumps[Defines.LUMP_AREAPORTALS]); CMod_LoadVisibility(header.lumps[Defines.LUMP_VISIBILITY]); CMod_LoadEntityString(header.lumps[Defines.LUMP_ENTITIES]); ! FS.FreeFile(buf); --- 289,297 ---- CMod_LoadNodes(header.lumps[Defines.LUMP_NODES]); ! CMod_LoadAreas(header.lumps[Defines.LUMP_AREAS]); ! CMod_LoadAreaPortals(header.lumps[Defines.LUMP_AREAPORTALS]); CMod_LoadVisibility(header.lumps[Defines.LUMP_VISIBILITY]); CMod_LoadEntityString(header.lumps[Defines.LUMP_ENTITIES]); ! FS.FreeFile(buf); *************** *** 319,323 **** */ public static void CMod_LoadSubmodels(lump_t l) { ! Com.DPrintf("CMod_LoadSubmodels...\n"); qfiles.dmodel_t in; cmodel_t out; --- 319,323 ---- */ public static void CMod_LoadSubmodels(lump_t l) { ! Com.DPrintf("CMod_LoadSubmodels()\n"); qfiles.dmodel_t in; cmodel_t out; *************** *** 325,329 **** if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size"); count = l.filelen / qfiles.dmodel_t.SIZE; --- 325,329 ---- if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "CMod_LoadBmodel: funny lump size"); count = l.filelen / qfiles.dmodel_t.SIZE; *************** *** 334,338 **** Com.Error(Defines.ERR_DROP, "Map has too many models"); ! Com.DPrintf(" numcmodels=" + count + "\n"); numcmodels = count; --- 334,338 ---- Com.Error(Defines.ERR_DROP, "Map has too many models"); ! Com.DPrintf(" numcmodels=" + count + "\n"); numcmodels = count; *************** *** 371,375 **** */ public static void CMod_LoadSurfaces(lump_t l) { ! Com.DPrintf("CMod_LoadSurfaces...\n"); texinfo_t in; mapsurface_t out; --- 371,375 ---- */ public static void CMod_LoadSurfaces(lump_t l) { ! Com.DPrintf("CMod_LoadSurfaces()\n"); texinfo_t in; mapsurface_t out; *************** *** 386,390 **** numtexinfo = count; ! Com.DPrintf("numtexinfo=" + count + "\n"); if (debugloadmap) Com.DPrintf("surfaces:\n"); --- 386,390 ---- numtexinfo = count; ! Com.DPrintf(" numtexinfo=" + count + "\n"); if (debugloadmap) Com.DPrintf("surfaces:\n"); *************** *** 415,419 **** */ public static void CMod_LoadNodes(lump_t l) { ! Com.DPrintf("CMod_LoadNodes...\n"); qfiles.dnode_t in; int child; --- 415,419 ---- */ public static void CMod_LoadNodes(lump_t l) { ! Com.DPrintf("CMod_LoadNodes()\n"); qfiles.dnode_t in; int child; *************** *** 432,436 **** numnodes = count; ! Com.DPrintf(" numnodes=" + count + "\n"); if (debugloadmap) { --- 432,436 ---- numnodes = count; ! Com.DPrintf(" numnodes=" + count + "\n"); if (debugloadmap) { *************** *** 461,465 **** */ public static void CMod_LoadBrushes(lump_t l) { ! Com.DPrintf("CMod_LoadBrushes...\n"); qfiles.dbrush_t in; cbrush_t out; --- 461,465 ---- */ public static void CMod_LoadBrushes(lump_t l) { ! Com.DPrintf("CMod_LoadBrushes()\n"); qfiles.dbrush_t in; cbrush_t out; *************** *** 475,479 **** numbrushes = count; ! Com.DPrintf(" numbrushes=" + count + "\n"); if (debugloadmap) { Com.DPrintf("brushes:(firstbrushside, numsides, contents)\n"); --- 475,479 ---- numbrushes = count; ! Com.DPrintf(" numbrushes=" + count + "\n"); if (debugloadmap) { Com.DPrintf("brushes:(firstbrushside, numsides, contents)\n"); *************** *** 500,504 **** */ public static void CMod_LoadLeafs(lump_t l) { ! Com.DPrintf("CMod_LoadLeafs...\n"); int i; cleaf_t out; --- 500,504 ---- */ public static void CMod_LoadLeafs(lump_t l) { ! Com.DPrintf("CMod_LoadLeafs()\n"); int i; cleaf_t out; *************** *** 518,528 **** Com.Error(Defines.ERR_DROP, "Map has too many planes"); ! Com.DPrintf(" numleafes=" + count + "\n"); numleafs = count; numclusters = 0; if (debugloadmap) ! Com ! .DPrintf("cleaf-list:(contents, cluster, area, firstleafbrush, numleafbrushes)\n"); for (i = 0; i < count; i++) { in = new qfiles.dleaf_t(cmod_base, i * qfiles.dleaf_t.SIZE --- 518,527 ---- Com.Error(Defines.ERR_DROP, "Map has too many planes"); ! Com.DPrintf(" numleafes=" + count + "\n"); numleafs = count; numclusters = 0; if (debugloadmap) ! Com.DPrintf("cleaf-list:(contents, cluster, area, firstleafbrush, numleafbrushes)\n"); for (i = 0; i < count; i++) { in = new qfiles.dleaf_t(cmod_base, i * qfiles.dleaf_t.SIZE *************** *** 548,552 **** } ! Com.DPrintf(" numclusters=" + numclusters + "\n"); if (map_leafs[0].contents != Defines.CONTENTS_SOLID) --- 547,551 ---- } ! Com.DPrintf(" numclusters=" + numclusters + "\n"); if (map_leafs[0].contents != Defines.CONTENTS_SOLID) *************** *** 571,575 **** */ public static void CMod_LoadPlanes(lump_t l) { ! Com.DPrintf("CMod_LoadPlanes...\n"); int i, j; cplane_t out; --- 570,574 ---- */ public static void CMod_LoadPlanes(lump_t l) { ! Com.DPrintf("CMod_LoadPlanes()\n"); int i, j; cplane_t out; *************** *** 590,594 **** Com.Error(Defines.ERR_DROP, "Map has too many planes"); ! Com.DPrintf(" numplanes=" + count + "\n"); numplanes = count; --- 589,593 ---- Com.Error(Defines.ERR_DROP, "Map has too many planes"); ! Com.DPrintf(" numplanes=" + count + "\n"); numplanes = count; *************** *** 629,633 **** */ public static void CMod_LoadLeafBrushes(lump_t l) { ! Com.DPrintf("CMod_LoadLeafBrushes...\n"); int i; int out[]; --- 628,632 ---- */ public static void CMod_LoadLeafBrushes(lump_t l) { ! Com.DPrintf("CMod_LoadLeafBrushes()\n"); int i; int out[]; *************** *** 640,644 **** count = l.filelen / 2; ! Com.DPrintf(" numbrushes=" + count + "\n"); if (count < 1) --- 639,643 ---- count = l.filelen / 2; ! Com.DPrintf(" numbrushes=" + count + "\n"); if (count < 1) *************** *** 671,675 **** */ public static void CMod_LoadBrushSides(lump_t l) { ! Com.DPrintf("CMod_LoadBrushSides...\n"); int i, j; cbrushside_t out; --- 670,674 ---- */ public static void CMod_LoadBrushSides(lump_t l) { ! Com.DPrintf("CMod_LoadBrushSides()\n"); int i, j; cbrushside_t out; *************** *** 688,692 **** numbrushsides = count; ! Com.DPrintf(" numbrushsides=" + count + "\n"); if (debugloadmap) { --- 687,691 ---- numbrushsides = count; ! Com.DPrintf(" numbrushsides=" + count + "\n"); if (debugloadmap) { *************** *** 728,732 **** */ public static void CMod_LoadAreas(lump_t l) { ! Com.DPrintf("CMod_LoadAreas...\n"); int i; carea_t out; --- 727,731 ---- */ public static void CMod_LoadAreas(lump_t l) { ! Com.DPrintf("CMod_LoadAreas()\n"); int i; carea_t out; *************** *** 742,746 **** Com.Error(Defines.ERR_DROP, "Map has too many areas"); ! Com.DPrintf(" numareas=" + count + "\n"); numareas = count; --- 741,745 ---- Com.Error(Defines.ERR_DROP, "Map has too many areas"); ! Com.DPrintf(" numareas=" + count + "\n"); numareas = count; *************** *** 770,774 **** */ public static void CMod_LoadAreaPortals(lump_t l) { ! Com.DPrintf("CMod_LoadAreaPortals...\n"); int i; qfiles.dareaportal_t out; --- 769,773 ---- */ public static void CMod_LoadAreaPortals(lump_t l) { ! Com.DPrintf("CMod_LoadAreaPortals()\n"); int i; qfiles.dareaportal_t out; *************** *** 784,788 **** numareaportals = count; ! Com.DPrintf(" numareaportals=" + count + "\n"); if (debugloadmap) { Com.DPrintf("areaportals(portalnum, otherarea)\n"); --- 783,787 ---- numareaportals = count; ! Com.DPrintf(" numareaportals=" + count + "\n"); if (debugloadmap) { Com.DPrintf("areaportals(portalnum, otherarea)\n"); *************** *** 809,818 **** */ public static void CMod_LoadVisibility(lump_t l) { ! Com.DPrintf("CMod_LoadVisibility...\n"); int i; numvisibility = l.filelen; ! Com.DPrintf(" numvisibility=" + numvisibility + "\n"); if (l.filelen > Defines.MAX_MAP_VISIBILITY) --- 808,817 ---- */ public static void CMod_LoadVisibility(lump_t l) { ! Com.DPrintf("CMod_LoadVisibility()\n"); int i; numvisibility = l.filelen; ! Com.DPrintf(" numvisibility=" + numvisibility + "\n"); if (l.filelen > Defines.MAX_MAP_VISIBILITY) *************** *** 832,836 **** */ public static void CMod_LoadEntityString(lump_t l) { ! Com.DPrintf("CMod_LoadEntityString...\n"); numentitychars = l.filelen; --- 831,835 ---- */ public static void CMod_LoadEntityString(lump_t l) { ! Com.DPrintf("CMod_LoadEntityString()\n"); numentitychars = l.filelen; *************** *** 840,847 **** int x = 0; ! for (; x < l.filelen && cmod_base[x + l.fileofs] != 0; x++) ! ; map_entitystring = new String(cmod_base, l.fileofs, x).trim(); } --- 839,848 ---- int x = 0; ! for (; x < l.filelen && cmod_base[x + l.fileofs] != 0; x++); map_entitystring = new String(cmod_base, l.fileofs, x).trim(); + Com.dprintln("entitystring=" + map_entitystring.length() + + " bytes, [" + map_entitystring.substring(0, Math.min ( + map_entitystring.length(), 15)) + "...]" ); } *************** *** 1401,1405 **** float idist; int i; - float[] mid = { 0, 0, 0 }; int side; float midf; --- 1402,1405 ---- *************** *** 1470,1473 **** --- 1470,1475 ---- midf = p1f + (p2f - p1f) * frac; + float[] mid = Vec3Cache.get(); + for (i = 0; i < 3; i++) mid[i] = p1[i] + frac * (p2[i] - p1[i]); *************** *** 1486,1489 **** --- 1488,1492 ---- CM_RecursiveHullCheck(node.children[side ^ 1], midf, p2f, mid, p2); + Vec3Cache.release(); } |