diff options
author | Holger Zickner <[email protected]> | 2004-07-08 20:24:48 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-07-08 20:24:48 +0000 |
commit | 252832999fa43bce63ca4b643fab5d9dd51fccc4 (patch) | |
tree | 98570c65819059d14f0809ae964aa1c6c93684a0 /src/jake2/qcommon | |
parent | 4f13ea26c4f47e54e66926f0700cf631e7bb3352 (diff) |
import of Jake2 version cebit
Diffstat (limited to 'src/jake2/qcommon')
-rw-r--r-- | src/jake2/qcommon/MSG.java | 16 | ||||
-rw-r--r-- | src/jake2/qcommon/Qcommon.java | 7 | ||||
-rw-r--r-- | src/jake2/qcommon/qfiles.java | 48 |
3 files changed, 51 insertions, 20 deletions
diff --git a/src/jake2/qcommon/MSG.java b/src/jake2/qcommon/MSG.java index 3d18798..36b1467 100644 --- a/src/jake2/qcommon/MSG.java +++ b/src/jake2/qcommon/MSG.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 29.11.2003 by RST. -// $Id: MSG.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ +// $Id: MSG.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ package jake2.qcommon; @@ -34,9 +34,6 @@ public class MSG extends GameBase { //ok. public static void WriteChar(sizebuf_t sb, int c) { -// if (c < -128 || c > 127) -// Com.Error(ERR_FATAL, "WriteChar: range error"); - sb.data[SZ.GetSpace(sb, 1)] = (byte) (c & 0xFF); } @@ -48,11 +45,6 @@ public class MSG extends GameBase { //ok. public static void WriteByte(sizebuf_t sb, int c) { - byte buf; - - //if (c < 0 || c > 255) - //Com.Error(ERR_FATAL, "WriteByte: range error"); - sb.data[SZ.GetSpace(sb, 1)] = (byte) (c & 0xFF); } @@ -63,11 +55,6 @@ public class MSG extends GameBase { public static void WriteShort(sizebuf_t sb, int c) { - - // TODO brauchen wir nicht (cwei) - // if (c < -32768 || c > 32767) - // Com.Error(ERR_FATAL, "WriteShort: range error"); - int i = SZ.GetSpace(sb, 2); sb.data[i++] = (byte) (c & 0xff); sb.data[i] = (byte) ((c >>> 8) & 0xFF); @@ -75,7 +62,6 @@ public class MSG extends GameBase { //ok. public static void WriteInt(sizebuf_t sb, int c) { - int i = SZ.GetSpace(sb, 4); sb.data[i++] = (byte) ((c & 0xff)); sb.data[i++] = (byte) ((c >>> 8) & 0xff); diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index bf7771c..3da48ca 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.2 2004-07-08 15:58:46 hzi Exp $ + * $Id: Qcommon.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -110,13 +110,13 @@ public final class Qcommon extends Globals { NET.NET_Init(); Netchan.Netchan_Init(); - //SV_MAIN.SV_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.AddText("d1\n"); Cbuf.Execute(); } else { // the user asked for something explicit @@ -183,7 +183,6 @@ public final class Qcommon extends Globals { Globals.logfile_active= Cvar.Get("logfile", "0", 0); Globals.showtrace= Cvar.Get("showtrace", "0", 0); Globals.dedicated= Cvar.Get("dedicated", "0", CVAR_NOSET); - Globals.slomo= Cvar.Get("slomo", "1", 0); String s = Com.sprintf("%4.2f %s %s %s", new Vargs(4) .add(Globals.VERSION) diff --git a/src/jake2/qcommon/qfiles.java b/src/jake2/qcommon/qfiles.java index bda2233..ae7fdf6 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.2 2004-07-08 15:58:46 hzi Exp $ + * $Id: qfiles.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -114,6 +114,52 @@ public class qfiles { /* ======================================================================== + TGA files are used for sky planes + + ======================================================================== + */ + public static class tga_t { + + // targa header + public int id_length, colormap_type, image_type; // unsigned char + public int colormap_index, colormap_length; // unsigned short + public int colormap_size; // unsigned char + public int x_origin, y_origin, width, height; // unsigned short + public int pixel_size, attributes; // unsigned char + + public ByteBuffer data; // (un)compressed data + + public tga_t(byte[] dataBytes) { + this(ByteBuffer.wrap(dataBytes)); + } + + public tga_t(ByteBuffer b) { + // is stored as little endian + b.order(ByteOrder.LITTLE_ENDIAN); + + // fill header + id_length = b.get() & 0xFF; + colormap_type = b.get() & 0xFF; + image_type = b.get() & 0xFF; + colormap_index = b.getShort() & 0xFFFF; + colormap_length = b.getShort() & 0xFFFF; + colormap_size = b.get() & 0xFF; + x_origin = b.getShort() & 0xFFFF; + y_origin = b.getShort() & 0xFFFF; + width = b.getShort() & 0xFFFF; + height = b.getShort() & 0xFFFF; + pixel_size = b.get() & 0xFF; + attributes = b.get() & 0xFF; + + // fill data + data = b.slice(); + } + + } + + /* + ======================================================================== + .MD2 triangle model file format ======================================================================== |