aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/client
diff options
context:
space:
mode:
authorHolger Zickner <[email protected]>2004-07-09 06:50:52 +0000
committerHolger Zickner <[email protected]>2004-07-09 06:50:52 +0000
commit20a66a892a3f0704ef37f1eebb681edfee6fc165 (patch)
tree118e0e5ea00eecf450e4c63edc88c421d52a7db2 /src/jake2/client
parent6b36f9e0380b7c80aecdc78ef07a0cf473712416 (diff)
import of Jake2
Diffstat (limited to 'src/jake2/client')
-rw-r--r--src/jake2/client/CL.java41
-rw-r--r--src/jake2/client/CL_ents.java10
-rw-r--r--src/jake2/client/CL_input.java7
-rw-r--r--src/jake2/client/CL_parse.java6
-rw-r--r--src/jake2/client/CL_view.java43
-rw-r--r--src/jake2/client/Key.java72
-rw-r--r--src/jake2/client/Menu.java87
-rw-r--r--src/jake2/client/SCR.java35
-rw-r--r--src/jake2/client/V.java37
-rw-r--r--src/jake2/client/VID.java17
-rw-r--r--src/jake2/client/client_state_t.java6
-rw-r--r--src/jake2/client/frame_t.java8
-rw-r--r--src/jake2/client/particle_t.java20
-rw-r--r--src/jake2/client/refdef_t.java4
14 files changed, 215 insertions, 178 deletions
diff --git a/src/jake2/client/CL.java b/src/jake2/client/CL.java
index 5b30e34..125cedd 100644
--- a/src/jake2/client/CL.java
+++ b/src/jake2/client/CL.java
@@ -2,7 +2,7 @@
* CL.java
* Copyright (C) 2004
*
- * $Id: CL.java,v 1.4 2004-07-08 20:56:50 hzi Exp $
+ * $Id: CL.java,v 1.5 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -43,17 +43,6 @@ import java.nio.ByteBuffer;
*/
public final class CL extends CL_pred {
-
-// static cvar_t adr0;
-// static cvar_t adr1;
-// static cvar_t adr2;
-// static cvar_t adr3;
-// static cvar_t adr4;
-// static cvar_t adr5;
-// static cvar_t adr6;
-// static cvar_t adr7;
-// static cvar_t adr8;
-
/*
====================
CL_WriteDemoMessage
@@ -713,7 +702,7 @@ public final class CL extends CL_pred {
c = Cmd.Argv(0);
- Com.Printf(NET.AdrToString(net_from) + ": " + c + " \n");
+ Com.Printf(NET.AdrToString(net_from) + ": " + c + "\n");
// server connection
if (c.equals("client_connect")) {
@@ -1126,17 +1115,17 @@ public final class CL extends CL_pred {
if (precache_check == ENV_CNT) {
precache_check = ENV_CNT + 1;
- CM.intwrap iw = new CM.intwrap(map_checksum);
+ int iw[] = {map_checksum};
CM.CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, iw);
- map_checksum = iw.i;
-// TODO MD4 check abgeklemmt
-// if ((map_checksum ^ atoi(cl.configstrings[CS_MAPCHECKSUM])) != 0) {
-// Com.Error(
-// ERR_DROP,
-// "Local map version differs from server: " + map_checksum + " != '" + cl.configstrings[CS_MAPCHECKSUM] + "'\n");
-// return;
-// }
+ map_checksum = iw[0];
+
+ if ((map_checksum ^ atoi(cl.configstrings[CS_MAPCHECKSUM])) != 0) {
+ Com.Error(
+ ERR_DROP,
+ "Local map version differs from server: " + map_checksum + " != '" + cl.configstrings[CS_MAPCHECKSUM] + "'\n");
+ return;
+ }
}
if (precache_check > ENV_CNT && precache_check < TEXTURE_CNT) {
@@ -1201,10 +1190,11 @@ public final class CL extends CL_pred {
if (Cmd.Argc() < 2) {
- CM.intwrap iw = new CM.intwrap(0); // for detecting cheater maps
+ int iw[] ={0};// for detecting cheater maps
+
CM.CM_LoadMap(cl.configstrings[CS_MODELS + 1], true, iw);
-// int mapchecksum = iw.i ;
+ int mapchecksum = iw[0] ;
CL.RegisterSounds();
CL.PrepRefresh();
return;
@@ -1540,8 +1530,7 @@ public final class CL extends CL_pred {
VID.CheckChanges();
if (!cl.refresh_prepped && cls.state == ca_active) {
CL.PrepRefresh();
- // TODO force GC after level loading
- System.gc();
+ // force GC after level loading
System.gc();
}
diff --git a/src/jake2/client/CL_ents.java b/src/jake2/client/CL_ents.java
index d406ff2..ae05398 100644
--- a/src/jake2/client/CL_ents.java
+++ b/src/jake2/client/CL_ents.java
@@ -2,7 +2,7 @@
* CL_ents.java
* Copyright (C) 2004
*
- * $Id: CL_ents.java,v 1.3 2004-07-08 20:56:50 hzi Exp $
+ * $Id: CL_ents.java,v 1.4 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -53,7 +53,7 @@ public class CL_ents extends CL_inv {
=================
*/
static int bitcounts[] = new int[32]; /// just for protocol profiling
- public static int ParseEntityBits(CM.intwrap bits) {
+ public static int ParseEntityBits(int bits[]) {
int b, total;
int i;
int number;
@@ -82,7 +82,7 @@ public class CL_ents extends CL_inv {
else
number = MSG.ReadByte(net_message);
- bits.i = total;
+ bits[0] = total;
return number;
}
@@ -253,9 +253,9 @@ public class CL_ents extends CL_inv {
}
while (true) {
- CM.intwrap iw = new CM.intwrap(bits);
+ int iw[] = {bits};
newnum = ParseEntityBits(iw);
- bits = iw.i;
+ bits = iw[0];
if (newnum >= MAX_EDICTS)
Com.Error(ERR_DROP, "CL_ParsePacketEntities: bad number:" + newnum);
diff --git a/src/jake2/client/CL_input.java b/src/jake2/client/CL_input.java
index b55b866..47132bb 100644
--- a/src/jake2/client/CL_input.java
+++ b/src/jake2/client/CL_input.java
@@ -2,7 +2,7 @@
* CL_input.java
* Copyright (C) 2004
*
- * $Id: CL_input.java,v 1.2 2004-07-08 15:58:43 hzi Exp $
+ * $Id: CL_input.java,v 1.3 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -549,10 +549,7 @@ public class CL_input extends CL_ents {
MSG.WriteDeltaUsercmd(buf, oldcmd, cmd);
// calculate a checksum over the move commands
- buf.data[checksumIndex] = 0;
- /*COM_BlockSequenceCRCByte(
- buf.data + checksumIndex + 1, buf.cursize - checksumIndex - 1,
- cls.netchan.outgoing_sequence);*/
+ buf.data[checksumIndex] = Com.BlockSequenceCRCByte(buf.data, checksumIndex + 1, buf.cursize - checksumIndex - 1, cls.netchan.outgoing_sequence);
//
// deliver the message
diff --git a/src/jake2/client/CL_parse.java b/src/jake2/client/CL_parse.java
index ad19960..a36e677 100644
--- a/src/jake2/client/CL_parse.java
+++ b/src/jake2/client/CL_parse.java
@@ -2,7 +2,7 @@
* CL_parse.java
* Copyright (C) 2004
*
- * $Id: CL_parse.java,v 1.4 2004-07-08 20:56:49 hzi Exp $
+ * $Id: CL_parse.java,v 1.5 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -360,10 +360,10 @@ public class CL_parse extends CL_view {
entity_state_t nullstate = new entity_state_t(null);
//memset(nullstate, 0, sizeof(nullstate));
- CM.intwrap bits = new CM.intwrap(0);
+ int bits[] = {0};
newnum = CL_ents.ParseEntityBits(bits);
es = cl_entities[newnum].baseline;
- CL_ents.ParseDelta(nullstate, es, newnum, bits.i);
+ CL_ents.ParseDelta(nullstate, es, newnum, bits[0]);
}
/*
diff --git a/src/jake2/client/CL_view.java b/src/jake2/client/CL_view.java
index 08e55c3..ab9efa7 100644
--- a/src/jake2/client/CL_view.java
+++ b/src/jake2/client/CL_view.java
@@ -2,7 +2,7 @@
* CL_view.java
* Copyright (C) 2004
*
- * $Id: CL_view.java,v 1.2 2004-07-08 20:24:29 hzi Exp $
+ * $Id: CL_view.java,v 1.3 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -25,17 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package jake2.client;
-import java.util.StringTokenizer;
-
import jake2.qcommon.CM;
import jake2.qcommon.Com;
-import jake2.qcommon.xcommand_t;
import jake2.sys.Sys;
-import jake2.util.Vargs;
-
-
-
+import java.util.StringTokenizer;
public class CL_view extends CL_input {
@@ -50,18 +44,7 @@ public class CL_view extends CL_input {
Call before entering a new level, or after changing dlls
=================
*/
-
- private static xcommand_t prepRefreshCallback = new xcommand_t() {
- public void execute() {
- PrepRefresh2();
- }
- };
-
static void PrepRefresh() {
- re.updateScreen(prepRefreshCallback);
- }
-
- static void PrepRefresh2() {
String mapname;
int i;
String name;
@@ -80,13 +63,13 @@ public class CL_view extends CL_input {
// register models, pics, and skins
Com.Printf("Map: " + mapname + "\r");
- SCR.UpdateScreen2();
+ SCR.UpdateScreen();
re.BeginRegistration(mapname);
Com.Printf(" \r");
// precache status bar pics
Com.Printf("pics\r");
- SCR.UpdateScreen2();
+ SCR.UpdateScreen();
SCR.TouchPics();
Com.Printf(" \r");
@@ -99,11 +82,11 @@ public class CL_view extends CL_input {
name = new String(cl.configstrings[CS_MODELS+i]);
if (name.length() > 37) name = name.substring(0, 36);
- /*
+
if (name.charAt(0) != '*')
- Com.Printf("name" + "\r");
- */
- SCR.UpdateScreen2();
+ Com.Printf(name + "\r");
+
+ SCR.UpdateScreen();
Sys.SendKeyEvents(); // pump message loop
if (name.charAt(0) == '#') {
// special player weapon model
@@ -123,7 +106,7 @@ public class CL_view extends CL_input {
}
Com.Printf("images\r");
- SCR.UpdateScreen2();
+ SCR.UpdateScreen();
for (i=1 ; i<MAX_IMAGES && cl.configstrings[CS_IMAGES+i].length() > 0 ; i++) {
cl.image_precache[i] = re.RegisterPic(cl.configstrings[CS_IMAGES+i]);
Sys.SendKeyEvents(); // pump message loop
@@ -133,8 +116,8 @@ public class CL_view extends CL_input {
for (i=0 ; i<MAX_CLIENTS ; i++) {
if (cl.configstrings[CS_PLAYERSKINS+i].length() == 0)
continue;
- Com.Printf("client %i\r", new Vargs(1).add(i));
- SCR.UpdateScreen2();
+ Com.Printf("client " + i + '\r');
+ SCR.UpdateScreen();
Sys.SendKeyEvents(); // pump message loop
CL.ParseClientinfo(i);
Com.Printf(" \r");
@@ -144,7 +127,7 @@ public class CL_view extends CL_input {
// set sky textures and speed
Com.Printf("sky\r");
- SCR.UpdateScreen2();
+ SCR.UpdateScreen();
rotate = Float.parseFloat(cl.configstrings[CS_SKYROTATE]);
StringTokenizer st = new StringTokenizer(cl.configstrings[CS_SKYAXIS]);
axis[0] = Float.parseFloat(st.nextToken());
@@ -159,7 +142,7 @@ public class CL_view extends CL_input {
// clear any lines of console text
Console.ClearNotify();
- SCR.UpdateScreen2();
+ SCR.UpdateScreen();
cl.refresh_prepped = true;
cl.force_refdef = true; // make sure we have a valid refdef
}
diff --git a/src/jake2/client/Key.java b/src/jake2/client/Key.java
index 0b3e82a..5f7d921 100644
--- a/src/jake2/client/Key.java
+++ b/src/jake2/client/Key.java
@@ -2,7 +2,7 @@
* Key.java
* Copyright (C) 2003
*
- * $Id: Key.java,v 1.3 2004-07-08 20:24:29 hzi Exp $
+ * $Id: Key.java,v 1.4 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -119,7 +119,7 @@ public class Key extends Globals {
static int history_line = 0;
static boolean shift_down = false;
static int[] key_repeats = new int[256];
- static int[] keyshift = new int[256];
+ //static int[] keyshift = new int[256];
static boolean[] menubound = new boolean[256];
static boolean[] consolekeys = new boolean[256];
@@ -241,31 +241,31 @@ public class Key extends Globals {
consolekeys['`'] = false;
consolekeys['~'] = false;
- for (int i = 0; i < 256; i++)
- keyshift[i] = i;
- for (int i = 'a'; i <= 'z'; i++)
- keyshift[i] = i - 'a' + 'A';
- keyshift['1'] = '!';
- keyshift['2'] = '@';
- keyshift['3'] = '#';
- keyshift['4'] = '$';
- keyshift['5'] = '%';
- keyshift['6'] = '^';
- keyshift['7'] = '&';
- keyshift['8'] = '*';
- keyshift['9'] = '(';
- keyshift['0'] = ')';
- keyshift['-'] = '_';
- keyshift['='] = '+';
- keyshift[','] = '<';
- keyshift['.'] = '>';
- keyshift['/'] = '?';
- keyshift[';'] = ':';
- keyshift['\''] = '"';
- keyshift['['] = '{';
- keyshift[']'] = '}';
- keyshift['`'] = '~';
- keyshift['\\'] = '|';
+// for (int i = 0; i < 256; i++)
+// keyshift[i] = i;
+// for (int i = 'a'; i <= 'z'; i++)
+// keyshift[i] = i - 'a' + 'A';
+// keyshift['1'] = '!';
+// keyshift['2'] = '@';
+// keyshift['3'] = '#';
+// keyshift['4'] = '$';
+// keyshift['5'] = '%';
+// keyshift['6'] = '^';
+// keyshift['7'] = '&';
+// keyshift['8'] = '*';
+// keyshift['9'] = '(';
+// keyshift['0'] = ')';
+// keyshift['-'] = '_';
+// keyshift['='] = '+';
+// keyshift[','] = '<';
+// keyshift['.'] = '>';
+// keyshift['/'] = '?';
+// keyshift[';'] = ':';
+// keyshift['\''] = '"';
+// keyshift['['] = '{';
+// keyshift[']'] = '}';
+// keyshift['`'] = '~';
+// keyshift['\\'] = '|';
menubound[K_ESCAPE] = true;
for (int i = 0; i < 12; i++)
@@ -386,13 +386,13 @@ public class Key extends Globals {
cmd = "-" + kb.substring(1) + " " + key + " " + time + "\n";
Cbuf.AddText(cmd);
}
- if (keyshift[key] != key) {
- kb = Globals.keybindings[keyshift[key]];
- if (kb != null && kb.length()>0 && kb.charAt(0) == '+') {
- cmd = "-" + kb.substring(1) + " " + key + " " + time + "\n";
- Cbuf.AddText(cmd);
- }
- }
+// if (keyshift[key] != key) {
+// kb = Globals.keybindings[keyshift[key]];
+// if (kb != null && kb.length()>0 && kb.charAt(0) == '+') {
+// cmd = "-" + kb.substring(1) + " " + key + " " + time + "\n";
+// Cbuf.AddText(cmd);
+// }
+// }
return;
}
@@ -419,8 +419,8 @@ public class Key extends Globals {
if (!down)
return; // other systems only care about key down events
- if (shift_down)
- key = keyshift[key];
+// if (shift_down)
+// key = keyshift[key];
switch (Globals.cls.key_dest) {
case Defines.key_message :
diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java
index 00944ed..faaf77c 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.3 2004-07-08 20:56:49 hzi Exp $
+ * $Id: Menu.java,v 1.4 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -1226,7 +1226,7 @@ public final class Menu extends Key {
static menulist_s s_options_joystick_box = new menulist_s();
static menulist_s s_options_cdvolume_box = new menulist_s();
static menulist_s s_options_quality_list = new menulist_s();
- static menulist_s s_options_compatibility_list = new menulist_s();
+ //static menulist_s s_options_compatibility_list = new menulist_s();
static menuaction_s s_options_console_action = new menuaction_s();
static void CrosshairFunc(Object unused) {
@@ -1268,7 +1268,13 @@ public final class Menu extends Key {
static void ControlsSetMenuItemValues() {
s_options_sfxvolume_slider.curvalue = Cvar.VariableValue("s_volume") * 10;
s_options_cdvolume_box.curvalue = 1 - ((int) Cvar.VariableValue("cd_nocd"));
- s_options_quality_list.curvalue = 1 - ((int) Cvar.VariableValue("s_loadas8bit"));
+ //s_options_quality_list.curvalue = 1 - ((int) Cvar.VariableValue("s_loadas8bit"));
+ if ("joal".equals(Cvar.VariableString("s_impl"))) {
+ s_options_quality_list.curvalue = 0;
+ } else {
+ s_options_quality_list.curvalue = 1;
+ }
+
s_options_sensitivity_slider.curvalue = (sensitivity.value) * 2;
Cvar.SetValue("cl_run", ClampCvar(0, 1, cl_run.value));
@@ -1339,30 +1345,41 @@ public final class Menu extends Key {
}
static void UpdateSoundQualityFunc(Object unused) {
+ boolean driverNotChanged = false;
if (s_options_quality_list.curvalue != 0) {
- Cvar.SetValue("s_khz", 22);
- Cvar.SetValue("s_loadas8bit", 0);
+// Cvar.SetValue("s_khz", 22);
+// Cvar.SetValue("s_loadas8bit", 0);
+ driverNotChanged = S.getDriverName().equals("dummy");
+ Cvar.Set("s_impl", "dummy");
}
else {
- Cvar.SetValue("s_khz", 11);
- Cvar.SetValue("s_loadas8bit", 1);
+// Cvar.SetValue("s_khz", 11);
+// Cvar.SetValue("s_loadas8bit", 1);
+ driverNotChanged = S.getDriverName().equals("joal");
+ Cvar.Set("s_impl", "joal");
}
- Cvar.SetValue("s_primary", s_options_compatibility_list.curvalue);
+ //Cvar.SetValue("s_primary", s_options_compatibility_list.curvalue);
- DrawTextBox(8, 120 - 48, 36, 3);
- Print(16 + 16, 120 - 48 + 8, "Restarting the sound system. This");
- Print(16 + 16, 120 - 48 + 16, "could take up to a minute, so");
- Print(16 + 16, 120 - 48 + 24, "please be patient.");
+ if (driverNotChanged) {
+ re.EndFrame();
+ return;
+ } else {
- // the text box won't show up unless we do a buffer swap
- re.EndFrame();
+ DrawTextBox(8, 120 - 48, 36, 3);
+ Print(16 + 16, 120 - 48 + 8, "Restarting the sound system. This");
+ Print(16 + 16, 120 - 48 + 16, "could take up to a minute, so");
+ Print(16 + 16, 120 - 48 + 24, "please be patient.");
- CL.Snd_Restart_f.execute();
+ // the text box won't show up unless we do a buffer swap
+ re.EndFrame();
+
+ CL.Snd_Restart_f.execute();
+ }
}
static String cd_music_items[] = { "disabled", "enabled", null };
- static String quality_items[] = { "low", "high", null };
+ static String soundstate_items[] = { "on", "off", null };
static String compatibility_items[] = { "max compatibility", "max performance", null };
@@ -1410,26 +1427,27 @@ public final class Menu extends Key {
s_options_quality_list.x = 0;
s_options_quality_list.y = 20;
;
- s_options_quality_list.name = "sound quality";
+ s_options_quality_list.name = "sound";
s_options_quality_list.callback = new mcallback() {
public void execute(Object o) {
UpdateSoundQualityFunc(o);
}
};
- s_options_quality_list.itemnames = quality_items;
- s_options_quality_list.curvalue = 1 - (int) Cvar.VariableValue("s_loadas8bit");
-
- s_options_compatibility_list.type = MTYPE_SPINCONTROL;
- s_options_compatibility_list.x = 0;
- s_options_compatibility_list.y = 30;
- s_options_compatibility_list.name = "sound compatibility";
- s_options_compatibility_list.callback = new mcallback() {
- public void execute(Object o) {
- UpdateSoundQualityFunc(o);
- }
- };
- s_options_compatibility_list.itemnames = compatibility_items;
- s_options_compatibility_list.curvalue = (int) Cvar.VariableValue("s_primary");
+ s_options_quality_list.itemnames = soundstate_items;
+ //s_options_quality_list.curvalue = 1 - (int) Cvar.VariableValue("s_loadas8bit");
+
+
+// s_options_compatibility_list.type = MTYPE_SPINCONTROL;
+// s_options_compatibility_list.x = 0;
+// s_options_compatibility_list.y = 30;
+// s_options_compatibility_list.name = "sound compatibility";
+// s_options_compatibility_list.callback = new mcallback() {
+// public void execute(Object o) {
+// UpdateSoundQualityFunc(o);
+// }
+// };
+// s_options_compatibility_list.itemnames = compatibility_items;
+// s_options_compatibility_list.curvalue = (int) Cvar.VariableValue("s_primary");
s_options_sensitivity_slider.type = MTYPE_SLIDER;
s_options_sensitivity_slider.x = 0;
@@ -1563,7 +1581,7 @@ public final class Menu extends Key {
Menu_AddItem(s_options_menu, s_options_cdvolume_box);
Menu_AddItem(s_options_menu, s_options_quality_list);
- Menu_AddItem(s_options_menu, s_options_compatibility_list);
+// Menu_AddItem(s_options_menu, s_options_compatibility_list);
Menu_AddItem(s_options_menu, s_options_sensitivity_slider);
Menu_AddItem(s_options_menu, s_options_alwaysrun_box);
Menu_AddItem(s_options_menu, s_options_invertmouse_box);
@@ -1653,7 +1671,7 @@ public final class Menu extends Key {
"John Cash",
"Brian Hook",
"",
- "+JAVA PORT BY JTEAM",
+ "+JAVA PORT BY BYTONIC",
"CWEI",
"HOZ",
"RST",
@@ -2945,6 +2963,7 @@ public final class Menu extends Key {
s_hostname_field.length = 12;
s_hostname_field.visible_length = 12;
s_hostname_field.buffer = new StringBuffer(Cvar.VariableString("hostname"));
+ s_hostname_field.cursor = s_hostname_field.buffer.length();
s_startserver_dmoptions_action.type = MTYPE_ACTION;
s_startserver_dmoptions_action.name = " deathmatch flags";
@@ -4464,7 +4483,7 @@ public final class Menu extends Key {
}
Menu_DrawString(f.x + f.parent.x + 24, f.y + f.parent.y, tempbuffer);
-
+
if (Menu_ItemAtCursor(f.parent) == f) {
int offset;
diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java
index 66b5c33..5df826c 100644
--- a/src/jake2/client/SCR.java
+++ b/src/jake2/client/SCR.java
@@ -2,7 +2,7 @@
* SCR.java
* Copyright (C) 2003
*
- * $Id: SCR.java,v 1.4 2004-07-08 20:56:49 hzi Exp $
+ * $Id: SCR.java,v 1.5 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -84,7 +84,7 @@ public final class SCR extends Globals
static cvar_t scr_graphscale;
static cvar_t scr_graphshift;
static cvar_t scr_drawall;
- static cvar_t fps;
+ public static cvar_t fps;
static dirty_t scr_dirty = new dirty_t();
static dirty_t[] scr_old_dirty = { new dirty_t(), new dirty_t()};
@@ -98,6 +98,17 @@ public final class SCR extends Globals
int x2;
int y1;
int y2;
+
+ void set(dirty_t src) {
+ x1 = src.x1;
+ x2 = src.x2;
+ y1 = src.y1;
+ y2 = src.y2;
+ }
+
+ void clear() {
+ x1 = x2 = y1 = y2 = 0;
+ }
}
/*
@@ -700,11 +711,14 @@ public final class SCR extends Globals
Clear any parts of the tiled background that were drawn on last frame
==============
*/
+
+ static dirty_t clear = new dirty_t();
+
static void TileClear()
{
int i;
int top, bottom, left, right;
- dirty_t clear = new dirty_t();
+ clear.clear();
if (scr_drawall.value != 0)
DirtyScreen(); // for power vr or broken page flippers...
@@ -718,7 +732,7 @@ public final class SCR extends Globals
// erase rect will be the union of the past three frames
// so tripple buffering works properly
- clear = scr_dirty;
+ clear.set(scr_dirty);
for (i = 0; i < 2; i++)
{
if (scr_old_dirty[i].x1 < clear.x1)
@@ -731,8 +745,8 @@ public final class SCR extends Globals
clear.y2 = scr_old_dirty[i].y2;
}
- scr_old_dirty[1] = scr_old_dirty[0];
- scr_old_dirty[0] = scr_dirty;
+ scr_old_dirty[1].set(scr_old_dirty[0]);
+ scr_old_dirty[0].set(scr_dirty);
scr_dirty.x1 = 9999;
scr_dirty.x2 = -9999;
@@ -1452,10 +1466,16 @@ public final class SCR extends Globals
private static int lastframes = 0;
private static int lasttime = 0;
private static String fpsvalue = "";
+
static void DrawFPS()
{
if (fps.value > 0.0f)
{
+ if (fps.modified) {
+ fps.modified = false;
+ Cvar.SetValue("cl_maxfps", 1000);
+ }
+
int diff = cls.realtime - lasttime;
if (diff > (int) (fps.value * 1000))
{
@@ -1469,6 +1489,9 @@ public final class SCR extends Globals
re.DrawChar(x, 2, fpsvalue.charAt(i));
x += 8;
}
+ } else if (fps.modified){
+ fps.modified = false;
+ Cvar.SetValue("cl_maxfps", 90);
}
}
diff --git a/src/jake2/client/V.java b/src/jake2/client/V.java
index 3b9d139..2fd3005 100644
--- a/src/jake2/client/V.java
+++ b/src/jake2/client/V.java
@@ -2,7 +2,7 @@
* V.java
* Copyright (C) 2003
*
- * $Id: V.java,v 1.1 2004-07-07 19:58:52 hzi Exp $
+ * $Id: V.java,v 1.2 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -34,6 +34,7 @@ import jake2.util.Math3D;
import jake2.util.Vargs;
import java.io.IOException;
+import java.nio.FloatBuffer;
/**
* V
@@ -53,7 +54,7 @@ public final class V extends Globals {
static entity_t[] r_entities = new entity_t[MAX_ENTITIES];
static int r_numparticles;
- static particle_t[] r_particles = new particle_t[MAX_PARTICLES];
+ //static particle_t[] r_particles = new particle_t[MAX_PARTICLES];
static lightstyle_t[] r_lightstyles = new lightstyle_t[MAX_LIGHTSTYLES];
static {
@@ -61,8 +62,6 @@ public final class V extends Globals {
r_dlights[i] = new dlight_t();
for (int i = 0; i < r_entities.length; i++)
r_entities[i] = new entity_t();
- for (int i = 0; i < r_particles.length; i++)
- r_particles[i] = new particle_t();
for (int i = 0; i < r_lightstyles.length; i++)
r_lightstyles[i] = new lightstyle_t();
}
@@ -99,16 +98,20 @@ public final class V extends Globals {
=====================
*/
static void AddParticle(float[] org, int color, float alpha) {
- particle_t p;
-
if (r_numparticles >= MAX_PARTICLES)
return;
- p = r_particles[r_numparticles++];
+ int i = r_numparticles++;
- VectorCopy(org, p.origin);
- p.color = color;
- p.alpha = alpha;
+ int c = particle_t.colorTable[color];
+ c |= (int)(alpha * 255) << 24;
+ particle_t.colorArray.put(i, c);
+
+ i *= 3;
+ FloatBuffer vertexBuf = particle_t.vertexArray;
+ vertexBuf.put(i++, org[0]);
+ vertexBuf.put(i++, org[1]);
+ vertexBuf.put(i++, org[2]);
}
/*
@@ -158,26 +161,25 @@ public final class V extends Globals {
================
*/
static void TestParticles() {
- particle_t p;
int i, j;
float d, r, u;
- r_numparticles = MAX_PARTICLES;
- for (i = 0; i < r_numparticles; i++) {
+ float[] origin = {0,0,0};
+
+ r_numparticles = 0;
+ for (i = 0; i < MAX_PARTICLES; i++) {
d = i * 0.25f;
r = 4 * ((i & 7) - 3.5f);
u = 4 * (((i >> 3) & 7) - 3.5f);
- p = r_particles[i];
for (j = 0; j < 3; j++)
- p.origin[j] =
+ origin[j] =
cl.refdef.vieworg[j]
+ cl.v_forward[j] * d
+ cl.v_right[j] * r
+ cl.v_up[j] * u;
- p.color = 8;
- p.alpha = cl_testparticles.value;
+ AddParticle(origin, 8, cl_testparticles.value);
}
}
@@ -356,7 +358,6 @@ public final class V extends Globals {
cl.refdef.num_entities = r_numentities;
cl.refdef.entities = r_entities;
cl.refdef.num_particles = r_numparticles;
- cl.refdef.particles = r_particles;
cl.refdef.num_dlights = r_numdlights;
cl.refdef.dlights = r_dlights;
cl.refdef.lightstyles = r_lightstyles;
diff --git a/src/jake2/client/VID.java b/src/jake2/client/VID.java
index 53a943f..b18683b 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.4 2004-07-08 20:56:50 hzi Exp $
+ * $Id: VID.java,v 1.5 2004-07-09 06:50:50 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -370,7 +370,7 @@ public class VID extends Globals {
public static void Init()
{
/* Create the video variables so we know how to start the graphics drivers */
- vid_ref = Cvar.Get("vid_ref", "jogl", CVAR_ARCHIVE);
+ vid_ref = Cvar.Get("vid_ref", "fastjogl", CVAR_ARCHIVE);
vid_xpos = Cvar.Get("vid_xpos", "3", CVAR_ARCHIVE);
vid_ypos = Cvar.Get("vid_ypos", "22", CVAR_ARCHIVE);
vid_fullscreen = Cvar.Get("vid_fullscreen", "0", CVAR_ARCHIVE);
@@ -419,6 +419,7 @@ public class VID extends Globals {
// #define REF_3DFXGL 3
// #define REF_OPENGLX 4
static final int REF_OPENGL_JOGL = 0;
+ static final int REF_OPENGL_FASTJOGL =1;
// #define REF_MESA3DGLX 5
// extern cvar_t *vid_ref;
@@ -605,6 +606,12 @@ public class VID extends Globals {
if (gl_driver.modified)
vid_ref.modified = true;
break;
+ case REF_OPENGL_FASTJOGL :
+ Cvar.Set( "vid_ref", "fastjogl" );
+ Cvar.Set( "gl_driver", "fastjogl" );
+ if (gl_driver.modified)
+ vid_ref.modified = true;
+ break;
}
Menu.ForceMenuOff();
@@ -634,6 +641,7 @@ public class VID extends Globals {
// "[OpenGL glX ]",
// "[Mesa 3-D glX ]",
"[OpenGL jogl ]",
+ "[OpenGL fastjogl]",
null
};
static final String[] yesno_names =
@@ -686,6 +694,11 @@ public class VID extends Globals {
s_current_menu_index = OPENGL_MENU;
s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_OPENGL_JOGL;
}
+ else if ( vid_ref.string.equalsIgnoreCase("fastjogl"))
+ {
+ s_current_menu_index = OPENGL_MENU;
+ s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_OPENGL_FASTJOGL;
+ }
// else if (strcmp( vid_ref->string, "softx" ) == 0 )
// {
// s_current_menu_index = SOFTWARE_MENU;
diff --git a/src/jake2/client/client_state_t.java b/src/jake2/client/client_state_t.java
index ff86070..11a3af7 100644
--- a/src/jake2/client/client_state_t.java
+++ b/src/jake2/client/client_state_t.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 27.11.2003 by RST.
-//$Id: client_state_t.java,v 1.2 2004-07-08 20:56:51 hzi Exp $
+//$Id: client_state_t.java,v 1.3 2004-07-09 06:50:50 hzi Exp $
package jake2.client;
@@ -57,7 +57,7 @@ public class client_state_t {
int timedemo_start;
public boolean refresh_prepped; // false if on new level or new ref dll
- boolean sound_prepped; // ambient sounds can start
+ public boolean sound_prepped; // ambient sounds can start
boolean force_refdef; // vid has changed, so we can't use a paused refdef
int parse_entities; // index (not anded off) into cl_parse_entities[]
@@ -129,7 +129,7 @@ public class client_state_t {
model_t model_draw[] = new model_t[Defines.MAX_MODELS];
cmodel_t model_clip[] = new cmodel_t[Defines.MAX_MODELS];
- sfx_t sound_precache[] = new sfx_t[Defines.MAX_SOUNDS];
+ public sfx_t sound_precache[] = new sfx_t[Defines.MAX_SOUNDS];
image_t image_precache[] = new image_t[Defines.MAX_IMAGES];
clientinfo_t clientinfo[] = new clientinfo_t[Defines.MAX_CLIENTS];
diff --git a/src/jake2/client/frame_t.java b/src/jake2/client/frame_t.java
index 1e414dc..a242217 100644
--- a/src/jake2/client/frame_t.java
+++ b/src/jake2/client/frame_t.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 27.11.2003 by RST.
-// $Id: frame_t.java,v 1.2 2004-07-08 20:56:50 hzi Exp $
+// $Id: frame_t.java,v 1.3 2004-07-09 06:50:50 hzi Exp $
package jake2.client;
@@ -27,7 +27,7 @@ import jake2.game.player_state_t;
import java.util.Arrays;
-public class frame_t implements Cloneable {
+public class frame_t {
public static final int MAX_MAP_AREAS = 256;
@@ -37,8 +37,8 @@ public class frame_t implements Cloneable {
int deltaframe;
byte areabits[] = new byte [MAX_MAP_AREAS/8]; // portalarea visibility bits
public player_state_t playerstate = new player_state_t(); // mem
- int num_entities;
- int parse_entities; // non-masked index into cl_parse_entities array
+ public int num_entities;
+ public int parse_entities; // non-masked index into cl_parse_entities array
public void set(frame_t from) {
valid = from.valid;
diff --git a/src/jake2/client/particle_t.java b/src/jake2/client/particle_t.java
index 2127b5d..027cadf 100644
--- a/src/jake2/client/particle_t.java
+++ b/src/jake2/client/particle_t.java
@@ -19,12 +19,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 20.11.2003 by RST.
-// $Id: particle_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $
+// $Id: particle_t.java,v 1.2 2004-07-09 06:50:50 hzi Exp $
package jake2.client;
+import jake2.Defines;
+import jake2.util.Lib;
+
+import java.nio.*;
+
public class particle_t {
- public float origin[] = { 0, 0, 0 };
- public int color;
- public float alpha;
+
+ public static FloatBuffer vertexArray = Lib.newFloatBuffer(Defines.MAX_PARTICLES * 3);
+ public static IntBuffer colorArray = Lib.newIntBuffer(Defines.MAX_PARTICLES, ByteOrder.LITTLE_ENDIAN);
+ public static int[] colorTable = new int[256];
+
+ public static void setColorPalette(int[] palette) {
+ for (int i=0; i < 256; i++) {
+ colorTable[i] = palette[i] & 0x00FFFFFF;
+ }
+ }
}
diff --git a/src/jake2/client/refdef_t.java b/src/jake2/client/refdef_t.java
index a01ab06..d5c6027 100644
--- a/src/jake2/client/refdef_t.java
+++ b/src/jake2/client/refdef_t.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 20.11.2003 by RST.
-// $Id: refdef_t.java,v 1.1 2004-07-07 19:58:52 hzi Exp $
+// $Id: refdef_t.java,v 1.2 2004-07-09 06:50:50 hzi Exp $
package jake2.client;
@@ -43,5 +43,5 @@ public class refdef_t {
public dlight_t dlights[];
public int num_particles;
- public particle_t particles[];
+ //public particle_t particles[];
}