aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/jogl/Image.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/render/jogl/Image.java')
-rw-r--r--src/jake2/render/jogl/Image.java68
1 files changed, 35 insertions, 33 deletions
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) {