diff options
29 files changed, 508 insertions, 1021 deletions
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java index 6ef8f1c..59c9252 100644 --- a/src/jake2/client/VID.java +++ b/src/jake2/client/VID.java @@ -2,7 +2,7 @@ * VID.java * Copyright (C) 2003 * - * $Id: VID.java,v 1.7 2004-07-15 16:16:24 hzi Exp $ + * $Id: VID.java,v 1.8 2004-07-16 10:11:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,7 +31,7 @@ import jake2.game.Cmd; import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.render.Renderer; -import jake2.sound.*; +import jake2.sound.S; import jake2.sys.IN; import jake2.sys.KBD; import jake2.util.Vargs; @@ -78,6 +78,10 @@ public class VID extends Globals { ========================================================================== */ + public static void Printf(int print_level, String fmt) { + Printf(print_level, fmt, null); + } + public static void Printf(int print_level, String fmt, Vargs vargs) { // static qboolean inupdate; if (print_level == Defines.PRINT_ALL) @@ -188,85 +192,7 @@ public class VID extends Globals { } Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); - refimport_t ri = new refimport_t() { - public void Sys_Error(int err_level, String str) { - Com.Error(err_level, str, null); - } - - public void Sys_Error(int err_level, String str, Vargs vargs) { - Com.Error(err_level, str, vargs); - } - - public void Cmd_AddCommand(String name, xcommand_t cmd) { - Cmd.AddCommand(name, cmd); - } - - public void Cmd_RemoveCommand(String name) { - Cmd.RemoveCommand(name); - } - - public int Cmd_Argc() { - return Cmd.Argc(); - } - - public String Cmd_Argv(int i) { - return Cmd.Argv(i); - } - - public void Cmd_ExecuteText(int exec_when, String text) { - Cbuf.ExecuteText(exec_when, text); - } - - public void Con_Printf(int print_level, String str) { - VID.Printf(print_level, str, null); - } - - public void Con_Printf(int print_level, String str, Vargs vargs) { - VID.Printf(print_level, str, vargs); - } - - public byte[] FS_LoadFile(String name) { - return FS.LoadFile(name); - } - - public int FS_FileLength(String name) { - return FS.FileLength(name); - } - - public void FS_FreeFile(byte[] buf) { - FS.FreeFile(buf); - } - - public String FS_Gamedir() { - return FS.Gamedir(); - } - - public cvar_t Cvar_Get(String name, String value, int flags) { - return Cvar.Get(name, value, flags); - } - - public cvar_t Cvar_Set(String name, String value) { - return Cvar.Set(name, value); - } - - public void Cvar_SetValue(String name, float value) { - Cvar.SetValue(name, value); - } - - public boolean Vid_GetModeInfo(Dimension dim, int mode) { - return VID.GetModeInfo(dim, mode); - } - - public void Vid_MenuInit() { - VID.MenuInit(); - } - - public void Vid_NewWindow(int width, int height) { - VID.NewWindow(width, height); - } - }; - - Globals.re = Renderer.getDriver( name, ri ); + Globals.re = Renderer.getDriver(name); if (Globals.re == null) { diff --git a/src/jake2/client/refimport_t.java b/src/jake2/client/refimport_t.java deleted file mode 100644 index 849b143..0000000 --- a/src/jake2/client/refimport_t.java +++ /dev/null @@ -1,70 +0,0 @@ -/* -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 20.11.2003 by RST. -// $Id: refimport_t.java,v 1.2 2004-07-08 20:24:29 hzi Exp $ - - -package jake2.client; - -import java.awt.Dimension; - -import jake2.game.*; -import jake2.qcommon.xcommand_t; -import jake2.util.Vargs; - -public interface refimport_t { - // ref.h - // these are the functions imported by the refresh module - // - void Sys_Error(int err_level, String str); - void Sys_Error(int err_level, String str, Vargs vargs); - - void Cmd_AddCommand(String name, xcommand_t cmd); - void Cmd_RemoveCommand(String name); - int Cmd_Argc(); - String Cmd_Argv(int i); - void Cmd_ExecuteText(int exec_when, String text); - - void Con_Printf(int print_level, String str, Vargs vargs); - - void Con_Printf(int print_level, String str); - - // files will be memory mapped read only - // the returned buffer may be part of a larger pak file, - // or a discrete file from anywhere in the quake search path - // a -1 return means the file does not exist - // NULL can be passed for buf to just determine existance - byte[] FS_LoadFile(String name); - int FS_FileLength(String name); - - void FS_FreeFile(byte[] buf); - // gamedir will be the current directory that generated - // files should be stored to, ie: "f:\quake\id1" - String FS_Gamedir(); - - cvar_t Cvar_Get(String name, String value, int flags); - cvar_t Cvar_Set(String name, String value); - void Cvar_SetValue(String name, float value); - - boolean Vid_GetModeInfo(Dimension dim /* int *w, *h */, int mode); - void Vid_MenuInit(); - void Vid_NewWindow(int width, int height); -}
\ No newline at end of file diff --git a/src/jake2/render/FastJoglRenderer.java b/src/jake2/render/FastJoglRenderer.java index 56ab03b..e333c10 100644 --- a/src/jake2/render/FastJoglRenderer.java +++ b/src/jake2/render/FastJoglRenderer.java @@ -2,7 +2,7 @@ * FastJoglRenderer.java * Copyright (C) 2003 * - * $Id: FastJoglRenderer.java,v 1.2 2004-07-15 14:37:35 hzi Exp $ + * $Id: FastJoglRenderer.java,v 1.3 2004-07-16 10:11:34 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -300,8 +300,7 @@ final class FastJoglRenderer extends Misc implements refexport_t, Ref { return DRIVER_NAME; } - public refexport_t GetRefAPI(refimport_t rimp) { - this.ri = rimp; + public refexport_t GetRefAPI() { return this; } diff --git a/src/jake2/render/JoglBase.java b/src/jake2/render/JoglBase.java index 7c8cde1..113cd28 100644 --- a/src/jake2/render/JoglBase.java +++ b/src/jake2/render/JoglBase.java @@ -2,7 +2,7 @@ * JoglCommon.java * Copyright (C) 2004 * - * $Id: JoglBase.java,v 1.3 2004-07-15 16:33:24 hzi Exp $ + * $Id: JoglBase.java,v 1.4 2004-07-16 10:11:34 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render; import jake2.Defines; -import jake2.client.refimport_t; -import jake2.client.viddef_t; +import jake2.client.*; import jake2.game.cvar_t; +import jake2.qcommon.Cbuf; import jake2.qcommon.xcommand_t; import jake2.sys.KBD; @@ -49,8 +49,6 @@ import net.java.games.jogl.util.GLUT; public abstract class JoglBase implements GLEventListener { // IMPORTED FUNCTIONS - protected refimport_t ri = null; - protected GraphicsDevice device; protected DisplayMode oldDisplayMode; protected GLCanvas canvas; @@ -80,7 +78,7 @@ public abstract class JoglBase implements GLEventListener { // check the post init process // if (!post_init) { - ri.Con_Printf(Defines.PRINT_ALL, "Missing multi-texturing for FastJOGL renderer\n"); + VID.Printf(Defines.PRINT_ALL, "Missing multi-texturing for FastJOGL renderer\n"); } GLimp_EndFrame(); @@ -169,9 +167,9 @@ public abstract class JoglBase implements GLEventListener { Dimension newDim = new Dimension(); - ri.Con_Printf(Defines.PRINT_ALL, "Initializing OpenGL display\n"); + VID.Printf(Defines.PRINT_ALL, "Initializing OpenGL display\n"); - ri.Con_Printf(Defines.PRINT_ALL, "...setting mode " + mode + ":"); + VID.Printf(Defines.PRINT_ALL, "...setting mode " + mode + ":"); /* * fullscreen handling @@ -183,12 +181,12 @@ public abstract class JoglBase implements GLEventListener { oldDisplayMode = device.getDisplayMode(); } - if (!ri.Vid_GetModeInfo(newDim, mode)) { - ri.Con_Printf(Defines.PRINT_ALL, " invalid mode\n"); + if (!VID.GetModeInfo(newDim, mode)) { + VID.Printf(Defines.PRINT_ALL, " invalid mode\n"); return rserr_invalid_mode; } - ri.Con_Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); + VID.Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); // destroy the existing window GLimp_Shutdown(); @@ -210,7 +208,7 @@ public abstract class JoglBase implements GLEventListener { // register event listener window.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - ri.Cmd_ExecuteText(Defines.EXEC_APPEND, "quit"); + Cbuf.ExecuteText(Defines.EXEC_APPEND, "quit"); } }); @@ -238,7 +236,7 @@ public abstract class JoglBase implements GLEventListener { window.setSize(displayMode.getWidth(), displayMode.getHeight()); canvas.setSize(displayMode.getWidth(), displayMode.getHeight()); - ri.Con_Printf(Defines.PRINT_ALL, "...setting fullscreen " + getModeString(displayMode) + '\n'); + VID.Printf(Defines.PRINT_ALL, "...setting fullscreen " + getModeString(displayMode) + '\n'); } else { window.setLocation(window_xpos, window_ypos); @@ -260,7 +258,7 @@ public abstract class JoglBase implements GLEventListener { vid.height = newDim.height; // let the sound and input subsystems know about the new window - ri.Vid_NewWindow(vid.width, vid.height); + VID.NewWindow(vid.width, vid.height); return rserr_ok; } diff --git a/src/jake2/render/JoglRenderer.java b/src/jake2/render/JoglRenderer.java index 6e0926b..4aa619d 100644 --- a/src/jake2/render/JoglRenderer.java +++ b/src/jake2/render/JoglRenderer.java @@ -2,7 +2,7 @@ * JoglRenderer.java * Copyright (C) 2003 * - * $Id: JoglRenderer.java,v 1.4 2004-07-15 14:37:35 hzi Exp $ + * $Id: JoglRenderer.java,v 1.5 2004-07-16 10:11:34 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -298,8 +298,7 @@ final class JoglRenderer extends Misc implements refexport_t, Ref { return DRIVER_NAME; } - public refexport_t GetRefAPI(refimport_t rimp) { - this.ri = rimp; + public refexport_t GetRefAPI() { return this; } }
\ No newline at end of file diff --git a/src/jake2/render/Ref.java b/src/jake2/render/Ref.java index f5818c7..568f709 100644 --- a/src/jake2/render/Ref.java +++ b/src/jake2/render/Ref.java @@ -2,7 +2,7 @@ * Ref.java * Copyright (C) 2003 * - * $Id: Ref.java,v 1.1 2004-07-07 19:59:34 hzi Exp $ + * $Id: Ref.java,v 1.2 2004-07-16 10:11:34 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render; import jake2.client.refexport_t; -import jake2.client.refimport_t; /** * Ref @@ -38,6 +37,6 @@ public interface Ref { // ============================================================================ // extensions (cwei) // ============================================================================ - refexport_t GetRefAPI(refimport_t rimp); + refexport_t GetRefAPI(); String getName(); } diff --git a/src/jake2/render/Renderer.java b/src/jake2/render/Renderer.java index 55d985c..7c3cdbb 100644 --- a/src/jake2/render/Renderer.java +++ b/src/jake2/render/Renderer.java @@ -2,7 +2,7 @@ * Renderer.java * Copyright (C) 2003 * - * $Id: Renderer.java,v 1.2 2004-07-09 06:50:47 hzi Exp $ + * $Id: Renderer.java,v 1.3 2004-07-16 10:11:34 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,7 +28,6 @@ package jake2.render; import java.util.Vector; import jake2.client.refexport_t; -import jake2.client.refimport_t; /** * Renderer @@ -65,16 +64,14 @@ public class Renderer { * Factory method to get the Renderer implementation. * @return refexport_t (Renderer singleton) */ - public static refexport_t getDriver(String driverName, refimport_t rimp) { - if (rimp == null) - throw new IllegalArgumentException("refimport_t can't be null"); + public static refexport_t getDriver(String driverName) { // find a driver Ref driver = null; int count = drivers.size(); for (int i = 0; i < count; i++) { driver = (Ref) drivers.get(i); if (driver.getName().equals(driverName)) { - return driver.GetRefAPI(rimp); + return driver.GetRefAPI(); } } // null if driver not found diff --git a/src/jake2/render/fastjogl/Draw.java b/src/jake2/render/fastjogl/Draw.java index 0309dba..3098697 100644 --- a/src/jake2/render/fastjogl/Draw.java +++ b/src/jake2/render/fastjogl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.2 2004-07-15 14:37:33 hzi Exp $ + * $Id: Draw.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.fastjogl; import jake2.Defines; +import jake2.client.VID; +import jake2.qcommon.Com; import jake2.render.image_t; import java.awt.Dimension; @@ -136,7 +138,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); + VID.Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); return; } @@ -175,7 +177,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); + VID.Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); return; } if (scrap_dirty) @@ -215,7 +217,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); + VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } @@ -249,7 +251,7 @@ public abstract class Draw extends Image { protected void Draw_Fill(int x, int y, int w, int h, int colorIndex) { if ( colorIndex > 255) - ri.Sys_Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); + Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); gl.glDisable(GL.GL_TEXTURE_2D); diff --git a/src/jake2/render/fastjogl/Image.java b/src/jake2/render/fastjogl/Image.java index 1f80af0..a6b1a91 100644 --- a/src/jake2/render/fastjogl/Image.java +++ b/src/jake2/render/fastjogl/Image.java @@ -2,7 +2,7 @@ * Image.java * Copyright (C) 2003 * - * $Id: Image.java,v 1.3 2004-07-12 22:08:02 hzi Exp $ + * $Id: Image.java,v 1.4 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,8 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.fastjogl; import jake2.Defines; +import jake2.client.VID; import jake2.client.particle_t; import jake2.game.cvar_t; +import jake2.qcommon.*; import jake2.qcommon.longjmpException; import jake2.qcommon.qfiles; import jake2.render.image_t; @@ -245,7 +247,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); return; } @@ -279,7 +281,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_ALPHA_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); return; } @@ -299,7 +301,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_SOLID_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); return; } @@ -317,7 +319,7 @@ public abstract class Image extends Main { int texels; final String[] palstrings = { "RGB", "PAL" }; - ri.Con_Printf(Defines.PRINT_ALL, "------------------\n"); + VID.Printf(Defines.PRINT_ALL, "------------------\n"); texels = 0; for (int i = 0; i < numgltextures; i++) { @@ -328,29 +330,29 @@ public abstract class Image extends Main { texels += image.upload_width * image.upload_height; switch (image.type) { case it_skin : - ri.Con_Printf(Defines.PRINT_ALL, "M"); + VID.Printf(Defines.PRINT_ALL, "M"); break; case it_sprite : - ri.Con_Printf(Defines.PRINT_ALL, "S"); + VID.Printf(Defines.PRINT_ALL, "S"); break; case it_wall : - ri.Con_Printf(Defines.PRINT_ALL, "W"); + VID.Printf(Defines.PRINT_ALL, "W"); break; case it_pic : - ri.Con_Printf(Defines.PRINT_ALL, "P"); + VID.Printf(Defines.PRINT_ALL, "P"); break; default : - ri.Con_Printf(Defines.PRINT_ALL, " "); + VID.Printf(Defines.PRINT_ALL, " "); break; } - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, " %3i %3i %s: %s\n", new Vargs(4).add(image.upload_width).add(image.upload_height).add(palstrings[(image.paletted) ? 1 : 0]).add( image.name)); } - ri.Con_Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); + VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); } /* @@ -446,10 +448,10 @@ public abstract class Image extends Main { // // load the file // - byte[] raw = ri.FS_LoadFile(filename); + byte[] raw = FS.LoadFile(filename); if (raw == null) { - ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); + VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); return null; } @@ -465,7 +467,7 @@ public abstract class Image extends Main { || pcx.xmax >= 640 || pcx.ymax >= 480) { - ri.Con_Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); + VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); return null; } @@ -541,21 +543,21 @@ public abstract class Image extends Main { // // load the file // - raw = ri.FS_LoadFile (name); + raw = FS.LoadFile(name); if (raw == null) { - ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); + VID.Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); return null; } targa_header = new qfiles.tga_t(raw); if (targa_header.image_type != 2 && targa_header.image_type != 10) - ri.Sys_Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); + Com.Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24)) - ri.Sys_Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); + Com.Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); columns = targa_header.width; rows = targa_header.height; @@ -1088,7 +1090,7 @@ public abstract class Image extends Main { upload_height = scaled_height; if (scaled_width * scaled_height > 256 * 256) - ri.Sys_Error(Defines.ERR_DROP, "GL_Upload32: too big"); + Com.Error(Defines.ERR_DROP, "GL_Upload32: too big"); // scan the texture for any non-255 alpha c = width * height; @@ -1106,7 +1108,7 @@ public abstract class Image extends Main { else if (samples == gl_alpha_format) comp = gl_tex_alpha_format; else { - ri.Con_Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); + VID.Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); comp = samples; } @@ -1248,7 +1250,7 @@ public abstract class Image extends Main { int s = width * height; if (s > trans.length) - ri.Sys_Error(Defines.ERR_DROP, "GL_Upload8: too large"); + Com.Error(Defines.ERR_DROP, "GL_Upload8: too large"); if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) { gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL.GL_COLOR_INDEX, GL.GL_UNSIGNED_BYTE, data); @@ -1315,14 +1317,14 @@ public abstract class Image extends Main { if (i == numgltextures) { if (numgltextures == MAX_GLTEXTURES) - ri.Sys_Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); + Com.Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); numgltextures++; } image = gltextures[i]; if (name.length() > Defines.MAX_QPATH) - ri.Sys_Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); + Com.Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); image.name = name; image.registration_sequence = registration_sequence; @@ -1438,9 +1440,9 @@ public abstract class Image extends Main { image_t image = null; - byte[] raw = ri.FS_LoadFile(name); + byte[] raw = FS.LoadFile(name); if (raw == null) { - ri.Con_Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); return r_notexture; } @@ -1472,8 +1474,8 @@ public abstract class Image extends Main { name = name.substring(0, index); if (name == null || name.length() < 5) - return null; // ri.Sys_Error (ERR_DROP, "GL_FindImage: NULL name"); - // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad name: %s", name); + return null; // Com.Error (ERR_DROP, "GL_FindImage: NULL name"); + // Com.Error (ERR_DROP, "GL_FindImage: bad name: %s", name); // look for it for (int i = 0; i < numgltextures; i++) @@ -1581,7 +1583,7 @@ public abstract class Image extends Main { pic = LoadPCX("pics/colormap.pcx", palette, dim = new Dimension()); if (palette[0] == null || palette[0].length != 768) - ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); + Com.Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); byte[] pal = palette[0]; @@ -1611,19 +1613,19 @@ public abstract class Image extends Main { registration_sequence = 1; // init intensity conversions - intensity = ri.Cvar_Get("intensity", "2", 0); + intensity = Cvar.Get("intensity", "2", 0); if (intensity.value <= 1) - ri.Cvar_Set("intensity", "1"); + Cvar.Set("intensity", "1"); gl_state.inverse_intensity = 1 / intensity.value; Draw_GetPalette(); if (qglColorTableEXT) { - gl_state.d_16to8table = ri.FS_LoadFile("pics/16to8.dat"); + gl_state.d_16to8table = FS.LoadFile("pics/16to8.dat"); if (gl_state.d_16to8table == null) - ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); + Com.Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); } if ((gl_config.renderer & (GL_RENDERER_VOODOO | GL_RENDERER_VOODOO2)) != 0) { diff --git a/src/jake2/render/fastjogl/Light.java b/src/jake2/render/fastjogl/Light.java index a9e64a5..5e7cce5 100644 --- a/src/jake2/render/fastjogl/Light.java +++ b/src/jake2/render/fastjogl/Light.java @@ -2,7 +2,7 @@ * Light.java * Copyright (C) 2003 * - * $Id: Light.java,v 1.4 2004-07-12 22:08:02 hzi Exp $ + * $Id: Light.java,v 1.5 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,6 +30,7 @@ import jake2.Globals; import jake2.client.dlight_t; import jake2.game.GameBase; import jake2.game.cplane_t; +import jake2.qcommon.Com; import jake2.qcommon.longjmpException; import jake2.render.*; import jake2.util.Math3D; @@ -491,13 +492,13 @@ public abstract class Light extends Warp { //lightstyle_t style; if ( (surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0 ) - ri.Sys_Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); + Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); int smax = (surf.extents[0] >> 4) + 1; int tmax = (surf.extents[1] >> 4) + 1; int size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4) ) - ri.Sys_Error(Defines.ERR_DROP, "Bad s_blocklights size"); + Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data diff --git a/src/jake2/render/fastjogl/Main.java b/src/jake2/render/fastjogl/Main.java index 4e32817..bcc4e92 100644 --- a/src/jake2/render/fastjogl/Main.java +++ b/src/jake2/render/fastjogl/Main.java @@ -2,7 +2,7 @@ * Main.java * Copyright (C) 2003 * - * $Id: Main.java,v 1.2 2004-07-15 14:37:33 hzi Exp $ + * $Id: Main.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,8 +28,10 @@ package jake2.render.fastjogl; import jake2.Defines; import jake2.Globals; import jake2.client.*; +import jake2.game.*; import jake2.game.cplane_t; import jake2.game.cvar_t; +import jake2.qcommon.*; import jake2.qcommon.qfiles; import jake2.qcommon.xcommand_t; import jake2.render.*; @@ -420,7 +422,7 @@ public abstract class Main extends Base { R_DrawSpriteModel(currententity); break; default : - ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); + Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } @@ -454,7 +456,7 @@ public abstract class Main extends Base { R_DrawSpriteModel(currententity); break; default : - ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); + Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } @@ -826,11 +828,11 @@ public abstract class Main extends Base { // included by cwei if (r_newrefdef == null) { - ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); + Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); } if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) - ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); + Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); if (r_speeds.value != 0.0f) { c_brush_polys = 0; @@ -863,7 +865,7 @@ public abstract class Main extends Base { R_Flash(); if (r_speeds.value != 0.0f) { - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", new Vargs(4).add(c_brush_polys).add(c_alias_polys).add(c_visible_textures).add(c_visible_lightmaps)); @@ -930,90 +932,90 @@ public abstract class Main extends Base { } protected void R_Register() { - r_lefthand = ri.Cvar_Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); - r_norefresh = ri.Cvar_Get("r_norefresh", "0", 0); - r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0); - r_drawentities = ri.Cvar_Get("r_drawentities", "1", 0); - r_drawworld = ri.Cvar_Get("r_drawworld", "1", 0); - r_novis = ri.Cvar_Get("r_novis", "0", 0); - r_nocull = ri.Cvar_Get("r_nocull", "0", 0); - r_lerpmodels = ri.Cvar_Get("r_lerpmodels", "1", 0); - r_speeds = ri.Cvar_Get("r_speeds", "0", 0); - - r_lightlevel = ri.Cvar_Get("r_lightlevel", "1", 0); - - gl_nosubimage = ri.Cvar_Get("gl_nosubimage", "0", 0); - gl_allow_software = ri.Cvar_Get("gl_allow_software", "0", 0); - - gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); - gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); - gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); - gl_particle_att_a = ri.Cvar_Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); - gl_particle_att_b = ri.Cvar_Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); - gl_particle_att_c = ri.Cvar_Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); - - gl_modulate = ri.Cvar_Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); - gl_log = ri.Cvar_Get("gl_log", "0", 0); - gl_bitdepth = ri.Cvar_Get("gl_bitdepth", "0", 0); - gl_mode = ri.Cvar_Get("gl_mode", "3", Globals.CVAR_ARCHIVE); // 640x480 - gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); - gl_shadows = ri.Cvar_Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); - gl_dynamic = ri.Cvar_Get("gl_dynamic", "1", 0); - gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); - gl_round_down = ri.Cvar_Get("gl_round_down", "1", 0); - gl_picmip = ri.Cvar_Get("gl_picmip", "0", 0); - gl_skymip = ri.Cvar_Get("gl_skymip", "0", 0); - gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0); - gl_ztrick = ri.Cvar_Get("gl_ztrick", "0", 0); - gl_finish = ri.Cvar_Get("gl_finish", "0", Globals.CVAR_ARCHIVE); - gl_clear = ri.Cvar_Get("gl_clear", "0", 0); - gl_cull = ri.Cvar_Get("gl_cull", "1", 0); - gl_polyblend = ri.Cvar_Get("gl_polyblend", "1", 0); - gl_flashblend = ri.Cvar_Get("gl_flashblend", "0", 0); - gl_playermip = ri.Cvar_Get("gl_playermip", "0", 0); - gl_monolightmap = ri.Cvar_Get("gl_monolightmap", "0", 0); - gl_driver = ri.Cvar_Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); - gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); - gl_texturealphamode = ri.Cvar_Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); - gl_texturesolidmode = ri.Cvar_Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); - gl_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0); - - gl_vertex_arrays = ri.Cvar_Get("gl_vertex_arrays", "1", Globals.CVAR_ARCHIVE); - - gl_ext_swapinterval = ri.Cvar_Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); - gl_ext_palettedtexture = ri.Cvar_Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); - gl_ext_multitexture = ri.Cvar_Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); - gl_ext_pointparameters = ri.Cvar_Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); - gl_ext_compiled_vertex_array = ri.Cvar_Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); - - gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); - gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "0", Globals.CVAR_ARCHIVE); - - gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0); - - gl_3dlabs_broken = ri.Cvar_Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); - - vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); - vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); - vid_ref = ri.Cvar_Get("vid_ref", "fastjogl", Globals.CVAR_ARCHIVE); - - ri.Cmd_AddCommand("imagelist", new xcommand_t() { + r_lefthand = Cvar.Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); + r_norefresh = Cvar.Get("r_norefresh", "0", 0); + r_fullbright = Cvar.Get("r_fullbright", "0", 0); + r_drawentities = Cvar.Get("r_drawentities", "1", 0); + r_drawworld = Cvar.Get("r_drawworld", "1", 0); + r_novis = Cvar.Get("r_novis", "0", 0); + r_nocull = Cvar.Get("r_nocull", "0", 0); + r_lerpmodels = Cvar.Get("r_lerpmodels", "1", 0); + r_speeds = Cvar.Get("r_speeds", "0", 0); + + r_lightlevel = Cvar.Get("r_lightlevel", "1", 0); + + gl_nosubimage = Cvar.Get("gl_nosubimage", "0", 0); + gl_allow_software = Cvar.Get("gl_allow_software", "0", 0); + + gl_particle_min_size = Cvar.Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); + gl_particle_max_size = Cvar.Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); + gl_particle_size = Cvar.Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); + gl_particle_att_a = Cvar.Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); + gl_particle_att_b = Cvar.Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); + gl_particle_att_c = Cvar.Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); + + gl_modulate = Cvar.Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); + gl_log = Cvar.Get("gl_log", "0", 0); + gl_bitdepth = Cvar.Get("gl_bitdepth", "0", 0); + gl_mode = Cvar.Get("gl_mode", "3", Globals.CVAR_ARCHIVE); // 640x480 + gl_lightmap = Cvar.Get("gl_lightmap", "0", 0); + gl_shadows = Cvar.Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); + gl_dynamic = Cvar.Get("gl_dynamic", "1", 0); + gl_nobind = Cvar.Get("gl_nobind", "0", 0); + gl_round_down = Cvar.Get("gl_round_down", "1", 0); + gl_picmip = Cvar.Get("gl_picmip", "0", 0); + gl_skymip = Cvar.Get("gl_skymip", "0", 0); + gl_showtris = Cvar.Get("gl_showtris", "0", 0); + gl_ztrick = Cvar.Get("gl_ztrick", "0", 0); + gl_finish = Cvar.Get("gl_finish", "0", Globals.CVAR_ARCHIVE); + gl_clear = Cvar.Get("gl_clear", "0", 0); + gl_cull = Cvar.Get("gl_cull", "1", 0); + gl_polyblend = Cvar.Get("gl_polyblend", "1", 0); + gl_flashblend = Cvar.Get("gl_flashblend", "0", 0); + gl_playermip = Cvar.Get("gl_playermip", "0", 0); + gl_monolightmap = Cvar.Get("gl_monolightmap", "0", 0); + gl_driver = Cvar.Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); + gl_texturemode = Cvar.Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); + gl_texturealphamode = Cvar.Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); + gl_texturesolidmode = Cvar.Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); + gl_lockpvs = Cvar.Get("gl_lockpvs", "0", 0); + + gl_vertex_arrays = Cvar.Get("gl_vertex_arrays", "1", Globals.CVAR_ARCHIVE); + + gl_ext_swapinterval = Cvar.Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); + gl_ext_palettedtexture = Cvar.Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); + gl_ext_multitexture = Cvar.Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); + gl_ext_pointparameters = Cvar.Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); + gl_ext_compiled_vertex_array = Cvar.Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); + + gl_drawbuffer = Cvar.Get("gl_drawbuffer", "GL_BACK", 0); + gl_swapinterval = Cvar.Get("gl_swapinterval", "0", Globals.CVAR_ARCHIVE); + + gl_saturatelighting = Cvar.Get("gl_saturatelighting", "0", 0); + + gl_3dlabs_broken = Cvar.Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); + + vid_fullscreen = Cvar.Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); + vid_gamma = Cvar.Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); + vid_ref = Cvar.Get("vid_ref", "fastjogl", Globals.CVAR_ARCHIVE); + + Cmd.AddCommand("imagelist", new xcommand_t() { public void execute() { GL_ImageList_f(); } }); - ri.Cmd_AddCommand("screenshot", new xcommand_t() { + Cmd.AddCommand("screenshot", new xcommand_t() { public void execute() { GL_ScreenShot_f(); } }); - ri.Cmd_AddCommand("modellist", new xcommand_t() { + Cmd.AddCommand("modellist", new xcommand_t() { public void execute() { Mod_Modellist_f(); } }); - ri.Cmd_AddCommand("gl_strings", new xcommand_t() { + Cmd.AddCommand("gl_strings", new xcommand_t() { public void execute() { GL_Strings_f(); } @@ -1031,8 +1033,8 @@ public abstract class Main extends Base { boolean fullscreen; // if (vid_fullscreen.modified && !gl_config.allow_cds) { -// ri.Con_Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); -// ri.Cvar_SetValue("vid_fullscreen", (vid_fullscreen.value > 0.0f) ? 0.0f : 1.0f); +// VID.Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); +// Cvar.SetValue("vid_fullscreen", (vid_fullscreen.value > 0.0f) ? 0.0f : 1.0f); // vid_fullscreen.modified = false; // } @@ -1048,21 +1050,21 @@ public abstract class Main extends Base { } else { if (err == rserr_invalid_fullscreen) { - ri.Cvar_SetValue("vid_fullscreen", 0); + Cvar.SetValue("vid_fullscreen", 0); vid_fullscreen.modified = false; - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok) return true; } else if (err == rserr_invalid_mode) { - ri.Cvar_SetValue("gl_mode", gl_state.prev_mode); + Cvar.SetValue("gl_mode", gl_state.prev_mode); gl_mode.modified = false; - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); } // try setting it back to something safe if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); return false; } } @@ -1085,7 +1087,7 @@ public abstract class Main extends Base { r_turbsin[j] = Warp.SIN[j] * 0.5f; } - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl version: " + REF_VERSION + '\n'); + VID.Printf(Defines.PRINT_ALL, "ref_gl version: " + REF_VERSION + '\n'); Draw_GetPalette(); @@ -1096,26 +1098,26 @@ public abstract class Main extends Base { // create the window and set up the context if (!R_SetMode()) { - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); return false; } return true; } protected boolean R_Init2() { - ri.Vid_MenuInit(); + VID.MenuInit(); /* ** get our various GL strings */ gl_config.vendor_string = gl.glGetString(GL.GL_VENDOR); - ri.Con_Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); gl_config.renderer_string = gl.glGetString(GL.GL_RENDERER); - ri.Con_Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); gl_config.version_string = gl.glGetString(GL.GL_VERSION); - ri.Con_Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); gl_config.extensions_string = gl.glGetString(GL.GL_EXTENSIONS); - ri.Con_Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); String renderer_buffer = gl_config.renderer_string.toLowerCase(); String vendor_buffer = gl_config.vendor_string.toLowerCase(); @@ -1146,33 +1148,33 @@ public abstract class Main extends Base { String monolightmap = gl_monolightmap.string.toUpperCase(); if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { - ri.Cvar_Set("gl_monolightmap", "A"); - ri.Con_Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); + Cvar.Set("gl_monolightmap", "A"); + VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { - ri.Cvar_Set("gl_monolightmap", "0"); + Cvar.Set("gl_monolightmap", "0"); } else { - ri.Cvar_Set("gl_monolightmap", "0"); + Cvar.Set("gl_monolightmap", "0"); } } // power vr can't have anything stay in the framebuffer, so // the screen needs to redraw the tiled background every frame if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { - ri.Cvar_Set("scr_drawall", "1"); + Cvar.Set("scr_drawall", "1"); } else { - ri.Cvar_Set("scr_drawall", "0"); + Cvar.Set("scr_drawall", "0"); } // #ifdef __linux__ - ri.Cvar_SetValue("gl_finish", 1); + Cvar.SetValue("gl_finish", 1); // #endif // MCD has buffering issues if (gl_config.renderer == GL_RENDERER_MCD) { - ri.Cvar_SetValue("gl_finish", 1); + Cvar.SetValue("gl_finish", 1); } if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) { @@ -1186,16 +1188,16 @@ public abstract class Main extends Base { } if (gl_config.allow_cds) - ri.Con_Printf(Defines.PRINT_ALL, "...allowing CDS\n"); + VID.Printf(Defines.PRINT_ALL, "...allowing CDS\n"); else - ri.Con_Printf(Defines.PRINT_ALL, "...disabling CDS\n"); + VID.Printf(Defines.PRINT_ALL, "...disabling CDS\n"); /* ** grab extensions */ if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0 || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) { - ri.Con_Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); + VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); // qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" ); if (gl_ext_compiled_vertex_array.value != 0.0f) qglLockArraysEXT = true; @@ -1205,16 +1207,16 @@ public abstract class Main extends Base { //qglUnlockArraysEXT = true; } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); qglLockArraysEXT = false; } if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) { qwglSwapIntervalEXT = true; - ri.Con_Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); + VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); } else { qwglSwapIntervalEXT = false; - ri.Con_Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); + VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); } if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) { @@ -1222,14 +1224,14 @@ public abstract class Main extends Base { // qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" ); qglPointParameterfEXT = true; // qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" ); - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); } // #ifdef __linux__ @@ -1237,18 +1239,18 @@ public abstract class Main extends Base { // { // if ( gl_ext_palettedtexture->value ) // { - // ri.Con_Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); + // VID.Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); // qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" ); //// qglColorTableEXT = Fake_glColorTableEXT; // } // else // { - // ri.Con_Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); + // VID.Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); // } // } // else // { - // ri.Con_Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); + // VID.Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); // } // #endif @@ -1256,26 +1258,26 @@ public abstract class Main extends Base { && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) { if (gl_ext_palettedtexture.value != 0.0f) { - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; // true; TODO jogl bug } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); } if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) { - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); qglActiveTextureARB = true; GL_TEXTURE0 = GL.GL_TEXTURE0_ARB; GL_TEXTURE1 = GL.GL_TEXTURE1_ARB; } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); } if (!(qglActiveTextureARB)) @@ -1290,7 +1292,7 @@ public abstract class Main extends Base { int err = gl.glGetError(); if (err != GL.GL_NO_ERROR) - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, "glGetError() = 0x%x\n\t%s\n", new Vargs(2).add(err).add("" + gl.glGetString(err))); @@ -1304,10 +1306,10 @@ public abstract class Main extends Base { =============== */ protected void R_Shutdown() { - ri.Cmd_RemoveCommand("modellist"); - ri.Cmd_RemoveCommand("screenshot"); - ri.Cmd_RemoveCommand("imagelist"); - ri.Cmd_RemoveCommand("gl_strings"); + Cmd.RemoveCommand("modellist"); + Cmd.RemoveCommand("screenshot"); + Cmd.RemoveCommand("imagelist"); + Cmd.RemoveCommand("gl_strings"); Mod_FreeAll(); @@ -1335,7 +1337,7 @@ public abstract class Main extends Base { // FIXME: only restart if CDS is required cvar_t ref; - ref = ri.Cvar_Get("vid_ref", "fastjogl", 0); + ref = Cvar.Get("vid_ref", "fastjogl", 0); ref.modified = true; } @@ -1368,7 +1370,7 @@ public abstract class Main extends Base { Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g ); putenv( envbuffer ); */ - ri.Con_Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); + VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } diff --git a/src/jake2/render/fastjogl/Mesh.java b/src/jake2/render/fastjogl/Mesh.java index 257fc68..1569ff9 100644 --- a/src/jake2/render/fastjogl/Mesh.java +++ b/src/jake2/render/fastjogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.3 2004-07-12 22:08:02 hzi Exp $ + * $Id: Mesh.java,v 1.4 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.fastjogl; import jake2.Defines; +import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; @@ -344,12 +345,12 @@ public abstract class Mesh extends Light { if ( ( e.frame >= paliashdr.num_frames ) || ( e.frame < 0 ) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name +": no such frame " + e.frame + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name +": no such frame " + e.frame + '\n'); e.frame = 0; } if ( ( e.oldframe >= paliashdr.num_frames ) || ( e.oldframe < 0 ) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } @@ -683,7 +684,7 @@ public abstract class Mesh extends Light { if ( (currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } @@ -691,7 +692,7 @@ public abstract class Mesh extends Light { if ( (currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { - ri.Con_Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } diff --git a/src/jake2/render/fastjogl/Misc.java b/src/jake2/render/fastjogl/Misc.java index bcd2a5f..dad5ae0 100644 --- a/src/jake2/render/fastjogl/Misc.java +++ b/src/jake2/render/fastjogl/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.1 2004-07-09 06:50:48 hzi Exp $ + * $Id: Misc.java,v 1.2 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,6 +29,7 @@ import net.java.games.jogl.GL; import net.java.games.jogl.WGL; import jake2.Defines; +import jake2.client.VID; /** * Misc @@ -143,7 +144,7 @@ public abstract class Misc extends Mesh { // } // if (i==100) // { -// ri.Con_Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); +// VID.Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); // return; // } // @@ -173,17 +174,17 @@ public abstract class Misc extends Mesh { // fclose (f); // // free (buffer); -// ri.Con_Printf (PRINT_ALL, "Wrote %s\n", picname); +// VID.Printf (PRINT_ALL, "Wrote %s\n", picname); } /* ** GL_Strings_f */ void GL_Strings_f() { - ri.Con_Printf (Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); } /* diff --git a/src/jake2/render/fastjogl/Model.java b/src/jake2/render/fastjogl/Model.java index c7d83e9..e928c5e 100644 --- a/src/jake2/render/fastjogl/Model.java +++ b/src/jake2/render/fastjogl/Model.java @@ -2,7 +2,7 @@ * Model.java * Copyright (C) 2003 * - * $Id: Model.java,v 1.2 2004-07-12 22:08:02 hzi Exp $ + * $Id: Model.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.fastjogl; import jake2.Defines; +import jake2.client.VID; import jake2.game.cplane_t; import jake2.game.cvar_t; import jake2.qcommon.*; @@ -74,7 +75,7 @@ public abstract class Model extends Surf { cplane_t plane; if (model == null || model.nodes == null) - ri.Sys_Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); + Com.Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); node = model.nodes[0]; // root node while (true) @@ -171,17 +172,17 @@ public abstract class Model extends Surf { int total; total = 0; - ri.Con_Printf(Defines.PRINT_ALL,"Loaded models:\n"); + VID.Printf(Defines.PRINT_ALL,"Loaded models:\n"); for (i=0; i < mod_numknown ; i++) { mod = mod_known[i]; if (mod.name == "") continue; - ri.Con_Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); + VID.Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); total += mod.extradatasize; } - ri.Con_Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); + VID.Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); } /* @@ -213,7 +214,7 @@ public abstract class Model extends Surf { int i; if (name == null || name.length() == 0) - ri.Sys_Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); + Com.Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); // // inline models are grabbed only from worldmodel @@ -222,7 +223,7 @@ public abstract class Model extends Surf { { i = Integer.parseInt(name.substring(1)); if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels) - ri.Sys_Error (Defines.ERR_DROP, "bad inline model number"); + Com.Error (Defines.ERR_DROP, "bad inline model number"); return mod_inline[i]; } @@ -252,7 +253,7 @@ public abstract class Model extends Surf { if (i == mod_numknown) { if (mod_numknown == MAX_MOD_KNOWN) - ri.Sys_Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); + Com.Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); mod_numknown++; mod = mod_known[i]; } @@ -262,12 +263,12 @@ public abstract class Model extends Surf { // // load the file // - fileBuffer = ri.FS_LoadFile(name); + fileBuffer = FS.LoadFile(name); if (fileBuffer == null) { if (crash) - ri.Sys_Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); + Com.Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); mod.name = ""; return null; @@ -302,7 +303,7 @@ public abstract class Model extends Surf { Mod_LoadBrushModel(mod, bb); break; default: - ri.Sys_Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); + Com.Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); break; } @@ -384,7 +385,7 @@ public abstract class Model extends Surf { int i, count; if ( (l.filelen % mvertex_t.DISK_SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / mvertex_t.DISK_SIZE; @@ -431,7 +432,7 @@ public abstract class Model extends Surf { int i, j, count; if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dmodel_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -471,7 +472,7 @@ public abstract class Model extends Surf { int i, count; if ( (l.filelen % medge_t.DISK_SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / medge_t.DISK_SIZE; // out = Hunk_Alloc ( (count + 1) * sizeof(*out)); @@ -504,7 +505,7 @@ public abstract class Model extends Surf { String name; if ((l.filelen % texinfo_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / texinfo_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -534,7 +535,7 @@ public abstract class Model extends Surf { out[i].image = GL_FindImage(name, it_wall); if (out[i].image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); + VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); out[i].image = r_notexture; } } @@ -616,7 +617,7 @@ public abstract class Model extends Surf { int ti; if ((l.filelen % qfiles.dface_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dface_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -650,7 +651,7 @@ public abstract class Model extends Surf { ti = in.texinfo; if (ti < 0 || ti >= loadmodel.numtexinfo) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); out[surfnum].texinfo = loadmodel.texinfo[ti]; @@ -722,7 +723,7 @@ public abstract class Model extends Surf { mnode_t[] out; if ((l.filelen % qfiles.dnode_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dnode_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -779,7 +780,7 @@ public abstract class Model extends Surf { int i, j, count, p; if ((l.filelen % qfiles.dleaf_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dleaf_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -824,7 +825,7 @@ public abstract class Model extends Surf { msurface_t[] out; if ((l.filelen % Defines.SIZE_OF_SHORT) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_SHORT; // out = Hunk_Alloc ( count*sizeof(*out)); out = new msurface_t[count]; @@ -839,7 +840,7 @@ public abstract class Model extends Surf { { j = bb.getShort(); if (j < 0 || j >= loadmodel.numsurfaces) - ri.Sys_Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); + Com.Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel.surfaces[j]; } @@ -857,11 +858,11 @@ public abstract class Model extends Surf { int[] offsets; if ( (l.filelen % Defines.SIZE_OF_INT) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_INT; if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); offsets = new int[count]; @@ -889,7 +890,7 @@ public abstract class Model extends Surf { int bits; if ((l.filelen % qfiles.dplane_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dplane_t.SIZE; // out = Hunk_Alloc ( count*2*sizeof(*out)); @@ -932,13 +933,13 @@ public abstract class Model extends Surf { loadmodel.type = mod_brush; if (loadmodel != mod_known[0]) - ri.Sys_Error(Defines.ERR_DROP, "Loaded a brush model after the world"); + Com.Error(Defines.ERR_DROP, "Loaded a brush model after the world"); header = new qfiles.dheader_t(buffer); i = header.version; if (i != Defines.BSPVERSION) - ri.Sys_Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); + Com.Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); mod_base = fileBuffer; //(byte *)header; @@ -972,7 +973,7 @@ public abstract class Model extends Surf { starmod.nummodelsurfaces = bm.numfaces; starmod.firstnode = bm.headnode; if (starmod.firstnode >= loadmodel.numnodes) - ri.Sys_Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); + Com.Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); Math3D.VectorCopy(bm.maxs, starmod.maxs); Math3D.VectorCopy(bm.mins, starmod.mins); @@ -1010,26 +1011,26 @@ public abstract class Model extends Surf { pheader = new qfiles.dmdl_t(buffer); if (pheader.version != qfiles.ALIAS_VERSION) - ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", + Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION)); if (pheader.skinheight > MAX_LBM_HEIGHT) - ri.Sys_Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); + Com.Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); if (pheader.num_xyz <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); if (pheader.num_xyz > qfiles.MAX_VERTS) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); if (pheader.num_st <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); if (pheader.num_tris <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); if (pheader.num_frames <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); // // load base s and t vertices (not used in gl version) @@ -1124,11 +1125,11 @@ public abstract class Model extends Surf { qfiles.dsprite_t sprout = new qfiles.dsprite_t(buffer); if (sprout.version != qfiles.SPRITE_VERSION) - ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", + Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION)); if (sprout.numframes > qfiles.MAX_MD2SKINS) - ri.Sys_Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", + Com.Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS)); for (int i=0 ; i<sprout.numframes ; i++) @@ -1163,7 +1164,7 @@ public abstract class Model extends Surf { // explicitly free the old map if different // this guarantees that mod_known[0] is the world map - flushmap = ri.Cvar_Get("flushmap", "0", 0); + flushmap = Cvar.Get("flushmap", "0", 0); if ( !mod_known[0].name.equals(fullname) || flushmap.value != 0.0f) Mod_Free(mod_known[0]); r_worldmodel = Mod_ForName(fullname, true); diff --git a/src/jake2/render/fastjogl/Surf.java b/src/jake2/render/fastjogl/Surf.java index 2bb812c..a37eb32 100644 --- a/src/jake2/render/fastjogl/Surf.java +++ b/src/jake2/render/fastjogl/Surf.java @@ -2,7 +2,7 @@ * Surf.java * Copyright (C) 2003 * - * $Id: Surf.java,v 1.2 2004-07-12 18:19:42 hzi Exp $ + * $Id: Surf.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,6 +28,7 @@ package jake2.render.fastjogl; import jake2.Defines; import jake2.client.*; import jake2.game.cplane_t; +import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Lib; import jake2.util.Math3D; @@ -1105,7 +1106,7 @@ public abstract class Surf extends Draw { GL.GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer ); if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS ) - ri.Sys_Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); + Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4); @@ -1258,7 +1259,7 @@ public abstract class Surf extends Draw { lightPos = new pos_t(surf.light_s, surf.light_t); if ( !LM_AllocBlock( smax, tmax, lightPos ) ) { - ri.Sys_Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); + Com.Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); } } diff --git a/src/jake2/render/fastjogl/Warp.java b/src/jake2/render/fastjogl/Warp.java index d7645f8..f6b1416 100644 --- a/src/jake2/render/fastjogl/Warp.java +++ b/src/jake2/render/fastjogl/Warp.java @@ -2,7 +2,7 @@ * Warp.java * Copyright (C) 2003 * - * $Id: Warp.java,v 1.2 2004-07-12 22:08:02 hzi Exp $ + * $Id: Warp.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -27,6 +27,7 @@ package jake2.render.fastjogl; import jake2.Defines; import jake2.Globals; +import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; @@ -128,7 +129,7 @@ public abstract class Warp extends Model { float total_s, total_t; if (numverts > 60) - ri.Sys_Error(Defines.ERR_DROP, "numverts = " + numverts); + Com.Error(Defines.ERR_DROP, "numverts = " + numverts); BoundPoly(numverts, verts, mins, maxs); @@ -463,7 +464,7 @@ public abstract class Warp extends Model { int i, j; if (nump > MAX_CLIP_VERTS-2) - ri.Sys_Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); + Com.Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); if (stage == 6) { // fully clipped, so draw it DrawSkyPolygon(nump, vecs); diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java index b83e422..5047ddb 100644 --- a/src/jake2/render/jogl/Draw.java +++ b/src/jake2/render/jogl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.4 2004-07-15 14:37:34 hzi Exp $ + * $Id: Draw.java,v 1.5 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; +import jake2.client.VID; +import jake2.qcommon.Com; import jake2.render.image_t; import java.awt.Dimension; @@ -136,7 +138,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); + VID.Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); return; } @@ -175,7 +177,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); + VID.Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); return; } if (scrap_dirty) @@ -215,7 +217,7 @@ public abstract class Draw extends Image { image = Draw_FindPic(pic); if (image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); + VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } @@ -249,7 +251,7 @@ public abstract class Draw extends Image { protected void Draw_Fill(int x, int y, int w, int h, int colorIndex) { if ( colorIndex > 255) - ri.Sys_Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); + Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); gl.glDisable(GL.GL_TEXTURE_2D); diff --git a/src/jake2/render/jogl/Image.java b/src/jake2/render/jogl/Image.java index 3a58884..64588ef 100644 --- a/src/jake2/render/jogl/Image.java +++ b/src/jake2/render/jogl/Image.java @@ -2,7 +2,7 @@ * Image.java * Copyright (C) 2003 * - * $Id: Image.java,v 1.4 2004-07-12 22:08:03 hzi Exp $ + * $Id: Image.java,v 1.5 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,8 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; +import jake2.client.VID; import jake2.client.particle_t; import jake2.game.cvar_t; +import jake2.qcommon.*; import jake2.qcommon.longjmpException; import jake2.qcommon.qfiles; import jake2.render.image_t; @@ -263,7 +265,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); return; } @@ -297,7 +299,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_ALPHA_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); return; } @@ -317,7 +319,7 @@ public abstract class Image extends Main { } if (i == NUM_GL_SOLID_MODES) { - ri.Con_Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); + VID.Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); return; } @@ -335,7 +337,7 @@ public abstract class Image extends Main { int texels; final String[] palstrings = { "RGB", "PAL" }; - ri.Con_Printf(Defines.PRINT_ALL, "------------------\n"); + VID.Printf(Defines.PRINT_ALL, "------------------\n"); texels = 0; for (int i = 0; i < numgltextures; i++) { @@ -346,29 +348,29 @@ public abstract class Image extends Main { texels += image.upload_width * image.upload_height; switch (image.type) { case it_skin : - ri.Con_Printf(Defines.PRINT_ALL, "M"); + VID.Printf(Defines.PRINT_ALL, "M"); break; case it_sprite : - ri.Con_Printf(Defines.PRINT_ALL, "S"); + VID.Printf(Defines.PRINT_ALL, "S"); break; case it_wall : - ri.Con_Printf(Defines.PRINT_ALL, "W"); + VID.Printf(Defines.PRINT_ALL, "W"); break; case it_pic : - ri.Con_Printf(Defines.PRINT_ALL, "P"); + VID.Printf(Defines.PRINT_ALL, "P"); break; default : - ri.Con_Printf(Defines.PRINT_ALL, " "); + VID.Printf(Defines.PRINT_ALL, " "); break; } - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, " %3i %3i %s: %s\n", new Vargs(4).add(image.upload_width).add(image.upload_height).add(palstrings[(image.paletted) ? 1 : 0]).add( image.name)); } - ri.Con_Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); + VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); } /* @@ -464,10 +466,10 @@ public abstract class Image extends Main { // // load the file // - byte[] raw = ri.FS_LoadFile(filename); + byte[] raw = FS.LoadFile(filename); if (raw == null) { - ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); + VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); return null; } @@ -483,7 +485,7 @@ public abstract class Image extends Main { || pcx.xmax >= 640 || pcx.ymax >= 480) { - ri.Con_Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); + VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); return null; } @@ -559,21 +561,21 @@ public abstract class Image extends Main { // // load the file // - raw = ri.FS_LoadFile (name); + raw = FS.LoadFile (name); if (raw == null) { - ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); + VID.Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); return null; } targa_header = new qfiles.tga_t(raw); if (targa_header.image_type != 2 && targa_header.image_type != 10) - ri.Sys_Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); + Com.Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24)) - ri.Sys_Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); + Com.Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); columns = targa_header.width; rows = targa_header.height; @@ -1101,7 +1103,7 @@ public abstract class Image extends Main { upload_height = scaled_height; if (scaled_width * scaled_height > 256 * 256) - ri.Sys_Error(Defines.ERR_DROP, "GL_Upload32: too big"); + Com.Error(Defines.ERR_DROP, "GL_Upload32: too big"); // scan the texture for any non-255 alpha c = width * height; @@ -1119,7 +1121,7 @@ public abstract class Image extends Main { else if (samples == gl_alpha_format) comp = gl_tex_alpha_format; else { - ri.Con_Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); + VID.Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); comp = samples; } @@ -1262,7 +1264,7 @@ public abstract class Image extends Main { int s = width * height; if (s > trans.length) - ri.Sys_Error(Defines.ERR_DROP, "GL_Upload8: too large"); + Com.Error(Defines.ERR_DROP, "GL_Upload8: too large"); if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) { gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL.GL_COLOR_INDEX, GL.GL_UNSIGNED_BYTE, data); @@ -1329,14 +1331,14 @@ public abstract class Image extends Main { if (i == numgltextures) { if (numgltextures == MAX_GLTEXTURES) - ri.Sys_Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); + Com.Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); numgltextures++; } image = gltextures[i]; if (name.length() > Defines.MAX_QPATH) - ri.Sys_Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); + Com.Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); image.name = name; image.registration_sequence = registration_sequence; @@ -1452,9 +1454,9 @@ public abstract class Image extends Main { image_t image = null; - byte[] raw = ri.FS_LoadFile(name); + byte[] raw = FS.LoadFile(name); if (raw == null) { - ri.Con_Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); return r_notexture; } @@ -1486,8 +1488,8 @@ public abstract class Image extends Main { name = name.substring(0, index); if (name == null || name.length() < 5) - return null; // ri.Sys_Error (ERR_DROP, "GL_FindImage: NULL name"); - // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad name: %s", name); + return null; // Com.Error (ERR_DROP, "GL_FindImage: NULL name"); + // Com.Error (ERR_DROP, "GL_FindImage: bad name: %s", name); // look for it for (int i = 0; i < numgltextures; i++) @@ -1595,7 +1597,7 @@ public abstract class Image extends Main { pic = LoadPCX("pics/colormap.pcx", palette, dim = new Dimension()); if (palette[0] == null || palette[0].length != 768) - ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); + Com.Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); byte[] pal = palette[0]; @@ -1625,19 +1627,19 @@ public abstract class Image extends Main { registration_sequence = 1; // init intensity conversions - intensity = ri.Cvar_Get("intensity", "2", 0); + intensity = Cvar.Get("intensity", "2", 0); if (intensity.value <= 1) - ri.Cvar_Set("intensity", "1"); + Cvar.Set("intensity", "1"); gl_state.inverse_intensity = 1 / intensity.value; Draw_GetPalette(); if (qglColorTableEXT) { - gl_state.d_16to8table = ri.FS_LoadFile("pics/16to8.dat"); + gl_state.d_16to8table = FS.LoadFile("pics/16to8.dat"); if (gl_state.d_16to8table == null) - ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); + Com.Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); } if ((gl_config.renderer & (GL_RENDERER_VOODOO | GL_RENDERER_VOODOO2)) != 0) { diff --git a/src/jake2/render/jogl/Light.java b/src/jake2/render/jogl/Light.java index e9e83af..de23629 100644 --- a/src/jake2/render/jogl/Light.java +++ b/src/jake2/render/jogl/Light.java @@ -2,7 +2,7 @@ * Light.java * Copyright (C) 2003 * - * $Id: Light.java,v 1.5 2004-07-12 22:08:04 hzi Exp $ + * $Id: Light.java,v 1.6 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -31,6 +31,7 @@ import jake2.client.dlight_t; import jake2.client.lightstyle_t; import jake2.game.GameBase; import jake2.game.cplane_t; +import jake2.qcommon.Com; import jake2.qcommon.longjmpException; import jake2.render.*; import jake2.util.Math3D; @@ -503,13 +504,13 @@ public abstract class Light extends Warp { int monolightmap; if ( (surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0 ) - ri.Sys_Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); + Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4) ) - ri.Sys_Error(Defines.ERR_DROP, "Bad s_blocklights size"); + Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data diff --git a/src/jake2/render/jogl/Main.java b/src/jake2/render/jogl/Main.java index 9f85422..ce5c8fe 100644 --- a/src/jake2/render/jogl/Main.java +++ b/src/jake2/render/jogl/Main.java @@ -2,7 +2,7 @@ * Main.java * Copyright (C) 2003 * - * $Id: Main.java,v 1.4 2004-07-15 14:37:34 hzi Exp $ + * $Id: Main.java,v 1.5 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,6 +28,7 @@ package jake2.render.jogl; import jake2.Defines; import jake2.Globals; import jake2.client.*; +import jake2.game.*; import jake2.game.cplane_t; import jake2.game.cvar_t; import jake2.qcommon.*; @@ -419,7 +420,7 @@ public abstract class Main extends Base { R_DrawSpriteModel(currententity); break; default : - ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); + Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } @@ -453,7 +454,7 @@ public abstract class Main extends Base { R_DrawSpriteModel(currententity); break; default : - ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); + Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } @@ -825,11 +826,11 @@ public abstract class Main extends Base { // included by cwei if (r_newrefdef == null) { - ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); + Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); } if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) - ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); + Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); if (r_speeds.value != 0.0f) { c_brush_polys = 0; @@ -862,7 +863,7 @@ public abstract class Main extends Base { R_Flash(); if (r_speeds.value != 0.0f) { - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", new Vargs(4).add(c_brush_polys).add(c_alias_polys).add(c_visible_textures).add(c_visible_lightmaps)); @@ -929,90 +930,90 @@ public abstract class Main extends Base { } protected void R_Register() { - r_lefthand = ri.Cvar_Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); - r_norefresh = ri.Cvar_Get("r_norefresh", "0", 0); - r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0); - r_drawentities = ri.Cvar_Get("r_drawentities", "1", 0); - r_drawworld = ri.Cvar_Get("r_drawworld", "1", 0); - r_novis = ri.Cvar_Get("r_novis", "0", 0); - r_nocull = ri.Cvar_Get("r_nocull", "0", 0); - r_lerpmodels = ri.Cvar_Get("r_lerpmodels", "1", 0); - r_speeds = ri.Cvar_Get("r_speeds", "0", 0); - - r_lightlevel = ri.Cvar_Get("r_lightlevel", "1", 0); - - gl_nosubimage = ri.Cvar_Get("gl_nosubimage", "0", 0); - gl_allow_software = ri.Cvar_Get("gl_allow_software", "0", 0); - - gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); - gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); - gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); - gl_particle_att_a = ri.Cvar_Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); - gl_particle_att_b = ri.Cvar_Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); - gl_particle_att_c = ri.Cvar_Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); - - gl_modulate = ri.Cvar_Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); - gl_log = ri.Cvar_Get("gl_log", "0", 0); - gl_bitdepth = ri.Cvar_Get("gl_bitdepth", "0", 0); - gl_mode = ri.Cvar_Get("gl_mode", "1", Globals.CVAR_ARCHIVE); - gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); - gl_shadows = ri.Cvar_Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); - gl_dynamic = ri.Cvar_Get("gl_dynamic", "1", 0); - gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); - gl_round_down = ri.Cvar_Get("gl_round_down", "1", 0); - gl_picmip = ri.Cvar_Get("gl_picmip", "0", 0); - gl_skymip = ri.Cvar_Get("gl_skymip", "0", 0); - gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0); - gl_ztrick = ri.Cvar_Get("gl_ztrick", "0", 0); - gl_finish = ri.Cvar_Get("gl_finish", "0", Globals.CVAR_ARCHIVE); - gl_clear = ri.Cvar_Get("gl_clear", "0", 0); - gl_cull = ri.Cvar_Get("gl_cull", "1", 0); - gl_polyblend = ri.Cvar_Get("gl_polyblend", "1", 0); - gl_flashblend = ri.Cvar_Get("gl_flashblend", "0", 0); - gl_playermip = ri.Cvar_Get("gl_playermip", "0", 0); - gl_monolightmap = ri.Cvar_Get("gl_monolightmap", "0", 0); - gl_driver = ri.Cvar_Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); - gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); - gl_texturealphamode = ri.Cvar_Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); - gl_texturesolidmode = ri.Cvar_Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); - gl_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0); - - gl_vertex_arrays = ri.Cvar_Get("gl_vertex_arrays", "0", Globals.CVAR_ARCHIVE); - - gl_ext_swapinterval = ri.Cvar_Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); - gl_ext_palettedtexture = ri.Cvar_Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); - gl_ext_multitexture = ri.Cvar_Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); - gl_ext_pointparameters = ri.Cvar_Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); - gl_ext_compiled_vertex_array = ri.Cvar_Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); - - gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); - gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "1", Globals.CVAR_ARCHIVE); - - gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0); - - gl_3dlabs_broken = ri.Cvar_Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); - - vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); - vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); - vid_ref = ri.Cvar_Get("vid_ref", "jogl", Globals.CVAR_ARCHIVE); - - ri.Cmd_AddCommand("imagelist", new xcommand_t() { + r_lefthand = Cvar.Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); + r_norefresh = Cvar.Get("r_norefresh", "0", 0); + r_fullbright = Cvar.Get("r_fullbright", "0", 0); + r_drawentities = Cvar.Get("r_drawentities", "1", 0); + r_drawworld = Cvar.Get("r_drawworld", "1", 0); + r_novis = Cvar.Get("r_novis", "0", 0); + r_nocull = Cvar.Get("r_nocull", "0", 0); + r_lerpmodels = Cvar.Get("r_lerpmodels", "1", 0); + r_speeds = Cvar.Get("r_speeds", "0", 0); + + r_lightlevel = Cvar.Get("r_lightlevel", "1", 0); + + gl_nosubimage = Cvar.Get("gl_nosubimage", "0", 0); + gl_allow_software = Cvar.Get("gl_allow_software", "0", 0); + + gl_particle_min_size = Cvar.Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); + gl_particle_max_size = Cvar.Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); + gl_particle_size = Cvar.Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); + gl_particle_att_a = Cvar.Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); + gl_particle_att_b = Cvar.Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); + gl_particle_att_c = Cvar.Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); + + gl_modulate = Cvar.Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); + gl_log = Cvar.Get("gl_log", "0", 0); + gl_bitdepth = Cvar.Get("gl_bitdepth", "0", 0); + gl_mode = Cvar.Get("gl_mode", "1", Globals.CVAR_ARCHIVE); + gl_lightmap = Cvar.Get("gl_lightmap", "0", 0); + gl_shadows = Cvar.Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); + gl_dynamic = Cvar.Get("gl_dynamic", "1", 0); + gl_nobind = Cvar.Get("gl_nobind", "0", 0); + gl_round_down = Cvar.Get("gl_round_down", "1", 0); + gl_picmip = Cvar.Get("gl_picmip", "0", 0); + gl_skymip = Cvar.Get("gl_skymip", "0", 0); + gl_showtris = Cvar.Get("gl_showtris", "0", 0); + gl_ztrick = Cvar.Get("gl_ztrick", "0", 0); + gl_finish = Cvar.Get("gl_finish", "0", Globals.CVAR_ARCHIVE); + gl_clear = Cvar.Get("gl_clear", "0", 0); + gl_cull = Cvar.Get("gl_cull", "1", 0); + gl_polyblend = Cvar.Get("gl_polyblend", "1", 0); + gl_flashblend = Cvar.Get("gl_flashblend", "0", 0); + gl_playermip = Cvar.Get("gl_playermip", "0", 0); + gl_monolightmap = Cvar.Get("gl_monolightmap", "0", 0); + gl_driver = Cvar.Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); + gl_texturemode = Cvar.Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); + gl_texturealphamode = Cvar.Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); + gl_texturesolidmode = Cvar.Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); + gl_lockpvs = Cvar.Get("gl_lockpvs", "0", 0); + + gl_vertex_arrays = Cvar.Get("gl_vertex_arrays", "0", Globals.CVAR_ARCHIVE); + + gl_ext_swapinterval = Cvar.Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); + gl_ext_palettedtexture = Cvar.Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); + gl_ext_multitexture = Cvar.Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); + gl_ext_pointparameters = Cvar.Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); + gl_ext_compiled_vertex_array = Cvar.Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); + + gl_drawbuffer = Cvar.Get("gl_drawbuffer", "GL_BACK", 0); + gl_swapinterval = Cvar.Get("gl_swapinterval", "1", Globals.CVAR_ARCHIVE); + + gl_saturatelighting = Cvar.Get("gl_saturatelighting", "0", 0); + + gl_3dlabs_broken = Cvar.Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); + + vid_fullscreen = Cvar.Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); + vid_gamma = Cvar.Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); + vid_ref = Cvar.Get("vid_ref", "jogl", Globals.CVAR_ARCHIVE); + + Cmd.AddCommand("imagelist", new xcommand_t() { public void execute() { GL_ImageList_f(); } }); - ri.Cmd_AddCommand("screenshot", new xcommand_t() { + Cmd.AddCommand("screenshot", new xcommand_t() { public void execute() { GL_ScreenShot_f(); } }); - ri.Cmd_AddCommand("modellist", new xcommand_t() { + Cmd.AddCommand("modellist", new xcommand_t() { public void execute() { Mod_Modellist_f(); } }); - ri.Cmd_AddCommand("gl_strings", new xcommand_t() { + Cmd.AddCommand("gl_strings", new xcommand_t() { public void execute() { GL_Strings_f(); } @@ -1030,8 +1031,8 @@ public abstract class Main extends Base { boolean fullscreen; // if (vid_fullscreen.modified && !gl_config.allow_cds) { -// ri.Con_Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); -// ri.Cvar_SetValue("vid_fullscreen", (vid_fullscreen.value > 0.0f) ? 0.0f : 1.0f); +// VID.Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); +// Cvar.SetValue("vid_fullscreen", (vid_fullscreen.value > 0.0f) ? 0.0f : 1.0f); // vid_fullscreen.modified = false; // } @@ -1047,21 +1048,21 @@ public abstract class Main extends Base { } else { if (err == rserr_invalid_fullscreen) { - ri.Cvar_SetValue("vid_fullscreen", 0); + Cvar.SetValue("vid_fullscreen", 0); vid_fullscreen.modified = false; - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok) return true; } else if (err == rserr_invalid_mode) { - ri.Cvar_SetValue("gl_mode", gl_state.prev_mode); + Cvar.SetValue("gl_mode", gl_state.prev_mode); gl_mode.modified = false; - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); } // try setting it back to something safe if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); return false; } } @@ -1084,7 +1085,7 @@ public abstract class Main extends Base { r_turbsin[j] = Warp.SIN[j] * 0.5f; } - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl version: " + REF_VERSION + '\n'); + VID.Printf(Defines.PRINT_ALL, "ref_gl version: " + REF_VERSION + '\n'); Draw_GetPalette(); @@ -1095,26 +1096,26 @@ public abstract class Main extends Base { // create the window and set up the context if (!R_SetMode()) { - ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); + VID.Printf(Defines.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n"); return false; } return true; } protected boolean R_Init2() { - ri.Vid_MenuInit(); + VID.MenuInit(); /* ** get our various GL strings */ gl_config.vendor_string = gl.glGetString(GL.GL_VENDOR); - ri.Con_Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); gl_config.renderer_string = gl.glGetString(GL.GL_RENDERER); - ri.Con_Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); gl_config.version_string = gl.glGetString(GL.GL_VERSION); - ri.Con_Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); gl_config.extensions_string = gl.glGetString(GL.GL_EXTENSIONS); - ri.Con_Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); + VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); String renderer_buffer = gl_config.renderer_string.toLowerCase(); String vendor_buffer = gl_config.vendor_string.toLowerCase(); @@ -1145,33 +1146,33 @@ public abstract class Main extends Base { String monolightmap = gl_monolightmap.string.toUpperCase(); if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') { if (gl_config.renderer == GL_RENDERER_PERMEDIA2) { - ri.Cvar_Set("gl_monolightmap", "A"); - ri.Con_Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); + Cvar.Set("gl_monolightmap", "A"); + VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n"); } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { - ri.Cvar_Set("gl_monolightmap", "0"); + Cvar.Set("gl_monolightmap", "0"); } else { - ri.Cvar_Set("gl_monolightmap", "0"); + Cvar.Set("gl_monolightmap", "0"); } } // power vr can't have anything stay in the framebuffer, so // the screen needs to redraw the tiled background every frame if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) { - ri.Cvar_Set("scr_drawall", "1"); + Cvar.Set("scr_drawall", "1"); } else { - ri.Cvar_Set("scr_drawall", "0"); + Cvar.Set("scr_drawall", "0"); } // #ifdef __linux__ - ri.Cvar_SetValue("gl_finish", 1); + Cvar.SetValue("gl_finish", 1); // #endif // MCD has buffering issues if (gl_config.renderer == GL_RENDERER_MCD) { - ri.Cvar_SetValue("gl_finish", 1); + Cvar.SetValue("gl_finish", 1); } if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) { @@ -1185,16 +1186,16 @@ public abstract class Main extends Base { } if (gl_config.allow_cds) - ri.Con_Printf(Defines.PRINT_ALL, "...allowing CDS\n"); + VID.Printf(Defines.PRINT_ALL, "...allowing CDS\n"); else - ri.Con_Printf(Defines.PRINT_ALL, "...disabling CDS\n"); + VID.Printf(Defines.PRINT_ALL, "...disabling CDS\n"); /* ** grab extensions */ if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0 || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) { - ri.Con_Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); + VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n"); // qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" ); if (gl_ext_compiled_vertex_array.value != 0.0f) qglLockArraysEXT = true; @@ -1204,15 +1205,15 @@ public abstract class Main extends Base { //qglUnlockArraysEXT = true; } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n"); } if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) { qwglSwapIntervalEXT = true; - ri.Con_Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); + VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n"); } else { qwglSwapIntervalEXT = false; - ri.Con_Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); + VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n"); } if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) { @@ -1220,14 +1221,14 @@ public abstract class Main extends Base { // qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" ); qglPointParameterfEXT = true; // qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" ); - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n"); } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n"); } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n"); } // #ifdef __linux__ @@ -1235,18 +1236,18 @@ public abstract class Main extends Base { // { // if ( gl_ext_palettedtexture->value ) // { - // ri.Con_Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); + // VID.Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" ); // qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" ); //// qglColorTableEXT = Fake_glColorTableEXT; // } // else // { - // ri.Con_Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); + // VID.Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" ); // } // } // else // { - // ri.Con_Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); + // VID.Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" ); // } // #endif @@ -1254,21 +1255,21 @@ public abstract class Main extends Base { && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0 && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) { if (gl_ext_palettedtexture.value != 0.0f) { - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; // true; TODO jogl bug } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); qglColorTableEXT = false; } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); } if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) { if (gl_ext_multitexture.value != 0.0f) { - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n"); // qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMultiTexCoord2fARB" ); // qglActiveTextureARB = ( void * ) qwglGetProcAddress( "glActiveTextureARB" ); // qglClientActiveTextureARB = ( void * ) qwglGetProcAddress( "glClientActiveTextureARB" ); @@ -1279,21 +1280,21 @@ public abstract class Main extends Base { Cvar.SetValue("r_fullbright", 1); } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_ARB_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_ARB_multitexture\n"); Cvar.SetValue("r_fullbright", 0); } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n"); Cvar.SetValue("r_fullbright", 0); } if (gl_config.extensions_string.indexOf("GL_SGIS_multitexture") >= 0) { if (qglActiveTextureARB) { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_SGIS_multitexture deprecated in favor of ARB_multitexture\n"); Cvar.SetValue("r_fullbright", 1); } else if (gl_ext_multitexture.value != 0.0f) { - ri.Con_Printf(Defines.PRINT_ALL, "...using GL_SGIS_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...using GL_SGIS_multitexture\n"); // qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMTexCoord2fSGIS" ); // qglSelectTextureSGIS = ( void * ) qwglGetProcAddress( "glSelectTextureSGIS" ); qglSelectTextureSGIS = true; @@ -1302,12 +1303,12 @@ public abstract class Main extends Base { // //GL_TEXTURE0 = GL.GL_TEXTURE0_SGIS; // //GL_TEXTURE1 = GL.GL_TEXTURE1_SGIS; } else { - ri.Con_Printf(Defines.PRINT_ALL, "...ignoring GL_SGIS_multitexture\n"); + VID.Printf(Defines.PRINT_ALL, "...ignoring GL_SGIS_multitexture\n"); Cvar.SetValue("r_fullbright", 0); } } else { - ri.Con_Printf(Defines.PRINT_ALL, "...GL_SGIS_multitexture not found\n"); + VID.Printf(Defines.PRINT_ALL, "...GL_SGIS_multitexture not found\n"); if (!qglActiveTextureARB) Cvar.SetValue("r_fullbright", 0); } @@ -1321,7 +1322,7 @@ public abstract class Main extends Base { int err = gl.glGetError(); if (err != GL.GL_NO_ERROR) - ri.Con_Printf( + VID.Printf( Defines.PRINT_ALL, "glGetError() = 0x%x\n\t%s\n", new Vargs(2).add(err).add("" + gl.glGetString(err))); @@ -1335,10 +1336,10 @@ public abstract class Main extends Base { =============== */ protected void R_Shutdown() { - ri.Cmd_RemoveCommand("modellist"); - ri.Cmd_RemoveCommand("screenshot"); - ri.Cmd_RemoveCommand("imagelist"); - ri.Cmd_RemoveCommand("gl_strings"); + Cmd.RemoveCommand("modellist"); + Cmd.RemoveCommand("screenshot"); + Cmd.RemoveCommand("imagelist"); + Cmd.RemoveCommand("gl_strings"); Mod_FreeAll(); @@ -1366,7 +1367,7 @@ public abstract class Main extends Base { // FIXME: only restart if CDS is required cvar_t ref; - ref = ri.Cvar_Get("vid_ref", "jogl", 0); + ref = Cvar.Get("vid_ref", "jogl", 0); ref.modified = true; } @@ -1399,7 +1400,7 @@ public abstract class Main extends Base { Com_sprintf( envbuffer, sizeof(envbuffer), "SST_GAMMA=%f", g ); putenv( envbuffer ); */ - ri.Con_Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); + VID.Printf(Defines.PRINT_DEVELOPER, "gamma anpassung fuer VOODOO nicht gesetzt"); } } diff --git a/src/jake2/render/jogl/Mesh.java b/src/jake2/render/jogl/Mesh.java index 4a53371..4a8aed3 100644 --- a/src/jake2/render/jogl/Mesh.java +++ b/src/jake2/render/jogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.5 2004-07-12 22:08:03 hzi Exp $ + * $Id: Mesh.java,v 1.6 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; +import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; @@ -474,12 +475,12 @@ public abstract class Mesh extends Light { if ( ( e.frame >= paliashdr.num_frames ) || ( e.frame < 0 ) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name +": no such frame " + e.frame + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name +": no such frame " + e.frame + '\n'); e.frame = 0; } if ( ( e.oldframe >= paliashdr.num_frames ) || ( e.oldframe < 0 ) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } @@ -809,7 +810,7 @@ public abstract class Mesh extends Light { if ( (currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0) ) { - ri.Con_Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } @@ -817,7 +818,7 @@ public abstract class Mesh extends Light { if ( (currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { - ri.Con_Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); + VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } diff --git a/src/jake2/render/jogl/Misc.java b/src/jake2/render/jogl/Misc.java index a1d2e70..256e0cf 100644 --- a/src/jake2/render/jogl/Misc.java +++ b/src/jake2/render/jogl/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.2 2004-07-09 06:50:48 hzi Exp $ + * $Id: Misc.java,v 1.3 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; +import jake2.client.VID; import net.java.games.jogl.GL; import net.java.games.jogl.WGL; @@ -145,7 +146,7 @@ public abstract class Misc extends Mesh { // } // if (i==100) // { -// ri.Con_Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); +// VID.Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); // return; // } // @@ -175,17 +176,17 @@ public abstract class Misc extends Mesh { // fclose (f); // // free (buffer); -// ri.Con_Printf (PRINT_ALL, "Wrote %s\n", picname); +// VID.Printf (PRINT_ALL, "Wrote %s\n", picname); } /* ** GL_Strings_f */ void GL_Strings_f() { - ri.Con_Printf (Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); - ri.Con_Printf (Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); + VID.Printf (Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); + VID.Printf (Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); + VID.Printf (Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); + VID.Printf (Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); } /* diff --git a/src/jake2/render/jogl/Model.java b/src/jake2/render/jogl/Model.java index 9a10cf5..2508d69 100644 --- a/src/jake2/render/jogl/Model.java +++ b/src/jake2/render/jogl/Model.java @@ -2,7 +2,7 @@ * Model.java * Copyright (C) 2003 * - * $Id: Model.java,v 1.3 2004-07-12 22:08:03 hzi Exp $ + * $Id: Model.java,v 1.4 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; +import jake2.client.VID; import jake2.game.cplane_t; import jake2.game.cvar_t; import jake2.qcommon.*; @@ -72,7 +73,7 @@ public abstract class Model extends Surf { cplane_t plane; if (model == null || model.nodes == null) - ri.Sys_Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); + Com.Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); node = model.nodes[0]; // root node while (true) @@ -169,17 +170,17 @@ public abstract class Model extends Surf { int total; total = 0; - ri.Con_Printf(Defines.PRINT_ALL,"Loaded models:\n"); + VID.Printf(Defines.PRINT_ALL,"Loaded models:\n"); for (i=0; i < mod_numknown ; i++) { mod = mod_known[i]; if (mod.name == "") continue; - ri.Con_Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); + VID.Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); total += mod.extradatasize; } - ri.Con_Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); + VID.Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); } /* @@ -211,7 +212,7 @@ public abstract class Model extends Surf { int i; if (name == null || name.length() == 0) - ri.Sys_Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); + Com.Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); // // inline models are grabbed only from worldmodel @@ -220,7 +221,7 @@ public abstract class Model extends Surf { { i = Integer.parseInt(name.substring(1)); if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels) - ri.Sys_Error (Defines.ERR_DROP, "bad inline model number"); + Com.Error (Defines.ERR_DROP, "bad inline model number"); return mod_inline[i]; } @@ -250,7 +251,7 @@ public abstract class Model extends Surf { if (i == mod_numknown) { if (mod_numknown == MAX_MOD_KNOWN) - ri.Sys_Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); + Com.Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); mod_numknown++; mod = mod_known[i]; } @@ -260,12 +261,12 @@ public abstract class Model extends Surf { // // load the file // - fileBuffer = ri.FS_LoadFile(name); + fileBuffer = FS.LoadFile(name); if (fileBuffer == null) { if (crash) - ri.Sys_Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); + Com.Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); mod.name = ""; return null; @@ -300,7 +301,7 @@ public abstract class Model extends Surf { Mod_LoadBrushModel(mod, bb); break; default: - ri.Sys_Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); + Com.Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); break; } @@ -382,7 +383,7 @@ public abstract class Model extends Surf { int i, count; if ( (l.filelen % mvertex_t.DISK_SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / mvertex_t.DISK_SIZE; @@ -429,7 +430,7 @@ public abstract class Model extends Surf { int i, j, count; if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dmodel_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -469,7 +470,7 @@ public abstract class Model extends Surf { int i, count; if ( (l.filelen % medge_t.DISK_SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / medge_t.DISK_SIZE; // out = Hunk_Alloc ( (count + 1) * sizeof(*out)); @@ -502,7 +503,7 @@ public abstract class Model extends Surf { String name; if ((l.filelen % texinfo_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / texinfo_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -532,7 +533,7 @@ public abstract class Model extends Surf { out[i].image = GL_FindImage(name, it_wall); if (out[i].image == null) { - ri.Con_Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); + VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); out[i].image = r_notexture; } } @@ -614,7 +615,7 @@ public abstract class Model extends Surf { int ti; if ((l.filelen % qfiles.dface_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dface_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -648,7 +649,7 @@ public abstract class Model extends Surf { ti = in.texinfo; if (ti < 0 || ti >= loadmodel.numtexinfo) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); out[surfnum].texinfo = loadmodel.texinfo[ti]; @@ -720,7 +721,7 @@ public abstract class Model extends Surf { mnode_t[] out; if ((l.filelen % qfiles.dnode_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dnode_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -777,7 +778,7 @@ public abstract class Model extends Surf { int i, j, count, p; if ((l.filelen % qfiles.dleaf_t.SIZE) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dleaf_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); @@ -822,7 +823,7 @@ public abstract class Model extends Surf { msurface_t[] out; if ((l.filelen % Defines.SIZE_OF_SHORT) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_SHORT; // out = Hunk_Alloc ( count*sizeof(*out)); out = new msurface_t[count]; @@ -837,7 +838,7 @@ public abstract class Model extends Surf { { j = bb.getShort(); if (j < 0 || j >= loadmodel.numsurfaces) - ri.Sys_Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); + Com.Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel.surfaces[j]; } @@ -855,11 +856,11 @@ public abstract class Model extends Surf { int[] offsets; if ( (l.filelen % Defines.SIZE_OF_INT) != 0) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_INT; if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES) - ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); + Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); offsets = new int[count]; @@ -887,7 +888,7 @@ public abstract class Model extends Surf { int bits; if ((l.filelen % qfiles.dplane_t.SIZE) != 0) - ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); + Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dplane_t.SIZE; // out = Hunk_Alloc ( count*2*sizeof(*out)); @@ -930,13 +931,13 @@ public abstract class Model extends Surf { loadmodel.type = mod_brush; if (loadmodel != mod_known[0]) - ri.Sys_Error(Defines.ERR_DROP, "Loaded a brush model after the world"); + Com.Error(Defines.ERR_DROP, "Loaded a brush model after the world"); header = new qfiles.dheader_t(buffer); i = header.version; if (i != Defines.BSPVERSION) - ri.Sys_Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); + Com.Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); mod_base = fileBuffer; //(byte *)header; @@ -970,7 +971,7 @@ public abstract class Model extends Surf { starmod.nummodelsurfaces = bm.numfaces; starmod.firstnode = bm.headnode; if (starmod.firstnode >= loadmodel.numnodes) - ri.Sys_Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); + Com.Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); Math3D.VectorCopy(bm.maxs, starmod.maxs); Math3D.VectorCopy(bm.mins, starmod.mins); @@ -1008,26 +1009,26 @@ public abstract class Model extends Surf { pheader = new qfiles.dmdl_t(buffer); if (pheader.version != qfiles.ALIAS_VERSION) - ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", + Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION)); if (pheader.skinheight > MAX_LBM_HEIGHT) - ri.Sys_Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); + Com.Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); if (pheader.num_xyz <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); if (pheader.num_xyz > qfiles.MAX_VERTS) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); if (pheader.num_st <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); if (pheader.num_tris <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); if (pheader.num_frames <= 0) - ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); + Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); // // load base s and t vertices (not used in gl version) @@ -1120,11 +1121,11 @@ public abstract class Model extends Surf { qfiles.dsprite_t sprout = new qfiles.dsprite_t(buffer); if (sprout.version != qfiles.SPRITE_VERSION) - ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", + Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION)); if (sprout.numframes > qfiles.MAX_MD2SKINS) - ri.Sys_Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", + Com.Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS)); for (int i=0 ; i<sprout.numframes ; i++) @@ -1156,7 +1157,7 @@ public abstract class Model extends Surf { // explicitly free the old map if different // this guarantees that mod_known[0] is the world map - flushmap = ri.Cvar_Get("flushmap", "0", 0); + flushmap = Cvar.Get("flushmap", "0", 0); if ( !mod_known[0].name.equals(fullname) || flushmap.value != 0.0f) Mod_Free(mod_known[0]); r_worldmodel = Mod_ForName(fullname, true); diff --git a/src/jake2/render/jogl/Surf.java b/src/jake2/render/jogl/Surf.java index e4d0101..f4eb76b 100644 --- a/src/jake2/render/jogl/Surf.java +++ b/src/jake2/render/jogl/Surf.java @@ -2,7 +2,7 @@ * Surf.java * Copyright (C) 2003 * - * $Id: Surf.java,v 1.4 2004-07-12 18:19:42 hzi Exp $ + * $Id: Surf.java,v 1.5 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -28,6 +28,7 @@ package jake2.render.jogl; import jake2.Defines; import jake2.client.*; import jake2.game.cplane_t; +import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Lib; import jake2.util.Math3D; @@ -424,7 +425,7 @@ public abstract class Surf extends Draw { // try uploading the block now if ( !LM_AllocBlock( smax, tmax, lightPos) ) { - ri.Sys_Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax + "," + tmax + ") failed (dynamic)\n"); + Com.Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax + "," + tmax + ") failed (dynamic)\n"); } // kopiere die koordinaten zurueck @@ -1405,7 +1406,7 @@ public abstract class Surf extends Draw { GL.GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer ); if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS ) - ri.Sys_Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); + Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4); @@ -1556,7 +1557,7 @@ public abstract class Surf extends Draw { lightPos = new pos_t(surf.light_s, surf.light_t); if ( !LM_AllocBlock( smax, tmax, lightPos ) ) { - ri.Sys_Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); + Com.Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); } } diff --git a/src/jake2/render/jogl/Warp.java b/src/jake2/render/jogl/Warp.java index ba89fc6..cd926c6 100644 --- a/src/jake2/render/jogl/Warp.java +++ b/src/jake2/render/jogl/Warp.java @@ -2,7 +2,7 @@ * Warp.java * Copyright (C) 2003 * - * $Id: Warp.java,v 1.5 2004-07-12 22:08:03 hzi Exp $ + * $Id: Warp.java,v 1.6 2004-07-16 10:11:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -27,6 +27,7 @@ package jake2.render.jogl; import jake2.Defines; import jake2.Globals; +import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; import net.java.games.jogl.GL; @@ -125,7 +126,7 @@ public abstract class Warp extends Model { float total_s, total_t; if (numverts > 60) - ri.Sys_Error(Defines.ERR_DROP, "numverts = " + numverts); + Com.Error(Defines.ERR_DROP, "numverts = " + numverts); BoundPoly(numverts, verts, mins, maxs); @@ -454,7 +455,7 @@ public abstract class Warp extends Model { int i, j; if (nump > MAX_CLIP_VERTS-2) - ri.Sys_Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); + Com.Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); if (stage == 6) { // fully clipped, so draw it DrawSkyPolygon(nump, vecs); diff --git a/test/jake2/render/DancingQueens.java b/test/jake2/render/DancingQueens.java index c59c509..a95891f 100644 --- a/test/jake2/render/DancingQueens.java +++ b/test/jake2/render/DancingQueens.java @@ -2,7 +2,7 @@ * DancingQueens.java * Copyright (C) 2003 * - * $Id: DancingQueens.java,v 1.4 2004-07-15 14:38:40 hzi Exp $ + * $Id: DancingQueens.java,v 1.5 2004-07-16 10:11:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -50,7 +50,6 @@ public class DancingQueens String[] args; refexport_t re; - refimport_t ri; viddef_t viddef; int framecount = 0; @@ -67,91 +66,6 @@ public class DancingQueens void init() { - // only for testing - // a simple refimport_t implementation - ri = new refimport_t() { - public void Sys_Error(int err_level, String str) { - Com.Error(err_level, str, null); - } - - public void Sys_Error(int err_level, String str, Vargs vargs) { - Com.Error(err_level, str, vargs); - } - - public void Cmd_AddCommand(String name, xcommand_t cmd) { - Cmd.AddCommand(name, cmd); - } - - public void Cmd_RemoveCommand(String name) { - Cmd.RemoveCommand(name); - } - - public int Cmd_Argc() { - return Cmd.Argc(); - } - - public String Cmd_Argv(int i) { - return Cmd.Argv(i); - } - - public void Cmd_ExecuteText(int exec_when, String text) { - Cbuf.ExecuteText(exec_when, text); - } - - public void Con_Printf(int print_level, String str) { - VID.Printf(print_level, str, null); - } - - public void Con_Printf(int print_level, String str, Vargs vargs) { - VID.Printf(print_level, str, vargs); - } - - public byte[] FS_LoadFile(String name) { - return FS.LoadFile(name); - } - - public int FS_FileLength(String name) { - return FS.FileLength(name); - } - - public void FS_FreeFile(byte[] buf) { - FS.FreeFile(buf); - } - - public String FS_Gamedir() { - return FS.Gamedir(); - } - - public cvar_t Cvar_Get(String name, String value, int flags) { - return Cvar.Get(name, value, flags); - } - - public cvar_t Cvar_Set(String name, String value) { - return Cvar.Set(name, value); - } - - public void Cvar_SetValue(String name, float value) { - Cvar.SetValue(name, value); - } - - public boolean Vid_GetModeInfo(Dimension dim, int mode) { - return VID.GetModeInfo(dim, mode); - } - - public void Vid_MenuInit() { - VID.MenuInit(); - } - - public void Vid_NewWindow(int width, int height) { - VID.NewWindow(width, height); - } - - public void updateScreenCallback() { - DancingQueens.this.updateScreen(); - } - }; - - Qcommon.Init(new String[] {"DancingQueens"}); // sehr wichtig !!! VID.Shutdown(); @@ -159,7 +73,7 @@ public class DancingQueens String[] names = Renderer.getDriverNames(); System.out.println("Registered Drivers: " + Arrays.asList(names)); - this.re = Renderer.getDriver("fastjogl", ri); + this.re = Renderer.getDriver("fastjogl"); System.out.println("Use driver: " + re); System.out.println(); diff --git a/test/jake2/render/DebugCulling.java b/test/jake2/render/DebugCulling.java index 8782ce9..1cf6793 100644 --- a/test/jake2/render/DebugCulling.java +++ b/test/jake2/render/DebugCulling.java @@ -2,7 +2,7 @@ * DebugCulling.java * Copyright (C) 2003 * - * $Id: DebugCulling.java,v 1.2 2004-07-15 14:38:40 hzi Exp $ + * $Id: DebugCulling.java,v 1.3 2004-07-16 10:11:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -50,7 +50,6 @@ public class DebugCulling String[] args; refexport_t re; - refimport_t ri; viddef_t viddef; int framecount = 0; @@ -70,116 +69,11 @@ public class DebugCulling void init() { - // only for testing - // a simple refimport_t implementation - ri = new refimport_t() - { - public void Sys_Error(int err_level, String str) - { - Com.Error(err_level, str, null); - } - - public void Sys_Error(int err_level, String str, Vargs vargs) - { - Com.Error(err_level, str, vargs); - } - - public void Cmd_AddCommand(String name, xcommand_t cmd) - { - Cmd.AddCommand(name, cmd); - } - - public void Cmd_RemoveCommand(String name) - { - Cmd.RemoveCommand(name); - } - - public int Cmd_Argc() - { - return Cmd.Argc(); - } - - public String Cmd_Argv(int i) - { - return Cmd.Argv(i); - } - - public void Cmd_ExecuteText(int exec_when, String text) - { - Cbuf.ExecuteText(exec_when, text); - } - - public void Con_Printf(int print_level, String str) - { - VID.Printf(print_level, str, null); - } - - public void Con_Printf(int print_level, String str, Vargs vargs) - { - VID.Printf(print_level, str, vargs); - } - - public byte[] FS_LoadFile(String name) - { - return FS.LoadFile(name); - } - - public int FS_FileLength(String name) - { - return FS.FileLength(name); - } - - public void FS_FreeFile(byte[] buf) - { - FS.FreeFile(buf); - } - - public String FS_Gamedir() - { - return FS.Gamedir(); - } - - public cvar_t Cvar_Get(String name, String value, int flags) - { - return Cvar.Get(name, value, flags); - } - - public cvar_t Cvar_Set(String name, String value) - { - return Cvar.Set(name, value); - } - - public void Cvar_SetValue(String name, float value) - { - Cvar.SetValue(name, value); - } - - public boolean Vid_GetModeInfo(Dimension dim, int mode) - { - return VID.GetModeInfo(dim, mode); - } - - public void Vid_MenuInit() - { - VID.MenuInit(); - } - - public void Vid_NewWindow(int width, int height) - { - VID.NewWindow(width, height); - } - - public void updateScreenCallback() - { - DebugCulling.this.updateScreen(); - } - }; - - Qcommon.Init(new String[] { "$Id: DebugCulling.java,v 1.2 2004-07-15 14:38:40 hzi Exp $" }); + Qcommon.Init(new String[] { "$Id: DebugCulling.java,v 1.3 2004-07-16 10:11:36 cawe Exp $" }); // sehr wichtig !!! VID.Shutdown(); - this.re = Renderer.getDriver("jogl", ri); + this.re = Renderer.getDriver("jogl"); re.Init(0, 0); @@ -317,7 +211,7 @@ public class DebugCulling double x; if (fov_x < 1 || fov_x > 179) - ri.Sys_Error(Defines.ERR_DROP, "Bad fov: " + fov_x); + Com.Error(Defines.ERR_DROP, "Bad fov: " + fov_x); x = width / Math.tan(fov_x / 360 * Math.PI); diff --git a/test/jake2/render/TestMap.java b/test/jake2/render/TestMap.java index 71207b9..c8cfb76 100644 --- a/test/jake2/render/TestMap.java +++ b/test/jake2/render/TestMap.java @@ -2,7 +2,7 @@ * TestMap.java * Copyright (C) 2003 * - * $Id: TestMap.java,v 1.4 2004-07-15 14:38:40 hzi Exp $ + * $Id: TestMap.java,v 1.5 2004-07-16 10:11:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -53,7 +53,6 @@ public class TestMap String[] args; refexport_t re; - refimport_t ri; viddef_t viddef; int framecount = 0; @@ -73,116 +72,11 @@ public class TestMap void init() { - // only for testing - // a simple refimport_t implementation - ri = new refimport_t() - { - public void Sys_Error(int err_level, String str) - { - Com.Error(err_level, str, null); - } - - public void Sys_Error(int err_level, String str, Vargs vargs) - { - Com.Error(err_level, str, vargs); - } - - public void Cmd_AddCommand(String name, xcommand_t cmd) - { - Cmd.AddCommand(name, cmd); - } - - public void Cmd_RemoveCommand(String name) - { - Cmd.RemoveCommand(name); - } - - public int Cmd_Argc() - { - return Cmd.Argc(); - } - - public String Cmd_Argv(int i) - { - return Cmd.Argv(i); - } - - public void Cmd_ExecuteText(int exec_when, String text) - { - Cbuf.ExecuteText(exec_when, text); - } - - public void Con_Printf(int print_level, String str) - { - VID.Printf(print_level, str, null); - } - - public void Con_Printf(int print_level, String str, Vargs vargs) - { - VID.Printf(print_level, str, vargs); - } - - public byte[] FS_LoadFile(String name) - { - return FS.LoadFile(name); - } - - public int FS_FileLength(String name) - { - return FS.FileLength(name); - } - - public void FS_FreeFile(byte[] buf) - { - FS.FreeFile(buf); - } - - public String FS_Gamedir() - { - return FS.Gamedir(); - } - - public cvar_t Cvar_Get(String name, String value, int flags) - { - return Cvar.Get(name, value, flags); - } - - public cvar_t Cvar_Set(String name, String value) - { - return Cvar.Set(name, value); - } - - public void Cvar_SetValue(String name, float value) - { - Cvar.SetValue(name, value); - } - - public boolean Vid_GetModeInfo(Dimension dim, int mode) - { - return VID.GetModeInfo(dim, mode); - } - - public void Vid_MenuInit() - { - VID.MenuInit(); - } - - public void Vid_NewWindow(int width, int height) - { - VID.NewWindow(width, height); - } - - public void updateScreenCallback() - { - TestMap.this.updateScreen(); - } - }; - - Qcommon.Init(new String[] { "TestMap $Id: TestMap.java,v 1.4 2004-07-15 14:38:40 hzi Exp $" }); + Qcommon.Init(new String[] { "TestMap $Id: TestMap.java,v 1.5 2004-07-16 10:11:36 cawe Exp $" }); // sehr wichtig !!! VID.Shutdown(); - this.re = Renderer.getDriver("jogl", ri); + this.re = Renderer.getDriver("jogl"); re.Init(0, 0); diff --git a/test/jake2/render/TestRenderer.java b/test/jake2/render/TestRenderer.java index 62ffc7c..8388b20 100644 --- a/test/jake2/render/TestRenderer.java +++ b/test/jake2/render/TestRenderer.java @@ -2,7 +2,7 @@ * TestRenderer.java * Copyright (C) 2003 * - * $Id: TestRenderer.java,v 1.4 2004-07-15 14:38:40 hzi Exp $ + * $Id: TestRenderer.java,v 1.5 2004-07-16 10:11:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -48,7 +48,6 @@ public class TestRenderer { String[] args; refexport_t re; - refimport_t ri; viddef_t viddef; int framecount = 0; static int testnr = 0; @@ -66,91 +65,6 @@ public class TestRenderer { void init() { - // only for testing - // a simple refimport_t implementation - ri = new refimport_t() { - public void Sys_Error(int err_level, String str) { - Com.Error(err_level, str, null); - } - - public void Sys_Error(int err_level, String str, Vargs vargs) { - Com.Error(err_level, str, vargs); - } - - public void Cmd_AddCommand(String name, xcommand_t cmd) { - Cmd.AddCommand(name, cmd); - } - - public void Cmd_RemoveCommand(String name) { - Cmd.RemoveCommand(name); - } - - public int Cmd_Argc() { - return Cmd.Argc(); - } - - public String Cmd_Argv(int i) { - return Cmd.Argv(i); - } - - public void Cmd_ExecuteText(int exec_when, String text) { - Cbuf.ExecuteText(exec_when, text); - } - - public void Con_Printf(int print_level, String str) { - VID.Printf(print_level, str, null); - } - - public void Con_Printf(int print_level, String str, Vargs vargs) { - VID.Printf(print_level, str, vargs); - } - - public byte[] FS_LoadFile(String name) { - return FS.LoadFile(name); - } - - public int FS_FileLength(String name) { - return FS.FileLength(name); - } - - public void FS_FreeFile(byte[] buf) { - FS.FreeFile(buf); - } - - public String FS_Gamedir() { - return FS.Gamedir(); - } - - public cvar_t Cvar_Get(String name, String value, int flags) { - return Cvar.Get(name, value, flags); - } - - public cvar_t Cvar_Set(String name, String value) { - return Cvar.Set(name, value); - } - - public void Cvar_SetValue(String name, float value) { - Cvar.SetValue(name, value); - } - - public boolean Vid_GetModeInfo(Dimension dim, int mode) { - return VID.GetModeInfo(dim, mode); - } - - public void Vid_MenuInit() { - VID.MenuInit(); - } - - public void Vid_NewWindow(int width, int height) { - VID.NewWindow(width, height); - } - - public void updateScreenCallback() { - TestRenderer.this.updateScreen(); - } - }; - - Qcommon.Init(new String[] {"TestRenderer"}); // sehr wichtig !!! VID.Shutdown(); @@ -158,7 +72,7 @@ public class TestRenderer { String[] names = Renderer.getDriverNames(); System.out.println("Registered Drivers: " + Arrays.asList(names)); - this.re = Renderer.getDriver("jogl", ri); + this.re = Renderer.getDriver("jogl"); System.out.println("Use driver: " + re); System.out.println(); |