diff options
Diffstat (limited to 'src/jake2/qcommon')
-rw-r--r-- | src/jake2/qcommon/CM.java | 26 | ||||
-rw-r--r-- | src/jake2/qcommon/CRC.java | 383 | ||||
-rw-r--r-- | src/jake2/qcommon/Com.java | 1336 | ||||
-rw-r--r-- | src/jake2/qcommon/FS.java | 14 | ||||
-rw-r--r-- | src/jake2/qcommon/MD4.java | 14 | ||||
-rw-r--r-- | src/jake2/qcommon/Qcommon.java | 94 | ||||
-rw-r--r-- | src/jake2/qcommon/qfiles.java | 19 |
7 files changed, 1627 insertions, 259 deletions
diff --git a/src/jake2/qcommon/CM.java b/src/jake2/qcommon/CM.java index 8c5a203..1c3a756 100644 --- a/src/jake2/qcommon/CM.java +++ b/src/jake2/qcommon/CM.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.01.2004 by RST. -// $Id: CM.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ +// $Id: CM.java,v 1.3 2004-07-09 06:50:50 hzi Exp $ package jake2.qcommon; @@ -189,7 +189,7 @@ public class CM extends Game { Loads in the map and all submodels ================== */ - public static cmodel_t CM_LoadMap(String name, boolean clientload, intwrap checksum) { + public static cmodel_t CM_LoadMap(String name, boolean clientload, int checksum[]) { Com.DPrintf("CM_LoadMap...\n"); byte buf[]; int i; @@ -200,7 +200,7 @@ public class CM extends Game { if (0 == strcmp(map_name, name) && (clientload || 0 == Cvar.VariableValue("flushmap"))) { - checksum.i = last_checksum; + checksum[0] = last_checksum; if (!clientload) { Arrays.fill(portalopen, false); @@ -222,7 +222,7 @@ public class CM extends Game { numleafs = 1; numclusters = 1; numareas = 1; - checksum.i = 0; + checksum[0] = 0; return map_cmodels[0]; // cinematic servers won't have anything at all } @@ -240,7 +240,7 @@ public class CM extends Game { ByteBuffer bbuf = ByteBuffer.wrap(buf); last_checksum = MD4.Com_BlockChecksum(buf, length); - checksum.i = last_checksum; + checksum[0] = last_checksum; header = new qfiles.dheader_t(bbuf.slice()); @@ -796,7 +796,6 @@ public class CM extends Game { if (l.filelen > MAX_MAP_VISIBILITY) Com.Error(ERR_DROP, "Map has too large visibility lump"); - //was: memcpy(map_visibility, cmod_base + l.fileofs, l.filelen); System.arraycopy(cmod_base, l.fileofs, map_visibility, 0, l.filelen); ByteBuffer bb = ByteBuffer.wrap(map_visibility, 0, l.filelen); @@ -1074,7 +1073,7 @@ public class CM extends Game { } } - public static int CM_BoxLeafnums_headnode(float[] mins, float[] maxs, int list[], int listsize, int headnode, intwrap topnode) { + public static int CM_BoxLeafnums_headnode(float[] mins, float[] maxs, int list[], int listsize, int headnode, int topnode[]) { leaf_list = list; leaf_count = 0; leaf_maxcount = listsize; @@ -1086,22 +1085,23 @@ public class CM extends Game { CM_BoxLeafnums_r(headnode); if (topnode != null) - topnode.i = leaf_topnode; + topnode[0] = leaf_topnode; return leaf_count; } - public static int CM_BoxLeafnums(float[] mins, float[] maxs, int list[], int listsize, intwrap topnode) { + public static int CM_BoxLeafnums(float[] mins, float[] maxs, int list[], int listsize, int topnode[]) { return CM_BoxLeafnums_headnode(mins, maxs, list, listsize, map_cmodels[0].headnode, topnode); } - public static class intwrap { + /* + public static class intwrap1 { public intwrap(int i) { this.i = i; } public int i; } - + */ /* ================== CM_PointContents @@ -1539,10 +1539,10 @@ public class CM extends Game { c2[i] += 1; } - intwrap tn = new intwrap(topnode); + int tn[] = {topnode}; numleafs = CM_BoxLeafnums_headnode(c1, c2, leafs, 1024, headnode, tn); - topnode = tn.i; + topnode = tn[0]; for (i = 0; i < numleafs; i++) { CM_TestInLeaf(leafs[i]); if (trace_trace.allsolid) diff --git a/src/jake2/qcommon/CRC.java b/src/jake2/qcommon/CRC.java new file mode 100644 index 0000000..ca22d9b --- /dev/null +++ b/src/jake2/qcommon/CRC.java @@ -0,0 +1,383 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +// Created on 25.01.2004 by RST. +// $Id: CRC.java,v 1.1 2004-07-09 06:50:49 hzi Exp $ +package jake2.qcommon; + +import jake2.util.Vargs; + +public class CRC +{ + + public final static short CRC_INIT_VALUE= (short) 0xffff; + public final static short CRC_XOR_VALUE= (short) 0x0000; + + private static int crctable[]= + { + 0x0000, + 0x1021, + 0x2042, + 0x3063, + 0x4084, + 0x50a5, + 0x60c6, + 0x70e7, + 0x8108, + 0x9129, + 0xa14a, + 0xb16b, + 0xc18c, + 0xd1ad, + 0xe1ce, + 0xf1ef, + 0x1231, + 0x0210, + 0x3273, + 0x2252, + 0x52b5, + 0x4294, + 0x72f7, + 0x62d6, + 0x9339, + 0x8318, + 0xb37b, + 0xa35a, + 0xd3bd, + 0xc39c, + 0xf3ff, + 0xe3de, + 0x2462, + 0x3443, + 0x0420, + 0x1401, + 0x64e6, + 0x74c7, + 0x44a4, + 0x5485, + 0xa56a, + 0xb54b, + 0x8528, + 0x9509, + 0xe5ee, + 0xf5cf, + 0xc5ac, + 0xd58d, + 0x3653, + 0x2672, + 0x1611, + 0x0630, + 0x76d7, + 0x66f6, + 0x5695, + 0x46b4, + 0xb75b, + 0xa77a, + 0x9719, + 0x8738, + 0xf7df, + 0xe7fe, + 0xd79d, + 0xc7bc, + 0x48c4, + 0x58e5, + 0x6886, + 0x78a7, + 0x0840, + 0x1861, + 0x2802, + 0x3823, + 0xc9cc, + 0xd9ed, + 0xe98e, + 0xf9af, + 0x8948, + 0x9969, + 0xa90a, + 0xb92b, + 0x5af5, + 0x4ad4, + 0x7ab7, + 0x6a96, + 0x1a71, + 0x0a50, + 0x3a33, + 0x2a12, + 0xdbfd, + 0xcbdc, + 0xfbbf, + 0xeb9e, + 0x9b79, + 0x8b58, + 0xbb3b, + 0xab1a, + 0x6ca6, + 0x7c87, + 0x4ce4, + 0x5cc5, + 0x2c22, + 0x3c03, + 0x0c60, + 0x1c41, + 0xedae, + 0xfd8f, + 0xcdec, + 0xddcd, + 0xad2a, + 0xbd0b, + 0x8d68, + 0x9d49, + 0x7e97, + 0x6eb6, + 0x5ed5, + 0x4ef4, + 0x3e13, + 0x2e32, + 0x1e51, + 0x0e70, + 0xff9f, + 0xefbe, + 0xdfdd, + 0xcffc, + 0xbf1b, + 0xaf3a, + 0x9f59, + 0x8f78, + 0x9188, + 0x81a9, + 0xb1ca, + 0xa1eb, + 0xd10c, + 0xc12d, + 0xf14e, + 0xe16f, + 0x1080, + 0x00a1, + 0x30c2, + 0x20e3, + 0x5004, + 0x4025, + 0x7046, + 0x6067, + 0x83b9, + 0x9398, + 0xa3fb, + 0xb3da, + 0xc33d, + 0xd31c, + 0xe37f, + 0xf35e, + 0x02b1, + 0x1290, + 0x22f3, + 0x32d2, + 0x4235, + 0x5214, + 0x6277, + 0x7256, + 0xb5ea, + 0xa5cb, + 0x95a8, + 0x8589, + 0xf56e, + 0xe54f, + 0xd52c, + 0xc50d, + 0x34e2, + 0x24c3, + 0x14a0, + 0x0481, + 0x7466, + 0x6447, + 0x5424, + 0x4405, + 0xa7db, + 0xb7fa, + 0x8799, + 0x97b8, + 0xe75f, + 0xf77e, + 0xc71d, + 0xd73c, + 0x26d3, + 0x36f2, + 0x0691, + 0x16b0, + 0x6657, + 0x7676, + 0x4615, + 0x5634, + 0xd94c, + 0xc96d, + 0xf90e, + 0xe92f, + 0x99c8, + 0x89e9, + 0xb98a, + 0xa9ab, + 0x5844, + 0x4865, + 0x7806, + 0x6827, + 0x18c0, + 0x08e1, + 0x3882, + 0x28a3, + 0xcb7d, + 0xdb5c, + 0xeb3f, + 0xfb1e, + 0x8bf9, + 0x9bd8, + 0xabbb, + 0xbb9a, + 0x4a75, + 0x5a54, + 0x6a37, + 0x7a16, + 0x0af1, + 0x1ad0, + 0x2ab3, + 0x3a92, + 0xfd2e, + 0xed0f, + 0xdd6c, + 0xcd4d, + 0xbdaa, + 0xad8b, + 0x9de8, + 0x8dc9, + 0x7c26, + 0x6c07, + 0x5c64, + 0x4c45, + 0x3ca2, + 0x2c83, + 0x1ce0, + 0x0cc1, + 0xef1f, + 0xff3e, + 0xcf5d, + 0xdf7c, + 0xaf9b, + 0xbfba, + 0x8fd9, + 0x9ff8, + 0x6e17, + 0x7e36, + 0x4e55, + 0x5e74, + 0x2e93, + 0x3eb2, + 0x0ed1, + 0x1ef0 }; + + static short CRC_Block(byte start[], int count) + { + short crc= CRC_INIT_VALUE; + + int ndx= 0; + + while (count-- > 0) + crc= (short) ((crc << 8) ^ crctable[0xff & ((crc >> 8) ^ start[ndx++])]); + + return crc; + } + + public static void main(String[] args) + { + byte data[]= + { + (byte) 0x71, + (byte) 0xa9, + (byte) 0x05, + (byte) 0xce, + (byte) 0x8d, + (byte) 0x75, + (byte) 0x28, + (byte) 0xc8, + (byte) 0xba, + (byte) 0x97, + + (byte) 0x45, + (byte) 0xe9, + (byte) 0x8a, + (byte) 0xe0, + (byte) 0x37, + (byte) 0xbd, + (byte) 0x6c, + (byte) 0x6d, + (byte) 0x67, + (byte) 0x4a, + (byte) 0x21 }; + System.out.println("crc:" + (CRC_Block(data, 21) & 0xffff)); + System.out.println("----"); + for (int n=0; n < 5; n++) + System.out.println("seq:" + (Com.BlockSequenceCRCByte( data,0, 21,n*10) & 0xff)); + + } + +/* c test: + * + * D:\Rene\gamesrc\quake2-3.21\qcommon>crc + * crc=-12353 + * ---- + * seq:215 + * seq:252 + * seq:164 + * seq:202 + * seq:201 + * +int main() +{ + byte data[21] = + { + 0x71, + 0xa9, + 0x05, + 0xce, + 0x8d, + 0x75, + 0x28, + 0xc8, + 0xba, + 0x97, + + 0x45, + 0xe9, + 0x8a, + 0xe0, + 0x37, + 0xbd, + 0x6c, + 0x6d, + 0x67, + 0x4a, 0x21 }; + int n=0; + + printf("crc=%d\n", (short) CRC_Block(&data, 21)); + + printf("----\n"); + for (n=0; n < 5; n++) + printf("seq:%d\n", COM_BlockSequenceCRCByte( &data,21, n*10) ); +} + */ + +} diff --git a/src/jake2/qcommon/Com.java b/src/jake2/qcommon/Com.java index c938fdb..705a009 100644 --- a/src/jake2/qcommon/Com.java +++ b/src/jake2/qcommon/Com.java @@ -2,7 +2,7 @@ * Com.java * Copyright (C) 2003 * - * $Id: Com.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ + * $Id: Com.java,v 1.3 2004-07-09 06:50:50 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -38,15 +38,17 @@ import java.io.*; /** * Com - * TODO complete Com interface + * */ -public final class Com { - +public final class Com +{ + static int com_argc; - static String[] com_argv = new String[Defines.MAX_NUM_ARGVS]; - - public abstract static class RD_Flusher { - public abstract void rd_flush(int target, byte [] buffer); + static String[] com_argv= new String[Defines.MAX_NUM_ARGVS]; + + public abstract static class RD_Flusher + { + public abstract void rd_flush(int target, byte[] buffer); } static int rd_target; @@ -54,80 +56,95 @@ public final class Com { static int rd_buffersize; static RD_Flusher rd_flusher; - public static void BeginRedirect(int target, byte [] buffer, int buffersize, RD_Flusher flush) { + public static void BeginRedirect(int target, byte[] buffer, int buffersize, RD_Flusher flush) + { if (0 == target || null == buffer || 0 == buffersize || null == flush) return; - rd_target = target; - rd_buffer = buffer; - rd_buffersize = buffersize; - rd_flusher = flush; + rd_target= target; + rd_buffer= buffer; + rd_buffersize= buffersize; + rd_flusher= flush; - rd_buffer = null; + rd_buffer= null; } - public static void EndRedirect() { + public static void EndRedirect() + { rd_flusher.rd_flush(rd_target, rd_buffer); - rd_target = 0; - rd_buffer = null; - rd_buffersize = 0; - rd_flusher = null; + rd_target= 0; + rd_buffer= null; + rd_buffersize= 0; + rd_flusher= null; } - static boolean recursive = false; + static boolean recursive= false; - static String msg = ""; + static String msg= ""; // helper class to replace the pointer-pointer - public static class ParseHelp { + public static class ParseHelp + { - public ParseHelp(String in, int offset) { + public ParseHelp(String in, int offset) + { this(in.toCharArray(), offset); } - public ParseHelp(String in) { - if (in == null) { - data = null; + public ParseHelp(String in) + { + if (in == null) + { + data= null; } - else { - data = in.toCharArray(); + else + { + data= in.toCharArray(); } - index = 0; + index= 0; } - public ParseHelp(char in[]) { + public ParseHelp(char in[]) + { this(in, 0); } - public ParseHelp(char in[], int offset) { + public ParseHelp(char in[], int offset) + { if (in == null || in.length == 0) - data = null; + data= null; else - data = in; - index = offset; + data= in; + index= offset; } - public char getchar() { + public char getchar() + { // faster than if - try { + try + { return data[index]; } - catch (Exception e) { - data = null; + catch (Exception e) + { + data= null; // last char return 0; } } - public char nextchar() { + public char nextchar() + { // faster than if - try { + try + { index++; return data[index]; } - catch (Exception e) { - data = null; + catch (Exception e) + { + data= null; // avoid int wraps; index--; // last char @@ -135,144 +152,170 @@ public final class Com { } } - public boolean isEof() { + public boolean isEof() + { return data == null; } public int index; public char data[]; - public char skipwhites() { + public char skipwhites() + { char c; - while (((c = getchar()) <= ' ') && c != 0) + while (((c= getchar()) <= ' ') && c != 0) index++; return c; } - public char skipwhitestoeol() { + public char skipwhitestoeol() + { char c; - while (((c = getchar()) <= ' ') && c != '\n' && c != 0) + while (((c= getchar()) <= ' ') && c != '\n' && c != 0) index++; return c; } - public char skiptoeol() { + public char skiptoeol() + { char c; - while ((c = getchar()) != '\n' && c != 0) + while ((c= getchar()) != '\n' && c != 0) index++; return c; } } - public static char com_token[] = new char[Defines.MAX_TOKEN_CHARS]; + public static char com_token[]= new char[Defines.MAX_TOKEN_CHARS]; // See GameSpanw.ED_ParseEdict() to see how to use it now. // works perfect ! - public static String Parse(ParseHelp hlp) { + public static String Parse(ParseHelp hlp) + { int c; - int len = 0; - len = 0; + int len= 0; + len= 0; - com_token[0] = 0; + com_token[0]= 0; - if (hlp.data == null) { + if (hlp.data == null) + { return ""; } // skip whitespace hlp.skipwhites(); - if (hlp.isEof()) { + if (hlp.isEof()) + { return ""; } // skip // comments - if (hlp.getchar() == '/') { - if (hlp.nextchar() == '/') { - if ((hlp.skiptoeol() == 0) || (hlp.skipwhites() == 0)) { + if (hlp.getchar() == '/') + { + if (hlp.nextchar() == '/') + { + if ((hlp.skiptoeol() == 0) || (hlp.skipwhites() == 0)) + { return ""; } } - else { - com_token[len] = '/'; + else + { + com_token[len]= '/'; len++; } } // handle quoted strings specially - if (hlp.getchar() == '\"') { - while (true) { - c = hlp.nextchar(); - if (c == '\"' || c == 0) { + if (hlp.getchar() == '\"') + { + while (true) + { + c= hlp.nextchar(); + if (c == '\"' || c == 0) + { hlp.nextchar(); - com_token[len] = '?'; + com_token[len]= '?'; return new String(com_token, 0, len); } - if (len < Defines.MAX_TOKEN_CHARS) { - com_token[len] = hlp.getchar(); + if (len < Defines.MAX_TOKEN_CHARS) + { + com_token[len]= hlp.getchar(); len++; } } } // parse a regular word - do { - if (len < Defines.MAX_TOKEN_CHARS) { - com_token[len] = hlp.getchar(); + do + { + if (len < Defines.MAX_TOKEN_CHARS) + { + com_token[len]= hlp.getchar(); len++; } - c = hlp.nextchar(); + c= hlp.nextchar(); } while (c > 32); - if (len == Defines.MAX_TOKEN_CHARS) { + if (len == Defines.MAX_TOKEN_CHARS) + { Printf("Token exceeded " + Defines.MAX_TOKEN_CHARS + " chars, discarded.\n"); - len = 0; + len= 0; } // trigger the eof hlp.skipwhites(); - com_token[len] = 0; + com_token[len]= 0; return new String(com_token, 0, len); } - public static xcommand_t Error_f = new xcommand_t() { - public void execute() throws longjmpException { + public static xcommand_t Error_f= new xcommand_t() + { + public void execute() throws longjmpException + { Error(Globals.ERR_FATAL, Cmd.Argv(1)); } }; - public static void Error(int code, String fmt) throws longjmpException { + public static void Error(int code, String fmt) throws longjmpException + { Error(code, fmt, null); } - public static void Error(int code, String fmt, Vargs vargs) throws longjmpException { + public static void Error(int code, String fmt, Vargs vargs) throws longjmpException + { // va_list argptr; // static char msg[MAXPRINTMSG]; - if (recursive) { + if (recursive) + { Sys.Error("recursive error after: " + msg); } - recursive = true; + recursive= true; - msg = sprintf(fmt, vargs); + msg= sprintf(fmt, vargs); - if (code == Defines.ERR_DISCONNECT) { + if (code == Defines.ERR_DISCONNECT) + { CL.Drop(); - recursive = false; + recursive= false; throw new longjmpException(); } - else if (code == Defines.ERR_DROP) { + else if (code == Defines.ERR_DROP) + { Com.Printf("********************\nERROR: " + msg + "\n********************\n"); SV_MAIN.SV_Shutdown("Server crashed: " + msg + "\n", false); CL.Drop(); - recursive = false; + recursive= false; throw new longjmpException(); } - else { + else + { SV_MAIN.SV_Shutdown("Server fatal crashed: %s" + msg + "\n", false); CL.Shutdown(); } @@ -284,43 +327,51 @@ public final class Com { * Com_InitArgv checks the number of command line arguments * and copies all arguments with valid length into com_argv. */ - static void InitArgv(String[] args) throws longjmpException { + static void InitArgv(String[] args) throws longjmpException + { - if (args.length > Globals.MAX_NUM_ARGVS) { + if (args.length > Globals.MAX_NUM_ARGVS) + { Com.Error(Globals.ERR_FATAL, "argc > MAX_NUM_ARGVS"); } - Com.com_argc = args.length; - for (int i = 0; i < Com.com_argc; i++) { + Com.com_argc= args.length; + for (int i= 0; i < Com.com_argc; i++) + { if (args[i].length() >= Globals.MAX_TOKEN_CHARS) - Com.com_argv[i] = ""; + Com.com_argv[i]= ""; else - Com.com_argv[i] = args[i]; + Com.com_argv[i]= args[i]; } } - public static void DPrintf(String fmt) { + public static void DPrintf(String fmt) + { DPrintf(fmt, null); } - - public static void d(String fmt) { + + public static void d(String fmt) + { DPrintf(fmt + "\n", null); } - - public static void Printf(String fmt) { + + public static void Printf(String fmt) + { Printf(fmt, null); } - public static void DPrintf(String fmt, Vargs vargs) { + 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... Printf(fmt, vargs); } - public static void Printf(String fmt, Vargs vargs) { + public static void Printf(String fmt, Vargs vargs) + { // TODO Com.Printf ist nur zum testen - String msg = sprintf(fmt, vargs); + String msg= sprintf(fmt, vargs); if (rd_target != 0) { @@ -328,7 +379,7 @@ public final class Com { { rd_flusher.rd_flush(rd_target, rd_buffer); // *rd_buffer = 0; - rd_buffer[rd_buffersize] = '\0'; + rd_buffer[rd_buffersize]= '\0'; } // TODO handle rd_buffer // strcat(rd_buffer, msg); @@ -336,7 +387,7 @@ public final class Com { } Console.Print(msg); - + // also echo to debugging console Sys.ConsoleOutput(msg); @@ -344,14 +395,14 @@ public final class Com { if (Globals.logfile_active != null && Globals.logfile_active.value != 0) { String name; - + if (Globals.logfile == null) { - name = FS.Gamedir() + "/qconsole.log"; + name= FS.Gamedir() + "/qconsole.log"; if (Globals.logfile_active.value > 2) try { - Globals.logfile = new RandomAccessFile(name, "a"); + Globals.logfile= new RandomAccessFile(name, "a"); } catch (FileNotFoundException e) { @@ -361,7 +412,7 @@ public final class Com { else try { - Globals.logfile = new RandomAccessFile(name, "rw"); + Globals.logfile= new RandomAccessFile(name, "rw"); } catch (FileNotFoundException e1) { @@ -379,58 +430,68 @@ public final class Com { // TODO: do quake2 error handling! e.printStackTrace(); } - if (Globals.logfile_active.value > 1) - ; // do nothing - // fflush (logfile); // force it to save every time + if (Globals.logfile_active.value > 1); // do nothing + // fflush (logfile); // force it to save every time } } - public static void Println(String fmt) { + public static void Println(String fmt) + { Printf(fmt); Printf("\n"); } - - public static void p(String fmt) { + + public static void p(String fmt) + { Printf(fmt); Printf("\n"); } - public static String sprintf(String fmt, Vargs vargs) { - String msg = ""; - if (vargs == null || vargs.size() == 0) { - msg = fmt; + public static String sprintf(String fmt, Vargs vargs) + { + String msg= ""; + if (vargs == null || vargs.size() == 0) + { + msg= fmt; } - else { - msg = new PrintfFormat(fmt).sprintf(vargs.toArray()); + else + { + msg= new PrintfFormat(fmt).sprintf(vargs.toArray()); } return msg; } - public static int ServerState() { + public static int ServerState() + { return Globals.server_state; } - public static int Argc() { + public static int Argc() + { return Com.com_argc; } - public static String Argv(int arg) { + public static String Argv(int arg) + { if (arg < 0 || arg >= Com.com_argc || Com.com_argv[arg].length() < 1) return ""; return Com.com_argv[arg]; } - public static void ClearArgv(int arg) { + public static void ClearArgv(int arg) + { if (arg < 0 || arg >= Com.com_argc || Com.com_argv[arg].length() < 1) return; - Com.com_argv[arg] = ""; + Com.com_argv[arg]= ""; } - public static void Quit() { + public static void Quit() + { SV_MAIN.SV_Shutdown("Server quit\n", false); CL.Shutdown(); - if (Globals.logfile != null) { + if (Globals.logfile != null) + { try { Globals.logfile.close(); @@ -438,25 +499,1036 @@ public final class Com { catch (IOException e) { } - Globals.logfile = null; + Globals.logfile= null; } Sys.Quit(); } - public static void SetServerState(int i) { - Globals.server_state = i; + Globals.server_state= i; } - public static int BlockChecksum(byte[] buf, int length) { return MD4.Com_BlockChecksum(buf, length); } - public static void StripExtension(String string, String string2) { - // TODO implement! + public static void StripExtension(String string, String string2) + { + // TODO implement StripExtension } + + /** + * CRC table. + */ + + static int chktbl[]= + { + 0x84, + 0x47, + 0x51, + 0xc1, + 0x93, + 0x22, + 0x21, + 0x24, + 0x2f, + 0x66, + 0x60, + 0x4d, + 0xb0, + 0x7c, + 0xda, + 0x88, + 0x54, + 0x15, + 0x2b, + 0xc6, + 0x6c, + 0x89, + 0xc5, + 0x9d, + 0x48, + 0xee, + 0xe6, + 0x8a, + 0xb5, + 0xf4, + 0xcb, + 0xfb, + 0xf1, + 0x0c, + 0x2e, + 0xa0, + 0xd7, + 0xc9, + 0x1f, + 0xd6, + 0x06, + 0x9a, + 0x09, + 0x41, + 0x54, + 0x67, + 0x46, + 0xc7, + 0x74, + 0xe3, + 0xc8, + 0xb6, + 0x5d, + 0xa6, + 0x36, + 0xc4, + 0xab, + 0x2c, + 0x7e, + 0x85, + 0xa8, + 0xa4, + 0xa6, + 0x4d, + 0x96, + 0x19, + 0x19, + 0x9a, + 0xcc, + 0xd8, + 0xac, + 0x39, + 0x5e, + 0x3c, + 0xf2, + 0xf5, + 0x5a, + 0x72, + 0xe5, + 0xa9, + 0xd1, + 0xb3, + 0x23, + 0x82, + 0x6f, + 0x29, + 0xcb, + 0xd1, + 0xcc, + 0x71, + 0xfb, + 0xea, + 0x92, + 0xeb, + 0x1c, + 0xca, + 0x4c, + 0x70, + 0xfe, + 0x4d, + 0xc9, + 0x67, + 0x43, + 0x47, + 0x94, + 0xb9, + 0x47, + 0xbc, + 0x3f, + 0x01, + 0xab, + 0x7b, + 0xa6, + 0xe2, + 0x76, + 0xef, + 0x5a, + 0x7a, + 0x29, + 0x0b, + 0x51, + 0x54, + 0x67, + 0xd8, + 0x1c, + 0x14, + 0x3e, + 0x29, + 0xec, + 0xe9, + 0x2d, + 0x48, + 0x67, + 0xff, + 0xed, + 0x54, + 0x4f, + 0x48, + 0xc0, + 0xaa, + 0x61, + 0xf7, + 0x78, + 0x12, + 0x03, + 0x7a, + 0x9e, + 0x8b, + 0xcf, + 0x83, + 0x7b, + 0xae, + 0xca, + 0x7b, + 0xd9, + 0xe9, + 0x53, + 0x2a, + 0xeb, + 0xd2, + 0xd8, + 0xcd, + 0xa3, + 0x10, + 0x25, + 0x78, + 0x5a, + 0xb5, + 0x23, + 0x06, + 0x93, + 0xb7, + 0x84, + 0xd2, + 0xbd, + 0x96, + 0x75, + 0xa5, + 0x5e, + 0xcf, + 0x4e, + 0xe9, + 0x50, + 0xa1, + 0xe6, + 0x9d, + 0xb1, + 0xe3, + 0x85, + 0x66, + 0x28, + 0x4e, + 0x43, + 0xdc, + 0x6e, + 0xbb, + 0x33, + 0x9e, + 0xf3, + 0x0d, + 0x00, + 0xc1, + 0xcf, + 0x67, + 0x34, + 0x06, + 0x7c, + 0x71, + 0xe3, + 0x63, + 0xb7, + 0xb7, + 0xdf, + 0x92, + 0xc4, + 0xc2, + 0x25, + 0x5c, + 0xff, + 0xc3, + 0x6e, + 0xfc, + 0xaa, + 0x1e, + 0x2a, + 0x48, + 0x11, + 0x1c, + 0x36, + 0x68, + 0x78, + 0x86, + 0x79, + 0x30, + 0xc3, + 0xd6, + 0xde, + 0xbc, + 0x3a, + 0x2a, + 0x6d, + 0x1e, + 0x46, + 0xdd, + 0xe0, + 0x80, + 0x1e, + 0x44, + 0x3b, + 0x6f, + 0xaf, + 0x31, + 0xda, + 0xa2, + 0xbd, + 0x77, + 0x06, + 0x56, + 0xc0, + 0xb7, + 0x92, + 0x4b, + 0x37, + 0xc0, + 0xfc, + 0xc2, + 0xd5, + 0xfb, + 0xa8, + 0xda, + 0xf5, + 0x57, + 0xa8, + 0x18, + 0xc0, + 0xdf, + 0xe7, + 0xaa, + 0x2a, + 0xe0, + 0x7c, + 0x6f, + 0x77, + 0xb1, + 0x26, + 0xba, + 0xf9, + 0x2e, + 0x1d, + 0x16, + 0xcb, + 0xb8, + 0xa2, + 0x44, + 0xd5, + 0x2f, + 0x1a, + 0x79, + 0x74, + 0x87, + 0x4b, + 0x00, + 0xc9, + 0x4a, + 0x3a, + 0x65, + 0x8f, + 0xe6, + 0x5d, + 0xe5, + 0x0a, + 0x77, + 0xd8, + 0x1a, + 0x14, + 0x41, + 0x75, + 0xb1, + 0xe2, + 0x50, + 0x2c, + 0x93, + 0x38, + 0x2b, + 0x6d, + 0xf3, + 0xf6, + 0xdb, + 0x1f, + 0xcd, + 0xff, + 0x14, + 0x70, + 0xe7, + 0x16, + 0xe8, + 0x3d, + 0xf0, + 0xe3, + 0xbc, + 0x5e, + 0xb6, + 0x3f, + 0xcc, + 0x81, + 0x24, + 0x67, + 0xf3, + 0x97, + 0x3b, + 0xfe, + 0x3a, + 0x96, + 0x85, + 0xdf, + 0xe4, + 0x6e, + 0x3c, + 0x85, + 0x05, + 0x0e, + 0xa3, + 0x2b, + 0x07, + 0xc8, + 0xbf, + 0xe5, + 0x13, + 0x82, + 0x62, + 0x08, + 0x61, + 0x69, + 0x4b, + 0x47, + 0x62, + 0x73, + 0x44, + 0x64, + 0x8e, + 0xe2, + 0x91, + 0xa6, + 0x9a, + 0xb7, + 0xe9, + 0x04, + 0xb6, + 0x54, + 0x0c, + 0xc5, + 0xa9, + 0x47, + 0xa6, + 0xc9, + 0x08, + 0xfe, + 0x4e, + 0xa6, + 0xcc, + 0x8a, + 0x5b, + 0x90, + 0x6f, + 0x2b, + 0x3f, + 0xb6, + 0x0a, + 0x96, + 0xc0, + 0x78, + 0x58, + 0x3c, + 0x76, + 0x6d, + 0x94, + 0x1a, + 0xe4, + 0x4e, + 0xb8, + 0x38, + 0xbb, + 0xf5, + 0xeb, + 0x29, + 0xd8, + 0xb0, + 0xf3, + 0x15, + 0x1e, + 0x99, + 0x96, + 0x3c, + 0x5d, + 0x63, + 0xd5, + 0xb1, + 0xad, + 0x52, + 0xb8, + 0x55, + 0x70, + 0x75, + 0x3e, + 0x1a, + 0xd5, + 0xda, + 0xf6, + 0x7a, + 0x48, + 0x7d, + 0x44, + 0x41, + 0xf9, + 0x11, + 0xce, + 0xd7, + 0xca, + 0xa5, + 0x3d, + 0x7a, + 0x79, + 0x7e, + 0x7d, + 0x25, + 0x1b, + 0x77, + 0xbc, + 0xf7, + 0xc7, + 0x0f, + 0x84, + 0x95, + 0x10, + 0x92, + 0x67, + 0x15, + 0x11, + 0x5a, + 0x5e, + 0x41, + 0x66, + 0x0f, + 0x38, + 0x03, + 0xb2, + 0xf1, + 0x5d, + 0xf8, + 0xab, + 0xc0, + 0x02, + 0x76, + 0x84, + 0x28, + 0xf4, + 0x9d, + 0x56, + 0x46, + 0x60, + 0x20, + 0xdb, + 0x68, + 0xa7, + 0xbb, + 0xee, + 0xac, + 0x15, + 0x01, + 0x2f, + 0x20, + 0x09, + 0xdb, + 0xc0, + 0x16, + 0xa1, + 0x89, + 0xf9, + 0x94, + 0x59, + 0x00, + 0xc1, + 0x76, + 0xbf, + 0xc1, + 0x4d, + 0x5d, + 0x2d, + 0xa9, + 0x85, + 0x2c, + 0xd6, + 0xd3, + 0x14, + 0xcc, + 0x02, + 0xc3, + 0xc2, + 0xfa, + 0x6b, + 0xb7, + 0xa6, + 0xef, + 0xdd, + 0x12, + 0x26, + 0xa4, + 0x63, + 0xe3, + 0x62, + 0xbd, + 0x56, + 0x8a, + 0x52, + 0x2b, + 0xb9, + 0xdf, + 0x09, + 0xbc, + 0x0e, + 0x97, + 0xa9, + 0xb0, + 0x82, + 0x46, + 0x08, + 0xd5, + 0x1a, + 0x8e, + 0x1b, + 0xa7, + 0x90, + 0x98, + 0xb9, + 0xbb, + 0x3c, + 0x17, + 0x9a, + 0xf2, + 0x82, + 0xba, + 0x64, + 0x0a, + 0x7f, + 0xca, + 0x5a, + 0x8c, + 0x7c, + 0xd3, + 0x79, + 0x09, + 0x5b, + 0x26, + 0xbb, + 0xbd, + 0x25, + 0xdf, + 0x3d, + 0x6f, + 0x9a, + 0x8f, + 0xee, + 0x21, + 0x66, + 0xb0, + 0x8d, + 0x84, + 0x4c, + 0x91, + 0x45, + 0xd4, + 0x77, + 0x4f, + 0xb3, + 0x8c, + 0xbc, + 0xa8, + 0x99, + 0xaa, + 0x19, + 0x53, + 0x7c, + 0x02, + 0x87, + 0xbb, + 0x0b, + 0x7c, + 0x1a, + 0x2d, + 0xdf, + 0x48, + 0x44, + 0x06, + 0xd6, + 0x7d, + 0x0c, + 0x2d, + 0x35, + 0x76, + 0xae, + 0xc4, + 0x5f, + 0x71, + 0x85, + 0x97, + 0xc4, + 0x3d, + 0xef, + 0x52, + 0xbe, + 0x00, + 0xe4, + 0xcd, + 0x49, + 0xd1, + 0xd1, + 0x1c, + 0x3c, + 0xd0, + 0x1c, + 0x42, + 0xaf, + 0xd4, + 0xbd, + 0x58, + 0x34, + 0x07, + 0x32, + 0xee, + 0xb9, + 0xb5, + 0xea, + 0xff, + 0xd7, + 0x8c, + 0x0d, + 0x2e, + 0x2f, + 0xaf, + 0x87, + 0xbb, + 0xe6, + 0x52, + 0x71, + 0x22, + 0xf5, + 0x25, + 0x17, + 0xa1, + 0x82, + 0x04, + 0xc2, + 0x4a, + 0xbd, + 0x57, + 0xc6, + 0xab, + 0xc8, + 0x35, + 0x0c, + 0x3c, + 0xd9, + 0xc2, + 0x43, + 0xdb, + 0x27, + 0x92, + 0xcf, + 0xb8, + 0x25, + 0x60, + 0xfa, + 0x21, + 0x3b, + 0x04, + 0x52, + 0xc8, + 0x96, + 0xba, + 0x74, + 0xe3, + 0x67, + 0x3e, + 0x8e, + 0x8d, + 0x61, + 0x90, + 0x92, + 0x59, + 0xb6, + 0x1a, + 0x1c, + 0x5e, + 0x21, + 0xc1, + 0x65, + 0xe5, + 0xa6, + 0x34, + 0x05, + 0x6f, + 0xc5, + 0x60, + 0xb1, + 0x83, + 0xc1, + 0xd5, + 0xd5, + 0xed, + 0xd9, + 0xc7, + 0x11, + 0x7b, + 0x49, + 0x7a, + 0xf9, + 0xf9, + 0x84, + 0x47, + 0x9b, + 0xe2, + 0xa5, + 0x82, + 0xe0, + 0xc2, + 0x88, + 0xd0, + 0xb2, + 0x58, + 0x88, + 0x7f, + 0x45, + 0x09, + 0x67, + 0x74, + 0x61, + 0xbf, + 0xe6, + 0x40, + 0xe2, + 0x9d, + 0xc2, + 0x47, + 0x05, + 0x89, + 0xed, + 0xcb, + 0xbb, + 0xb7, + 0x27, + 0xe7, + 0xdc, + 0x7a, + 0xfd, + 0xbf, + 0xa8, + 0xd0, + 0xaa, + 0x10, + 0x39, + 0x3c, + 0x20, + 0xf0, + 0xd3, + 0x6e, + 0xb1, + 0x72, + 0xf8, + 0xe6, + 0x0f, + 0xef, + 0x37, + 0xe5, + 0x09, + 0x33, + 0x5a, + 0x83, + 0x43, + 0x80, + 0x4f, + 0x65, + 0x2f, + 0x7c, + 0x8c, + 0x6a, + 0xa0, + 0x82, + 0x0c, + 0xd4, + 0xd4, + 0xfa, + 0x81, + 0x60, + 0x3d, + 0xdf, + 0x06, + 0xf1, + 0x5f, + 0x08, + 0x0d, + 0x6d, + 0x43, + 0xf2, + 0xe3, + 0x11, + 0x7d, + 0x80, + 0x32, + 0xc5, + 0xfb, + 0xc5, + 0xd9, + 0x27, + 0xec, + 0xc6, + 0x4e, + 0x65, + 0x27, + 0x76, + 0x87, + 0xa6, + 0xee, + 0xee, + 0xd7, + 0x8b, + 0xd1, + 0xa0, + 0x5c, + 0xb0, + 0x42, + 0x13, + 0x0e, + 0x95, + 0x4a, + 0xf2, + 0x06, + 0xc6, + 0x43, + 0x33, + 0xf4, + 0xc7, + 0xf8, + 0xe7, + 0x1f, + 0xdd, + 0xe4, + 0x46, + 0x4a, + 0x70, + 0x39, + 0x6c, + 0xd0, + 0xed, + 0xca, + 0xbe, + 0x60, + 0x3b, + 0xd1, + 0x7b, + 0x57, + 0x48, + 0xe5, + 0x3a, + 0x79, + 0xc1, + 0x69, + 0x33, + 0x53, + 0x1b, + 0x80, + 0xb8, + 0x91, + 0x7d, + 0xb4, + 0xf6, + 0x17, + 0x1a, + 0x1d, + 0x5a, + 0x32, + 0xd6, + 0xcc, + 0x71, + 0x29, + 0x3f, + 0x28, + 0xbb, + 0xf3, + 0x5e, + 0x71, + 0xb8, + 0x43, + 0xaf, + 0xf8, + 0xb9, + 0x64, + 0xef, + 0xc4, + 0xa5, + 0x6c, + 0x08, + 0x53, + 0xc7, + 0x00, + 0x10, + 0x39, + 0x4f, + 0xdd, + 0xe4, + 0xb6, + 0x19, + 0x27, + 0xfb, + 0xb8, + 0xf5, + 0x32, + 0x73, + 0xe5, + 0xcb, + 0x32, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + static byte chkb[] = new byte [60 + 4]; + + /** + * Calculates a crc checksum-sequence over an array. + */ + public static byte BlockSequenceCRCByte(byte base[], int offset, int length, int sequence) + { + int n; + int p_ndx; + short x; + + short crc; + + if (sequence < 0) + Sys.Error("sequence < 0, this shouldn't happen\n"); + + //p_ndx = (sequence % (sizeof(chktbl) - 4)); + p_ndx = (sequence % (1024 - 4)); + + //memcpy(chkb, base, length); + System.arraycopy(base, offset , chkb, 0, Math.max(60, length)); + + chkb[length]= (byte) chktbl[p_ndx + 0]; + chkb[length + 1]= (byte) chktbl[p_ndx + 1]; + chkb[length + 2]= (byte) chktbl[p_ndx + 2]; + chkb[length + 3]= (byte) chktbl[p_ndx + 3]; + + + length += 4; + + crc = CRC.CRC_Block(chkb, length); + + for (x= 0, n= 0; n < length; n++) + x += chkb[n]; + + crc ^= x; + + return (byte)(crc & 0xFF); + } + }
\ No newline at end of file diff --git a/src/jake2/qcommon/FS.java b/src/jake2/qcommon/FS.java index 98975a6..a99ae28 100644 --- a/src/jake2/qcommon/FS.java +++ b/src/jake2/qcommon/FS.java @@ -2,7 +2,7 @@ * FS.java * Copyright (C) 2003 * - * $Id: FS.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ + * $Id: FS.java,v 1.3 2004-07-09 06:50:49 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -33,8 +33,6 @@ import jake2.sys.Sys; import java.io.*; import java.nio.ByteOrder; import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.imageio.stream.FileImageInputStream; @@ -45,8 +43,6 @@ import javax.imageio.stream.FileImageInputStream; */ public final class FS extends Globals { - private static Logger logger = Logger.getLogger(FS.class.getName()); - /* ============================================================================= @@ -120,7 +116,7 @@ public final class FS extends Globals { if (index > 0) { File f = new File(path.substring(0, index)); if (!f.mkdirs()) { - logger.log(Level.WARNING, "can't create path \"" + path + '"'); + Com.Printf("can't create path \"" + path + '"' + "\n" ); } } } @@ -448,12 +444,12 @@ public final class FS extends Globals { newfiles.put(entry.name.toLowerCase(), entry); - logger.log(Level.FINEST, i + ".\t" + entry); + //logger.log(Level.FINEST, i + ".\t" + entry); } } catch (IOException e) { - logger.log(Level.WARNING, e.toString()); + //logger.log(Level.WARNING, e.toString()); return null; } @@ -577,7 +573,7 @@ public final class FS extends Globals { fs_searchpaths.pack.handle.close(); } catch (IOException e) { - logger.log(Level.WARNING, e.toString()); + //logger.log(Level.WARNING, e.toString()); } // clear the hashtable fs_searchpaths.pack.files.clear(); diff --git a/src/jake2/qcommon/MD4.java b/src/jake2/qcommon/MD4.java index 45fdf7c..2c01f08 100644 --- a/src/jake2/qcommon/MD4.java +++ b/src/jake2/qcommon/MD4.java @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 02.02.2004 by RST. -// $Id: MD4.java,v 1.1 2004-07-07 19:59:31 hzi Exp $ +// $Id: MD4.java,v 1.2 2004-07-09 06:50:49 hzi Exp $ package jake2.qcommon; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.security.MessageDigest; import jake2.*; @@ -295,17 +296,18 @@ public class MD4 extends MessageDigest implements Cloneable { return t << s | t >>> (32 - s); } + /** + * Bugfixed, now works prima (RST). + */ public static int Com_BlockChecksum(byte[] buffer, int length) { - byte digest[] = new byte[16]; + int val; MD4 md4 = new MD4(); md4.engineUpdate(buffer, 0, length); - byte data[] = md4.engineDigest(); - Com.Printf("md4: " + Lib.hexDump(data, 16, false)); - + byte data[] = md4.engineDigest(); ByteBuffer bb = ByteBuffer.wrap(data); - //val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3]; + bb.order(ByteOrder.LITTLE_ENDIAN); val = bb.getInt() ^ bb.getInt() ^ bb.getInt() ^ bb.getInt(); return val; } diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index 3da48ca..9f653d4 100644 --- a/src/jake2/qcommon/Qcommon.java +++ b/src/jake2/qcommon/Qcommon.java @@ -2,7 +2,7 @@ * Qcommon.java * Copyright 2003 * - * $Id: Qcommon.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ + * $Id: Qcommon.java,v 1.4 2004-07-09 06:50:49 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,8 +28,6 @@ package jake2.qcommon; import jake2.Globals; import jake2.client.*; import jake2.game.Cmd; -import jake2.game.EntThinkAdapter; -import jake2.game.GamePWeapon; import jake2.game.Swap; import jake2.server.SV_MAIN; import jake2.sys.NET; @@ -47,95 +45,11 @@ public final class Qcommon extends Globals { public static final String BUILDSTRING = "Java"; public static final String CPUSTRING = "jvm"; - - /** - * This function initializes the different subsystems of - * the game engine. The setjmp/longjmp mechanism of the original - * was replaced with exceptions. - * @param args the original unmodified command line arguments - */ - public static void InitForTestMap(String[] args) { - try { - - // prepare enough of the subsystems to handle - // cvar and command buffer management - Com.InitArgv(args); - - Swap.Init(); - Cbuf.Init(); - - Cmd.Init(); - Cvar.Init(); - - Key.Init(); - - // we need to add the early commands twice, because - // a basedir or cddir needs to be set before execing - // config files, but we want other parms to override - // the settings of the config files - Cbuf.AddEarlyCommands(false); - Cbuf.Execute(); - - FS.InitFilesystem(); - - Cbuf.AddText("exec default.cfg\n"); - Cbuf.AddText("exec config.cfg\n"); - - Cbuf.AddEarlyCommands(true); - Cbuf.Execute(); - - // - // init commands and vars - // - Cmd.AddCommand("error", Com.Error_f); - - 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", "1", 0); - Globals.fixedtime= Cvar.Get("fixedtime", "0", 0); - Globals.logfile_active= Cvar.Get("logfile", "0", 0); - Globals.showtrace= Cvar.Get("showtrace", "0", 0); - Globals.dedicated= Cvar.Get("dedicated", "0", CVAR_NOSET); - - String s = Com.sprintf("%4.2f %s %s %s", - new Vargs(4) - .add(Globals.VERSION) - .add(CPUSTRING) - .add(Globals.__DATE__) - .add(BUILDSTRING)); - - Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); - - NET.NET_Init(); - Netchan.Netchan_Init(); - - SV_MAIN.SV_Init(); - CL.Init(); - - // add + commands from command line - if (!Cbuf.AddLateCommands()) { - // if the user didn't give any commands, run default action - //Cbuf.AddText("d1\n"); - Cbuf.Execute(); - } else { - // the user asked for something explicit - // so drop the loading plaque - SCR.EndLoadingPlaque(); - } - - Com.Printf("====== Quake2 Initialized ======\n\n"); - - } catch (longjmpException e) { - Sys.Error("Error during initialization"); - } - } - /** * This function initializes the different subsystems of - * the game engine. The setjmp/longjmp mechanism of the original - * was replaced with exceptions. + * the game engine. The setjmp/longjmp mechanism of the original + * was replaced with exceptions. * @param args the original unmodified command line arguments */ public static void Init(String[] args) { @@ -147,8 +61,6 @@ public final class Qcommon extends Globals { Swap.Init(); Cbuf.Init(); - //rst bugfix - //GamePWeapon xxx = new GamePWeapon(); Cmd.Init(); Cvar.Init(); diff --git a/src/jake2/qcommon/qfiles.java b/src/jake2/qcommon/qfiles.java index ae7fdf6..8e524a5 100644 --- a/src/jake2/qcommon/qfiles.java +++ b/src/jake2/qcommon/qfiles.java @@ -2,7 +2,7 @@ * qfiles.java * Copyright (C) 2003 * - * $Id: qfiles.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ + * $Id: qfiles.java,v 1.4 2004-07-09 06:50:50 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,14 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.qcommon; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; +import jake2.Defines; -import jake2.*; -import jake2.client.*; -import jake2.game.*; -import jake2.render.*; -import jake2.server.*; +import java.nio.*; /** * qfiles @@ -292,6 +287,14 @@ public class qfiles { ofs_glcmds = b.getInt(); ofs_end = b.getInt(); // end of file } + + /* + * new members for vertex array handling + */ + public FloatBuffer textureCoordBuf = null; + public IntBuffer vertexIndexBuf = null; + public int[] counts = null; + public IntBuffer[] indexElements = null; } /* |