aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2008-03-02 14:56:23 +0000
committerCarsten Weisse <[email protected]>2008-03-02 14:56:23 +0000
commit78d0a1f33aaca5d734122371c43fd51ff43ad3fd (patch)
treeeb01e518130289d77dbdb3331042c5da399cc15a
parentadaf8e215e6dfff3435d59867661b4cd8946569f (diff)
use getters and setters of modified viddef_t
-rw-r--r--src/jake2/client/CL_inv.java6
-rw-r--r--src/jake2/client/CL_view.java4
-rw-r--r--src/jake2/client/Console.java894
-rw-r--r--src/jake2/client/Menu.java82
-rw-r--r--src/jake2/client/SCR.java48
-rw-r--r--src/jake2/client/VID.java13
-rw-r--r--src/jake2/render/Base.java5
-rw-r--r--src/jake2/render/basic/Draw.java8
-rw-r--r--src/jake2/render/basic/Main.java24
-rw-r--r--src/jake2/render/basic/Misc.java18
-rw-r--r--src/jake2/render/fast/Draw.java8
-rw-r--r--src/jake2/render/fast/Main.java29
-rw-r--r--src/jake2/render/fast/Misc.java18
-rw-r--r--test/jake2/render/DancingQueens.java10
-rw-r--r--test/jake2/render/DebugCulling.java14
-rw-r--r--test/jake2/render/TestMap.java17
-rw-r--r--test/jake2/render/TestRenderer.java57
17 files changed, 621 insertions, 634 deletions
diff --git a/src/jake2/client/CL_inv.java b/src/jake2/client/CL_inv.java
index 7b771f1..fd2579c 100644
--- a/src/jake2/client/CL_inv.java
+++ b/src/jake2/client/CL_inv.java
@@ -2,7 +2,7 @@
* CL_fx.java
* Copyright (C) 2004
*
- * $Id: CL_inv.java,v 1.3 2005-12-18 22:10:10 cawe Exp $
+ * $Id: CL_inv.java,v 1.4 2008-03-02 14:56:22 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -103,8 +103,8 @@ public class CL_inv {
if (top < 0)
top = 0;
- x = (Globals.viddef.width - 256) / 2;
- y = (Globals.viddef.height - 240) / 2;
+ x = (Globals.viddef.getWidth() - 256) / 2;
+ y = (Globals.viddef.getHeight() - 240) / 2;
// repaint everything next frame
SCR.DirtyScreen();
diff --git a/src/jake2/client/CL_view.java b/src/jake2/client/CL_view.java
index 8a834d9..ad1c254 100644
--- a/src/jake2/client/CL_view.java
+++ b/src/jake2/client/CL_view.java
@@ -1,7 +1,7 @@
/*
* CL_view.java Copyright (C) 2004
*
- * $Id: CL_view.java,v 1.4 2004-09-22 19:22:07 salomo Exp $
+ * $Id: CL_view.java,v 1.5 2008-03-02 14:56:22 cawe Exp $
*/
/*
* Copyright (C) 1997-2001 Id Software, Inc.
@@ -57,7 +57,7 @@ public class CL_view {
return; // no map loaded
SCR.AddDirtyPoint(0, 0);
- SCR.AddDirtyPoint(Globals.viddef.width - 1, Globals.viddef.height - 1);
+ SCR.AddDirtyPoint(Globals.viddef.getWidth() - 1, Globals.viddef.getHeight() - 1);
// let the render dll load the map
mapname = Globals.cl.configstrings[Defines.CS_MODELS + 1].substring(5,
diff --git a/src/jake2/client/Console.java b/src/jake2/client/Console.java
index 9ceb7fd..af2dd3a 100644
--- a/src/jake2/client/Console.java
+++ b/src/jake2/client/Console.java
@@ -2,7 +2,7 @@
* Con.java
* Copyright (C) 2003
*
- * $Id: Console.java,v 1.7 2005-06-30 08:36:22 hzi Exp $
+ * $Id: Console.java,v 1.8 2008-03-02 14:56:22 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -42,129 +42,129 @@ import jake2.util.Vargs;
public final class Console extends Globals {
public static xcommand_t ToggleConsole_f = new xcommand_t() {
- public void execute() {
- SCR.EndLoadingPlaque(); // get rid of loading plaque
-
- if (Globals.cl.attractloop) {
- Cbuf.AddText("killserver\n");
- return;
- }
-
- if (Globals.cls.state == Defines.ca_disconnected) {
- // start the demo loop again
- Cbuf.AddText("d1\n");
- return;
- }
-
- Key.ClearTyping();
- Console.ClearNotify();
-
- if (Globals.cls.key_dest == Defines.key_console) {
- Menu.ForceMenuOff();
- Cvar.Set("paused", "0");
- } else {
- Menu.ForceMenuOff();
- Globals.cls.key_dest = Defines.key_console;
-
- if (Cvar.VariableValue("maxclients") == 1
- && Globals.server_state != 0)
- Cvar.Set("paused", "1");
- }
- }
+ public void execute() {
+ SCR.EndLoadingPlaque(); // get rid of loading plaque
+
+ if (Globals.cl.attractloop) {
+ Cbuf.AddText("killserver\n");
+ return;
+ }
+
+ if (Globals.cls.state == Defines.ca_disconnected) {
+ // start the demo loop again
+ Cbuf.AddText("d1\n");
+ return;
+ }
+
+ Key.ClearTyping();
+ Console.ClearNotify();
+
+ if (Globals.cls.key_dest == Defines.key_console) {
+ Menu.ForceMenuOff();
+ Cvar.Set("paused", "0");
+ } else {
+ Menu.ForceMenuOff();
+ Globals.cls.key_dest = Defines.key_console;
+
+ if (Cvar.VariableValue("maxclients") == 1
+ && Globals.server_state != 0)
+ Cvar.Set("paused", "1");
+ }
+ }
};
public static xcommand_t Clear_f = new xcommand_t() {
- public void execute() {
- Arrays.fill(Globals.con.text, (byte) ' ');
- }
+ public void execute() {
+ Arrays.fill(Globals.con.text, (byte) ' ');
+ }
};
public static xcommand_t Dump_f = new xcommand_t() {
- public void execute() {
-
- int l, x;
- int line;
- RandomAccessFile f;
- byte[] buffer = new byte[1024];
- String name;
-
- if (Cmd.Argc() != 2) {
- Com.Printf("usage: condump <filename>\n");
- return;
- }
-
- //Com_sprintf (name, sizeof(name), "%s/%s.txt", FS_Gamedir(),
- // Cmd_Argv(1));
- name = FS.Gamedir() + "/" + Cmd.Argv(1) + ".txt";
-
- Com.Printf("Dumped console text to " + name + ".\n");
- FS.CreatePath(name);
- f = Lib.fopen(name, "rw");
- if (f == null) {
- Com.Printf("ERROR: couldn't open.\n");
- return;
- }
-
- // skip empty lines
- for (l = con.current - con.totallines + 1; l <= con.current; l++) {
- line = (l % con.totallines) * con.linewidth;
- for (x = 0; x < con.linewidth; x++)
- if (con.text[line + x] != ' ')
- break;
- if (x != con.linewidth)
- break;
- }
-
- // write the remaining lines
- buffer[con.linewidth] = 0;
- for (; l <= con.current; l++) {
- line = (l % con.totallines) * con.linewidth;
- //strncpy (buffer, line, con.linewidth);
- System.arraycopy(con.text, line, buffer, 0, con.linewidth);
- for (x = con.linewidth - 1; x >= 0; x--) {
- if (buffer[x] == ' ')
- buffer[x] = 0;
- else
- break;
- }
- for (x = 0; buffer[x] != 0; x++)
- buffer[x] &= 0x7f;
-
- buffer[x] = '\n';
- // fprintf (f, "%s\n", buffer);
- try {
- f.write(buffer, 0, x + 1);
- } catch (IOException e) {
- }
- }
-
- Lib.fclose(f);
-
- }
+ public void execute() {
+
+ int l, x;
+ int line;
+ RandomAccessFile f;
+ byte[] buffer = new byte[1024];
+ String name;
+
+ if (Cmd.Argc() != 2) {
+ Com.Printf("usage: condump <filename>\n");
+ return;
+ }
+
+ // Com_sprintf (name, sizeof(name), "%s/%s.txt", FS_Gamedir(),
+ // Cmd_Argv(1));
+ name = FS.Gamedir() + "/" + Cmd.Argv(1) + ".txt";
+
+ Com.Printf("Dumped console text to " + name + ".\n");
+ FS.CreatePath(name);
+ f = Lib.fopen(name, "rw");
+ if (f == null) {
+ Com.Printf("ERROR: couldn't open.\n");
+ return;
+ }
+
+ // skip empty lines
+ for (l = con.current - con.totallines + 1; l <= con.current; l++) {
+ line = (l % con.totallines) * con.linewidth;
+ for (x = 0; x < con.linewidth; x++)
+ if (con.text[line + x] != ' ')
+ break;
+ if (x != con.linewidth)
+ break;
+ }
+
+ // write the remaining lines
+ buffer[con.linewidth] = 0;
+ for (; l <= con.current; l++) {
+ line = (l % con.totallines) * con.linewidth;
+ // strncpy (buffer, line, con.linewidth);
+ System.arraycopy(con.text, line, buffer, 0, con.linewidth);
+ for (x = con.linewidth - 1; x >= 0; x--) {
+ if (buffer[x] == ' ')
+ buffer[x] = 0;
+ else
+ break;
+ }
+ for (x = 0; buffer[x] != 0; x++)
+ buffer[x] &= 0x7f;
+
+ buffer[x] = '\n';
+ // fprintf (f, "%s\n", buffer);
+ try {
+ f.write(buffer, 0, x + 1);
+ } catch (IOException e) {
+ }
+ }
+
+ Lib.fclose(f);
+
+ }
};
/**
- *
+ *
*/
public static void Init() {
- Globals.con.linewidth = -1;
+ Globals.con.linewidth = -1;
- CheckResize();
+ CheckResize();
- Com.Printf("Console initialized.\n");
+ Com.Printf("Console initialized.\n");
- //
- // register our commands
- //
- Globals.con_notifytime = Cvar.Get("con_notifytime", "3", 0);
+ //
+ // register our commands
+ //
+ Globals.con_notifytime = Cvar.Get("con_notifytime", "3", 0);
- Cmd.AddCommand("toggleconsole", ToggleConsole_f);
- Cmd.AddCommand("togglechat", ToggleChat_f);
- Cmd.AddCommand("messagemode", MessageMode_f);
- Cmd.AddCommand("messagemode2", MessageMode2_f);
- Cmd.AddCommand("clear", Clear_f);
- Cmd.AddCommand("condump", Dump_f);
- Globals.con.initialized = true;
+ Cmd.AddCommand("toggleconsole", ToggleConsole_f);
+ Cmd.AddCommand("togglechat", ToggleChat_f);
+ Cmd.AddCommand("messagemode", MessageMode_f);
+ Cmd.AddCommand("messagemode2", MessageMode2_f);
+ Cmd.AddCommand("clear", Clear_f);
+ Cmd.AddCommand("condump", Dump_f);
+ Globals.con.initialized = true;
}
/**
@@ -172,128 +172,129 @@ public final class Console extends Globals {
*/
public static void CheckResize() {
- int width = (Globals.viddef.width >> 3) - 2;
- if (width > Defines.MAXCMDLINE) width = Defines.MAXCMDLINE;
-
- if (width == Globals.con.linewidth)
- return;
-
- if (width < 1) { // video hasn't been initialized yet
- width = 38;
- Globals.con.linewidth = width;
- Globals.con.totallines = Defines.CON_TEXTSIZE
- / Globals.con.linewidth;
- Arrays.fill(Globals.con.text, (byte) ' ');
- } else {
- int oldwidth = Globals.con.linewidth;
- Globals.con.linewidth = width;
- int oldtotallines = Globals.con.totallines;
- Globals.con.totallines = Defines.CON_TEXTSIZE
- / Globals.con.linewidth;
- int numlines = oldtotallines;
-
- if (Globals.con.totallines < numlines)
- numlines = Globals.con.totallines;
-
- int numchars = oldwidth;
-
- if (Globals.con.linewidth < numchars)
- numchars = Globals.con.linewidth;
-
- byte[] tbuf = new byte[Defines.CON_TEXTSIZE];
- System
- .arraycopy(Globals.con.text, 0, tbuf, 0,
- Defines.CON_TEXTSIZE);
- Arrays.fill(Globals.con.text, (byte) ' ');
-
- for (int i = 0; i < numlines; i++) {
- for (int j = 0; j < numchars; j++) {
- Globals.con.text[(Globals.con.totallines - 1 - i)
- * Globals.con.linewidth + j] = tbuf[((Globals.con.current
- - i + oldtotallines) % oldtotallines)
- * oldwidth + j];
- }
- }
-
- Console.ClearNotify();
- }
-
- Globals.con.current = Globals.con.totallines - 1;
- Globals.con.display = Globals.con.current;
+ int width = (Globals.viddef.getWidth() >> 3) - 2;
+ if (width > Defines.MAXCMDLINE)
+ width = Defines.MAXCMDLINE;
+
+ if (width == Globals.con.linewidth)
+ return;
+
+ if (width < 1) { // video hasn't been initialized yet
+ width = 38;
+ Globals.con.linewidth = width;
+ Globals.con.totallines = Defines.CON_TEXTSIZE
+ / Globals.con.linewidth;
+ Arrays.fill(Globals.con.text, (byte) ' ');
+ } else {
+ int oldwidth = Globals.con.linewidth;
+ Globals.con.linewidth = width;
+ int oldtotallines = Globals.con.totallines;
+ Globals.con.totallines = Defines.CON_TEXTSIZE
+ / Globals.con.linewidth;
+ int numlines = oldtotallines;
+
+ if (Globals.con.totallines < numlines)
+ numlines = Globals.con.totallines;
+
+ int numchars = oldwidth;
+
+ if (Globals.con.linewidth < numchars)
+ numchars = Globals.con.linewidth;
+
+ byte[] tbuf = new byte[Defines.CON_TEXTSIZE];
+ System
+ .arraycopy(Globals.con.text, 0, tbuf, 0,
+ Defines.CON_TEXTSIZE);
+ Arrays.fill(Globals.con.text, (byte) ' ');
+
+ for (int i = 0; i < numlines; i++) {
+ for (int j = 0; j < numchars; j++) {
+ Globals.con.text[(Globals.con.totallines - 1 - i)
+ * Globals.con.linewidth + j] = tbuf[((Globals.con.current
+ - i + oldtotallines) % oldtotallines)
+ * oldwidth + j];
+ }
+ }
+
+ Console.ClearNotify();
+ }
+
+ Globals.con.current = Globals.con.totallines - 1;
+ Globals.con.display = Globals.con.current;
}
public static void ClearNotify() {
- int i;
- for (i = 0; i < Defines.NUM_CON_TIMES; i++)
- Globals.con.times[i] = 0;
+ int i;
+ for (i = 0; i < Defines.NUM_CON_TIMES; i++)
+ Globals.con.times[i] = 0;
}
static void DrawString(int x, int y, String s) {
- for (int i = 0; i < s.length(); i++) {
- Globals.re.DrawChar(x, y, s.charAt(i));
- x += 8;
- }
+ for (int i = 0; i < s.length(); i++) {
+ Globals.re.DrawChar(x, y, s.charAt(i));
+ x += 8;
+ }
}
static void DrawAltString(int x, int y, String s) {
- for (int i = 0; i < s.length(); i++) {
- Globals.re.DrawChar(x, y, s.charAt(i) ^ 0x80);
- x += 8;
- }
+ for (int i = 0; i < s.length(); i++) {
+ Globals.re.DrawChar(x, y, s.charAt(i) ^ 0x80);
+ x += 8;
+ }
}
/*
* ================ Con_ToggleChat_f ================
*/
static xcommand_t ToggleChat_f = new xcommand_t() {
- public void execute() {
- Key.ClearTyping();
-
- if (cls.key_dest == key_console) {
- if (cls.state == ca_active) {
- Menu.ForceMenuOff();
- cls.key_dest = key_game;
- }
- } else
- cls.key_dest = key_console;
-
- ClearNotify();
- }
+ public void execute() {
+ Key.ClearTyping();
+
+ if (cls.key_dest == key_console) {
+ if (cls.state == ca_active) {
+ Menu.ForceMenuOff();
+ cls.key_dest = key_game;
+ }
+ } else
+ cls.key_dest = key_console;
+
+ ClearNotify();
+ }
};
/*
* ================ Con_MessageMode_f ================
*/
static xcommand_t MessageMode_f = new xcommand_t() {
- public void execute() {
- chat_team = false;
- cls.key_dest = key_message;
- }
+ public void execute() {
+ chat_team = false;
+ cls.key_dest = key_message;
+ }
};
/*
* ================ Con_MessageMode2_f ================
*/
static xcommand_t MessageMode2_f = new xcommand_t() {
- public void execute() {
- chat_team = true;
- cls.key_dest = key_message;
- }
+ public void execute() {
+ chat_team = true;
+ cls.key_dest = key_message;
+ }
};
/*
* =============== Con_Linefeed ===============
*/
static void Linefeed() {
- Globals.con.x = 0;
- if (Globals.con.display == Globals.con.current)
- Globals.con.display++;
- Globals.con.current++;
- int i = (Globals.con.current % Globals.con.totallines)
- * Globals.con.linewidth;
- int e = i + Globals.con.linewidth;
- while (i++ < e)
- Globals.con.text[i] = ' ';
+ Globals.con.x = 0;
+ if (Globals.con.display == Globals.con.current)
+ Globals.con.display++;
+ Globals.con.current++;
+ int i = (Globals.con.current % Globals.con.totallines)
+ * Globals.con.linewidth;
+ int e = i + Globals.con.linewidth;
+ while (i++ < e)
+ Globals.con.text[i] = ' ';
}
/*
@@ -306,84 +307,84 @@ public final class Console extends Globals {
private static int cr;
public static void Print(String txt) {
- int y;
- int c, l;
- int mask;
- int txtpos = 0;
-
- if (!con.initialized)
- return;
-
- if (txt.charAt(0) == 1 || txt.charAt(0) == 2) {
- mask = 128; // go to colored text
- txtpos++;
- } else
- mask = 0;
-
- while (txtpos < txt.length()) {
- c = txt.charAt(txtpos);
- // count word length
- for (l = 0; l < con.linewidth && l < (txt.length() - txtpos); l++)
- if (txt.charAt(l + txtpos) <= ' ')
- break;
-
- // word wrap
- if (l != con.linewidth && (con.x + l > con.linewidth))
- con.x = 0;
-
- txtpos++;
-
- if (cr != 0) {
- con.current--;
- cr = 0;
- }
-
- if (con.x == 0) {
- Console.Linefeed();
- // mark time for transparent overlay
- if (con.current >= 0)
- con.times[con.current % NUM_CON_TIMES] = cls.realtime;
- }
-
- switch (c) {
- case '\n':
- con.x = 0;
- break;
-
- case '\r':
- con.x = 0;
- cr = 1;
- break;
-
- default: // display character and advance
- y = con.current % con.totallines;
- con.text[y * con.linewidth + con.x] = (byte) (c | mask | con.ormask);
- con.x++;
- if (con.x >= con.linewidth)
- con.x = 0;
- break;
- }
- }
+ int y;
+ int c, l;
+ int mask;
+ int txtpos = 0;
+
+ if (!con.initialized)
+ return;
+
+ if (txt.charAt(0) == 1 || txt.charAt(0) == 2) {
+ mask = 128; // go to colored text
+ txtpos++;
+ } else
+ mask = 0;
+
+ while (txtpos < txt.length()) {
+ c = txt.charAt(txtpos);
+ // count word length
+ for (l = 0; l < con.linewidth && l < (txt.length() - txtpos); l++)
+ if (txt.charAt(l + txtpos) <= ' ')
+ break;
+
+ // word wrap
+ if (l != con.linewidth && (con.x + l > con.linewidth))
+ con.x = 0;
+
+ txtpos++;
+
+ if (cr != 0) {
+ con.current--;
+ cr = 0;
+ }
+
+ if (con.x == 0) {
+ Console.Linefeed();
+ // mark time for transparent overlay
+ if (con.current >= 0)
+ con.times[con.current % NUM_CON_TIMES] = cls.realtime;
+ }
+
+ switch (c) {
+ case '\n':
+ con.x = 0;
+ break;
+
+ case '\r':
+ con.x = 0;
+ cr = 1;
+ break;
+
+ default: // display character and advance
+ y = con.current % con.totallines;
+ con.text[y * con.linewidth + con.x] = (byte) (c | mask | con.ormask);
+ con.x++;
+ if (con.x >= con.linewidth)
+ con.x = 0;
+ break;
+ }
+ }
}
/*
* ============== Con_CenteredPrint ==============
*/
static void CenteredPrint(String text) {
- int l = text.length();
- l = (con.linewidth - l) / 2;
- if (l < 0)
- l = 0;
+ int l = text.length();
+ l = (con.linewidth - l) / 2;
+ if (l < 0)
+ l = 0;
- StringBuffer sb = new StringBuffer(1024);
- for (int i = 0; i < l; i++)
- sb.append(' ');
- sb.append(text);
- sb.append('\n');
+ StringBuffer sb = new StringBuffer(1024);
+ for (int i = 0; i < l; i++)
+ sb.append(' ');
+ sb.append(text);
+ sb.append('\n');
- sb.setLength(1024);
+ sb.setLength(1024);
- Console.Print(sb.toString());
+ Console.Print(sb.toString());
}
/*
@@ -401,36 +402,36 @@ public final class Console extends Globals {
* ================
*/
static void DrawInput() {
- int i;
- byte[] text;
- int start = 0;
+ int i;
+ byte[] text;
+ int start = 0;
- if (cls.key_dest == key_menu)
- return;
- if (cls.key_dest != key_console && cls.state == ca_active)
- return; // don't draw anything (always draw if not active)
+ if (cls.key_dest == key_menu)
+ return;
+ if (cls.key_dest != key_console && cls.state == ca_active)
+ return; // don't draw anything (always draw if not active)
- text = key_lines[edit_line];
+ text = key_lines[edit_line];
- // add the cursor frame
- text[key_linepos] = (byte) (10 + ((int) (cls.realtime >> 8) & 1));
+ // add the cursor frame
+ text[key_linepos] = (byte) (10 + ((int) (cls.realtime >> 8) & 1));
- // fill out remainder with spaces
- for (i = key_linepos + 1; i < con.linewidth; i++)
- text[i] = ' ';
+ // fill out remainder with spaces
+ for (i = key_linepos + 1; i < con.linewidth; i++)
+ text[i] = ' ';
- // prestep if horizontally scrolling
- if (key_linepos >= con.linewidth)
- start += 1 + key_linepos - con.linewidth;
+ // prestep if horizontally scrolling
+ if (key_linepos >= con.linewidth)
+ start += 1 + key_linepos - con.linewidth;
- // draw it
- // y = con.vislines-16;
+ // draw it
+ // y = con.vislines-16;
- for (i = 0; i < con.linewidth; i++)
- re.DrawChar((i + 1) << 3, con.vislines - 22, text[i]);
+ for (i = 0; i < con.linewidth; i++)
+ re.DrawChar((i + 1) << 3, con.vislines - 22, text[i]);
- // remove cursor
- key_lines[edit_line][key_linepos] = 0;
+ // remove cursor
+ key_lines[edit_line][key_linepos] = 0;
}
/*
@@ -440,60 +441,60 @@ public final class Console extends Globals {
* ================
*/
static void DrawNotify() {
- int x, v;
- int text;
- int i;
- int time;
- String s;
- int skip;
-
- v = 0;
- for (i = con.current - NUM_CON_TIMES + 1; i <= con.current; i++) {
- if (i < 0)
- continue;
-
- time = (int) con.times[i % NUM_CON_TIMES];
- if (time == 0)
- continue;
-
- time = (int) (cls.realtime - time);
- if (time > con_notifytime.value * 1000)
- continue;
-
- text = (i % con.totallines) * con.linewidth;
-
- for (x = 0; x < con.linewidth; x++)
- re.DrawChar((x + 1) << 3, v, con.text[text + x]);
-
- v += 8;
- }
-
- if (cls.key_dest == key_message) {
- if (chat_team) {
- DrawString(8, v, "say_team:");
- skip = 11;
- } else {
- DrawString(8, v, "say:");
- skip = 5;
- }
-
- s = chat_buffer;
- if (chat_bufferlen > (viddef.width >> 3) - (skip + 1))
- s = s.substring(chat_bufferlen
- - ((viddef.width >> 3) - (skip + 1)));
-
- for (x = 0; x < s.length(); x++) {
- re.DrawChar((x + skip) << 3, v, s.charAt(x));
- }
- re.DrawChar((x + skip) << 3, v,
- (int) (10 + ((cls.realtime >> 8) & 1)));
- v += 8;
- }
-
- if (v != 0) {
- SCR.AddDirtyPoint(0, 0);
- SCR.AddDirtyPoint(viddef.width - 1, v);
- }
+ int x, v;
+ int text;
+ int i;
+ int time;
+ String s;
+ int skip;
+
+ v = 0;
+ for (i = con.current - NUM_CON_TIMES + 1; i <= con.current; i++) {
+ if (i < 0)
+ continue;
+
+ time = (int) con.times[i % NUM_CON_TIMES];
+ if (time == 0)
+ continue;
+
+ time = (int) (cls.realtime - time);
+ if (time > con_notifytime.value * 1000)
+ continue;
+
+ text = (i % con.totallines) * con.linewidth;
+
+ for (x = 0; x < con.linewidth; x++)
+ re.DrawChar((x + 1) << 3, v, con.text[text + x]);
+
+ v += 8;
+ }
+
+ if (cls.key_dest == key_message) {
+ if (chat_team) {
+ DrawString(8, v, "say_team:");
+ skip = 11;
+ } else {
+ DrawString(8, v, "say:");
+ skip = 5;
+ }
+
+ s = chat_buffer;
+ if (chat_bufferlen > (viddef.getWidth() >> 3) - (skip + 1))
+ s = s.substring(chat_bufferlen
+ - ((viddef.getWidth() >> 3) - (skip + 1)));
+
+ for (x = 0; x < s.length(); x++) {
+ re.DrawChar((x + skip) << 3, v, s.charAt(x));
+ }
+ re.DrawChar((x + skip) << 3, v,
+ (int) (10 + ((cls.realtime >> 8) & 1)));
+ v += 8;
+ }
+
+ if (v != 0) {
+ SCR.AddDirtyPoint(0, 0);
+ SCR.AddDirtyPoint(viddef.getWidth() - 1, v);
+ }
}
/*
@@ -502,109 +503,108 @@ public final class Console extends Globals {
* Draws the console with the solid background ================
*/
static void DrawConsole(float frac) {
- int i, j, x, y, n;
- int rows;
- int text;
- int row;
- int lines;
- String version;
-
- lines = (int) (viddef.height * frac);
- if (lines <= 0)
- return;
-
- if (lines > viddef.height)
- lines = viddef.height;
-
- // draw the background
- re.DrawStretchPic(0, -viddef.height + lines, viddef.width,
- viddef.height, "conback");
- SCR.AddDirtyPoint(0, 0);
- SCR.AddDirtyPoint(viddef.width - 1, lines - 1);
-
- version = Com.sprintf("v%4.2f", new Vargs(1).add(VERSION));
- for (x = 0; x < 5; x++)
- re.DrawChar(viddef.width - 44 + x * 8, lines - 12, 128 + version
- .charAt(x));
-
- // draw the text
- con.vislines = lines;
-
- rows = (lines - 22) >> 3; // rows of text to draw
-
- y = lines - 30;
-
- // draw from the bottom up
- if (con.display != con.current) {
- // draw arrows to show the buffer is backscrolled
- for (x = 0; x < con.linewidth; x += 4)
- re.DrawChar((x + 1) << 3, y, '^');
-
- y -= 8;
- rows--;
- }
-
- row = con.display;
- for (i = 0; i < rows; i++, y -= 8, row--) {
- if (row < 0)
- break;
- if (con.current - row >= con.totallines)
- break; // past scrollback wrap point
-
- int first = (row % con.totallines) * con.linewidth;
-
- for (x = 0; x < con.linewidth; x++)
- re.DrawChar((x + 1) << 3, y, con.text[x + first]);
- }
-
- //ZOID
- // draw the download bar
- // figure out width
- if (cls.download != null) {
- if ((text = cls.downloadname.lastIndexOf('/')) != 0)
- text++;
- else
- text = 0;
-
- x = con.linewidth - ((con.linewidth * 7) / 40);
- y = x - (cls.downloadname.length() - text) - 8;
- i = con.linewidth / 3;
- StringBuffer dlbar = new StringBuffer(512);
- if (cls.downloadname.length() - text > i) {
- y = x - i - 11;
- int end = text + i - 1;
- ;
- dlbar.append(cls.downloadname.substring(text, end));
- dlbar.append("...");
- } else {
- dlbar.append(cls.downloadname.substring(text));
- }
- dlbar.append(": ");
- dlbar.append((char) 0x80);
-
- // where's the dot go?
- if (cls.downloadpercent == 0)
- n = 0;
- else
- n = y * cls.downloadpercent / 100;
-
- for (j = 0; j < y; j++) {
- if (j == n)
- dlbar.append((char) 0x83);
- else
- dlbar.append((char) 0x81);
- }
- dlbar.append((char) 0x82);
- dlbar.append((cls.downloadpercent < 10) ? " 0" : " ");
- dlbar.append(cls.downloadpercent).append('%');
- // draw it
- y = con.vislines - 12;
- for (i = 0; i < dlbar.length(); i++)
- re.DrawChar((i + 1) << 3, y, dlbar.charAt(i));
- }
- //ZOID
-
- // draw the input prompt, user text, and cursor if desired
- DrawInput();
+
+ int width = viddef.getWidth();
+ int height = viddef.getHeight();
+ int lines = (int) (height * frac);
+ if (lines <= 0)
+ return;
+
+ if (lines > height)
+ lines = height;
+
+ // draw the background
+ re.DrawStretchPic(0, -height + lines, width, height, "conback");
+ SCR.AddDirtyPoint(0, 0);
+ SCR.AddDirtyPoint(width - 1, lines - 1);
+
+ String version = Com.sprintf("v%4.2f", new Vargs(1).add(VERSION));
+ for (int x = 0; x < 5; x++)
+ re
+ .DrawChar(width - 44 + x * 8, lines - 12, 128 + version
+ .charAt(x));
+
+ // draw the text
+ con.vislines = lines;
+
+ int rows = (lines - 22) >> 3; // rows of text to draw
+
+ int y = lines - 30;
+
+ // draw from the bottom up
+ if (con.display != con.current) {
+ // draw arrows to show the buffer is backscrolled
+ for (int x = 0; x < con.linewidth; x += 4)
+ re.DrawChar((x + 1) << 3, y, '^');
+
+ y -= 8;
+ rows--;
+ }
+
+ int i, j, x, n;
+
+ int row = con.display;
+ for (i = 0; i < rows; i++, y -= 8, row--) {
+ if (row < 0)
+ break;
+ if (con.current - row >= con.totallines)
+ break; // past scrollback wrap point
+
+ int first = (row % con.totallines) * con.linewidth;
+
+ for (x = 0; x < con.linewidth; x++)
+ re.DrawChar((x + 1) << 3, y, con.text[x + first]);
+ }
+
+ // ZOID
+ // draw the download bar
+ // figure out width
+ if (cls.download != null) {
+ int text;
+ if ((text = cls.downloadname.lastIndexOf('/')) != 0)
+ text++;
+ else
+ text = 0;
+
+ x = con.linewidth - ((con.linewidth * 7) / 40);
+ y = x - (cls.downloadname.length() - text) - 8;
+ i = con.linewidth / 3;
+ StringBuffer dlbar = new StringBuffer(512);
+ if (cls.downloadname.length() - text > i) {
+ y = x - i - 11;
+ int end = text + i - 1;
+ ;
+ dlbar.append(cls.downloadname.substring(text, end));
+ dlbar.append("...");
+ } else {
+ dlbar.append(cls.downloadname.substring(text));
+ }
+ dlbar.append(": ");
+ dlbar.append((char) 0x80);
+
+ // where's the dot go?
+ if (cls.downloadpercent == 0)
+ n = 0;
+ else
+ n = y * cls.downloadpercent / 100;
+
+ for (j = 0; j < y; j++) {
+ if (j == n)
+ dlbar.append((char) 0x83);
+ else
+ dlbar.append((char) 0x81);
+ }
+ dlbar.append((char) 0x82);
+ dlbar.append((cls.downloadpercent < 10) ? " 0" : " ");
+ dlbar.append(cls.downloadpercent).append('%');
+ // draw it
+ y = con.vislines - 12;
+ for (i = 0; i < dlbar.length(); i++)
+ re.DrawChar((i + 1) << 3, y, dlbar.charAt(i));
+ }
+ // ZOID
+
+ // draw the input prompt, user text, and cursor if desired
+ DrawInput();
}
} \ No newline at end of file
diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java
index d606ac8..ecb4e3e 100644
--- a/src/jake2/client/Menu.java
+++ b/src/jake2/client/Menu.java
@@ -2,7 +2,7 @@
* Menu.java
* Copyright (C) 2004
*
- * $Id: Menu.java,v 1.22 2008-03-02 08:35:30 cawe Exp $
+ * $Id: Menu.java,v 1.23 2008-03-02 14:56:22 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -177,8 +177,8 @@ public final class Menu extends Key {
Dimension dim = new Dimension();
Globals.re.DrawGetPicSize(dim, name);
- Globals.re.DrawPic(viddef.width / 2 - dim.width / 2,
- viddef.height / 2 - 110, name);
+ Globals.re.DrawPic(viddef.getWidth() / 2 - dim.width / 2,
+ viddef.getHeight() / 2 - 110, name);
}
static void PushMenu(xcommand_t draw, keyfunc_t key) { //, String(*key)
@@ -326,8 +326,8 @@ public final class Menu extends Key {
* and will be centered on higher res screens. ================
*/
public static void DrawCharacter(int cx, int cy, int num) {
- re.DrawChar(cx + ((viddef.width - 320) >> 1), cy
- + ((viddef.height - 240) >> 1), num);
+ re.DrawChar(cx + ((viddef.getWidth() - 320) >> 1), cy
+ + ((viddef.getHeight() - 240) >> 1), num);
}
public static void Print(int cx, int cy, String str) {
@@ -348,8 +348,8 @@ public final class Menu extends Key {
}
public static void DrawPic(int x, int y, String pic) {
- re.DrawPic(x + ((viddef.width - 320) >> 1), y
- + ((viddef.height - 240) >> 1), pic);
+ re.DrawPic(x + ((viddef.getWidth() - 320) >> 1), y
+ + ((viddef.getHeight() - 240) >> 1), pic);
}
/*
@@ -454,8 +454,8 @@ public final class Menu extends Key {
totalheight += (h + 12);
}
- ystart = (Globals.viddef.height / 2 - 110);
- xoffset = (Globals.viddef.width - widest + 70) / 2;
+ ystart = (Globals.viddef.getHeight() / 2 - 110);
+ xoffset = (Globals.viddef.getWidth() - widest + 70) / 2;
for (i = 0; i < names.length; i++) {
if (i != m_main_cursor)
@@ -586,7 +586,7 @@ public final class Menu extends Key {
}
static void Multiplayer_MenuInit() {
- s_multiplayer_menu.x = (int) (viddef.width * 0.50f - 64);
+ s_multiplayer_menu.x = (int) (viddef.getWidth() * 0.50f - 64);
s_multiplayer_menu.nitems = 0;
s_join_network_server_action.type = MTYPE_ACTION;
@@ -817,7 +817,7 @@ public final class Menu extends Key {
int y = 0;
int i = 0;
- s_keys_menu.x = (int) (viddef.width * 0.50);
+ s_keys_menu.x = (int) (viddef.getWidth() * 0.50);
s_keys_menu.nitems = 0;
s_keys_menu.cursordraw = new mcallback() {
public void execute(Object o) {
@@ -1446,8 +1446,8 @@ public final class Menu extends Key {
/*
* * configure controls menu and menu items
*/
- s_options_menu.x = viddef.width / 2;
- s_options_menu.y = viddef.height / 2 - 58;
+ s_options_menu.x = viddef.getWidth() / 2;
+ s_options_menu.y = viddef.getHeight() / 2 - 58;
s_options_menu.nitems = 0;
s_options_sfxvolume_slider.type = MTYPE_SLIDER;
@@ -1841,8 +1841,8 @@ public final class Menu extends Key {
/*
* * draw the credits
*/
- for (i = 0, y = (int) (viddef.height - ((cls.realtime - credits_start_time) / 40.0F)); credits[i] != null
- && y < viddef.height; y += 10, i++) {
+ for (i = 0, y = (int) (viddef.getHeight() - ((cls.realtime - credits_start_time) / 40.0F)); credits[i] != null
+ && y < viddef.getHeight(); y += 10, i++) {
int j, stringoffset = 0;
boolean bold = false;
@@ -1860,7 +1860,7 @@ public final class Menu extends Key {
for (j = 0; j + stringoffset < credits[i].length(); j++) {
int x;
- x = (viddef.width - credits[i].length() * 8 - stringoffset * 8)
+ x = (viddef.getWidth() - credits[i].length() * 8 - stringoffset * 8)
/ 2 + (j + stringoffset) * 8;
if (bold)
@@ -2008,7 +2008,7 @@ public final class Menu extends Key {
static void Game_MenuInit() {
- s_game_menu.x = (int) (viddef.width * 0.50);
+ s_game_menu.x = (int) (viddef.getWidth() * 0.50);
s_game_menu.nitems = 0;
s_easy_game_action.type = MTYPE_ACTION;
@@ -2194,8 +2194,8 @@ public final class Menu extends Key {
static void LoadGame_MenuInit() {
int i;
- s_loadgame_menu.x = viddef.width / 2 - 120;
- s_loadgame_menu.y = viddef.height / 2 - 58;
+ s_loadgame_menu.x = viddef.getWidth() / 2 - 120;
+ s_loadgame_menu.y = viddef.getHeight() / 2 - 58;
s_loadgame_menu.nitems = 0;
Create_Savestrings();
@@ -2287,8 +2287,8 @@ public final class Menu extends Key {
static void SaveGame_MenuInit() {
int i;
- s_savegame_menu.x = viddef.width / 2 - 120;
- s_savegame_menu.y = viddef.height / 2 - 58;
+ s_savegame_menu.x = viddef.getWidth() / 2 - 120;
+ s_savegame_menu.y = viddef.getHeight() / 2 - 58;
s_savegame_menu.nitems = 0;
Create_Savestrings();
@@ -2451,7 +2451,7 @@ public final class Menu extends Key {
static void JoinServer_MenuInit() {
int i;
- s_joinserver_menu.x = (int) (viddef.width * 0.50 - 120);
+ s_joinserver_menu.x = (int) (viddef.getWidth() * 0.50 - 120);
s_joinserver_menu.nitems = 0;
s_joinserver_address_book_action.type = MTYPE_ACTION;
@@ -2748,7 +2748,7 @@ public final class Menu extends Key {
/*
* * initialize the menu stuff
*/
- s_startserver_menu.x = (int) (viddef.width * 0.50);
+ s_startserver_menu.x = (int) (viddef.getWidth() * 0.50);
s_startserver_menu.nitems = 0;
s_startmap_list.type = MTYPE_SPINCONTROL;
@@ -3081,7 +3081,7 @@ public final class Menu extends Key {
int dmflags = (int) Cvar.VariableValue("dmflags");
int y = 0;
- s_dmoptions_menu.x = (int) (viddef.width * 0.50);
+ s_dmoptions_menu.x = (int) (viddef.getWidth() * 0.50);
s_dmoptions_menu.nitems = 0;
s_falls_box.type = MTYPE_SPINCONTROL;
@@ -3435,7 +3435,7 @@ public final class Menu extends Key {
int y = 0;
- s_downloadoptions_menu.x = (int) (viddef.width * 0.50);
+ s_downloadoptions_menu.x = (int) (viddef.getWidth() * 0.50);
s_downloadoptions_menu.nitems = 0;
s_download_title.type = MTYPE_SEPARATOR;
@@ -3566,8 +3566,8 @@ public final class Menu extends Key {
}
static void AddressBook_MenuInit() {
- s_addressbook_menu.x = viddef.width / 2 - 142;
- s_addressbook_menu.y = viddef.height / 2 - 58;
+ s_addressbook_menu.x = viddef.getWidth() / 2 - 142;
+ s_addressbook_menu.y = viddef.getHeight() / 2 - 58;
s_addressbook_menu.nitems = 0;
for (int i = 0; i < NUM_ADDRESSBOOK_ENTRIES; i++) {
@@ -3958,8 +3958,8 @@ public final class Menu extends Key {
}
}
- s_player_config_menu.x = viddef.width / 2 - 95;
- s_player_config_menu.y = viddef.height / 2 - 97;
+ s_player_config_menu.x = viddef.getWidth() / 2 - 95;
+ s_player_config_menu.y = viddef.getHeight() / 2 - 97;
s_player_config_menu.nitems = 0;
s_player_name_field.type = MTYPE_FIELD;
@@ -4083,8 +4083,8 @@ public final class Menu extends Key {
//memset(refdef, 0, sizeof(refdef));
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
+ refdef.x = viddef.getWidth() / 2;
+ refdef.y = viddef.getHeight() / 2 - 72;
refdef.width = 144;
refdef.height = 168;
refdef.fov_x = 40;
@@ -4129,8 +4129,8 @@ public final class Menu extends Key {
Menu_Draw(s_player_config_menu);
DrawTextBox(
- (int) ((refdef.x) * (320.0F / viddef.width) - 8),
- (int) ((viddef.height / 2) * (240.0F / viddef.height) - 77),
+ (int) ((refdef.x) * (320.0F / viddef.getWidth()) - 8),
+ (int) ((viddef.getHeight() / 2) * (240.0F / viddef.getHeight()) - 77),
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
@@ -4234,7 +4234,7 @@ public final class Menu extends Key {
re.DrawGetPicSize(d, "quit");
w = d.width;
h = d.height;
- re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit");
+ re.DrawPic((viddef.getWidth() - w) / 2, (viddef.getHeight() - h) / 2, "quit");
}
static xcommand_t Menu_Quit = new xcommand_t() {
@@ -4296,7 +4296,7 @@ public final class Menu extends Key {
// dim everything behind it down
if (cl.cinematictime > 0)
- re.DrawFill(0, 0, viddef.width, viddef.height, 0);
+ re.DrawFill(0, 0, viddef.getWidth(), viddef.getHeight(), 0);
else
re.DrawFadeScreen();
@@ -4595,7 +4595,7 @@ public final class Menu extends Key {
height = ((menucommon_s) menu.items[menu.nitems - 1]).y;
height += 10;
- menu.y = (viddef.height - height) / 2;
+ menu.y = (viddef.getHeight() - height) / 2;
}
public static void Menu_Draw(menuframework_s menu) {
@@ -4660,14 +4660,14 @@ public final class Menu extends Key {
public static void Menu_DrawStatusBar(String string) {
if (string != null) {
int l = string.length();
- int maxrow = viddef.height / 8;
- int maxcol = viddef.width / 8;
+ int maxrow = viddef.getHeight() / 8;
+ int maxcol = viddef.getWidth() / 8;
int col = maxcol / 2 - l / 2;
- re.DrawFill(0, viddef.height - 8, viddef.width, 8, 4);
- Menu_DrawString(col * 8, viddef.height - 8, string);
+ re.DrawFill(0, viddef.getHeight() - 8, viddef.getWidth(), 8, 4);
+ Menu_DrawString(col * 8, viddef.getHeight() - 8, string);
} else {
- re.DrawFill(0, viddef.height - 8, viddef.width, 8, 0);
+ re.DrawFill(0, viddef.getHeight() - 8, viddef.getWidth(), 8, 0);
}
}
diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java
index ee0a973..fb4121c 100644
--- a/src/jake2/client/SCR.java
+++ b/src/jake2/client/SCR.java
@@ -297,7 +297,7 @@ public final class SCR extends Globals {
start = 0;
if (scr_center_lines <= 4)
- y = (int) (viddef.height * 0.35);
+ y = (int) (viddef.getHeight() * 0.35);
else
y = 48;
@@ -307,7 +307,7 @@ public final class SCR extends Globals {
if (start + l == cs.length() - 1
|| cs.charAt(start + l) == '\n')
break;
- x = (viddef.width - l * 8) / 2;
+ x = (viddef.getWidth() - l * 8) / 2;
SCR.AddDirtyPoint(x, y);
for (j = 0; j < l; j++, x += 8) {
re.DrawChar(x, y, cs.charAt(start + j));
@@ -355,14 +355,14 @@ public final class SCR extends Globals {
size = (int) scr_viewsize.value;
- scr_vrect.width = viddef.width * size / 100;
+ scr_vrect.width = viddef.getWidth() * size / 100;
scr_vrect.width &= ~7;
- scr_vrect.height = viddef.height * size / 100;
+ scr_vrect.height = viddef.getHeight() * size / 100;
scr_vrect.height &= ~1;
- scr_vrect.x = (viddef.width - scr_vrect.width) / 2;
- scr_vrect.y = (viddef.height - scr_vrect.height) / 2;
+ scr_vrect.x = (viddef.getWidth() - scr_vrect.width) / 2;
+ scr_vrect.y = (viddef.getHeight() - scr_vrect.height) / 2;
}
/*
@@ -489,7 +489,7 @@ public final class SCR extends Globals {
return;
re.DrawGetPicSize(dim, "pause");
- re.DrawPic((viddef.width - dim.width) / 2, viddef.height / 2 + 8,
+ re.DrawPic((viddef.getWidth() - dim.width) / 2, viddef.getHeight() / 2 + 8,
"pause");
}
@@ -504,8 +504,8 @@ public final class SCR extends Globals {
scr_draw_loading = 0;
re.DrawGetPicSize(dim, "loading");
- re.DrawPic((viddef.width - dim.width) / 2,
- (viddef.height - dim.height) / 2, "loading");
+ re.DrawPic((viddef.getWidth() - dim.width) / 2,
+ (viddef.getHeight() - dim.height) / 2, "loading");
}
// =============================================================================
@@ -551,7 +551,7 @@ public final class SCR extends Globals {
if (cls.state != ca_active || !cl.refresh_prepped) { // connected, but
// can't render
Console.DrawConsole(0.5f);
- re.DrawFill(0, viddef.height / 2, viddef.width, viddef.height / 2,
+ re.DrawFill(0, viddef.getHeight() / 2, viddef.getWidth(), viddef.getHeight() / 2,
0);
return;
}
@@ -644,7 +644,7 @@ public final class SCR extends Globals {
static void DirtyScreen() {
AddDirtyPoint(0, 0);
- AddDirtyPoint(viddef.width - 1, viddef.height - 1);
+ AddDirtyPoint(viddef.getWidth() - 1, viddef.getHeight() - 1);
}
/*
@@ -694,7 +694,7 @@ public final class SCR extends Globals {
scr_dirty.y2 = -9999;
// don't bother with anything convered by the console)
- top = (int) (scr_con_current * viddef.height);
+ top = (int) (scr_con_current * viddef.getHeight());
if (top >= clear.y1)
clear.y1 = top;
@@ -902,12 +902,12 @@ public final class SCR extends Globals {
}
if (parser.tokenEquals("xr")) {
parser.next();
- x = viddef.width + parser.tokenAsInt();
+ x = viddef.getWidth() + parser.tokenAsInt();
continue;
}
if (parser.tokenEquals("xv")) {
parser.next();
- x = viddef.width / 2 - 160 + parser.tokenAsInt();
+ x = viddef.getWidth() / 2 - 160 + parser.tokenAsInt();
continue;
}
@@ -918,12 +918,12 @@ public final class SCR extends Globals {
}
if (parser.tokenEquals("yb")) {
parser.next();
- y = viddef.height + parser.tokenAsInt();
+ y = viddef.getHeight() + parser.tokenAsInt();
continue;
}
if (parser.tokenEquals("yv")) {
parser.next();
- y = viddef.height / 2 - 120 + parser.tokenAsInt();
+ y = viddef.getHeight() / 2 - 120 + parser.tokenAsInt();
continue;
}
@@ -944,9 +944,9 @@ public final class SCR extends Globals {
int score, ping, time;
parser.next();
- x = viddef.width / 2 - 160 + parser.tokenAsInt();
+ x = viddef.getWidth() / 2 - 160 + parser.tokenAsInt();
parser.next();
- y = viddef.height / 2 - 120 + parser.tokenAsInt();
+ y = viddef.getHeight() / 2 - 120 + parser.tokenAsInt();
AddDirtyPoint(x, y);
AddDirtyPoint(x + 159, y + 31);
@@ -981,9 +981,9 @@ public final class SCR extends Globals {
int score, ping;
parser.next();
- x = viddef.width / 2 - 160 + parser.tokenAsInt();
+ x = viddef.getWidth() / 2 - 160 + parser.tokenAsInt();
parser.next();
- y = viddef.height / 2 - 120 + parser.tokenAsInt();
+ y = viddef.getHeight() / 2 - 120 + parser.tokenAsInt();
AddDirtyPoint(x, y);
AddDirtyPoint(x + 159, y + 31);
@@ -1214,8 +1214,8 @@ public final class SCR extends Globals {
re.CinematicSetPalette(null);
scr_draw_loading = 0; // false
re.DrawGetPicSize(dim, "loading");
- re.DrawPic((viddef.width - dim.width) / 2,
- (viddef.height - dim.height) / 2, "loading");
+ re.DrawPic((viddef.getWidth() - dim.width) / 2,
+ (viddef.getHeight() - dim.height) / 2, "loading");
}
// if a cinematic is supposed to be running, handle menus
// and console specially
@@ -1345,7 +1345,7 @@ public final class SCR extends Globals {
lastframes = cls.framecount;
lasttime = cls.realtime;
}
- int x = viddef.width - 8 * fpsvalue.length() - 2;
+ int x = viddef.getWidth() - 8 * fpsvalue.length() - 2;
for (int i = 0; i < fpsvalue.length(); i++) {
re.DrawChar(x, 2, fpsvalue.charAt(i));
x += 8;
@@ -1803,7 +1803,7 @@ public final class SCR extends Globals {
if (cin.pic == null)
return true;
- Globals.re.DrawStretchRaw(0, 0, viddef.width, viddef.height, cin.width, cin.height, cin.pic);
+ Globals.re.DrawStretchRaw(0, 0, viddef.getWidth(), viddef.getHeight(), cin.width, cin.height, cin.pic);
return true;
}
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java
index e6d0a56..6af2220 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.20 2007-01-13 18:36:23 cawe Exp $
+ * $Id: VID.java,v 1.21 2008-03-02 14:56:22 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -147,8 +147,7 @@ public class VID extends Globals {
** VID_NewWindow
*/
public static void NewWindow(int width, int height) {
- Globals.viddef.width = width;
- Globals.viddef.height = height;
+ Globals.viddef.setSize(width, height);
}
static void FreeReflib()
@@ -238,8 +237,8 @@ public class VID extends Globals {
*/
public static void CheckChanges()
{
- cvar_t gl_mode;
-
+ Globals.viddef.update();
+
if ( vid_ref.modified )
{
S.StopAllSounds();
@@ -565,7 +564,7 @@ public class VID extends Globals {
}
}
- s_opengl_menu.x = (int)(viddef.width * 0.50f);
+ s_opengl_menu.x = (int)(viddef.getWidth() * 0.50f);
s_opengl_menu.nitems = 0;
s_ref_list.type = MTYPE_SPINCONTROL;
@@ -705,7 +704,7 @@ public class VID extends Globals {
*/
Dimension dim = new Dimension();
re.DrawGetPicSize( dim, "m_banner_video" );
- re.DrawPic( viddef.width / 2 - dim.width / 2, viddef.height /2 - 110, "m_banner_video" );
+ re.DrawPic( viddef.getWidth() / 2 - dim.width / 2, viddef.getHeight() /2 - 110, "m_banner_video" );
/*
** move cursor to a reasonable starting position
diff --git a/src/jake2/render/Base.java b/src/jake2/render/Base.java
index ddec0d8..7997893 100644
--- a/src/jake2/render/Base.java
+++ b/src/jake2/render/Base.java
@@ -179,9 +179,8 @@ public abstract class Base implements QGLConst, RenderAPI {
gl = (QGL)driver;
}
- public static void setVid(int width, int height) {
- vid.width = width;
- vid.height = height;
+ public static synchronized void setVid(int width, int height) {
+ vid.setSize(width, height);
}
} \ No newline at end of file
diff --git a/src/jake2/render/basic/Draw.java b/src/jake2/render/basic/Draw.java
index a4347cb..52ee9fc 100644
--- a/src/jake2/render/basic/Draw.java
+++ b/src/jake2/render/basic/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.2 2006-11-21 00:50:46 cawe Exp $
+ * $Id: Draw.java,v 1.3 2008-03-02 14:56:23 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -290,9 +290,9 @@ public abstract class Draw extends Image {
gl.glBegin(GL_QUADS);
gl.glVertex2f(0,0);
- gl.glVertex2f(vid.width, 0);
- gl.glVertex2f(vid.width, vid.height);
- gl.glVertex2f(0, vid.height);
+ gl.glVertex2f(vid.getWidth(), 0);
+ gl.glVertex2f(vid.getWidth(), vid.getHeight());
+ gl.glVertex2f(0, vid.getHeight());
gl.glEnd();
gl.glColor4f(1,1,1,1);
diff --git a/src/jake2/render/basic/Main.java b/src/jake2/render/basic/Main.java
index 34545d7..8f46270 100644
--- a/src/jake2/render/basic/Main.java
+++ b/src/jake2/render/basic/Main.java
@@ -679,7 +679,7 @@ public abstract class Main extends Base {
gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
gl.glScissor(
r_newrefdef.x,
- vid.height - r_newrefdef.height - r_newrefdef.y,
+ vid.getHeight() - r_newrefdef.height - r_newrefdef.y,
r_newrefdef.width,
r_newrefdef.height);
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -715,10 +715,10 @@ public abstract class Main extends Base {
//
// set up viewport
//
- x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width);
- x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width);
- y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height);
- y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height);
+ x = (int) Math.floor(r_newrefdef.x * vid.getWidth() / vid.getWidth());
+ x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.getWidth() / vid.getWidth());
+ y = (int) Math.floor(vid.getHeight() - r_newrefdef.y * vid.getHeight() / vid.getHeight());
+ y2 = (int) Math.ceil(vid.getHeight() - (r_newrefdef.y + r_newrefdef.height) * vid.getHeight() / vid.getHeight());
w = x2 - x;
h = y - y2;
@@ -866,10 +866,10 @@ public abstract class Main extends Base {
void R_SetGL2D() {
// set 2D virtual screen size
- gl.glViewport(0, 0, vid.width, vid.height);
+ gl.glViewport(0, 0, vid.getWidth(), vid.getHeight());
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
gl.glDisable(GL_DEPTH_TEST);
@@ -1035,7 +1035,7 @@ public abstract class Main extends Base {
vid_fullscreen.modified = false;
gl_mode.modified = false;
- Dimension dim = new Dimension(vid.width, vid.height);
+ Dimension dim = new Dimension(vid.getWidth(), vid.getHeight());
if ((err = glImpl.setMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) {
gl_state.prev_mode = (int) gl_mode.value;
@@ -1358,7 +1358,9 @@ public abstract class Main extends Base {
@@@@@@@@@@@@@@@@@@@@@
*/
public void R_BeginFrame(float camera_separation) {
-
+
+ vid.update();
+
gl_state.camera_separation = camera_separation;
/*
@@ -1410,10 +1412,10 @@ public abstract class Main extends Base {
/*
** go into 2D mode
*/
- gl.glViewport(0, 0, vid.width, vid.height);
+ gl.glViewport(0, 0, vid.getWidth(), vid.getHeight());
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
gl.glDisable(GL_DEPTH_TEST);
diff --git a/src/jake2/render/basic/Misc.java b/src/jake2/render/basic/Misc.java
index bc56f0e..a8c4b3e 100644
--- a/src/jake2/render/basic/Misc.java
+++ b/src/jake2/render/basic/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.4 2007-01-11 23:36:15 cawe Exp $
+ * $Id: Misc.java,v 1.5 2008-03-02 14:56:23 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -143,7 +143,7 @@ public final class Misc extends Mesh {
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
FileChannel ch = out.getChannel();
- int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3;
+ int fileLength = TGA_HEADER_SIZE + vid.getWidth() * vid.getHeight() * 3;
out.setLength(fileLength);
MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0,
fileLength);
@@ -151,10 +151,10 @@ public final class Misc extends Mesh {
// write the TGA header
image.put(0, (byte) 0).put(1, (byte) 0);
image.put(2, (byte) 2); // uncompressed type
- image.put(12, (byte) (vid.width & 0xFF)); // vid.width
- image.put(13, (byte) (vid.width >> 8)); // vid.width
- image.put(14, (byte) (vid.height & 0xFF)); // vid.height
- image.put(15, (byte) (vid.height >> 8)); // vid.height
+ image.put(12, (byte) (vid.getWidth() & 0xFF)); // vid.getWidth()
+ image.put(13, (byte) (vid.getWidth() >> 8)); // vid.getWidth()
+ image.put(14, (byte) (vid.getHeight() & 0xFF)); // vid.getHeight()
+ image.put(15, (byte) (vid.getHeight() >> 8)); // vid.getHeight()
image.put(16, (byte) 24); // pixel size
// go to image data position
@@ -163,7 +163,7 @@ public final class Misc extends Mesh {
ByteBuffer rgb = image.slice();
// change pixel alignment for reading
- if (vid.width % 4 != 0) {
+ if (vid.getWidth() % 4 != 0) {
gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
}
@@ -172,10 +172,10 @@ public final class Misc extends Mesh {
// e.g.: 1.5.2 NVIDIA 66.29
if (gl_config.getOpenGLVersion() >= 1.2f) {
// read the BGR values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL_BGR, GL_UNSIGNED_BYTE, rgb);
+ gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_BGR, GL_UNSIGNED_BYTE, rgb);
} else {
// read the RGB values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, rgb);
+ gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_RGB, GL_UNSIGNED_BYTE, rgb);
// flip RGB to BGR
byte tmp;
for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) {
diff --git a/src/jake2/render/fast/Draw.java b/src/jake2/render/fast/Draw.java
index db6dfb2..6eeb937 100644
--- a/src/jake2/render/fast/Draw.java
+++ b/src/jake2/render/fast/Draw.java
@@ -2,7 +2,7 @@
* Draw.java
* Copyright (C) 2003
*
- * $Id: Draw.java,v 1.3 2007-05-12 23:20:29 cawe Exp $
+ * $Id: Draw.java,v 1.4 2008-03-02 14:56:23 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -285,9 +285,9 @@ public abstract class Draw extends Image {
gl.glBegin(GL_QUADS);
gl.glVertex2f(0,0);
- gl.glVertex2f(vid.width, 0);
- gl.glVertex2f(vid.width, vid.height);
- gl.glVertex2f(0, vid.height);
+ gl.glVertex2f(vid.getWidth(), 0);
+ gl.glVertex2f(vid.getWidth(), vid.getHeight());
+ gl.glVertex2f(0, vid.getHeight());
gl.glEnd();
gl.glColor4f(1,1,1,1);
diff --git a/src/jake2/render/fast/Main.java b/src/jake2/render/fast/Main.java
index 98d2b2c..e5583cd 100644
--- a/src/jake2/render/fast/Main.java
+++ b/src/jake2/render/fast/Main.java
@@ -2,7 +2,7 @@
* Main.java
* Copyright (C) 2003
*
- * $Id: Main.java,v 1.5 2006-12-12 14:46:04 cawe Exp $
+ * $Id: Main.java,v 1.6 2008-03-02 14:56:23 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -667,7 +667,7 @@ public abstract class Main extends Base {
gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
gl.glScissor(
r_newrefdef.x,
- vid.height - r_newrefdef.height - r_newrefdef.y,
+ vid.getHeight() - r_newrefdef.height - r_newrefdef.y,
r_newrefdef.width,
r_newrefdef.height);
gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -705,14 +705,14 @@ public abstract class Main extends Base {
//
// set up viewport
//
- //int x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width);
+ //int x = (int) Math.floor(r_newrefdef.x * vid.getWidth() / vid.getWidth());
int x = r_newrefdef.x;
- //int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width);
+ //int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.getWidth() / vid.getWidth());
int x2 = r_newrefdef.x + r_newrefdef.width;
- //int y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height);
- int y = vid.height - r_newrefdef.y;
- //int y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height);
- int y2 = vid.height - (r_newrefdef.y + r_newrefdef.height);
+ //int y = (int) Math.floor(vid.getHeight() - r_newrefdef.y * vid.getHeight() / vid.getHeight());
+ int y = vid.getHeight() - r_newrefdef.y;
+ //int y2 = (int) Math.ceil(vid.getHeight() - (r_newrefdef.y + r_newrefdef.height) * vid.getHeight() / vid.getHeight());
+ int y2 = vid.getHeight() - (r_newrefdef.y + r_newrefdef.height);
int w = x2 - x;
int h = y - y2;
@@ -861,10 +861,10 @@ public abstract class Main extends Base {
*/
void R_SetGL2D() {
// set 2D virtual screen size
- gl.glViewport(0, 0, vid.width, vid.height);
+ gl.glViewport(0, 0, vid.getWidth(), vid.getHeight());
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
gl.glDisable(GL_DEPTH_TEST);
@@ -1015,7 +1015,7 @@ public abstract class Main extends Base {
vid_fullscreen.modified = false;
gl_mode.modified = false;
- Dimension dim = new Dimension(vid.width, vid.height);
+ Dimension dim = new Dimension(vid.getWidth(), vid.getHeight());
int err; // enum rserr_t
if ((err = glImpl.setMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) {
@@ -1312,6 +1312,9 @@ public abstract class Main extends Base {
* R_BeginFrame
*/
public void R_BeginFrame(float camera_separation) {
+
+ vid.update();
+
gl_state.camera_separation = camera_separation;
@@ -1364,10 +1367,10 @@ public abstract class Main extends Base {
/*
** go into 2D mode
*/
- gl.glViewport(0, 0, vid.width, vid.height);
+ gl.glViewport(0, 0, vid.getWidth(), vid.getHeight());
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
- gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999);
+ gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
gl.glDisable(GL_DEPTH_TEST);
diff --git a/src/jake2/render/fast/Misc.java b/src/jake2/render/fast/Misc.java
index d611f34..0479d59 100644
--- a/src/jake2/render/fast/Misc.java
+++ b/src/jake2/render/fast/Misc.java
@@ -2,7 +2,7 @@
* Misc.java
* Copyright (C) 2003
*
- * $Id: Misc.java,v 1.4 2007-01-11 23:36:21 cawe Exp $
+ * $Id: Misc.java,v 1.5 2008-03-02 14:56:23 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -136,7 +136,7 @@ public final class Misc extends Mesh {
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
FileChannel ch = out.getChannel();
- int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3;
+ int fileLength = TGA_HEADER_SIZE + vid.getWidth() * vid.getHeight() * 3;
out.setLength(fileLength);
MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0,
fileLength);
@@ -144,10 +144,10 @@ public final class Misc extends Mesh {
// write the TGA header
image.put(0, (byte) 0).put(1, (byte) 0);
image.put(2, (byte) 2); // uncompressed type
- image.put(12, (byte) (vid.width & 0xFF)); // vid.width
- image.put(13, (byte) (vid.width >> 8)); // vid.width
- image.put(14, (byte) (vid.height & 0xFF)); // vid.height
- image.put(15, (byte) (vid.height >> 8)); // vid.height
+ image.put(12, (byte) (vid.getWidth() & 0xFF)); // vid.getWidth()
+ image.put(13, (byte) (vid.getWidth() >> 8)); // vid.getWidth()
+ image.put(14, (byte) (vid.getHeight() & 0xFF)); // vid.getHeight()
+ image.put(15, (byte) (vid.getHeight() >> 8)); // vid.getHeight()
image.put(16, (byte) 24); // pixel size
// go to image data position
@@ -155,7 +155,7 @@ public final class Misc extends Mesh {
// change pixel alignment for reading
- if (vid.width % 4 != 0) {
+ if (vid.getWidth() % 4 != 0) {
gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
}
@@ -164,10 +164,10 @@ public final class Misc extends Mesh {
// e.g.: 1.5.2 NVIDIA 66.29
if (gl_config.getOpenGLVersion() >= 1.2f) {
// read the BGR values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL_BGR, GL_UNSIGNED_BYTE, image);
+ gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_BGR, GL_UNSIGNED_BYTE, image);
} else {
// read the RGB values into the image buffer
- gl.glReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, image);
+ gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_RGB, GL_UNSIGNED_BYTE, image);
// flip RGB to BGR
byte tmp;
for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) {
diff --git a/test/jake2/render/DancingQueens.java b/test/jake2/render/DancingQueens.java
index 2ba220a..4097d21 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.12 2007-03-20 18:57:16 cawe Exp $
+ * $Id: DancingQueens.java,v 1.13 2008-03-02 14:56:21 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -100,7 +100,7 @@ public class DancingQueens {
Globals.cls.state = Defines.ca_active;
viddef = Globals.viddef;
- fov_y = Math3D.CalcFov(fov_x, viddef.width, viddef.height);
+ fov_y = Math3D.CalcFov(fov_x, viddef.getWidth(), viddef.getHeight());
}
float fps = 0.0f;
@@ -119,7 +119,7 @@ public class DancingQueens {
testModel();
- drawString(10, viddef.height - 16, text);
+ drawString(10, viddef.getHeight() - 16, text);
re.EndFrame();
framecount++;
@@ -162,8 +162,8 @@ public class DancingQueens {
refdef.x = 0;
refdef.y = 0;
- refdef.width = viddef.width;
- refdef.height = viddef.height;
+ refdef.width = viddef.getWidth();
+ refdef.height = viddef.getHeight();
refdef.fov_x = fov_x;
refdef.fov_y = fov_y;
refdef.time = 1.0f * 0.001f;
diff --git a/test/jake2/render/DebugCulling.java b/test/jake2/render/DebugCulling.java
index 6312ad6..1731f67 100644
--- a/test/jake2/render/DebugCulling.java
+++ b/test/jake2/render/DebugCulling.java
@@ -63,7 +63,7 @@ public class DebugCulling
void init()
{
- Qcommon.Init(new String[] { "$Id: DebugCulling.java,v 1.5 2007-02-27 14:00:35 cawe Exp $" });
+ Qcommon.Init(new String[] { "$Id: DebugCulling.java,v 1.6 2008-03-02 14:56:21 cawe Exp $" });
// sehr wichtig !!!
VID.Shutdown();
@@ -102,8 +102,8 @@ public class DebugCulling
switch (currentState)
{
case 0 :
- re.DrawStretchPic(0, 0, viddef.width, viddef.height, "conback");
- re.DrawPic(viddef.width / 2 - 50, viddef.height / 2, "loading");
+ re.DrawStretchPic(0, 0, viddef.getWidth(), viddef.getHeight(), "conback");
+ re.DrawPic(viddef.getWidth() / 2 - 50, viddef.getHeight() / 2, "loading");
currentState = 1;
break;
case 1 :
@@ -124,7 +124,7 @@ public class DebugCulling
testMap();
- drawString(10, viddef.height - 16, text);
+ drawString(10, viddef.getHeight() - 16, text);
}
re.EndFrame();
@@ -133,8 +133,6 @@ public class DebugCulling
// ===================================================================
- private float yaw = 0;
-
private float fov_x = 90;
private refdef_t refdef;
@@ -147,8 +145,8 @@ public class DebugCulling
refdef.x = 0;
refdef.y = 0;
- refdef.width = viddef.width;
- refdef.height = viddef.height;
+ refdef.width = viddef.getWidth();
+ refdef.height = viddef.getHeight();
refdef.fov_x = fov_x;
refdef.fov_y = CalcFov(fov_x, refdef.width -10, refdef.height-10);
refdef.vieworg = new float[] {0, 0, 0};
diff --git a/test/jake2/render/TestMap.java b/test/jake2/render/TestMap.java
index 0a0c3c5..f9a78ce 100644
--- a/test/jake2/render/TestMap.java
+++ b/test/jake2/render/TestMap.java
@@ -143,8 +143,8 @@ public class TestMap
switch (currentState)
{
case 0 :
- re.DrawStretchPic(0, 0, viddef.width, viddef.height, "conback");
- re.DrawPic(viddef.width / 2 - 50, viddef.height / 2, "loading");
+ re.DrawStretchPic(0, 0, viddef.getWidth(), viddef.getHeight(), "conback");
+ re.DrawPic(viddef.getWidth() / 2 - 50, viddef.getHeight() / 2, "loading");
currentState = 1;
break;
case 1 :
@@ -163,7 +163,7 @@ public class TestMap
testMap();
- drawString(10, viddef.height - 16, text);
+ drawString(10, viddef.getHeight() - 16, text);
}
re.EndFrame();
@@ -234,8 +234,6 @@ public class TestMap
}
};
- private float yaw = 0;
-
private float fov_x = 90;
private refdef_t refdef;
@@ -254,8 +252,8 @@ public class TestMap
refdef.x = 0;
refdef.y = 0;
- refdef.width = viddef.width;
- refdef.height = viddef.height;
+ refdef.width = viddef.getWidth();
+ refdef.height = viddef.getHeight();
refdef.fov_x = (Globals.fov == null) ? this.fov_x : Globals.fov.value;
refdef.fov_x = this.fov_x;
refdef.fov_y = Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height);
@@ -366,11 +364,6 @@ public class TestMap
}
private LinkedList active_particles = new LinkedList();
- private boolean explode = false;
- private float[] target;
-
- private boolean initParticles = true;
-
private void animateParticles()
{
cparticle_t p;
diff --git a/test/jake2/render/TestRenderer.java b/test/jake2/render/TestRenderer.java
index 1106fb8..46426eb 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.8 2006-11-21 01:59:41 cawe Exp $
+ * $Id: TestRenderer.java,v 1.9 2008-03-02 14:56:21 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -109,7 +109,7 @@ public class TestRenderer {
void updateScreen() {
re.BeginFrame(0.0f);
viddef = Globals.viddef;
- re.DrawStretchPic(0, 0, viddef.width, viddef.height, "conback");
+ re.DrawStretchPic(0, 0, viddef.getWidth(), viddef.getHeight(), "conback");
if (framecount % 500 == 0) {
long time = System.currentTimeMillis();
@@ -119,13 +119,13 @@ public class TestRenderer {
String text = ((int)(fps +0.5f)) + " fps";
for (int i = 0; i < text.length(); i++) {
- re.DrawChar(10 + 8 * i, viddef.height / 2, (int) text.charAt(i));
+ re.DrawChar(10 + 8 * i, viddef.getHeight() / 2, (int) text.charAt(i));
}
Dimension wal = new Dimension();
re.DrawGetPicSize(wal, "/textures/e1u1/basemap.wal");
- re.DrawPic(0, viddef.height - wal.height, "/textures/e1u1/basemap.wal");
+ re.DrawPic(0, viddef.getHeight() - wal.height, "/textures/e1u1/basemap.wal");
switch (testnr) {
case 0:
@@ -172,8 +172,8 @@ public class TestRenderer {
refdef_t refdef = new refdef_t();
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
+ refdef.x = viddef.getWidth() / 2;
+ refdef.y = viddef.getHeight() / 2 - 72;
refdef.width = 144 * 2;
refdef.height = 168 * 2;
refdef.fov_x = 40;
@@ -181,7 +181,6 @@ public class TestRenderer {
.CalcFov(refdef.fov_x, refdef.width, refdef.height);
refdef.time = 1.0f * 0.001f;
- int maxframe = 29;
entity_t entity = new entity_t();
String modelName = "players/female/tris.md2";
@@ -223,8 +222,8 @@ public class TestRenderer {
// Menu_Draw(& s_player_config_menu);
- M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.width) - 8),
- (int) ((viddef.height / 2) * (240.0F / viddef.height) - 77),
+ M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.getWidth()) - 8),
+ (int) ((viddef.getHeight() / 2) * (240.0F / viddef.getHeight()) - 77),
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
@@ -249,10 +248,10 @@ public class TestRenderer {
if (loading) {
- re.DrawPic(viddef.width / 2 - 50, viddef.height / 2, "loading");
+ re.DrawPic(viddef.getWidth() / 2 - 50, viddef.getHeight() / 2, "loading");
String name = sprites[spriteCount];
- drawString(viddef.width / 2 - 50, viddef.height / 2 + 50, name);
+ drawString(viddef.getWidth() / 2 - 50, viddef.getHeight() / 2 + 50, name);
re.RegisterModel(name);
loading = ++spriteCount < sprites.length;
@@ -261,8 +260,8 @@ public class TestRenderer {
refdef_t refdef = new refdef_t();
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
+ refdef.x = viddef.getWidth() / 2;
+ refdef.y = viddef.getHeight() / 2 - 72;
refdef.width = 144 * 2;
refdef.height = 168 * 2;
refdef.fov_x = 40;
@@ -270,7 +269,6 @@ public class TestRenderer {
.CalcFov(refdef.fov_x, refdef.width, refdef.height);
refdef.time = 1.0f * 0.001f;
- int maxframe = 29;
entity_t entity = new entity_t();
String modelName = sprites[(framecount / 30) % sprites.length];
@@ -294,8 +292,8 @@ public class TestRenderer {
refdef.lightstyles = null;
refdef.rdflags = Defines.RDF_NOWORLDMODEL;
- M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.width) - 8),
- (int) ((viddef.height / 2) * (240.0F / viddef.height) - 77),
+ M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.getWidth()) - 8),
+ (int) ((viddef.getHeight() / 2) * (240.0F / viddef.getHeight()) - 77),
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
@@ -307,8 +305,8 @@ public class TestRenderer {
refdef_t refdef = new refdef_t();
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
+ refdef.x = viddef.getWidth() / 2;
+ refdef.y = viddef.getHeight() / 2 - 72;
refdef.width = 144 * 2;
refdef.height = 168 * 2;
refdef.fov_x = 40;
@@ -316,7 +314,6 @@ public class TestRenderer {
.CalcFov(refdef.fov_x, refdef.width, refdef.height);
refdef.time = 1.0f * 0.001f;
- int maxframe = 29;
entity_t entity = new entity_t();
drawString(refdef.x, refdef.y - 20, "Beam Test");
@@ -350,8 +347,8 @@ public class TestRenderer {
refdef.lightstyles = null;
refdef.rdflags = Defines.RDF_NOWORLDMODEL;
- M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.width) - 8),
- (int) ((viddef.height / 2) * (240.0F / viddef.height) - 77),
+ M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.getWidth()) - 8),
+ (int) ((viddef.getHeight() / 2) * (240.0F / viddef.getHeight()) - 77),
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
@@ -364,8 +361,6 @@ public class TestRenderer {
private float[] target;
- private boolean initParticles = true;
-
private void testParticles() {
r_numparticles = 0;
@@ -383,8 +378,8 @@ public class TestRenderer {
}
refdef_t refdef = new refdef_t();
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
+ refdef.x = viddef.getWidth() / 2;
+ refdef.y = viddef.getHeight() / 2 - 72;
refdef.width = 400;
refdef.height = 400;
refdef.fov_x = 50;
@@ -405,8 +400,8 @@ public class TestRenderer {
refdef.lightstyles = null;
refdef.rdflags = Defines.RDF_NOWORLDMODEL;
- M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.width) - 8),
- (int) ((viddef.height / 2) * (240.0F / viddef.height) - 77),
+ M_DrawTextBox((int) ((refdef.x) * (320.0F / viddef.getWidth()) - 8),
+ (int) ((viddef.getHeight() / 2) * (240.0F / viddef.getHeight()) - 77),
refdef.width / 8, refdef.height / 8);
refdef.height += 4;
@@ -464,18 +459,16 @@ public class TestRenderer {
* and will be centered on higher res screens. ================
*/
private void M_DrawCharacter(int cx, int cy, int num) {
- re.DrawChar(cx + ((viddef.width - 320) >> 1), cy
- + ((viddef.height - 240) >> 1), num);
+ re.DrawChar(cx + ((viddef.getWidth() - 320) >> 1), cy
+ + ((viddef.getHeight() - 240) >> 1), num);
}
long endtime;
private void Explosion(float[] org) {
- float[] dir = { 0, 0, 0 };
- int i;
cparticle_t p;
- for (i = 0; i < 256; i++) {
+ for (int i = 0; i < 256; i++) {
p = new cparticle_t();
p.time = time() * 1.0f;