From: Holger Z. <hz...@us...> - 2004-09-06 19:39:31
|
Update of /cvsroot/jake2/jake2/src/jake2/qcommon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2637/src/jake2/qcommon Modified Files: Tag: r_0_9 Qcommon.java PMove.java Cvar.java MSG.java FS.java Netchan.java CRC.java CM.java Com.java Cbuf.java Log Message: merge changes for 0.9.3 Index: PMove.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/PMove.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** PMove.java 8 Jul 2004 15:58:46 -0000 1.2 --- PMove.java 6 Sep 2004 19:39:18 -0000 1.2.2.1 *************** *** 161,164 **** --- 161,165 ---- if (pm.numtouch < MAXTOUCH && trace.ent != null) { + //rst: just for debugging touches. //if (trace.ent.index != -1 && trace.ent.index != 0) //Com.p("touch: " + trace.ent.classname + " (" + trace.ent.index + ")" ); *************** *** 1257,1260 **** PM_SnapPosition(); } - } --- 1258,1260 ---- Index: Com.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Com.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** Com.java 9 Jul 2004 08:38:29 -0000 1.2.2.1 --- Com.java 6 Sep 2004 19:39:19 -0000 1.2.2.2 *************** *** 87,96 **** public static class ParseHelp { - - public ParseHelp(String in, int offset) - { - this(in.toCharArray(), offset); - } - public ParseHelp(String in) { --- 87,90 ---- *************** *** 113,120 **** public ParseHelp(char in[], int offset) { ! if (in == null || in.length == 0) ! data= null; ! else ! data= in; index= offset; } --- 107,111 ---- public ParseHelp(char in[], int offset) { ! data= in; index= offset; } *************** *** 152,155 **** --- 143,155 ---- } } + + public char prevchar() { + if (index > 0) + { + index--; + return data[index]; + } + return 0; + } public boolean isEof() *************** *** 189,247 **** // See GameSpanw.ED_ParseEdict() to see how to use it now. ! // works perfect ! ! public static String Parse(ParseHelp hlp) ! { ! int c; ! int len= 0; ! len= 0; ! ! com_token[0]= 0; ! if (hlp.data == null) ! { return ""; } ! // skip whitespace ! hlp.skipwhites(); ! ! if (hlp.isEof()) ! { ! return ""; ! } ! // skip // comments ! if (hlp.getchar() == '/') ! { ! if (hlp.nextchar() == '/') ! { ! if ((hlp.skiptoeol() == 0) || (hlp.skipwhites() == 0)) ! { return ""; } ! } ! else ! { ! com_token[len]= '/'; ! len++; ! } } - // handle quoted strings specially - if (hlp.getchar() == '\"') - { - while (true) - { - c= hlp.nextchar(); - if (c == '\"' || c == 0) - { ! hlp.nextchar(); ! com_token[len]= '?'; return new String(com_token, 0, len); } ! if (len < Defines.MAX_TOKEN_CHARS) ! { ! com_token[len]= hlp.getchar(); len++; } --- 189,230 ---- // See GameSpanw.ED_ParseEdict() to see how to use it now. ! public static String Parse(ParseHelp hlp) { int c; ! int len = 0; ! if (hlp.data == null) { return ""; } ! while (true) { ! // skip whitespace ! hlp.skipwhites(); ! if (hlp.isEof()) ! return ""; ! // skip // comments ! if (hlp.getchar() == '/') { ! if (hlp.nextchar() == '/') { ! hlp.skiptoeol(); return ""; + } else { + hlp.prevchar(); + break; } ! } else ! break; } ! // handle quoted strings specially ! if (hlp.getchar() == '\"') { ! hlp.nextchar(); ! while (true) { ! c = hlp.getchar(); ! hlp.nextchar(); ! if (c == '\"' || c == 0) { return new String(com_token, 0, len); } ! if (len < Defines.MAX_TOKEN_CHARS) { ! com_token[len] = (char) c; len++; } *************** *** 249,275 **** } ! // parse a regular word ! do ! { ! if (len < Defines.MAX_TOKEN_CHARS) ! { ! com_token[len]= hlp.getchar(); len++; } ! c= hlp.nextchar(); ! } ! while (c > 32); ! ! if (len == Defines.MAX_TOKEN_CHARS) ! { ! Printf("Token exceeded " + Defines.MAX_TOKEN_CHARS + " chars, discarded.\n"); ! len= 0; } - // trigger the eof - hlp.skipwhites(); - - com_token[len]= 0; return new String(com_token, 0, len); } --- 232,250 ---- } ! // parse a regular word ! c = hlp.getchar(); ! do { ! if (len < Defines.MAX_TOKEN_CHARS) { ! com_token[len] = (char) c; len++; } + c = hlp.nextchar(); + } while (c > 32); ! if (len == Defines.MAX_TOKEN_CHARS) { ! Com.Printf("Token exceeded " + Defines.MAX_TOKEN_CHARS + " chars, discarded.\n"); ! len = 0; } return new String(com_token, 0, len); } *************** *** 351,359 **** } - public static void d(String fmt) - { - DPrintf(fmt + "\n", null); - } - public static void Printf(String fmt) { --- 326,329 ---- *************** *** 462,470 **** } - public static int ServerState() - { - return Globals.server_state; - } - public static int Argc() { --- 432,435 ---- *************** *** 516,522 **** } ! public static void StripExtension(String string, String string2) ! { ! // TODO implement StripExtension } --- 481,489 ---- } ! public static String StripExtension(String string) { ! int i = string.lastIndexOf('.'); ! if (i < 0) ! return string; ! return string.substring(0, i); } *************** *** 524,528 **** * CRC table. */ - static int chktbl[]= { --- 491,494 ---- Index: MSG.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/MSG.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** MSG.java 8 Jul 2004 20:24:48 -0000 1.3 --- MSG.java 6 Sep 2004 19:39:18 -0000 1.3.2.1 *************** *** 478,487 **** } while (l < 2047); - //readbuf[l] = 0; return new String(readbuf, 0, l); } - // 2k read buffer. - public static byte readbuf1[] = new byte[2048]; public static String ReadStringLine(sizebuf_t msg_read) { --- 478,484 ---- *************** *** 494,505 **** if (c == -1 || c == 0 || c == 0x0a) break; ! readbuf1[l] = c; l++; ! } ! while (l < 2047); ! ! readbuf1[l] = 0; ! return new String(readbuf1, 0, l).trim(); } --- 491,499 ---- if (c == -1 || c == 0 || c == 0x0a) break; ! readbuf[l] = c; l++; ! } while (l < 2047); ! return new String(readbuf, 0, l).trim(); } *************** *** 563,572 **** public static void ReadData(sizebuf_t msg_read, byte data[], int len) { ! int i; ! ! for (i = 0; i < len; i++) data[i] = (byte) ReadByte(msg_read); } - - //============================================================================ } --- 557,562 ---- public static void ReadData(sizebuf_t msg_read, byte data[], int len) { ! for (int i = 0; i < len; i++) data[i] = (byte) ReadByte(msg_read); } } Index: Qcommon.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Qcommon.java,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** Qcommon.java 9 Jul 2004 08:38:29 -0000 1.3.2.2 --- Qcommon.java 6 Sep 2004 19:39:18 -0000 1.3.2.3 *************** *** 29,33 **** import jake2.client.*; import jake2.game.Cmd; - import jake2.game.Swap; import jake2.server.SV_MAIN; import jake2.sys.NET; --- 29,32 ---- *************** *** 60,64 **** Com.InitArgv(args); - Swap.Init(); Cbuf.Init(); --- 59,62 ---- Index: Cbuf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Cbuf.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Cbuf.java 8 Jul 2004 15:58:46 -0000 1.2 --- Cbuf.java 6 Sep 2004 19:39:19 -0000 1.2.2.1 *************** *** 29,33 **** import jake2.Globals; import jake2.game.Cmd; - import jake2.util.Lib; /** --- 29,32 ---- *************** *** 230,234 **** */ public static void CopyToDefer() { ! Lib.memcpy(Globals.defer_text_buf, Globals.cmd_text_buf, Globals.cmd_text.cursize); Globals.defer_text_buf[Globals.cmd_text.cursize] = 0; Globals.cmd_text.cursize = 0; --- 229,233 ---- */ public static void CopyToDefer() { ! System.arraycopy(Globals.cmd_text_buf, 0, Globals.defer_text_buf, 0, Globals.cmd_text.cursize); Globals.defer_text_buf[Globals.cmd_text.cursize] = 0; Globals.cmd_text.cursize = 0; Index: FS.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/FS.java,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** FS.java 9 Jul 2004 08:38:29 -0000 1.2.2.2 --- FS.java 6 Sep 2004 19:39:18 -0000 1.2.2.3 *************** *** 117,121 **** File f = new File(path.substring(0, index)); if (!f.mkdirs()) { ! Com.Printf("can't create path \"" + path + '"' + "\n" ); } } --- 117,121 ---- File f = new File(path.substring(0, index)); if (!f.mkdirs()) { ! //Com.Printf("can't create path \"" + path + '"' + "\n" ); } } Index: CM.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/CM.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** CM.java 9 Jul 2004 08:38:29 -0000 1.2.2.1 --- CM.java 6 Sep 2004 19:39:18 -0000 1.2.2.2 *************** *** 199,203 **** map_noareas = Cvar.Get("map_noareas", "0", 0); ! if (0 == strcmp(map_name, name) && (clientload || 0 == Cvar.VariableValue("flushmap"))) { checksum[0] = last_checksum; --- 199,203 ---- map_noareas = Cvar.Get("map_noareas", "0", 0); ! if (map_name.equals(name) && (clientload || 0 == Cvar.VariableValue("flushmap"))) { checksum[0] = last_checksum; *************** *** 1704,1708 **** public static byte[] CM_ClusterPVS(int cluster) { if (cluster == -1) ! Lib.memset(pvsrow, (byte) 0, (numclusters + 7) >> 3); else CM_DecompressVis(map_visibility, map_vis.bitofs[cluster][DVIS_PVS], pvsrow); --- 1704,1708 ---- public static byte[] CM_ClusterPVS(int cluster) { if (cluster == -1) ! Arrays.fill(pvsrow, 0, (numclusters + 7) >> 3, (byte)0); else CM_DecompressVis(map_visibility, map_vis.bitofs[cluster][DVIS_PVS], pvsrow); *************** *** 1712,1716 **** public static byte[] CM_ClusterPHS(int cluster) { if (cluster == -1) ! Lib.memset(phsrow, (byte) 0, (numclusters + 7) >> 3); else CM_DecompressVis(map_visibility, map_vis.bitofs[cluster][Defines.DVIS_PHS], phsrow); --- 1712,1716 ---- public static byte[] CM_ClusterPHS(int cluster) { if (cluster == -1) ! Arrays.fill(phsrow, 0, (numclusters + 7) >> 3, (byte)0); else CM_DecompressVis(map_visibility, map_vis.bitofs[cluster][Defines.DVIS_PHS], phsrow); *************** *** 1823,1830 **** if (map_noareas.value != 0) { // for debugging, send everything ! Lib.memset(buffer, 255, bytes); } else { ! Lib.memset(buffer, 0, bytes); floodnum = map_areas[area].floodnum; for (i = 0; i < numareas; i++) { --- 1823,1830 ---- if (map_noareas.value != 0) { // for debugging, send everything ! Arrays.fill(buffer, 0, bytes, (byte)255); } else { ! Arrays.fill(buffer, 0, bytes, (byte)0); floodnum = map_areas[area].floodnum; for (i = 0; i < numareas; i++) { Index: Netchan.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Netchan.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Netchan.java 8 Jul 2004 15:58:46 -0000 1.2 --- Netchan.java 6 Sep 2004 19:39:18 -0000 1.2.2.1 *************** *** 26,38 **** package jake2.qcommon; ! import sun.applet.resources.MsgAppletViewer; ! import jake2.*; ! import jake2.client.*; ! import jake2.game.*; ! import jake2.render.*; ! import jake2.server.*; import jake2.sys.NET; import jake2.sys.Sys; - import jake2.util.Lib; /** --- 26,35 ---- package jake2.qcommon; ! import jake2.Defines; ! import jake2.Globals; ! import jake2.game.cvar_t; ! import jake2.server.SV_MAIN; import jake2.sys.NET; import jake2.sys.Sys; /** *************** *** 225,229 **** if (chan.reliable_length == 0 && chan.message.cursize != 0) { ! Lib.memcpy(chan.reliable_buf, chan.message_buf, chan.message.cursize); chan.reliable_length = chan.message.cursize; chan.message.cursize = 0; --- 222,226 ---- if (chan.reliable_length == 0 && chan.message.cursize != 0) { ! System.arraycopy(chan.message_buf, 0, chan.reliable_buf, 0, chan.message.cursize); chan.reliable_length = chan.message.cursize; chan.message.cursize = 0; Index: Cvar.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/qcommon/Cvar.java,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** Cvar.java 7 Jul 2004 19:59:30 -0000 1.1.1.1 --- Cvar.java 6 Sep 2004 19:39:18 -0000 1.1.1.1.2.1 *************** *** 29,32 **** --- 29,33 ---- import java.io.IOException; import java.io.RandomAccessFile; + import java.util.Vector; import jake2.Defines; *************** *** 133,137 **** var.string = value; ! var.value = Lib.atof(var.string); var.flags = flags; --- 134,143 ---- var.string = value; ! try { ! var.value = Float.parseFloat(var.string); ! } catch (Exception e) { ! var.value = 0.0f; ! } ! var.flags = flags; *************** *** 185,197 **** } ! if (Com.ServerState() != 0) { Com.Printf(var_name + " will be changed for next game.\n"); - //var.latched_string = CopyString(value); var.latched_string = value; } else { - //var.string = CopyString(value); var.string = value; ! var.value = Lib.atof(var.string); if (var.name.equals("game")) { FS.SetGamedir(var.string); --- 191,205 ---- } ! if (Globals.server_state != 0) { Com.Printf(var_name + " will be changed for next game.\n"); var.latched_string = value; } else { var.string = value; ! try { ! var.value = Float.parseFloat(var.string); ! } catch (Exception e) { ! var.value = 0.0f; ! } if (var.name.equals("game")) { FS.SetGamedir(var.string); *************** *** 217,225 **** Globals.userinfo_modified = true; // transmit at next oportunity - //Z_Free(var.string); // free the old value string - - //var.string = CopyString(value); var.string = value; ! var.value = Lib.atof(var.string); return var; --- 225,234 ---- Globals.userinfo_modified = true; // transmit at next oportunity var.string = value; ! try { ! var.value = Float.parseFloat(var.string); ! } catch (Exception e) { ! var.value = 0.0f; ! } return var; *************** *** 312,316 **** if (var == null) return 0; ! return Lib.atof(var.string); } --- 321,329 ---- if (var == null) return 0; ! float val = 0.0f; ! try { ! val = Float.parseFloat(var.string); ! } catch (Exception e) {} ! return val; } *************** *** 419,437 **** ============ */ ! static String CompleteVariable(String partial) { ! cvar_t cvar; ! int len; ! ! len = partial.length(); ! ! if (len == 0) ! return null; // check match ! for (cvar = Globals.cvar_vars; cvar != null; cvar = cvar.next) if (cvar.name.startsWith(partial)) ! return cvar.name; ! ! return null; } --- 432,445 ---- ============ */ ! public static Vector CompleteVariable(String partial) { ! ! Vector vars = new Vector(); // check match ! for (cvar_t cvar = Globals.cvar_vars; cvar != null; cvar = cvar.next) if (cvar.name.startsWith(partial)) ! vars.add(cvar.name); ! ! return vars; } |