summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRene Stoeckel <[email protected]>2004-08-20 21:29:58 +0000
committerRene Stoeckel <[email protected]>2004-08-20 21:29:58 +0000
commit93a1cb6d6bfa9d7a80c004100125c829f1f36e86 (patch)
tree4ca88afc7718f8e63bd7f91aeccfe3c0fe66634e
parenta1a1c7334c9b03113344078d2d7977193a1d7b5e (diff)
savegames now seem to work.
-rw-r--r--src/jake2/client/Menu.java2692
-rw-r--r--src/jake2/game/GameBase.java5
-rw-r--r--src/jake2/game/GameSave.java721
-rw-r--r--src/jake2/game/GameUtil.java3
-rw-r--r--src/jake2/game/PlayerClient.java11
-rw-r--r--src/jake2/game/PlayerClientAdapters.java106
-rw-r--r--src/jake2/game/SuperAdapter.java87
-rw-r--r--src/jake2/game/client_persistant_t.java89
-rw-r--r--src/jake2/game/client_respawn_t.java62
-rw-r--r--src/jake2/game/edict_t.java781
-rw-r--r--src/jake2/game/entity_state_t.java80
-rw-r--r--src/jake2/game/game_export_t.java35
-rw-r--r--src/jake2/game/game_locals_t.java58
-rw-r--r--src/jake2/game/gclient_t.java340
-rw-r--r--src/jake2/game/gitem_t.java4
-rw-r--r--src/jake2/game/level_locals_t.java98
-rw-r--r--src/jake2/game/mframe_t.java32
-rw-r--r--src/jake2/game/mmove_t.java46
-rw-r--r--src/jake2/game/monsterinfo_t.java101
-rw-r--r--src/jake2/game/moveinfo_t.java64
-rw-r--r--src/jake2/game/player_state_t.java179
-rw-r--r--src/jake2/game/pmove_state_t.java74
-rw-r--r--src/jake2/qcommon/FS.java4
-rw-r--r--src/jake2/server/SV.java913
-rw-r--r--src/jake2/server/SV_CCMDS.java823
-rw-r--r--src/jake2/server/SV_INIT.java273
-rw-r--r--src/jake2/server/SV_WORLD.java14
-rw-r--r--src/jake2/util/QuakeFile.java180
28 files changed, 4473 insertions, 3402 deletions
diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java
index 6e451b9..74f6714 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.6 2004-07-30 06:03:40 hzi Exp $
+ * $Id: Menu.java,v 1.7 2004-08-20 21:29:56 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -34,8 +34,10 @@ import jake2.sys.NET;
import jake2.sys.Sys;
import jake2.util.Lib;
import jake2.util.Math3D;
+import jake2.util.QuakeFile;
import java.awt.Dimension;
+import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Arrays;
import java.util.Comparator;
@@ -53,11 +55,11 @@ abstract class keyfunc_t {
public final class Menu extends Key {
static int m_main_cursor;
- static final int NUM_CURSOR_FRAMES = 15;
+ static final int NUM_CURSOR_FRAMES= 15;
- static final String menu_in_sound = "misc/menu1.wav";
- static final String menu_move_sound = "misc/menu2.wav";
- static final String menu_out_sound = "misc/menu3.wav";
+ static final String menu_in_sound= "misc/menu1.wav";
+ static final String menu_move_sound= "misc/menu2.wav";
+ static final String menu_out_sound= "misc/menu3.wav";
static boolean m_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
@@ -69,7 +71,7 @@ public final class Menu extends Key {
// =============================================================================
/* Support Routines */
- public final static int MAX_MENU_DEPTH = 8;
+ public final static int MAX_MENU_DEPTH= 8;
public static class menulayer_t {
xcommand_t draw;
@@ -82,7 +84,7 @@ public final class Menu extends Key {
int nitems;
int nslots;
- menucommon_s items[] = new menucommon_s[64];
+ menucommon_s items[]= new menucommon_s[64];
String statusbar;
@@ -97,15 +99,15 @@ public final class Menu extends Key {
static class menucommon_s {
int type;
- String name;
+ String name= "";
int x, y;
menuframework_s parent;
int cursor_offset;
- int localdata[] = { 0, 0, 0, 0 };
+ int localdata[]= { 0, 0, 0, 0 };
int flags;
- int n = -1; //position in an array.
+ int n= -1; //position in an array.
- String statusbar;
+ String statusbar= "";
mcallback callback;
mcallback statusbarfunc;
@@ -145,11 +147,11 @@ public final class Menu extends Key {
}
- public static menulayer_t m_layers[] = new menulayer_t[MAX_MENU_DEPTH];
+ public static menulayer_t m_layers[]= new menulayer_t[MAX_MENU_DEPTH];
public static int m_menudepth;
static void Banner(String name) {
- Dimension dim = new Dimension();
+ Dimension dim= new Dimension();
Globals.re.DrawGetPicSize(dim, name);
Globals.re.DrawPic(viddef.width / 2 - dim.width / 2, viddef.height / 2 - 110, name);
@@ -163,33 +165,33 @@ public final class Menu extends Key {
// if this menu is already present, drop back to that level
// to avoid stacking menus by hotkeys
- for (i = 0; i < m_menudepth; i++)
+ for (i= 0; i < m_menudepth; i++)
if (m_layers[i].draw == draw && m_layers[i].key == key) {
- m_menudepth = i;
+ m_menudepth= i;
}
if (i == m_menudepth) {
if (m_menudepth >= MAX_MENU_DEPTH)
Com.Error(ERR_FATAL, "PushMenu: MAX_MENU_DEPTH");
- m_layers[m_menudepth].draw = m_drawfunc;
- m_layers[m_menudepth].key = m_keyfunc;
+ m_layers[m_menudepth].draw= m_drawfunc;
+ m_layers[m_menudepth].key= m_keyfunc;
m_menudepth++;
}
- m_drawfunc = draw;
- m_keyfunc = key;
+ m_drawfunc= draw;
+ m_keyfunc= key;
- m_entersound = true;
+ m_entersound= true;
- cls.key_dest = key_menu;
+ cls.key_dest= key_menu;
}
static void ForceMenuOff() {
- m_drawfunc = null;
- m_keyfunc = null;
- cls.key_dest = key_game;
- m_menudepth = 0;
+ m_drawfunc= null;
+ m_keyfunc= null;
+ cls.key_dest= key_game;
+ m_menudepth= 0;
Key.ClearStates();
Cvar.Set("paused", "0");
}
@@ -200,19 +202,19 @@ public final class Menu extends Key {
Com.Error(ERR_FATAL, "PopMenu: depth < 1");
m_menudepth--;
- m_drawfunc = m_layers[m_menudepth].draw;
- m_keyfunc = m_layers[m_menudepth].key;
+ m_drawfunc= m_layers[m_menudepth].draw;
+ m_keyfunc= m_layers[m_menudepth].key;
if (0 == m_menudepth)
ForceMenuOff();
}
static String Default_MenuKey(menuframework_s m, int key) {
- String sound = null;
+ String sound= null;
menucommon_s item;
if (m != null) {
- if ((item = ((menucommon_s) Menu_ItemAtCursor(m))) != null) {
+ if ((item= ((menucommon_s) Menu_ItemAtCursor(m))) != null) {
if (item.type == MTYPE_FIELD) {
if (Field_Key((menufield_s) item, key))
return null;
@@ -229,14 +231,14 @@ public final class Menu extends Key {
if (m != null) {
m.cursor--;
Menu_AdjustCursor(m, -1);
- sound = menu_move_sound;
+ sound= menu_move_sound;
}
break;
case K_TAB :
if (m != null) {
m.cursor++;
Menu_AdjustCursor(m, 1);
- sound = menu_move_sound;
+ sound= menu_move_sound;
}
break;
case K_KP_DOWNARROW :
@@ -244,21 +246,21 @@ public final class Menu extends Key {
if (m != null) {
m.cursor++;
Menu_AdjustCursor(m, 1);
- sound = menu_move_sound;
+ sound= menu_move_sound;
}
break;
case K_KP_LEFTARROW :
case K_LEFTARROW :
if (m != null) {
Menu_SlideItem(m, -1);
- sound = menu_move_sound;
+ sound= menu_move_sound;
}
break;
case K_KP_RIGHTARROW :
case K_RIGHTARROW :
if (m != null) {
Menu_SlideItem(m, 1);
- sound = menu_move_sound;
+ sound= menu_move_sound;
}
break;
@@ -307,7 +309,7 @@ public final class Menu extends Key {
case K_ENTER :
if (m != null)
Menu_SelectItem(m);
- sound = menu_move_sound;
+ sound= menu_move_sound;
break;
}
@@ -329,7 +331,7 @@ public final class Menu extends Key {
public static void Print(int cx, int cy, String str) {
//while (*str)
- for (int n = 0; n < str.length(); n++) {
+ for (int n= 0; n < str.length(); n++) {
DrawCharacter(cx, cy, str.charAt(n) + 128);
//str++;
cx += 8;
@@ -337,7 +339,7 @@ public final class Menu extends Key {
}
public static void PrintWhite(int cx, int cy, String str) {
- for (int n = 0; n < str.length(); n++) {
+ for (int n= 0; n < str.length(); n++) {
DrawCharacter(cx, cy, str.charAt(n));
//str++;
cx += 8;
@@ -364,20 +366,20 @@ public final class Menu extends Key {
assert(f >= 0) : "negative time and cursor bug";
- f = Math.abs(f);
+ f= Math.abs(f);
if (!cached) {
int i;
- for (i = 0; i < NUM_CURSOR_FRAMES; i++) {
- cursorname = "m_cursor" + i;
+ for (i= 0; i < NUM_CURSOR_FRAMES; i++) {
+ cursorname= "m_cursor" + i;
re.RegisterPic(cursorname);
}
- cached = true;
+ cached= true;
}
- cursorname = "m_cursor" + f;
+ cursorname= "m_cursor" + f;
re.DrawPic(x, y, cursorname);
}
@@ -386,11 +388,11 @@ public final class Menu extends Key {
int n;
// draw left side
- cx = x;
- cy = y;
+ cx= x;
+ cy= y;
DrawCharacter(cx, cy, 1);
- for (n = 0; n < lines; n++) {
+ for (n= 0; n < lines; n++) {
cy += 8;
DrawCharacter(cx, cy, 4);
}
@@ -399,10 +401,10 @@ public final class Menu extends Key {
// draw middle
cx += 8;
while (width > 0) {
- cy = y;
+ cy= y;
DrawCharacter(cx, cy, 2);
- for (n = 0; n < lines; n++) {
+ for (n= 0; n < lines; n++) {
cy += 8;
DrawCharacter(cx, cy, 5);
}
@@ -413,9 +415,9 @@ public final class Menu extends Key {
}
// draw right side
- cy = y;
+ cy= y;
DrawCharacter(cx, cy, 3);
- for (n = 0; n < lines; n++) {
+ for (n= 0; n < lines; n++) {
cy += 8;
DrawCharacter(cx, cy, 6);
@@ -431,9 +433,9 @@ public final class Menu extends Key {
=======================================================================
*/
- static final int MAIN_ITEMS = 5;
+ static final int MAIN_ITEMS= 5;
- static xcommand_t Main_Draw = new xcommand_t() {
+ static xcommand_t Main_Draw= new xcommand_t() {
public void execute() {
Main_Draw();
}
@@ -443,52 +445,52 @@ public final class Menu extends Key {
int w, h;
int ystart;
int xoffset;
- int widest = -1;
- int totalheight = 0;
+ int widest= -1;
+ int totalheight= 0;
String litname;
- String[] names = { "m_main_game", "m_main_multiplayer", "m_main_options", "m_main_video", "m_main_quit" };
- Dimension dim = new Dimension();
+ String[] names= { "m_main_game", "m_main_multiplayer", "m_main_options", "m_main_video", "m_main_quit" };
+ Dimension dim= new Dimension();
- for (i = 0; i < names.length; i++) {
+ for (i= 0; i < names.length; i++) {
Globals.re.DrawGetPicSize(dim, names[i]);
- w = dim.width;
- h = dim.height;
+ w= dim.width;
+ h= dim.height;
if (w > widest)
- widest = w;
+ widest= w;
totalheight += (h + 12);
}
- ystart = (Globals.viddef.height / 2 - 110);
- xoffset = (Globals.viddef.width - widest + 70) / 2;
+ ystart= (Globals.viddef.height / 2 - 110);
+ xoffset= (Globals.viddef.width - widest + 70) / 2;
- for (i = 0; i < names.length; i++) {
+ for (i= 0; i < names.length; i++) {
if (i != m_main_cursor)
Globals.re.DrawPic(xoffset, ystart + i * 40 + 13, names[i]);
}
//strcat(litname, "_sel");
- litname = names[m_main_cursor] + "_sel";
+ litname= names[m_main_cursor] + "_sel";
Globals.re.DrawPic(xoffset, ystart + m_main_cursor * 40 + 13, litname);
DrawCursor(xoffset - 25, ystart + m_main_cursor * 40 + 11, (int) ((Globals.cls.realtime / 100)) % NUM_CURSOR_FRAMES);
Globals.re.DrawGetPicSize(dim, "m_main_plaque");
- w = dim.width;
- h = dim.height;
+ w= dim.width;
+ h= dim.height;
Globals.re.DrawPic(xoffset - 30 - w, ystart, "m_main_plaque");
Globals.re.DrawPic(xoffset - 30 - w, ystart + h + 5, "m_main_logo");
}
- static keyfunc_t Main_Key = new keyfunc_t() {
+ static keyfunc_t Main_Key= new keyfunc_t() {
public String execute(int key) {
return Main_Key(key);
}
};
static String Main_Key(int key) {
- String sound = menu_move_sound;
+ String sound= menu_move_sound;
switch (key) {
case Key.K_ESCAPE :
@@ -498,18 +500,18 @@ public final class Menu extends Key {
case Key.K_KP_DOWNARROW :
case Key.K_DOWNARROW :
if (++m_main_cursor >= MAIN_ITEMS)
- m_main_cursor = 0;
+ m_main_cursor= 0;
return sound;
case Key.K_KP_UPARROW :
case Key.K_UPARROW :
if (--m_main_cursor < 0)
- m_main_cursor = MAIN_ITEMS - 1;
+ m_main_cursor= MAIN_ITEMS - 1;
return sound;
case Key.K_KP_ENTER :
case Key.K_ENTER :
- m_entersound = true;
+ m_entersound= true;
switch (m_main_cursor) {
case 0 :
@@ -537,7 +539,7 @@ public final class Menu extends Key {
return null;
}
- static xcommand_t Menu_Main = new xcommand_t() {
+ static xcommand_t Menu_Main= new xcommand_t() {
public void execute() {
Menu_Main_f();
}
@@ -562,10 +564,10 @@ public final class Menu extends Key {
=======================================================================
*/
- static menuframework_s s_multiplayer_menu = new menuframework_s();
- static menuaction_s s_join_network_server_action = new menuaction_s();
- static menuaction_s s_start_network_server_action = new menuaction_s();
- static menuaction_s s_player_setup_action = new menuaction_s();
+ static menuframework_s s_multiplayer_menu= new menuframework_s();
+ static menuaction_s s_join_network_server_action= new menuaction_s();
+ static menuaction_s s_start_network_server_action= new menuaction_s();
+ static menuaction_s s_player_setup_action= new menuaction_s();
static void Multiplayer_MenuDraw() {
Banner("m_banner_multiplayer");
@@ -587,37 +589,37 @@ public final class Menu extends Key {
}
static void Multiplayer_MenuInit() {
- s_multiplayer_menu.x = (int) (viddef.width * 0.50f - 64);
- s_multiplayer_menu.nitems = 0;
-
- s_join_network_server_action.type = MTYPE_ACTION;
- s_join_network_server_action.flags = QMF_LEFT_JUSTIFY;
- s_join_network_server_action.x = 0;
- s_join_network_server_action.y = 0;
- s_join_network_server_action.name = " join network server";
- s_join_network_server_action.callback = new mcallback() {
+ s_multiplayer_menu.x= (int) (viddef.width * 0.50f - 64);
+ s_multiplayer_menu.nitems= 0;
+
+ s_join_network_server_action.type= MTYPE_ACTION;
+ s_join_network_server_action.flags= QMF_LEFT_JUSTIFY;
+ s_join_network_server_action.x= 0;
+ s_join_network_server_action.y= 0;
+ s_join_network_server_action.name= " join network server";
+ s_join_network_server_action.callback= new mcallback() {
public void execute(Object o) {
JoinNetworkServerFunc(o);
};
};
- s_start_network_server_action.type = MTYPE_ACTION;
- s_start_network_server_action.flags = QMF_LEFT_JUSTIFY;
- s_start_network_server_action.x = 0;
- s_start_network_server_action.y = 10;
- s_start_network_server_action.name = " start network server";
- s_start_network_server_action.callback = new mcallback() {
+ s_start_network_server_action.type= MTYPE_ACTION;
+ s_start_network_server_action.flags= QMF_LEFT_JUSTIFY;
+ s_start_network_server_action.x= 0;
+ s_start_network_server_action.y= 10;
+ s_start_network_server_action.name= " start network server";
+ s_start_network_server_action.callback= new mcallback() {
public void execute(Object o) {
StartNetworkServerFunc(o);
}
};
- s_player_setup_action.type = MTYPE_ACTION;
- s_player_setup_action.flags = QMF_LEFT_JUSTIFY;
- s_player_setup_action.x = 0;
- s_player_setup_action.y = 20;
- s_player_setup_action.name = " player setup";
- s_player_setup_action.callback = new mcallback() {
+ s_player_setup_action.type= MTYPE_ACTION;
+ s_player_setup_action.flags= QMF_LEFT_JUSTIFY;
+ s_player_setup_action.x= 0;
+ s_player_setup_action.y= 20;
+ s_player_setup_action.name= " player setup";
+ s_player_setup_action.callback= new mcallback() {
public void execute(Object o) {
PlayerSetupFunc(o);
}
@@ -636,7 +638,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_multiplayer_menu, key);
}
- static xcommand_t Menu_Multiplayer = new xcommand_t() {
+ static xcommand_t Menu_Multiplayer= new xcommand_t() {
public void execute() {
Menu_Multiplayer_f();
}
@@ -662,7 +664,7 @@ public final class Menu extends Key {
=======================================================================
*/
- static String bindnames[][] = { { "+attack", "attack" }, {
+ static String bindnames[][]= { { "+attack", "attack" }, {
"weapnext", "next weapon" }, {
"+forward", "walk forward" }, {
"+back", "backpedal" }, {
@@ -693,38 +695,38 @@ public final class Menu extends Key {
int keys_cursor;
static boolean bind_grab;
- static menuframework_s s_keys_menu = new menuframework_s();
- static menuaction_s s_keys_attack_action = new menuaction_s();
- static menuaction_s s_keys_change_weapon_action = new menuaction_s();
- static menuaction_s s_keys_walk_forward_action = new menuaction_s();
- static menuaction_s s_keys_backpedal_action = new menuaction_s();
- static menuaction_s s_keys_turn_left_action = new menuaction_s();
- static menuaction_s s_keys_turn_right_action = new menuaction_s();
- static menuaction_s s_keys_run_action = new menuaction_s();
- static menuaction_s s_keys_step_left_action = new menuaction_s();
- static menuaction_s s_keys_step_right_action = new menuaction_s();
- static menuaction_s s_keys_sidestep_action = new menuaction_s();
- static menuaction_s s_keys_look_up_action = new menuaction_s();
- static menuaction_s s_keys_look_down_action = new menuaction_s();
- static menuaction_s s_keys_center_view_action = new menuaction_s();
- static menuaction_s s_keys_mouse_look_action = new menuaction_s();
- static menuaction_s s_keys_keyboard_look_action = new menuaction_s();
- static menuaction_s s_keys_move_up_action = new menuaction_s();
- static menuaction_s s_keys_move_down_action = new menuaction_s();
- static menuaction_s s_keys_inventory_action = new menuaction_s();
- static menuaction_s s_keys_inv_use_action = new menuaction_s();
- static menuaction_s s_keys_inv_drop_action = new menuaction_s();
- static menuaction_s s_keys_inv_prev_action = new menuaction_s();
- static menuaction_s s_keys_inv_next_action = new menuaction_s();
-
- static menuaction_s s_keys_help_computer_action = new menuaction_s();
+ static menuframework_s s_keys_menu= new menuframework_s();
+ static menuaction_s s_keys_attack_action= new menuaction_s();
+ static menuaction_s s_keys_change_weapon_action= new menuaction_s();
+ static menuaction_s s_keys_walk_forward_action= new menuaction_s();
+ static menuaction_s s_keys_backpedal_action= new menuaction_s();
+ static menuaction_s s_keys_turn_left_action= new menuaction_s();
+ static menuaction_s s_keys_turn_right_action= new menuaction_s();
+ static menuaction_s s_keys_run_action= new menuaction_s();
+ static menuaction_s s_keys_step_left_action= new menuaction_s();
+ static menuaction_s s_keys_step_right_action= new menuaction_s();
+ static menuaction_s s_keys_sidestep_action= new menuaction_s();
+ static menuaction_s s_keys_look_up_action= new menuaction_s();
+ static menuaction_s s_keys_look_down_action= new menuaction_s();
+ static menuaction_s s_keys_center_view_action= new menuaction_s();
+ static menuaction_s s_keys_mouse_look_action= new menuaction_s();
+ static menuaction_s s_keys_keyboard_look_action= new menuaction_s();
+ static menuaction_s s_keys_move_up_action= new menuaction_s();
+ static menuaction_s s_keys_move_down_action= new menuaction_s();
+ static menuaction_s s_keys_inventory_action= new menuaction_s();
+ static menuaction_s s_keys_inv_use_action= new menuaction_s();
+ static menuaction_s s_keys_inv_drop_action= new menuaction_s();
+ static menuaction_s s_keys_inv_prev_action= new menuaction_s();
+ static menuaction_s s_keys_inv_next_action= new menuaction_s();
+
+ static menuaction_s s_keys_help_computer_action= new menuaction_s();
static void UnbindCommand(String command) {
int j;
String b;
- for (j = 0; j < 256; j++) {
- b = keybindings[j];
+ for (j= 0; j < 256; j++) {
+ b= keybindings[j];
if (b == null)
continue;
if (b.equals(command))
@@ -737,16 +739,16 @@ public final class Menu extends Key {
int j;
String b;
- twokeys[0] = twokeys[1] = -1;
- count = 0;
+ twokeys[0]= twokeys[1]= -1;
+ count= 0;
- for (j = 0; j < 256; j++) {
- b = keybindings[j];
+ for (j= 0; j < 256; j++) {
+ b= keybindings[j];
if (b == null)
continue;
-
- if (b.equals(command)) {
- twokeys[count] = j;
+
+ if (b.equals(command)) {
+ twokeys[count]= j;
count++;
if (count == 2)
break;
@@ -762,8 +764,8 @@ public final class Menu extends Key {
}
static void DrawKeyBindingFunc(Object self) {
- int keys[] = { 0, 0 };
- menuaction_s a = (menuaction_s) self;
+ int keys[]= { 0, 0 };
+ menuaction_s a= (menuaction_s) self;
FindKeysForCommand(bindnames[a.localdata[0]][0], keys);
@@ -774,11 +776,11 @@ public final class Menu extends Key {
int x;
String name;
- name = Key.KeynumToString(keys[0]);
+ name= Key.KeynumToString(keys[0]);
Menu_DrawString(a.x + a.parent.x + 16, a.y + a.parent.y, name);
- x = name.length() * 8;
+ x= name.length() * 8;
if (keys[1] != -1) {
Menu_DrawString(a.x + a.parent.x + 24 + x, a.y + a.parent.y, "or");
@@ -788,322 +790,322 @@ public final class Menu extends Key {
}
static void KeyBindingFunc(Object self) {
- menuaction_s a = (menuaction_s) self;
- int keys[] = { 0, 0 };
+ menuaction_s a= (menuaction_s) self;
+ int keys[]= { 0, 0 };
FindKeysForCommand(bindnames[a.localdata[0]][0], keys);
if (keys[1] != -1)
UnbindCommand(bindnames[a.localdata[0]][0]);
- bind_grab = true;
+ bind_grab= true;
Menu_SetStatusBar(s_keys_menu, "press a key or button for this action");
}
static void Keys_MenuInit() {
- int y = 0;
- int i = 0;
+ int y= 0;
+ int i= 0;
- s_keys_menu.x = (int) (viddef.width * 0.50);
- s_keys_menu.nitems = 0;
- s_keys_menu.cursordraw = new mcallback() {
+ s_keys_menu.x= (int) (viddef.width * 0.50);
+ s_keys_menu.nitems= 0;
+ s_keys_menu.cursordraw= new mcallback() {
public void execute(Object o) {
KeyCursorDrawFunc((menuframework_s) o);
}
};
- s_keys_attack_action.type = MTYPE_ACTION;
- s_keys_attack_action.flags = QMF_GRAYED;
- s_keys_attack_action.x = 0;
- s_keys_attack_action.y = y;
- s_keys_attack_action.ownerdraw = new mcallback() {
+ s_keys_attack_action.type= MTYPE_ACTION;
+ s_keys_attack_action.flags= QMF_GRAYED;
+ s_keys_attack_action.x= 0;
+ s_keys_attack_action.y= y;
+ s_keys_attack_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_attack_action.localdata[0] = i;
- s_keys_attack_action.name = bindnames[s_keys_attack_action.localdata[0]][1];
-
- s_keys_change_weapon_action.type = MTYPE_ACTION;
- s_keys_change_weapon_action.flags = QMF_GRAYED;
- s_keys_change_weapon_action.x = 0;
- s_keys_change_weapon_action.y = y += 9;
- s_keys_change_weapon_action.ownerdraw = new mcallback() {
+ s_keys_attack_action.localdata[0]= i;
+ s_keys_attack_action.name= bindnames[s_keys_attack_action.localdata[0]][1];
+
+ s_keys_change_weapon_action.type= MTYPE_ACTION;
+ s_keys_change_weapon_action.flags= QMF_GRAYED;
+ s_keys_change_weapon_action.x= 0;
+ s_keys_change_weapon_action.y= y += 9;
+ s_keys_change_weapon_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_change_weapon_action.localdata[0] = ++i;
- s_keys_change_weapon_action.name = bindnames[s_keys_change_weapon_action.localdata[0]][1];
+ s_keys_change_weapon_action.localdata[0]= ++i;
+ s_keys_change_weapon_action.name= bindnames[s_keys_change_weapon_action.localdata[0]][1];
- s_keys_walk_forward_action.type = MTYPE_ACTION;
- s_keys_walk_forward_action.flags = QMF_GRAYED;
- s_keys_walk_forward_action.x = 0;
- s_keys_walk_forward_action.y = y += 9;
- s_keys_walk_forward_action.ownerdraw = new mcallback() {
+ s_keys_walk_forward_action.type= MTYPE_ACTION;
+ s_keys_walk_forward_action.flags= QMF_GRAYED;
+ s_keys_walk_forward_action.x= 0;
+ s_keys_walk_forward_action.y= y += 9;
+ s_keys_walk_forward_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_walk_forward_action.localdata[0] = ++i;
- s_keys_walk_forward_action.name = bindnames[s_keys_walk_forward_action.localdata[0]][1];
-
- s_keys_backpedal_action.type = MTYPE_ACTION;
- s_keys_backpedal_action.flags = QMF_GRAYED;
- s_keys_backpedal_action.x = 0;
- s_keys_backpedal_action.y = y += 9;
- s_keys_backpedal_action.ownerdraw = new mcallback() {
+ s_keys_walk_forward_action.localdata[0]= ++i;
+ s_keys_walk_forward_action.name= bindnames[s_keys_walk_forward_action.localdata[0]][1];
+
+ s_keys_backpedal_action.type= MTYPE_ACTION;
+ s_keys_backpedal_action.flags= QMF_GRAYED;
+ s_keys_backpedal_action.x= 0;
+ s_keys_backpedal_action.y= y += 9;
+ s_keys_backpedal_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_backpedal_action.localdata[0] = ++i;
- s_keys_backpedal_action.name = bindnames[s_keys_backpedal_action.localdata[0]][1];
-
- s_keys_turn_left_action.type = MTYPE_ACTION;
- s_keys_turn_left_action.flags = QMF_GRAYED;
- s_keys_turn_left_action.x = 0;
- s_keys_turn_left_action.y = y += 9;
- s_keys_turn_left_action.ownerdraw = new mcallback() {
+ s_keys_backpedal_action.localdata[0]= ++i;
+ s_keys_backpedal_action.name= bindnames[s_keys_backpedal_action.localdata[0]][1];
+
+ s_keys_turn_left_action.type= MTYPE_ACTION;
+ s_keys_turn_left_action.flags= QMF_GRAYED;
+ s_keys_turn_left_action.x= 0;
+ s_keys_turn_left_action.y= y += 9;
+ s_keys_turn_left_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_turn_left_action.localdata[0] = ++i;
- s_keys_turn_left_action.name = bindnames[s_keys_turn_left_action.localdata[0]][1];
-
- s_keys_turn_right_action.type = MTYPE_ACTION;
- s_keys_turn_right_action.flags = QMF_GRAYED;
- s_keys_turn_right_action.x = 0;
- s_keys_turn_right_action.y = y += 9;
- s_keys_turn_right_action.ownerdraw = new mcallback() {
+ s_keys_turn_left_action.localdata[0]= ++i;
+ s_keys_turn_left_action.name= bindnames[s_keys_turn_left_action.localdata[0]][1];
+
+ s_keys_turn_right_action.type= MTYPE_ACTION;
+ s_keys_turn_right_action.flags= QMF_GRAYED;
+ s_keys_turn_right_action.x= 0;
+ s_keys_turn_right_action.y= y += 9;
+ s_keys_turn_right_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_turn_right_action.localdata[0] = ++i;
- s_keys_turn_right_action.name = bindnames[s_keys_turn_right_action.localdata[0]][1];
-
- s_keys_run_action.type = MTYPE_ACTION;
- s_keys_run_action.flags = QMF_GRAYED;
- s_keys_run_action.x = 0;
- s_keys_run_action.y = y += 9;
- s_keys_run_action.ownerdraw = new mcallback() {
+ s_keys_turn_right_action.localdata[0]= ++i;
+ s_keys_turn_right_action.name= bindnames[s_keys_turn_right_action.localdata[0]][1];
+
+ s_keys_run_action.type= MTYPE_ACTION;
+ s_keys_run_action.flags= QMF_GRAYED;
+ s_keys_run_action.x= 0;
+ s_keys_run_action.y= y += 9;
+ s_keys_run_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_run_action.localdata[0] = ++i;
- s_keys_run_action.name = bindnames[s_keys_run_action.localdata[0]][1];
-
- s_keys_step_left_action.type = MTYPE_ACTION;
- s_keys_step_left_action.flags = QMF_GRAYED;
- s_keys_step_left_action.x = 0;
- s_keys_step_left_action.y = y += 9;
- s_keys_step_left_action.ownerdraw = new mcallback() {
+ s_keys_run_action.localdata[0]= ++i;
+ s_keys_run_action.name= bindnames[s_keys_run_action.localdata[0]][1];
+
+ s_keys_step_left_action.type= MTYPE_ACTION;
+ s_keys_step_left_action.flags= QMF_GRAYED;
+ s_keys_step_left_action.x= 0;
+ s_keys_step_left_action.y= y += 9;
+ s_keys_step_left_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_step_left_action.localdata[0] = ++i;
- s_keys_step_left_action.name = bindnames[s_keys_step_left_action.localdata[0]][1];
-
- s_keys_step_right_action.type = MTYPE_ACTION;
- s_keys_step_right_action.flags = QMF_GRAYED;
- s_keys_step_right_action.x = 0;
- s_keys_step_right_action.y = y += 9;
- s_keys_step_right_action.ownerdraw = new mcallback() {
+ s_keys_step_left_action.localdata[0]= ++i;
+ s_keys_step_left_action.name= bindnames[s_keys_step_left_action.localdata[0]][1];
+
+ s_keys_step_right_action.type= MTYPE_ACTION;
+ s_keys_step_right_action.flags= QMF_GRAYED;
+ s_keys_step_right_action.x= 0;
+ s_keys_step_right_action.y= y += 9;
+ s_keys_step_right_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_step_right_action.localdata[0] = ++i;
- s_keys_step_right_action.name = bindnames[s_keys_step_right_action.localdata[0]][1];
+ s_keys_step_right_action.localdata[0]= ++i;
+ s_keys_step_right_action.name= bindnames[s_keys_step_right_action.localdata[0]][1];
- s_keys_sidestep_action.type = MTYPE_ACTION;
- s_keys_sidestep_action.flags = QMF_GRAYED;
- s_keys_sidestep_action.x = 0;
- s_keys_sidestep_action.y = y += 9;
- s_keys_sidestep_action.ownerdraw = new mcallback() {
+ s_keys_sidestep_action.type= MTYPE_ACTION;
+ s_keys_sidestep_action.flags= QMF_GRAYED;
+ s_keys_sidestep_action.x= 0;
+ s_keys_sidestep_action.y= y += 9;
+ s_keys_sidestep_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_sidestep_action.localdata[0] = ++i;
- s_keys_sidestep_action.name = bindnames[s_keys_sidestep_action.localdata[0]][1];
+ s_keys_sidestep_action.localdata[0]= ++i;
+ s_keys_sidestep_action.name= bindnames[s_keys_sidestep_action.localdata[0]][1];
- s_keys_look_up_action.type = MTYPE_ACTION;
- s_keys_look_up_action.flags = QMF_GRAYED;
- s_keys_look_up_action.x = 0;
- s_keys_look_up_action.y = y += 9;
- s_keys_look_up_action.ownerdraw = new mcallback() {
+ s_keys_look_up_action.type= MTYPE_ACTION;
+ s_keys_look_up_action.flags= QMF_GRAYED;
+ s_keys_look_up_action.x= 0;
+ s_keys_look_up_action.y= y += 9;
+ s_keys_look_up_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_look_up_action.localdata[0] = ++i;
- s_keys_look_up_action.name = bindnames[s_keys_look_up_action.localdata[0]][1];
+ s_keys_look_up_action.localdata[0]= ++i;
+ s_keys_look_up_action.name= bindnames[s_keys_look_up_action.localdata[0]][1];
- s_keys_look_down_action.type = MTYPE_ACTION;
- s_keys_look_down_action.flags = QMF_GRAYED;
- s_keys_look_down_action.x = 0;
- s_keys_look_down_action.y = y += 9;
- s_keys_look_down_action.ownerdraw = new mcallback() {
+ s_keys_look_down_action.type= MTYPE_ACTION;
+ s_keys_look_down_action.flags= QMF_GRAYED;
+ s_keys_look_down_action.x= 0;
+ s_keys_look_down_action.y= y += 9;
+ s_keys_look_down_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_look_down_action.localdata[0] = ++i;
- s_keys_look_down_action.name = bindnames[s_keys_look_down_action.localdata[0]][1];
+ s_keys_look_down_action.localdata[0]= ++i;
+ s_keys_look_down_action.name= bindnames[s_keys_look_down_action.localdata[0]][1];
- s_keys_center_view_action.type = MTYPE_ACTION;
- s_keys_center_view_action.flags = QMF_GRAYED;
- s_keys_center_view_action.x = 0;
- s_keys_center_view_action.y = y += 9;
- s_keys_center_view_action.ownerdraw = new mcallback() {
+ s_keys_center_view_action.type= MTYPE_ACTION;
+ s_keys_center_view_action.flags= QMF_GRAYED;
+ s_keys_center_view_action.x= 0;
+ s_keys_center_view_action.y= y += 9;
+ s_keys_center_view_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_center_view_action.localdata[0] = ++i;
- s_keys_center_view_action.name = bindnames[s_keys_center_view_action.localdata[0]][1];
+ s_keys_center_view_action.localdata[0]= ++i;
+ s_keys_center_view_action.name= bindnames[s_keys_center_view_action.localdata[0]][1];
- s_keys_mouse_look_action.type = MTYPE_ACTION;
- s_keys_mouse_look_action.flags = QMF_GRAYED;
- s_keys_mouse_look_action.x = 0;
- s_keys_mouse_look_action.y = y += 9;
- s_keys_mouse_look_action.ownerdraw = new mcallback() {
+ s_keys_mouse_look_action.type= MTYPE_ACTION;
+ s_keys_mouse_look_action.flags= QMF_GRAYED;
+ s_keys_mouse_look_action.x= 0;
+ s_keys_mouse_look_action.y= y += 9;
+ s_keys_mouse_look_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_mouse_look_action.localdata[0] = ++i;
- s_keys_mouse_look_action.name = bindnames[s_keys_mouse_look_action.localdata[0]][1];
+ s_keys_mouse_look_action.localdata[0]= ++i;
+ s_keys_mouse_look_action.name= bindnames[s_keys_mouse_look_action.localdata[0]][1];
- s_keys_keyboard_look_action.type = MTYPE_ACTION;
- s_keys_keyboard_look_action.flags = QMF_GRAYED;
- s_keys_keyboard_look_action.x = 0;
- s_keys_keyboard_look_action.y = y += 9;
- s_keys_keyboard_look_action.ownerdraw = new mcallback() {
+ s_keys_keyboard_look_action.type= MTYPE_ACTION;
+ s_keys_keyboard_look_action.flags= QMF_GRAYED;
+ s_keys_keyboard_look_action.x= 0;
+ s_keys_keyboard_look_action.y= y += 9;
+ s_keys_keyboard_look_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_keyboard_look_action.localdata[0] = ++i;
- s_keys_keyboard_look_action.name = bindnames[s_keys_keyboard_look_action.localdata[0]][1];
+ s_keys_keyboard_look_action.localdata[0]= ++i;
+ s_keys_keyboard_look_action.name= bindnames[s_keys_keyboard_look_action.localdata[0]][1];
- s_keys_move_up_action.type = MTYPE_ACTION;
- s_keys_move_up_action.flags = QMF_GRAYED;
- s_keys_move_up_action.x = 0;
- s_keys_move_up_action.y = y += 9;
- s_keys_move_up_action.ownerdraw = new mcallback() {
+ s_keys_move_up_action.type= MTYPE_ACTION;
+ s_keys_move_up_action.flags= QMF_GRAYED;
+ s_keys_move_up_action.x= 0;
+ s_keys_move_up_action.y= y += 9;
+ s_keys_move_up_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_move_up_action.localdata[0] = ++i;
- s_keys_move_up_action.name = bindnames[s_keys_move_up_action.localdata[0]][1];
+ s_keys_move_up_action.localdata[0]= ++i;
+ s_keys_move_up_action.name= bindnames[s_keys_move_up_action.localdata[0]][1];
- s_keys_move_down_action.type = MTYPE_ACTION;
- s_keys_move_down_action.flags = QMF_GRAYED;
- s_keys_move_down_action.x = 0;
- s_keys_move_down_action.y = y += 9;
- s_keys_move_down_action.ownerdraw = new mcallback() {
+ s_keys_move_down_action.type= MTYPE_ACTION;
+ s_keys_move_down_action.flags= QMF_GRAYED;
+ s_keys_move_down_action.x= 0;
+ s_keys_move_down_action.y= y += 9;
+ s_keys_move_down_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_move_down_action.localdata[0] = ++i;
- s_keys_move_down_action.name = bindnames[s_keys_move_down_action.localdata[0]][1];
+ s_keys_move_down_action.localdata[0]= ++i;
+ s_keys_move_down_action.name= bindnames[s_keys_move_down_action.localdata[0]][1];
- s_keys_inventory_action.type = MTYPE_ACTION;
- s_keys_inventory_action.flags = QMF_GRAYED;
- s_keys_inventory_action.x = 0;
- s_keys_inventory_action.y = y += 9;
- s_keys_inventory_action.ownerdraw = new mcallback() {
+ s_keys_inventory_action.type= MTYPE_ACTION;
+ s_keys_inventory_action.flags= QMF_GRAYED;
+ s_keys_inventory_action.x= 0;
+ s_keys_inventory_action.y= y += 9;
+ s_keys_inventory_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_inventory_action.localdata[0] = ++i;
- s_keys_inventory_action.name = bindnames[s_keys_inventory_action.localdata[0]][1];
+ s_keys_inventory_action.localdata[0]= ++i;
+ s_keys_inventory_action.name= bindnames[s_keys_inventory_action.localdata[0]][1];
- s_keys_inv_use_action.type = MTYPE_ACTION;
- s_keys_inv_use_action.flags = QMF_GRAYED;
- s_keys_inv_use_action.x = 0;
- s_keys_inv_use_action.y = y += 9;
- s_keys_inv_use_action.ownerdraw = new mcallback() {
+ s_keys_inv_use_action.type= MTYPE_ACTION;
+ s_keys_inv_use_action.flags= QMF_GRAYED;
+ s_keys_inv_use_action.x= 0;
+ s_keys_inv_use_action.y= y += 9;
+ s_keys_inv_use_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_inv_use_action.localdata[0] = ++i;
- s_keys_inv_use_action.name = bindnames[s_keys_inv_use_action.localdata[0]][1];
+ s_keys_inv_use_action.localdata[0]= ++i;
+ s_keys_inv_use_action.name= bindnames[s_keys_inv_use_action.localdata[0]][1];
- s_keys_inv_drop_action.type = MTYPE_ACTION;
- s_keys_inv_drop_action.flags = QMF_GRAYED;
- s_keys_inv_drop_action.x = 0;
- s_keys_inv_drop_action.y = y += 9;
- s_keys_inv_drop_action.ownerdraw = new mcallback() {
+ s_keys_inv_drop_action.type= MTYPE_ACTION;
+ s_keys_inv_drop_action.flags= QMF_GRAYED;
+ s_keys_inv_drop_action.x= 0;
+ s_keys_inv_drop_action.y= y += 9;
+ s_keys_inv_drop_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_inv_drop_action.localdata[0] = ++i;
- s_keys_inv_drop_action.name = bindnames[s_keys_inv_drop_action.localdata[0]][1];
+ s_keys_inv_drop_action.localdata[0]= ++i;
+ s_keys_inv_drop_action.name= bindnames[s_keys_inv_drop_action.localdata[0]][1];
- s_keys_inv_prev_action.type = MTYPE_ACTION;
- s_keys_inv_prev_action.flags = QMF_GRAYED;
- s_keys_inv_prev_action.x = 0;
- s_keys_inv_prev_action.y = y += 9;
- s_keys_inv_prev_action.ownerdraw = new mcallback() {
+ s_keys_inv_prev_action.type= MTYPE_ACTION;
+ s_keys_inv_prev_action.flags= QMF_GRAYED;
+ s_keys_inv_prev_action.x= 0;
+ s_keys_inv_prev_action.y= y += 9;
+ s_keys_inv_prev_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_inv_prev_action.localdata[0] = ++i;
- s_keys_inv_prev_action.name = bindnames[s_keys_inv_prev_action.localdata[0]][1];
+ s_keys_inv_prev_action.localdata[0]= ++i;
+ s_keys_inv_prev_action.name= bindnames[s_keys_inv_prev_action.localdata[0]][1];
- s_keys_inv_next_action.type = MTYPE_ACTION;
- s_keys_inv_next_action.flags = QMF_GRAYED;
- s_keys_inv_next_action.x = 0;
- s_keys_inv_next_action.y = y += 9;
- s_keys_inv_next_action.ownerdraw = new mcallback() {
+ s_keys_inv_next_action.type= MTYPE_ACTION;
+ s_keys_inv_next_action.flags= QMF_GRAYED;
+ s_keys_inv_next_action.x= 0;
+ s_keys_inv_next_action.y= y += 9;
+ s_keys_inv_next_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_inv_next_action.localdata[0] = ++i;
- s_keys_inv_next_action.name = bindnames[s_keys_inv_next_action.localdata[0]][1];
+ s_keys_inv_next_action.localdata[0]= ++i;
+ s_keys_inv_next_action.name= bindnames[s_keys_inv_next_action.localdata[0]][1];
- s_keys_help_computer_action.type = MTYPE_ACTION;
- s_keys_help_computer_action.flags = QMF_GRAYED;
- s_keys_help_computer_action.x = 0;
- s_keys_help_computer_action.y = y += 9;
- s_keys_help_computer_action.ownerdraw = new mcallback() {
+ s_keys_help_computer_action.type= MTYPE_ACTION;
+ s_keys_help_computer_action.flags= QMF_GRAYED;
+ s_keys_help_computer_action.x= 0;
+ s_keys_help_computer_action.y= y += 9;
+ s_keys_help_computer_action.ownerdraw= new mcallback() {
public void execute(Object o) {
DrawKeyBindingFunc(o);
}
};
- s_keys_help_computer_action.localdata[0] = ++i;
- s_keys_help_computer_action.name = bindnames[s_keys_help_computer_action.localdata[0]][1];
+ s_keys_help_computer_action.localdata[0]= ++i;
+ s_keys_help_computer_action.name= bindnames[s_keys_help_computer_action.localdata[0]][1];
Menu_AddItem(s_keys_menu, s_keys_attack_action);
Menu_AddItem(s_keys_menu, s_keys_change_weapon_action);
@@ -1135,7 +1137,7 @@ public final class Menu extends Key {
Menu_Center(s_keys_menu);
}
- static xcommand_t Keys_MenuDraw = new xcommand_t() {
+ static xcommand_t Keys_MenuDraw= new xcommand_t() {
public void execute() {
Keys_MenuDraw_f();
}
@@ -1146,13 +1148,13 @@ public final class Menu extends Key {
Menu_Draw(s_keys_menu);
}
- static keyfunc_t Keys_MenuKey = new keyfunc_t() {
+ static keyfunc_t Keys_MenuKey= new keyfunc_t() {
public String execute(int key) {
return Keys_MenuKey_f(key);
}
};
static String Keys_MenuKey_f(int key) {
- menuaction_s item = (menuaction_s) Menu_ItemAtCursor(s_keys_menu);
+ menuaction_s item= (menuaction_s) Menu_ItemAtCursor(s_keys_menu);
if (bind_grab) {
if (key != K_ESCAPE && key != '`') {
@@ -1160,12 +1162,12 @@ public final class Menu extends Key {
String cmd;
//Com_sprintf(cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString(key), bindnames[item.localdata[0]][0]);
- cmd = "bind \"" + Key.KeynumToString(key) + "\" \"" + bindnames[item.localdata[0]][0] + "\"";
+ cmd= "bind \"" + Key.KeynumToString(key) + "\" \"" + bindnames[item.localdata[0]][0] + "\"";
Cbuf.InsertText(cmd);
}
Menu_SetStatusBar(s_keys_menu, "enter to change, backspace to clear");
- bind_grab = false;
+ bind_grab= false;
return menu_out_sound;
}
@@ -1184,7 +1186,7 @@ public final class Menu extends Key {
}
}
- static xcommand_t Menu_Keys = new xcommand_t() {
+ static xcommand_t Menu_Keys= new xcommand_t() {
public void execute() {
Menu_Keys_f();
}
@@ -1211,23 +1213,23 @@ public final class Menu extends Key {
*/
static cvar_t win_noalttab;
- static menuframework_s s_options_menu = new menuframework_s();
- static menuaction_s s_options_defaults_action = new menuaction_s();
- static menuaction_s s_options_customize_options_action = new menuaction_s();
- static menuslider_s s_options_sensitivity_slider = new menuslider_s();
- static menulist_s s_options_freelook_box = new menulist_s();
- static menulist_s s_options_noalttab_box = new menulist_s();
- static menulist_s s_options_alwaysrun_box = new menulist_s();
- static menulist_s s_options_invertmouse_box = new menulist_s();
- static menulist_s s_options_lookspring_box = new menulist_s();
- static menulist_s s_options_lookstrafe_box = new menulist_s();
- static menulist_s s_options_crosshair_box = new menulist_s();
- static menuslider_s s_options_sfxvolume_slider = new menuslider_s();
- 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 menuframework_s s_options_menu= new menuframework_s();
+ static menuaction_s s_options_defaults_action= new menuaction_s();
+ static menuaction_s s_options_customize_options_action= new menuaction_s();
+ static menuslider_s s_options_sensitivity_slider= new menuslider_s();
+ static menulist_s s_options_freelook_box= new menulist_s();
+ static menulist_s s_options_noalttab_box= new menulist_s();
+ static menulist_s s_options_alwaysrun_box= new menulist_s();
+ static menulist_s s_options_invertmouse_box= new menulist_s();
+ static menulist_s s_options_lookspring_box= new menulist_s();
+ static menulist_s s_options_lookstrafe_box= new menulist_s();
+ static menulist_s s_options_crosshair_box= new menulist_s();
+ static menuslider_s s_options_sfxvolume_slider= new menuslider_s();
+ 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 menuaction_s s_options_console_action = new menuaction_s();
+ static menuaction_s s_options_console_action= new menuaction_s();
static void CrosshairFunc(Object unused) {
Cvar.SetValue("crosshair", s_options_crosshair_box.curvalue);
@@ -1266,38 +1268,39 @@ 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_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"));
if ("joal".equals(Cvar.VariableString("s_impl"))) {
- s_options_quality_list.curvalue = 0;
- } else {
- s_options_quality_list.curvalue = 1;
+ s_options_quality_list.curvalue= 0;
}
-
- s_options_sensitivity_slider.curvalue = (sensitivity.value) * 2;
+ 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));
- s_options_alwaysrun_box.curvalue = (int) cl_run.value;
+ s_options_alwaysrun_box.curvalue= (int) cl_run.value;
- s_options_invertmouse_box.curvalue = m_pitch.value < 0 ? 1 : 0;
+ s_options_invertmouse_box.curvalue= m_pitch.value < 0 ? 1 : 0;
Cvar.SetValue("lookspring", ClampCvar(0, 1, lookspring.value));
- s_options_lookspring_box.curvalue = (int) lookspring.value;
+ s_options_lookspring_box.curvalue= (int) lookspring.value;
Cvar.SetValue("lookstrafe", ClampCvar(0, 1, lookstrafe.value));
- s_options_lookstrafe_box.curvalue = (int) lookstrafe.value;
+ s_options_lookstrafe_box.curvalue= (int) lookstrafe.value;
Cvar.SetValue("freelook", ClampCvar(0, 1, freelook.value));
- s_options_freelook_box.curvalue = (int) freelook.value;
+ s_options_freelook_box.curvalue= (int) freelook.value;
Cvar.SetValue("crosshair", ClampCvar(0, 3, Globals.crosshair.value));
- s_options_crosshair_box.curvalue = (int) Globals.crosshair.value;
+ s_options_crosshair_box.curvalue= (int) Globals.crosshair.value;
Cvar.SetValue("in_joystick", ClampCvar(0, 1, in_joystick.value));
- s_options_joystick_box.curvalue = (int) in_joystick.value;
+ s_options_joystick_box.curvalue= (int) in_joystick.value;
- s_options_noalttab_box.curvalue = (int) win_noalttab.value;
+ s_options_noalttab_box.curvalue= (int) win_noalttab.value;
}
static void ControlsResetDefaultsFunc(Object unused) {
@@ -1341,21 +1344,21 @@ public final class Menu extends Key {
Console.ClearNotify();
ForceMenuOff();
- cls.key_dest = key_console;
+ cls.key_dest= key_console;
}
static void UpdateSoundQualityFunc(Object unused) {
- boolean driverNotChanged = false;
+ boolean driverNotChanged= false;
if (s_options_quality_list.curvalue != 0) {
-// Cvar.SetValue("s_khz", 22);
-// Cvar.SetValue("s_loadas8bit", 0);
- driverNotChanged = S.getDriverName().equals("dummy");
+ // 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);
- driverNotChanged = S.getDriverName().equals("joal");
+ // Cvar.SetValue("s_khz", 11);
+ // Cvar.SetValue("s_loadas8bit", 1);
+ driverNotChanged= S.getDriverName().equals("joal");
Cvar.Set("s_impl", "joal");
}
@@ -1363,8 +1366,9 @@ public final class Menu extends Key {
if (driverNotChanged) {
re.EndFrame();
- return;
- } else {
+ return;
+ }
+ else {
DrawTextBox(8, 120 - 48, 36, 3);
Print(16 + 16, 120 - 48 + 8, "Restarting the sound system. This");
@@ -1373,159 +1377,158 @@ public final class Menu extends Key {
// 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 soundstate_items[] = { "on", "off", null };
+ static String cd_music_items[]= { "disabled", "enabled", null };
+ static String soundstate_items[]= { "on", "off", null };
- static String compatibility_items[] = { "max compatibility", "max performance", null };
+ static String compatibility_items[]= { "max compatibility", "max performance", null };
- static String yesno_names[] = { "no", "yes", null };
+ static String yesno_names[]= { "no", "yes", null };
- static String crosshair_names[] = { "none", "cross", "dot", "angle", null };
+ static String crosshair_names[]= { "none", "cross", "dot", "angle", null };
static void Options_MenuInit() {
- win_noalttab = Cvar.Get("win_noalttab", "0", CVAR_ARCHIVE);
+ win_noalttab= Cvar.Get("win_noalttab", "0", CVAR_ARCHIVE);
/*
** configure controls menu and menu items
*/
- s_options_menu.x = viddef.width / 2;
- s_options_menu.y = viddef.height / 2 - 58;
- s_options_menu.nitems = 0;
-
- s_options_sfxvolume_slider.type = MTYPE_SLIDER;
- s_options_sfxvolume_slider.x = 0;
- s_options_sfxvolume_slider.y = 0;
- s_options_sfxvolume_slider.name = "effects volume";
- s_options_sfxvolume_slider.callback = new mcallback() {
+ s_options_menu.x= viddef.width / 2;
+ s_options_menu.y= viddef.height / 2 - 58;
+ s_options_menu.nitems= 0;
+
+ s_options_sfxvolume_slider.type= MTYPE_SLIDER;
+ s_options_sfxvolume_slider.x= 0;
+ s_options_sfxvolume_slider.y= 0;
+ s_options_sfxvolume_slider.name= "effects volume";
+ s_options_sfxvolume_slider.callback= new mcallback() {
public void execute(Object o) {
UpdateVolumeFunc(o);
}
};
- s_options_sfxvolume_slider.minvalue = 0;
- s_options_sfxvolume_slider.maxvalue = 10;
- s_options_sfxvolume_slider.curvalue = Cvar.VariableValue("s_volume") * 10;
-
- s_options_cdvolume_box.type = MTYPE_SPINCONTROL;
- s_options_cdvolume_box.x = 0;
- s_options_cdvolume_box.y = 10;
- s_options_cdvolume_box.name = "CD music";
- s_options_cdvolume_box.callback = new mcallback() {
+ s_options_sfxvolume_slider.minvalue= 0;
+ s_options_sfxvolume_slider.maxvalue= 10;
+ s_options_sfxvolume_slider.curvalue= Cvar.VariableValue("s_volume") * 10;
+
+ s_options_cdvolume_box.type= MTYPE_SPINCONTROL;
+ s_options_cdvolume_box.x= 0;
+ s_options_cdvolume_box.y= 10;
+ s_options_cdvolume_box.name= "CD music";
+ s_options_cdvolume_box.callback= new mcallback() {
public void execute(Object o) {
UpdateCDVolumeFunc(o);
}
};
- s_options_cdvolume_box.itemnames = cd_music_items;
- s_options_cdvolume_box.curvalue = 1 - (int) Cvar.VariableValue("cd_nocd");
+ s_options_cdvolume_box.itemnames= cd_music_items;
+ s_options_cdvolume_box.curvalue= 1 - (int) Cvar.VariableValue("cd_nocd");
- s_options_quality_list.type = MTYPE_SPINCONTROL;
- s_options_quality_list.x = 0;
- s_options_quality_list.y = 20;
+ s_options_quality_list.type= MTYPE_SPINCONTROL;
+ s_options_quality_list.x= 0;
+ s_options_quality_list.y= 20;
;
- s_options_quality_list.name = "sound";
- s_options_quality_list.callback = new mcallback() {
+ 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 = soundstate_items;
+ 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;
- s_options_sensitivity_slider.y = 50;
- s_options_sensitivity_slider.name = "mouse speed";
- s_options_sensitivity_slider.callback = new mcallback() {
+ // 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;
+ s_options_sensitivity_slider.y= 50;
+ s_options_sensitivity_slider.name= "mouse speed";
+ s_options_sensitivity_slider.callback= new mcallback() {
public void execute(Object o) {
MouseSpeedFunc(o);
}
};
- s_options_sensitivity_slider.minvalue = 2;
- s_options_sensitivity_slider.maxvalue = 22;
-
- s_options_alwaysrun_box.type = MTYPE_SPINCONTROL;
- s_options_alwaysrun_box.x = 0;
- s_options_alwaysrun_box.y = 60;
- s_options_alwaysrun_box.name = "always run";
- s_options_alwaysrun_box.callback = new mcallback() {
+ s_options_sensitivity_slider.minvalue= 2;
+ s_options_sensitivity_slider.maxvalue= 22;
+
+ s_options_alwaysrun_box.type= MTYPE_SPINCONTROL;
+ s_options_alwaysrun_box.x= 0;
+ s_options_alwaysrun_box.y= 60;
+ s_options_alwaysrun_box.name= "always run";
+ s_options_alwaysrun_box.callback= new mcallback() {
public void execute(Object o) {
AlwaysRunFunc(o);
}
};
- s_options_alwaysrun_box.itemnames = yesno_names;
+ s_options_alwaysrun_box.itemnames= yesno_names;
- s_options_invertmouse_box.type = MTYPE_SPINCONTROL;
- s_options_invertmouse_box.x = 0;
- s_options_invertmouse_box.y = 70;
- s_options_invertmouse_box.name = "invert mouse";
- s_options_invertmouse_box.callback = new mcallback() {
+ s_options_invertmouse_box.type= MTYPE_SPINCONTROL;
+ s_options_invertmouse_box.x= 0;
+ s_options_invertmouse_box.y= 70;
+ s_options_invertmouse_box.name= "invert mouse";
+ s_options_invertmouse_box.callback= new mcallback() {
public void execute(Object o) {
InvertMouseFunc(o);
}
};
- s_options_invertmouse_box.itemnames = yesno_names;
+ s_options_invertmouse_box.itemnames= yesno_names;
- s_options_lookspring_box.type = MTYPE_SPINCONTROL;
- s_options_lookspring_box.x = 0;
- s_options_lookspring_box.y = 80;
- s_options_lookspring_box.name = "lookspring";
- s_options_lookspring_box.callback = new mcallback() {
+ s_options_lookspring_box.type= MTYPE_SPINCONTROL;
+ s_options_lookspring_box.x= 0;
+ s_options_lookspring_box.y= 80;
+ s_options_lookspring_box.name= "lookspring";
+ s_options_lookspring_box.callback= new mcallback() {
public void execute(Object o) {
LookspringFunc(o);
}
};
- s_options_lookspring_box.itemnames = yesno_names;
+ s_options_lookspring_box.itemnames= yesno_names;
- s_options_lookstrafe_box.type = MTYPE_SPINCONTROL;
- s_options_lookstrafe_box.x = 0;
- s_options_lookstrafe_box.y = 90;
- s_options_lookstrafe_box.name = "lookstrafe";
- s_options_lookstrafe_box.callback = new mcallback() {
+ s_options_lookstrafe_box.type= MTYPE_SPINCONTROL;
+ s_options_lookstrafe_box.x= 0;
+ s_options_lookstrafe_box.y= 90;
+ s_options_lookstrafe_box.name= "lookstrafe";
+ s_options_lookstrafe_box.callback= new mcallback() {
public void execute(Object o) {
LookstrafeFunc(o);
}
};
- s_options_lookstrafe_box.itemnames = yesno_names;
+ s_options_lookstrafe_box.itemnames= yesno_names;
- s_options_freelook_box.type = MTYPE_SPINCONTROL;
- s_options_freelook_box.x = 0;
- s_options_freelook_box.y = 100;
- s_options_freelook_box.name = "free look";
- s_options_freelook_box.callback = new mcallback() {
+ s_options_freelook_box.type= MTYPE_SPINCONTROL;
+ s_options_freelook_box.x= 0;
+ s_options_freelook_box.y= 100;
+ s_options_freelook_box.name= "free look";
+ s_options_freelook_box.callback= new mcallback() {
public void execute(Object o) {
FreeLookFunc(o);
}
};
- s_options_freelook_box.itemnames = yesno_names;
+ s_options_freelook_box.itemnames= yesno_names;
- s_options_crosshair_box.type = MTYPE_SPINCONTROL;
- s_options_crosshair_box.x = 0;
- s_options_crosshair_box.y = 110;
- s_options_crosshair_box.name = "crosshair";
- s_options_crosshair_box.callback = new mcallback() {
+ s_options_crosshair_box.type= MTYPE_SPINCONTROL;
+ s_options_crosshair_box.x= 0;
+ s_options_crosshair_box.y= 110;
+ s_options_crosshair_box.name= "crosshair";
+ s_options_crosshair_box.callback= new mcallback() {
public void execute(Object o) {
CrosshairFunc(o);
}
};
- s_options_crosshair_box.itemnames = crosshair_names;
+ s_options_crosshair_box.itemnames= crosshair_names;
/*
s_options_noalttab_box.type = MTYPE_SPINCONTROL;
s_options_noalttab_box.x = 0;
@@ -1534,42 +1537,42 @@ public final class Menu extends Key {
s_options_noalttab_box.callback = NoAltTabFunc;
s_options_noalttab_box.itemnames = yesno_names;
*/
- s_options_joystick_box.type = MTYPE_SPINCONTROL;
- s_options_joystick_box.x = 0;
- s_options_joystick_box.y = 120;
- s_options_joystick_box.name = "use joystick";
- s_options_joystick_box.callback = new mcallback() {
+ s_options_joystick_box.type= MTYPE_SPINCONTROL;
+ s_options_joystick_box.x= 0;
+ s_options_joystick_box.y= 120;
+ s_options_joystick_box.name= "use joystick";
+ s_options_joystick_box.callback= new mcallback() {
public void execute(Object o) {
JoystickFunc(o);
}
};
- s_options_joystick_box.itemnames = yesno_names;
+ s_options_joystick_box.itemnames= yesno_names;
- s_options_customize_options_action.type = MTYPE_ACTION;
- s_options_customize_options_action.x = 0;
- s_options_customize_options_action.y = 140;
- s_options_customize_options_action.name = "customize controls";
- s_options_customize_options_action.callback = new mcallback() {
+ s_options_customize_options_action.type= MTYPE_ACTION;
+ s_options_customize_options_action.x= 0;
+ s_options_customize_options_action.y= 140;
+ s_options_customize_options_action.name= "customize controls";
+ s_options_customize_options_action.callback= new mcallback() {
public void execute(Object o) {
CustomizeControlsFunc(o);
}
};
- s_options_defaults_action.type = MTYPE_ACTION;
- s_options_defaults_action.x = 0;
- s_options_defaults_action.y = 150;
- s_options_defaults_action.name = "reset defaults";
- s_options_defaults_action.callback = new mcallback() {
+ s_options_defaults_action.type= MTYPE_ACTION;
+ s_options_defaults_action.x= 0;
+ s_options_defaults_action.y= 150;
+ s_options_defaults_action.name= "reset defaults";
+ s_options_defaults_action.callback= new mcallback() {
public void execute(Object o) {
ControlsResetDefaultsFunc(o);
}
};
- s_options_console_action.type = MTYPE_ACTION;
- s_options_console_action.x = 0;
- s_options_console_action.y = 160;
- s_options_console_action.name = "go to console";
- s_options_console_action.callback = new mcallback() {
+ s_options_console_action.type= MTYPE_ACTION;
+ s_options_console_action.x= 0;
+ s_options_console_action.y= 160;
+ s_options_console_action.name= "go to console";
+ s_options_console_action.callback= new mcallback() {
public void execute(Object o) {
ConsoleFunc(o);
}
@@ -1581,7 +1584,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);
@@ -1589,7 +1592,7 @@ public final class Menu extends Key {
Menu_AddItem(s_options_menu, s_options_lookstrafe_box);
Menu_AddItem(s_options_menu, s_options_freelook_box);
Menu_AddItem(s_options_menu, s_options_crosshair_box);
-// Menu_AddItem(s_options_menu, s_options_joystick_box);
+ // Menu_AddItem(s_options_menu, s_options_joystick_box);
Menu_AddItem(s_options_menu, s_options_customize_options_action);
Menu_AddItem(s_options_menu, s_options_defaults_action);
Menu_AddItem(s_options_menu, s_options_console_action);
@@ -1605,7 +1608,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_options_menu, key);
}
- static xcommand_t Menu_Options = new xcommand_t() {
+ static xcommand_t Menu_Options= new xcommand_t() {
public void execute() {
Menu_Options_f();
}
@@ -1632,7 +1635,7 @@ public final class Menu extends Key {
=======================================================================
*/
- static xcommand_t Menu_Video = new xcommand_t() {
+ static xcommand_t Menu_Video= new xcommand_t() {
public void execute() {
Menu_Video_f();
}
@@ -1660,9 +1663,9 @@ public final class Menu extends Key {
*/
static int credits_start_time;
- static String creditsIndex[] = new String[256];
+ static String creditsIndex[]= new String[256];
static String creditsBuffer;
- static String idcredits[] =
+ static String idcredits[]=
{
"+QUAKE II BY ID SOFTWARE",
"",
@@ -1675,7 +1678,7 @@ public final class Menu extends Key {
"CWEI",
"HOZ",
"RST",
- "",
+ "",
"+ART",
"Adrian Carmack",
"Kevin Cloud",
@@ -1756,8 +1759,8 @@ public final class Menu extends Key {
"other trademarks and trade names are",
"properties of their respective owners.",
null };
- static String credits[] = idcredits;
- static String xatcredits[] =
+ static String credits[]= idcredits;
+ static String xatcredits[]=
{
"+QUAKE II MISSION PACK: THE RECKONING",
"+BY",
@@ -1897,7 +1900,7 @@ public final class Menu extends Key {
"respective owners.",
null };
- static String roguecredits[] =
+ static String roguecredits[]=
{
"+QUAKE II MISSION PACK 2: GROUND ZERO",
"+BY",
@@ -2016,28 +2019,28 @@ public final class Menu extends Key {
/*
** draw the credits
*/
- for (i = 0, y = (int) (viddef.height - ((cls.realtime - credits_start_time) / 40.0F));
+ for (i= 0, y= (int) (viddef.height - ((cls.realtime - credits_start_time) / 40.0F));
credits[i] != null && y < viddef.height;
y += 10, i++) {
- int j, stringoffset = 0;
- boolean bold = false;
+ int j, stringoffset= 0;
+ boolean bold= false;
if (y <= -8)
continue;
if (credits[i].length() > 0 && credits[i].charAt(0) == '+') {
- bold = true;
- stringoffset = 1;
+ bold= true;
+ stringoffset= 1;
}
else {
- bold = false;
- stringoffset = 0;
+ bold= false;
+ stringoffset= 0;
}
- for (j = 0; j + stringoffset < credits[i].length(); j++) {
+ for (j= 0; j + stringoffset < credits[i].length(); j++) {
int x;
- x = (viddef.width - credits[i].length() * 8 - stringoffset * 8) / 2 + (j + stringoffset) * 8;
+ x= (viddef.width - credits[i].length() * 8 - stringoffset * 8) / 2 + (j + stringoffset) * 8;
if (bold)
re.DrawChar(x, y, credits[i].charAt(j + stringoffset) + 128);
@@ -2047,7 +2050,7 @@ public final class Menu extends Key {
}
if (y < 0)
- credits_start_time = cls.realtime;
+ credits_start_time= cls.realtime;
}
public static String Credits_Key(int key) {
@@ -2064,42 +2067,42 @@ public final class Menu extends Key {
}
- static xcommand_t Menu_Credits = new xcommand_t() {
+ static xcommand_t Menu_Credits= new xcommand_t() {
public void execute() {
Menu_Credits_f();
}
};
static void Menu_Credits_f() {
int n;
- int isdeveloper = 0;
+ int isdeveloper= 0;
- byte b[] = FS.LoadFile("credits");
+ byte b[]= FS.LoadFile("credits");
if (b != null) {
- creditsBuffer = new String(b);
- String line[] = Lib.linesplit(creditsBuffer);
+ creditsBuffer= new String(b);
+ String line[]= Lib.linesplit(creditsBuffer);
- for (n = 0; n < line.length; n++) {
- creditsIndex[n] = line[n];
+ for (n= 0; n < line.length; n++) {
+ creditsIndex[n]= line[n];
}
- creditsIndex[n] = null;
- credits = creditsIndex;
+ creditsIndex[n]= null;
+ credits= creditsIndex;
}
else {
- isdeveloper = FS.Developer_searchpath(1);
+ isdeveloper= FS.Developer_searchpath(1);
if (isdeveloper == 1) // xatrix
- credits = xatcredits;
+ credits= xatcredits;
else if (isdeveloper == 2) // ROGUE
- credits = roguecredits;
+ credits= roguecredits;
else {
- credits = idcredits;
+ credits= idcredits;
}
}
- credits_start_time = cls.realtime;
+ credits_start_time= cls.realtime;
PushMenu(new xcommand_t() {
public void execute() {
Credits_MenuDraw();
@@ -2121,18 +2124,18 @@ public final class Menu extends Key {
static int m_game_cursor;
- static menuframework_s s_game_menu = new menuframework_s();
- static menuaction_s s_easy_game_action = new menuaction_s();
- static menuaction_s s_medium_game_action = new menuaction_s();
- static menuaction_s s_hard_game_action = new menuaction_s();
- static menuaction_s s_load_game_action = new menuaction_s();
- static menuaction_s s_save_game_action = new menuaction_s();
- static menuaction_s s_credits_action = new menuaction_s();
- static menuseparator_s s_blankline = new menuseparator_s();
+ static menuframework_s s_game_menu= new menuframework_s();
+ static menuaction_s s_easy_game_action= new menuaction_s();
+ static menuaction_s s_medium_game_action= new menuaction_s();
+ static menuaction_s s_hard_game_action= new menuaction_s();
+ static menuaction_s s_load_game_action= new menuaction_s();
+ static menuaction_s s_save_game_action= new menuaction_s();
+ static menuaction_s s_credits_action= new menuaction_s();
+ static menuseparator_s s_blankline= new menuseparator_s();
static void StartGame() {
// disable updates and start the cinematic going
- cl.servercount = -1;
+ cl.servercount= -1;
ForceMenuOff();
Cvar.SetValue("deathmatch", 0);
Cvar.SetValue("coop", 0);
@@ -2140,7 +2143,7 @@ public final class Menu extends Key {
Cvar.SetValue("gamerules", 0); //PGM
Cbuf.AddText("loading ; killserver ; wait ; newgame\n");
- cls.key_dest = key_game;
+ cls.key_dest= key_game;
}
static void EasyGameFunc(Object data) {
@@ -2170,75 +2173,75 @@ public final class Menu extends Key {
Menu_Credits_f();
}
- static String difficulty_names[] = { "easy", "medium", "fuckin shitty hard", null };
+ static String difficulty_names[]= { "easy", "medium", "fuckin shitty hard", null };
static void Game_MenuInit() {
- s_game_menu.x = (int) (viddef.width * 0.50);
- s_game_menu.nitems = 0;
+ s_game_menu.x= (int) (viddef.width * 0.50);
+ s_game_menu.nitems= 0;
- s_easy_game_action.type = MTYPE_ACTION;
- s_easy_game_action.flags = QMF_LEFT_JUSTIFY;
- s_easy_game_action.x = 0;
- s_easy_game_action.y = 0;
- s_easy_game_action.name = "easy";
- s_easy_game_action.callback = new mcallback() {
+ s_easy_game_action.type= MTYPE_ACTION;
+ s_easy_game_action.flags= QMF_LEFT_JUSTIFY;
+ s_easy_game_action.x= 0;
+ s_easy_game_action.y= 0;
+ s_easy_game_action.name= "easy";
+ s_easy_game_action.callback= new mcallback() {
public void execute(Object o) {
EasyGameFunc(o);
}
};
- s_medium_game_action.type = MTYPE_ACTION;
- s_medium_game_action.flags = QMF_LEFT_JUSTIFY;
- s_medium_game_action.x = 0;
- s_medium_game_action.y = 10;
- s_medium_game_action.name = "medium";
- s_medium_game_action.callback = new mcallback() {
+ s_medium_game_action.type= MTYPE_ACTION;
+ s_medium_game_action.flags= QMF_LEFT_JUSTIFY;
+ s_medium_game_action.x= 0;
+ s_medium_game_action.y= 10;
+ s_medium_game_action.name= "medium";
+ s_medium_game_action.callback= new mcallback() {
public void execute(Object o) {
MediumGameFunc(o);
}
};
- s_hard_game_action.type = MTYPE_ACTION;
- s_hard_game_action.flags = QMF_LEFT_JUSTIFY;
- s_hard_game_action.x = 0;
- s_hard_game_action.y = 20;
- s_hard_game_action.name = "hard";
- s_hard_game_action.callback = new mcallback() {
+ s_hard_game_action.type= MTYPE_ACTION;
+ s_hard_game_action.flags= QMF_LEFT_JUSTIFY;
+ s_hard_game_action.x= 0;
+ s_hard_game_action.y= 20;
+ s_hard_game_action.name= "hard";
+ s_hard_game_action.callback= new mcallback() {
public void execute(Object o) {
HardGameFunc(o);
}
};
- s_blankline.type = MTYPE_SEPARATOR;
+ s_blankline.type= MTYPE_SEPARATOR;
- s_load_game_action.type = MTYPE_ACTION;
- s_load_game_action.flags = QMF_LEFT_JUSTIFY;
- s_load_game_action.x = 0;
- s_load_game_action.y = 40;
- s_load_game_action.name = "load game";
- s_load_game_action.callback = new mcallback() {
+ s_load_game_action.type= MTYPE_ACTION;
+ s_load_game_action.flags= QMF_LEFT_JUSTIFY;
+ s_load_game_action.x= 0;
+ s_load_game_action.y= 40;
+ s_load_game_action.name= "load game";
+ s_load_game_action.callback= new mcallback() {
public void execute(Object o) {
LoadGameFunc(o);
}
};
- s_save_game_action.type = MTYPE_ACTION;
- s_save_game_action.flags = QMF_LEFT_JUSTIFY;
- s_save_game_action.x = 0;
- s_save_game_action.y = 50;
- s_save_game_action.name = "save game";
- s_save_game_action.callback = new mcallback() {
+ s_save_game_action.type= MTYPE_ACTION;
+ s_save_game_action.flags= QMF_LEFT_JUSTIFY;
+ s_save_game_action.x= 0;
+ s_save_game_action.y= 50;
+ s_save_game_action.name= "save game";
+ s_save_game_action.callback= new mcallback() {
public void execute(Object o) {
SaveGameFunc(o);
}
};
- s_credits_action.type = MTYPE_ACTION;
- s_credits_action.flags = QMF_LEFT_JUSTIFY;
- s_credits_action.x = 0;
- s_credits_action.y = 60;
- s_credits_action.name = "credits";
- s_credits_action.callback = new mcallback() {
+ s_credits_action.type= MTYPE_ACTION;
+ s_credits_action.flags= QMF_LEFT_JUSTIFY;
+ s_credits_action.x= 0;
+ s_credits_action.y= 60;
+ s_credits_action.name= "credits";
+ s_credits_action.callback= new mcallback() {
public void execute(Object o) {
CreditsFunc(o);
}
@@ -2266,7 +2269,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_game_menu, key);
}
- static xcommand_t Menu_Game = new xcommand_t() {
+ static xcommand_t Menu_Game= new xcommand_t() {
public void execute() {
Menu_Game_f();
}
@@ -2283,7 +2286,7 @@ public final class Menu extends Key {
return Game_MenuKey(key);
}
});
- m_game_cursor = 1;
+ m_game_cursor= 1;
}
/*
@@ -2294,51 +2297,62 @@ public final class Menu extends Key {
=============================================================================
*/
- public final static int MAX_SAVEGAMES = 15;
+ public final static int MAX_SAVEGAMES= 15;
- static menuframework_s s_savegame_menu = new menuframework_s();
- static menuframework_s s_loadgame_menu = new menuframework_s();
+ static menuframework_s s_savegame_menu= new menuframework_s();
+ static menuframework_s s_loadgame_menu= new menuframework_s();
- static menuaction_s s_loadgame_actions[] = new menuaction_s[MAX_SAVEGAMES];
+ static menuaction_s s_loadgame_actions[]= new menuaction_s[MAX_SAVEGAMES];
static {
- for (int n = 0; n < MAX_SAVEGAMES; n++)
- s_loadgame_actions[n] = new menuaction_s();
+ for (int n= 0; n < MAX_SAVEGAMES; n++)
+ s_loadgame_actions[n]= new menuaction_s();
}
//String m_savestrings[] = new String [MAX_SAVEGAMES][32];
- static String m_savestrings[] = new String[MAX_SAVEGAMES];
+ static String m_savestrings[]= new String[MAX_SAVEGAMES];
static {
- for (int n = 0; n < MAX_SAVEGAMES; n++)
- m_savestrings[n] = "";
+ for (int n= 0; n < MAX_SAVEGAMES; n++)
+ m_savestrings[n]= "";
}
- static boolean m_savevalid[] = new boolean[MAX_SAVEGAMES];
+ static boolean m_savevalid[]= new boolean[MAX_SAVEGAMES];
+ /** Search the save dir for saved games and their names. */
static void Create_Savestrings() {
int i;
- RandomAccessFile f;
- //char name[MAX_OSPATH];
+ QuakeFile f;
String name;
- for (i = 0; i < MAX_SAVEGAMES; i++) {
- name = FS.Gamedir() + "/save/save" + i + "/server.ssv";
- f = fopen(name, "r");
- if (f == null) {
- m_savestrings[i] = "<EMPTY>";
- m_savevalid[i] = false;
- }
- else {
- m_savestrings[i] = freadString(f, 32);
- fclose(f);
- m_savevalid[i] = true;
+ for (i= 0; i < MAX_SAVEGAMES; i++) {
+
+ m_savestrings[i]= "<EMPTY>";
+ name= FS.Gamedir() + "/save/save" + i + "/server.ssv";
+
+ try {
+ f= new QuakeFile(name, "r");
+ if (f == null) {
+ m_savestrings[i]= "<EMPTY>";
+ m_savevalid[i]= false;
+ }
+ else {
+ String str= f.readString();
+ if (str != null)
+ m_savestrings[i]= str;
+ f.close();
+ m_savevalid[i]= true;
+ }
}
+ catch (Exception e) {
+ m_savestrings[i]= "<EMPTY>";
+ m_savevalid[i]= false;
+ };
}
}
static void LoadGameCallback(Object self) {
- menuaction_s a = (menuaction_s) self;
+ menuaction_s a= (menuaction_s) self;
if (m_savevalid[a.localdata[0]])
Cbuf.AddText("load save" + a.localdata[0] + "\n");
@@ -2348,28 +2362,28 @@ 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.nitems = 0;
+ s_loadgame_menu.x= viddef.width / 2 - 120;
+ s_loadgame_menu.y= viddef.height / 2 - 58;
+ s_loadgame_menu.nitems= 0;
Create_Savestrings();
- for (i = 0; i < MAX_SAVEGAMES; i++) {
- s_loadgame_actions[i].name = m_savestrings[i];
- s_loadgame_actions[i].flags = QMF_LEFT_JUSTIFY;
- s_loadgame_actions[i].localdata[0] = i;
- s_loadgame_actions[i].callback = new mcallback() {
+ for (i= 0; i < MAX_SAVEGAMES; i++) {
+ s_loadgame_actions[i].name= m_savestrings[i];
+ s_loadgame_actions[i].flags= QMF_LEFT_JUSTIFY;
+ s_loadgame_actions[i].localdata[0]= i;
+ s_loadgame_actions[i].callback= new mcallback() {
public void execute(Object o) {
LoadGameCallback(o);
}
};
- s_loadgame_actions[i].x = 0;
- s_loadgame_actions[i].y = (i) * 10;
+ s_loadgame_actions[i].x= 0;
+ s_loadgame_actions[i].y= (i) * 10;
if (i > 0) // separate from autosave
s_loadgame_actions[i].y += 10;
- s_loadgame_actions[i].type = MTYPE_ACTION;
+ s_loadgame_actions[i].type= MTYPE_ACTION;
Menu_AddItem(s_loadgame_menu, s_loadgame_actions[i]);
}
@@ -2383,14 +2397,14 @@ public final class Menu extends Key {
static String LoadGame_MenuKey(int key) {
if (key == K_ESCAPE || key == K_ENTER) {
- s_savegame_menu.cursor = s_loadgame_menu.cursor - 1;
+ s_savegame_menu.cursor= s_loadgame_menu.cursor - 1;
if (s_savegame_menu.cursor < 0)
- s_savegame_menu.cursor = 0;
+ s_savegame_menu.cursor= 0;
}
return Default_MenuKey(s_loadgame_menu, key);
}
- static xcommand_t Menu_LoadGame = new xcommand_t() {
+ static xcommand_t Menu_LoadGame= new xcommand_t() {
public void execute() {
Menu_LoadGame_f();
}
@@ -2416,10 +2430,16 @@ public final class Menu extends Key {
=============================================================================
*/
//static menuframework_s s_savegame_menu;
- static menuaction_s s_savegame_actions[] = new menuaction_s[MAX_SAVEGAMES];
+ static menuaction_s s_savegame_actions[]= new menuaction_s[MAX_SAVEGAMES];
+
+ static {
+ for (int n= 0; n < MAX_SAVEGAMES; n++)
+ s_savegame_actions[n]= new menuaction_s();
+
+ }
static void SaveGameCallback(Object self) {
- menuaction_s a = (menuaction_s) self;
+ menuaction_s a= (menuaction_s) self;
Cbuf.AddText("save save" + a.localdata[0] + "\n");
ForceMenuOff();
@@ -2434,27 +2454,27 @@ 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.nitems = 0;
+ s_savegame_menu.x= viddef.width / 2 - 120;
+ s_savegame_menu.y= viddef.height / 2 - 58;
+ s_savegame_menu.nitems= 0;
Create_Savestrings();
// don't include the autosave slot
- for (i = 0; i < MAX_SAVEGAMES - 1; i++) {
- s_savegame_actions[i].name = m_savestrings[i + 1];
- s_savegame_actions[i].localdata[0] = i + 1;
- s_savegame_actions[i].flags = QMF_LEFT_JUSTIFY;
- s_savegame_actions[i].callback = new mcallback() {
+ for (i= 0; i < MAX_SAVEGAMES - 1; i++) {
+ s_savegame_actions[i].name= m_savestrings[i + 1];
+ s_savegame_actions[i].localdata[0]= i + 1;
+ s_savegame_actions[i].flags= QMF_LEFT_JUSTIFY;
+ s_savegame_actions[i].callback= new mcallback() {
public void execute(Object o) {
SaveGameCallback(o);
}
};
- s_savegame_actions[i].x = 0;
- s_savegame_actions[i].y = (i) * 10;
+ s_savegame_actions[i].x= 0;
+ s_savegame_actions[i].y= (i) * 10;
- s_savegame_actions[i].type = MTYPE_ACTION;
+ s_savegame_actions[i].type= MTYPE_ACTION;
Menu_AddItem(s_savegame_menu, s_savegame_actions[i]);
}
@@ -2462,18 +2482,19 @@ public final class Menu extends Key {
static String SaveGame_MenuKey(int key) {
if (key == K_ENTER || key == K_ESCAPE) {
- s_loadgame_menu.cursor = s_savegame_menu.cursor - 1;
+ s_loadgame_menu.cursor= s_savegame_menu.cursor - 1;
if (s_loadgame_menu.cursor < 0)
- s_loadgame_menu.cursor = 0;
+ s_loadgame_menu.cursor= 0;
}
return Default_MenuKey(s_savegame_menu, key);
}
- static xcommand_t Menu_SaveGame = new xcommand_t() {
+ static xcommand_t Menu_SaveGame= new xcommand_t() {
public void execute() {
Menu_SaveGame_f();
}
};
+
static void Menu_SaveGame_f() {
if (0 == Globals.server_state)
return; // not playing a game
@@ -2499,23 +2520,23 @@ public final class Menu extends Key {
=============================================================================
*/
- static menuframework_s s_joinserver_menu = new menuframework_s();
- static menuseparator_s s_joinserver_server_title = new menuseparator_s();
- static menuaction_s s_joinserver_search_action = new menuaction_s();
- static menuaction_s s_joinserver_address_book_action = new menuaction_s();
+ static menuframework_s s_joinserver_menu= new menuframework_s();
+ static menuseparator_s s_joinserver_server_title= new menuseparator_s();
+ static menuaction_s s_joinserver_search_action= new menuaction_s();
+ static menuaction_s s_joinserver_address_book_action= new menuaction_s();
- static netadr_t local_server_netadr[] = new netadr_t[MAX_LOCAL_SERVERS];
- static String local_server_names[] = new String[MAX_LOCAL_SERVERS]; //[80];
- static menuaction_s s_joinserver_server_actions[] = new menuaction_s[MAX_LOCAL_SERVERS];
+ static netadr_t local_server_netadr[]= new netadr_t[MAX_LOCAL_SERVERS];
+ static String local_server_names[]= new String[MAX_LOCAL_SERVERS]; //[80];
+ static menuaction_s s_joinserver_server_actions[]= new menuaction_s[MAX_LOCAL_SERVERS];
// user readable information
// network address
static {
- for (int n = 0; n < MAX_LOCAL_SERVERS; n++) {
- local_server_netadr[n] = new netadr_t();
- local_server_names[n] = "";
- s_joinserver_server_actions[n] = new menuaction_s();
- s_joinserver_server_actions[n].n = n;
+ for (int n= 0; n < MAX_LOCAL_SERVERS; n++) {
+ local_server_netadr[n]= new netadr_t();
+ local_server_names[n]= "";
+ s_joinserver_server_actions[n]= new menuaction_s();
+ s_joinserver_server_actions[n].n= n;
}
}
@@ -2527,15 +2548,16 @@ public final class Menu extends Key {
if (m_num_servers == MAX_LOCAL_SERVERS)
return;
- String x = info.trim();
+ String x= info.trim();
// ignore if duplicated
- for (i = 0; i < m_num_servers; i++)
+
+ for (i= 0; i < m_num_servers; i++)
if (x.equals(local_server_names[i]))
return;
- local_server_netadr[m_num_servers] = adr;
- local_server_names[m_num_servers] = x;
+ local_server_netadr[m_num_servers]= adr;
+ local_server_names[m_num_servers]= x;
m_num_servers++;
}
@@ -2543,7 +2565,7 @@ public final class Menu extends Key {
String buffer;
int index;
- index = ((menucommon_s) self).n;
+ index= ((menucommon_s) self).n;
if (Q_stricmp(local_server_names[index], NO_SERVER_STRING) == 0)
return;
@@ -2551,7 +2573,7 @@ public final class Menu extends Key {
if (index >= m_num_servers)
return;
- buffer = "connect " + NET.AdrToString(local_server_netadr[index]) + "\n";
+ buffer= "connect " + NET.AdrToString(local_server_netadr[index]) + "\n";
Cbuf.AddText(buffer);
ForceMenuOff();
}
@@ -2566,9 +2588,9 @@ public final class Menu extends Key {
static void SearchLocalGames() {
int i;
- m_num_servers = 0;
- for (i = 0; i < MAX_LOCAL_SERVERS; i++)
- local_server_names[i] = NO_SERVER_STRING;
+ m_num_servers= 0;
+ for (i= 0; i < MAX_LOCAL_SERVERS; i++)
+ local_server_names[i]= NO_SERVER_STRING;
DrawTextBox(8, 120 - 48, 36, 3);
Print(16 + 16, 120 - 48 + 8, "Searching for local servers, this");
@@ -2589,57 +2611,57 @@ 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.nitems = 0;
+ s_joinserver_menu.x= (int) (viddef.width * 0.50 - 120);
+ s_joinserver_menu.nitems= 0;
- s_joinserver_address_book_action.type = MTYPE_ACTION;
- s_joinserver_address_book_action.name = "address book";
- s_joinserver_address_book_action.flags = QMF_LEFT_JUSTIFY;
- s_joinserver_address_book_action.x = 0;
- s_joinserver_address_book_action.y = 0;
- s_joinserver_address_book_action.callback = new mcallback() {
+ s_joinserver_address_book_action.type= MTYPE_ACTION;
+ s_joinserver_address_book_action.name= "address book";
+ s_joinserver_address_book_action.flags= QMF_LEFT_JUSTIFY;
+ s_joinserver_address_book_action.x= 0;
+ s_joinserver_address_book_action.y= 0;
+ s_joinserver_address_book_action.callback= new mcallback() {
public void execute(Object o) {
AddressBookFunc(o);
}
};
- s_joinserver_search_action.type = MTYPE_ACTION;
- s_joinserver_search_action.name = "refresh server list";
- s_joinserver_search_action.flags = QMF_LEFT_JUSTIFY;
- s_joinserver_search_action.x = 0;
- s_joinserver_search_action.y = 10;
- s_joinserver_search_action.callback = new mcallback() {
+ s_joinserver_search_action.type= MTYPE_ACTION;
+ s_joinserver_search_action.name= "refresh server list";
+ s_joinserver_search_action.flags= QMF_LEFT_JUSTIFY;
+ s_joinserver_search_action.x= 0;
+ s_joinserver_search_action.y= 10;
+ s_joinserver_search_action.callback= new mcallback() {
public void execute(Object o) {
SearchLocalGamesFunc(o);
}
};
- s_joinserver_search_action.statusbar = "search for servers";
-
- s_joinserver_server_title.type = MTYPE_SEPARATOR;
- s_joinserver_server_title.name = "connect to...";
- s_joinserver_server_title.x = 80;
- s_joinserver_server_title.y = 30;
-
- for (i = 0; i < MAX_LOCAL_SERVERS; i++) {
- s_joinserver_server_actions[i].type = MTYPE_ACTION;
- local_server_names[i] = NO_SERVER_STRING;
- s_joinserver_server_actions[i].name = local_server_names[i];
- s_joinserver_server_actions[i].flags = QMF_LEFT_JUSTIFY;
- s_joinserver_server_actions[i].x = 0;
- s_joinserver_server_actions[i].y = 40 + i * 10;
- s_joinserver_server_actions[i].callback = new mcallback() {
+ s_joinserver_search_action.statusbar= "search for servers";
+
+ s_joinserver_server_title.type= MTYPE_SEPARATOR;
+ s_joinserver_server_title.name= "connect to...";
+ s_joinserver_server_title.x= 80;
+ s_joinserver_server_title.y= 30;
+
+ for (i= 0; i < MAX_LOCAL_SERVERS; i++) {
+ s_joinserver_server_actions[i].type= MTYPE_ACTION;
+ local_server_names[i]= NO_SERVER_STRING;
+ s_joinserver_server_actions[i].name= local_server_names[i];
+ s_joinserver_server_actions[i].flags= QMF_LEFT_JUSTIFY;
+ s_joinserver_server_actions[i].x= 0;
+ s_joinserver_server_actions[i].y= 40 + i * 10;
+ s_joinserver_server_actions[i].callback= new mcallback() {
public void execute(Object o) {
JoinServerFunc(o);
}
};
- s_joinserver_server_actions[i].statusbar = "press ENTER to connect";
+ s_joinserver_server_actions[i].statusbar= "press ENTER to connect";
}
Menu_AddItem(s_joinserver_menu, s_joinserver_address_book_action);
Menu_AddItem(s_joinserver_menu, s_joinserver_server_title);
Menu_AddItem(s_joinserver_menu, s_joinserver_search_action);
- for (i = 0; i < 8; i++)
+ for (i= 0; i < 8; i++)
Menu_AddItem(s_joinserver_menu, s_joinserver_server_actions[i]);
Menu_Center(s_joinserver_menu);
@@ -2656,7 +2678,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_joinserver_menu, key);
}
- static xcommand_t Menu_JoinServer = new xcommand_t() {
+ static xcommand_t Menu_JoinServer= new xcommand_t() {
public void execute() {
Menu_JoinServer_f();
}
@@ -2681,18 +2703,18 @@ public final class Menu extends Key {
=============================================================================
*/
- static menuframework_s s_startserver_menu = new menuframework_s();
+ static menuframework_s s_startserver_menu= new menuframework_s();
static String mapnames[];
static int nummaps;
- static menuaction_s s_startserver_start_action = new menuaction_s();
- static menuaction_s s_startserver_dmoptions_action = new menuaction_s();
- static menufield_s s_timelimit_field = new menufield_s();
- static menufield_s s_fraglimit_field = new menufield_s();
- static menufield_s s_maxclients_field = new menufield_s();
- static menufield_s s_hostname_field = new menufield_s();
- static menulist_s s_startmap_list = new menulist_s();
- static menulist_s s_rules_box = new menulist_s();
+ static menuaction_s s_startserver_start_action= new menuaction_s();
+ static menuaction_s s_startserver_dmoptions_action= new menuaction_s();
+ static menufield_s s_timelimit_field= new menufield_s();
+ static menufield_s s_fraglimit_field= new menufield_s();
+ static menufield_s s_maxclients_field= new menufield_s();
+ static menufield_s s_hostname_field= new menufield_s();
+ static menulist_s s_startmap_list= new menulist_s();
+ static menulist_s s_rules_box= new menulist_s();
static void DMOptionsFunc(Object self) {
if (s_rules_box.curvalue == 1)
@@ -2703,16 +2725,16 @@ public final class Menu extends Key {
static void RulesChangeFunc(Object self) {
// DM
if (s_rules_box.curvalue == 0) {
- s_maxclients_field.statusbar = null;
- s_startserver_dmoptions_action.statusbar = null;
+ s_maxclients_field.statusbar= null;
+ s_startserver_dmoptions_action.statusbar= null;
}
else if (s_rules_box.curvalue == 1)
// coop // PGM
{
- s_maxclients_field.statusbar = "4 maximum for cooperative";
+ s_maxclients_field.statusbar= "4 maximum for cooperative";
if (atoi(s_maxclients_field.buffer.toString()) > 4)
- s_maxclients_field.buffer = new StringBuffer("4");
- s_startserver_dmoptions_action.statusbar = "N/A for cooperative";
+ s_maxclients_field.buffer= new StringBuffer("4");
+ s_startserver_dmoptions_action.statusbar= "N/A for cooperative";
}
// =====
// PGM
@@ -2720,8 +2742,8 @@ public final class Menu extends Key {
else if (FS.Developer_searchpath(2) == 2) {
if (s_rules_box.curvalue == 2) // tag
{
- s_maxclients_field.statusbar = null;
- s_startserver_dmoptions_action.statusbar = null;
+ s_maxclients_field.statusbar= null;
+ s_startserver_dmoptions_action.statusbar= null;
}
/*
else if(s_rules_box.curvalue == 3) // deathball
@@ -2744,17 +2766,17 @@ public final class Menu extends Key {
String spot;
//strcpy(startmap, strchr(mapnames[s_startmap_list.curvalue], '\n') + 1);
- String x = mapnames[s_startmap_list.curvalue];
+ String x= mapnames[s_startmap_list.curvalue];
- int pos = x.indexOf('\n');
+ int pos= x.indexOf('\n');
if (pos == -1)
- startmap = x;
+ startmap= x;
else
- startmap = x.substring(pos + 1, x.length());
+ startmap= x.substring(pos + 1, x.length());
- maxclients = atoi(s_maxclients_field.buffer.toString());
- timelimit = atoi(s_timelimit_field.buffer.toString());
- fraglimit = atoi(s_fraglimit_field.buffer.toString());
+ maxclients= atoi(s_maxclients_field.buffer.toString());
+ timelimit= atoi(s_timelimit_field.buffer.toString());
+ fraglimit= atoi(s_fraglimit_field.buffer.toString());
Cvar.SetValue("maxclients", ClampCvar(0, maxclients, maxclients));
Cvar.SetValue("timelimit", ClampCvar(0, timelimit, timelimit));
@@ -2778,25 +2800,25 @@ public final class Menu extends Key {
}
// PGM
- spot = null;
+ spot= null;
if (s_rules_box.curvalue == 1) // PGM
{
if (Q_stricmp(startmap, "bunk1") == 0)
- spot = "start";
+ spot= "start";
else if (Q_stricmp(startmap, "mintro") == 0)
- spot = "start";
+ spot= "start";
else if (Q_stricmp(startmap, "fact1") == 0)
- spot = "start";
+ spot= "start";
else if (Q_stricmp(startmap, "power1") == 0)
- spot = "pstart";
+ spot= "pstart";
else if (Q_stricmp(startmap, "biggun") == 0)
- spot = "bstart";
+ spot= "bstart";
else if (Q_stricmp(startmap, "hangar1") == 0)
- spot = "unitstart";
+ spot= "unitstart";
else if (Q_stricmp(startmap, "city1") == 0)
- spot = "unitstart";
+ spot= "unitstart";
else if (Q_stricmp(startmap, "boss1") == 0)
- spot = "bosstart";
+ spot= "bosstart";
}
if (spot != null) {
@@ -2811,8 +2833,8 @@ public final class Menu extends Key {
ForceMenuOff();
}
- static String dm_coop_names[] = { "deathmatch", "cooperative", null };
- static String dm_coop_names_rogue[] = { "deathmatch", "cooperative", "tag",
+ static String dm_coop_names[]= { "deathmatch", "cooperative", null };
+ static String dm_coop_names_rogue[]= { "deathmatch", "cooperative", "tag",
// "deathball",
null };
@@ -2821,8 +2843,8 @@ public final class Menu extends Key {
// =======
// PGM
// =======
-
- byte[] buffer = null;
+
+ byte[] buffer= null;
String mapsname;
String s;
int i;
@@ -2831,18 +2853,18 @@ public final class Menu extends Key {
/*
** load the list of map names
*/
- mapsname = FS.Gamedir() + "/maps.lst";
+ mapsname= FS.Gamedir() + "/maps.lst";
- if ((fp = fopen(mapsname, "r")) == null) {
- buffer = FS.LoadFile("maps.lst");
+ if ((fp= fopen(mapsname, "r")) == null) {
+ buffer= FS.LoadFile("maps.lst");
if (buffer == null)
//if ((length = FS_LoadFile("maps.lst", (Object *) & buffer)) == -1)
Com.Error(ERR_DROP, "couldn't find maps.lst\n");
}
else {
try {
- int len = (int) fp.length();
- buffer = new byte[len];
+ int len= (int) fp.length();
+ buffer= new byte[len];
fp.readFully(buffer);
}
catch (Exception e) {
@@ -2850,31 +2872,31 @@ public final class Menu extends Key {
}
}
- s = new String(buffer);
- String lines[] = Lib.linesplit(s);
+ s= new String(buffer);
+ String lines[]= Lib.linesplit(s);
- nummaps = lines.length;
+ nummaps= lines.length;
if (nummaps == 0)
Com.Error(ERR_DROP, "no maps in maps.lst\n");
- mapnames = new String[nummaps + 1];
+ mapnames= new String[nummaps + 1];
- for (i = 0; i < nummaps; i++) {
+ for (i= 0; i < nummaps; i++) {
String shortname, longname, scratch;
- Com.ParseHelp ph = new Com.ParseHelp(lines[i]);
+ Com.ParseHelp ph= new Com.ParseHelp(lines[i]);
- shortname = Com.Parse(ph).toUpperCase();
- longname = Com.Parse(ph);
- scratch = longname + "\n" + shortname;
- mapnames[i] = scratch;
+ shortname= Com.Parse(ph).toUpperCase();
+ longname= Com.Parse(ph);
+ scratch= longname + "\n" + shortname;
+ mapnames[i]= scratch;
}
- mapnames[nummaps] = null;
+ mapnames[nummaps]= null;
if (fp != null) {
fclose(fp);
- fp = null;
+ fp= null;
}
else {
@@ -2884,56 +2906,56 @@ public final class Menu extends Key {
/*
** initialize the menu stuff
*/
- s_startserver_menu.x = (int) (viddef.width * 0.50);
- s_startserver_menu.nitems = 0;
+ s_startserver_menu.x= (int) (viddef.width * 0.50);
+ s_startserver_menu.nitems= 0;
- s_startmap_list.type = MTYPE_SPINCONTROL;
- s_startmap_list.x = 0;
- s_startmap_list.y = 0;
- s_startmap_list.name = "initial map";
- s_startmap_list.itemnames = mapnames;
+ s_startmap_list.type= MTYPE_SPINCONTROL;
+ s_startmap_list.x= 0;
+ s_startmap_list.y= 0;
+ s_startmap_list.name= "initial map";
+ s_startmap_list.itemnames= mapnames;
- s_rules_box.type = MTYPE_SPINCONTROL;
- s_rules_box.x = 0;
- s_rules_box.y = 20;
- s_rules_box.name = "rules";
+ s_rules_box.type= MTYPE_SPINCONTROL;
+ s_rules_box.x= 0;
+ s_rules_box.y= 20;
+ s_rules_box.name= "rules";
// PGM - rogue games only available with rogue DLL.
if (FS.Developer_searchpath(2) == 2)
- s_rules_box.itemnames = dm_coop_names_rogue;
+ s_rules_box.itemnames= dm_coop_names_rogue;
else
- s_rules_box.itemnames = dm_coop_names;
+ s_rules_box.itemnames= dm_coop_names;
// PGM
if (Cvar.VariableValue("coop") != 0)
- s_rules_box.curvalue = 1;
+ s_rules_box.curvalue= 1;
else
- s_rules_box.curvalue = 0;
- s_rules_box.callback = new mcallback() {
+ s_rules_box.curvalue= 0;
+ s_rules_box.callback= new mcallback() {
public void execute(Object o) {
RulesChangeFunc(o);
}
};
- s_timelimit_field.type = MTYPE_FIELD;
- s_timelimit_field.name = "time limit";
- s_timelimit_field.flags = QMF_NUMBERSONLY;
- s_timelimit_field.x = 0;
- s_timelimit_field.y = 36;
- s_timelimit_field.statusbar = "0 = no limit";
- s_timelimit_field.length = 3;
- s_timelimit_field.visible_length = 3;
- s_timelimit_field.buffer = new StringBuffer(Cvar.VariableString("timelimit"));
-
- s_fraglimit_field.type = MTYPE_FIELD;
- s_fraglimit_field.name = "frag limit";
- s_fraglimit_field.flags = QMF_NUMBERSONLY;
- s_fraglimit_field.x = 0;
- s_fraglimit_field.y = 54;
- s_fraglimit_field.statusbar = "0 = no limit";
- s_fraglimit_field.length = 3;
- s_fraglimit_field.visible_length = 3;
- s_fraglimit_field.buffer = new StringBuffer(Cvar.VariableString("fraglimit"));
+ s_timelimit_field.type= MTYPE_FIELD;
+ s_timelimit_field.name= "time limit";
+ s_timelimit_field.flags= QMF_NUMBERSONLY;
+ s_timelimit_field.x= 0;
+ s_timelimit_field.y= 36;
+ s_timelimit_field.statusbar= "0 = no limit";
+ s_timelimit_field.length= 3;
+ s_timelimit_field.visible_length= 3;
+ s_timelimit_field.buffer= new StringBuffer(Cvar.VariableString("timelimit"));
+
+ s_fraglimit_field.type= MTYPE_FIELD;
+ s_fraglimit_field.name= "frag limit";
+ s_fraglimit_field.flags= QMF_NUMBERSONLY;
+ s_fraglimit_field.x= 0;
+ s_fraglimit_field.y= 54;
+ s_fraglimit_field.statusbar= "0 = no limit";
+ s_fraglimit_field.length= 3;
+ s_fraglimit_field.visible_length= 3;
+ s_fraglimit_field.buffer= new StringBuffer(Cvar.VariableString("fraglimit"));
/*
** maxclients determines the maximum number of players that can join
@@ -2941,48 +2963,48 @@ public final class Menu extends Key {
** option to 8 players, otherwise use whatever its current value is.
** Clamping will be done when the server is actually started.
*/
- s_maxclients_field.type = MTYPE_FIELD;
- s_maxclients_field.name = "max players";
- s_maxclients_field.flags = QMF_NUMBERSONLY;
- s_maxclients_field.x = 0;
- s_maxclients_field.y = 72;
- s_maxclients_field.statusbar = null;
- s_maxclients_field.length = 3;
- s_maxclients_field.visible_length = 3;
+ s_maxclients_field.type= MTYPE_FIELD;
+ s_maxclients_field.name= "max players";
+ s_maxclients_field.flags= QMF_NUMBERSONLY;
+ s_maxclients_field.x= 0;
+ s_maxclients_field.y= 72;
+ s_maxclients_field.statusbar= null;
+ s_maxclients_field.length= 3;
+ s_maxclients_field.visible_length= 3;
if (Cvar.VariableValue("maxclients") == 1)
- s_maxclients_field.buffer = new StringBuffer("8");
+ s_maxclients_field.buffer= new StringBuffer("8");
else
- s_maxclients_field.buffer = new StringBuffer(Cvar.VariableString("maxclients"));
-
- s_hostname_field.type = MTYPE_FIELD;
- s_hostname_field.name = "hostname";
- s_hostname_field.flags = 0;
- s_hostname_field.x = 0;
- s_hostname_field.y = 90;
- s_hostname_field.statusbar = null;
- 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";
- s_startserver_dmoptions_action.flags = QMF_LEFT_JUSTIFY;
- s_startserver_dmoptions_action.x = 24;
- s_startserver_dmoptions_action.y = 108;
- s_startserver_dmoptions_action.statusbar = null;
- s_startserver_dmoptions_action.callback = new mcallback() {
+ s_maxclients_field.buffer= new StringBuffer(Cvar.VariableString("maxclients"));
+
+ s_hostname_field.type= MTYPE_FIELD;
+ s_hostname_field.name= "hostname";
+ s_hostname_field.flags= 0;
+ s_hostname_field.x= 0;
+ s_hostname_field.y= 90;
+ s_hostname_field.statusbar= null;
+ 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";
+ s_startserver_dmoptions_action.flags= QMF_LEFT_JUSTIFY;
+ s_startserver_dmoptions_action.x= 24;
+ s_startserver_dmoptions_action.y= 108;
+ s_startserver_dmoptions_action.statusbar= null;
+ s_startserver_dmoptions_action.callback= new mcallback() {
public void execute(Object o) {
DMOptionsFunc(o);
}
};
- s_startserver_start_action.type = MTYPE_ACTION;
- s_startserver_start_action.name = " begin";
- s_startserver_start_action.flags = QMF_LEFT_JUSTIFY;
- s_startserver_start_action.x = 24;
- s_startserver_start_action.y = 128;
- s_startserver_start_action.callback = new mcallback() {
+ s_startserver_start_action.type= MTYPE_ACTION;
+ s_startserver_start_action.name= " begin";
+ s_startserver_start_action.flags= QMF_LEFT_JUSTIFY;
+ s_startserver_start_action.x= 24;
+ s_startserver_start_action.y= 128;
+ s_startserver_start_action.callback= new mcallback() {
public void execute(Object o) {
StartServerActionFunc(o);
}
@@ -3012,18 +3034,18 @@ public final class Menu extends Key {
if (mapnames != null) {
int i;
- for (i = 0; i < nummaps; i++)
- mapnames[i] = null;
+ for (i= 0; i < nummaps; i++)
+ mapnames[i]= null;
}
- mapnames = null;
- nummaps = 0;
+ mapnames= null;
+ nummaps= 0;
}
return Default_MenuKey(s_startserver_menu, key);
}
- static xcommand_t Menu_StartServer = new xcommand_t() {
+ static xcommand_t Menu_StartServer= new xcommand_t() {
public void execute() {
Menu_StartServer_f();
}
@@ -3050,42 +3072,42 @@ public final class Menu extends Key {
*/
static String dmoptions_statusbar; //[128];
- static menuframework_s s_dmoptions_menu = new menuframework_s();
-
- static menulist_s s_friendlyfire_box = new menulist_s();
- static menulist_s s_falls_box = new menulist_s();
- static menulist_s s_weapons_stay_box = new menulist_s();
- static menulist_s s_instant_powerups_box = new menulist_s();
- static menulist_s s_powerups_box = new menulist_s();
- static menulist_s s_health_box = new menulist_s();
- static menulist_s s_spawn_farthest_box = new menulist_s();
- static menulist_s s_teamplay_box = new menulist_s();
- static menulist_s s_samelevel_box = new menulist_s();
- static menulist_s s_force_respawn_box = new menulist_s();
- static menulist_s s_armor_box = new menulist_s();
- static menulist_s s_allow_exit_box = new menulist_s();
- static menulist_s s_infinite_ammo_box = new menulist_s();
- static menulist_s s_fixed_fov_box = new menulist_s();
- static menulist_s s_quad_drop_box = new menulist_s();
+ static menuframework_s s_dmoptions_menu= new menuframework_s();
+
+ static menulist_s s_friendlyfire_box= new menulist_s();
+ static menulist_s s_falls_box= new menulist_s();
+ static menulist_s s_weapons_stay_box= new menulist_s();
+ static menulist_s s_instant_powerups_box= new menulist_s();
+ static menulist_s s_powerups_box= new menulist_s();
+ static menulist_s s_health_box= new menulist_s();
+ static menulist_s s_spawn_farthest_box= new menulist_s();
+ static menulist_s s_teamplay_box= new menulist_s();
+ static menulist_s s_samelevel_box= new menulist_s();
+ static menulist_s s_force_respawn_box= new menulist_s();
+ static menulist_s s_armor_box= new menulist_s();
+ static menulist_s s_allow_exit_box= new menulist_s();
+ static menulist_s s_infinite_ammo_box= new menulist_s();
+ static menulist_s s_fixed_fov_box= new menulist_s();
+ static menulist_s s_quad_drop_box= new menulist_s();
// ROGUE
- static menulist_s s_no_mines_box = new menulist_s();
- static menulist_s s_no_nukes_box = new menulist_s();
- static menulist_s s_stack_double_box = new menulist_s();
- static menulist_s s_no_spheres_box = new menulist_s();
+ static menulist_s s_no_mines_box= new menulist_s();
+ static menulist_s s_no_nukes_box= new menulist_s();
+ static menulist_s s_stack_double_box= new menulist_s();
+ static menulist_s s_no_spheres_box= new menulist_s();
// ROGUE
static void setvalue(int flags) {
Cvar.SetValue("dmflags", flags);
- dmoptions_statusbar = "dmflags = " + flags;
+ dmoptions_statusbar= "dmflags = " + flags;
}
static void DMFlagCallback(Object self) {
- menulist_s f = (menulist_s) self;
+ menulist_s f= (menulist_s) self;
int flags;
- int bit = 0;
+ int bit= 0;
- flags = (int) Cvar.VariableValue("dmflags");
+ flags= (int) Cvar.VariableValue("dmflags");
if (f == s_friendlyfire_box) {
if (f.curvalue != 0)
@@ -3104,13 +3126,13 @@ public final class Menu extends Key {
return;
}
else if (f == s_weapons_stay_box) {
- bit = DF_WEAPONS_STAY;
+ bit= DF_WEAPONS_STAY;
}
else if (f == s_instant_powerups_box) {
- bit = DF_INSTANT_ITEMS;
+ bit= DF_INSTANT_ITEMS;
}
else if (f == s_allow_exit_box) {
- bit = DF_ALLOW_EXIT;
+ bit= DF_ALLOW_EXIT;
}
else if (f == s_powerups_box) {
if (f.curvalue != 0)
@@ -3129,7 +3151,7 @@ public final class Menu extends Key {
return;
}
else if (f == s_spawn_farthest_box) {
- bit = DF_SPAWN_FARTHEST;
+ bit= DF_SPAWN_FARTHEST;
}
else if (f == s_teamplay_box) {
if (f.curvalue == 1) {
@@ -3148,10 +3170,10 @@ public final class Menu extends Key {
return;
}
else if (f == s_samelevel_box) {
- bit = DF_SAME_LEVEL;
+ bit= DF_SAME_LEVEL;
}
else if (f == s_force_respawn_box) {
- bit = DF_FORCE_RESPAWN;
+ bit= DF_FORCE_RESPAWN;
}
else if (f == s_armor_box) {
if (f.curvalue != 0)
@@ -3162,29 +3184,29 @@ public final class Menu extends Key {
return;
}
else if (f == s_infinite_ammo_box) {
- bit = DF_INFINITE_AMMO;
+ bit= DF_INFINITE_AMMO;
}
else if (f == s_fixed_fov_box) {
- bit = DF_FIXED_FOV;
+ bit= DF_FIXED_FOV;
}
else if (f == s_quad_drop_box) {
- bit = DF_QUAD_DROP;
+ bit= DF_QUAD_DROP;
}
// =======
// ROGUE
else if (FS.Developer_searchpath(2) == 2) {
if (f == s_no_mines_box) {
- bit = DF_NO_MINES;
+ bit= DF_NO_MINES;
}
else if (f == s_no_nukes_box) {
- bit = DF_NO_NUKES;
+ bit= DF_NO_NUKES;
}
else if (f == s_stack_double_box) {
- bit = DF_NO_STACK_DOUBLE;
+ bit= DF_NO_STACK_DOUBLE;
}
else if (f == s_no_spheres_box) {
- bit = DF_NO_SPHERES;
+ bit= DF_NO_SPHERES;
}
}
// ROGUE
@@ -3199,250 +3221,250 @@ public final class Menu extends Key {
Cvar.SetValue("dmflags", flags);
- dmoptions_statusbar = "dmflags = " + flags;
+ dmoptions_statusbar= "dmflags = " + flags;
}
//static String yes_no_names[] = { "no", "yes", 0 };
- static String teamplay_names[] = { "disabled", "by skin", "by model", null };
+ static String teamplay_names[]= { "disabled", "by skin", "by model", null };
static void DMOptions_MenuInit() {
- int dmflags = (int) Cvar.VariableValue("dmflags");
- int y = 0;
+ int dmflags= (int) Cvar.VariableValue("dmflags");
+ int y= 0;
- s_dmoptions_menu.x = (int) (viddef.width * 0.50);
- s_dmoptions_menu.nitems = 0;
+ s_dmoptions_menu.x= (int) (viddef.width * 0.50);
+ s_dmoptions_menu.nitems= 0;
- s_falls_box.type = MTYPE_SPINCONTROL;
- s_falls_box.x = 0;
- s_falls_box.y = y;
- s_falls_box.name = "falling damage";
- s_falls_box.callback = new mcallback() {
+ s_falls_box.type= MTYPE_SPINCONTROL;
+ s_falls_box.x= 0;
+ s_falls_box.y= y;
+ s_falls_box.name= "falling damage";
+ s_falls_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_falls_box.itemnames = yes_no_names;
- s_falls_box.curvalue = (dmflags & DF_NO_FALLING) == 0 ? 1 : 0;
-
- s_weapons_stay_box.type = MTYPE_SPINCONTROL;
- s_weapons_stay_box.x = 0;
- s_weapons_stay_box.y = y += 10;
- s_weapons_stay_box.name = "weapons stay";
- s_weapons_stay_box.callback = new mcallback() {
+ s_falls_box.itemnames= yes_no_names;
+ s_falls_box.curvalue= (dmflags & DF_NO_FALLING) == 0 ? 1 : 0;
+
+ s_weapons_stay_box.type= MTYPE_SPINCONTROL;
+ s_weapons_stay_box.x= 0;
+ s_weapons_stay_box.y= y += 10;
+ s_weapons_stay_box.name= "weapons stay";
+ s_weapons_stay_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_weapons_stay_box.itemnames = yes_no_names;
- s_weapons_stay_box.curvalue = (dmflags & DF_WEAPONS_STAY) != 0 ? 1 : 0;
-
- s_instant_powerups_box.type = MTYPE_SPINCONTROL;
- s_instant_powerups_box.x = 0;
- s_instant_powerups_box.y = y += 10;
- s_instant_powerups_box.name = "instant powerups";
- s_instant_powerups_box.callback = new mcallback() {
+ s_weapons_stay_box.itemnames= yes_no_names;
+ s_weapons_stay_box.curvalue= (dmflags & DF_WEAPONS_STAY) != 0 ? 1 : 0;
+
+ s_instant_powerups_box.type= MTYPE_SPINCONTROL;
+ s_instant_powerups_box.x= 0;
+ s_instant_powerups_box.y= y += 10;
+ s_instant_powerups_box.name= "instant powerups";
+ s_instant_powerups_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_instant_powerups_box.itemnames = yes_no_names;
- s_instant_powerups_box.curvalue = (dmflags & DF_INSTANT_ITEMS) != 0 ? 1 : 0;
-
- s_powerups_box.type = MTYPE_SPINCONTROL;
- s_powerups_box.x = 0;
- s_powerups_box.y = y += 10;
- s_powerups_box.name = "allow powerups";
- s_powerups_box.callback = new mcallback() {
+ s_instant_powerups_box.itemnames= yes_no_names;
+ s_instant_powerups_box.curvalue= (dmflags & DF_INSTANT_ITEMS) != 0 ? 1 : 0;
+
+ s_powerups_box.type= MTYPE_SPINCONTROL;
+ s_powerups_box.x= 0;
+ s_powerups_box.y= y += 10;
+ s_powerups_box.name= "allow powerups";
+ s_powerups_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_powerups_box.itemnames = yes_no_names;
- s_powerups_box.curvalue = (dmflags & DF_NO_ITEMS) == 0 ? 1 : 0;
+ s_powerups_box.itemnames= yes_no_names;
+ s_powerups_box.curvalue= (dmflags & DF_NO_ITEMS) == 0 ? 1 : 0;
- s_health_box.type = MTYPE_SPINCONTROL;
- s_health_box.x = 0;
- s_health_box.y = y += 10;
- s_health_box.callback = new mcallback() {
+ s_health_box.type= MTYPE_SPINCONTROL;
+ s_health_box.x= 0;
+ s_health_box.y= y += 10;
+ s_health_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_health_box.name = "allow health";
- s_health_box.itemnames = yes_no_names;
- s_health_box.curvalue = (dmflags & DF_NO_HEALTH) == 0 ? 1 : 0;
-
- s_armor_box.type = MTYPE_SPINCONTROL;
- s_armor_box.x = 0;
- s_armor_box.y = y += 10;
- s_armor_box.name = "allow armor";
- s_armor_box.callback = new mcallback() {
+ s_health_box.name= "allow health";
+ s_health_box.itemnames= yes_no_names;
+ s_health_box.curvalue= (dmflags & DF_NO_HEALTH) == 0 ? 1 : 0;
+
+ s_armor_box.type= MTYPE_SPINCONTROL;
+ s_armor_box.x= 0;
+ s_armor_box.y= y += 10;
+ s_armor_box.name= "allow armor";
+ s_armor_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_armor_box.itemnames = yes_no_names;
- s_armor_box.curvalue = (dmflags & DF_NO_ARMOR) == 0 ? 1 : 0;
-
- s_spawn_farthest_box.type = MTYPE_SPINCONTROL;
- s_spawn_farthest_box.x = 0;
- s_spawn_farthest_box.y = y += 10;
- s_spawn_farthest_box.name = "spawn farthest";
- s_spawn_farthest_box.callback = new mcallback() {
+ s_armor_box.itemnames= yes_no_names;
+ s_armor_box.curvalue= (dmflags & DF_NO_ARMOR) == 0 ? 1 : 0;
+
+ s_spawn_farthest_box.type= MTYPE_SPINCONTROL;
+ s_spawn_farthest_box.x= 0;
+ s_spawn_farthest_box.y= y += 10;
+ s_spawn_farthest_box.name= "spawn farthest";
+ s_spawn_farthest_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_spawn_farthest_box.itemnames = yes_no_names;
- s_spawn_farthest_box.curvalue = (dmflags & DF_SPAWN_FARTHEST) != 0 ? 1 : 0;
-
- s_samelevel_box.type = MTYPE_SPINCONTROL;
- s_samelevel_box.x = 0;
- s_samelevel_box.y = y += 10;
- s_samelevel_box.name = "same map";
- s_samelevel_box.callback = new mcallback() {
+ s_spawn_farthest_box.itemnames= yes_no_names;
+ s_spawn_farthest_box.curvalue= (dmflags & DF_SPAWN_FARTHEST) != 0 ? 1 : 0;
+
+ s_samelevel_box.type= MTYPE_SPINCONTROL;
+ s_samelevel_box.x= 0;
+ s_samelevel_box.y= y += 10;
+ s_samelevel_box.name= "same map";
+ s_samelevel_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_samelevel_box.itemnames = yes_no_names;
- s_samelevel_box.curvalue = (dmflags & DF_SAME_LEVEL) != 0 ? 1 : 0;
-
- s_force_respawn_box.type = MTYPE_SPINCONTROL;
- s_force_respawn_box.x = 0;
- s_force_respawn_box.y = y += 10;
- s_force_respawn_box.name = "force respawn";
- s_force_respawn_box.callback = new mcallback() {
+ s_samelevel_box.itemnames= yes_no_names;
+ s_samelevel_box.curvalue= (dmflags & DF_SAME_LEVEL) != 0 ? 1 : 0;
+
+ s_force_respawn_box.type= MTYPE_SPINCONTROL;
+ s_force_respawn_box.x= 0;
+ s_force_respawn_box.y= y += 10;
+ s_force_respawn_box.name= "force respawn";
+ s_force_respawn_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_force_respawn_box.itemnames = yes_no_names;
- s_force_respawn_box.curvalue = (dmflags & DF_FORCE_RESPAWN) != 0 ? 1 : 0;
-
- s_teamplay_box.type = MTYPE_SPINCONTROL;
- s_teamplay_box.x = 0;
- s_teamplay_box.y = y += 10;
- s_teamplay_box.name = "teamplay";
- s_teamplay_box.callback = new mcallback() {
+ s_force_respawn_box.itemnames= yes_no_names;
+ s_force_respawn_box.curvalue= (dmflags & DF_FORCE_RESPAWN) != 0 ? 1 : 0;
+
+ s_teamplay_box.type= MTYPE_SPINCONTROL;
+ s_teamplay_box.x= 0;
+ s_teamplay_box.y= y += 10;
+ s_teamplay_box.name= "teamplay";
+ s_teamplay_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_teamplay_box.itemnames = teamplay_names;
+ s_teamplay_box.itemnames= teamplay_names;
- s_allow_exit_box.type = MTYPE_SPINCONTROL;
- s_allow_exit_box.x = 0;
- s_allow_exit_box.y = y += 10;
- s_allow_exit_box.name = "allow exit";
- s_allow_exit_box.callback = new mcallback() {
+ s_allow_exit_box.type= MTYPE_SPINCONTROL;
+ s_allow_exit_box.x= 0;
+ s_allow_exit_box.y= y += 10;
+ s_allow_exit_box.name= "allow exit";
+ s_allow_exit_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_allow_exit_box.itemnames = yes_no_names;
- s_allow_exit_box.curvalue = (dmflags & DF_ALLOW_EXIT) != 0 ? 1 : 0;
-
- s_infinite_ammo_box.type = MTYPE_SPINCONTROL;
- s_infinite_ammo_box.x = 0;
- s_infinite_ammo_box.y = y += 10;
- s_infinite_ammo_box.name = "infinite ammo";
- s_infinite_ammo_box.callback = new mcallback() {
+ s_allow_exit_box.itemnames= yes_no_names;
+ s_allow_exit_box.curvalue= (dmflags & DF_ALLOW_EXIT) != 0 ? 1 : 0;
+
+ s_infinite_ammo_box.type= MTYPE_SPINCONTROL;
+ s_infinite_ammo_box.x= 0;
+ s_infinite_ammo_box.y= y += 10;
+ s_infinite_ammo_box.name= "infinite ammo";
+ s_infinite_ammo_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_infinite_ammo_box.itemnames = yes_no_names;
- s_infinite_ammo_box.curvalue = (dmflags & DF_INFINITE_AMMO) != 0 ? 1 : 0;
-
- s_fixed_fov_box.type = MTYPE_SPINCONTROL;
- s_fixed_fov_box.x = 0;
- s_fixed_fov_box.y = y += 10;
- s_fixed_fov_box.name = "fixed FOV";
- s_fixed_fov_box.callback = new mcallback() {
+ s_infinite_ammo_box.itemnames= yes_no_names;
+ s_infinite_ammo_box.curvalue= (dmflags & DF_INFINITE_AMMO) != 0 ? 1 : 0;
+
+ s_fixed_fov_box.type= MTYPE_SPINCONTROL;
+ s_fixed_fov_box.x= 0;
+ s_fixed_fov_box.y= y += 10;
+ s_fixed_fov_box.name= "fixed FOV";
+ s_fixed_fov_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_fixed_fov_box.itemnames = yes_no_names;
- s_fixed_fov_box.curvalue = (dmflags & DF_FIXED_FOV) != 0 ? 1 : 0;
-
- s_quad_drop_box.type = MTYPE_SPINCONTROL;
- s_quad_drop_box.x = 0;
- s_quad_drop_box.y = y += 10;
- s_quad_drop_box.name = "quad drop";
- s_quad_drop_box.callback = new mcallback() {
+ s_fixed_fov_box.itemnames= yes_no_names;
+ s_fixed_fov_box.curvalue= (dmflags & DF_FIXED_FOV) != 0 ? 1 : 0;
+
+ s_quad_drop_box.type= MTYPE_SPINCONTROL;
+ s_quad_drop_box.x= 0;
+ s_quad_drop_box.y= y += 10;
+ s_quad_drop_box.name= "quad drop";
+ s_quad_drop_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_quad_drop_box.itemnames = yes_no_names;
- s_quad_drop_box.curvalue = (dmflags & DF_QUAD_DROP) != 0 ? 1 : 0;
-
- s_friendlyfire_box.type = MTYPE_SPINCONTROL;
- s_friendlyfire_box.x = 0;
- s_friendlyfire_box.y = y += 10;
- s_friendlyfire_box.name = "friendly fire";
- s_friendlyfire_box.callback = new mcallback() {
+ s_quad_drop_box.itemnames= yes_no_names;
+ s_quad_drop_box.curvalue= (dmflags & DF_QUAD_DROP) != 0 ? 1 : 0;
+
+ s_friendlyfire_box.type= MTYPE_SPINCONTROL;
+ s_friendlyfire_box.x= 0;
+ s_friendlyfire_box.y= y += 10;
+ s_friendlyfire_box.name= "friendly fire";
+ s_friendlyfire_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_friendlyfire_box.itemnames = yes_no_names;
- s_friendlyfire_box.curvalue = (dmflags & DF_NO_FRIENDLY_FIRE) == 0 ? 1 : 0;
+ s_friendlyfire_box.itemnames= yes_no_names;
+ s_friendlyfire_box.curvalue= (dmflags & DF_NO_FRIENDLY_FIRE) == 0 ? 1 : 0;
// ============
// ROGUE
if (FS.Developer_searchpath(2) == 2) {
- s_no_mines_box.type = MTYPE_SPINCONTROL;
- s_no_mines_box.x = 0;
- s_no_mines_box.y = y += 10;
- s_no_mines_box.name = "remove mines";
- s_no_mines_box.callback = new mcallback() {
+ s_no_mines_box.type= MTYPE_SPINCONTROL;
+ s_no_mines_box.x= 0;
+ s_no_mines_box.y= y += 10;
+ s_no_mines_box.name= "remove mines";
+ s_no_mines_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_no_mines_box.itemnames = yes_no_names;
- s_no_mines_box.curvalue = (dmflags & DF_NO_MINES) != 0 ? 1 : 0;
-
- s_no_nukes_box.type = MTYPE_SPINCONTROL;
- s_no_nukes_box.x = 0;
- s_no_nukes_box.y = y += 10;
- s_no_nukes_box.name = "remove nukes";
- s_no_nukes_box.callback = new mcallback() {
+ s_no_mines_box.itemnames= yes_no_names;
+ s_no_mines_box.curvalue= (dmflags & DF_NO_MINES) != 0 ? 1 : 0;
+
+ s_no_nukes_box.type= MTYPE_SPINCONTROL;
+ s_no_nukes_box.x= 0;
+ s_no_nukes_box.y= y += 10;
+ s_no_nukes_box.name= "remove nukes";
+ s_no_nukes_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_no_nukes_box.itemnames = yes_no_names;
- s_no_nukes_box.curvalue = (dmflags & DF_NO_NUKES) != 0 ? 1 : 0;
-
- s_stack_double_box.type = MTYPE_SPINCONTROL;
- s_stack_double_box.x = 0;
- s_stack_double_box.y = y += 10;
- s_stack_double_box.name = "2x/4x stacking off";
- s_stack_double_box.callback = new mcallback() {
+ s_no_nukes_box.itemnames= yes_no_names;
+ s_no_nukes_box.curvalue= (dmflags & DF_NO_NUKES) != 0 ? 1 : 0;
+
+ s_stack_double_box.type= MTYPE_SPINCONTROL;
+ s_stack_double_box.x= 0;
+ s_stack_double_box.y= y += 10;
+ s_stack_double_box.name= "2x/4x stacking off";
+ s_stack_double_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_stack_double_box.itemnames = yes_no_names;
- s_stack_double_box.curvalue = (dmflags & DF_NO_STACK_DOUBLE);
-
- s_no_spheres_box.type = MTYPE_SPINCONTROL;
- s_no_spheres_box.x = 0;
- s_no_spheres_box.y = y += 10;
- s_no_spheres_box.name = "remove spheres";
- s_no_spheres_box.callback = new mcallback() {
+ s_stack_double_box.itemnames= yes_no_names;
+ s_stack_double_box.curvalue= (dmflags & DF_NO_STACK_DOUBLE);
+
+ s_no_spheres_box.type= MTYPE_SPINCONTROL;
+ s_no_spheres_box.x= 0;
+ s_no_spheres_box.y= y += 10;
+ s_no_spheres_box.name= "remove spheres";
+ s_no_spheres_box.callback= new mcallback() {
public void execute(Object o) {
DMFlagCallback(o);
}
};
- s_no_spheres_box.itemnames = yes_no_names;
- s_no_spheres_box.curvalue = (dmflags & DF_NO_SPHERES) != 0 ? 1 : 0;
+ s_no_spheres_box.itemnames= yes_no_names;
+ s_no_spheres_box.curvalue= (dmflags & DF_NO_SPHERES) != 0 ? 1 : 0;
}
// ROGUE
@@ -3490,7 +3512,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_dmoptions_menu, key);
}
- static xcommand_t Menu_DMOptions = new xcommand_t() {
+ static xcommand_t Menu_DMOptions= new xcommand_t() {
public void execute() {
Menu_DMOptions_f();
}
@@ -3515,17 +3537,17 @@ public final class Menu extends Key {
=============================================================================
*/
- static menuframework_s s_downloadoptions_menu = new menuframework_s();
+ static menuframework_s s_downloadoptions_menu= new menuframework_s();
- static menuseparator_s s_download_title = new menuseparator_s();
- static menulist_s s_allow_download_box = new menulist_s();
- static menulist_s s_allow_download_maps_box = new menulist_s();
- static menulist_s s_allow_download_models_box = new menulist_s();
- static menulist_s s_allow_download_players_box = new menulist_s();
- static menulist_s s_allow_download_sounds_box = new menulist_s();
+ static menuseparator_s s_download_title= new menuseparator_s();
+ static menulist_s s_allow_download_box= new menulist_s();
+ static menulist_s s_allow_download_maps_box= new menulist_s();
+ static menulist_s s_allow_download_models_box= new menulist_s();
+ static menulist_s s_allow_download_players_box= new menulist_s();
+ static menulist_s s_allow_download_sounds_box= new menulist_s();
static void DownloadCallback(Object self) {
- menulist_s f = (menulist_s) self;
+ menulist_s f= (menulist_s) self;
if (f == s_allow_download_box) {
Cvar.SetValue("allow_download", f.curvalue);
@@ -3548,78 +3570,78 @@ public final class Menu extends Key {
}
}
- static String yes_no_names[] = { "no", "yes", null };
+ static String yes_no_names[]= { "no", "yes", null };
static void DownloadOptions_MenuInit() {
- int y = 0;
+ int y= 0;
- s_downloadoptions_menu.x = (int) (viddef.width * 0.50);
- s_downloadoptions_menu.nitems = 0;
+ s_downloadoptions_menu.x= (int) (viddef.width * 0.50);
+ s_downloadoptions_menu.nitems= 0;
- s_download_title.type = MTYPE_SEPARATOR;
- s_download_title.name = "Download Options";
- s_download_title.x = 48;
- s_download_title.y = y;
+ s_download_title.type= MTYPE_SEPARATOR;
+ s_download_title.name= "Download Options";
+ s_download_title.x= 48;
+ s_download_title.y= y;
- s_allow_download_box.type = MTYPE_SPINCONTROL;
- s_allow_download_box.x = 0;
- s_allow_download_box.y = y += 20;
- s_allow_download_box.name = "allow downloading";
- s_allow_download_box.callback = new mcallback() {
+ s_allow_download_box.type= MTYPE_SPINCONTROL;
+ s_allow_download_box.x= 0;
+ s_allow_download_box.y= y += 20;
+ s_allow_download_box.name= "allow downloading";
+ s_allow_download_box.callback= new mcallback() {
public void execute(Object o) {
DownloadCallback(o);
}
};
- s_allow_download_box.itemnames = yes_no_names;
- s_allow_download_box.curvalue = (Cvar.VariableValue("allow_download") != 0) ? 1 : 0;
-
- s_allow_download_maps_box.type = MTYPE_SPINCONTROL;
- s_allow_download_maps_box.x = 0;
- s_allow_download_maps_box.y = y += 20;
- s_allow_download_maps_box.name = "maps";
- s_allow_download_maps_box.callback = new mcallback() {
+ s_allow_download_box.itemnames= yes_no_names;
+ s_allow_download_box.curvalue= (Cvar.VariableValue("allow_download") != 0) ? 1 : 0;
+
+ s_allow_download_maps_box.type= MTYPE_SPINCONTROL;
+ s_allow_download_maps_box.x= 0;
+ s_allow_download_maps_box.y= y += 20;
+ s_allow_download_maps_box.name= "maps";
+ s_allow_download_maps_box.callback= new mcallback() {
public void execute(Object o) {
DownloadCallback(o);
}
};
- s_allow_download_maps_box.itemnames = yes_no_names;
- s_allow_download_maps_box.curvalue = (Cvar.VariableValue("allow_download_maps") != 0) ? 1 : 0;
-
- s_allow_download_players_box.type = MTYPE_SPINCONTROL;
- s_allow_download_players_box.x = 0;
- s_allow_download_players_box.y = y += 10;
- s_allow_download_players_box.name = "player models/skins";
- s_allow_download_players_box.callback = new mcallback() {
+ s_allow_download_maps_box.itemnames= yes_no_names;
+ s_allow_download_maps_box.curvalue= (Cvar.VariableValue("allow_download_maps") != 0) ? 1 : 0;
+
+ s_allow_download_players_box.type= MTYPE_SPINCONTROL;
+ s_allow_download_players_box.x= 0;
+ s_allow_download_players_box.y= y += 10;
+ s_allow_download_players_box.name= "player models/skins";
+ s_allow_download_players_box.callback= new mcallback() {
public void execute(Object o) {
DownloadCallback(o);
}
};
- s_allow_download_players_box.itemnames = yes_no_names;
- s_allow_download_players_box.curvalue = (Cvar.VariableValue("allow_download_players") != 0) ? 1 : 0;
-
- s_allow_download_models_box.type = MTYPE_SPINCONTROL;
- s_allow_download_models_box.x = 0;
- s_allow_download_models_box.y = y += 10;
- s_allow_download_models_box.name = "models";
- s_allow_download_models_box.callback = new mcallback() {
+ s_allow_download_players_box.itemnames= yes_no_names;
+ s_allow_download_players_box.curvalue= (Cvar.VariableValue("allow_download_players") != 0) ? 1 : 0;
+
+ s_allow_download_models_box.type= MTYPE_SPINCONTROL;
+ s_allow_download_models_box.x= 0;
+ s_allow_download_models_box.y= y += 10;
+ s_allow_download_models_box.name= "models";
+ s_allow_download_models_box.callback= new mcallback() {
public void execute(Object o) {
DownloadCallback(o);
}
};
- s_allow_download_models_box.itemnames = yes_no_names;
- s_allow_download_models_box.curvalue = (Cvar.VariableValue("allow_download_models") != 0) ? 1 : 0;
-
- s_allow_download_sounds_box.type = MTYPE_SPINCONTROL;
- s_allow_download_sounds_box.x = 0;
- s_allow_download_sounds_box.y = y += 10;
- s_allow_download_sounds_box.name = "sounds";
- s_allow_download_sounds_box.callback = new mcallback() {
+ s_allow_download_models_box.itemnames= yes_no_names;
+ s_allow_download_models_box.curvalue= (Cvar.VariableValue("allow_download_models") != 0) ? 1 : 0;
+
+ s_allow_download_sounds_box.type= MTYPE_SPINCONTROL;
+ s_allow_download_sounds_box.x= 0;
+ s_allow_download_sounds_box.y= y += 10;
+ s_allow_download_sounds_box.name= "sounds";
+ s_allow_download_sounds_box.callback= new mcallback() {
public void execute(Object o) {
DownloadCallback(o);
}
};
- s_allow_download_sounds_box.itemnames = yes_no_names;
- s_allow_download_sounds_box.curvalue = (Cvar.VariableValue("allow_download_sounds") != 0) ? 1 : 0;
+ s_allow_download_sounds_box.itemnames= yes_no_names;
+ s_allow_download_sounds_box.curvalue= (Cvar.VariableValue("allow_download_sounds") != 0) ? 1 : 0;
Menu_AddItem(s_downloadoptions_menu, s_download_title);
Menu_AddItem(s_downloadoptions_menu, s_allow_download_box);
@@ -3632,7 +3654,7 @@ public final class Menu extends Key {
// skip over title
if (s_downloadoptions_menu.cursor == 0)
- s_downloadoptions_menu.cursor = 1;
+ s_downloadoptions_menu.cursor= 1;
}
static void DownloadOptions_MenuDraw() {
@@ -3643,7 +3665,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_downloadoptions_menu, key);
}
- static xcommand_t Menu_DownloadOptions = new xcommand_t() {
+ static xcommand_t Menu_DownloadOptions= new xcommand_t() {
public void execute() {
Menu_DownloadOptions_f();
}
@@ -3668,47 +3690,47 @@ public final class Menu extends Key {
=============================================================================
*/
- static menuframework_s s_addressbook_menu = new menuframework_s();
- static menufield_s s_addressbook_fields[] = new menufield_s[NUM_ADDRESSBOOK_ENTRIES];
+ static menuframework_s s_addressbook_menu= new menuframework_s();
+ static menufield_s s_addressbook_fields[]= new menufield_s[NUM_ADDRESSBOOK_ENTRIES];
static {
- for (int n = 0; n < NUM_ADDRESSBOOK_ENTRIES; n++)
- s_addressbook_fields[n] = new menufield_s();
+ for (int n= 0; n < NUM_ADDRESSBOOK_ENTRIES; n++)
+ s_addressbook_fields[n]= new menufield_s();
}
static void AddressBook_MenuInit() {
int i;
- s_addressbook_menu.x = viddef.width / 2 - 142;
- s_addressbook_menu.y = viddef.height / 2 - 58;
- s_addressbook_menu.nitems = 0;
+ s_addressbook_menu.x= viddef.width / 2 - 142;
+ s_addressbook_menu.y= viddef.height / 2 - 58;
+ s_addressbook_menu.nitems= 0;
- for (i = 0; i < NUM_ADDRESSBOOK_ENTRIES; i++) {
+ for (i= 0; i < NUM_ADDRESSBOOK_ENTRIES; i++) {
cvar_t adr;
//char buffer[20];
String buffer;
//Com_sprintf(buffer, sizeof(buffer), "adr%d", i);
- buffer = "adr" + i;
+ buffer= "adr" + i;
- adr = Cvar.Get(buffer, "", CVAR_ARCHIVE);
+ adr= Cvar.Get(buffer, "", CVAR_ARCHIVE);
- s_addressbook_fields[i].type = MTYPE_FIELD;
- s_addressbook_fields[i].name = null;
- s_addressbook_fields[i].callback = null;
- s_addressbook_fields[i].x = 0;
- s_addressbook_fields[i].y = i * 18 + 0;
- s_addressbook_fields[i].localdata[0] = i;
- s_addressbook_fields[i].cursor = 0;
- s_addressbook_fields[i].length = 60;
- s_addressbook_fields[i].visible_length = 30;
+ s_addressbook_fields[i].type= MTYPE_FIELD;
+ s_addressbook_fields[i].name= null;
+ s_addressbook_fields[i].callback= null;
+ s_addressbook_fields[i].x= 0;
+ s_addressbook_fields[i].y= i * 18 + 0;
+ s_addressbook_fields[i].localdata[0]= i;
+ s_addressbook_fields[i].cursor= 0;
+ s_addressbook_fields[i].length= 60;
+ s_addressbook_fields[i].visible_length= 30;
- s_addressbook_fields[i].buffer = new StringBuffer(adr.string);
+ s_addressbook_fields[i].buffer= new StringBuffer(adr.string);
Menu_AddItem(s_addressbook_menu, s_addressbook_fields[i]);
}
}
- static keyfunc_t AddressBook_MenuKey = new keyfunc_t() {
+ static keyfunc_t AddressBook_MenuKey= new keyfunc_t() {
public String execute(int key) {
return AddressBook_MenuKey_f(key);
}
@@ -3720,8 +3742,8 @@ public final class Menu extends Key {
//char buffer[20];
String buffer;
- for (index = 0; index < NUM_ADDRESSBOOK_ENTRIES; index++) {
- buffer = "adr" + index;
+ for (index= 0; index < NUM_ADDRESSBOOK_ENTRIES; index++) {
+ buffer= "adr" + index;
//Com_sprintf(buffer, sizeof(buffer), "adr%d", index);
Cvar.Set(buffer, s_addressbook_fields[index].buffer.toString());
}
@@ -3729,7 +3751,7 @@ public final class Menu extends Key {
return Default_MenuKey(s_addressbook_menu, key);
}
- static xcommand_t AddressBook_MenuDraw = new xcommand_t() {
+ static xcommand_t AddressBook_MenuDraw= new xcommand_t() {
public void execute() {
AddressBook_MenuDraw_f();
}
@@ -3739,7 +3761,7 @@ public final class Menu extends Key {
Menu_Draw(s_addressbook_menu);
}
- static xcommand_t Menu_AddressBook = new xcommand_t() {
+ static xcommand_t Menu_AddressBook= new xcommand_t() {
public void execute() {
Menu_AddressBook_f();
}
@@ -3763,17 +3785,17 @@ public final class Menu extends Key {
=============================================================================
*/
- static menuframework_s s_player_config_menu = new menuframework_s();
- static menufield_s s_player_name_field = new menufield_s();
- static menulist_s s_player_model_box = new menulist_s();
- static menulist_s s_player_skin_box = new menulist_s();
- static menulist_s s_player_handedness_box = new menulist_s();
- static menulist_s s_player_rate_box = new menulist_s();
- static menuseparator_s s_player_skin_title = new menuseparator_s();
- static menuseparator_s s_player_model_title = new menuseparator_s();
- static menuseparator_s s_player_hand_title = new menuseparator_s();
- static menuseparator_s s_player_rate_title = new menuseparator_s();
- static menuaction_s s_player_download_action = new menuaction_s();
+ static menuframework_s s_player_config_menu= new menuframework_s();
+ static menufield_s s_player_name_field= new menufield_s();
+ static menulist_s s_player_model_box= new menulist_s();
+ static menulist_s s_player_skin_box= new menulist_s();
+ static menulist_s s_player_handedness_box= new menulist_s();
+ static menulist_s s_player_rate_box= new menulist_s();
+ static menuseparator_s s_player_skin_title= new menuseparator_s();
+ static menuseparator_s s_player_model_title= new menuseparator_s();
+ static menuseparator_s s_player_hand_title= new menuseparator_s();
+ static menuseparator_s s_player_rate_title= new menuseparator_s();
+ static menuaction_s s_player_download_action= new menuaction_s();
static class playermodelinfo_s {
int nskins;
@@ -3784,12 +3806,12 @@ public final class Menu extends Key {
String directory;
};
- static playermodelinfo_s s_pmi[] = new playermodelinfo_s[MAX_PLAYERMODELS];
- static String s_pmnames[] = new String[MAX_PLAYERMODELS];
+ static playermodelinfo_s s_pmi[]= new playermodelinfo_s[MAX_PLAYERMODELS];
+ static String s_pmnames[]= new String[MAX_PLAYERMODELS];
static int s_numplayermodels;
- static int rate_tbl[] = { 2500, 3200, 5000, 10000, 25000, 0 };
- static String rate_names[] = { "28.8 Modem", "33.6 Modem", "Single ISDN", "Dual ISDN/Cable", "T1/LAN", "User defined", null };
+ static int rate_tbl[]= { 2500, 3200, 5000, 10000, 25000, 0 };
+ static String rate_names[]= { "28.8 Modem", "33.6 Modem", "Single ISDN", "Dual ISDN/Cable", "T1/LAN", "User defined", null };
static void DownloadOptionsFunc(Object self) {
Menu_DownloadOptions_f();
@@ -3805,8 +3827,8 @@ public final class Menu extends Key {
}
static void ModelCallback(Object unused) {
- s_player_skin_box.itemnames = s_pmi[s_player_model_box.curvalue].skindisplaynames;
- s_player_skin_box.curvalue = 0;
+ s_player_skin_box.itemnames= s_pmi[s_player_model_box.curvalue].skindisplaynames;
+ s_player_skin_box.curvalue= 0;
}
static boolean IconOfSkinExists(String skin, String pcxfiles[], int npcxfiles) {
@@ -3815,15 +3837,15 @@ public final class Menu extends Key {
String scratch;
//strcpy(scratch, skin);
- scratch = skin;
- int pos = scratch.lastIndexOf('.');
+ scratch= skin;
+ int pos= scratch.lastIndexOf('.');
if (pos != -1)
- scratch = scratch.substring(0, pos) + "_i.pcx";
+ scratch= scratch.substring(0, pos) + "_i.pcx";
else
scratch += "_i.pcx";
- for (i = 0; i < npcxfiles; i++) {
+ for (i= 0; i < npcxfiles; i++) {
if (strcmp(pcxfiles[i], scratch) == 0)
return true;
}
@@ -3837,27 +3859,27 @@ public final class Menu extends Key {
//char scratch[1024];
String scratch;
- int ndirs = 0, npms = 0;
+ int ndirs= 0, npms= 0;
int a, b, c;
String dirnames[];
- String path = null;
+ String path= null;
int i;
//extern String * FS_ListFiles(String , int *, unsigned, unsigned);
- s_numplayermodels = 0;
+ s_numplayermodels= 0;
/*
** get a list of directories
*/
do {
- path = FS.NextPath(path);
- findname = path + "/players/*.*";
+ path= FS.NextPath(path);
+ findname= path + "/players/*.*";
- if ((dirnames = FS.ListFiles(findname, 0, SFF_SUBDIR)) != null) {
- ndirs = dirnames.length;
+ if ((dirnames= FS.ListFiles(findname, 0, SFF_SUBDIR)) != null) {
+ ndirs= dirnames.length;
break;
}
}
@@ -3869,45 +3891,45 @@ public final class Menu extends Key {
/*
** go through the subdirectories
*/
- npms = ndirs;
+ npms= ndirs;
if (npms > MAX_PLAYERMODELS)
- npms = MAX_PLAYERMODELS;
+ npms= MAX_PLAYERMODELS;
- for (i = 0; i < npms; i++) {
+ for (i= 0; i < npms; i++) {
int k, s;
//String a, b, c;
String pcxnames[];
String skinnames[];
int npcxfiles;
- int nskins = 0;
+ int nskins= 0;
if (dirnames[i] == null)
continue;
// verify the existence of tris.md2
- scratch = dirnames[i];
+ scratch= dirnames[i];
scratch += "/tris.md2";
if (Sys.FindFirst(scratch, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM) == null) {
//free(dirnames[i]);
- dirnames[i] = null;
+ dirnames[i]= null;
Sys.FindClose();
continue;
}
Sys.FindClose();
// verify the existence of at least one pcx skin
- scratch = dirnames[i] + "/*.pcx";
- pcxnames = FS.ListFiles(scratch, 0, 0);
- npcxfiles = pcxnames.length;
+ scratch= dirnames[i] + "/*.pcx";
+ pcxnames= FS.ListFiles(scratch, 0, 0);
+ npcxfiles= pcxnames.length;
if (pcxnames == null) {
- dirnames[i] = null;
+ dirnames[i]= null;
continue;
}
// count valid skins, which consist of a skin with a matching "_i" icon
- for (k = 0; k < npcxfiles - 1; k++) {
+ for (k= 0; k < npcxfiles - 1; k++) {
if (!pcxnames[k].endsWith("_i.pcx")) {
//if (!strstr(pcxnames[k], "_i.pcx")) {
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1)) {
@@ -3918,28 +3940,28 @@ public final class Menu extends Key {
if (nskins == 0)
continue;
- skinnames = new String[nskins + 1]; //malloc(sizeof(String) * (nskins + 1));
+ skinnames= new String[nskins + 1]; //malloc(sizeof(String) * (nskins + 1));
//memset(skinnames, 0, sizeof(String) * (nskins + 1));
// copy the valid skins
- for (s = 0, k = 0; k < npcxfiles - 1; k++) {
+ for (s= 0, k= 0; k < npcxfiles - 1; k++) {
if (pcxnames[k].indexOf("_i.pcx") < 0) {
if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1)) {
- a = pcxnames[k].lastIndexOf('/');
- b = pcxnames[k].lastIndexOf('\\');
+ a= pcxnames[k].lastIndexOf('/');
+ b= pcxnames[k].lastIndexOf('\\');
if (a > b)
- c = a;
+ c= a;
else
- c = b;
+ c= b;
- scratch = pcxnames[k].substring(c + 1, pcxnames[k].length());
- int pos = scratch.lastIndexOf('.');
+ scratch= pcxnames[k].substring(c + 1, pcxnames[k].length());
+ int pos= scratch.lastIndexOf('.');
if (pos != -1)
- scratch = scratch.substring(0, pos);
+ scratch= scratch.substring(0, pos);
- skinnames[s] = scratch;
+ skinnames[s]= scratch;
s++;
}
}
@@ -3947,22 +3969,22 @@ public final class Menu extends Key {
// at this point we have a valid player model
if (s_pmi[s_numplayermodels] == null)
- s_pmi[s_numplayermodels] = new playermodelinfo_s();
+ s_pmi[s_numplayermodels]= new playermodelinfo_s();
- s_pmi[s_numplayermodels].nskins = nskins;
- s_pmi[s_numplayermodels].skindisplaynames = skinnames;
+ s_pmi[s_numplayermodels].nskins= nskins;
+ s_pmi[s_numplayermodels].skindisplaynames= skinnames;
// make short name for the model
- a = dirnames[i].lastIndexOf('/');
- b = dirnames[i].lastIndexOf('\\');
+ a= dirnames[i].lastIndexOf('/');
+ b= dirnames[i].lastIndexOf('\\');
if (a > b)
- c = a;
+ c= a;
else
- c = b;
+ c= b;
- s_pmi[s_numplayermodels].displayname = dirnames[i].substring(c + 1);
- s_pmi[s_numplayermodels].directory = dirnames[i].substring(c + 1);
+ s_pmi[s_numplayermodels].displayname= dirnames[i].substring(c + 1);
+ s_pmi[s_numplayermodels].directory= dirnames[i].substring(c + 1);
s_numplayermodels++;
}
@@ -3972,8 +3994,8 @@ public final class Menu extends Key {
}
static int pmicmpfnc(Object _a, Object _b) {
- playermodelinfo_s a = (playermodelinfo_s) _a;
- playermodelinfo_s b = (playermodelinfo_s) _b;
+ playermodelinfo_s a= (playermodelinfo_s) _a;
+ playermodelinfo_s b= (playermodelinfo_s) _b;
/*
** sort by male, female, then alphabetical
@@ -3991,7 +4013,7 @@ public final class Menu extends Key {
return strcmp(a.directory, b.directory);
}
- static String handedness[] = { "right", "left", "center", null };
+ static String handedness[]= { "right", "left", "center", null };
static boolean PlayerConfig_MenuInit() {
/*
@@ -4004,12 +4026,12 @@ public final class Menu extends Key {
//char currentskin[1024];
String currentskin;
- int i = 0;
+ int i= 0;
- int currentdirectoryindex = 0;
- int currentskinindex = 0;
+ int currentdirectoryindex= 0;
+ int currentskinindex= 0;
- cvar_t hand = Cvar.Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
+ cvar_t hand= Cvar.Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
PlayerConfig_ScanDirectories();
@@ -4019,19 +4041,19 @@ public final class Menu extends Key {
if (hand.value < 0 || hand.value > 2)
Cvar.SetValue("hand", 0);
- currentdirectory = skin.string;
+ currentdirectory= skin.string;
if (currentdirectory.lastIndexOf('/') != -1) {
- currentskin = rightFrom(currentdirectory, '/');
- currentdirectory = leftFrom(currentdirectory, '/');
+ currentskin= rightFrom(currentdirectory, '/');
+ currentdirectory= leftFrom(currentdirectory, '/');
}
else if (currentdirectory.lastIndexOf('\\') != -1) {
- currentskin = rightFrom(currentdirectory, '\\');
- currentdirectory = leftFrom(currentdirectory, '\\');
+ currentskin= rightFrom(currentdirectory, '\\');
+ currentdirectory= leftFrom(currentdirectory, '\\');
}
else {
- currentdirectory = "male";
- currentskin = "grunt";
+ currentdirectory= "male";
+ currentskin= "grunt";
}
//qsort(s_pmi, s_numplayermodels, sizeof(s_pmi[0]), pmicmpfnc);
@@ -4042,116 +4064,116 @@ public final class Menu extends Key {
});
//memset(s_pmnames, 0, sizeof(s_pmnames));
- s_pmnames = new String[MAX_PLAYERMODELS];
+ s_pmnames= new String[MAX_PLAYERMODELS];
- for (i = 0; i < s_numplayermodels; i++) {
- s_pmnames[i] = s_pmi[i].displayname;
+ for (i= 0; i < s_numplayermodels; i++) {
+ s_pmnames[i]= s_pmi[i].displayname;
if (Q_stricmp(s_pmi[i].directory, currentdirectory) == 0) {
int j;
- currentdirectoryindex = i;
+ currentdirectoryindex= i;
- for (j = 0; j < s_pmi[i].nskins; j++) {
+ for (j= 0; j < s_pmi[i].nskins; j++) {
if (Q_stricmp(s_pmi[i].skindisplaynames[j], currentskin) == 0) {
- currentskinindex = j;
+ currentskinindex= j;
break;
}
}
}
}
- s_player_config_menu.x = viddef.width / 2 - 95;
- s_player_config_menu.y = viddef.height / 2 - 97;
- s_player_config_menu.nitems = 0;
+ s_player_config_menu.x= viddef.width / 2 - 95;
+ s_player_config_menu.y= viddef.height / 2 - 97;
+ s_player_config_menu.nitems= 0;
- s_player_name_field.type = MTYPE_FIELD;
- s_player_name_field.name = "name";
- s_player_name_field.callback = null;
- s_player_name_field.x = 0;
- s_player_name_field.y = 0;
- s_player_name_field.length = 20;
- s_player_name_field.visible_length = 20;
- s_player_name_field.buffer = new StringBuffer(name.string);
- s_player_name_field.cursor = name.string.length();
+ s_player_name_field.type= MTYPE_FIELD;
+ s_player_name_field.name= "name";
+ s_player_name_field.callback= null;
+ s_player_name_field.x= 0;
+ s_player_name_field.y= 0;
+ s_player_name_field.length= 20;
+ s_player_name_field.visible_length= 20;
+ s_player_name_field.buffer= new StringBuffer(name.string);
+ s_player_name_field.cursor= name.string.length();
- s_player_model_title.type = MTYPE_SEPARATOR;
- s_player_model_title.name = "model";
- s_player_model_title.x = -8;
- s_player_model_title.y = 60;
+ s_player_model_title.type= MTYPE_SEPARATOR;
+ s_player_model_title.name= "model";
+ s_player_model_title.x= -8;
+ s_player_model_title.y= 60;
- s_player_model_box.type = MTYPE_SPINCONTROL;
- s_player_model_box.x = -56;
- s_player_model_box.y = 70;
- s_player_model_box.callback = new mcallback() {
+ s_player_model_box.type= MTYPE_SPINCONTROL;
+ s_player_model_box.x= -56;
+ s_player_model_box.y= 70;
+ s_player_model_box.callback= new mcallback() {
public void execute(Object o) {
ModelCallback(o);
}
};
- s_player_model_box.cursor_offset = -48;
- s_player_model_box.curvalue = currentdirectoryindex;
- s_player_model_box.itemnames = s_pmnames;
-
- s_player_skin_title.type = MTYPE_SEPARATOR;
- s_player_skin_title.name = "skin";
- s_player_skin_title.x = -16;
- s_player_skin_title.y = 84;
-
- s_player_skin_box.type = MTYPE_SPINCONTROL;
- s_player_skin_box.x = -56;
- s_player_skin_box.y = 94;
- s_player_skin_box.name = null;
- s_player_skin_box.callback = null;
- s_player_skin_box.cursor_offset = -48;
- s_player_skin_box.curvalue = currentskinindex;
- s_player_skin_box.itemnames = s_pmi[currentdirectoryindex].skindisplaynames;
-
- s_player_hand_title.type = MTYPE_SEPARATOR;
- s_player_hand_title.name = "handedness";
- s_player_hand_title.x = 32;
- s_player_hand_title.y = 108;
-
- s_player_handedness_box.type = MTYPE_SPINCONTROL;
- s_player_handedness_box.x = -56;
- s_player_handedness_box.y = 118;
- s_player_handedness_box.name = null;
- s_player_handedness_box.cursor_offset = -48;
- s_player_handedness_box.callback = new mcallback() {
+ s_player_model_box.cursor_offset= -48;
+ s_player_model_box.curvalue= currentdirectoryindex;
+ s_player_model_box.itemnames= s_pmnames;
+
+ s_player_skin_title.type= MTYPE_SEPARATOR;
+ s_player_skin_title.name= "skin";
+ s_player_skin_title.x= -16;
+ s_player_skin_title.y= 84;
+
+ s_player_skin_box.type= MTYPE_SPINCONTROL;
+ s_player_skin_box.x= -56;
+ s_player_skin_box.y= 94;
+ s_player_skin_box.name= null;
+ s_player_skin_box.callback= null;
+ s_player_skin_box.cursor_offset= -48;
+ s_player_skin_box.curvalue= currentskinindex;
+ s_player_skin_box.itemnames= s_pmi[currentdirectoryindex].skindisplaynames;
+
+ s_player_hand_title.type= MTYPE_SEPARATOR;
+ s_player_hand_title.name= "handedness";
+ s_player_hand_title.x= 32;
+ s_player_hand_title.y= 108;
+
+ s_player_handedness_box.type= MTYPE_SPINCONTROL;
+ s_player_handedness_box.x= -56;
+ s_player_handedness_box.y= 118;
+ s_player_handedness_box.name= null;
+ s_player_handedness_box.cursor_offset= -48;
+ s_player_handedness_box.callback= new mcallback() {
public void execute(Object o) {
HandednessCallback(o);
}
};
- s_player_handedness_box.curvalue = (int) Cvar.VariableValue("hand");
- s_player_handedness_box.itemnames = handedness;
+ s_player_handedness_box.curvalue= (int) Cvar.VariableValue("hand");
+ s_player_handedness_box.itemnames= handedness;
- for (i = 0; i < rate_tbl.length - 1; i++)
+ for (i= 0; i < rate_tbl.length - 1; i++)
if (Cvar.VariableValue("rate") == rate_tbl[i])
break;
- s_player_rate_title.type = MTYPE_SEPARATOR;
- s_player_rate_title.name = "connect speed";
- s_player_rate_title.x = 56;
- s_player_rate_title.y = 156;
-
- s_player_rate_box.type = MTYPE_SPINCONTROL;
- s_player_rate_box.x = -56;
- s_player_rate_box.y = 166;
- s_player_rate_box.name = null;
- s_player_rate_box.cursor_offset = -48;
- s_player_rate_box.callback = new mcallback() {
+ s_player_rate_title.type= MTYPE_SEPARATOR;
+ s_player_rate_title.name= "connect speed";
+ s_player_rate_title.x= 56;
+ s_player_rate_title.y= 156;
+
+ s_player_rate_box.type= MTYPE_SPINCONTROL;
+ s_player_rate_box.x= -56;
+ s_player_rate_box.y= 166;
+ s_player_rate_box.name= null;
+ s_player_rate_box.cursor_offset= -48;
+ s_player_rate_box.callback= new mcallback() {
public void execute(Object o) {
RateCallback(o);
}
};
- s_player_rate_box.curvalue = i;
- s_player_rate_box.itemnames = rate_names;
-
- s_player_download_action.type = MTYPE_ACTION;
- s_player_download_action.name = "download options";
- s_player_download_action.flags = QMF_LEFT_JUSTIFY;
- s_player_download_action.x = -24;
- s_player_download_action.y = 186;
- s_player_download_action.statusbar = null;
- s_player_download_action.callback = new mcallback() {
+ s_player_rate_box.curvalue= i;
+ s_player_rate_box.itemnames= rate_names;
+
+ s_player_download_action.type= MTYPE_ACTION;
+ s_player_download_action.name= "download options";
+ s_player_download_action.flags= QMF_LEFT_JUSTIFY;
+ s_player_download_action.x= -24;
+ s_player_download_action.y= 186;
+ s_player_download_action.statusbar= null;
+ s_player_download_action.callback= new mcallback() {
public void execute(Object o) {
DownloadOptionsFunc(o);
}
@@ -4177,56 +4199,56 @@ public final class Menu extends Key {
static void PlayerConfig_MenuDraw() {
- refdef_t refdef = new refdef_t();
+ refdef_t refdef= new refdef_t();
//char scratch[MAX_QPATH];
String scratch;
//memset(refdef, 0, sizeof(refdef));
- refdef.x = viddef.width / 2;
- refdef.y = viddef.height / 2 - 72;
- refdef.width = 144;
- refdef.height = 168;
- refdef.fov_x = 40;
- refdef.fov_y = Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height);
- refdef.time = cls.realtime * 0.001f;
+ refdef.x= viddef.width / 2;
+ refdef.y= viddef.height / 2 - 72;
+ refdef.width= 144;
+ refdef.height= 168;
+ refdef.fov_x= 40;
+ refdef.fov_y= Math3D.CalcFov(refdef.fov_x, refdef.width, refdef.height);
+ refdef.time= cls.realtime * 0.001f;
if (s_pmi[s_player_model_box.curvalue].skindisplaynames != null) {
- int maxframe = 29;
- entity_t entity = new entity_t();
+ int maxframe= 29;
+ entity_t entity= new entity_t();
//memset(entity, 0, sizeof(entity));
- scratch = "players/" + s_pmi[s_player_model_box.curvalue].directory + "/tris.md2";
+ scratch= "players/" + s_pmi[s_player_model_box.curvalue].directory + "/tris.md2";
- entity.model = re.RegisterModel(scratch);
+ entity.model= re.RegisterModel(scratch);
- scratch =
+ scratch=
"players/"
+ s_pmi[s_player_model_box.curvalue].directory
+ "/"
+ s_pmi[s_player_model_box.curvalue].skindisplaynames[s_player_skin_box.curvalue]
+ ".pcx";
- entity.skin = re.RegisterSkin(scratch);
- entity.flags = RF_FULLBRIGHT;
- entity.origin[0] = 80;
- entity.origin[1] = 0;
- entity.origin[2] = 0;
+ entity.skin= re.RegisterSkin(scratch);
+ entity.flags= RF_FULLBRIGHT;
+ entity.origin[0]= 80;
+ entity.origin[1]= 0;
+ entity.origin[2]= 0;
VectorCopy(entity.origin, entity.oldorigin);
- entity.frame = 0;
- entity.oldframe = 0;
- entity.backlerp = 0.0f;
- entity.angles[1] = yaw++;
+ entity.frame= 0;
+ entity.oldframe= 0;
+ entity.backlerp= 0.0f;
+ entity.angles[1]= yaw++;
if (++yaw > 360)
yaw -= 360;
- refdef.areabits = null;
- refdef.num_entities = 1;
- refdef.entities = new entity_t[] { entity };
- refdef.lightstyles = null;
- refdef.rdflags = RDF_NOWORLDMODEL;
+ refdef.areabits= null;
+ refdef.num_entities= 1;
+ refdef.entities= new entity_t[] { entity };
+ refdef.lightstyles= null;
+ refdef.rdflags= RDF_NOWORLDMODEL;
Menu_Draw(s_player_config_menu);
@@ -4239,7 +4261,7 @@ public final class Menu extends Key {
re.RenderFrame(refdef);
- scratch =
+ scratch=
"/players/"
+ s_pmi[s_player_model_box.curvalue].directory
+ "/"
@@ -4259,28 +4281,28 @@ public final class Menu extends Key {
Cvar.Set("name", s_player_name_field.buffer.toString());
- scratch =
+ scratch=
s_pmi[s_player_model_box.curvalue].directory
+ "/"
+ s_pmi[s_player_model_box.curvalue].skindisplaynames[s_player_skin_box.curvalue];
Cvar.Set("skin", scratch);
- for (i = 0; i < s_numplayermodels; i++) {
+ for (i= 0; i < s_numplayermodels; i++) {
int j;
- for (j = 0; j < s_pmi[i].nskins; j++) {
+ for (j= 0; j < s_pmi[i].nskins; j++) {
if (s_pmi[i].skindisplaynames[j] != null)
- s_pmi[i].skindisplaynames[j] = null;
+ s_pmi[i].skindisplaynames[j]= null;
}
- s_pmi[i].skindisplaynames = null;
- s_pmi[i].nskins = 0;
+ s_pmi[i].skindisplaynames= null;
+ s_pmi[i].nskins= 0;
}
}
return Default_MenuKey(s_player_config_menu, key);
}
- static xcommand_t Menu_PlayerConfig = new xcommand_t() {
+ static xcommand_t Menu_PlayerConfig= new xcommand_t() {
public void execute() {
Menu_PlayerConfig_f();
}
@@ -4320,7 +4342,7 @@ public final class Menu extends Key {
case 'Y' :
case 'y' :
- cls.key_dest = key_console;
+ cls.key_dest= key_console;
CL.Quit_f.execute();
break;
@@ -4334,14 +4356,14 @@ public final class Menu extends Key {
static void Quit_Draw() {
int w, h;
- Dimension d = new Dimension();
+ Dimension d= new Dimension();
re.DrawGetPicSize(d, "quit");
- w = d.width;
- h = d.height;
+ w= d.width;
+ h= d.height;
re.DrawPic((viddef.width - w) / 2, (viddef.height - h) / 2, "quit");
}
- static xcommand_t Menu_Quit = new xcommand_t() {
+ static xcommand_t Menu_Quit= new xcommand_t() {
public void execute() {
Menu_Quit_f();
}
@@ -4383,8 +4405,8 @@ public final class Menu extends Key {
Cmd.AddCommand("menu_keys", Menu_Keys);
Cmd.AddCommand("menu_quit", Menu_Quit);
- for (int i = 0; i < m_layers.length; i++) {
- m_layers[i] = new menulayer_t();
+ for (int i= 0; i < m_layers.length; i++) {
+ m_layers[i]= new menulayer_t();
}
}
@@ -4413,7 +4435,7 @@ public final class Menu extends Key {
// caching images
if (m_entersound) {
S.StartLocalSound(menu_in_sound);
- m_entersound = false;
+ m_entersound= false;
}
}
@@ -4426,7 +4448,7 @@ public final class Menu extends Key {
String s;
if (m_keyfunc != null)
- if ((s = m_keyfunc.execute(key)) != null)
+ if ((s= m_keyfunc.execute(key)) != null)
S.StartLocalSound(s);
}
@@ -4469,28 +4491,28 @@ public final class Menu extends Key {
Menu_DrawStringR2LDark(f.x + f.parent.x + LCOLUMN_OFFSET, f.y + f.parent.y, f.name);
//strncpy(tempbuffer, f.buffer + f.visible_offset, f.visible_length);
- String s = f.buffer.toString();
- tempbuffer = s.substring(f.visible_offset, s.length());
+ String s= f.buffer.toString();
+ tempbuffer= s.substring(f.visible_offset, s.length());
re.DrawChar(f.x + f.parent.x + 16, f.y + f.parent.y - 4, 18);
re.DrawChar(f.x + f.parent.x + 16, f.y + f.parent.y + 4, 24);
re.DrawChar(f.x + f.parent.x + 24 + f.visible_length * 8, f.y + f.parent.y - 4, 20);
re.DrawChar(f.x + f.parent.x + 24 + f.visible_length * 8, f.y + f.parent.y + 4, 26);
- for (i = 0; i < f.visible_length; i++) {
+ for (i= 0; i < f.visible_length; i++) {
re.DrawChar(f.x + f.parent.x + 24 + i * 8, f.y + f.parent.y - 4, 19);
re.DrawChar(f.x + f.parent.x + 24 + i * 8, f.y + f.parent.y + 4, 25);
}
Menu_DrawString(f.x + f.parent.x + 24, f.y + f.parent.y, tempbuffer);
-
+
if (Menu_ItemAtCursor(f.parent) == f) {
int offset;
if (f.visible_offset != 0)
- offset = f.visible_length;
+ offset= f.visible_length;
else
- offset = f.cursor;
+ offset= f.cursor;
if ((((int) (Sys.Milliseconds() / 250)) & 1) != 0) {
re.DrawChar(f.x + f.parent.x + (offset + 2) * 8 + 8, f.y + f.parent.y, 11);
@@ -4502,50 +4524,50 @@ public final class Menu extends Key {
}
public static boolean Field_Key(menufield_s f, int k) {
- char key = (char) k;
+ char key= (char) k;
switch (key) {
case K_KP_SLASH :
- key = '/';
+ key= '/';
break;
case K_KP_MINUS :
- key = '-';
+ key= '-';
break;
case K_KP_PLUS :
- key = '+';
+ key= '+';
break;
case K_KP_HOME :
- key = '7';
+ key= '7';
break;
case K_KP_UPARROW :
- key = '8';
+ key= '8';
break;
case K_KP_PGUP :
- key = '9';
+ key= '9';
break;
case K_KP_LEFTARROW :
- key = '4';
+ key= '4';
break;
case K_KP_5 :
- key = '5';
+ key= '5';
break;
case K_KP_RIGHTARROW :
- key = '6';
+ key= '6';
break;
case K_KP_END :
- key = '1';
+ key= '1';
break;
case K_KP_DOWNARROW :
- key = '2';
+ key= '2';
break;
case K_KP_PGDN :
- key = '3';
+ key= '3';
break;
case K_KP_INS :
- key = '0';
+ key= '0';
break;
case K_KP_DEL :
- key = '.';
+ key= '.';
break;
}
@@ -4563,18 +4585,18 @@ public final class Menu extends Key {
if ((Character.toUpperCase(key) == 'V' && keydown[K_CTRL]) || (((key == K_INS) || (key == K_KP_INS)) && keydown[K_SHIFT])) {
String cbd;
- if ((cbd = Sys.GetClipboardData()) != null) {
+ if ((cbd= Sys.GetClipboardData()) != null) {
//strtok(cbd, "\n\r\b");
- String lines[] = Lib.linesplit(cbd);
+ String lines[]= Lib.linesplit(cbd);
if (lines.length > 0 && lines[0].length() != 0) {
//strncpy(f.buffer, cbd, f.length - 1);
- f.buffer = new StringBuffer(lines[0]);
- f.cursor = f.buffer.length();
+ f.buffer= new StringBuffer(lines[0]);
+ f.cursor= f.buffer.length();
- f.visible_offset = f.cursor - f.visible_length;
+ f.visible_offset= f.cursor - f.visible_length;
if (f.visible_offset < 0)
- f.visible_offset = 0;
+ f.visible_offset= 0;
}
}
return true;
@@ -4627,15 +4649,15 @@ public final class Menu extends Key {
public static void Menu_AddItem(menuframework_s menu, menucommon_s item) {
if (menu.nitems == 0)
- menu.nslots = 0;
+ menu.nslots= 0;
if (menu.nitems < MAXMENUITEMS) {
- menu.items[menu.nitems] = item;
- ((menucommon_s) menu.items[menu.nitems]).parent = menu;
+ menu.items[menu.nitems]= item;
+ ((menucommon_s) menu.items[menu.nitems]).parent= menu;
menu.nitems++;
}
- menu.nslots = Menu_TallySlots(menu);
+ menu.nslots= Menu_TallySlots(menu);
}
/*
@@ -4652,7 +4674,7 @@ public final class Menu extends Key {
** see if it's in a valid spot
*/
if (m.cursor >= 0 && m.cursor < m.nitems) {
- if ((citem = Menu_ItemAtCursor(m)) != null) {
+ if ((citem= Menu_ItemAtCursor(m)) != null) {
if (citem.type != MTYPE_SEPARATOR)
return;
}
@@ -4664,24 +4686,24 @@ public final class Menu extends Key {
*/
if (dir == 1) {
while (true) {
- citem = Menu_ItemAtCursor(m);
+ citem= Menu_ItemAtCursor(m);
if (citem != null)
if (citem.type != MTYPE_SEPARATOR)
break;
m.cursor += dir;
if (m.cursor >= m.nitems)
- m.cursor = 0;
+ m.cursor= 0;
}
}
else {
while (true) {
- citem = Menu_ItemAtCursor(m);
+ citem= Menu_ItemAtCursor(m);
if (citem != null)
if (citem.type != MTYPE_SEPARATOR)
break;
m.cursor += dir;
if (m.cursor < 0)
- m.cursor = m.nitems - 1;
+ m.cursor= m.nitems - 1;
}
}
}
@@ -4689,10 +4711,10 @@ public final class Menu extends Key {
public static void Menu_Center(menuframework_s menu) {
int height;
- height = ((menucommon_s) menu.items[menu.nitems - 1]).y;
+ height= ((menucommon_s) menu.items[menu.nitems - 1]).y;
height += 10;
- menu.y = (viddef.height - height) / 2;
+ menu.y= (viddef.height - height) / 2;
}
public static void Menu_Draw(menuframework_s menu) {
@@ -4702,7 +4724,7 @@ public final class Menu extends Key {
/*
** draw contents
*/
- for (i = 0; i < menu.nitems; i++) {
+ for (i= 0; i < menu.nitems; i++) {
switch (((menucommon_s) menu.items[i]).type) {
case MTYPE_FIELD :
Field_Draw((menufield_s) menu.items[i]);
@@ -4725,7 +4747,7 @@ public final class Menu extends Key {
}
}
- item = Menu_ItemAtCursor(menu);
+ item= Menu_ItemAtCursor(menu);
if (item != null && item.cursordraw != null) {
item.cursordraw.execute(item);
@@ -4758,10 +4780,10 @@ 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 col = maxcol / 2 - l / 2;
+ int l= string.length();
+ int maxrow= viddef.height / 8;
+ int maxcol= viddef.width / 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);
@@ -4774,7 +4796,7 @@ public final class Menu extends Key {
public static void Menu_DrawString(int x, int y, String string) {
int i;
- for (i = 0; i < string.length(); i++) {
+ for (i= 0; i < string.length(); i++) {
re.DrawChar((x + i * 8), y, string.charAt(i));
}
}
@@ -4782,7 +4804,7 @@ public final class Menu extends Key {
public static void Menu_DrawStringDark(int x, int y, String string) {
int i;
- for (i = 0; i < string.length(); i++) {
+ for (i= 0; i < string.length(); i++) {
re.DrawChar((x + i * 8), y, string.charAt(i) + 128);
}
}
@@ -4790,8 +4812,8 @@ public final class Menu extends Key {
public static void Menu_DrawStringR2L(int x, int y, String string) {
int i;
- int l = string.length();
- for (i = 0; i < l; i++) {
+ int l= string.length();
+ for (i= 0; i < l; i++) {
re.DrawChar((x - i * 8), y, string.charAt(l - i - 1));
}
}
@@ -4799,8 +4821,8 @@ public final class Menu extends Key {
public static void Menu_DrawStringR2LDark(int x, int y, String string) {
int i;
- int l = string.length();
- for (i = 0; i < l; i++) {
+ int l= string.length();
+ for (i= 0; i < l; i++) {
re.DrawChar((x - i * 8), y, string.charAt(l - i - 1) + 128);
}
}
@@ -4813,7 +4835,7 @@ public final class Menu extends Key {
}
static boolean Menu_SelectItem(menuframework_s s) {
- menucommon_s item = Menu_ItemAtCursor(s);
+ menucommon_s item= Menu_ItemAtCursor(s);
if (item != null) {
switch (item.type) {
@@ -4834,11 +4856,11 @@ public final class Menu extends Key {
}
public static void Menu_SetStatusBar(menuframework_s m, String string) {
- m.statusbar = string;
+ m.statusbar= string;
}
public static void Menu_SlideItem(menuframework_s s, int dir) {
- menucommon_s item = (menucommon_s) Menu_ItemAtCursor(s);
+ menucommon_s item= (menucommon_s) Menu_ItemAtCursor(s);
if (item != null) {
switch (item.type) {
@@ -4854,12 +4876,12 @@ public final class Menu extends Key {
public static int Menu_TallySlots(menuframework_s menu) {
int i;
- int total = 0;
+ int total= 0;
- for (i = 0; i < menu.nitems; i++) {
+ for (i= 0; i < menu.nitems; i++) {
if (((menucommon_s) menu.items[i]).type == MTYPE_LIST) {
- int nitems = 0;
- String n[] = ((menulist_s) menu.items[i]).itemnames;
+ int nitems= 0;
+ String n[]= ((menulist_s) menu.items[i]).itemnames;
while (n[nitems] != null)
nitems++;
@@ -4877,9 +4899,9 @@ public final class Menu extends Key {
public static void Menulist_DoEnter(menulist_s l) {
int start;
- start = l.y / 10 + 1;
+ start= l.y / 10 + 1;
- l.curvalue = l.parent.cursor - start;
+ l.curvalue= l.parent.cursor - start;
if (l.callback != null)
l.callback.execute(l);
@@ -4887,14 +4909,14 @@ public final class Menu extends Key {
public static void MenuList_Draw(menulist_s l) {
String n[];
- int y = 0;
+ int y= 0;
Menu_DrawStringR2LDark(l.x + l.parent.x + LCOLUMN_OFFSET, l.y + l.parent.y, l.name);
- n = l.itemnames;
+ n= l.itemnames;
re.DrawFill(l.x - 112 + l.parent.x, l.parent.y + l.y + l.curvalue * 10 + 10, 128, 10, 16);
- int i = 0;
+ int i= 0;
while (n[i] != null) {
Menu_DrawStringR2LDark(l.x + l.parent.x + LCOLUMN_OFFSET, l.y + l.parent.y + y + 10, n[i]);
@@ -4913,29 +4935,29 @@ public final class Menu extends Key {
s.curvalue += dir;
if (s.curvalue > s.maxvalue)
- s.curvalue = s.maxvalue;
+ s.curvalue= s.maxvalue;
else if (s.curvalue < s.minvalue)
- s.curvalue = s.minvalue;
+ s.curvalue= s.minvalue;
if (s.callback != null)
s.callback.execute(s);
}
- public static final int SLIDER_RANGE = 10;
+ public static final int SLIDER_RANGE= 10;
public static void Slider_Draw(menuslider_s s) {
int i;
Menu_DrawStringR2LDark(s.x + s.parent.x + LCOLUMN_OFFSET, s.y + s.parent.y, s.name);
- s.range = (s.curvalue - s.minvalue) / (float) (s.maxvalue - s.minvalue);
+ s.range= (s.curvalue - s.minvalue) / (float) (s.maxvalue - s.minvalue);
if (s.range < 0)
- s.range = 0;
+ s.range= 0;
if (s.range > 1)
- s.range = 1;
+ s.range= 1;
re.DrawChar(s.x + s.parent.x + RCOLUMN_OFFSET, s.y + s.parent.y, 128);
- for (i = 0; i < SLIDER_RANGE; i++)
+ for (i= 0; i < SLIDER_RANGE; i++)
re.DrawChar(RCOLUMN_OFFSET + s.x + i * 8 + s.parent.x + 8, s.y + s.parent.y, 129);
re.DrawChar(RCOLUMN_OFFSET + s.x + i * 8 + s.parent.x + 8, s.y + s.parent.y, 130);
re.DrawChar((int) (8 + RCOLUMN_OFFSET + s.parent.x + s.x + (SLIDER_RANGE - 1) * 8 * s.range), s.y + s.parent.y, 131);
@@ -4944,7 +4966,7 @@ public final class Menu extends Key {
public static void SpinControl_DoEnter(menulist_s s) {
s.curvalue++;
if (s.itemnames[s.curvalue] == null)
- s.curvalue = 0;
+ s.curvalue= 0;
if (s.callback != null)
s.callback.execute(s);
@@ -4954,7 +4976,7 @@ public final class Menu extends Key {
s.curvalue += dir;
if (s.curvalue < 0)
- s.curvalue = 0;
+ s.curvalue= 0;
else if (s.itemnames[s.curvalue] == null)
s.curvalue--;
@@ -4975,14 +4997,14 @@ public final class Menu extends Key {
}
else {
String line1, line2;
- line1 = Lib.leftFrom(s.itemnames[s.curvalue], '\n');
+ line1= Lib.leftFrom(s.itemnames[s.curvalue], '\n');
Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, s.y + s.parent.y, line1);
- line2 = Lib.rightFrom(s.itemnames[s.curvalue], '\n');
+ line2= Lib.rightFrom(s.itemnames[s.curvalue], '\n');
- int pos = line2.indexOf('\n');
+ int pos= line2.indexOf('\n');
if (pos != -1)
- line2 = line2.substring(0, pos);
+ line2= line2.substring(0, pos);
Menu_DrawString(RCOLUMN_OFFSET + s.x + s.parent.x, s.y + s.parent.y + 10, line2);
}
diff --git a/src/jake2/game/GameBase.java b/src/jake2/game/GameBase.java
index 871e084..db2b3f0 100644
--- a/src/jake2/game/GameBase.java
+++ b/src/jake2/game/GameBase.java
@@ -19,9 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 30.11.2003 by RST.
-// $Id: GameBase.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
+// $Id: GameBase.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
-/** Father of all Objects. */
+/** Father of all GameObjects. */
package jake2.game;
@@ -441,6 +441,7 @@ public class GameBase extends Globals
*/
public static void G_RunEntity(edict_t ent)
{
+
if (ent.prethink != null)
ent.prethink.think(ent);
diff --git a/src/jake2/game/GameSave.java b/src/jake2/game/GameSave.java
index d399b8c..ba36e06 100644
--- a/src/jake2/game/GameSave.java
+++ b/src/jake2/game/GameSave.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 29.12.2003 by RST.
-// $Id: GameSave.java,v 1.1 2004-07-07 19:59:01 hzi Exp $
+// $Id: GameSave.java,v 1.2 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
@@ -57,6 +57,7 @@ public class GameSave extends GameFunc {
g_edicts = new edict_t[game.maxentities];
for (int i = 0; i < game.maxentities; i++)
g_edicts[i] = new edict_t(i);
+ SV_GAME.ge.edicts = g_edicts;
}
public static void CreateClients() {
@@ -131,16 +132,11 @@ public class GameSave extends GameFunc {
// items
InitItems();
- //Com_sprintf (game.helpmessage1, sizeof(game.helpmessage1), "");
game.helpmessage1 = "";
-
- //Com_sprintf (game.helpmessage2, sizeof(game.helpmessage2), "");
game.helpmessage2 = "";
// initialize all entities for this game
game.maxentities = (int) maxentities.value;
-
- //g_edicts = gi.TagMalloc(game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
CreateEdicts();
globals.edicts = g_edicts;
@@ -149,585 +145,196 @@ public class GameSave extends GameFunc {
// initialize all clients for this game
game.maxclients = (int) maxclients.value;
- //game.clients = gi.TagMalloc(game.maxclients * sizeof(game.clients[0]), TAG_GAME);
CreateClients();
-
+
globals.num_edicts = game.maxclients + 1;
}
- ////=========================================================
- //
- //public static void WriteField1 (FILE *f, field_t field, byte base)
- //{
- // void *p;
- // int len;
- // int index;
- //
- // if (field.flags & FFL_SPAWNTEMP)
- // return;
- //
- // p = (void *)(base + field.ofs);
- // switch (field.type)
- // {
- // case F_INT:
- // case F_FLOAT:
- // case F_ANGLEHACK:
- // case F_VECTOR:
- // case F_IGNORE:
- // break;
- //
- // case F_LSTRING:
- // case F_GSTRING:
- // if ( *(char **)p )
- // len = strlen(*(char **)p) + 1;
- // else
- // len = 0;
- // *(int *)p = len;
- // break;
- // case F_EDICT:
- // if ( *(edict_t **)p == NULL)
- // index = -1;
- // else
- // index = *(edict_t **)p - g_edicts;
- // *(int *)p = index;
- // break;
- // case F_CLIENT:
- // if ( *(gclient_t **)p == NULL)
- // index = -1;
- // else
- // index = *(gclient_t **)p - game.clients;
- // *(int *)p = index;
- // break;
- // case F_ITEM:
- // if ( *(edict_t **)p == NULL)
- // index = -1;
- // else
- // index = *(gitem_t **)p - itemlist;
- // *(int *)p = index;
- // break;
- //
- // //relative to code segment
- // case F_FUNCTION:
- // if (*(byte **)p == NULL)
- // index = 0;
- // else
- // index = *(byte **)p - ((byte *)InitGame);
- // *(int *)p = index;
- // break;
- //
- // //relative to data segment
- // case F_MMOVE:
- // if (*(byte **)p == NULL)
- // index = 0;
- // else
- // index = *(byte **)p - (byte *)&mmove_reloc;
- // *(int *)p = index;
- // break;
- //
- // default:
- // gi.error ("WriteEdict: unknown field type");
- // }
- //}
- //
- //
- //void WriteField2 (FILE *f, field_t *field, byte *base)
- //{
- // int len;
- // void *p;
- //
- // if (field.flags & FFL_SPAWNTEMP)
- // return;
- //
- // p = (void *)(base + field.ofs);
- // switch (field.type)
- // {
- // case F_LSTRING:
- // if ( *(char **)p )
- // {
- // len = strlen(*(char **)p) + 1;
- // fwrite (*(char **)p, len, 1, f);
- // }
- // break;
- // }
- //}
- //
- //void ReadField (FILE *f, field_t *field, byte *base)
- //{
- // void *p;
- // int len;
- // int index;
- //
- // if (field.flags & FFL_SPAWNTEMP)
- // return;
- //
- // p = (void *)(base + field.ofs);
- // switch (field.type)
- // {
- // case F_INT:
- // case F_FLOAT:
- // case F_ANGLEHACK:
- // case F_VECTOR:
- // case F_IGNORE:
- // break;
- //
- // case F_LSTRING:
- // len = *(int *)p;
- // if (!len)
- // *(char **)p = NULL;
- // else
- // {
- // *(char **)p = gi.TagMalloc (len, TAG_LEVEL);
- // fread (*(char **)p, len, 1, f);
- // }
- // break;
- // case F_EDICT:
- // index = *(int *)p;
- // if ( index == -1 )
- // *(edict_t **)p = NULL;
- // else
- // *(edict_t **)p = &g_edicts[index];
- // break;
- // case F_CLIENT:
- // index = *(int *)p;
- // if ( index == -1 )
- // *(gclient_t **)p = NULL;
- // else
- // *(gclient_t **)p = &game.clients[index];
- // break;
- // case F_ITEM:
- // index = *(int *)p;
- // if ( index == -1 )
- // *(gitem_t **)p = NULL;
- // else
- // *(gitem_t **)p = &itemlist[index];
- // break;
- //
- // //relative to code segment
- // case F_FUNCTION:
- // index = *(int *)p;
- // if ( index == 0 )
- // *(byte **)p = NULL;
- // else
- // *(byte **)p = ((byte *)InitGame) + index;
- // break;
- //
- // //relative to data segment
- // case F_MMOVE:
- // index = *(int *)p;
- // if (index == 0)
- // *(byte **)p = NULL;
- // else
- // *(byte **)p = (byte *)&mmove_reloc + index;
- // break;
- //
- // default:
- // gi.error ("ReadEdict: unknown field type");
- // }
- //}
- //
- ////=========================================================
- //
- ///*
- //==============
- //WriteClient
- //
- //All pointer variables (except function pointers) must be handled specially.
- //==============
- //*/
- //void WriteClient (FILE *f, gclient_t *client)
- //{
- // field_t *field;
- // gclient_t temp;
- //
- // // all of the ints, floats, and vectors stay as they are
- // temp = *client;
- //
- // // change the pointers to lengths or indexes
- // for (field=clientfields ; field.name ; field++)
- // {
- // WriteField1 (f, field, (byte *)&temp);
- // }
- //
- // // write the block
- // fwrite (&temp, sizeof(temp), 1, f);
- //
- // // now write any allocated data following the edict
- // for (field=clientfields ; field.name ; field++)
- // {
- // WriteField2 (f, field, (byte *)client);
- // }
- //}
- //
/*
- ==============
- ReadClient
+ ============
+ WriteGame
+
+ This will be called whenever the game goes to a new level,
+ and when the user explicitly saves the game.
- All pointer variables (except function pointers) must be handled specially.
- ==============
+ Game information include cross level data, like multi level
+ triggers, help computer info, and all client states.
+
+ A single player death will automatically restore from the
+ last save position.
+ ============
*/
-
- //} //
-
- /*
- //============
- //WriteGame
- //
- //This will be called whenever the game goes to a new level,
- //and when the user explicitly saves the game.
- //
- //Game information include cross level data, like multi level
- //triggers, help computer info, and all client states.
- //
- //A single player death will automatically restore from the
- //last save position.
- //============
- //*/
- //public static void WriteGame (String filename, boolean autosave)
- //{
- // FILE *f;
- // int i;
- // char str[16];
- //
- // if (!autosave)
- // SaveClientData ();
- //
- // f = fopen (filename, "rw");
- // if (!f)
- // gi.error ("Couldn't open %s", filename);
- //
- // memset (str, 0, sizeof(str));
- // strcpy (str, __DATE__);
- // fwrite (str, sizeof(str), 1, f);
- //
- // game.autosaved = autosave;
- // fwrite (&game, sizeof(game), 1, f);
- // game.autosaved = false;
- //
- // for (i=0 ; i<game.maxclients ; i++)
- // WriteClient (f, &game.clients[i]);
- //
- // fclose (f);
- //}
- //
+ public static void WriteGame (String filename, boolean autosave)
+ {
+ try
+ {
+ QuakeFile f;
+
+ if (!autosave)
+ SaveClientData();
+
+ f = new QuakeFile(filename, "rw");
+
+ if (f == null)
+ gi.error ("Couldn't write to " + filename);
+
+ game.autosaved = autosave;
+ game.write(f);
+ game.autosaved = false;
+
+ for (int i=0 ; i<game.maxclients ; i++)
+ game.clients[i]. write(f);
+
+ fclose (f);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
public static void ReadGame(String filename) {
- RandomAccessFile f = null;
+ QuakeFile f = null;
try {
- f = new RandomAccessFile(filename, "r");
-
- byte buf[] = new byte[(int) f.length()];
-
+ f = new QuakeFile(filename, "r");
Com.Printf("loading game:" + filename);
-
- f.readFully(buf);
-
- ByteBuffer bb = ByteBuffer.wrap(buf);
-
- bb.order(ByteOrder.LITTLE_ENDIAN);
-
CreateEdicts();
- game.load(bb);
- //game.dump();
+ game.load(f);
for (int i = 0; i < game.maxclients; i++) {
game.clients[i] = new gclient_t(i);
- game.clients[i].load(bb);
+ game.clients[i].read(f);
}
- Com.Println("");
- Com.Println("file length:" + f.length());
- Com.Println("processed bytes:" + bb.position());
-
+ f.close();
}
catch (Exception e) {
e.printStackTrace();
- //gi.error ("File problems in "+ filename);
- } //if (!f)
- // gi.error ("Couldn't open %s", filename);
- //
- // fread (str, sizeof(str), 1, f);
- // if (strcmp (str, __DATE__))
- // {
- // fclose (f);
- // gi.error ("Savegame from an older version.\n");
- // }
- //
- // CreateEdicts();
- //
- // fread (game, sizeof(game), 1, f);
- //
- // CreateClients();
- //
- // for (i=0 ; i<game.maxclients ; i++)
- // ReadClient (f, game.clients[i]);
- //
- // fclose (f);
- try {
+ }
+ }
+
+ /*
+ =================
+ WriteLevel
+
+ =================
+ */
+ static void WriteLevel (String filename)
+ {
+ try
+ {
+ int i;
+ edict_t ent;
+ QuakeFile f;
+
+ f= new QuakeFile(filename, "rw");
+ if (f==null)
+ gi.error("Couldn't open for writing: " + filename);
+
+ // write out level_locals_t
+ level.write(f);
+
+ // write out all the entities
+ for (i= 0; i < globals.num_edicts; i++)
+ {
+ ent= g_edicts[i];
+ if (!ent.inuse)
+ continue;
+ f.writeInt(i);
+ ent.write(f);
+
+ }
+
+ i= -1;
+ f.writeInt(-1);
+
f.close();
}
- catch (IOException e) {
- Com.Error(Defines.ERR_DROP, "Unable to load savegame");
+ catch (Exception e)
+ {
+ e.printStackTrace();
}
}
+
+
+ /*
+ =================
+ ReadLevel
+
+ SpawnEntities will allready have been called on the
+ level the same way it was when the level was saved.
+
+ That is necessary to get the baselines
+ set up identically.
+
+ The server will have cleared all of the world links before
+ calling ReadLevel.
+
+ No clients are connected yet.
+ =================
+ */
+ static void ReadLevel (String filename) throws IOException
+ {
+ edict_t ent;
+
+ QuakeFile f = new QuakeFile(filename, "r");
+
+ if (f==null)
+ gi.error ("Couldn't read level file " + filename);
+
+ // wipe all the entities
+ Game.CreateEdicts();
+
+ globals.num_edicts = (int) maxclients.value + 1;
- //
- ////==========================================================
- //
- //
- ///*
- //==============
- //WriteEdict
- //
- //All pointer variables (except function pointers) must be handled specially.
- //==============
- //*/
- //void WriteEdict (FILE *f, edict_t *ent)
- //{
- // field_t *field;
- // edict_t temp;
- //
- // // all of the ints, floats, and vectors stay as they are
- // temp = *ent;
- //
- // // change the pointers to lengths or indexes
- // for (field=fields ; field.name ; field++)
- // {
- // WriteField1 (f, field, (byte *)&temp);
- // }
- //
- // // write the block
- // fwrite (&temp, sizeof(temp), 1, f);
- //
- // // now write any allocated data following the edict
- // for (field=fields ; field.name ; field++)
- // {
- // WriteField2 (f, field, (byte *)ent);
- // }
- //
- //}
- //
- ///*
- //==============
- //WriteLevelLocals
- //
- //All pointer variables (except function pointers) must be handled specially.
- //==============
- //*/
- //void WriteLevelLocals (FILE *f)
- //{
- // field_t *field;
- // level_locals_t temp;
- //
- // // all of the ints, floats, and vectors stay as they are
- // temp = level;
- //
- // // change the pointers to lengths or indexes
- // for (field=levelfields ; field.name ; field++)
- // {
- // WriteField1 (f, field, (byte *)&temp);
- // }
- //
- // // write the block
- // fwrite (&temp, sizeof(temp), 1, f);
- //
- // // now write any allocated data following the edict
- // for (field=levelfields ; field.name ; field++)
- // {
- // WriteField2 (f, field, (byte *)&level);
- // }
- //}
- //
- //
- ///*
- //==============
- //ReadEdict
- //
- //All pointer variables (except function pointers) must be handled specially.
- //==============
- //*/
- //void ReadEdict (FILE *f, edict_t *ent)
- //{
- // field_t *field;
- //
- // fread (ent, sizeof(*ent), 1, f);
- //
- // for (field=fields ; field.name ; field++)
- // {
- // ReadField (f, field, (byte *)ent);
- // }
- //}
- //
- ///*
- //==============
- //ReadLevelLocals
- //
- //All pointer variables (except function pointers) must be handled specially.
- //==============
- //*/
- //void ReadLevelLocals (FILE *f)
- //{
- // field_t *field;
- //
- // fread (&level, sizeof(level), 1, f);
- //
- // for (field=levelfields ; field.name ; field++)
- // {
- // ReadField (f, field, (byte *)&level);
- // }
- //}
- //
- ///*
- //=================
- //WriteLevel
- //
- //=================
- //*/
- //void WriteLevel (char *filename)
- //{
- // int i;
- // edict_t *ent;
- // FILE *f;
- // void *base;
- //
- // f = fopen (filename, "rw");
- // if (!f)
- // gi.error ("Couldn't open %s", filename);
- //
- // // write out edict size for checking
- // i = sizeof(edict_t);
- // fwrite (&i, sizeof(i), 1, f);
- //
- // // write out a function pointer for checking
- // base = (void *)InitGame;
- // fwrite (&base, sizeof(base), 1, f);
- //
- // // write out level_locals_t
- // WriteLevelLocals (f);
- //
- // // write out all the entities
- // for (i=0 ; i<globals.num_edicts ; i++)
- // {
- // ent = &g_edicts[i];
- // if (!ent.inuse)
- // continue;
- // fwrite (&i, sizeof(i), 1, f);
- // WriteEdict (f, ent);
- // }
- // i = -1;
- // fwrite (&i, sizeof(i), 1, f);
- //
- // fclose (f);
- //}
- //
- //
- ///*
- //=================
- //ReadLevel
- //
- //SpawnEntities will allready have been called on the
- //level the same way it was when the level was saved.
- //
- //That is necessary to get the baselines
- //set up identically.
- //
- //The server will have cleared all of the world links before
- //calling ReadLevel.
- //
- //No clients are connected yet.
- //=================
- //*/
- //void ReadLevel (char *filename)
- //{
- // int entnum;
- // FILE *f;
- // int i;
- // void *base;
- // edict_t *ent;
- //
- // f = fopen (filename, "r");
- // if (!f)
- // gi.error ("Couldn't open %s", filename);
- //
- // // free any dynamic memory allocated by loading the level
- // // base state
- // gi.FreeTags (TAG_LEVEL);
- //
- // // wipe all the entities
- // memset (g_edicts, 0, game.maxentities*sizeof(g_edicts[0]));
- // globals.num_edicts = maxclients.value+1;
- //
- // // check edict size
- // fread (&i, sizeof(i), 1, f);
- // if (i != sizeof(edict_t))
- // {
- // fclose (f);
- // gi.error ("ReadLevel: mismatched edict size");
- // }
- //
- // // check function pointer base address
- // fread (&base, sizeof(base), 1, f);
- //#ifdef _WIN32
- // if (base != (void *)InitGame)
- // {
- // fclose (f);
- // gi.error ("ReadLevel: function pointers have moved");
- // }
- //#else
- // gi.dprintf("Function offsets %d\n", ((byte *)base) - ((byte *)InitGame));
- //#endif
- //
- // // load the level locals
- // ReadLevelLocals (f);
- //
- // // load all the entities
- // while (1)
- // {
- // if (fread (&entnum, sizeof(entnum), 1, f) != 1)
- // {
- // fclose (f);
- // gi.error ("ReadLevel: failed to read entnum");
- // }
- // if (entnum == -1)
- // break;
- // if (entnum >= globals.num_edicts)
- // globals.num_edicts = entnum+1;
- //
- // ent = &g_edicts[entnum];
- // ReadEdict (f, ent);
- //
- // // let the server rebuild world links for this ent
- // memset (&ent.area, 0, sizeof(ent.area));
- // gi.linkentity (ent);
- // }
- //
- // fclose (f);
- //
- // // mark all clients as unconnected
- // for (i=0 ; i<maxclients.value ; i++)
- // {
- // ent = &g_edicts[i+1];
- // ent.client = game.clients + i;
- // ent.client.pers.connected = false;
- // }
- //
- // // do any load time things at this point
- // for (i=0 ; i<globals.num_edicts ; i++)
- // {
- // ent = &g_edicts[i];
- //
- // if (!ent.inuse)
- // continue;
- //
- // // fire any cross-level triggers
- // if (ent.classname)
- // if (strcmp(ent.classname, "target_crosslevel_target") == 0)
- // ent.nextthink = level.time + ent.delay;
- // }
- //}
-
+ // load the level locals
+ level.read(f);
+
+ // load all the entities
+ while (true)
+ {
+ int entnum = f.readInt();
+ if (entnum == -1)
+ break;
+
+ if (entnum >= globals.num_edicts)
+ globals.num_edicts = entnum + 1;
+
+ ent = g_edicts[entnum];
+ System.out.println("readint ent" + entnum);
+ ent.read(f);
+ ent.cleararealinks();
+ gi.linkentity(ent);
+ }
+
+ fclose (f);
+
+ // mark all clients as unconnected
+ for (int i=0 ; i<maxclients.value ; i++)
+ {
+ ent = g_edicts[i+1];
+ ent.client = game.clients[i];
+ ent.client.pers.connected = false;
+ }
+
+ // do any load time things at this point
+ for (int i=0 ; i<globals.num_edicts ; i++)
+ {
+ ent = g_edicts[i];
+
+ if (!ent.inuse)
+ continue;
+
+ // fire any cross-level triggers
+ if (ent.classname != null)
+ if (strcmp(ent.classname, "target_crosslevel_target") == 0)
+ ent.nextthink = level.time + ent.delay;
+ }
+ }
}
diff --git a/src/jake2/game/GameUtil.java b/src/jake2/game/GameUtil.java
index a5d81ad..5769564 100644
--- a/src/jake2/game/GameUtil.java
+++ b/src/jake2/game/GameUtil.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 01.11.2003 by RST.
-// $Id: GameUtil.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
+// $Id: GameUtil.java,v 1.4 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
@@ -887,7 +887,6 @@ public class GameUtil extends GameBase
//geht.
static gitem_t FindItem(String pickup_name)
{
- //Com.Printf("FindItem:" + pickup_name + "\n");
for (int i = 1; i < game.num_items; i++)
{
gitem_t it = GameAI.itemlist[i];
diff --git a/src/jake2/game/PlayerClient.java b/src/jake2/game/PlayerClient.java
index a7d06dd..3bb09f0 100644
--- a/src/jake2/game/PlayerClient.java
+++ b/src/jake2/game/PlayerClient.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 28.12.2003 by RST.
-// $Id: PlayerClient.java,v 1.3 2004-07-08 20:24:29 hzi Exp $
+// $Id: PlayerClient.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
@@ -355,9 +355,11 @@ public class PlayerClient extends PlayerHud {
ent = g_edicts[1 + i];
if (!ent.inuse)
continue;
+
game.clients[i].pers.health = ent.health;
game.clients[i].pers.max_health = ent.max_health;
game.clients[i].pers.savedFlags = (ent.flags & (FL_GODMODE | FL_NOTARGET | FL_POWER_ARMOR));
+
if (coop.value != 0)
game.clients[i].pers.score = ent.client.resp.score;
}
@@ -371,13 +373,6 @@ public class PlayerClient extends PlayerHud {
ent.client.resp.score = ent.client.pers.score;
}
- /*
- =======================================================================
-
- SelectSpawnPoint
-
- =======================================================================
- */
/*
================
diff --git a/src/jake2/game/PlayerClientAdapters.java b/src/jake2/game/PlayerClientAdapters.java
index 1f29b88..f6d1e8d 100644
--- a/src/jake2/game/PlayerClientAdapters.java
+++ b/src/jake2/game/PlayerClientAdapters.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 26.02.2004 by RST.
-// $Id: PlayerClientAdapters.java,v 1.1 2004-07-08 15:58:43 hzi Exp $
+// $Id: PlayerClientAdapters.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
@@ -34,7 +34,7 @@ public class PlayerClientAdapters extends PlayerClient {
//
// Gross, ugly, disgustuing hack section
//
-
+
// this function is an ugly as hell hack to fix some map flaws
//
// the coop spawn spots on some maps are SNAFU. There are coop spots
@@ -42,19 +42,19 @@ public class PlayerClientAdapters extends PlayerClient {
//
// we use carnal knowledge of the maps to fix the coop spot targetnames to match
// that of the nearest named single player spot
-
- static EntThinkAdapter SP_FixCoopSpots = new EntThinkAdapter() {
+
+ static EntThinkAdapter SP_FixCoopSpots= new EntThinkAdapter() {
public boolean think(edict_t self) {
-
+
edict_t spot;
- float[] d = { 0, 0, 0 };
-
- spot = null;
- EdictIterator es = null;
-
+ float[] d= { 0, 0, 0 };
+
+ spot= null;
+ EdictIterator es= null;
+
while (true) {
- es = GameBase.G_Find(es, GameBase.findByClass, "info_player_start");
- spot = es.o;
+ es= GameBase.G_Find(es, GameBase.findByClass, "info_player_start");
+ spot= es.o;
if (spot == null)
return true;
if (spot.targetname == null)
@@ -63,7 +63,7 @@ public class PlayerClientAdapters extends PlayerClient {
if (Math3D.VectorLength(d) < 384) {
if ((self.targetname == null) || Lib.Q_stricmp(self.targetname, spot.targetname) != 0) {
// gi.dprintf("FixCoopSpots changed %s at %s targetname from %s to %s\n", self.classname, vtos(self.s.origin), self.targetname, spot.targetname);
- self.targetname = spot.targetname;
+ self.targetname= spot.targetname;
}
return true;
}
@@ -73,74 +73,74 @@ public class PlayerClientAdapters extends PlayerClient {
// now if that one wasn't ugly enough for you then try this one on for size
// some maps don't have any coop spots at all, so we need to create them
// where they should have been
-
- static EntThinkAdapter SP_CreateCoopSpots = new EntThinkAdapter() {
+
+ static EntThinkAdapter SP_CreateCoopSpots= new EntThinkAdapter() {
public boolean think(edict_t self) {
-
+
edict_t spot;
-
+
if (Lib.Q_stricmp(GameBase.level.mapname, "security") == 0) {
- spot = GameUtil.G_Spawn();
- spot.classname = "info_player_coop";
- spot.s.origin[0] = 188 - 64;
- spot.s.origin[1] = -164;
- spot.s.origin[2] = 80;
- spot.targetname = "jail3";
- spot.s.angles[1] = 90;
-
- spot = GameUtil.G_Spawn();
- spot.classname = "info_player_coop";
- spot.s.origin[0] = 188 + 64;
- spot.s.origin[1] = -164;
- spot.s.origin[2] = 80;
- spot.targetname = "jail3";
- spot.s.angles[1] = 90;
-
- spot = GameUtil.G_Spawn();
- spot.classname = "info_player_coop";
- spot.s.origin[0] = 188 + 128;
- spot.s.origin[1] = -164;
- spot.s.origin[2] = 80;
- spot.targetname = "jail3";
- spot.s.angles[1] = 90;
+ spot= GameUtil.G_Spawn();
+ spot.classname= "info_player_coop";
+ spot.s.origin[0]= 188 - 64;
+ spot.s.origin[1]= -164;
+ spot.s.origin[2]= 80;
+ spot.targetname= "jail3";
+ spot.s.angles[1]= 90;
+
+ spot= GameUtil.G_Spawn();
+ spot.classname= "info_player_coop";
+ spot.s.origin[0]= 188 + 64;
+ spot.s.origin[1]= -164;
+ spot.s.origin[2]= 80;
+ spot.targetname= "jail3";
+ spot.s.angles[1]= 90;
+
+ spot= GameUtil.G_Spawn();
+ spot.classname= "info_player_coop";
+ spot.s.origin[0]= 188 + 128;
+ spot.s.origin[1]= -164;
+ spot.s.origin[2]= 80;
+ spot.targetname= "jail3";
+ spot.s.angles[1]= 90;
}
return true;
}
};
//=======================================================================
-
- static EntPainAdapter player_pain = new EntPainAdapter() {
+
+ // player pain is handled at the end of the frame in P_DamageFeedback
+ static EntPainAdapter player_pain= new EntPainAdapter() {
public void pain(edict_t self, edict_t other, float kick, int damage) {
- // player pain is handled at the end of the frame in P_DamageFeedback
- }
+ }
};
- static EntDieAdapter body_die = new EntDieAdapter() {
+ static EntDieAdapter body_die= new EntDieAdapter() {
public void die(edict_t self, edict_t inflictor, edict_t attacker, int damage, float[] point) {
-
+
int n;
-
+
if (self.health < -40) {
GameBase.gi.sound(self, Defines.CHAN_BODY, GameBase.gi.soundindex("misc/udeath.wav"), 1, Defines.ATTN_NORM, 0);
- for (n = 0; n < 4; n++)
+ for (n= 0; n < 4; n++)
GameAI.ThrowGib(self, "models/objects/gibs/sm_meat/tris.md2", damage, Defines.GIB_ORGANIC);
self.s.origin[2] -= 48;
GameAI.ThrowClientHead(self, damage);
- self.takedamage = Defines.DAMAGE_NO;
+ self.takedamage= Defines.DAMAGE_NO;
}
}
};
//==============================================================
-
+
static edict_t pm_passent;
// pmove doesn't need to know about passent and contentmask
- public static pmove_t.TraceAdapter PM_trace = new pmove_t.TraceAdapter() {
-
+ public static pmove_t.TraceAdapter PM_trace= new pmove_t.TraceAdapter() {
+
public trace_t trace(float[] start, float[] mins, float[] maxs, float[] end) {
if (pm_passent.health > 0)
return GameBase.gi.trace(start, mins, maxs, end, pm_passent, Defines.MASK_PLAYERSOLID);
else
return GameBase.gi.trace(start, mins, maxs, end, pm_passent, Defines.MASK_DEADSOLID);
}
-
+
};
}
diff --git a/src/jake2/game/SuperAdapter.java b/src/jake2/game/SuperAdapter.java
index 67285aa..29dcfb5 100644
--- a/src/jake2/game/SuperAdapter.java
+++ b/src/jake2/game/SuperAdapter.java
@@ -19,51 +19,80 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 09.01.2004 by RST.
-// $Id: SuperAdapter.java,v 1.1 2004-07-07 19:59:24 hzi Exp $
+// $Id: SuperAdapter.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import jake2.qcommon.Com;
+import java.util.Hashtable;
import java.util.Vector;
+public class SuperAdapter
+{
-// import jake2.*;
-// import jake2.client.*;
-// import jake2.game.*;
-// import jake2.qcommon.*;
-// import jake2.render.*;
-// import jake2.server.*;
-
-public class SuperAdapter {
-
- // registration
- private static void register(SuperAdapter sa)
+ /** Adapter registration. */
+ private static void register(SuperAdapter sa, String id)
{
- adapters.add(sa);
- //Com.Println("registering adapter " + sa.getID() + " (" + sa.getClass().getSuperclass() + ")");
+ adapters.put(id, sa);
}
-
- private static int id=0;
- private static Vector adapters = new Vector();
-
-
- private static SuperAdapter find(int num)
+
+ /** Adapter repository. */
+ private static Hashtable adapters= new Hashtable();
+
+ /** Returns the adapter from the repository given by its ID. */
+ public static SuperAdapter getFromID(String key)
{
- return (SuperAdapter) adapters.elementAt(num);
+ System.out.println("SuperAdapter.getFromID(\"" + key + "\")");
+ SuperAdapter sa = (SuperAdapter) adapters.get(key);
+
+ // try to create the adapter
+ if (sa == null)
+ {
+ System.out.println("adapter not found:" + key);
+ int pos = key.indexOf('$');
+ String classname = key;
+ if (pos != -1)
+ classname = key.substring(0, pos);
+
+ // load class and instantiate
+ try
+ {
+ System.err.println("loading class " + classname);
+ Class.forName(classname).newInstance();
+ }
+ catch(Exception e)
+ {
+ System.err.println("jake2: class not found:" + classname);
+ }
+
+ // try it again...
+ sa = (SuperAdapter) adapters.get(key);
+
+ if (sa == null)
+ System.err.println("jake2: could not load adapter:" + key);
+ }
+
+ return sa;
}
-
- // constructor
+
+ /** Constructor, does the adapter registration. */
public SuperAdapter()
- {
- adapterid = id++;
- register(this);
+ {
+ StackTraceElement tr[] = new Throwable().getStackTrace();
+ adapterid= tr[2].getClassName();
+ if (adapterid == "")
+ new Throwable("error in creating an adapter id!").printStackTrace();
+ else
+ register(this, adapterid);
}
-
- public int getID()
+
+ /** Returns the Adapter-ID. */
+ public String getID()
{
return adapterid;
}
- private int adapterid;
+ /** Adapter id. */
+ private String adapterid;
}
diff --git a/src/jake2/game/client_persistant_t.java b/src/jake2/game/client_persistant_t.java
index 774cfa4..126d5d5 100644
--- a/src/jake2/game/client_persistant_t.java
+++ b/src/jake2/game/client_persistant_t.java
@@ -19,13 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: client_persistant_t.java,v 1.4 2004-07-12 20:47:01 hzi Exp $
+// $Id: client_persistant_t.java,v 1.5 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import jake2.Defines;
import jake2.util.Lib;
+import jake2.util.QuakeFile;
+import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
public class client_persistant_t {
@@ -89,42 +92,78 @@ public class client_persistant_t {
int helpchanged;
boolean spectator; // client is a spectator
- public void load(ByteBuffer bb) {
- // client persistant_t
- userinfo = Lib.readString(bb, Defines.MAX_INFO_STRING);
- netname = Lib.readString(bb, 16);
+ /** Reads a client_persistant structure from a file. */
+ public void read(QuakeFile f) throws IOException {
+
+ userinfo = f.readString();
+ netname = f.readString();
- hand = bb.getInt();
+ hand = f.readInt();
- connected = bb.getInt() != 0;
- health = bb.getInt();
+ connected = f.readInt() != 0;
+ health = f.readInt();
- max_health = bb.getInt();
- savedFlags = bb.getInt();
- selected_item = bb.getInt();
+ max_health = f.readInt();
+ savedFlags = f.readInt();
+ selected_item = f.readInt();
for (int n = 0; n < Defines.MAX_ITEMS; n++)
- inventory[n] = bb.getInt();
+ inventory[n] = f.readInt();
+
+ max_bullets = f.readInt();
+ max_shells = f.readInt();
+ max_rockets = f.readInt();
+ max_grenades = f.readInt();
+ max_cells = f.readInt();
+ max_slugs = f.readInt();
+
+ weapon = f.readItem();
+ lastweapon = f.readItem();
+ power_cubes = f.readInt();
+ score = f.readInt();
+
+ game_helpchanged = f.readInt();
+ helpchanged = f.readInt();
+ spectator = f.readInt() != 0;
+ }
- max_bullets = bb.getInt();
- max_shells = bb.getInt();
- max_rockets = bb.getInt();
- max_grenades = bb.getInt();
- max_cells = bb.getInt();
- max_slugs = bb.getInt();
+ /** Writes a client_persistant structure to a file. */
+ public void write(QuakeFile f) throws IOException {
+ // client persistant_t
+ f.writeString(userinfo);
+ f.writeString(netname);
- weapon = GameAI.itemlist[bb.getInt()];
- lastweapon = GameAI.itemlist[bb.getInt()];
- power_cubes = bb.getInt();
- score = bb.getInt();
+ f.writeInt(hand);
- game_helpchanged = bb.getInt();
- helpchanged = bb.getInt();
- spectator = bb.getInt() != 0;
+ f.writeInt(connected ? 1:0);
+ f.writeInt(health);
+ f.writeInt(max_health);
+ f.writeInt(savedFlags);
+ f.writeInt(selected_item);
+
+ for (int n = 0; n < Defines.MAX_ITEMS; n++)
+ f.writeInt(inventory[n]);
+
+ f.writeInt(max_bullets);
+ f.writeInt(max_shells);
+ f.writeInt(max_rockets);
+ f.writeInt(max_grenades);
+ f.writeInt(max_cells);
+ f.writeInt(max_slugs);
+
+ f.writeItem(weapon);
+ f.writeItem(lastweapon);
+ f.writeInt(power_cubes);
+ f.writeInt(score);
+
+ f.writeInt(game_helpchanged);
+ f.writeInt(helpchanged);
+ f.writeInt(spectator?1:0);
}
+
public void dump() {
// client persistant_t
diff --git a/src/jake2/game/client_respawn_t.java b/src/jake2/game/client_respawn_t.java
index 722d609..26e69a2 100644
--- a/src/jake2/game/client_respawn_t.java
+++ b/src/jake2/game/client_respawn_t.java
@@ -18,26 +18,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: client_respawn_t.java,v 1.4 2004-07-12 20:47:01 hzi Exp $
+// $Id: client_respawn_t.java,v 1.5 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
import jake2.qcommon.Com;
import jake2.util.Lib;
import jake2.util.Math3D;
+import jake2.util.QuakeFile;
import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
+/** Client data that stays across deathmatch respawns.*/
public class client_respawn_t
-// client data that stays across deathmatch respawns
+
{
- client_persistant_t coop_respawn = new client_persistant_t(); // what to set client->pers to on a respawn
- int enterframe; // level.framenum the client entered the game
- int score; // frags, etc
- float cmd_angles[] = { 0, 0, 0 }; // angles sent over in the last command
- boolean spectator; // client is a spectator
+ /** What to set client->pers to on a respawn */
+ protected client_persistant_t coop_respawn = new client_persistant_t();
+
+ /** Level.framenum the client entered the game. */
+ protected int enterframe;
+
+ /** frags, etc. */
+ protected int score;
+
+ /** angles sent over in the last command. */
+ protected float cmd_angles[] = { 0, 0, 0 };
+
+ /** client is a spectator. */
+ protected boolean spectator;
+
+ /** Copies the client respawn data. */
public void set(client_respawn_t from)
{
coop_respawn.set(from.coop_respawn);
@@ -47,7 +61,7 @@ public class client_respawn_t
spectator = from.spectator;
}
- //ok
+ /** Clears the client reaspawn informations. */
public void clear()
{
coop_respawn = new client_persistant_t();
@@ -57,17 +71,33 @@ public class client_respawn_t
spectator = false;
}
- public void load(ByteBuffer bb) throws IOException
+ /** Reads a client_respawn from a file. */
+ public void read(QuakeFile f) throws IOException
+ {
+ coop_respawn.read(f);
+ enterframe = f.readInt();
+ score = f.readInt();
+ cmd_angles[0] = f.readFloat();
+ cmd_angles[1] = f.readFloat();
+ cmd_angles[2] = f.readFloat();
+ spectator = f.readInt() != 0;
+ }
+
+ /** Writes a client_respawn to a file. */
+ public void write(QuakeFile f) throws IOException
{
- coop_respawn.load(bb);
- enterframe = bb.getInt();
- score = bb.getInt();
- cmd_angles[0] = bb.getFloat();
- cmd_angles[1] = bb.getFloat();
- cmd_angles[2] = bb.getFloat();
- spectator = bb.getInt() != 0;
+ coop_respawn.write(f);
+ f.writeInt(enterframe);
+ f.writeInt(score);
+ f.writeFloat(cmd_angles[0]);
+ f.writeFloat(cmd_angles[1]);
+ f.writeFloat(cmd_angles[2]);
+ f.writeInt(spectator?1:0);
}
+
+
+ /** Prints out a client_respawn_t to the quake console.*/
public void dump()
{
coop_respawn.dump();
diff --git a/src/jake2/game/edict_t.java b/src/jake2/game/edict_t.java
index 229b18b..a132072 100644
--- a/src/jake2/game/edict_t.java
+++ b/src/jake2/game/edict_t.java
@@ -18,111 +18,130 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+// Created on 04.11.2003 by RST.
+// $Id: edict_t.java,v 1.3 2004-08-20 21:29:57 salomo Exp $
+
package jake2.game;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
import jake2.*;
import jake2.util.*;
-public class edict_t {
-
- public edict_t(int i) {
- s.number = i;
- index = i;
+public class edict_t
+{
+
+ /** Constructor. */
+ public edict_t(int i)
+ {
+ s.number= i;
+ index= i;
}
- public void clear() {
+ /** Used during level loading. */
+ public void cleararealinks()
+ {
+ area= new link_t(this);
}
- // integrated entity state
- public entity_state_t s = new entity_state_t(this);
+ /** Integrated entity state. */
+ public entity_state_t s= new entity_state_t(this);
public boolean inuse;
public int linkcount;
- // FIXME: move these fields to a server private sv_entity_t
- public link_t area = new link_t(this); // linked to a division node or leaf
+ /** FIXME: move these fields to a server private sv_entity_t.
+ * linked to a division node or leaf. */
+ public link_t area= new link_t(this);
+
+ /** if -1, use headnode instead.*/
+ public int num_clusters;
+ public int clusternums[]= new int[Defines.MAX_ENT_CLUSTERS];
- public int num_clusters; // if -1, use headnode instead
- public int clusternums[] = new int[Defines.MAX_ENT_CLUSTERS];
- public int headnode; // unused if num_clusters != -1
+ /** unused if num_clusters != -1. */
+ public int headnode;
public int areanum, areanum2;
//================================
- public int svflags; // SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc
- public float[] mins = { 0, 0, 0 };
- public float[] maxs = { 0, 0, 0 };
- public float[] absmin = { 0, 0, 0 };
- public float[] absmax = { 0, 0, 0 };
- public float[] size = { 0, 0, 0 };
+ /** SVF_NOCLIENT, SVF_DEADMONSTER, SVF_MONSTER, etc. */
+ public int svflags;
+ public float[] mins= { 0, 0, 0 };
+ public float[] maxs= { 0, 0, 0 };
+ public float[] absmin= { 0, 0, 0 };
+ public float[] absmax= { 0, 0, 0 };
+ public float[] size= { 0, 0, 0 };
public int solid;
public int clipmask;
- // the game dll can add anything it wants after
- // this point in the structure
- // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
- // EXPECTS THE FIELDS IN THAT ORDER!
-
//================================
public int movetype;
public int flags;
- public String model = null;
- public float freetime; // sv.time when the object was freed
+ public String model= null;
+
+ /** sv.time when the object was freed. */
+ public float freetime;
//
// only used locally in game, not by server
//
- public String message = null;
- public String classname = "";
+ public String message= null;
+ public String classname= "";
public int spawnflags;
public float timestamp;
- // set in qe3, -1 = up, -2 = down
+ /** set in qe3, -1 = up, -2 = down */
public float angle;
- public String target = null;
- public String targetname = null;
- public String killtarget = null;
- public String team = null;
- public String pathtarget = null;
- public String deathtarget = null;
- public String combattarget = null;
+ public String target= null;
+ public String targetname= null;
+ public String killtarget= null;
+ public String team= null;
+ public String pathtarget= null;
+ public String deathtarget= null;
+ public String combattarget= null;
- public edict_t target_ent = null;
+ public edict_t target_ent= null;
public float speed, accel, decel;
- public float[] movedir = { 0, 0, 0 };
+ public float[] movedir= { 0, 0, 0 };
- public float[] pos1 = { 0, 0, 0 };
- public float[] pos2 = { 0, 0, 0 };
+ public float[] pos1= { 0, 0, 0 };
+ public float[] pos2= { 0, 0, 0 };
- public float[] velocity = { 0, 0, 0 };
- public float[] avelocity = { 0, 0, 0 };
+ public float[] velocity= { 0, 0, 0 };
+ public float[] avelocity= { 0, 0, 0 };
public int mass;
public float air_finished;
- public float gravity; // per entity gravity multiplier (1.0 is normal)
- // use for lowgrav artifact, flares
- public edict_t goalentity = null;
- public edict_t movetarget = null;
+ /** per entity gravity multiplier (1.0 is normal). */
+ public float gravity;
+ /** use for lowgrav artifact, flares. */
+
+ public edict_t goalentity= null;
+ public edict_t movetarget= null;
public float yaw_speed;
public float ideal_yaw;
public float nextthink;
- public EntThinkAdapter prethink = null;
- public EntThinkAdapter think = null;
- public EntBlockedAdapter blocked = null;
- public EntTouchAdapter touch = null;
- public EntUseAdapter use = null;
- public EntPainAdapter pain = null;
- public EntDieAdapter die = null;
+ public EntThinkAdapter prethink= null;
+ public EntThinkAdapter think= null;
+ public EntBlockedAdapter blocked= null;
+ public EntTouchAdapter touch= null;
+ public EntUseAdapter use= null;
+ public EntPainAdapter pain= null;
+ public EntDieAdapter die= null;
- public float touch_debounce_time; // are all these legit? do we need more/less of them?
+ /** Are all these legit? do we need more/less of them? */
+ public float touch_debounce_time;
public float pain_debounce_time;
public float damage_debounce_time;
- public float fly_sound_debounce_time; //move to clientinfo
+
+ /** Move to clientinfo.*/
+ public float fly_sound_debounce_time;
public float last_move_time;
public int health;
@@ -133,37 +152,42 @@ public class edict_t {
public float powerarmor_time;
- public String map = null;
- ; // target_changelevel
+ /** target_changelevel. */
+ public String map= null;
- public int viewheight; // height above origin where eyesight is determined
+ /** Height above origin where eyesight is determined. */
+ public int viewheight;
public int takedamage;
public int dmg;
public int radius_dmg;
public float dmg_radius;
- public int sounds; //make this a spawntemp var?
+
+ /** make this a spawntemp var? */
+ public int sounds;
public int count;
- public edict_t chain = null;
- public edict_t enemy = null;
- public edict_t oldenemy = null;
- public edict_t activator = null;
- public edict_t groundentity = null;
+ public edict_t chain= null;
+ public edict_t enemy= null;
+ public edict_t oldenemy= null;
+ public edict_t activator= null;
+ public edict_t groundentity= null;
public int groundentity_linkcount;
- public edict_t teamchain = null;
- public edict_t teammaster = null;
+ public edict_t teamchain= null;
+ public edict_t teammaster= null;
- public edict_t mynoise = null; // can go in client only
- public edict_t mynoise2 = null;
+ /** can go in client only. */
+ public edict_t mynoise= null;
+ public edict_t mynoise2= null;
public int noise_index;
public int noise_index2;
public float volume;
public float attenuation;
- // timing variables
+ /** Timing variables. */
public float wait;
- public float delay; // before firing targets
+ /** before firing targets...*/
+ public float delay;
public float random;
public float teleport_time;
@@ -171,298 +195,557 @@ public class edict_t {
public int watertype;
public int waterlevel;
- public float[] move_origin = { 0, 0, 0 };
+ public float[] move_origin= { 0, 0, 0 };
- public float[] move_angles = { 0, 0, 0 };
+ public float[] move_angles= { 0, 0, 0 };
- // move this to clientinfo?
+ /** move this to clientinfo? .*/
public int light_level;
- public int style; // also used as areaportal number
+ /** also used as areaportal number. */
+ public int style;
public gitem_t item; // for bonus items
- // common integrated data blocks
- public moveinfo_t moveinfo = new moveinfo_t();
- public monsterinfo_t monsterinfo = new monsterinfo_t();
+ /** common integrated data blocks. */
+ public moveinfo_t moveinfo= new moveinfo_t();
+ public monsterinfo_t monsterinfo= new monsterinfo_t();
public gclient_t client;
public edict_t owner;
-
- public int index; //introduced by rst
-
+
+ /** Introduced by rst. */
+ public int index;
/////////////////////////////////////////////////
- public boolean set(String key, String value) {
+ public boolean set(String key, String value)
+ {
- if (key.equals("classname")) {
- classname = GameSpawn.ED_NewString(value);
+ if (key.equals("classname"))
+ {
+ classname= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("model")) {
- model = GameSpawn.ED_NewString(value);
+ if (key.equals("model"))
+ {
+ model= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("spawnflags")) {
- spawnflags = Lib.atoi(value);
+ if (key.equals("spawnflags"))
+ {
+ spawnflags= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("speed")) {
- speed = Lib.atof(value);
+ if (key.equals("speed"))
+ {
+ speed= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("accel")) {
- accel = Lib.atof(value);
+ if (key.equals("accel"))
+ {
+ accel= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("decel")) {
- decel = Lib.atof(value);
+ if (key.equals("decel"))
+ {
+ decel= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("target")) {
- target = GameSpawn.ED_NewString(value);
+ if (key.equals("target"))
+ {
+ target= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("targetname")) {
- targetname = GameSpawn.ED_NewString(value);
+ if (key.equals("targetname"))
+ {
+ targetname= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("pathtarget")) {
- pathtarget = GameSpawn.ED_NewString(value);
+ if (key.equals("pathtarget"))
+ {
+ pathtarget= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("deathtarget")) {
- deathtarget = GameSpawn.ED_NewString(value);
+ if (key.equals("deathtarget"))
+ {
+ deathtarget= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("killtarget")) {
- killtarget = GameSpawn.ED_NewString(value);
+ if (key.equals("killtarget"))
+ {
+ killtarget= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("combattarget")) {
- combattarget = GameSpawn.ED_NewString(value);
+ if (key.equals("combattarget"))
+ {
+ combattarget= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("message")) {
- message = GameSpawn.ED_NewString(value);
+ if (key.equals("message"))
+ {
+ message= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("team")) {
- team = GameSpawn.ED_NewString(value);
+ if (key.equals("team"))
+ {
+ team= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("wait")) {
- wait = Lib.atof(value);
+ if (key.equals("wait"))
+ {
+ wait= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("delay")) {
- delay = Lib.atof(value);
+ if (key.equals("delay"))
+ {
+ delay= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("random")) {
- random = Lib.atof(value);
+ if (key.equals("random"))
+ {
+ random= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("move_origin")) {
- move_origin = Lib.atov(value);
+ if (key.equals("move_origin"))
+ {
+ move_origin= Lib.atov(value);
return true;
} // F_VECTOR),
- if (key.equals("move_angles")) {
- move_angles = Lib.atov(value);
+ if (key.equals("move_angles"))
+ {
+ move_angles= Lib.atov(value);
return true;
} // F_VECTOR),
- if (key.equals("style")) {
- style = Lib.atoi(value);
+ if (key.equals("style"))
+ {
+ style= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("count")) {
- count = Lib.atoi(value);
+ if (key.equals("count"))
+ {
+ count= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("health")) {
- health = Lib.atoi(value);
+ if (key.equals("health"))
+ {
+ health= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("sounds")) {
- sounds = Lib.atoi(value);
+ if (key.equals("sounds"))
+ {
+ sounds= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("light")) {
+ if (key.equals("light"))
+ {
return true;
} // F_IGNORE),
- if (key.equals("dmg")) {
- dmg = Lib.atoi(value);
+ if (key.equals("dmg"))
+ {
+ dmg= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("mass")) {
- mass = Lib.atoi(value);
+ if (key.equals("mass"))
+ {
+ mass= Lib.atoi(value);
return true;
} // F_INT),
- if (key.equals("volume")) {
- volume = Lib.atof(value);
+ if (key.equals("volume"))
+ {
+ volume= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("attenuation")) {
- attenuation = Lib.atof(value);
+ if (key.equals("attenuation"))
+ {
+ attenuation= Lib.atof(value);
return true;
} // F_FLOAT),
- if (key.equals("map")) {
- map = GameSpawn.ED_NewString(value);
+ if (key.equals("map"))
+ {
+ map= GameSpawn.ED_NewString(value);
return true;
} // F_LSTRING),
- if (key.equals("origin")) {
- s.origin = Lib.atov(value);
+ if (key.equals("origin"))
+ {
+ s.origin= Lib.atov(value);
return true;
} // F_VECTOR),
- if (key.equals("angles")) {
- s.angles = Lib.atov(value);
+ if (key.equals("angles"))
+ {
+ s.angles= Lib.atov(value);
return true;
} // F_VECTOR),
- if (key.equals("angle")) {
- s.angles = new float[] { 0, Lib.atof(value), 0 };
+ if (key.equals("angle"))
+ {
+ s.angles= new float[] { 0, Lib.atof(value), 0 };
return true;
} // F_ANGLEHACK),
- /* --- NOSPAWN ---
- if (key.equals("goalentity")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
-
- if (key.equals("movetarget")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
-
- if (key.equals("enemy")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
-
- if (key.equals("oldenemy")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
-
- if (key.equals("activator")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
-
- if (key.equals("groundentity")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("teamchain")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("teammaster")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("owner")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("mynoise")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("mynoise2")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("target_ent")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("chain")) {
- return true;
- } // F_EDICT, FFL_NOSPAWN),
- if (key.equals("prethink")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("think")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("blocked")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("touch")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("use")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("pain")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("die")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("stand")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("idle")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("search")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("walk")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("run")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("dodge")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("attack")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("melee")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("sight")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("checkattack")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
- if (key.equals("currentmove")) {
- return true;
- } // F_MMOVE, FFL_NOSPAWN),
- if (key.equals("endfunc")) {
- return true;
- } // F_FUNCTION, FFL_NOSPAWN),
-
- */
- if (key.equals("item")) {
+ if (key.equals("item"))
+ {
Game.gi.error("ent.set(\"item\") called.");
return true;
} // F_ITEM)
return false;
}
+
+ /** Writes the entity to the file. */
+ public void write(QuakeFile f) throws IOException
+ {
+
+ s.write(f);
+ f.writeBoolean(inuse);
+ f.writeInt(linkcount);
+ f.writeInt(num_clusters);
+
+ f.writeInt(9999);
+
+ if (clusternums == null)
+ f.writeInt(-1);
+ else
+ {
+ f.writeInt(Defines.MAX_ENT_CLUSTERS);
+ for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++)
+ f.writeInt(clusternums[n]);
+
+ }
+ f.writeInt(headnode);
+ f.writeInt(areanum);
+ f.writeInt(areanum2);
+ f.writeInt(svflags);
+ f.writeVector(mins);
+ f.writeVector(maxs);
+ f.writeVector(absmin);
+ f.writeVector(absmax);
+ f.writeVector(size);
+ f.writeInt(solid);
+ f.writeInt(clipmask);
+
+ f.writeInt(movetype);
+ f.writeInt(flags);
+
+ f.writeString(model);
+ f.writeFloat(freetime);
+ f.writeString(message);
+ f.writeString(classname);
+ f.writeInt(spawnflags);
+ f.writeFloat(timestamp);
+
+ f.writeFloat(angle);
+
+ f.writeString(target);
+ f.writeString(targetname);
+ f.writeString(team);
+ f.writeString(pathtarget);
+ f.writeString(deathtarget);
+ f.writeString(combattarget);
+
+ f.writeEdictRef(target_ent);
+
+ f.writeFloat(speed);
+ f.writeFloat(accel);
+ f.writeFloat(decel);
+
+ f.writeVector(movedir);
+
+ f.writeVector(pos1);
+ f.writeVector(pos2);
+
+ f.writeVector(velocity);
+ f.writeVector(avelocity);
+
+ f.writeInt(mass);
+ f.writeFloat(air_finished);
+
+ f.writeFloat(gravity);
+
+ f.writeEdictRef(goalentity);
+ f.writeEdictRef(movetarget);
+
+ f.writeFloat(yaw_speed);
+ f.writeFloat(ideal_yaw);
+
+ f.writeFloat(nextthink);
+
+ f.writeAdapter(prethink);
+ f.writeAdapter(think);
+ f.writeAdapter(blocked);
+
+ f.writeAdapter(touch);
+ f.writeAdapter(use);
+ f.writeAdapter(pain);
+ f.writeAdapter(die);
+
+ f.writeFloat(touch_debounce_time);
+ f.writeFloat(pain_debounce_time);
+ f.writeFloat(damage_debounce_time);
+
+ f.writeFloat(fly_sound_debounce_time);
+ f.writeFloat(last_move_time);
+
+ f.writeInt(health);
+ f.writeInt(max_health);
+
+ f.writeInt(gib_health);
+ f.writeInt(deadflag);
+ f.writeInt(show_hostile);
+
+ f.writeFloat(powerarmor_time);
+
+ f.writeString(map);
+
+ f.writeInt(viewheight);
+ f.writeInt(takedamage);
+ f.writeInt(dmg);
+ f.writeInt(radius_dmg);
+ f.writeFloat(dmg_radius);
+
+ f.writeInt(sounds);
+ f.writeInt(count);
+
+ f.writeEdictRef(chain);
+ f.writeEdictRef(enemy);
+ f.writeEdictRef(oldenemy);
+ f.writeEdictRef(activator);
+ f.writeEdictRef(groundentity);
+ f.writeInt(groundentity_linkcount);
+ f.writeEdictRef(teamchain);
+ f.writeEdictRef(teammaster);
+
+ f.writeEdictRef(mynoise);
+ f.writeEdictRef(mynoise2);
+
+ f.writeInt(noise_index);
+ f.writeInt(noise_index2);
+
+ f.writeFloat(volume);
+ f.writeFloat(attenuation);
+ f.writeFloat(wait);
+ f.writeFloat(delay);
+ f.writeFloat(random);
+
+ f.writeFloat(teleport_time);
+
+ f.writeInt(watertype);
+ f.writeInt(waterlevel);
+ f.writeVector(move_origin);
+ f.writeVector(move_angles);
+
+ f.writeInt(light_level);
+ f.writeInt(style);
+
+ f.writeItem(item);
+
+ moveinfo.write(f);
+ monsterinfo.write(f);
+ if (client == null)
+ f.writeInt(-1);
+ else
+ f.writeInt(client.index);
+
+ f.writeEdictRef(owner);
+
+ // rst's checker :-)
+ f.writeInt(9876);
+ }
+
+ /** Reads the entity from the file.*/
+ public void read(QuakeFile f) throws IOException
+ {
+ s.read(f);
+ inuse= f.readBoolean();
+ linkcount= f.readInt();
+ num_clusters= f.readInt();
+
+ if (f.readInt() != 9999)
+ new Throwable("wrong read pos!").printStackTrace();
+
+ int len= f.readInt();
+
+ if (len == -1)
+ clusternums= null;
+ else
+ {
+ clusternums= new int[Defines.MAX_ENT_CLUSTERS];
+ for (int n= 0; n < Defines.MAX_ENT_CLUSTERS; n++)
+ clusternums[n]= f.readInt();
+ }
+
+ headnode= f.readInt();
+ areanum= f.readInt();
+ areanum2= f.readInt();
+ svflags= f.readInt();
+ mins= f.readVector();
+ maxs= f.readVector();
+ absmin= f.readVector();
+ absmax= f.readVector();
+ size= f.readVector();
+ solid= f.readInt();
+ clipmask= f.readInt();
+
+ movetype= f.readInt();
+ flags= f.readInt();
+
+ model= f.readString();
+ freetime= f.readFloat();
+ message= f.readString();
+ classname= f.readString();
+ spawnflags= f.readInt();
+ timestamp= f.readFloat();
+
+ angle= f.readFloat();
+
+ target= f.readString();
+ targetname= f.readString();
+ team= f.readString();
+ pathtarget= f.readString();
+ deathtarget= f.readString();
+ combattarget= f.readString();
+
+ target_ent= f.readEdictRef();
+
+ speed= f.readFloat();
+ accel= f.readFloat();
+ decel= f.readFloat();
+
+ movedir= f.readVector();
+
+ pos1= f.readVector();
+ pos2= f.readVector();
+
+ velocity= f.readVector();
+ avelocity= f.readVector();
+
+ mass= f.readInt();
+ air_finished= f.readFloat();
+
+ gravity= f.readFloat();
+
+ goalentity= f.readEdictRef();
+ movetarget= f.readEdictRef();
+
+ yaw_speed= f.readFloat();
+ ideal_yaw= f.readFloat();
+
+ nextthink= f.readFloat();
+
+ prethink= (EntThinkAdapter) f.readAdapter();
+ think= (EntThinkAdapter) f.readAdapter();
+ blocked= (EntBlockedAdapter) f.readAdapter();
+
+ touch= (EntTouchAdapter) f.readAdapter();
+ use= (EntUseAdapter) f.readAdapter();
+ pain= (EntPainAdapter) f.readAdapter();
+ die= (EntDieAdapter) f.readAdapter();
+
+ touch_debounce_time= f.readFloat();
+ pain_debounce_time= f.readFloat();
+ damage_debounce_time= f.readFloat();
+
+ fly_sound_debounce_time= f.readFloat();
+ last_move_time= f.readFloat();
+
+ health= f.readInt();
+ max_health= f.readInt();
+
+ gib_health= f.readInt();
+ deadflag= f.readInt();
+ show_hostile= f.readInt();
+
+ powerarmor_time= f.readFloat();
+
+ map= f.readString();
+
+ viewheight= f.readInt();
+ takedamage= f.readInt();
+ dmg= f.readInt();
+ radius_dmg= f.readInt();
+ dmg_radius= f.readFloat();
+
+ sounds= f.readInt();
+ count= f.readInt();
+
+ chain= f.readEdictRef();
+ enemy= f.readEdictRef();
+
+ oldenemy= f.readEdictRef();
+ activator= f.readEdictRef();
+ groundentity= f.readEdictRef();
+ if (index == 145)
+ System.out.println("loadground:" + groundentity);
+ groundentity_linkcount= f.readInt();
+ teamchain= f.readEdictRef();
+ teammaster= f.readEdictRef();
+
+ mynoise= f.readEdictRef();
+ mynoise2= f.readEdictRef();
+
+ noise_index= f.readInt();
+ noise_index2= f.readInt();
+
+ volume= f.readFloat();
+ attenuation= f.readFloat();
+ wait= f.readFloat();
+ delay= f.readFloat();
+ random= f.readFloat();
+
+ teleport_time= f.readFloat();
+
+ watertype= f.readInt();
+ waterlevel= f.readInt();
+ move_origin= f.readVector();
+ move_angles= f.readVector();
+
+ light_level= f.readInt();
+ style= f.readInt();
+
+ item= f.readItem();
+
+ moveinfo.read(f);
+ monsterinfo.read(f);
+
+ int ndx= f.readInt();
+ if (ndx == -1)
+ client= null;
+ else
+ client= Game.game.clients[ndx];
+
+ owner= f.readEdictRef();
+
+ // rst's checker :-)
+ if (f.readInt() != 9876)
+ System.err.println("ent load check failed for num " + index);
+ }
}
diff --git a/src/jake2/game/entity_state_t.java b/src/jake2/game/entity_state_t.java
index 25c3162..e4e7b68 100644
--- a/src/jake2/game/entity_state_t.java
+++ b/src/jake2/game/entity_state_t.java
@@ -19,33 +19,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 08.11.2003 by RST.
-// $Id: entity_state_t.java,v 1.2 2004-07-08 15:58:43 hzi Exp $
+// $Id: entity_state_t.java,v 1.3 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
import jake2.util.Math3D;
+import jake2.util.QuakeFile;
public class entity_state_t implements Cloneable
{
- // entity_state_t is the information conveyed from the server
- // in an update message about entities that the client will
- // need to render in some way
-
+ /** entity_state_t is the information conveyed from the server
+ in an update message about entities that the client will
+ need to render in some way. */
public entity_state_t(edict_t ent)
{
this.surrounding_ent = ent;
}
- public int number = -99999; // edict index
+ /** edict index. */
+ public int number = -99999;
public edict_t surrounding_ent = null;
public float[] origin = { 0, 0, 0 };
public float[] angles = { 0, 0, 0 };
- public float[] old_origin = { 0, 0, 0 }; // for lerping
+
+ /** for lerping. */
+ public float[] old_origin = { 0, 0, 0 };
public int modelindex;
- public int modelindex2, modelindex3, modelindex4; // weapons, CTF flags, etc.
+ /** weapons, CTF flags, etc. */
+ public int modelindex2, modelindex3, modelindex4;
public int frame;
public int skinnum;
- public int effects; // PGM - we're filling it, so it needs to be unsigned
+ /** PGM - we're filling it, so it needs to be unsigned. */
+ public int effects;
public int renderfx;
public int solid;
// for client side prediction, 8*(bits 0-4) is x/y radius
@@ -56,6 +64,60 @@ public class entity_state_t implements Cloneable
// events only go out for a single frame, they
// are automatically cleared each frame
+ /** Writes the entity state to the file. */
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeEdictRef(surrounding_ent);
+ f.writeVector(origin);
+ f.writeVector(angles);
+ f.writeVector(old_origin);
+
+ f.writeInt(modelindex);
+
+ f.writeInt(modelindex2);
+ f.writeInt(modelindex3);
+ f.writeInt(modelindex4);
+
+ f.writeInt(frame);
+ f.writeInt(skinnum);
+
+ f.writeInt(effects);
+ f.writeInt(renderfx);
+ f.writeInt(solid);
+
+ f.writeInt(sound);
+ f.writeInt(event);
+
+ }
+
+ /** Reads the entity state from the file. */
+ public void read(QuakeFile f) throws IOException
+ {
+ surrounding_ent = f.readEdictRef();
+ origin = f.readVector();
+ angles = f.readVector();
+ old_origin = f.readVector();
+
+ modelindex = f.readInt();
+
+ modelindex2= f.readInt();
+ modelindex3= f.readInt();
+ modelindex4= f.readInt();
+
+ frame = f.readInt();
+ skinnum = f.readInt();
+
+ effects = f.readInt();
+ renderfx = f.readInt();
+ solid = f.readInt();
+
+ sound = f.readInt();
+ event = f.readInt();
+
+
+ }
+
+
public entity_state_t getClone()
{
entity_state_t out = new entity_state_t(this.surrounding_ent);
diff --git a/src/jake2/game/game_export_t.java b/src/jake2/game/game_export_t.java
index 9dabf51..38df9db 100644
--- a/src/jake2/game/game_export_t.java
+++ b/src/jake2/game/game_export_t.java
@@ -19,11 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: game_export_t.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
+// $Id: game_export_t.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
import jake2.qcommon.Com;
+import jake2.util.QuakeFile;
//
//functions exported by the game subsystem
@@ -58,8 +63,7 @@ public class game_export_t
// ReadGame is called on a loadgame.
public void WriteGame(String filename, boolean autosave)
{
- // TODO WriteGame not implemented.
- Com.Println("WriteGame not implemented.");
+ GameSave.WriteGame(filename, autosave);
}
public void ReadGame(String filename)
@@ -71,28 +75,43 @@ public class game_export_t
// loaded with SpawnEntities
public void WriteLevel(String filename)
{
- // TODO WriteLevel not implemented.
- Com.Println("WriteLevel not implemented.");
+ try
+ {
+ GameSave.WriteLevel(filename);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
public void ReadLevel(String filename)
{
- // TODO ReadLevel not implemented.
- Com.Println("ReadLevel not implemented.");
+ try
+ {
+ GameSave.ReadLevel(filename);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
public boolean ClientConnect(edict_t ent, String userinfo)
{
return PlayerClient.ClientConnect(ent, userinfo);
}
+
public void ClientBegin(edict_t ent)
{
PlayerClient.ClientBegin(ent);
}
+
public void ClientUserinfoChanged(edict_t ent, String userinfo)
{
PlayerClient.ClientUserinfoChanged(ent, userinfo);
}
+
public void ClientDisconnect(edict_t ent)
{
PlayerClient.ClientDisconnect(ent);
@@ -132,4 +151,4 @@ public class game_export_t
public edict_t edicts[] = Game.g_edicts;
public int num_edicts; // current number, <= max_edicts
public int max_edicts;
-}
+} \ No newline at end of file
diff --git a/src/jake2/game/game_locals_t.java b/src/jake2/game/game_locals_t.java
index e638195..cbc109f 100644
--- a/src/jake2/game/game_locals_t.java
+++ b/src/jake2/game/game_locals_t.java
@@ -19,15 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: game_locals_t.java,v 1.3 2004-07-12 20:47:01 hzi Exp $
+// $Id: game_locals_t.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import jake2.Defines;
import jake2.qcommon.Com;
import jake2.util.Lib;
+import jake2.util.QuakeFile;
+import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
+import java.util.Date;
public class game_locals_t extends Defines
{
@@ -59,28 +63,54 @@ public class game_locals_t extends Defines
public int num_items;
public boolean autosaved;
- public void load(ByteBuffer bb)
+ /** Reads the game locals from a file. */
+ public void load(QuakeFile f) throws IOException
{
- String date = Lib.readString(bb, 16);
+ String date = f.readString();
- helpmessage1 = Lib.readString(bb, 512);
- helpmessage2 = Lib.readString(bb, 512);
+ helpmessage1 = f.readString();
+ helpmessage2 = f.readString();
- helpchanged = bb.getInt();
+ helpchanged = f.readInt();
// gclient_t*
- bb.getInt();
- spawnpoint = Lib.readString(bb, 512);
- maxclients = bb.getInt();
- maxentities = bb.getInt();
- serverflags = bb.getInt();
- num_items = bb.getInt();
- autosaved = bb.getInt() != 0;
+
+ spawnpoint = f.readString();
+ maxclients = f.readInt();
+ maxentities = f.readInt();
+ serverflags = f.readInt();
+ num_items = f.readInt();
+ autosaved = f.readInt() != 0;
+
+ // rst's checker :-)
+ if (f.readInt()!=1928)
+ System.err.println("error in loading game_locals.");
+
+ }
+
+ /** Writes the game locals to a file. */
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeString(new Date().toString());
+ f.writeString(helpmessage1);
+ f.writeString(helpmessage2);
+
+ f.writeInt(helpchanged);
+ // gclient_t*
+
+ f.writeString(spawnpoint);
+ f.writeInt(maxclients);
+ f.writeInt(maxentities);
+ f.writeInt(serverflags);
+ f.writeInt(num_items);
+ f.writeInt(autosaved?1:0);
+ // rst's checker :-)
+ f.writeInt(1928);
}
+ /** Prints the game locals.*/
public void dump()
{
-
Com.Println("String helpmessage1: " + helpmessage1);
Com.Println("String helpmessage2: " + helpmessage2);
diff --git a/src/jake2/game/gclient_t.java b/src/jake2/game/gclient_t.java
index ce0a491..2cbda59 100644
--- a/src/jake2/game/gclient_t.java
+++ b/src/jake2/game/gclient_t.java
@@ -19,15 +19,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: gclient_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: gclient_t.java,v 1.3 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import jake2.qcommon.Com;
import jake2.util.Lib;
+import jake2.util.QuakeFile;
import java.awt.event.ItemListener;
import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
public class gclient_t
@@ -123,6 +125,9 @@ public class gclient_t
public int index;
+
+
+
public void clear()
{
player_state_t ps = new player_state_t();
@@ -163,116 +168,233 @@ public class gclient_t
}
- public void load(ByteBuffer bb) throws IOException
+ /** Reads a game client from the file. */
+ public void read(QuakeFile f) throws IOException
{
- ps.load(bb);
-
- ping = bb.getInt();
-
- pers.load(bb);
- resp.load(bb);
-
- old_pmove.load(bb);
-
- showscores = bb.getInt() != 0;
- showinventory = bb.getInt() != 0;
- showhelp = bb.getInt() != 0;
- showhelpicon = bb.getInt() != 0;
- ammo_index = bb.getInt();
-
- buttons = bb.getInt();
- oldbuttons = bb.getInt();
- latched_buttons = bb.getInt();
-
- //weapon_thunk=bb.getInt()!=0;
- bb.getInt();
- //newweapon=GameTarget.itemlist[bb.getInt()];
- bb.getInt();
-
- damage_armor = bb.getInt();
- damage_parmor = bb.getInt();
- damage_blood = bb.getInt();
- damage_knockback = bb.getInt();
-
- damage_from[0] = bb.getFloat();
- damage_from[1] = bb.getFloat();
- damage_from[2] = bb.getFloat();
-
- killer_yaw = bb.getFloat();
-
- weaponstate = bb.getInt();
-
- kick_angles[0] = bb.getFloat();
- kick_angles[1] = bb.getFloat();
- kick_angles[2] = bb.getFloat();
-
- kick_origin[0] = bb.getFloat();
- kick_origin[1] = bb.getFloat();
- kick_origin[2] = bb.getFloat();
-
- v_dmg_roll = bb.getFloat();
- v_dmg_pitch = bb.getFloat();
- v_dmg_time = bb.getFloat();
- fall_time = bb.getFloat();
- fall_value = bb.getFloat();
- damage_alpha = bb.getFloat();
- bonus_alpha = bb.getFloat();
-
- damage_blend[0] = bb.getFloat();
- damage_blend[1] = bb.getFloat();
- damage_blend[2] = bb.getFloat();
-
- v_angle[0] = bb.getFloat();
- v_angle[1] = bb.getFloat();
- v_angle[2] = bb.getFloat();
-
- bobtime = bb.getFloat();
-
- oldviewangles[0] = bb.getFloat();
- oldviewangles[1] = bb.getFloat();
- oldviewangles[2] = bb.getFloat();
-
- oldvelocity[0] = bb.getFloat();
- oldvelocity[1] = bb.getFloat();
- oldvelocity[2] = bb.getFloat();
-
- next_drown_time = bb.getFloat();
-
- old_waterlevel = bb.getInt();
- breather_sound = bb.getInt();
- machinegun_shots = bb.getInt();
- anim_end = bb.getInt();
- anim_priority = bb.getInt();
- anim_duck = bb.getInt() != 0;
- anim_run = bb.getInt() != 0;
-
- quad_framenum = bb.getFloat();
- invincible_framenum = bb.getFloat();
- breather_framenum = bb.getFloat();
- enviro_framenum = bb.getFloat();
-
- grenade_blew_up = bb.getInt() != 0;
- grenade_time = bb.getFloat();
- silencer_shots = bb.getInt();
- weapon_sound = bb.getInt();
- pickup_msg_time = bb.getFloat();
- flood_locktill = bb.getFloat();
- flood_when[0] = bb.getFloat();
- flood_when[1] = bb.getFloat();
- flood_when[2] = bb.getFloat();
- flood_when[3] = bb.getFloat();
- flood_when[4] = bb.getFloat();
- flood_when[5] = bb.getFloat();
- flood_when[6] = bb.getFloat();
- flood_when[7] = bb.getFloat();
- flood_when[8] = bb.getFloat();
- flood_when[9] = bb.getFloat();
- flood_whenhead = bb.getInt();
- respawn_time = bb.getFloat();
- chase_target = GameUtil.g_edicts[bb.getInt()];
- update_chase = bb.getInt() != 0;
+ ps.load(f);
+
+ ping = f.readInt();
+
+ pers.read(f);
+ resp.read(f);
+
+ old_pmove.load(f);
+
+ showscores = f.readInt() != 0;
+ showinventory = f.readInt() != 0;
+ showhelp = f.readInt() != 0;
+ showhelpicon = f.readInt() != 0;
+ ammo_index = f.readInt();
+
+ buttons = f.readInt();
+ oldbuttons = f.readInt();
+ latched_buttons = f.readInt();
+
+ weapon_thunk=f.readInt()!=0;
+
+ newweapon=f.readItem();
+
+
+ damage_armor = f.readInt();
+ damage_parmor = f.readInt();
+ damage_blood = f.readInt();
+ damage_knockback = f.readInt();
+
+ damage_from[0] = f.readFloat();
+ damage_from[1] = f.readFloat();
+ damage_from[2] = f.readFloat();
+
+ killer_yaw = f.readFloat();
+
+ weaponstate = f.readInt();
+
+ kick_angles[0] = f.readFloat();
+ kick_angles[1] = f.readFloat();
+ kick_angles[2] = f.readFloat();
+
+ kick_origin[0] = f.readFloat();
+ kick_origin[1] = f.readFloat();
+ kick_origin[2] = f.readFloat();
+
+ v_dmg_roll = f.readFloat();
+ v_dmg_pitch = f.readFloat();
+ v_dmg_time = f.readFloat();
+ fall_time = f.readFloat();
+ fall_value = f.readFloat();
+ damage_alpha = f.readFloat();
+ bonus_alpha = f.readFloat();
+
+ damage_blend[0] = f.readFloat();
+ damage_blend[1] = f.readFloat();
+ damage_blend[2] = f.readFloat();
+
+ v_angle[0] = f.readFloat();
+ v_angle[1] = f.readFloat();
+ v_angle[2] = f.readFloat();
+
+ bobtime = f.readFloat();
+
+ oldviewangles[0] = f.readFloat();
+ oldviewangles[1] = f.readFloat();
+ oldviewangles[2] = f.readFloat();
+
+ oldvelocity[0] = f.readFloat();
+ oldvelocity[1] = f.readFloat();
+ oldvelocity[2] = f.readFloat();
+
+ next_drown_time = f.readFloat();
+
+ old_waterlevel = f.readInt();
+ breather_sound = f.readInt();
+ machinegun_shots = f.readInt();
+ anim_end = f.readInt();
+ anim_priority = f.readInt();
+ anim_duck = f.readInt() != 0;
+ anim_run = f.readInt() != 0;
+
+ quad_framenum = f.readFloat();
+ invincible_framenum = f.readFloat();
+ breather_framenum = f.readFloat();
+ enviro_framenum = f.readFloat();
+
+ grenade_blew_up = f.readInt() != 0;
+ grenade_time = f.readFloat();
+ silencer_shots = f.readInt();
+ weapon_sound = f.readInt();
+ pickup_msg_time = f.readFloat();
+ flood_locktill = f.readFloat();
+ flood_when[0] = f.readFloat();
+ flood_when[1] = f.readFloat();
+ flood_when[2] = f.readFloat();
+ flood_when[3] = f.readFloat();
+ flood_when[4] = f.readFloat();
+ flood_when[5] = f.readFloat();
+ flood_when[6] = f.readFloat();
+ flood_when[7] = f.readFloat();
+ flood_when[8] = f.readFloat();
+ flood_when[9] = f.readFloat();
+ flood_whenhead = f.readInt();
+ respawn_time = f.readFloat();
+ chase_target = f.readEdictRef();
+ update_chase = f.readInt() != 0;
+
+ if (f.readInt() != 8765)
+ System.err.println("game client load failed for num=" + index);
}
+
+ /** Writes a game_client_t (a player) to a file. */
+ public void write(QuakeFile f) throws IOException
+ {
+ ps.write(f);
+
+ f.writeInt(ping);
+
+ pers.write(f);
+ resp.write(f);
+
+ old_pmove.write(f);
+
+ f.writeInt(showscores?1:0);
+ f.writeInt(showinventory?1:0);
+ f.writeInt(showhelp?1:0);
+ f.writeInt(showhelpicon?1:0);
+ f.writeInt(ammo_index);
+
+ f.writeInt(buttons);
+ f.writeInt(oldbuttons);
+ f.writeInt(latched_buttons);
+
+ f.writeInt(weapon_thunk?1:0);
+ f.writeItem(newweapon);
+
+
+ f.writeInt(damage_armor);
+ f.writeInt(damage_parmor);
+ f.writeInt(damage_blood);
+ f.writeInt(damage_knockback);
+
+ f.writeFloat(damage_from[0]);
+ f.writeFloat(damage_from[1]);
+ f.writeFloat(damage_from[2]);
+
+ f.writeFloat(killer_yaw);
+
+ f.writeInt(weaponstate);
+
+ f.writeFloat(kick_angles[0]);
+ f.writeFloat(kick_angles[1]);
+ f.writeFloat(kick_angles[2]);
+
+ f.writeFloat(kick_origin[0]);
+ f.writeFloat(kick_origin[1]);
+ f.writeFloat(kick_origin[2]);
+
+ f.writeFloat(v_dmg_roll);
+ f.writeFloat(v_dmg_pitch);
+ f.writeFloat(v_dmg_time);
+ f.writeFloat(fall_time);
+ f.writeFloat(fall_value);
+ f.writeFloat(damage_alpha);
+ f.writeFloat(bonus_alpha);
+
+ f.writeFloat(damage_blend[0]);
+ f.writeFloat(damage_blend[1]);
+ f.writeFloat(damage_blend[2]);
+
+ f.writeFloat(v_angle[0]);
+ f.writeFloat(v_angle[1]);
+ f.writeFloat(v_angle[2]);
+
+ f.writeFloat(bobtime);
+
+ f.writeFloat(oldviewangles[0]);
+ f.writeFloat(oldviewangles[1]);
+ f.writeFloat(oldviewangles[2]);
+
+ f.writeFloat(oldvelocity[0]);
+ f.writeFloat(oldvelocity[1]);
+ f.writeFloat(oldvelocity[2]);
+
+ f.writeFloat(next_drown_time);
+
+ f.writeInt(old_waterlevel);
+ f.writeInt(breather_sound);
+ f.writeInt(machinegun_shots);
+ f.writeInt(anim_end);
+ f.writeInt(anim_priority);
+ f.writeInt(anim_duck?1:0);
+ f.writeInt(anim_run?1:0);
+
+ f.writeFloat(quad_framenum);
+ f.writeFloat(invincible_framenum);
+ f.writeFloat(breather_framenum);
+ f.writeFloat(enviro_framenum);
+
+ f.writeInt(grenade_blew_up?1:0);
+ f.writeFloat(grenade_time);
+ f.writeInt(silencer_shots);
+ f.writeInt(weapon_sound);
+ f.writeFloat(pickup_msg_time);
+ f.writeFloat(flood_locktill);
+ f.writeFloat(flood_when[0]);
+ f.writeFloat(flood_when[1]);
+ f.writeFloat(flood_when[2]);
+ f.writeFloat(flood_when[3]);
+ f.writeFloat(flood_when[4]);
+ f.writeFloat(flood_when[5]);
+ f.writeFloat(flood_when[6]);
+ f.writeFloat(flood_when[7]);
+ f.writeFloat(flood_when[8]);
+ f.writeFloat(flood_when[9]);
+ f.writeInt(flood_whenhead);
+ f.writeFloat(respawn_time);
+ f.writeEdictRef(chase_target);
+ f.writeInt(update_chase?1:0);
+
+ f.writeInt(8765);
+ }
+
public void dump()
{
@@ -357,7 +479,5 @@ public class gclient_t
Com.Println("respawn_time: " + respawn_time);
Com.Println("chase_target: " + chase_target);
Com.Println("update_chase: " + update_chase);
-
}
-
}
diff --git a/src/jake2/game/gitem_t.java b/src/jake2/game/gitem_t.java
index 6849809..f478f34 100644
--- a/src/jake2/game/gitem_t.java
+++ b/src/jake2/game/gitem_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: gitem_t.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: gitem_t.java,v 1.3 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
@@ -141,5 +141,5 @@ public class gitem_t
"");
}
- int index;
+ public int index;
}
diff --git a/src/jake2/game/level_locals_t.java b/src/jake2/game/level_locals_t.java
index 18038bf..dc12cab 100644
--- a/src/jake2/game/level_locals_t.java
+++ b/src/jake2/game/level_locals_t.java
@@ -19,12 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 20.11.2003 by RST
-// $Id: level_locals_t.java,v 1.1 2004-07-07 19:59:25 hzi Exp $
+// $Id: level_locals_t.java,v 1.2 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
-public class level_locals_t {
- //
+import jake2.util.Lib;
+import jake2.util.QuakeFile;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class level_locals_t
+{
+
// this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames
//
@@ -46,8 +53,10 @@ public class level_locals_t {
public edict_t sight_entity;
public int sight_entity_framenum;
+
public edict_t sound_entity;
public int sound_entity_framenum;
+
public edict_t sound2_entity;
public int sound2_entity_framenum;
@@ -66,4 +75,87 @@ public class level_locals_t {
public int body_que; // dead bodies
public int power_cubes; // ugly necessity for coop
+
+ /** Writes the levellocales to the file.*/
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeInt(framenum);
+ f.writeFloat(time);
+ f.writeString(level_name);
+ f.writeString(mapname);
+ f.writeString(nextmap);
+ f.writeFloat(intermissiontime);
+ f.writeString(changemap);
+ f.writeBoolean(exitintermission);
+ f.writeVector(intermission_origin);
+ f.writeVector(intermission_angle);
+ f.writeEdictRef(sight_client);
+
+ f.writeEdictRef(sight_entity);
+ f.writeInt(sight_entity_framenum);
+
+ f.writeEdictRef(sound_entity);
+ f.writeInt(sound_entity_framenum);
+ f.writeEdictRef(sound2_entity);
+ f.writeInt(sound2_entity_framenum);
+
+ f.writeInt(pic_health);
+
+ f.writeInt(total_secrets);
+ f.writeInt(found_secrets);
+
+ f.writeInt(total_goals);
+ f.writeInt(found_goals);
+ f.writeInt(total_monsters);
+ f.writeInt(killed_monsters);
+
+ f.writeEdictRef(current_entity);
+ f.writeInt(body_que); // dead bodies
+ f.writeInt(power_cubes); // ugly necessity for coop
+
+ // rst's checker :-)
+ f.writeInt(4711);
+ }
+
+ /** Reads the level locals from the file. */
+ public void read(QuakeFile f) throws IOException
+ {
+ framenum = f.readInt();
+ time = f.readFloat();
+ level_name = f.readString();
+ mapname = f.readString();
+ nextmap = f.readString();
+ intermissiontime = f.readFloat();
+ changemap = f.readString();
+ exitintermission = f.readBoolean();
+ intermission_origin = f.readVector();
+ intermission_angle = f.readVector();
+ sight_client = f.readEdictRef();
+
+ sight_entity = f.readEdictRef();
+ sight_entity_framenum = f.readInt();
+
+ sound_entity = f.readEdictRef();
+ sound_entity_framenum = f.readInt();
+ sound2_entity = f.readEdictRef();
+ sound2_entity_framenum = f.readInt();
+
+ pic_health = f.readInt();
+
+ total_secrets = f.readInt();
+ found_secrets = f.readInt();
+
+ total_goals = f.readInt();
+ found_goals = f.readInt();
+ total_monsters = f.readInt();
+ killed_monsters = f.readInt();
+
+ current_entity = f.readEdictRef();
+ body_que = f.readInt(); // dead bodies
+ power_cubes = f.readInt(); // ugly necessity for coop
+
+ // rst's checker :-)
+ if (f.readInt()!= 4711)
+ System.out.println("error in reading level_locals.");
+ }
}
diff --git a/src/jake2/game/mframe_t.java b/src/jake2/game/mframe_t.java
index 6e81af4..af5f095 100644
--- a/src/jake2/game/mframe_t.java
+++ b/src/jake2/game/mframe_t.java
@@ -19,18 +19,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 11.11.2003 by RST.
-// $Id: mframe_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $
+// $Id: mframe_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
-public class mframe_t {
- public mframe_t(AIAdapter ai, float dist, EntThinkAdapter think) {
+import jake2.util.Lib;
+import jake2.util.QuakeFile;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class mframe_t
+{
+ public mframe_t(AIAdapter ai, float dist, EntThinkAdapter think)
+ {
this.ai= ai;
this.dist= dist;
this.think= think;
}
+
+ /** Empty constructor. */
+ public mframe_t()
+ {}
public AIAdapter ai;
public float dist;
public EntThinkAdapter think;
+
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeAdapter(ai);
+ f.writeFloat(dist);
+ f.writeAdapter(think);
+ }
+
+ public void read(QuakeFile f) throws IOException
+ {
+ ai= (AIAdapter) f.readAdapter();
+ dist= f.readFloat();
+ think= (EntThinkAdapter) f.readAdapter();
+ }
}
diff --git a/src/jake2/game/mmove_t.java b/src/jake2/game/mmove_t.java
index b0c19d0..cf8b2c2 100644
--- a/src/jake2/game/mmove_t.java
+++ b/src/jake2/game/mmove_t.java
@@ -19,20 +19,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 11.11.2003 by RST.
-// $Id: mmove_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $
+// $Id: mmove_t.java,v 1.2 2004-08-20 21:29:57 salomo Exp $
package jake2.game;
+import jake2.util.Lib;
+import jake2.util.QuakeFile;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
public class mmove_t {
public mmove_t(int firstframe, int lastframe, mframe_t frame[], EntThinkAdapter endfunc) {
+
this.firstframe= firstframe;
this.lastframe= lastframe;
this.frame= frame;
this.endfunc= endfunc;
}
+ public mmove_t()
+ {}
+
public int firstframe;
public int lastframe;
public mframe_t frame[]; //ptr
public EntThinkAdapter endfunc;
+
+
+ /** Writes the structure to a random acccess file. */
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeInt(firstframe);
+ f.writeInt(lastframe);
+ if (frame == null)
+ f.writeInt(-1);
+ else
+ {
+ f. writeInt(frame.length);
+ for (int n=0; n < frame.length; n++)
+ frame[n].write(f);
+ }
+ f.writeAdapter(endfunc);
+ }
+
+ /** Read the mmove_t from the RandomAccessFile. */
+ public void read(QuakeFile f) throws IOException
+ {
+ firstframe = f.readInt();
+ lastframe = f.readInt();
+
+ int len = f.readInt();
+
+ frame = new mframe_t[len];
+ for (int n=0; n < len ; n++)
+ {
+ frame[n] = new mframe_t();
+ frame[n].read(f);
+ }
+ endfunc = (EntThinkAdapter) f.readAdapter();
+ }
}
diff --git a/src/jake2/game/monsterinfo_t.java b/src/jake2/game/monsterinfo_t.java
index 48b96f0..4a98213 100644
--- a/src/jake2/game/monsterinfo_t.java
+++ b/src/jake2/game/monsterinfo_t.java
@@ -19,10 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: monsterinfo_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $
+// $Id: monsterinfo_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
+import jake2.util.QuakeFile;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
public class monsterinfo_t {
public mmove_t currentmove;
@@ -60,4 +65,98 @@ public class monsterinfo_t {
public int power_armor_type;
public int power_armor_power;
+ /** Writes the monsterinfo to the file.*/
+ public void write(QuakeFile f) throws IOException
+ {
+ f.writeBoolean(currentmove != null);
+ if (currentmove != null)
+ currentmove.write(f);
+ f.writeInt(aiflags);
+ f.writeInt(nextframe);
+ f.writeFloat(scale);
+ f.writeAdapter(stand);
+ f.writeAdapter(idle);
+ f.writeAdapter(search);
+ f.writeAdapter(walk);
+ f.writeAdapter(run);
+
+ f.writeAdapter(dodge);
+
+ f.writeAdapter(attack);
+ f.writeAdapter(melee);
+
+ f.writeAdapter(sight);
+
+ f.writeAdapter(checkattack);
+
+ f.writeFloat(pausetime);
+ f.writeFloat(attack_finished);
+
+ f.writeVector(saved_goal);
+
+ f.writeFloat(search_time);
+ f.writeFloat(trail_time);
+
+ f.writeVector(last_sighting);
+
+ f.writeInt(attack_state);
+ f.writeInt(lefty);
+
+ f.writeFloat(idle_time);
+ f.writeInt(linkcount);
+
+ f.writeInt(power_armor_power);
+ f.writeInt(power_armor_type);
+ }
+
+ /** Writes the monsterinfo to the file.*/
+ public void read(QuakeFile f) throws IOException
+ {
+ if (f.readBoolean())
+ {
+ currentmove= new mmove_t();
+ currentmove.read(f);
+ }
+ else
+ currentmove= null;
+ aiflags = f.readInt();
+ nextframe = f.readInt();
+ scale = f.readFloat();
+ stand = (EntThinkAdapter) f.readAdapter();
+ idle = (EntThinkAdapter) f.readAdapter();
+ search = (EntThinkAdapter) f.readAdapter();
+ walk = (EntThinkAdapter) f.readAdapter();
+ run = (EntThinkAdapter) f.readAdapter();
+
+ dodge = (EntDodgeAdapter) f.readAdapter();
+
+ attack = (EntThinkAdapter) f.readAdapter();
+ melee = (EntThinkAdapter) f.readAdapter();
+
+ sight = (EntInteractAdapter) f.readAdapter();
+
+ checkattack = (EntThinkAdapter) f.readAdapter();
+
+ pausetime = f.readFloat();
+ attack_finished = f.readFloat();
+
+ saved_goal = f.readVector();
+
+ search_time = f.readFloat();
+ trail_time = f.readFloat();
+
+ last_sighting = f.readVector();
+
+ attack_state = f.readInt();
+ lefty = f.readInt();
+
+ idle_time = f.readFloat();
+ linkcount = f.readInt();
+
+ power_armor_power = f.readInt();
+ power_armor_type = f.readInt();
+
+ }
+
+
}
diff --git a/src/jake2/game/moveinfo_t.java b/src/jake2/game/moveinfo_t.java
index 16b0b50..864051d 100644
--- a/src/jake2/game/moveinfo_t.java
+++ b/src/jake2/game/moveinfo_t.java
@@ -19,10 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: moveinfo_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $
+// $Id: moveinfo_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
+import java.io.IOException;
+
+import jake2.util.QuakeFile;
+
public class moveinfo_t {
// fixed data
float[] start_origin= { 0, 0, 0 };
@@ -51,4 +55,62 @@ public class moveinfo_t {
float remaining_distance;
float decel_distance;
EntThinkAdapter endfunc;
+
+ /** saves the moveinfo to the file.*/
+ public void write(QuakeFile f) throws IOException {
+ f.writeVector(start_origin);
+ f.writeVector(start_angles);
+ f.writeVector(end_origin);
+ f.writeVector(end_angles);
+
+ f.writeInt(sound_start);
+ f.writeInt(sound_middle);
+ f.writeInt(sound_end);
+
+ f.writeFloat(accel);
+ f.writeFloat(speed);
+ f.writeFloat(decel);
+ f.writeFloat(distance);
+
+ f.writeFloat(wait);
+
+ f.writeInt(state);
+ f.writeVector(dir);
+
+ f.writeFloat(current_speed);
+ f.writeFloat(move_speed);
+ f.writeFloat(next_speed);
+ f.writeFloat(remaining_distance);
+ f.writeFloat(decel_distance);
+ f.writeAdapter(endfunc);
+ }
+
+ /** Reads the moveinfo from a file. */
+ public void read(QuakeFile f) throws IOException {
+ start_origin= f.readVector();
+ start_angles= f.readVector();
+ end_origin= f.readVector();
+ end_angles= f.readVector();
+
+ sound_start= f.readInt();
+ sound_middle= f.readInt();
+ sound_end= f.readInt();
+
+ accel= f.readFloat();
+ speed= f.readFloat();
+ decel= f.readFloat();
+ distance= f.readFloat();
+
+ wait= f.readFloat();
+
+ state= f.readInt();
+ dir= f.readVector();
+
+ current_speed= f.readFloat();
+ move_speed= f.readFloat();
+ next_speed= f.readFloat();
+ remaining_distance= f.readFloat();
+ decel_distance= f.readFloat();
+ endfunc= (EntThinkAdapter) f.readAdapter();
+ }
}
diff --git a/src/jake2/game/player_state_t.java b/src/jake2/game/player_state_t.java
index d4ecc72..cf4daf4 100644
--- a/src/jake2/game/player_state_t.java
+++ b/src/jake2/game/player_state_t.java
@@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: player_state_t.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
+// $Id: player_state_t.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import jake2.*;
@@ -32,114 +33,156 @@ import jake2.qcommon.Com;
import jake2.util.Lib;
import jake2.util.Math3D;
+/**
+ Player_state_t is the information needed in addition to pmove_state_t
+ to rendered a view. There will only be 10 player_state_t sent each second,
+ but the number of pmove_state_t changes will be relative to client
+ frame rates.
+*/
+
public class player_state_t {
- // player_state_t is the information needed in addition to pmove_state_t
- // to rendered a view. There will only be 10 player_state_t sent each second,
- // but the number of pmove_state_t changes will be reletive to client
- // frame rates
- public pmove_state_t pmove = new pmove_state_t(); // for prediction
+ public pmove_state_t pmove= new pmove_state_t(); // for prediction
// these fields do not need to be communicated bit-precise
- public float[] viewangles = { 0, 0, 0 }; // for fixed views
- public float[] viewoffset = { 0, 0, 0 }; // add to pmovestate->origin
- public float[] kick_angles = { 0, 0, 0 }; // add to view direction to get render angles
+ public float[] viewangles= { 0, 0, 0 }; // for fixed views
+ public float[] viewoffset= { 0, 0, 0 }; // add to pmovestate->origin
+ public float[] kick_angles= { 0, 0, 0 }; // add to view direction to get render angles
// set by weapon kicks, pain effects, etc
- public float[] gunangles = { 0, 0, 0 };
- public float[] gunoffset = { 0, 0, 0 };
+ public float[] gunangles= { 0, 0, 0 };
+ public float[] gunoffset= { 0, 0, 0 };
public int gunindex;
public int gunframe;
- public float blend[] = new float[4]; // rgba full screen effect
+ public float blend[]= new float[4]; // rgba full screen effect
public float fov; // horizontal field of view
public int rdflags; // refdef flags
- public short stats[] = new short[Defines.MAX_STATS];
+ public short stats[]= new short[Defines.MAX_STATS];
+
+ /** Lets cleverly reset the structure. */
+ private static player_state_t prototype= new player_state_t();
- /**
- *
- */
- private static player_state_t prototype = new player_state_t();
-
+ /** Clears the player_state.*/
public void clear() {
this.set(prototype);
}
-
- public player_state_t getClone()
- {
+
+ /** Clones the object.*/
+ public player_state_t getClone() {
return new player_state_t().set(this);
}
-
- public player_state_t set(player_state_t from)
- {
+
+ /** Copies the player state data. */
+ public player_state_t set(player_state_t from) {
pmove.set(from.pmove);
Math3D.VectorCopy(from.viewangles, viewangles);
- Math3D.VectorCopy(from.viewoffset,viewoffset);
+ Math3D.VectorCopy(from.viewoffset, viewoffset);
Math3D.VectorCopy(from.kick_angles, kick_angles);
- Math3D.VectorCopy(from.gunangles,gunangles);
+ Math3D.VectorCopy(from.gunangles, gunangles);
Math3D.VectorCopy(from.gunoffset, gunoffset);
- gunindex = from.gunindex;
- gunframe = from.gunframe;
-
- blend[0] = from.blend[0];
- blend[1] = from.blend[1];
- blend[2] = from.blend[2];
- blend[3] = from.blend[3];
-
- fov = from.fov;
- rdflags = from.rdflags;
-
- //stats = new short[Defines.MAX_STATS];
- System.arraycopy(from.stats, 0, stats,0, Defines.MAX_STATS);
-
+ gunindex= from.gunindex;
+ gunframe= from.gunframe;
+
+ blend[0]= from.blend[0];
+ blend[1]= from.blend[1];
+ blend[2]= from.blend[2];
+ blend[3]= from.blend[3];
+
+ fov= from.fov;
+ rdflags= from.rdflags;
+
+ System.arraycopy(from.stats, 0, stats, 0, Defines.MAX_STATS);
+
return this;
}
- public void load(ByteBuffer bb) throws IOException {
- pmove.load(bb);
+ /** Reads a player_state from a file.*/
+ public void load(RandomAccessFile f) throws IOException {
+ pmove.load(f);
+
+ viewangles[0]= f.readFloat();
+ viewangles[1]= f.readFloat();
+ viewangles[2]= f.readFloat();
+
+ viewoffset[0]= f.readFloat();
+ viewoffset[1]= f.readFloat();
+ viewoffset[2]= f.readFloat();
+
+ kick_angles[0]= f.readFloat();
+ kick_angles[1]= f.readFloat();
+ kick_angles[2]= f.readFloat();
+
+ gunangles[0]= f.readFloat();
+ gunangles[1]= f.readFloat();
+ gunangles[2]= f.readFloat();
+
+ gunoffset[0]= f.readFloat();
+ gunoffset[1]= f.readFloat();
+ gunoffset[2]= f.readFloat();
+
+ gunindex= f.readInt();
+ gunframe= f.readInt();
+
+ blend[0]= f.readFloat();
+ blend[1]= f.readFloat();
+ blend[2]= f.readFloat();
+ blend[3]= f.readFloat();
+
+ fov= f.readFloat();
+
+ rdflags= f.readInt();
+
+ for (int n= 0; n < Defines.MAX_STATS; n++)
+ stats[n]= f.readShort();
+ }
- viewangles[0] = bb.getFloat();
- viewangles[1] = bb.getFloat();
- viewangles[2] = bb.getFloat();
+ /** Writes a player_state to a file.*/
+ public void write(RandomAccessFile f) throws IOException {
+ pmove.write(f);
- viewoffset[0] = bb.getFloat();
- viewoffset[1] = bb.getFloat();
- viewoffset[2] = bb.getFloat();
+ f.writeFloat(viewangles[0]);
+ f.writeFloat(viewangles[1]);
+ f.writeFloat(viewangles[2]);
- kick_angles[0] = bb.getFloat();
- kick_angles[1] = bb.getFloat();
- kick_angles[2] = bb.getFloat();
+ f.writeFloat(viewoffset[0]);
+ f.writeFloat(viewoffset[1]);
+ f.writeFloat(viewoffset[2]);
- gunangles[0] = bb.getFloat();
- gunangles[1] = bb.getFloat();
- gunangles[2] = bb.getFloat();
+ f.writeFloat(kick_angles[0]);
+ f.writeFloat(kick_angles[1]);
+ f.writeFloat(kick_angles[2]);
- gunoffset[0] = bb.getFloat();
- gunoffset[1] = bb.getFloat();
- gunoffset[2] = bb.getFloat();
+ f.writeFloat(gunangles[0]);
+ f.writeFloat(gunangles[1]);
+ f.writeFloat(gunangles[2]);
- gunindex = bb.getInt();
- gunframe = bb.getInt();
+ f.writeFloat(gunoffset[0]);
+ f.writeFloat(gunoffset[1]);
+ f.writeFloat(gunoffset[2]);
- blend[0] = bb.getFloat();
- blend[1] = bb.getFloat();
- blend[2] = bb.getFloat();
- blend[3] = bb.getFloat();
+ f.writeInt(gunindex);
+ f.writeInt(gunframe);
- fov = bb.getFloat();
+ f.writeFloat(blend[0]);
+ f.writeFloat(blend[1]);
+ f.writeFloat(blend[2]);
+ f.writeFloat(blend[3]);
- rdflags = bb.getInt();
+ f.writeFloat(fov);
- for (int n = 0; n < Defines.MAX_STATS; n++)
- stats[n] = bb.getShort();
+ f.writeInt(rdflags);
+ for (int n= 0; n < Defines.MAX_STATS; n++)
+ f.writeShort(stats[n]);
}
+ /** Prints the player state. */
public void dump() {
pmove.dump();
@@ -158,7 +201,7 @@ public class player_state_t {
Com.Println("rdflags: " + rdflags);
- for (int n = 0; n < Defines.MAX_STATS; n++)
+ for (int n= 0; n < Defines.MAX_STATS; n++)
System.out.println("stats[" + n + "]: " + stats[n]);
}
}
diff --git a/src/jake2/game/pmove_state_t.java b/src/jake2/game/pmove_state_t.java
index 6c0906e..01b0bf6 100644
--- a/src/jake2/game/pmove_state_t.java
+++ b/src/jake2/game/pmove_state_t.java
@@ -19,13 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 31.10.2003 by RST.
-// $Id: pmove_state_t.java,v 1.1 2004-07-07 19:59:26 hzi Exp $
+// $Id: pmove_state_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $
package jake2.game;
import jake2.qcommon.Com;
import jake2.util.Math3D;
import java.io.IOException;
+import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
public class pmove_state_t {
@@ -39,12 +40,15 @@ public class pmove_state_t {
public short origin[] = { 0, 0, 0 }; // 12.3
public short velocity[] = { 0, 0, 0 }; // 12.3
- public byte pm_flags; // ducked, jump_held, etc
- public byte pm_time; // each unit = 8 ms
+ /** ducked, jump_held, etc. */
+ public byte pm_flags;
+ /** each unit = 8 ms. */
+ public byte pm_time;
public short gravity;
- public short delta_angles[] = { 0, 0, 0 }; // add to command angles to get view direction
- // changed by spawns, rotating objects, and teleporters
-
+ /** add to command angles to get view direction. */
+ public short delta_angles[] = { 0, 0, 0 };
+ /** changed by spawns, rotating objects, and teleporters.*/
+
private static pmove_state_t prototype = new pmove_state_t();
public void reset()
@@ -81,28 +85,53 @@ public class pmove_state_t {
return false;
}
- public void load(ByteBuffer bb) throws IOException {
+ /** Reads the playermove from the file.*/
+ public void load(RandomAccessFile f) throws IOException {
+
+ pm_type = f.readInt();
+
+ origin[0] = f.readShort();
+ origin[1] = f.readShort();
+ origin[2] = f.readShort();
+
+ velocity[0] = f.readShort();
+ velocity[1] = f.readShort();
+ velocity[2] = f.readShort();
+
+ pm_flags = f.readByte();
+ pm_time = f.readByte();
+ gravity = f.readShort();
- pm_type = bb.getInt();
+ f.readShort();
- origin[0] = bb.getShort();
- origin[1] = bb.getShort();
- origin[2] = bb.getShort();
+ delta_angles[0] = f.readShort();
+ delta_angles[1] = f.readShort();
+ delta_angles[2] = f.readShort();
- velocity[0] = bb.getShort();
- velocity[1] = bb.getShort();
- velocity[2] = bb.getShort();
+ }
+
+ /** Writes the playermove to the file. */
+ public void write (RandomAccessFile f) throws IOException {
+
+ f.writeInt(pm_type);
- pm_flags = bb.get();
- pm_time = bb.get();
- gravity = bb.getShort();
+ f.writeShort(origin[0]);
+ f.writeShort(origin[1]);
+ f.writeShort(origin[2]);
- bb.getShort();
+ f.writeShort(velocity[0]);
+ f.writeShort(velocity[1]);
+ f.writeShort(velocity[2]);
- delta_angles[0] = bb.getShort();
- delta_angles[1] = bb.getShort();
- delta_angles[2] = bb.getShort();
+ f.writeByte(pm_flags);
+ f.writeByte(pm_time);
+ f.writeShort(gravity);
+ f.writeShort(0);
+
+ f.writeShort(delta_angles[0]);
+ f.writeShort(delta_angles[1]);
+ f.writeShort(delta_angles[2]);
}
public void dump() {
@@ -124,7 +153,4 @@ public class pmove_state_t {
Com.Println("delta-angle[1]: " + delta_angles[0]);
Com.Println("delta-angle[2]: " + delta_angles[0]);
}
-
-
-
} \ No newline at end of file
diff --git a/src/jake2/qcommon/FS.java b/src/jake2/qcommon/FS.java
index a99ae28..b2233f3 100644
--- a/src/jake2/qcommon/FS.java
+++ b/src/jake2/qcommon/FS.java
@@ -2,7 +2,7 @@
* FS.java
* Copyright (C) 2003
*
- * $Id: FS.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
+ * $Id: FS.java,v 1.4 2004-08-20 21:29:58 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -116,7 +116,7 @@ public final class FS extends Globals {
if (index > 0) {
File f = new File(path.substring(0, index));
if (!f.mkdirs()) {
- Com.Printf("can't create path \"" + path + '"' + "\n" );
+ //Com.Printf("can't create path \"" + path + '"' + "\n" );
}
}
}
diff --git a/src/jake2/server/SV.java b/src/jake2/server/SV.java
index 4792264..540e3ea 100644
--- a/src/jake2/server/SV.java
+++ b/src/jake2/server/SV.java
@@ -2,9 +2,9 @@
* SV.java
* Copyright (C) 2003
*
- * $Id: SV.java,v 1.5 2004-07-30 06:07:23 hzi Exp $
+ * $Id: SV.java,v 1.6 2004-08-20 21:29:57 salomo Exp $
*/
- /*
+/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
@@ -35,198 +35,219 @@ import jake2.util.Math3D;
/**
* SV
*/
-public final class SV {
+public final class SV
+{
//file_io
//=====================================================================
//g_phys
-
+
///////////////////////////////////////
- public static edict_t[] SV_TestEntityPosition(edict_t ent) {
+ public static edict_t[] SV_TestEntityPosition(edict_t ent)
+ {
trace_t trace;
int mask;
-
+
if (ent.clipmask != 0)
- mask = ent.clipmask;
+ mask= ent.clipmask;
else
- mask = Defines.MASK_SOLID;
-
- trace = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, ent.s.origin, ent, mask);
-
+ mask= Defines.MASK_SOLID;
+
+ trace= GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, ent.s.origin, ent, mask);
+
if (trace.startsolid)
return GameBase.g_edicts;
-
+
return null;
}
///////////////////////////////////////
- public static void SV_CheckVelocity(edict_t ent) {
+ public static void SV_CheckVelocity(edict_t ent)
+ {
int i;
-
+
//
// bound velocity
//
- for (i = 0; i < 3; i++) {
+ for (i= 0; i < 3; i++)
+ {
if (ent.velocity[i] > GameBase.sv_maxvelocity.value)
- ent.velocity[i] = GameBase.sv_maxvelocity.value;
+ ent.velocity[i]= GameBase.sv_maxvelocity.value;
else if (ent.velocity[i] < -GameBase.sv_maxvelocity.value)
- ent.velocity[i] = -GameBase.sv_maxvelocity.value;
+ ent.velocity[i]= -GameBase.sv_maxvelocity.value;
}
}
/**
* Runs thinking code for this frame if necessary.
*/
- public static boolean SV_RunThink(edict_t ent) {
+ public static boolean SV_RunThink(edict_t ent)
+ {
float thinktime;
-
- thinktime = ent.nextthink;
+
+ thinktime= ent.nextthink;
if (thinktime <= 0)
return true;
if (thinktime > GameBase.level.time + 0.001)
return true;
-
- ent.nextthink = 0;
-
+
+ ent.nextthink= 0;
+
if (ent.think == null)
Com.Error(Defines.ERR_FATAL, "NULL ent.think");
ent.think.think(ent);
-
+
return false;
}
/**
* Two entities have touched, so run their touch functions.
*/
- public static void SV_Impact(edict_t e1, trace_t trace) {
+ public static void SV_Impact(edict_t e1, trace_t trace)
+ {
edict_t e2;
// cplane_t backplane;
-
- e2 = trace.ent;
-
+
+ e2= trace.ent;
+
if (e1.touch != null && e1.solid != Defines.SOLID_NOT)
e1.touch.touch(e1, e2, trace.plane, trace.surface);
-
+
if (e2.touch != null && e2.solid != Defines.SOLID_NOT)
e2.touch.touch(e2, e1, null, null);
}
- public static int SV_FlyMove(edict_t ent, float time, int mask) {
+ public static int SV_FlyMove(edict_t ent, float time, int mask)
+ {
edict_t hit;
int bumpcount, numbumps;
- float[] dir = { 0.0f, 0.0f, 0.0f };
+ float[] dir= { 0.0f, 0.0f, 0.0f };
float d;
int numplanes;
- float[][] planes = new float[GameBase.MAX_CLIP_PLANES][3];
- float[] primal_velocity = { 0.0f, 0.0f, 0.0f };
- float[] original_velocity = { 0.0f, 0.0f, 0.0f };
- float[] new_velocity = { 0.0f, 0.0f, 0.0f };
+ float[][] planes= new float[GameBase.MAX_CLIP_PLANES][3];
+ float[] primal_velocity= { 0.0f, 0.0f, 0.0f };
+ float[] original_velocity= { 0.0f, 0.0f, 0.0f };
+ float[] new_velocity= { 0.0f, 0.0f, 0.0f };
int i, j;
trace_t trace;
- float[] end = { 0.0f, 0.0f, 0.0f };
+ float[] end= { 0.0f, 0.0f, 0.0f };
float time_left;
int blocked;
-
- numbumps = 4;
-
- blocked = 0;
+
+ numbumps= 4;
+
+ blocked= 0;
Math3D.VectorCopy(ent.velocity, original_velocity);
Math3D.VectorCopy(ent.velocity, primal_velocity);
- numplanes = 0;
-
- time_left = time;
-
- ent.groundentity = null;
- for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
- for (i = 0; i < 3; i++)
- end[i] = ent.s.origin[i] + time_left * ent.velocity[i];
-
- trace = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, end, ent, mask);
-
- if (trace.allsolid) { // entity is trapped in another solid
+ numplanes= 0;
+
+ time_left= time;
+
+ ent.groundentity= null;
+ for (bumpcount= 0; bumpcount < numbumps; bumpcount++)
+ {
+ for (i= 0; i < 3; i++)
+ end[i]= ent.s.origin[i] + time_left * ent.velocity[i];
+
+ trace= GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, end, ent, mask);
+
+ if (trace.allsolid)
+ { // entity is trapped in another solid
Math3D.VectorCopy(GameBase.vec3_origin, ent.velocity);
return 3;
}
-
- if (trace.fraction > 0) { // actually covered some distance
+
+ if (trace.fraction > 0)
+ { // actually covered some distance
Math3D.VectorCopy(trace.endpos, ent.s.origin);
Math3D.VectorCopy(ent.velocity, original_velocity);
- numplanes = 0;
+ numplanes= 0;
}
-
+
if (trace.fraction == 1)
break; // moved the entire distance
-
- hit = trace.ent;
-
- if (trace.plane.normal[2] > 0.7) {
+
+ hit= trace.ent;
+
+ if (trace.plane.normal[2] > 0.7)
+ {
blocked |= 1; // floor
- if (hit.solid == Defines.SOLID_BSP) {
- ent.groundentity = hit;
- ent.groundentity_linkcount = hit.linkcount;
+ if (hit.solid == Defines.SOLID_BSP)
+ {
+ ent.groundentity= hit;
+ ent.groundentity_linkcount= hit.linkcount;
}
}
- if (trace.plane.normal[2] == 0.0f) {
+ if (trace.plane.normal[2] == 0.0f)
+ {
blocked |= 2; // step
}
-
+
//
// run the impact function
//
SV_Impact(ent, trace);
if (!ent.inuse)
break; // removed by the impact function
-
+
time_left -= time_left * trace.fraction;
-
+
// cliped to another plane
- if (numplanes >= GameBase.MAX_CLIP_PLANES) { // this shouldn't really happen
+ if (numplanes >= GameBase.MAX_CLIP_PLANES)
+ { // this shouldn't really happen
Math3D.VectorCopy(GameBase.vec3_origin, ent.velocity);
return 3;
}
-
+
Math3D.VectorCopy(trace.plane.normal, planes[numplanes]);
numplanes++;
-
+
//
// modify original_velocity so it parallels all of the clip planes
//
- for (i = 0; i < numplanes; i++) {
+ for (i= 0; i < numplanes; i++)
+ {
GameBase.ClipVelocity(original_velocity, planes[i], new_velocity, 1);
-
- for (j = 0; j < numplanes; j++)
- if ((j != i) && Math3D.VectorCompare(planes[i], planes[j]) == 0.0f) {
+
+ for (j= 0; j < numplanes; j++)
+ if ((j != i) && Math3D.VectorCompare(planes[i], planes[j]) == 0.0f)
+ {
if (Math3D.DotProduct(new_velocity, planes[j]) < 0)
break; // not ok
}
if (j == numplanes)
break;
}
-
- if (i != numplanes) { // go along this plane
+
+ if (i != numplanes)
+ { // go along this plane
Math3D.VectorCopy(new_velocity, ent.velocity);
- } else { // go along the crease
- if (numplanes != 2) {
+ }
+ else
+ { // go along the crease
+ if (numplanes != 2)
+ {
// gi.dprintf ("clip velocity, numplanes == %i\n",numplanes);
Math3D.VectorCopy(GameBase.vec3_origin, ent.velocity);
return 7;
}
Math3D.CrossProduct(planes[0], planes[1], dir);
- d = Math3D.DotProduct(dir, ent.velocity);
+ d= Math3D.DotProduct(dir, ent.velocity);
Math3D.VectorScale(dir, d, ent.velocity);
}
-
+
//
// if original velocity is against the original velocity, stop dead
// to avoid tiny occilations in sloping corners
//
- if (Math3D.DotProduct(ent.velocity, primal_velocity) <= 0) {
+ if (Math3D.DotProduct(ent.velocity, primal_velocity) <= 0)
+ {
Math3D.VectorCopy(GameBase.vec3_origin, ent.velocity);
return blocked;
}
}
-
+
return blocked;
}
@@ -236,55 +257,61 @@ public final class SV {
============
*/
- public static void SV_AddGravity(edict_t ent) {
+ public static void SV_AddGravity(edict_t ent)
+ {
ent.velocity[2] -= ent.gravity * GameBase.sv_gravity.value * Defines.FRAMETIME;
}
/**
* Does not change the entities velocity at all
*/
- public static trace_t SV_PushEntity(edict_t ent, float[] push) {
+ public static trace_t SV_PushEntity(edict_t ent, float[] push)
+ {
trace_t trace;
- float[] start = { 0, 0, 0 };
- float[] end = { 0, 0, 0 };
+ float[] start= { 0, 0, 0 };
+ float[] end= { 0, 0, 0 };
int mask;
-
+
Math3D.VectorCopy(ent.s.origin, start);
Math3D.VectorAdd(start, push, end);
-
+
// FIXME: test this
// a goto statement was replaced.
- boolean retry;
-
- do {
+ boolean retry= false;
+
+ do
+ {
if (ent.clipmask != 0)
- mask = ent.clipmask;
+ mask= ent.clipmask;
else
- mask = Defines.MASK_SOLID;
-
- trace = GameBase.gi.trace(start, ent.mins, ent.maxs, end, ent, mask);
-
+ mask= Defines.MASK_SOLID;
+
+ trace= GameBase.gi.trace(start, ent.mins, ent.maxs, end, ent, mask);
+
Math3D.VectorCopy(trace.endpos, ent.s.origin);
GameBase.gi.linkentity(ent);
-
- retry = false;
- if (trace.fraction != 1.0) {
+
+ retry= false;
+ if (trace.fraction != 1.0)
+ {
SV_Impact(ent, trace);
-
+
// if the pushed entity went away and the pusher is still there
- if (!trace.ent.inuse && ent.inuse) {
+ if (!trace.ent.inuse && ent.inuse)
+ {
// move the pusher back and try again
Math3D.VectorCopy(start, ent.s.origin);
GameBase.gi.linkentity(ent);
//goto retry;
- retry = true;
+ retry= true;
}
}
- } while (retry);
-
+ }
+ while (retry);
+
if (ent.inuse)
GameBase.G_TouchTriggers(ent);
-
+
return trace;
}
@@ -296,61 +323,65 @@ public final class SV {
otherwise riders would continue to slide.
============
*/
- public static boolean SV_Push(edict_t pusher, float[] move, float[] amove) {
+ public static boolean SV_Push(edict_t pusher, float[] move, float[] amove)
+ {
int i, e;
edict_t check, block[];
- float[] mins = { 0, 0, 0 };
- float[] maxs = { 0, 0, 0 };
+ float[] mins= { 0, 0, 0 };
+ float[] maxs= { 0, 0, 0 };
pushed_t p;
- float[] org = { 0, 0, 0 };
- float[] org2 = { 0, 0, 0 };
- float[] move2 = { 0, 0, 0 };
- float[] forward = { 0, 0, 0 };
- float[] right = { 0, 0, 0 };
- float[] up = { 0, 0, 0 };
-
+ float[] org= { 0, 0, 0 };
+ float[] org2= { 0, 0, 0 };
+ float[] move2= { 0, 0, 0 };
+ float[] forward= { 0, 0, 0 };
+ float[] right= { 0, 0, 0 };
+ float[] up= { 0, 0, 0 };
+
// clamp the move to 1/8 units, so the position will
// be accurate for client side prediction
- for (i = 0; i < 3; i++) {
+ for (i= 0; i < 3; i++)
+ {
float temp;
- temp = move[i] * 8.0f;
+ temp= move[i] * 8.0f;
if (temp > 0.0)
temp += 0.5;
else
temp -= 0.5;
- move[i] = 0.125f * (int) temp;
+ move[i]= 0.125f * (int) temp;
}
-
+
// find the bounding box
- for (i = 0; i < 3; i++) {
- mins[i] = pusher.absmin[i] + move[i];
- maxs[i] = pusher.absmax[i] + move[i];
+ for (i= 0; i < 3; i++)
+ {
+ mins[i]= pusher.absmin[i] + move[i];
+ maxs[i]= pusher.absmax[i] + move[i];
}
-
+
// we need this for pushing things later
Math3D.VectorSubtract(GameBase.vec3_origin, amove, org);
Math3D.AngleVectors(org, forward, right, up);
-
+
// save the pusher's original position
- GameBase.pushed[GameBase.pushed_p].ent = pusher;
+ GameBase.pushed[GameBase.pushed_p].ent= pusher;
Math3D.VectorCopy(pusher.s.origin, GameBase.pushed[GameBase.pushed_p].origin);
Math3D.VectorCopy(pusher.s.angles, GameBase.pushed[GameBase.pushed_p].angles);
-
+
if (pusher.client != null)
- GameBase.pushed[GameBase.pushed_p].deltayaw = pusher.client.ps.pmove.delta_angles[Defines.YAW];
-
+ GameBase.pushed[GameBase.pushed_p].deltayaw= pusher.client.ps.pmove.delta_angles[Defines.YAW];
+
GameBase.pushed_p++;
-
+
// move the pusher to it's final position
Math3D.VectorAdd(pusher.s.origin, move, pusher.s.origin);
Math3D.VectorAdd(pusher.s.angles, amove, pusher.s.angles);
GameBase.gi.linkentity(pusher);
-
+
// see if any solid entities are inside the final position
-
+
//check= g_edicts + 1;
- for (e = 1; e < GameBase.globals.num_edicts; e++) {
- check = GameBase.g_edicts[e];
+ for (e= 1; e < GameBase.globals.num_edicts; e++)
+ {
+ check= GameBase.g_edicts[e];
if (!check.inuse)
continue;
if (check.movetype == Defines.MOVETYPE_PUSH
@@ -358,12 +389,13 @@ public final class SV {
|| check.movetype == Defines.MOVETYPE_NONE
|| check.movetype == Defines.MOVETYPE_NOCLIP)
continue;
-
+
if (check.area.prev == null)
continue; // not linked in anywhere
-
+
// if the entity is standing on the pusher, it will definitely be moved
- if (check.groundentity != pusher) {
+ if (check.groundentity != pusher)
+ {
// see if the ent needs to be tested
if (check.absmin[0] >= maxs[0]
|| check.absmin[1] >= maxs[1]
@@ -372,79 +404,85 @@ public final class SV {
|| check.absmax[1] <= mins[1]
|| check.absmax[2] <= mins[2])
continue;
-
+
// see if the ent's bbox is inside the pusher's final position
if (SV_TestEntityPosition(check) == null)
continue;
}
-
- if ((pusher.movetype == Defines.MOVETYPE_PUSH) || (check.groundentity == pusher)) {
+
+ if ((pusher.movetype == Defines.MOVETYPE_PUSH) || (check.groundentity == pusher))
+ {
// move this entity
- GameBase.pushed[GameBase.pushed_p].ent = check;
+ GameBase.pushed[GameBase.pushed_p].ent= check;
Math3D.VectorCopy(check.s.origin, GameBase.pushed[GameBase.pushed_p].origin);
Math3D.VectorCopy(check.s.angles, GameBase.pushed[GameBase.pushed_p].angles);
GameBase.pushed_p++;
-
+
// try moving the contacted entity
Math3D.VectorAdd(check.s.origin, move, check.s.origin);
- if (check.client != null) { // FIXME: doesn't rotate monsters?
+ if (check.client != null)
+ { // FIXME: doesn't rotate monsters?
check.client.ps.pmove.delta_angles[Defines.YAW] += amove[Defines.YAW];
}
-
+
// figure movement due to the pusher's amove
Math3D.VectorSubtract(check.s.origin, pusher.s.origin, org);
- org2[0] = Math3D.DotProduct(org, forward);
- org2[1] = -Math3D.DotProduct(org, right);
- org2[2] = Math3D.DotProduct(org, up);
+ org2[0]= Math3D.DotProduct(org, forward);
+ org2[1]= -Math3D.DotProduct(org, right);
+ org2[2]= Math3D.DotProduct(org, up);
Math3D.VectorSubtract(org2, org, move2);
Math3D.VectorAdd(check.s.origin, move2, check.s.origin);
-
+
// may have pushed them off an edge
if (check.groundentity != pusher)
- check.groundentity = null;
-
- block = SV_TestEntityPosition(check);
- if (block == null) { // pushed ok
+ check.groundentity= null;
+
+ block= SV_TestEntityPosition(check);
+ if (block == null)
+ { // pushed ok
GameBase.gi.linkentity(check);
// impact?
continue;
}
-
+
// if it is ok to leave in the old position, do it
// this is only relevent for riding entities, not pushed
// FIXME: this doesn't acount for rotation
Math3D.VectorSubtract(check.s.origin, move, check.s.origin);
- block = SV_TestEntityPosition(check);
-
- if (block == null) {
+ block= SV_TestEntityPosition(check);
+
+ if (block == null)
+ {
GameBase.pushed_p--;
continue;
}
}
-
+
// save off the obstacle so we can call the block function
- GameBase.obstacle = check;
-
+ GameBase.obstacle= check;
+
// move back any entities we already moved
// go backwards, so if the same entity was pushed
// twice, it goes back to the original position
- for (int ip = GameBase.pushed_p - 1; ip >= 0; ip--) {
- p = GameBase.pushed[ip];
+ for (int ip= GameBase.pushed_p - 1; ip >= 0; ip--)
+ {
+ p= GameBase.pushed[ip];
Math3D.VectorCopy(p.origin, p.ent.s.origin);
Math3D.VectorCopy(p.angles, p.ent.s.angles);
- if (p.ent.client != null) {
- p.ent.client.ps.pmove.delta_angles[Defines.YAW] = (short) p.deltayaw;
+ if (p.ent.client != null)
+ {
+ p.ent.client.ps.pmove.delta_angles[Defines.YAW]= (short) p.deltayaw;
}
GameBase.gi.linkentity(p.ent);
}
return false;
}
-
+
// FIXME: is there a better way to handle this?
// see if anything we moved has touched a trigger
- for (int ip = GameBase.pushed_p - 1; ip >= 0; ip--)
+ for (int ip= GameBase.pushed_p - 1; ip >= 0; ip--)
GameBase.G_TouchTriggers(GameBase.pushed[ip].ent);
-
+
return true;
}
@@ -456,57 +494,65 @@ public final class SV {
push all box objects
================
*/
- public static void SV_Physics_Pusher(edict_t ent) {
- float[] move = { 0, 0, 0 };
- float[] amove = { 0, 0, 0 };
+ public static void SV_Physics_Pusher(edict_t ent)
+ {
+ float[] move= { 0, 0, 0 };
+ float[] amove= { 0, 0, 0 };
edict_t part, mv;
-
+
// if not a team captain, so movement will be handled elsewhere
if ((ent.flags & Defines.FL_TEAMSLAVE) != 0)
return;
-
+
// make sure all team slaves can move before commiting
// any moves or calling any think functions
// if the move is blocked, all moved objects will be backed out
// retry:
- GameBase.pushed_p = 0;
- for (part = ent; part != null; part = part.teamchain) {
+ GameBase.pushed_p= 0;
+ for (part= ent; part != null; part= part.teamchain)
+ {
if (part.velocity[0] != 0
|| part.velocity[1] != 0
|| part.velocity[2] != 0
|| part.avelocity[0] != 0
|| part.avelocity[1] != 0
- || part.avelocity[2] != 0) { // object is moving
+ || part.avelocity[2] != 0)
+ { // object is moving
Math3D.VectorScale(part.velocity, Defines.FRAMETIME, move);
Math3D.VectorScale(part.avelocity, Defines.FRAMETIME, amove);
-
+
if (!SV_Push(part, move, amove))
break; // move was blocked
}
}
if (GameBase.pushed_p > Defines.MAX_EDICTS)
+
SV_GAME.PF_error(Defines.ERR_FATAL, "pushed_p > &pushed[MAX_EDICTS], memory corrupted");
if (part != null) {
// the move failed, bump all nextthink times and back out moves
- for (mv = ent; mv != null; mv = mv.teamchain) {
+ for (mv= ent; mv != null; mv= mv.teamchain)
+ {
if (mv.nextthink > 0)
mv.nextthink += Defines.FRAMETIME;
}
-
+
// if the pusher has a "blocked" function, call it
// otherwise, just stay in place until the obstacle is gone
if (part.blocked != null)
part.blocked.blocked(part, GameBase.obstacle);
- } else { // the move succeeded, so call all think functions
- for (part = ent; part != null; part = part.teamchain) {
+ }
+ else
+ { // the move succeeded, so call all think functions
+ for (part= ent; part != null; part= part.teamchain)
+ {
SV_RunThink(part);
}
}
}
// ==================================================================
-
+
/*
=============
SV_Physics_None
@@ -514,7 +560,8 @@ public final class SV {
Non moving objects can only think
=============
*/
- public static void SV_Physics_None(edict_t ent) {
+ public static void SV_Physics_None(edict_t ent)
+ {
// regular thinking
SV_RunThink(ent);
}
@@ -526,14 +573,15 @@ public final class SV {
A moving object that doesn't obey physics
=============
*/
- public static void SV_Physics_Noclip(edict_t ent) {
+ public static void SV_Physics_Noclip(edict_t ent)
+ {
// regular thinking
if (!SV_RunThink(ent))
return;
-
+
Math3D.VectorMA(ent.s.angles, Defines.FRAMETIME, ent.avelocity, ent.s.angles);
Math3D.VectorMA(ent.s.origin, Defines.FRAMETIME, ent.velocity, ent.s.origin);
-
+
GameBase.gi.linkentity(ent);
}
@@ -544,7 +592,7 @@ public final class SV {
==============================================================================
*/
-
+
/*
=============
SV_Physics_Toss
@@ -552,90 +600,96 @@ public final class SV {
Toss, bounce, and fly movement. When onground, do nothing.
=============
*/
- public static void SV_Physics_Toss(edict_t ent) {
+ public static void SV_Physics_Toss(edict_t ent)
+ {
+
trace_t trace;
- float[] move = { 0, 0, 0 };
+ float[] move= { 0, 0, 0 };
float backoff;
edict_t slave;
boolean wasinwater;
boolean isinwater;
- float[] old_origin = { 0, 0, 0 };
-
+ float[] old_origin= { 0, 0, 0 };
+
// regular thinking
SV_RunThink(ent);
-
+
// if not a team captain, so movement will be handled elsewhere
if ((ent.flags & Defines.FL_TEAMSLAVE) != 0)
return;
-
+
if (ent.velocity[2] > 0)
- ent.groundentity = null;
-
- // check for the groundentity going away
+ ent.groundentity= null;
+
+ // check for the groundentity going away
if (ent.groundentity != null)
if (!ent.groundentity.inuse)
- ent.groundentity = null;
-
+ ent.groundentity= null;
+
// if onground, return without moving
if (ent.groundentity != null)
return;
-
+
Math3D.VectorCopy(ent.s.origin, old_origin);
-
+
SV_CheckVelocity(ent);
-
+
// add gravity
if (ent.movetype != Defines.MOVETYPE_FLY && ent.movetype != Defines.MOVETYPE_FLYMISSILE)
SV_AddGravity(ent);
-
+
// move angles
Math3D.VectorMA(ent.s.angles, Defines.FRAMETIME, ent.avelocity, ent.s.angles);
-
+
// move origin
Math3D.VectorScale(ent.velocity, Defines.FRAMETIME, move);
- trace = SV_PushEntity(ent, move);
+ trace= SV_PushEntity(ent, move);
if (!ent.inuse)
return;
-
- if (trace.fraction < 1) {
+
+ if (trace.fraction < 1)
+ {
if (ent.movetype == Defines.MOVETYPE_BOUNCE)
- backoff = 1.5f;
+ backoff= 1.5f;
else
- backoff = 1;
-
+ backoff= 1;
+
GameBase.ClipVelocity(ent.velocity, trace.plane.normal, ent.velocity, backoff);
-
+
// stop if on ground
- if (trace.plane.normal[2] > 0.7) {
- if (ent.velocity[2] < 60 || ent.movetype != Defines.MOVETYPE_BOUNCE) {
- ent.groundentity = trace.ent;
- ent.groundentity_linkcount = trace.ent.linkcount;
+ if (trace.plane.normal[2] > 0.7)
+ {
+ if (ent.velocity[2] < 60 || ent.movetype != Defines.MOVETYPE_BOUNCE)
+ {
+ ent.groundentity= trace.ent;
+ ent.groundentity_linkcount= trace.ent.linkcount;
Math3D.VectorCopy(GameBase.vec3_origin, ent.velocity);
Math3D.VectorCopy(GameBase.vec3_origin, ent.avelocity);
}
}
-
+
// if (ent.touch)
// ent.touch (ent, trace.ent, &trace.plane, trace.surface);
}
-
+
// check for water transition
- wasinwater = (ent.watertype & Defines.MASK_WATER) != 0;
- ent.watertype = GameBase.gi.pointcontents.pointcontents(ent.s.origin);
- isinwater = (ent.watertype & Defines.MASK_WATER) != 0;
-
+ wasinwater= (ent.watertype & Defines.MASK_WATER) != 0;
+ ent.watertype= GameBase.gi.pointcontents.pointcontents(ent.s.origin);
+ isinwater= (ent.watertype & Defines.MASK_WATER) != 0;
+
if (isinwater)
- ent.waterlevel = 1;
+ ent.waterlevel= 1;
else
- ent.waterlevel = 0;
-
+ ent.waterlevel= 0;
+
if (!wasinwater && isinwater)
GameBase.gi.positioned_sound(old_origin, ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);
else if (wasinwater && !isinwater)
GameBase.gi.positioned_sound(ent.s.origin, ent, Defines.CHAN_AUTO, GameBase.gi.soundindex("misc/h2ohit1.wav"), 1, 1, 0);
-
+
// move teamslaves
- for (slave = ent.teamchain; slave != null; slave = slave.teamchain) {
+ for (slave= ent.teamchain; slave != null; slave= slave.teamchain)
+ {
Math3D.VectorCopy(ent.s.origin, slave.s.origin);
GameBase.gi.linkentity(slave);
}
@@ -648,7 +702,7 @@ public final class SV {
===============================================================================
*/
-
+
/*
=============
SV_Physics_Step
@@ -661,128 +715,140 @@ public final class SV {
FIXME: is this true?
=============
*/
-
+
// FIXME: hacked in for E3 demo
-
- public static void SV_AddRotationalFriction(edict_t ent) {
+
+ public static void SV_AddRotationalFriction(edict_t ent)
+ {
int n;
float adjustment;
-
+
Math3D.VectorMA(ent.s.angles, Defines.FRAMETIME, ent.avelocity, ent.s.angles);
- adjustment = Defines.FRAMETIME * Defines.sv_stopspeed * Defines.sv_friction;
- for (n = 0; n < 3; n++) {
- if (ent.avelocity[n] > 0) {
+ adjustment= Defines.FRAMETIME * Defines.sv_stopspeed * Defines.sv_friction;
+ for (n= 0; n < 3; n++)
+ {
+ if (ent.avelocity[n] > 0)
+ {
ent.avelocity[n] -= adjustment;
if (ent.avelocity[n] < 0)
- ent.avelocity[n] = 0;
- } else {
+ ent.avelocity[n]= 0;
+ }
+ else
+ {
ent.avelocity[n] += adjustment;
if (ent.avelocity[n] > 0)
- ent.avelocity[n] = 0;
+ ent.avelocity[n]= 0;
}
}
}
- public static void SV_Physics_Step(edict_t ent) {
+ public static void SV_Physics_Step(edict_t ent)
+ {
boolean wasonground;
- boolean hitsound = false;
+ boolean hitsound= false;
float vel[];
float speed, newspeed, control;
float friction;
edict_t groundentity;
int mask;
-
+
// airborn monsters should always check for ground
if (ent.groundentity == null)
M.M_CheckGround(ent);
-
- groundentity = ent.groundentity;
-
+
+ groundentity= ent.groundentity;
+
SV_CheckVelocity(ent);
-
+
if (groundentity != null)
- wasonground = true;
+ wasonground= true;
else
- wasonground = false;
-
+ wasonground= false;
+
if (ent.avelocity[0] != 0 || ent.avelocity[1] != 0 || ent.avelocity[2] != 0)
SV_AddRotationalFriction(ent);
-
+
// add gravity except:
// flying monsters
// swimming monsters who are in the water
if (!wasonground)
if (0 == (ent.flags & Defines.FL_FLY))
- if (!((ent.flags & Defines.FL_SWIM) != 0 && (ent.waterlevel > 2))) {
+ if (!((ent.flags & Defines.FL_SWIM) != 0 && (ent.waterlevel > 2)))
+ {
if (ent.velocity[2] < GameBase.sv_gravity.value * -0.1)
- hitsound = true;
+ hitsound= true;
if (ent.waterlevel == 0)
SV_AddGravity(ent);
}
-
+
// friction for flying monsters that have been given vertical velocity
- if ((ent.flags & Defines.FL_FLY) != 0 && (ent.velocity[2] != 0)) {
- speed = Math.abs(ent.velocity[2]);
- control = speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
- friction = Defines.sv_friction / 3;
- newspeed = speed - (Defines.FRAMETIME * control * friction);
+ if ((ent.flags & Defines.FL_FLY) != 0 && (ent.velocity[2] != 0))
+ {
+ speed= Math.abs(ent.velocity[2]);
+ control= speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
+ friction= Defines.sv_friction / 3;
+ newspeed= speed - (Defines.FRAMETIME * control * friction);
if (newspeed < 0)
- newspeed = 0;
+ newspeed= 0;
newspeed /= speed;
ent.velocity[2] *= newspeed;
}
-
+
// friction for flying monsters that have been given vertical velocity
- if ((ent.flags & Defines.FL_SWIM) != 0 && (ent.velocity[2] != 0)) {
- speed = Math.abs(ent.velocity[2]);
- control = speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
- newspeed = speed - (Defines.FRAMETIME * control * Defines.sv_waterfriction * ent.waterlevel);
+ if ((ent.flags & Defines.FL_SWIM) != 0 && (ent.velocity[2] != 0))
+ {
+ speed= Math.abs(ent.velocity[2]);
+ control= speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
+ newspeed= speed - (Defines.FRAMETIME * control * Defines.sv_waterfriction * ent.waterlevel);
if (newspeed < 0)
- newspeed = 0;
+ newspeed= 0;
newspeed /= speed;
ent.velocity[2] *= newspeed;
}
-
- if (ent.velocity[2] != 0 || ent.velocity[1] != 0 || ent.velocity[0] != 0) {
+
+ if (ent.velocity[2] != 0 || ent.velocity[1] != 0 || ent.velocity[0] != 0)
+ {
// apply friction
// let dead monsters who aren't completely onground slide
if ((wasonground) || 0 != (ent.flags & (Defines.FL_SWIM | Defines.FL_FLY)))
- if (!(ent.health <= 0.0 && !M.M_CheckBottom(ent))) {
- vel = ent.velocity;
- speed = (float) Math.sqrt(vel[0] * vel[0] + vel[1] * vel[1]);
- if (speed != 0) {
- friction = Defines.sv_friction;
-
- control = speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
- newspeed = speed - Defines.FRAMETIME * control * friction;
-
+ if (!(ent.health <= 0.0 && !M.M_CheckBottom(ent)))
+ {
+ vel= ent.velocity;
+ speed= (float) Math.sqrt(vel[0] * vel[0] + vel[1] * vel[1]);
+ if (speed != 0)
+ {
+ friction= Defines.sv_friction;
+
+ control= speed < Defines.sv_stopspeed ? Defines.sv_stopspeed : speed;
+ newspeed= speed - Defines.FRAMETIME * control * friction;
+
if (newspeed < 0)
- newspeed = 0;
+ newspeed= 0;
newspeed /= speed;
-
+
vel[0] *= newspeed;
vel[1] *= newspeed;
}
}
-
+
if ((ent.svflags & Defines.SVF_MONSTER) != 0)
- mask = Defines.MASK_MONSTERSOLID;
+ mask= Defines.MASK_MONSTERSOLID;
else
- mask = Defines.MASK_SOLID;
-
+ mask= Defines.MASK_SOLID;
+
SV_FlyMove(ent, Defines.FRAMETIME, mask);
-
+
GameBase.gi.linkentity(ent);
GameBase.G_TouchTriggers(ent);
if (!ent.inuse)
return;
-
+
if (ent.groundentity != null)
if (!wasonground)
if (hitsound)
GameBase.gi.sound(ent, 0, GameBase.gi.soundindex("world/land.wav"), 1, 1, 0);
}
-
+
// regular thinking
SV_RunThink(ent);
}
@@ -799,38 +865,45 @@ public final class SV {
*/
// FIXME since we need to test end position contents here, can we avoid doing
// it again later in catagorize position?
- public static boolean SV_movestep(edict_t ent, float[] move, boolean relink) {
+ public static boolean SV_movestep(edict_t ent, float[] move, boolean relink)
+ {
float dz;
- float[] oldorg = { 0, 0, 0 };
- float[] neworg = { 0, 0, 0 };
- float[] end = { 0, 0, 0 };
-
- trace_t trace = null;// = new trace_t();
+ float[] oldorg= { 0, 0, 0 };
+ float[] neworg= { 0, 0, 0 };
+ float[] end= { 0, 0, 0 };
+
+ trace_t trace= null; // = new trace_t();
int i;
float stepsize;
- float[] test = { 0, 0, 0 };
+ float[] test= { 0, 0, 0 };
int contents;
-
+
// try the move
Math3D.VectorCopy(ent.s.origin, oldorg);
Math3D.VectorAdd(ent.s.origin, move, neworg);
-
+
// flying monsters don't step up
- if ((ent.flags & (Defines.FL_SWIM | Defines.FL_FLY)) != 0) {
+ if ((ent.flags & (Defines.FL_SWIM | Defines.FL_FLY)) != 0)
+ {
// try one move with vertical motion, then one without
- for (i = 0; i < 2; i++) {
+ for (i= 0; i < 2; i++)
+ {
Math3D.VectorAdd(ent.s.origin, move, neworg);
- if (i == 0 && ent.enemy != null) {
+ if (i == 0 && ent.enemy != null)
+ {
if (ent.goalentity == null)
- ent.goalentity = ent.enemy;
- dz = ent.s.origin[2] - ent.goalentity.s.origin[2];
- if (ent.goalentity.client != null) {
+ ent.goalentity= ent.enemy;
+ dz= ent.s.origin[2] - ent.goalentity.s.origin[2];
+ if (ent.goalentity.client != null)
+ {
if (dz > 40)
neworg[2] -= 8;
if (!((ent.flags & Defines.FL_SWIM) != 0 && (ent.waterlevel < 2)))
if (dz < 30)
neworg[2] += 8;
- } else {
+ }
+ else
+ {
if (dz > 8)
neworg[2] -= 8;
else if (dz > 0)
@@ -841,104 +914,118 @@ public final class SV {
neworg[2] += dz;
}
}
- trace = GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, neworg, ent, Defines.MASK_MONSTERSOLID);
-
+ trace= GameBase.gi.trace(ent.s.origin, ent.mins, ent.maxs, neworg, ent, Defines.MASK_MONSTERSOLID);
+
// fly monsters don't enter water voluntarily
- if ((ent.flags & Defines.FL_FLY) != 0) {
- if (ent.waterlevel == 0) {
- test[0] = trace.endpos[0];
- test[1] = trace.endpos[1];
- test[2] = trace.endpos[2] + ent.mins[2] + 1;
- contents = GameBase.gi.pointcontents.pointcontents(test);
+ if ((ent.flags & Defines.FL_FLY) != 0)
+ {
+ if (ent.waterlevel == 0)
+ {
+ test[0]= trace.endpos[0];
+ test[1]= trace.endpos[1];
+ test[2]= trace.endpos[2] + ent.mins[2] + 1;
+ contents= GameBase.gi.pointcontents.pointcontents(test);
if ((contents & Defines.MASK_WATER) != 0)
return false;
}
}
-
+
// swim monsters don't exit water voluntarily
- if ((ent.flags & Defines.FL_SWIM) != 0) {
- if (ent.waterlevel < 2) {
- test[0] = trace.endpos[0];
- test[1] = trace.endpos[1];
- test[2] = trace.endpos[2] + ent.mins[2] + 1;
- contents = GameBase.gi.pointcontents.pointcontents(test);
+ if ((ent.flags & Defines.FL_SWIM) != 0)
+ {
+ if (ent.waterlevel < 2)
+ {
+ test[0]= trace.endpos[0];
+ test[1]= trace.endpos[1];
+ test[2]= trace.endpos[2] + ent.mins[2] + 1;
+ contents= GameBase.gi.pointcontents.pointcontents(test);
if ((contents & Defines.MASK_WATER) == 0)
return false;
}
}
-
- if (trace.fraction == 1) {
+
+ if (trace.fraction == 1)
+ {
Math3D.VectorCopy(trace.endpos, ent.s.origin);
- if (relink) {
+ if (relink)
+ {
GameBase.gi.linkentity(ent);
GameBase.G_TouchTriggers(ent);
}
return true;
}
-
+
if (ent.enemy == null)
break;
}
-
+
return false;
}
-
+
// push down from a step height above the wished position
if ((ent.monsterinfo.aiflags & Defines.AI_NOSTEP) == 0)
- stepsize = GameBase.STEPSIZE;
+ stepsize= GameBase.STEPSIZE;
else
- stepsize = 1;
-
+ stepsize= 1;
+
neworg[2] += stepsize;
Math3D.VectorCopy(neworg, end);
end[2] -= stepsize * 2;
-
- trace = GameBase.gi.trace(neworg, ent.mins, ent.maxs, end, ent, Defines.MASK_MONSTERSOLID);
-
+
+ trace= GameBase.gi.trace(neworg, ent.mins, ent.maxs, end, ent, Defines.MASK_MONSTERSOLID);
+
if (trace.allsolid)
return false;
-
- if (trace.startsolid) {
+
+ if (trace.startsolid)
+ {
neworg[2] -= stepsize;
- trace = GameBase.gi.trace(neworg, ent.mins, ent.maxs, end, ent, Defines.MASK_MONSTERSOLID);
+ trace= GameBase.gi.trace(neworg, ent.mins, ent.maxs, end, ent, Defines.MASK_MONSTERSOLID);
if (trace.allsolid || trace.startsolid)
return false;
}
-
+
// don't go in to water
- if (ent.waterlevel == 0) {
- test[0] = trace.endpos[0];
- test[1] = trace.endpos[1];
- test[2] = trace.endpos[2] + ent.mins[2] + 1;
- contents = GameBase.gi.pointcontents.pointcontents(test);
-
+ if (ent.waterlevel == 0)
+ {
+ test[0]= trace.endpos[0];
+ test[1]= trace.endpos[1];
+ test[2]= trace.endpos[2] + ent.mins[2] + 1;
+ contents= GameBase.gi.pointcontents.pointcontents(test);
+
if ((contents & Defines.MASK_WATER) != 0)
return false;
}
-
- if (trace.fraction == 1) {
+
+ if (trace.fraction == 1)
+ {
// if monster had the ground pulled out, go ahead and fall
- if ((ent.flags & Defines.FL_PARTIALGROUND) != 0) {
+ if ((ent.flags & Defines.FL_PARTIALGROUND) != 0)
+ {
Math3D.VectorAdd(ent.s.origin, move, ent.s.origin);
- if (relink) {
+ if (relink)
+ {
GameBase.gi.linkentity(ent);
GameBase.G_TouchTriggers(ent);
}
- ent.groundentity = null;
+ ent.groundentity= null;
return true;
}
-
+
return false; // walked off an edge
}
-
+
// check point traces down for dangling corners
Math3D.VectorCopy(trace.endpos, ent.s.origin);
-
- if (!M.M_CheckBottom(ent)) {
- if ((ent.flags & Defines.FL_PARTIALGROUND) != 0) {
+
+ if (!M.M_CheckBottom(ent))
+ {
+ if ((ent.flags & Defines.FL_PARTIALGROUND) != 0)
+ {
// entity had floor mostly pulled out from underneath it
// and is trying to correct
- if (relink) {
+ if (relink)
+ {
GameBase.gi.linkentity(ent);
GameBase.G_TouchTriggers(ent);
}
@@ -947,15 +1034,17 @@ public final class SV {
Math3D.VectorCopy(oldorg, ent.s.origin);
return false;
}
-
- if ((ent.flags & Defines.FL_PARTIALGROUND) != 0) {
+
+ if ((ent.flags & Defines.FL_PARTIALGROUND) != 0)
+ {
ent.flags &= ~Defines.FL_PARTIALGROUND;
}
- ent.groundentity = trace.ent;
- ent.groundentity_linkcount = trace.ent.linkcount;
-
+ ent.groundentity= trace.ent;
+ ent.groundentity_linkcount= trace.ent.linkcount;
+
// the move is ok
- if (relink) {
+ if (relink)
+ {
GameBase.gi.linkentity(ent);
GameBase.G_TouchTriggers(ent);
}
@@ -971,23 +1060,26 @@ public final class SV {
======================
*/
- public static boolean SV_StepDirection(edict_t ent, float yaw, float dist) {
- float[] move = { 0, 0, 0 };
- float[] oldorigin = { 0, 0, 0 };
+ public static boolean SV_StepDirection(edict_t ent, float yaw, float dist)
+ {
+ float[] move= { 0, 0, 0 };
+ float[] oldorigin= { 0, 0, 0 };
float delta;
-
- ent.ideal_yaw = yaw;
+
+ ent.ideal_yaw= yaw;
M.M_ChangeYaw(ent);
-
- yaw = (float) (yaw * Math.PI * 2 / 360);
- move[0] = (float) Math.cos(yaw) * dist;
- move[1] = (float) Math.sin(yaw) * dist;
- move[2] = 0;
-
+
+ yaw= (float) (yaw * Math.PI * 2 / 360);
+ move[0]= (float) Math.cos(yaw) * dist;
+ move[1]= (float) Math.sin(yaw) * dist;
+ move[2]= 0;
+
Math3D.VectorCopy(ent.s.origin, oldorigin);
- if (SV_movestep(ent, move, false)) {
- delta = ent.s.angles[Defines.YAW] - ent.ideal_yaw;
- if (delta > 45 && delta < 315) { // not turned far enough, so don't take the step
+ if (SV_movestep(ent, move, false))
+ {
+ delta= ent.s.angles[Defines.YAW] - ent.ideal_yaw;
+ if (delta > 45 && delta < 315)
+ { // not turned far enough, so don't take the step
Math3D.VectorCopy(oldorigin, ent.s.origin);
}
GameBase.gi.linkentity(ent);
@@ -1005,86 +1097,93 @@ public final class SV {
======================
*/
- public static void SV_FixCheckBottom(edict_t ent) {
+ public static void SV_FixCheckBottom(edict_t ent)
+ {
ent.flags |= Defines.FL_PARTIALGROUND;
}
- public static void SV_NewChaseDir(edict_t actor, edict_t enemy, float dist) {
+ public static void SV_NewChaseDir(edict_t actor, edict_t enemy, float dist)
+ {
float deltax, deltay;
- float d[] = { 0, 0, 0 };
+ float d[]= { 0, 0, 0 };
float tdir, olddir, turnaround;
-
+
//FIXME: how did we get here with no enemy
if (enemy == null)
{
Com.DPrintf("SV_NewChaseDir without enemy!\n");
return;
}
- olddir = Math3D.anglemod((int) (actor.ideal_yaw / 45) * 45);
- turnaround = Math3D.anglemod(olddir - 180);
-
- deltax = enemy.s.origin[0] - actor.s.origin[0];
- deltay = enemy.s.origin[1] - actor.s.origin[1];
+ olddir= Math3D.anglemod((int) (actor.ideal_yaw / 45) * 45);
+ turnaround= Math3D.anglemod(olddir - 180);
+
+ deltax= enemy.s.origin[0] - actor.s.origin[0];
+ deltay= enemy.s.origin[1] - actor.s.origin[1];
if (deltax > 10)
- d[1] = 0;
+ d[1]= 0;
else if (deltax < -10)
- d[1] = 180;
+ d[1]= 180;
else
- d[1] = GameBase.DI_NODIR;
+ d[1]= GameBase.DI_NODIR;
if (deltay < -10)
- d[2] = 270;
+ d[2]= 270;
else if (deltay > 10)
- d[2] = 90;
+ d[2]= 90;
else
- d[2] = GameBase.DI_NODIR;
-
+ d[2]= GameBase.DI_NODIR;
+
// try direct route
- if (d[1] != GameBase.DI_NODIR && d[2] != GameBase.DI_NODIR) {
+ if (d[1] != GameBase.DI_NODIR && d[2] != GameBase.DI_NODIR)
+ {
if (d[1] == 0)
- tdir = d[2] == 90 ? 45 : 315;
+ tdir= d[2] == 90 ? 45 : 315;
else
- tdir = d[2] == 90 ? 135 : 215;
-
+ tdir= d[2] == 90 ? 135 : 215;
+
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
}
-
+
// try other directions
- if (((Lib.rand() & 3) & 1) != 0 || Math.abs(deltay) > Math.abs(deltax)) {
- tdir = d[1];
- d[1] = d[2];
- d[2] = tdir;
+ if (((Lib.rand() & 3) & 1) != 0 || Math.abs(deltay) > Math.abs(deltax))
+ {
+ tdir= d[1];
+ d[1]= d[2];
+ d[2]= tdir;
}
-
+
if (d[1] != GameBase.DI_NODIR && d[1] != turnaround && SV_StepDirection(actor, d[1], dist))
return;
-
+
if (d[2] != GameBase.DI_NODIR && d[2] != turnaround && SV_StepDirection(actor, d[2], dist))
return;
-
+
/* there is no direct path to the player, so pick another direction */
-
+
if (olddir != GameBase.DI_NODIR && SV_StepDirection(actor, olddir, dist))
return;
-
- if ((Lib.rand() & 1) != 0) /*randomly determine direction of search*/ {
- for (tdir = 0; tdir <= 315; tdir += 45)
+
+ if ((Lib.rand() & 1) != 0) /*randomly determine direction of search*/
+ {
+ for (tdir= 0; tdir <= 315; tdir += 45)
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
- } else {
- for (tdir = 315; tdir >= 0; tdir -= 45)
+ }
+ else
+ {
+ for (tdir= 315; tdir >= 0; tdir -= 45)
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
}
-
+
if (turnaround != GameBase.DI_NODIR && SV_StepDirection(actor, turnaround, dist))
return;
-
- actor.ideal_yaw = olddir; // can't move
-
+
+ actor.ideal_yaw= olddir; // can't move
+
// if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all
-
+
if (!M.M_CheckBottom(actor))
SV_FixCheckBottom(actor);
}
@@ -1094,11 +1193,13 @@ public final class SV {
SV_CloseEnough
======================
- *///ok
- public static boolean SV_CloseEnough(edict_t ent, edict_t goal, float dist) {
+ */ //ok
+ public static boolean SV_CloseEnough(edict_t ent, edict_t goal, float dist)
+ {
int i;
-
- for (i = 0; i < 3; i++) {
+
+ for (i= 0; i < 3; i++)
+ {
if (goal.absmin[i] > ent.absmax[i] + dist)
return false;
if (goal.absmax[i] < ent.absmin[i] - dist)
diff --git a/src/jake2/server/SV_CCMDS.java b/src/jake2/server/SV_CCMDS.java
index 105e156..a5b509f 100644
--- a/src/jake2/server/SV_CCMDS.java
+++ b/src/jake2/server/SV_CCMDS.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 18.01.2004 by RST.
-// $Id: SV_CCMDS.java,v 1.5 2004-07-23 10:09:01 hzi Exp $
+// $Id: SV_CCMDS.java,v 1.6 2004-08-20 21:29:57 salomo Exp $
package jake2.server;
@@ -29,12 +29,14 @@ import jake2.qcommon.*;
import jake2.sys.NET;
import jake2.sys.Sys;
import jake2.util.Lib;
+import jake2.util.QuakeFile;
import jake2.util.Vargs;
import java.io.*;
import java.util.Calendar;
-public class SV_CCMDS extends SV_ENTS {
+public class SV_CCMDS extends SV_ENTS
+{
/*
===============================================================================
@@ -52,11 +54,13 @@ public class SV_CCMDS extends SV_ENTS {
Specify a list of master servers
====================
*/
- public static void SV_SetMaster_f() {
+ public static void SV_SetMaster_f()
+ {
int i, slot;
// only dedicated servers send heartbeats
- if (dedicated.value == 0) {
+ if (dedicated.value == 0)
+ {
Com.Printf("Only dedicated servers use masters.\n");
return;
}
@@ -64,21 +68,23 @@ public class SV_CCMDS extends SV_ENTS {
// make sure the server is listed public
Cvar.Set("public", "1");
- for (i = 1; i < MAX_MASTERS; i++)
+ for (i= 1; i < MAX_MASTERS; i++)
//memset (&master_adr[i], 0, sizeof(master_adr[i]));
- master_adr[i] = new netadr_t();
+ master_adr[i]= new netadr_t();
- slot = 1; // slot 0 will always contain the id master
- for (i = 1; i < Cmd.Argc(); i++) {
+ slot= 1; // slot 0 will always contain the id master
+ for (i= 1; i < Cmd.Argc(); i++)
+ {
if (slot == MAX_MASTERS)
break;
- if (!NET.StringToAdr(Cmd.Argv(i), master_adr[i])) {
+ if (!NET.StringToAdr(Cmd.Argv(i), master_adr[i]))
+ {
Com.Printf("Bad address: " + Cmd.Argv(i) + "\n");
continue;
}
if (master_adr[slot].port == 0)
- master_adr[slot].port = //BigShort (PORT_MASTER);
+ master_adr[slot].port= //BigShort (PORT_MASTER);
PORT_MASTER;
Com.Printf("Master server at " + NET.AdrToString(master_adr[slot]) + "\n");
@@ -90,7 +96,7 @@ public class SV_CCMDS extends SV_ENTS {
slot++;
}
- svs.last_heartbeat = -9999999;
+ svs.last_heartbeat= -9999999;
}
/*
@@ -100,7 +106,8 @@ public class SV_CCMDS extends SV_ENTS {
Sets sv_client and sv_player to the player with idnum Cmd.Argv(1)
==================
*/
- public static boolean SV_SetPlayer() {
+ public static boolean SV_SetPlayer()
+ {
client_t cl;
int i;
int idnum;
@@ -109,19 +116,22 @@ public class SV_CCMDS extends SV_ENTS {
if (Cmd.Argc() < 2)
return false;
- s = Cmd.Argv(1);
+ s= Cmd.Argv(1);
// numeric values are just slot numbers
- if (s.charAt(0) >= '0' && s.charAt(0) <= '9') {
- idnum = atoi(Cmd.Argv(1));
- if (idnum < 0 || idnum >= maxclients.value) {
+ if (s.charAt(0) >= '0' && s.charAt(0) <= '9')
+ {
+ idnum= atoi(Cmd.Argv(1));
+ if (idnum < 0 || idnum >= maxclients.value)
+ {
Com.Printf("Bad client slot: " + idnum + "\n");
return false;
}
- sv_client = svs.clients[idnum];
- sv_player = sv_client.edict;
- if (0 == sv_client.state) {
+ sv_client= svs.clients[idnum];
+ sv_player= sv_client.edict;
+ if (0 == sv_client.state)
+ {
Com.Printf("Client " + idnum + " is not active\n");
return false;
}
@@ -129,13 +139,15 @@ public class SV_CCMDS extends SV_ENTS {
}
// check for a name match
- for (i = 0; i < maxclients.value; i++) {
- cl = svs.clients[i];
+ for (i= 0; i < maxclients.value; i++)
+ {
+ cl= svs.clients[i];
if (0 == cl.state)
continue;
- if (0 == strcmp(cl.name, s)) {
- sv_client = cl;
- sv_player = sv_client.edict;
+ if (0 == strcmp(cl.name, s))
+ {
+ sv_client= cl;
+ sv_player= sv_client.edict;
return true;
}
}
@@ -152,11 +164,14 @@ public class SV_CCMDS extends SV_ENTS {
===============================================================================
*/
- public static void remove(String name) {
- try {
+ public static void remove(String name)
+ {
+ try
+ {
new File(name).delete();
}
- catch (Exception e) {
+ catch (Exception e)
+ {
}
}
@@ -167,7 +182,8 @@ public class SV_CCMDS extends SV_ENTS {
Delete save/<XXX>/
=====================
*/
- public static void SV_WipeSavegame(String savename) {
+ public static void SV_WipeSavegame(String savename)
+ {
//char name[MAX_OSPATH];
//char *s;
@@ -175,28 +191,30 @@ public class SV_CCMDS extends SV_ENTS {
Com.DPrintf("SV_WipeSaveGame(" + savename + ")\n");
- name = FS.Gamedir() + "/save/" + savename + "/server.ssv";
+ name= FS.Gamedir() + "/save/" + savename + "/server.ssv";
remove(name);
- name = FS.Gamedir() + "/save/" + savename + "/game.ssv";
+ name= FS.Gamedir() + "/save/" + savename + "/game.ssv";
remove(name);
- name = FS.Gamedir() + "/save/" + savename + "/*.sav";
+ name= FS.Gamedir() + "/save/" + savename + "/*.sav";
- File f = Sys.FindFirst(name, 0, 0);
- while (f != null) {
+ File f= Sys.FindFirst(name, 0, 0);
+ while (f != null)
+ {
f.delete();
- f = Sys.FindNext();
+ f= Sys.FindNext();
}
Sys.FindClose();
- name = FS.Gamedir() + "/save/" + savename + "/*.sv2";
+ name= FS.Gamedir() + "/save/" + savename + "/*.sv2";
- f = Sys.FindFirst(name, 0, 0);
+ f= Sys.FindFirst(name, 0, 0);
- while (f != null) {
+ while (f != null)
+ {
f.delete();
- f = Sys.FindNext();
+ f= Sys.FindNext();
}
Sys.FindClose();
}
@@ -206,64 +224,80 @@ public class SV_CCMDS extends SV_ENTS {
CopyFile
================
*/
- public static void CopyFile(String src, String dst) {
+ public static void CopyFile(String src, String dst)
+ {
RandomAccessFile f1, f2;
- int l = -1;
- byte buffer[] = new byte[65536];
+ int l= -1;
+ byte buffer[]= new byte[65536];
Com.DPrintf("CopyFile (" + src + ", " + dst + ")\n");
-
- try {
- f1 = new RandomAccessFile(src, "r");
+ System.out.println("CopyFile (" + src + ", " + dst + ")\n");
+ try
+ {
+ f1= new RandomAccessFile(src, "r");
}
- catch (Exception e) {
+ catch (Exception e)
+ {
return;
}
- try {
+ try
+ {
- f2 = new RandomAccessFile(dst, "rw");
+ f2= new RandomAccessFile(dst, "rw");
}
- catch (Exception e) {
- try {
+ catch (Exception e)
+ {
+ try
+ {
f1.close();
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
e1.printStackTrace();
}
return;
}
- while (true) {
+ while (true)
+ {
- try {
- l = f1.read(buffer, 0, 65536);
+ try
+ {
+ l= f1.read(buffer, 0, 65536);
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
e1.printStackTrace();
}
if (l == -1)
break;
- try {
+ try
+ {
f2.write(buffer, 0, l);
}
- catch (IOException e2) {
+ catch (IOException e2)
+ {
e2.printStackTrace();
}
}
- try {
+ try
+ {
f1.close();
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
e1.printStackTrace();
}
- try {
+ try
+ {
f2.close();
}
- catch (IOException e2) {
+ catch (IOException e2)
+ {
e2.printStackTrace();
}
@@ -274,7 +308,8 @@ public class SV_CCMDS extends SV_ENTS {
SV_CopySaveGame
================
*/
- public static void SV_CopySaveGame(String src, String dst) {
+ public static void SV_CopySaveGame(String src, String dst)
+ {
//char name[MAX_OSPATH], name2[MAX_OSPATH];
int l, len;
File found;
@@ -286,24 +321,26 @@ public class SV_CCMDS extends SV_ENTS {
SV_WipeSavegame(dst);
// copy the savegame over
- name = FS.Gamedir() + "/save/" + src + "/server.ssv";
- name2 = FS.Gamedir() + "/save/" + dst + "/server.ssv";
+ name= FS.Gamedir() + "/save/" + src + "/server.ssv";
+ name2= FS.Gamedir() + "/save/" + dst + "/server.ssv";
FS.CreatePath(name2);
CopyFile(name, name2);
- name = FS.Gamedir() + "/save/" + src + "/game.ssv";
- name2 = "/save/" + dst + "/game.ssv";
+ name= FS.Gamedir() + "/save/" + src + "/game.ssv";
+ name2= FS.Gamedir() + "/save/" + dst + "/game.ssv";
CopyFile(name, name2);
- String name1 = FS.Gamedir() + "/save/" + src + "/";
- len = name1.length();
- name = FS.Gamedir() + "/save/" + src + "/*.sav";
+ String name1= FS.Gamedir() + "/save/" + src + "/";
+ len= name1.length();
+ name= FS.Gamedir() + "/save/" + src + "/*.sav";
- found = Sys.FindFirst(name, 0, 0);
+ found= Sys.FindFirst(name, 0, 0);
- while (found != null) {
- name = name1 + '/' + found.getName();
- name2 = FS.Gamedir() + "/save/" + dst + "/" + found.getName();
+ while (found != null)
+ {
+ name= name1 + found.getName();
+ name2= FS.Gamedir() + "/save/" + dst + "/" + found.getName();
+
CopyFile(name, name2);
// change sav to sv2
@@ -311,12 +348,12 @@ public class SV_CCMDS extends SV_ENTS {
//strcpy(name + l - 3, "sv2");
//l = strlen(name2);
//strcpy(name2 + l - 3, "sv2");
- name = name.substring(0, name.length() - 3) + "sv2";
- name2 = name.substring(0, name2.length() - 3) + "sv2";
+ name= name.substring(0, name.length() - 3) + "sv2";
+ name2= name2.substring(0, name2.length() - 3) + "sv2";
CopyFile(name, name2);
- found = Sys.FindNext();
+ found= Sys.FindNext();
}
Sys.FindClose();
}
@@ -327,38 +364,33 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_WriteLevelFile() {
- //char name[MAX_OSPATH];
- //FILE * f;
+ public static void SV_WriteLevelFile()
+ {
String name;
- RandomAccessFile f;
+ QuakeFile f;
Com.DPrintf("SV_WriteLevelFile()\n");
- name = FS.Gamedir() + "/save/current/" + sv.name + ".sv2";
+ name= FS.Gamedir() + "/save/current/" + sv.name + ".sv2";
- try {
- f = new RandomAccessFile(name, "rw");
- }
- catch (Exception e) {
- Com.Printf("Failed to open " + name + "\n");
- return;
- }
- try {
- //fwrite(sv.configstrings, sizeof(sv.configstrings), 1, f);
- for (int i = 0; i < sv.configstrings.length; i++)
- Lib.fwriteString(sv.configstrings[i], MAX_QPATH, f);
+ try
+ {
+ f= new QuakeFile(name, "rw");
+
+ for (int i= 0; i < MAX_CONFIGSTRINGS; i++)
+ f.writeString(sv.configstrings[i]);
CM.CM_WritePortalState(f);
f.close();
}
- catch (Exception e) {
- Com.Printf("IOError in SV_WriteLevelFile: " + e);
+ catch (Exception e)
+ {
+ Com.Printf("Failed to open " + name + "\n");
e.printStackTrace();
}
- name = FS.Gamedir() + "/save/current/" + sv.name + ".sav";
+ name= FS.Gamedir() + "/save/current/" + sv.name + ".sav";
ge.WriteLevel(name);
}
@@ -368,36 +400,35 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_ReadLevelFile() {
+ public static void SV_ReadLevelFile()
+ {
//char name[MAX_OSPATH];
String name;
- RandomAccessFile f;
+ QuakeFile f;
Com.DPrintf("SV_ReadLevelFile()\n");
- name = FS.Gamedir() + "/save/current/" + sv.name + ".sv2";
- try {
- f = new RandomAccessFile(name, "r");
- }
- catch (Exception e) {
- Com.Printf("Failed to open " + name + "\n");
- return;
- }
- // FS.Read(sv.configstrings, sizeof(sv.configstrings), f);
- for (int n = 0; n < MAX_CONFIGSTRINGS; n++)
- sv.configstrings[n] = Lib.freadString(f, MAX_QPATH);
+ name= FS.Gamedir() + "/save/current/" + sv.name + ".sv2";
+ try
+ {
+ f= new QuakeFile(name, "r");
- CM.CM_ReadPortalState(f);
+ for (int n= 0; n < MAX_CONFIGSTRINGS; n++)
+ sv.configstrings[n]= f.readString();
+
+ CM.CM_ReadPortalState(f);
- try {
f.close();
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
+ Com.Printf("Failed to open " + name + "\n");
e1.printStackTrace();
}
- name = FS.Gamedir() + "/save/current/" + sv.name + ".sav";
+ name= FS.Gamedir() + "/save/current/" + sv.name + ".sav";
ge.ReadLevel(name);
+ System.out.println("all done!");
}
/*
@@ -406,83 +437,77 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_WriteServerFile(boolean autosave) {
- RandomAccessFile f;
+ public static void SV_WriteServerFile(boolean autosave)
+ {
+ QuakeFile f;
cvar_t var;
- //char name[MAX_OSPATH], string[128];
- //char comment[32];
- //time_t aclock;
- //struct tm * newtime;
- String name, string, comment;
+
+ String filename, name, string, comment;
Com.DPrintf("SV_WriteServerFile(" + (autosave ? "true" : "false") + ")\n");
- name = FS.Gamedir() + "/save/current/server.ssv";
- try {
- f = new RandomAccessFile(name, "rw");
- } catch (FileNotFoundException e) {
- f = null;
- }
- if (f == null) {
- Com.Printf("Couldn't write " + name + "\n");
- return;
- }
- // write the comment field
- //memset(comment, 0, sizeof(comment));
-
- if (!autosave) {
- //time( aclock);
- //newtime = localtime( aclock);
- Calendar c = Calendar.getInstance();
- comment =
- Com.sprintf(
- "%2i:%2i %2i/%2i ",
- new Vargs()
- .add(c.get(Calendar.HOUR_OF_DAY))
- .add(c.get(Calendar.MINUTE))
- .add(c.get(Calendar.MONTH) + 1)
- .add(c.get(Calendar.DAY_OF_MONTH)));
- comment += sv.configstrings[CS_NAME];
- }
- else { // autosaved
- comment = "ENTERING " + sv.configstrings[CS_NAME];
- }
+ filename= FS.Gamedir() + "/save/current/server.ssv";
+ try
+ {
+ f= new QuakeFile(filename, "rw");
+
+ if (!autosave)
+ {
+ Calendar c= Calendar.getInstance();
+ comment=
+ Com.sprintf(
+ "%2i:%2i %2i/%2i ",
+ new Vargs().add(c.get(Calendar.HOUR_OF_DAY)).add(c.get(Calendar.MINUTE)).add(c.get(Calendar.MONTH) + 1).add(
+ c.get(Calendar.DAY_OF_MONTH)));
+ comment += sv.configstrings[CS_NAME];
+ }
+ else
+ {
+ // autosaved
+ comment= "ENTERING " + sv.configstrings[CS_NAME];
+ }
- try {
- fwriteString(comment, 32, f);
- fwriteString(svs.mapcmd, MAX_TOKEN_CHARS, f);
+ f.writeString(comment);
+ f.writeString(svs.mapcmd);
+
+ // write the mapcmd
+
+ // write all CVAR_LATCH cvars
+ // these will be things like coop, skill, deathmatch, etc
+ for (var= Globals.cvar_vars; var != null; var= var.next)
+ {
+ if (0 == (var.flags & CVAR_LATCH))
+ continue;
+ if (var.name.length() >= MAX_OSPATH - 1 || var.string.length() >= 128 - 1)
+ {
+ Com.Printf("Cvar too long: " + var.name + " = " + var.string + "\n");
+ continue;
+ }
- } catch (IOException e1) {}
+ name= var.name;
+ string= var.string;
+ try
+ {
+ f.writeString(name);
+ f.writeString(string);
+ }
+ catch (IOException e2)
+ {
+ }
- // write the mapcmd
-
- // write all CVAR_LATCH cvars
- // these will be things like coop, skill, deathmatch, etc
- for (var = Globals.cvar_vars; var != null; var = var.next) {
- if (0 == (var.flags & CVAR_LATCH))
- continue;
- if (var.name.length() >= MAX_OSPATH - 1 || var.string.length() >= 128 - 1) {
- Com.Printf("Cvar too long: " + var.name + " = " + var.string + "\n");
- continue;
}
- //memset(name, 0, sizeof(name));
- //memset(string, 0, sizeof(string));
- name = var.name;
- string = var.string;
- try {
- fwriteString(name, MAX_OSPATH, f);
- fwriteString(string, 128, f);
- } catch (IOException e2) {}
-
- }
-
- try {
+ // rst: for termination.
+ f.writeString(null);
f.close();
- } catch (IOException e2) {}
+ }
+ catch (Exception e)
+ {
+ Com.Printf("Couldn't write " + filename + "\n");
+ }
// write game state
- name = FS.Gamedir() + "/save/current/game.ssv";
- ge.WriteGame(name, autosave);
+ filename= FS.Gamedir() + "/save/current/game.ssv";
+ ge.WriteGame(filename, autosave);
}
/*
@@ -491,58 +516,59 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_ReadServerFile() {
- RandomAccessFile f;
- //char name[MAX_OSPATH], string[128];
- //char comment[32];
- //char mapcmd[MAX_TOKEN_CHARS];
+ public static void SV_ReadServerFile()
+ {
+ String filename, name= "", string, comment, mapcmd;
+ try
+ {
+ QuakeFile f;
- String name, string, comment, mapcmd;
+ mapcmd= "";
- Com.DPrintf("SV_ReadServerFile()\n");
+ Com.DPrintf("SV_ReadServerFile()\n");
- name = FS.Gamedir() + "/save/current/server.ssv";
- try {
- f = new RandomAccessFile(name, "r");
- }
- catch (FileNotFoundException e1) {
- Com.Printf("Couldn't read " + name + "\n");
- e1.printStackTrace();
- return;
- }
- // read the comment field
- comment = Lib.freadString(f, 32);
-
- // read the mapcmd
- mapcmd = Lib.freadString(f, MAX_TOKEN_CHARS);
-
- // read all CVAR_LATCH cvars
- // these will be things like coop, skill, deathmatch, etc
- while (true) {
- name = Lib.freadString(f, MAX_OSPATH);
- //if (!fread(name, 1, sizeof(name), f))
- if (name == null)
- break;
- string = Lib.freadString(f, 128);
- Com.DPrintf("Set " + name + " = " + string + "\n");
- Cvar.ForceSet(name, string);
- }
+ filename= FS.Gamedir() + "/save/current/server.ssv";
+
+ f= new QuakeFile(filename, "r");
+
+ // read the comment field
+
+ comment= f.readString();
+
+ // read the mapcmd
+
+ mapcmd= f.readString();
+
+ // read all CVAR_LATCH cvars
+ // these will be things like coop, skill, deathmatch, etc
+ while (true)
+ {
+ name= f.readString();
+ if (name == null)
+ break;
+ string= f.readString();
+
+ Com.DPrintf("Set " + name + " = " + string + "\n");
+ Cvar.ForceSet(name, string);
+ }
- try {
f.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- // start a new game fresh with new cvars
- SV_InitGame();
+ // start a new game fresh with new cvars
+ SV_InitGame();
- svs.mapcmd = mapcmd;
+ svs.mapcmd= mapcmd;
- // read game state
- name = FS.Gamedir() + "/save/current/game.ssv";
- ge.ReadGame(name);
+ // read game state
+ filename= FS.Gamedir() + "/save/current/game.ssv";
+ ge.ReadGame(filename);
+ }
+ catch (Exception e)
+ {
+ Com.Printf("Couldn't read file " + name + "\n");
+ System.err.println(e);
+ e.printStackTrace();
+ }
}
//=========================================================
@@ -554,7 +580,8 @@ public class SV_CCMDS extends SV_ENTS {
Puts the server in demo mode on a specific map/cinematic
==================
*/
- public static void SV_DemoMap_f() {
+ public static void SV_DemoMap_f()
+ {
SV_Map(true, Cmd.Argv(1), false);
}
@@ -576,13 +603,15 @@ public class SV_CCMDS extends SV_ENTS {
goes to map jail.bsp.
==================
*/
- public static void SV_GameMap_f() {
+ public static void SV_GameMap_f()
+ {
String map;
int i;
client_t cl;
boolean savedInuse[];
- if (Cmd.Argc() != 2) {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("USAGE: gamemap <map>\n");
return;
}
@@ -592,32 +621,37 @@ public class SV_CCMDS extends SV_ENTS {
FS.CreatePath(FS.Gamedir() + "/save/current/");
// check for clearing the current savegame
- map = Cmd.Argv(1);
- if (map.charAt(0) == '*') {
+ map= Cmd.Argv(1);
+ if (map.charAt(0) == '*')
+ {
// wipe all the *.sav files
SV_WipeSavegame("current");
}
- else { // save the map just exited
- if (sv.state == ss_game) {
+ else
+ { // save the map just exited
+ if (sv.state == ss_game)
+ {
// clear all the client inuse flags before saving so that
// when the level is re-entered, the clients will spawn
// at spawn points instead of occupying body shells
- savedInuse = new boolean[(int) maxclients.value];
- for (i = 0; i < maxclients.value; i++) {
- cl = svs.clients[i];
- savedInuse[i] = cl.edict.inuse;
- cl.edict.inuse = false;
+ savedInuse= new boolean[(int) maxclients.value];
+ for (i= 0; i < maxclients.value; i++)
+ {
+ cl= svs.clients[i];
+ savedInuse[i]= cl.edict.inuse;
+ cl.edict.inuse= false;
}
SV_WriteLevelFile();
// we must restore these for clients to transfer over correctly
- for (i = 0; i < maxclients.value; i++) {
- cl = svs.clients[i];
- cl.edict.inuse = savedInuse[i];
+ for (i= 0; i < maxclients.value; i++)
+ {
+ cl= svs.clients[i];
+ cl.edict.inuse= savedInuse[i];
}
- savedInuse = null;
+ savedInuse= null;
}
}
@@ -625,15 +659,13 @@ public class SV_CCMDS extends SV_ENTS {
SV_Map(false, Cmd.Argv(1), false);
// archive server state
- svs.mapcmd = Cmd.Argv(1);
+ svs.mapcmd= Cmd.Argv(1);
// copy off the level to the autosave slot
- if (0 == dedicated.value) {
-
- //TODO: SV_WriteServerFile.
- //SV_WriteServerFile(true);
-
- //SV_CopySaveGame("current", "save0");
+ if (0 == dedicated.value)
+ {
+ SV_WriteServerFile(true);
+ SV_CopySaveGame("current", "save0");
}
}
@@ -645,24 +677,34 @@ public class SV_CCMDS extends SV_ENTS {
For development work
==================
*/
- public static void SV_Map_f() {
+ public static void SV_Map_f()
+ {
String map;
//char expanded[MAX_QPATH];
String expanded;
// if not a pcx, demo, or cinematic, check to make sure the level exists
+//<<<<<<< SV_CCMDS.java
+// map= Cmd.Argv(1);
+// if (!strstr(map, "."))
+// {
+// expanded= "maps/" + map + ".bsp";
+// if (FS.LoadFile(expanded) == null)
+// {
+//=======
map = Cmd.Argv(1);
if (map.indexOf(".") < 0) {
expanded = "maps/" + map + ".bsp";
if (FS.LoadFile(expanded) == null) {
+
Com.Printf("Can't find " + expanded + "\n");
return;
}
}
- sv.state = ss_dead; // don't save current level when changing
+ sv.state= ss_dead; // don't save current level when changing
//TODO: savegame
- //SV_WipeSavegame("current");
+ SV_WipeSavegame("current");
SV_GameMap_f();
}
@@ -680,7 +722,8 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_Loadgame_f() {
+ public static void SV_Loadgame_f()
+ {
//char name[MAX_OSPATH];
//FILE * f;
//char * dir;
@@ -689,32 +732,38 @@ public class SV_CCMDS extends SV_ENTS {
RandomAccessFile f;
String dir;
- if (Cmd.Argc() != 2) {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("USAGE: loadgame <directory>\n");
return;
}
Com.Printf("Loading game...\n");
- dir = Cmd.Argv(1);
- if (strstr(dir, "..") || strstr(dir, "/") || strstr(dir, "\\")) {
+ dir= Cmd.Argv(1);
+ if (strstr(dir, "..") || strstr(dir, "/") || strstr(dir, "\\"))
+ {
Com.Printf("Bad savedir.\n");
}
// make sure the server.ssv file exists
- name = FS.Gamedir() + "/save/" + Cmd.Argv(1) + "/server.ssv";
- try {
- f = new RandomAccessFile(name, "r");
+ name= FS.Gamedir() + "/save/" + Cmd.Argv(1) + "/server.ssv";
+ try
+ {
+ f= new RandomAccessFile(name, "r");
}
- catch (FileNotFoundException e) {
+ catch (FileNotFoundException e)
+ {
Com.Printf("No such savegame: " + name + "\n");
return;
}
- try {
+ try
+ {
f.close();
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
e1.printStackTrace();
}
@@ -723,7 +772,7 @@ public class SV_CCMDS extends SV_ENTS {
SV_ReadServerFile();
// go to the map
- sv.state = ss_dead; // don't save current level when changing
+ sv.state= ss_dead; // don't save current level when changing
SV_INIT.SV_Map(false, svs.mapcmd, true);
}
@@ -733,36 +782,43 @@ public class SV_CCMDS extends SV_ENTS {
==============
*/
- public static void SV_Savegame_f() {
+ public static void SV_Savegame_f()
+ {
String dir;
- if (sv.state != ss_game) {
+ if (sv.state != ss_game)
+ {
Com.Printf("You must be in a game to save.\n");
return;
}
- if (Cmd.Argc() != 2) {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("USAGE: savegame <directory>\n");
return;
}
- if (Cvar.VariableValue("deathmatch") != 0) {
+ if (Cvar.VariableValue("deathmatch") != 0)
+ {
Com.Printf("Can't savegame in a deathmatch\n");
return;
}
- if (0 == strcmp(Cmd.Argv(1), "current")) {
+ if (0 == strcmp(Cmd.Argv(1), "current"))
+ {
Com.Printf("Can't save to 'current'\n");
return;
}
- if (maxclients.value == 1 && svs.clients[0].edict.client.ps.stats[STAT_HEALTH] <= 0) {
+ if (maxclients.value == 1 && svs.clients[0].edict.client.ps.stats[STAT_HEALTH] <= 0)
+ {
Com.Printf("\nCan't savegame while dead!\n");
return;
}
- dir = Cmd.Argv(1);
- if (strstr(dir, "..") || strstr(dir, "/") || strstr(dir, "\\")) {
+ dir= Cmd.Argv(1);
+ if (strstr(dir, "..") || strstr(dir, "/") || strstr(dir, "\\"))
+ {
Com.Printf("Bad savedir.\n");
}
@@ -774,10 +830,12 @@ public class SV_CCMDS extends SV_ENTS {
SV_WriteLevelFile();
// save server state
- try {
+ try
+ {
SV_WriteServerFile(false);
}
- catch (Exception e) {
+ catch (Exception e)
+ {
Com.Printf("IOError in SV_WriteServerFile: " + e);
}
@@ -796,13 +854,16 @@ public class SV_CCMDS extends SV_ENTS {
Kick a user off of the server
==================
*/
- public static void SV_Kick_f() {
- if (!svs.initialized) {
+ public static void SV_Kick_f()
+ {
+ if (!svs.initialized)
+ {
Com.Printf("No server running.\n");
return;
}
- if (Cmd.Argc() != 2) {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("Usage: kick <userid>\n");
return;
}
@@ -815,7 +876,7 @@ public class SV_CCMDS extends SV_ENTS {
// SV_BroadcastPrintf message
SV_ClientPrintf(sv_client, PRINT_HIGH, "You were kicked from the game\n");
SV_DropClient(sv_client);
- sv_client.lastmessage = svs.realtime; // min case there is a funny zombie
+ sv_client.lastmessage= svs.realtime; // min case there is a funny zombie
}
/*
@@ -823,12 +884,14 @@ public class SV_CCMDS extends SV_ENTS {
SV_Status_f
================
*/
- public static void SV_Status_f() {
+ public static void SV_Status_f()
+ {
int i, j, l;
client_t cl;
String s;
int ping;
- if (svs.clients == null) {
+ if (svs.clients == null)
+ {
Com.Printf("No server running.\n");
return;
}
@@ -836,8 +899,9 @@ public class SV_CCMDS extends SV_ENTS {
Com.Printf("num score ping name lastmsg address qport \n");
Com.Printf("--- ----- ---- --------------- ------- --------------------- ------\n");
- for (i = 0; i < maxclients.value; i++) {
- cl = svs.clients[i];
+ for (i= 0; i < maxclients.value; i++)
+ {
+ cl= svs.clients[i];
if (0 == cl.state)
continue;
@@ -848,22 +912,23 @@ public class SV_CCMDS extends SV_ENTS {
Com.Printf("CNCT ");
else if (cl.state == cs_zombie)
Com.Printf("ZMBI ");
- else {
- ping = cl.ping < 9999 ? cl.ping : 9999;
+ else
+ {
+ ping= cl.ping < 9999 ? cl.ping : 9999;
Com.Printf("%4i ", new Vargs().add(ping));
}
Com.Printf("%s", new Vargs().add(cl.name));
- l = 16 - cl.name.length();
- for (j = 0; j < l; j++)
+ l= 16 - cl.name.length();
+ for (j= 0; j < l; j++)
Com.Printf(" ");
Com.Printf("%7i ", new Vargs().add(svs.realtime - cl.lastmessage));
- s = NET.AdrToString(cl.netchan.remote_address);
+ s= NET.AdrToString(cl.netchan.remote_address);
Com.Printf(s);
- l = 22 - s.length();
- for (j = 0; j < l; j++)
+ l= 22 - s.length();
+ for (j= 0; j < l; j++)
Com.Printf(" ");
Com.Printf("%5i", new Vargs().add(cl.netchan.qport));
@@ -878,7 +943,8 @@ public class SV_CCMDS extends SV_ENTS {
SV_ConSay_f
==================
*/
- public static void SV_ConSay_f() {
+ public static void SV_ConSay_f()
+ {
client_t client;
int j;
String p;
@@ -887,17 +953,19 @@ public class SV_CCMDS extends SV_ENTS {
if (Cmd.Argc() < 2)
return;
- text = "console: ";
- p = Cmd.Args();
+ text= "console: ";
+ p= Cmd.Args();
- if (p.charAt(0) == '"') {
- p = p.substring(1, p.length() - 1);
+ if (p.charAt(0) == '"')
+ {
+ p= p.substring(1, p.length() - 1);
}
text += p;
- for (j = 0; j < maxclients.value; j++) {
- client = svs.clients[j];
+ for (j= 0; j < maxclients.value; j++)
+ {
+ client= svs.clients[j];
if (client.state != cs_spawned)
continue;
SV_ClientPrintf(client, PRINT_CHAT, text + "\n");
@@ -909,8 +977,9 @@ public class SV_CCMDS extends SV_ENTS {
SV_Heartbeat_f
==================
*/
- public static void SV_Heartbeat_f() {
- svs.last_heartbeat = -9999999;
+ public static void SV_Heartbeat_f()
+ {
+ svs.last_heartbeat= -9999999;
}
/*
@@ -920,7 +989,8 @@ public class SV_CCMDS extends SV_ENTS {
Examine or change the serverinfo string
===========
*/
- public static void SV_Serverinfo_f() {
+ public static void SV_Serverinfo_f()
+ {
Com.Printf("Server info settings:\n");
Info.Print(Cvar.Serverinfo());
}
@@ -932,8 +1002,10 @@ public class SV_CCMDS extends SV_ENTS {
Examine all a users info strings
===========
*/
- public static void SV_DumpUser_f() {
- if (Cmd.Argc() != 2) {
+ public static void SV_DumpUser_f()
+ {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("Usage: info <userid>\n");
return;
}
@@ -955,25 +1027,29 @@ public class SV_CCMDS extends SV_ENTS {
recorded, but no playerinfo will be stored. Primarily for demo merging.
==============
*/
- public static void SV_ServerRecord_f() {
+ public static void SV_ServerRecord_f()
+ {
//char name[MAX_OSPATH];
String name;
- byte buf_data[] = new byte[32768];
- sizebuf_t buf = new sizebuf_t();
+ byte buf_data[]= new byte[32768];
+ sizebuf_t buf= new sizebuf_t();
int len;
int i;
- if (Cmd.Argc() != 2) {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("serverrecord <demoname>\n");
return;
}
- if (svs.demofile != null) {
+ if (svs.demofile != null)
+ {
Com.Printf("Already recording.\n");
return;
}
- if (sv.state != ss_game) {
+ if (sv.state != ss_game)
+ {
Com.Printf("You must be in a level to record.\n");
return;
}
@@ -981,14 +1057,16 @@ public class SV_CCMDS extends SV_ENTS {
//
// open the demo file
//
- name = FS.Gamedir() + "/demos/" + Cmd.Argv(1) + ".dm2";
+ name= FS.Gamedir() + "/demos/" + Cmd.Argv(1) + ".dm2";
Com.Printf("recording to " + name + ".\n");
FS.CreatePath(name);
- try {
- svs.demofile = new RandomAccessFile(name, "rw");
+ try
+ {
+ svs.demofile= new RandomAccessFile(name, "rw");
}
- catch (Exception e) {
+ catch (Exception e)
+ {
Com.Printf("ERROR: couldn't open.\n");
return;
}
@@ -1016,8 +1094,9 @@ public class SV_CCMDS extends SV_ENTS {
// send full levelname
MSG.WriteString(buf, sv.configstrings[CS_NAME]);
- for (i = 0; i < MAX_CONFIGSTRINGS; i++)
- if (sv.configstrings[i].length() == 0) {
+ for (i= 0; i < MAX_CONFIGSTRINGS; i++)
+ if (sv.configstrings[i].length() == 0)
+ {
MSG.WriteByte(buf, svc_configstring);
MSG.WriteShort(buf, i);
MSG.WriteString(buf, sv.configstrings[i]);
@@ -1025,14 +1104,16 @@ public class SV_CCMDS extends SV_ENTS {
// write it to the demo file
Com.DPrintf("signon message length: " + buf.cursize + "\n");
- len = EndianHandler.swapInt(buf.cursize);
+ len= EndianHandler.swapInt(buf.cursize);
//fwrite(len, 4, 1, svs.demofile);
//fwrite(buf.data, buf.cursize, 1, svs.demofile);
- try {
+ try
+ {
svs.demofile.writeInt(len);
svs.demofile.write(buf.data);
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
// TODO: do quake2 error handling!
e1.printStackTrace();
}
@@ -1047,18 +1128,22 @@ public class SV_CCMDS extends SV_ENTS {
Ends server demo recording
==============
*/
- public static void SV_ServerStop_f() {
- if (svs.demofile == null) {
+ public static void SV_ServerStop_f()
+ {
+ if (svs.demofile == null)
+ {
Com.Printf("Not doing a serverrecord.\n");
return;
}
- try {
+ try
+ {
svs.demofile.close();
}
- catch (IOException e) {
+ catch (IOException e)
+ {
e.printStackTrace();
}
- svs.demofile = null;
+ svs.demofile= null;
Com.Printf("Recording completed.\n");
}
@@ -1070,7 +1155,8 @@ public class SV_CCMDS extends SV_ENTS {
===============
*/
- public static void SV_KillServer_f() {
+ public static void SV_KillServer_f()
+ {
if (!svs.initialized)
return;
SV_Shutdown("Server was killed.\n", false);
@@ -1084,8 +1170,10 @@ public class SV_CCMDS extends SV_ENTS {
Let the game dll handle a command
===============
*/
- public static void SV_ServerCommand_f() {
- if (SV_GAME.ge == null) {
+ public static void SV_ServerCommand_f()
+ {
+ if (SV_GAME.ge == null)
+ {
Com.Printf("No game loaded.\n");
return;
}
@@ -1100,91 +1188,124 @@ public class SV_CCMDS extends SV_ENTS {
SV_InitOperatorCommands
==================
*/
- public static void SV_InitOperatorCommands() {
- Cmd.AddCommand("heartbeat", new xcommand_t() {
- public void execute() {
+ public static void SV_InitOperatorCommands()
+ {
+ Cmd.AddCommand("heartbeat", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Heartbeat_f();
}
});
- Cmd.AddCommand("kick", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("kick", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Kick_f();
}
});
- Cmd.AddCommand("status", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("status", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Status_f();
}
});
- Cmd.AddCommand("serverinfo", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("serverinfo", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Serverinfo_f();
}
});
- Cmd.AddCommand("dumpuser", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("dumpuser", new xcommand_t()
+ {
+ public void execute()
+ {
SV_DumpUser_f();
}
});
- Cmd.AddCommand("map", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("map", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Map_f();
}
});
- Cmd.AddCommand("demomap", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("demomap", new xcommand_t()
+ {
+ public void execute()
+ {
SV_DemoMap_f();
}
});
- Cmd.AddCommand("gamemap", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("gamemap", new xcommand_t()
+ {
+ public void execute()
+ {
SV_GameMap_f();
}
});
- Cmd.AddCommand("setmaster", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("setmaster", new xcommand_t()
+ {
+ public void execute()
+ {
SV_SetMaster_f();
}
});
if (dedicated.value != 0)
- Cmd.AddCommand("say", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("say", new xcommand_t()
+ {
+ public void execute()
+ {
SV_ConSay_f();
}
});
- Cmd.AddCommand("serverrecord", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("serverrecord", new xcommand_t()
+ {
+ public void execute()
+ {
SV_ServerRecord_f();
}
});
- Cmd.AddCommand("serverstop", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("serverstop", new xcommand_t()
+ {
+ public void execute()
+ {
SV_ServerStop_f();
}
});
- Cmd.AddCommand("save", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("save", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Savegame_f();
}
});
- Cmd.AddCommand("load", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("load", new xcommand_t()
+ {
+ public void execute()
+ {
SV_Loadgame_f();
}
});
- Cmd.AddCommand("killserver", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("killserver", new xcommand_t()
+ {
+ public void execute()
+ {
SV_KillServer_f();
}
});
- Cmd.AddCommand("sv", new xcommand_t() {
- public void execute() {
+ Cmd.AddCommand("sv", new xcommand_t()
+ {
+ public void execute()
+ {
SV_ServerCommand_f();
}
});
diff --git a/src/jake2/server/SV_INIT.java b/src/jake2/server/SV_INIT.java
index fd0823c..b8e5c90 100644
--- a/src/jake2/server/SV_INIT.java
+++ b/src/jake2/server/SV_INIT.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 14.01.2004 by RST.
-// $Id: SV_INIT.java,v 1.5 2004-07-30 06:07:23 hzi Exp $
+// $Id: SV_INIT.java,v 1.6 2004-08-20 21:29:57 salomo Exp $
package jake2.server;
@@ -33,10 +33,11 @@ import jake2.sys.NET;
import java.io.IOException;
import java.io.RandomAccessFile;
-public class SV_INIT extends Globals {
+public class SV_INIT extends Globals
+{
- public static server_static_t svs = new server_static_t(); // persistant server info
- public static server_t sv = new server_t(); // local server
+ public static server_static_t svs= new server_static_t(); // persistant server info
+ public static server_t sv= new server_t(); // local server
/*
================
@@ -44,13 +45,14 @@ public class SV_INIT extends Globals {
================
*/
- public static int SV_FindIndex(String name, int start, int max, boolean create) {
+ public static int SV_FindIndex(String name, int start, int max, boolean create)
+ {
int i;
if (name == null || name.length() == 0)
return 0;
- for (i = 1; i < max && sv.configstrings[start + i] != null; i++)
+ for (i= 1; i < max && sv.configstrings[start + i] != null; i++)
if (0 == strcmp(sv.configstrings[start + i], name))
return i;
@@ -61,9 +63,10 @@ public class SV_INIT extends Globals {
Com.Error(ERR_DROP, "*Index: overflow");
//strncpy (sv.configstrings[start+i], name, sizeof(sv.configstrings[i]));
- sv.configstrings[start + i] = name;
+ sv.configstrings[start + i]= name;
- if (sv.state != ss_loading) { // send the update to everyone
+ if (sv.state != ss_loading)
+ { // send the update to everyone
SZ.Clear(sv.multicast);
MSG.WriteChar(sv.multicast, svc_configstring);
MSG.WriteShort(sv.multicast, start + i);
@@ -74,15 +77,18 @@ public class SV_INIT extends Globals {
return i;
}
- public static int SV_ModelIndex(String name) {
+ public static int SV_ModelIndex(String name)
+ {
return SV_FindIndex(name, CS_MODELS, MAX_MODELS, true);
}
- public static int SV_SoundIndex(String name) {
+ public static int SV_SoundIndex(String name)
+ {
return SV_FindIndex(name, CS_SOUNDS, MAX_SOUNDS, true);
}
- public static int SV_ImageIndex(String name) {
+ public static int SV_ImageIndex(String name)
+ {
return SV_FindIndex(name, CS_IMAGES, MAX_IMAGES, true);
}
@@ -95,26 +101,28 @@ public class SV_INIT extends Globals {
baseline will be transmitted
================
*/
- public static void SV_CreateBaseline() {
+ public static void SV_CreateBaseline()
+ {
edict_t svent;
int entnum;
- for (entnum = 1; entnum < SV_GAME.ge.num_edicts; entnum++) {
+ for (entnum= 1; entnum < SV_GAME.ge.num_edicts; entnum++)
+ {
//svent = EDICT_NUM(entnum);
- svent = SV_GAME.ge.edicts[entnum];
+ svent= SV_GAME.ge.edicts[entnum];
if (!svent.inuse)
continue;
if (0 == svent.s.modelindex && 0 == svent.s.sound && 0 == svent.s.effects)
continue;
- svent.s.number = entnum;
+ svent.s.number= entnum;
//
// take current state as baseline
//
VectorCopy(svent.s.origin, svent.s.old_origin);
// rst: bugfix
- sv.baselines[entnum].set(svent.s);// = svent.s.getClone();
+ sv.baselines[entnum].set(svent.s); // = svent.s.getClone();
}
}
@@ -123,7 +131,8 @@ public class SV_INIT extends Globals {
SV_CheckForSavegame
=================
*/
- public static void SV_CheckForSavegame() {
+ public static void SV_CheckForSavegame()
+ {
//char name[MAX_OSPATH];
String name;
//FILE *f;
@@ -137,19 +146,23 @@ public class SV_INIT extends Globals {
if (Cvar.VariableValue("deathmatch") != 0)
return;
- name = FS.Gamedir() + "/save/current/" + sv.name + ".sav";
- try {
- f = new RandomAccessFile(name, "r");
+ name= FS.Gamedir() + "/save/current/" + sv.name + ".sav";
+ try
+ {
+ f= new RandomAccessFile(name, "r");
}
- catch (Exception e) {
+ catch (Exception e)
+ {
return; // no savegame
}
- try {
+ try
+ {
f.close();
}
- catch (IOException e1) {
+ catch (IOException e1)
+ {
e1.printStackTrace();
}
@@ -158,7 +171,8 @@ public class SV_INIT extends Globals {
// get configstrings and areaportals
SV_CCMDS.SV_ReadLevelFile();
- if (!sv.loadgame) { // coming back to a level after being in a different
+ if (!sv.loadgame)
+ { // coming back to a level after being in a different
// level, so run it for ten seconds
// rlava2 was sending too many lightstyles, and overflowing the
@@ -166,12 +180,12 @@ public class SV_INIT extends Globals {
// prevents these from being passed down.
int previousState; // PGM
- previousState = sv.state; // PGM
- sv.state = ss_loading; // PGM
- for (i = 0; i < 100; i++)
+ previousState= sv.state; // PGM
+ sv.state= ss_loading; // PGM
+ for (i= 0; i < 100; i++)
SV_GAME.ge.RunFrame();
- sv.state = previousState; // PGM
+ sv.state= previousState; // PGM
}
}
@@ -184,14 +198,10 @@ public class SV_INIT extends Globals {
================
*/
- public static void SV_SpawnServer(
- String server,
- String spawnpoint,
- int serverstate,
- boolean attractloop,
- boolean loadgame) {
+ public static void SV_SpawnServer(String server, String spawnpoint, int serverstate, boolean attractloop, boolean loadgame)
+ {
int i;
- int checksum = 0;
+ int checksum= 0;
if (attractloop)
Cvar.Set("paused", "0");
@@ -200,76 +210,86 @@ public class SV_INIT extends Globals {
Com.DPrintf("SpawnServer: " + server + "\n");
if (sv.demofile != null)
- try {
+ try
+ {
sv.demofile.close();
}
- catch (Exception e) {
+ catch (Exception e)
+ {
}
svs.spawncount++; // any partially connected client will be
// restarted
+
sv.state = ss_dead;
Globals.server_state= sv.state;
+
// wipe the entire per-level structure
//memset(sv, 0, sizeof(sv));
- sv = new server_t();
-
- svs.realtime = 0;
- sv.loadgame = loadgame;
- sv.attractloop = attractloop;
+ sv= new server_t();
+
+ svs.realtime= 0;
+ sv.loadgame= loadgame;
+ sv.attractloop= attractloop;
// save name for levels that don't set message
sv.configstrings[CS_NAME]= server;
-
- if (Cvar.VariableValue("deathmatch")!=0) {
- sv.configstrings[CS_AIRACCEL] = ""+SV_MAIN.sv_airaccelerate.value;
- PMove.pm_airaccelerate = SV_MAIN.sv_airaccelerate.value;
+
+ if (Cvar.VariableValue("deathmatch") != 0)
+ {
+ sv.configstrings[CS_AIRACCEL]= "" + SV_MAIN.sv_airaccelerate.value;
+ PMove.pm_airaccelerate= SV_MAIN.sv_airaccelerate.value;
}
- else {
- sv.configstrings[CS_AIRACCEL] = "0";
- PMove.pm_airaccelerate = 0;
+ else
+ {
+ sv.configstrings[CS_AIRACCEL]= "0";
+ PMove.pm_airaccelerate= 0;
}
SZ.Init(sv.multicast, sv.multicast_buf, sv.multicast_buf.length);
- sv.name = server;
+ sv.name= server;
// leave slots at start for clients only
- for (i = 0; i < SV_MAIN.maxclients.value; i++) {
+ for (i= 0; i < SV_MAIN.maxclients.value; i++)
+ {
// needs to reconnect
if (svs.clients[i].state > cs_connected)
- svs.clients[i].state = cs_connected;
- svs.clients[i].lastframe = -1;
+ svs.clients[i].state= cs_connected;
+ svs.clients[i].lastframe= -1;
}
- sv.time = 1000;
+ sv.time= 1000;
- sv.name=server;
- sv.configstrings[CS_NAME] = server;
-
- int iw[] = {checksum};
+ sv.name= server;
+ sv.configstrings[CS_NAME]= server;
+
+ int iw[]= { checksum };
- if (serverstate != ss_game) {
- sv.models[1] = CM.CM_LoadMap("", false, iw); // no real map
+ if (serverstate != ss_game)
+ {
+ sv.models[1]= CM.CM_LoadMap("", false, iw); // no real map
}
- else {
- sv.configstrings[CS_MODELS + 1] = "maps/" + server + ".bsp";
- sv.models[1] = CM.CM_LoadMap(sv.configstrings[CS_MODELS + 1], false, iw);
+ else
+ {
+ sv.configstrings[CS_MODELS + 1]= "maps/" + server + ".bsp";
+ sv.models[1]= CM.CM_LoadMap(sv.configstrings[CS_MODELS + 1], false, iw);
}
- checksum = iw[0];
- sv.configstrings[CS_MAPCHECKSUM] = "" + checksum;
+ checksum= iw[0];
+ sv.configstrings[CS_MAPCHECKSUM]= "" + checksum;
//
// clear physics interaction links
//
SV_WORLD.SV_ClearWorld();
- for (i = 1; i < CM.CM_NumInlineModels(); i++) {
- sv.configstrings[CS_MODELS + 1 + i] = "*" + i;
+ for (i= 1; i < CM.CM_NumInlineModels(); i++)
+ {
+ sv.configstrings[CS_MODELS + 1 + i]= "*" + i;
// copy references
- sv.models[i + 1] = CM.InlineModel(sv.configstrings[CS_MODELS + 1 + i]);
+ sv.models[i + 1]= CM.InlineModel(sv.configstrings[CS_MODELS + 1 + i]);
}
//
@@ -278,6 +298,7 @@ public class SV_INIT extends Globals {
// precache and static commands can be issued during
// map initialization
+
sv.state = ss_loading;
Globals.server_state= sv.state;
@@ -311,17 +332,20 @@ public class SV_INIT extends Globals {
A brand new game has been started
==============
*/
- public static void SV_InitGame() {
+ public static void SV_InitGame()
+ {
int i;
- edict_t ent;
+ edict_t ent;
//char idmaster[32];
String idmaster;
- if (svs.initialized) {
+ if (svs.initialized)
+ {
// cause any connected clients to reconnect
SV_MAIN.SV_Shutdown("Server restarted\n", true);
}
- else {
+ else
+ {
// make sure the client is down
CL.Drop();
SCR.BeginLoadingPlaque();
@@ -330,28 +354,32 @@ public class SV_INIT extends Globals {
// get any latched variable changes (maxclients, etc)
Cvar.GetLatchedVars();
- svs.initialized = true;
+ svs.initialized= true;
- if (Cvar.VariableValue("coop")!=0 && Cvar.VariableValue("deathmatch")!=0) {
+ if (Cvar.VariableValue("coop") != 0 && Cvar.VariableValue("deathmatch") != 0)
+ {
Com.Printf("Deathmatch and Coop both set, disabling Coop\n");
Cvar.FullSet("coop", "0", CVAR_SERVERINFO | CVAR_LATCH);
}
// dedicated servers are can't be single player and are usually DM
// so unless they explicity set coop, force it to deathmatch
- if (dedicated.value!=0) {
- if (0==Cvar.VariableValue("coop"))
+ if (dedicated.value != 0)
+ {
+ if (0 == Cvar.VariableValue("coop"))
Cvar.FullSet("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH);
}
// init clients
- if (Cvar.VariableValue("deathmatch")!=0) {
+ if (Cvar.VariableValue("deathmatch") != 0)
+ {
if (SV_MAIN.maxclients.value <= 1)
Cvar.FullSet("maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH);
else if (SV_MAIN.maxclients.value > MAX_CLIENTS)
- Cvar.FullSet("maxclients", "" + MAX_CLIENTS, CVAR_SERVERINFO | CVAR_LATCH);
+ Cvar.FullSet("maxclients", "" + MAX_CLIENTS, CVAR_SERVERINFO | CVAR_LATCH);
}
- else if (Cvar.VariableValue("coop")!=0) {
+ else if (Cvar.VariableValue("coop") != 0)
+ {
if (SV_MAIN.maxclients.value <= 1 || SV_MAIN.maxclients.value > 4)
Cvar.FullSet("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
@@ -361,37 +389,38 @@ public class SV_INIT extends Globals {
Cvar.FullSet("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH);
}
- svs.spawncount = rand();
+ svs.spawncount= rand();
//svs.clients = Z_Malloc(sizeof(client_t) * maxclients.value);
- svs.clients = new client_t[(int) SV_MAIN.maxclients.value];
- for (int n=0; n < svs.clients.length; n++)
+ svs.clients= new client_t[(int) SV_MAIN.maxclients.value];
+ for (int n= 0; n < svs.clients.length; n++)
svs.clients[n]= new client_t();
-
- svs.num_client_entities = ((int) SV_MAIN.maxclients.value) * UPDATE_BACKUP * 64; //ok.
-
+
+ svs.num_client_entities= ((int) SV_MAIN.maxclients.value) * UPDATE_BACKUP * 64; //ok.
+
//svs.client_entities = Z_Malloc(sizeof(entity_state_t) * svs.num_client_entities);
- svs.client_entities = new entity_state_t[svs.num_client_entities];
- for (int n=0; n < svs.client_entities.length; n++)
- svs.client_entities[n] = new entity_state_t(null);
+ svs.client_entities= new entity_state_t[svs.num_client_entities];
+ for (int n= 0; n < svs.client_entities.length; n++)
+ svs.client_entities[n]= new entity_state_t(null);
// init network stuff
NET.Config((SV_MAIN.maxclients.value > 1)); //ok!
// heartbeats will always be sent to the id master
- svs.last_heartbeat = -99999; // send immediately
- idmaster = "192.246.40.37:" + PORT_MASTER;
+ svs.last_heartbeat= -99999; // send immediately
+ idmaster= "192.246.40.37:" + PORT_MASTER;
NET.StringToAdr(idmaster, SV_MAIN.master_adr[0]);
// init game
SV_GAME.SV_InitGameProgs(); // bis hier alles ok!
-
- for (i = 0; i < SV_MAIN.maxclients.value; i++) {
- ent = SV_GAME.ge.edicts[i + 1];
-
+
+ for (i= 0; i < SV_MAIN.maxclients.value; i++)
+ {
+ ent= SV_GAME.ge.edicts[i + 1];
+
//ent.s.number = i + 1; //dont need this, ent.s.number already set.
- svs.clients[i].edict = ent;
+ svs.clients[i].edict= ent;
//memset(& svs.clients[i].lastcmd, 0, sizeof(svs.clients[i].lastcmd));
- svs.clients[i].lastcmd = new usercmd_t();
+ svs.clients[i].lastcmd= new usercmd_t();
}
}
@@ -411,7 +440,8 @@ public class SV_INIT extends Globals {
map tram.cin+jail_e3
======================
*/
- public static void SV_Map(boolean attractloop, String levelstring, boolean loadgame) {
+ public static void SV_Map(boolean attractloop, String levelstring, boolean loadgame)
+ {
//char level[MAX_QPATH];
//char *ch;
int l;
@@ -419,13 +449,13 @@ public class SV_INIT extends Globals {
String level, ch, spawnpoint;
- sv.loadgame = loadgame;
- sv.attractloop = attractloop;
+ sv.loadgame= loadgame;
+ sv.attractloop= attractloop;
if (sv.state == ss_dead && !sv.loadgame)
SV_InitGame(); // the game is just starting
- level = levelstring; // bis hier her ok.
+ level= levelstring; // bis hier her ok.
// if there is a + in the map, set nextserver to the remainder
@@ -439,52 +469,59 @@ public class SV_INIT extends Globals {
// else
// Cvar_Set ("nextserver", "");
- int c = level.indexOf('+');
- if (c != -1) {
- Cvar.Set("nextserver","gamemap \"" + level.substring(c+1) + "\"");
- level = level.substring(0, c);
+ int c= level.indexOf('+');
+ if (c != -1)
+ {
+ Cvar.Set("nextserver", "gamemap \"" + level.substring(c + 1) + "\"");
+ level= level.substring(0, c);
}
- else {
+ else
+ {
Cvar.Set("nextserver", "");
}
//ZOID special hack for end game screen in coop mode
- if (Cvar.VariableValue("coop")!=0 && !level.equals( "victory.pcx"))
+ if (Cvar.VariableValue("coop") != 0 && !level.equals("victory.pcx"))
Cvar.Set("nextserver", "gamemap \"*base1\"");
// if there is a $, use the remainder as a spawnpoint
- int pos = level.indexOf('$');
- if (pos!=-1) {
+ int pos= level.indexOf('$');
+ if (pos != -1)
+ {
//* ch = 0;
- spawnpoint = level.substring(pos + 1);
- level = level.substring(0,pos);
-
+ spawnpoint= level.substring(pos + 1);
+ level= level.substring(0, pos);
+
}
else
//spawnpoint[0] = 0;
- spawnpoint = "";
+ spawnpoint= "";
// skip the end-of-unit flag if necessary
if (level.charAt(0) == '*')
- level = level.substring(1);
+ level= level.substring(1);
- l = level.length();
- if (l > 4 && level.endsWith(".cin")) {
+ l= level.length();
+ if (l > 4 && level.endsWith(".cin"))
+ {
SCR.BeginLoadingPlaque(); // for local system
SV_SEND.SV_BroadcastCommand("changing\n");
SV_SpawnServer(level, spawnpoint, ss_cinematic, attractloop, loadgame);
}
- else if (l > 4 && level.endsWith(".dm2")) {
+ else if (l > 4 && level.endsWith(".dm2"))
+ {
SCR.BeginLoadingPlaque(); // for local system
SV_SEND.SV_BroadcastCommand("changing\n");
SV_SpawnServer(level, spawnpoint, ss_demo, attractloop, loadgame);
}
- else if (l > 4 && level.endsWith(".pcx")) {
+ else if (l > 4 && level.endsWith(".pcx"))
+ {
SCR.BeginLoadingPlaque(); // for local system
SV_SEND.SV_BroadcastCommand("changing\n");
SV_SpawnServer(level, spawnpoint, ss_pic, attractloop, loadgame);
}
- else {
+ else
+ {
SCR.BeginLoadingPlaque(); // for local system
SV_SEND.SV_BroadcastCommand("changing\n");
SV_SEND.SV_SendClientMessages();
diff --git a/src/jake2/server/SV_WORLD.java b/src/jake2/server/SV_WORLD.java
index 2eb2ca6..cb74e95 100644
--- a/src/jake2/server/SV_WORLD.java
+++ b/src/jake2/server/SV_WORLD.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 07.01.2000 by RST.
-// $Id: SV_WORLD.java,v 1.4 2004-07-09 06:50:49 hzi Exp $
+// $Id: SV_WORLD.java,v 1.5 2004-08-20 21:29:57 salomo Exp $
package jake2.server;
@@ -176,6 +176,7 @@ public class SV_WORLD extends SV_CCMDS
{
if (null == ent.area.prev)
return; // not linked in anywhere
+
RemoveLink(ent.area);
ent.area.prev= ent.area.next= null;
}
@@ -212,7 +213,8 @@ public class SV_WORLD extends SV_CCMDS
// encode the size into the entity_state for client prediction
if (ent.solid == SOLID_BBOX && 0 == (ent.svflags & SVF_DEADMONSTER))
- { // assume that x/y are equal and symetric
+ {
+ // assume that x/y are equal and symetric
int i= (int) (ent.maxs[0] / 8);
if (i < 1)
i= 1;
@@ -244,7 +246,8 @@ public class SV_WORLD extends SV_CCMDS
// set the abs box
if (ent.solid == SOLID_BSP && (ent.s.angles[0] != 0 || ent.s.angles[1] != 0 || ent.s.angles[2] != 0))
- { // expand for rotation
+ {
+ // expand for rotation
float max, v;
max= 0;
@@ -264,7 +267,8 @@ public class SV_WORLD extends SV_CCMDS
}
}
else
- { // normal
+ {
+ // normal
VectorAdd(ent.s.origin, ent.mins, ent.absmin);
VectorAdd(ent.s.origin, ent.maxs, ent.absmax);
}
@@ -284,7 +288,7 @@ public class SV_WORLD extends SV_CCMDS
ent.areanum= 0;
ent.areanum2= 0;
- //get all leafs, including solids
+ // get all leafs, including solids
int iw[] = {topnode};
diff --git a/src/jake2/util/QuakeFile.java b/src/jake2/util/QuakeFile.java
new file mode 100644
index 0000000..9b71bb2
--- /dev/null
+++ b/src/jake2/util/QuakeFile.java
@@ -0,0 +1,180 @@
+/*
+Copyright (C) 1997-2001 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+// Created on 24.07.2004 by RST.
+// $Id: QuakeFile.java,v 1.1 2004-08-20 21:29:57 salomo Exp $
+
+package jake2.util;
+
+import jake2.game.Game;
+import jake2.game.SuperAdapter;
+import jake2.game.edict_t;
+import jake2.game.gitem_t;
+
+import java.io.*;
+
+/** RandomAccessFile, bur handles readString/WriteString specially and
+ * offers other helper functions */
+public class QuakeFile extends RandomAccessFile
+{
+
+ /** Standard Constructor.*/
+ public QuakeFile(String filename, String mode) throws FileNotFoundException
+ {
+ super(filename, mode);
+ }
+
+ /** Writes a Vector to a RandomAccessFile. */
+ public void writeVector(float v[]) throws IOException
+ {
+ for (int n= 0; n < 3; n++)
+ writeFloat(v[n]);
+ }
+
+ /** Writes a Vector to a RandomAccessFile. */
+ public float[] readVector() throws IOException
+ {
+ float res[]= { 0, 0, 0 };
+ for (int n= 0; n < 3; n++)
+ res[n]= readFloat();
+
+ return res;
+ }
+
+ /** Reads a length specified string from a file. */
+ public String readString() throws IOException
+ {
+ int len= readInt();
+
+ if (len == -1)
+ return null;
+
+ if (len == 0)
+ return "";
+
+ byte bb[]= new byte[len];
+
+ super.read(bb, 0, len);
+
+ return new String(bb, 0, len);
+ }
+
+ /** Writes a length specified string to a file. */
+ public void writeString(String s) throws IOException
+ {
+ if (s == null)
+ {
+ writeInt(-1);
+ return;
+ }
+
+ writeInt(s.length());
+ if (s.length() != 0)
+ writeBytes(s);
+ }
+
+ /** Writes the edict reference. */
+ public void writeEdictRef(edict_t ent) throws IOException
+ {
+ if (ent == null)
+ writeInt(-1);
+ else
+ {
+ writeInt(ent.s.number);
+ }
+ }
+
+ /**
+ * Reads an edict index from a file and returns the edict.
+ */
+
+ public edict_t readEdictRef() throws IOException
+ {
+ int i= readInt();
+
+ // handle -1
+ if (i < 0)
+ return null;
+
+ if (i > Game.g_edicts.length)
+ {
+ System.err.println("jake2: illegal edict num:" + i);
+ return null;
+ }
+
+ // valid edict.
+ return Game.g_edicts[i];
+ }
+
+ /** Writes the Adapter-ID to the file. */
+ public void writeAdapter(SuperAdapter a) throws IOException
+ {
+ writeInt(3988);
+ if (a == null)
+ writeString(null);
+ else
+ {
+ String str= a.getID();
+ if (a == null)
+ {
+ System.err.println("writeAdapter: invalid Adapter id for" + a);
+ }
+ System.out.println("writing adapter:" + str);
+ writeString(str);
+ }
+ }
+
+ /** Reads the adapter id and returns the adapter. */
+ public SuperAdapter readAdapter() throws IOException
+ {
+ if (readInt() != 3988)
+ System.err.println("wrong read position: readadapter.");
+
+ String id= readString();
+
+ if (id == null)
+ {
+ // null adapter. :-)
+ return null;
+ }
+
+ return SuperAdapter.getFromID(id);
+ }
+
+ /** Writes an item reference. */
+ public void writeItem(gitem_t item) throws IOException
+ {
+ if (item == null)
+ writeInt(-1);
+ else
+ writeInt(item.index);
+ }
+
+ /** Reads the item index and returns the game item. */
+ public gitem_t readItem() throws IOException
+ {
+ int ndx= readInt();
+ if (ndx == -1)
+ return null;
+ else
+ return Game.itemlist[ndx];
+ }
+
+}