aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jake2/Globals.java4
-rw-r--r--src/jake2/client/CL.java17
-rw-r--r--src/jake2/game/Swap.java46
-rw-r--r--src/jake2/qcommon/Qcommon.java4
4 files changed, 12 insertions, 59 deletions
diff --git a/src/jake2/Globals.java b/src/jake2/Globals.java
index 32771bf..c0530a4 100644
--- a/src/jake2/Globals.java
+++ b/src/jake2/Globals.java
@@ -2,7 +2,7 @@
* Globals.java
* Copyright (C) 2003
*
- * $Id: Globals.java,v 1.3 2004-07-08 20:24:48 hzi Exp $
+ * $Id: Globals.java,v 1.4 2004-08-18 20:27:36 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -128,8 +128,6 @@ public class Globals extends Defines {
public static FileWriter log_stats_file = null;
- public static EndianHandler endian = null;
-
public static cvar_t m_pitch;
public static cvar_t m_yaw;
public static cvar_t m_forward;
diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java
index b1231f8..25d8ab6 100644
--- a/src/jake2/client/CL.java
+++ b/src/jake2/client/CL.java
@@ -2,7 +2,7 @@
* CL.java
* Copyright (C) 2004
*
- * $Id: CL.java,v 1.6 2004-07-30 06:03:40 hzi Exp $
+ * $Id: CL.java,v 1.7 2004-08-18 20:27:35 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -37,6 +37,7 @@ import jake2.util.Vargs;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
/**
* CL
@@ -948,7 +949,9 @@ public final class CL extends CL_pred {
continue; // couldn't load it
}
ByteBuffer bb = ByteBuffer.wrap(precache_model);
- int header = Globals.endian.LittleLong(bb.getInt());
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+
+ int header = bb.getInt();
if (header != qfiles.IDALIASHEADER) {
// not an alias model
@@ -958,17 +961,17 @@ public final class CL extends CL_pred {
precache_check++;
continue;
}
- pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model));
- if (Globals.endian.LittleLong(pheader.version) != ALIAS_VERSION) {
+ pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model).order(ByteOrder.LITTLE_ENDIAN));
+ if (pheader.version != ALIAS_VERSION) {
precache_check++;
precache_model_skin = 0;
continue; // couldn't load it
}
}
- pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model));
+ pheader = new qfiles.dmdl_t(ByteBuffer.wrap(precache_model).order(ByteOrder.LITTLE_ENDIAN));
- int num_skins = Globals.endian.LittleLong(pheader.num_skins);
+ int num_skins = pheader.num_skins;
while (precache_model_skin - 1 < num_skins) {
Com.Printf("critical code section because of endian mess!");
@@ -976,7 +979,7 @@ public final class CL extends CL_pred {
String name =
new String(
precache_model,
- Globals.endian.LittleLong(pheader.ofs_skins) + (precache_model_skin - 1) * MAX_SKINNAME,
+ pheader.ofs_skins + (precache_model_skin - 1) * MAX_SKINNAME,
MAX_SKINNAME * num_skins);
if (!CheckOrDownloadFile(name)) {
diff --git a/src/jake2/game/Swap.java b/src/jake2/game/Swap.java
deleted file mode 100644
index 3a074b1..0000000
--- a/src/jake2/game/Swap.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Swap.java
- * Copyright (C) 2003
- *
- * $Id: Swap.java,v 1.1 2004-07-07 19:59:24 hzi Exp $
- */
-/*
-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.
-
-*/
-package jake2.game;
-
-import java.nio.ByteOrder;
-
-import jake2.Globals;
-
-/**
- * Swap
- */
-public final class Swap {
-
- public static void Init() {
- // set the byte swapping variables in a portable manner
- if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
- Globals.endian= new BigEndianHandler();
- } else {
- Globals.endian= new LittleEndianHandler();
- }
- }
-
-}
diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java
index 9f653d4..e11b06d 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.4 2004-07-09 06:50:49 hzi Exp $
+ * $Id: Qcommon.java,v 1.5 2004-08-18 20:27:36 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -28,7 +28,6 @@ package jake2.qcommon;
import jake2.Globals;
import jake2.client.*;
import jake2.game.Cmd;
-import jake2.game.Swap;
import jake2.server.SV_MAIN;
import jake2.sys.NET;
import jake2.sys.Sys;
@@ -59,7 +58,6 @@ public final class Qcommon extends Globals {
// cvar and command buffer management
Com.InitArgv(args);
- Swap.Init();
Cbuf.Init();
Cmd.Init();