summaryrefslogtreecommitdiffstats
path: root/src/jake2/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/game')
-rw-r--r--src/jake2/game/Cmd.java740
-rw-r--r--src/jake2/game/GameBase.java20
-rw-r--r--src/jake2/game/GameFunc.java5
-rw-r--r--src/jake2/game/GameSVCmds.java12
-rw-r--r--src/jake2/game/GameSpawn.java6
-rw-r--r--src/jake2/game/GameUtil.java3
-rw-r--r--src/jake2/game/GameUtilAdapters.java14
-rw-r--r--src/jake2/game/M_Actor.java4
-rw-r--r--src/jake2/game/PlayerHud.java6
-rw-r--r--src/jake2/game/game_export_t.java14
-rw-r--r--src/jake2/game/player_state_t.java3
11 files changed, 464 insertions, 363 deletions
diff --git a/src/jake2/game/Cmd.java b/src/jake2/game/Cmd.java
index bbb6742..a5a0a50 100644
--- a/src/jake2/game/Cmd.java
+++ b/src/jake2/game/Cmd.java
@@ -2,7 +2,7 @@
* Cmd.java
* Copyright (C) 2003
*
- * $Id: Cmd.java,v 1.2 2004-07-08 15:58:43 hzi Exp $
+ * $Id: Cmd.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -35,32 +35,40 @@ import java.util.Arrays;
/**
* Cmd
*/
-public final class Cmd extends PlayerView {
+public final class Cmd extends PlayerView
+{
- static xcommand_t List_f = new xcommand_t() {
- public void execute() {
- cmd_function_t cmd = Cmd.cmd_functions;
- int i = 0;
+ static xcommand_t List_f= new xcommand_t()
+ {
+ public void execute()
+ {
+ cmd_function_t cmd= Cmd.cmd_functions;
+ int i= 0;
- while (cmd != null) {
+ while (cmd != null)
+ {
Com.Printf(cmd.name + '\n');
i++;
- cmd = cmd.next;
+ cmd= cmd.next;
}
Com.Printf(i + " commands\n");
}
};
- static xcommand_t Exec_f = new xcommand_t() {
- public void execute() {
- if (Cmd.Argc() != 2) {
+ static xcommand_t Exec_f= new xcommand_t()
+ {
+ public void execute()
+ {
+ if (Cmd.Argc() != 2)
+ {
Com.Printf("exec <filename> : execute a script file\n");
return;
}
- byte[] f = null;
- f = FS.LoadFile(Cmd.Argv(1));
- if (f == null) {
+ byte[] f= null;
+ f= FS.LoadFile(Cmd.Argv(1));
+ if (f == null)
+ {
Com.Printf("couldn't exec " + Cmd.Argv(1) + "\n");
return;
}
@@ -71,77 +79,93 @@ public final class Cmd extends PlayerView {
FS.FreeFile(f);
}
};
- static xcommand_t Echo_f = new xcommand_t() {
- public void execute() {
- for (int i = 1; i < Cmd.Argc(); i++) {
+
+ static xcommand_t Echo_f= new xcommand_t()
+ {
+ public void execute()
+ {
+ for (int i= 1; i < Cmd.Argc(); i++)
+ {
Com.Printf(Cmd.Argv(i) + " ");
}
Com.Printf("'\n");
}
};
- static xcommand_t Alias_f = new xcommand_t() {
- public void execute() {
- cmdalias_t a = null;
- if (Cmd.Argc() == 1) {
+ static xcommand_t Alias_f= new xcommand_t()
+ {
+ public void execute()
+ {
+ cmdalias_t a= null;
+ if (Cmd.Argc() == 1)
+ {
Com.Printf("Current alias commands:\n");
- for (a = Globals.cmd_alias; a != null; a = a.next) {
+ for (a= Globals.cmd_alias; a != null; a= a.next)
+ {
Com.Printf(a.name + " : " + a.value);
}
return;
}
- String s = Cmd.Argv(1);
- if (s.length() > Globals.MAX_ALIAS_NAME) {
+ String s= Cmd.Argv(1);
+ if (s.length() > Globals.MAX_ALIAS_NAME)
+ {
Com.Printf("Alias name is too long\n");
return;
}
// if the alias already exists, reuse it
- for (a = Globals.cmd_alias; a != null; a = a.next) {
- if (s.equalsIgnoreCase(a.name)) {
- a.value = null;
+ for (a= Globals.cmd_alias; a != null; a= a.next)
+ {
+ if (s.equalsIgnoreCase(a.name))
+ {
+ a.value= null;
break;
}
}
- if (a == null) {
- a = new cmdalias_t();
- a.next = Globals.cmd_alias;
- Globals.cmd_alias = a;
+ if (a == null)
+ {
+ a= new cmdalias_t();
+ a.next= Globals.cmd_alias;
+ Globals.cmd_alias= a;
}
- a.name = s;
+ a.name= s;
// copy the rest of the command line
- String cmd = "";
- int c = Cmd.Argc();
- for (int i = 2; i < c; i++) {
- cmd = cmd + Cmd.Argv(i);
+ String cmd= "";
+ int c= Cmd.Argc();
+ for (int i= 2; i < c; i++)
+ {
+ cmd= cmd + Cmd.Argv(i);
if (i != (c - 1))
- cmd = cmd + " ";
+ cmd= cmd + " ";
}
- cmd = cmd + "\n";
+ cmd= cmd + "\n";
- a.value = cmd;
+ a.value= cmd;
}
};
- public static xcommand_t Wait_f = new xcommand_t() {
- public void execute() {
- Globals.cmd_wait = true;
+ public static xcommand_t Wait_f= new xcommand_t()
+ {
+ public void execute()
+ {
+ Globals.cmd_wait= true;
}
};
- public static cmd_function_t cmd_functions = null;
+ public static cmd_function_t cmd_functions= null;
public static int cmd_argc;
- public static String[] cmd_argv = new String[Globals.MAX_STRING_TOKENS];
+ public static String[] cmd_argv= new String[Globals.MAX_STRING_TOKENS];
public static String cmd_args;
- public static final int ALIAS_LOOP_COUNT = 16;
+ public static final int ALIAS_LOOP_COUNT= 16;
/**
* register our commands
*/
- public static void Init() {
+ public static void Init()
+ {
Cmd.AddCommand("exec", Exec_f);
Cmd.AddCommand("echo", Echo_f);
@@ -150,34 +174,37 @@ public final class Cmd extends PlayerView {
Cmd.AddCommand("wait", Wait_f);
}
- private static char expanded[] = new char[MAX_STRING_CHARS];
- private static char temporary[] = new char[MAX_STRING_CHARS];
+ private static char expanded[]= new char[MAX_STRING_CHARS];
+ private static char temporary[]= new char[MAX_STRING_CHARS];
/*
======================
Cmd_MacroExpandString
======================
*/
- public static char[] MacroExpandString(char text[], int len) {
+ public static char[] MacroExpandString(char text[], int len)
+ {
int i, j, count;
boolean inquote;
char scan[];
String token;
- inquote = false;
+ inquote= false;
- scan = text;
+ scan= text;
- if (len >= MAX_STRING_CHARS) {
+ if (len >= MAX_STRING_CHARS)
+ {
Com.Printf("Line exceeded " + MAX_STRING_CHARS + " chars, discarded.\n");
return null;
}
- count = 0;
+ count= 0;
- for (i = 0; i < len; i++) {
+ for (i= 0; i < len; i++)
+ {
if (scan[i] == '"')
- inquote = !inquote;
+ inquote= !inquote;
if (inquote)
continue; // don't expand inside quotes
@@ -186,19 +213,20 @@ public final class Cmd extends PlayerView {
continue;
// scan out the complete macro, without $
- Com.ParseHelp ph = new Com.ParseHelp(text, i + 1);
- token = Com.Parse(ph);
+ Com.ParseHelp ph= new Com.ParseHelp(text, i + 1);
+ token= Com.Parse(ph);
if (ph.data == null)
continue;
- token = Cvar.VariableString(token);
+ token= Cvar.VariableString(token);
- j = token.length();
+ j= token.length();
len += j;
- if (len >= MAX_STRING_CHARS) {
+ if (len >= MAX_STRING_CHARS)
+ {
Com.Printf("Expanded line exceeded " + MAX_STRING_CHARS + " chars, discarded.\n");
return null;
}
@@ -214,16 +242,18 @@ public final class Cmd extends PlayerView {
//strcpy(expanded, temporary);
System.arraycopy(temporary, 0, expanded, 0, 0);
- scan = expanded;
+ scan= expanded;
i--;
- if (++count == 100) {
+ if (++count == 100)
+ {
Com.Printf("Macro expansion loop, discarded.\n");
return null;
}
}
- if (inquote) {
+ if (inquote)
+ {
Com.Printf("Line has unmatched quote, discarded.\n");
return null;
}
@@ -239,31 +269,34 @@ public final class Cmd extends PlayerView {
$Cvars will be expanded unless they are in a quoted token
============
*/
- public static void TokenizeString(char text[], boolean macroExpand) {
+ public static void TokenizeString(char text[], boolean macroExpand)
+ {
String com_token;
- cmd_argc = 0;
+ cmd_argc= 0;
- int len = strlen(text);
+ int len= strlen(text);
// macro expand the text
if (macroExpand)
- text = MacroExpandString(text, len);
+ text= MacroExpandString(text, len);
if (text == null)
return;
- len = strlen(text);
+ len= strlen(text);
- Com.ParseHelp ph = new Com.ParseHelp(text);
+ Com.ParseHelp ph= new Com.ParseHelp(text);
- while (true) {
+ while (true)
+ {
// skip whitespace up to a /n
- char c = ph.skipwhitestoeol();
+ char c= ph.skipwhitestoeol();
- if (c == '\n') { // a newline seperates commands in the buffer
- c = ph.nextchar();
+ if (c == '\n')
+ { // a newline seperates commands in the buffer
+ c= ph.nextchar();
break;
}
@@ -271,46 +304,52 @@ public final class Cmd extends PlayerView {
return;
// set cmd_args to everything after the first arg
- if (cmd_argc == 1) {
- cmd_args = new String(text, ph.index, len - ph.index);
+ if (cmd_argc == 1)
+ {
+ cmd_args= new String(text, ph.index, len - ph.index);
cmd_args.trim();
}
- com_token = Com.Parse(ph);
+ com_token= Com.Parse(ph);
if (com_token.length() == 0)
return;
- if (cmd_argc < MAX_STRING_TOKENS) {
- cmd_argv[cmd_argc] = com_token;
+ if (cmd_argc < MAX_STRING_TOKENS)
+ {
+ cmd_argv[cmd_argc]= com_token;
cmd_argc++;
}
}
}
- public static void AddCommand(String cmd_name, xcommand_t function) {
+ public static void AddCommand(String cmd_name, xcommand_t function)
+ {
cmd_function_t cmd;
//Com.DPrintf("Cmd_AddCommand: " + cmd_name + "\n");
// fail if the command is a variable name
- if ((Cvar.VariableString(cmd_name)).length() > 0) {
+ if ((Cvar.VariableString(cmd_name)).length() > 0)
+ {
Com.Printf("Cmd_AddCommand: " + cmd_name + " already defined as a var\n");
return;
}
// fail if the command already exists
- for (cmd = cmd_functions; cmd != null; cmd = cmd.next) {
- if (cmd_name.equals(cmd.name)) {
+ for (cmd= cmd_functions; cmd != null; cmd= cmd.next)
+ {
+ if (cmd_name.equals(cmd.name))
+ {
Com.Printf("Cmd_AddCommand: " + cmd_name + " already defined\n");
return;
}
}
- cmd = new cmd_function_t();
- cmd.name = cmd_name;
-
- cmd.function = function;
- cmd.next = cmd_functions;
- cmd_functions = cmd;
+ cmd= new cmd_function_t();
+ cmd.name= cmd_name;
+
+ cmd.function= function;
+ cmd.next= cmd_functions;
+ cmd_functions= cmd;
}
/*
@@ -318,26 +357,30 @@ public final class Cmd extends PlayerView {
Cmd_RemoveCommand
============
*/
- public static void RemoveCommand(String cmd_name) {
- cmd_function_t cmd, back = null;
+ public static void RemoveCommand(String cmd_name)
+ {
+ cmd_function_t cmd, back= null;
- back = cmd = cmd_functions;
+ back= cmd= cmd_functions;
- while (true) {
+ while (true)
+ {
- if (cmd == null) {
+ if (cmd == null)
+ {
Com.Printf("Cmd_RemoveCommand: " + cmd_name + " not added\n");
return;
}
- if (0 == strcmp(cmd_name, cmd.name)) {
+ if (0 == strcmp(cmd_name, cmd.name))
+ {
if (cmd == cmd_functions)
- cmd_functions = cmd.next;
+ cmd_functions= cmd.next;
else
- back.next = cmd.next;
+ back.next= cmd.next;
return;
}
- back = cmd;
- cmd = cmd.next;
+ back= cmd;
+ cmd= cmd.next;
}
}
@@ -346,10 +389,12 @@ public final class Cmd extends PlayerView {
Cmd_Exists
============
*/
- public static boolean Exists(String cmd_name) {
+ public static boolean Exists(String cmd_name)
+ {
cmd_function_t cmd;
- for (cmd = cmd_functions; cmd != null; cmd = cmd.next) {
+ for (cmd= cmd_functions; cmd != null; cmd= cmd.next)
+ {
if (0 == strcmp(cmd_name, cmd.name))
return true;
}
@@ -357,17 +402,20 @@ public final class Cmd extends PlayerView {
return false;
}
- public static int Argc() {
+ public static int Argc()
+ {
return cmd_argc;
}
- public static String Argv(int i) {
+ public static String Argv(int i)
+ {
if (i < 0 || i >= cmd_argc)
return "";
return cmd_argv[i];
}
- public static String Args() {
+ public static String Args()
+ {
return new String(cmd_args);
}
@@ -379,48 +427,49 @@ public final class Cmd extends PlayerView {
FIXME: lookupnoadd the token to speed search?
============
*/
- public static void ExecuteString(String text) {
+ public static void ExecuteString(String text)
+ {
cmd_function_t cmd;
cmdalias_t a;
TokenizeString(text.toCharArray(), true);
-// if (Argc() > 0) {
-// Com.DPrintf("tokenized:");
-// for (int xxx = 0; xxx < Argc(); xxx++)
-// Com.DPrintf("[" + Argv(xxx) + "]");
-//
-// Com.DPrintf("\n");
-// }
+ // if (Argc() > 0) {
+ // Com.DPrintf("tokenized:");
+ // for (int xxx = 0; xxx < Argc(); xxx++)
+ // Com.DPrintf("[" + Argv(xxx) + "]");
+ //
+ // Com.DPrintf("\n");
+ // }
// execute the command line
if (Argc() == 0)
return; // no tokens
// check functions
- for (cmd = cmd_functions; cmd != null; cmd = cmd.next) {
- if (cmd_argv[0].equalsIgnoreCase(cmd.name)) {
- if (null == cmd.function) { // forward to server command
+ for (cmd= cmd_functions; cmd != null; cmd= cmd.next)
+ {
+ if (cmd_argv[0].equalsIgnoreCase(cmd.name))
+ {
+ if (null == cmd.function)
+ { // forward to server command
Cmd.ExecuteString("cmd " + text);
+ } else {
+ cmd.function.execute();
}
- else
- try {
- cmd.function.execute();
- }
- catch (Exception e) {
- System.err.println("Exception in executing a command " + cmd.name + ":");
- e.printStackTrace();
- }
return;
}
}
// check alias
- for (a = cmd_alias; a != null; a = a.next) {
+ for (a= cmd_alias; a != null; a= a.next)
+ {
- if (cmd_argv[0].equalsIgnoreCase(a.name)) {
+ if (cmd_argv[0].equalsIgnoreCase(a.name))
+ {
- if (++alias_count == ALIAS_LOOP_COUNT) {
+ if (++alias_count == ALIAS_LOOP_COUNT)
+ {
Com.Printf("ALIAS_LOOP_COUNT\n");
return;
}
@@ -444,7 +493,8 @@ public final class Cmd extends PlayerView {
Give items to a client
==================
*/
- public static void Give_f(edict_t ent) {
+ public static void Give_f(edict_t ent)
+ {
String name;
gitem_t it;
int index;
@@ -452,30 +502,34 @@ public final class Cmd extends PlayerView {
boolean give_all;
edict_t it_ent;
- if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0) {
+ if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
- name = GameBase.gi.args();
+ name= GameBase.gi.args();
if (0 == Lib.Q_stricmp(name, "all"))
- give_all = true;
+ give_all= true;
else
- give_all = false;
+ give_all= false;
- if (give_all || 0 == Lib.Q_stricmp(GameBase.gi.argv(1), "health")) {
+ if (give_all || 0 == Lib.Q_stricmp(GameBase.gi.argv(1), "health"))
+ {
if (GameBase.gi.argc() == 3)
- ent.health = Lib.atoi(GameBase.gi.argv(2));
+ ent.health= Lib.atoi(GameBase.gi.argv(2));
else
- ent.health = ent.max_health;
+ ent.health= ent.max_health;
if (!give_all)
return;
}
- if (give_all || 0 == Lib.Q_stricmp(name, "weapons")) {
- for (i = 1; i < GameBase.game.num_items; i++) {
- it = GameAI.itemlist[i];
+ if (give_all || 0 == Lib.Q_stricmp(name, "weapons"))
+ {
+ for (i= 1; i < GameBase.game.num_items; i++)
+ {
+ it= GameAI.itemlist[i];
if (null == it.pickup)
continue;
if (0 == (it.flags & Defines.IT_WEAPON))
@@ -486,9 +540,11 @@ public final class Cmd extends PlayerView {
return;
}
- if (give_all || 0 == Lib.Q_stricmp(name, "ammo")) {
- for (i = 1; i < GameBase.game.num_items; i++) {
- it = GameAI.itemlist[i];
+ if (give_all || 0 == Lib.Q_stricmp(name, "ammo"))
+ {
+ for (i= 1; i < GameBase.game.num_items; i++)
+ {
+ it= GameAI.itemlist[i];
if (null == it.pickup)
continue;
if (0 == (it.flags & Defines.IT_AMMO))
@@ -499,27 +555,29 @@ public final class Cmd extends PlayerView {
return;
}
- if (give_all || Lib.Q_stricmp(name, "armor") == 0) {
+ if (give_all || Lib.Q_stricmp(name, "armor") == 0)
+ {
gitem_armor_t info;
- it = GameUtil.FindItem("Jacket Armor");
- ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)] = 0;
+ it= GameUtil.FindItem("Jacket Armor");
+ ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)]= 0;
- it = GameUtil.FindItem("Combat Armor");
- ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)] = 0;
+ it= GameUtil.FindItem("Combat Armor");
+ ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)]= 0;
- it = GameUtil.FindItem("Body Armor");
- info = (gitem_armor_t) it.info;
- ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)] = info.max_count;
+ it= GameUtil.FindItem("Body Armor");
+ info= (gitem_armor_t) it.info;
+ ent.client.pers.inventory[GameUtil.ITEM_INDEX(it)]= info.max_count;
if (!give_all)
return;
}
- if (give_all || Lib.Q_stricmp(name, "Power Shield") == 0) {
- it = GameUtil.FindItem("Power Shield");
- it_ent = GameUtil.G_Spawn();
- it_ent.classname = it.classname;
+ if (give_all || Lib.Q_stricmp(name, "Power Shield") == 0)
+ {
+ it= GameUtil.FindItem("Power Shield");
+ it_ent= GameUtil.G_Spawn();
+ it_ent.classname= it.classname;
GameAI.SpawnItem(it_ent, it);
GameAI.Touch_Item(it_ent, ent, GameBase.dummyplane, null);
if (it_ent.inuse)
@@ -529,44 +587,51 @@ public final class Cmd extends PlayerView {
return;
}
- if (give_all) {
- for (i = 1; i < GameBase.game.num_items; i++) {
- it = GameAI.itemlist[i];
+ if (give_all)
+ {
+ for (i= 1; i < GameBase.game.num_items; i++)
+ {
+ it= GameAI.itemlist[i];
if (it.pickup != null)
continue;
if ((it.flags & (Defines.IT_ARMOR | Defines.IT_WEAPON | Defines.IT_AMMO)) != 0)
continue;
- ent.client.pers.inventory[i] = 1;
+ ent.client.pers.inventory[i]= 1;
}
return;
}
- it = GameUtil.FindItem(name);
- if (it == null) {
- name = GameBase.gi.argv(1);
- it = GameUtil.FindItem(name);
- if (it == null) {
+ it= GameUtil.FindItem(name);
+ if (it == null)
+ {
+ name= GameBase.gi.argv(1);
+ it= GameUtil.FindItem(name);
+ if (it == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item\n");
return;
}
}
- if (it.pickup == null) {
+ if (it.pickup == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "non-pickup item\n");
return;
}
- index = GameUtil.ITEM_INDEX(it);
+ index= GameUtil.ITEM_INDEX(it);
- if ((it.flags & Defines.IT_AMMO) != 0) {
+ if ((it.flags & Defines.IT_AMMO) != 0)
+ {
if (GameBase.gi.argc() == 3)
- ent.client.pers.inventory[index] = Lib.atoi(GameBase.gi.argv(2));
+ ent.client.pers.inventory[index]= Lib.atoi(GameBase.gi.argv(2));
else
ent.client.pers.inventory[index] += it.quantity;
}
- else {
- it_ent = GameUtil.G_Spawn();
- it_ent.classname = it.classname;
+ else
+ {
+ it_ent= GameUtil.G_Spawn();
+ it_ent.classname= it.classname;
GameAI.SpawnItem(it_ent, it);
GameAI.Touch_Item(it_ent, ent, GameBase.dummyplane, null);
if (it_ent.inuse)
@@ -583,19 +648,21 @@ public final class Cmd extends PlayerView {
argv(0) god
==================
*/
- public static void God_f(edict_t ent) {
+ public static void God_f(edict_t ent)
+ {
String msg;
- if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0) {
+ if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
ent.flags ^= Defines.FL_GODMODE;
if (0 == (ent.flags & Defines.FL_GODMODE))
- msg = "godmode OFF\n";
+ msg= "godmode OFF\n";
else
- msg = "godmode ON\n";
+ msg= "godmode ON\n";
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg);
}
@@ -609,19 +676,21 @@ public final class Cmd extends PlayerView {
argv(0) notarget
==================
*/
- public static void Notarget_f(edict_t ent) {
+ public static void Notarget_f(edict_t ent)
+ {
String msg;
- if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
+ if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
ent.flags ^= Defines.FL_NOTARGET;
if (0 == (ent.flags & Defines.FL_NOTARGET))
- msg = "notarget OFF\n";
+ msg= "notarget OFF\n";
else
- msg = "notarget ON\n";
+ msg= "notarget ON\n";
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg);
}
@@ -633,21 +702,25 @@ public final class Cmd extends PlayerView {
argv(0) noclip
==================
*/
- public static void Noclip_f(edict_t ent) {
+ public static void Noclip_f(edict_t ent)
+ {
String msg;
- if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
+ if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
- if (ent.movetype == Defines.MOVETYPE_NOCLIP) {
- ent.movetype = Defines.MOVETYPE_WALK;
- msg = "noclip OFF\n";
+ if (ent.movetype == Defines.MOVETYPE_NOCLIP)
+ {
+ ent.movetype= Defines.MOVETYPE_WALK;
+ msg= "noclip OFF\n";
}
- else {
- ent.movetype = Defines.MOVETYPE_NOCLIP;
- msg = "noclip ON\n";
+ else
+ {
+ ent.movetype= Defines.MOVETYPE_NOCLIP;
+ msg= "noclip ON\n";
}
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg);
@@ -660,23 +733,27 @@ public final class Cmd extends PlayerView {
Use an inventory item
==================
*/
- public static void Use_f(edict_t ent) {
+ public static void Use_f(edict_t ent)
+ {
int index;
gitem_t it;
String s;
- s = GameBase.gi.args();
- it = GameUtil.FindItem(s);
- if (it == null) {
+ s= GameBase.gi.args();
+ it= GameUtil.FindItem(s);
+ if (it == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n");
return;
}
- if (it.use == null) {
+ if (it.use == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n");
return;
}
- index = GameUtil.ITEM_INDEX(it);
- if (0 == ent.client.pers.inventory[index]) {
+ index= GameUtil.ITEM_INDEX(it);
+ if (0 == ent.client.pers.inventory[index])
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n");
return;
}
@@ -691,23 +768,27 @@ public final class Cmd extends PlayerView {
Drop an inventory item
==================
*/
- public static void Drop_f(edict_t ent) {
+ public static void Drop_f(edict_t ent)
+ {
int index;
gitem_t it;
String s;
- s = GameBase.gi.args();
- it = GameUtil.FindItem(s);
- if (it == null) {
+ s= GameBase.gi.args();
+ it= GameUtil.FindItem(s);
+ if (it == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n");
return;
}
- if (it.drop == null) {
+ if (it.drop == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n");
return;
}
- index = GameUtil.ITEM_INDEX(it);
- if (0 == ent.client.pers.inventory[index]) {
+ index= GameUtil.ITEM_INDEX(it);
+ if (0 == ent.client.pers.inventory[index])
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n");
return;
}
@@ -720,24 +801,27 @@ public final class Cmd extends PlayerView {
Cmd_Inven_f
=================
*/
- public static void Inven_f(edict_t ent) {
+ public static void Inven_f(edict_t ent)
+ {
int i;
gclient_t cl;
- cl = ent.client;
+ cl= ent.client;
- cl.showscores = false;
- cl.showhelp = false;
+ cl.showscores= false;
+ cl.showhelp= false;
- if (cl.showinventory) {
- cl.showinventory = false;
+ if (cl.showinventory)
+ {
+ cl.showinventory= false;
return;
}
- cl.showinventory = true;
+ cl.showinventory= true;
GameBase.gi.WriteByte(Defines.svc_inventory);
- for (i = 0; i < Defines.MAX_ITEMS; i++) {
+ for (i= 0; i < Defines.MAX_ITEMS; i++)
+ {
GameBase.gi.WriteShort(cl.pers.inventory[i]);
}
GameBase.gi.unicast(ent, true);
@@ -748,18 +832,21 @@ public final class Cmd extends PlayerView {
Cmd_InvUse_f
=================
*/
- public static void InvUse_f(edict_t ent) {
+ public static void InvUse_f(edict_t ent)
+ {
gitem_t it;
GameAI.ValidateSelectedItem(ent);
- if (ent.client.pers.selected_item == -1) {
+ if (ent.client.pers.selected_item == -1)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No item to use.\n");
return;
}
- it = GameAI.itemlist[ent.client.pers.selected_item];
- if (it.use == null) {
+ it= GameAI.itemlist[ent.client.pers.selected_item];
+ if (it.use == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n");
return;
}
@@ -771,26 +858,28 @@ public final class Cmd extends PlayerView {
Cmd_WeapPrev_f
=================
*/
- public static void WeapPrev_f(edict_t ent) {
+ public static void WeapPrev_f(edict_t ent)
+ {
gclient_t cl;
int i, index;
gitem_t it;
int selected_weapon;
- cl = ent.client;
+ cl= ent.client;
if (cl.pers.weapon == null)
return;
- selected_weapon = GameUtil.ITEM_INDEX(cl.pers.weapon);
+ selected_weapon= GameUtil.ITEM_INDEX(cl.pers.weapon);
// scan for the next valid one
- for (i = 1; i <= Defines.MAX_ITEMS; i++) {
- index = (selected_weapon + i) % Defines.MAX_ITEMS;
+ for (i= 1; i <= Defines.MAX_ITEMS; i++)
+ {
+ index= (selected_weapon + i) % Defines.MAX_ITEMS;
if (0 == cl.pers.inventory[index])
continue;
- it = GameAI.itemlist[index];
+ it= GameAI.itemlist[index];
if (it.use == null)
continue;
@@ -807,27 +896,30 @@ public final class Cmd extends PlayerView {
Cmd_WeapNext_f
=================
*/
- public static void WeapNext_f(edict_t ent) {
+ public static void WeapNext_f(edict_t ent)
+ {
gclient_t cl;
int i, index;
gitem_t it;
int selected_weapon;
- cl = ent.client;
+ cl= ent.client;
if (null == cl.pers.weapon)
return;
- selected_weapon = GameUtil.ITEM_INDEX(cl.pers.weapon);
+ selected_weapon= GameUtil.ITEM_INDEX(cl.pers.weapon);
// scan for the next valid one
- for (i = 1; i <= Defines.MAX_ITEMS; i++) {
- index = (selected_weapon + Defines.MAX_ITEMS - i) % Defines.MAX_ITEMS;
+ for (i= 1; i <= Defines.MAX_ITEMS; i++)
+ {
+ index= (selected_weapon + Defines.MAX_ITEMS - i) % Defines.MAX_ITEMS;
//bugfix rst
- if (index == 0) index++;
+ if (index == 0)
+ index++;
if (0 == cl.pers.inventory[index])
continue;
- it = GameAI.itemlist[index];
+ it= GameAI.itemlist[index];
if (null == it.use)
continue;
if (0 == (it.flags & Defines.IT_WEAPON))
@@ -843,20 +935,21 @@ public final class Cmd extends PlayerView {
Cmd_WeapLast_f
=================
*/
- public static void WeapLast_f(edict_t ent) {
+ public static void WeapLast_f(edict_t ent)
+ {
gclient_t cl;
int index;
gitem_t it;
- cl = ent.client;
+ cl= ent.client;
if (null == cl.pers.weapon || null == cl.pers.lastweapon)
return;
- index = GameUtil.ITEM_INDEX(cl.pers.lastweapon);
+ index= GameUtil.ITEM_INDEX(cl.pers.lastweapon);
if (0 == cl.pers.inventory[index])
return;
- it = GameAI.itemlist[index];
+ it= GameAI.itemlist[index];
if (null == it.use)
return;
if (0 == (it.flags & Defines.IT_WEAPON))
@@ -869,18 +962,21 @@ public final class Cmd extends PlayerView {
Cmd_InvDrop_f
=================
*/
- public static void InvDrop_f(edict_t ent) {
+ public static void InvDrop_f(edict_t ent)
+ {
gitem_t it;
GameAI.ValidateSelectedItem(ent);
- if (ent.client.pers.selected_item == -1) {
+ if (ent.client.pers.selected_item == -1)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No item to drop.\n");
return;
}
- it = GameAI.itemlist[ent.client.pers.selected_item];
- if (it.drop == null) {
+ it= GameAI.itemlist[ent.client.pers.selected_item];
+ if (it.drop == null)
+ {
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n");
return;
}
@@ -894,19 +990,21 @@ public final class Cmd extends PlayerView {
Display the scoreboard
==================
*/
- public static void Score_f(edict_t ent) {
- ent.client.showinventory = false;
- ent.client.showhelp = false;
+ public static void Score_f(edict_t ent)
+ {
+ ent.client.showinventory= false;
+ ent.client.showhelp= false;
if (0 == GameBase.deathmatch.value && 0 == GameBase.coop.value)
return;
- if (ent.client.showscores) {
- ent.client.showscores = false;
+ if (ent.client.showscores)
+ {
+ ent.client.showscores= false;
return;
}
- ent.client.showscores = true;
+ ent.client.showscores= true;
GameAI.DeathmatchScoreboard(ent);
}
@@ -917,23 +1015,26 @@ public final class Cmd extends PlayerView {
Display the current help message
==================
*/
- public static void Help_f(edict_t ent) {
+ public static void Help_f(edict_t ent)
+ {
// this is for backwards compatability
- if (GameBase.deathmatch.value != 0) {
+ if (GameBase.deathmatch.value != 0)
+ {
Score_f(ent);
return;
}
- ent.client.showinventory = false;
- ent.client.showscores = false;
+ ent.client.showinventory= false;
+ ent.client.showscores= false;
- if (ent.client.showhelp && (ent.client.pers.game_helpchanged == GameBase.game.helpchanged)) {
- ent.client.showhelp = false;
+ if (ent.client.showhelp && (ent.client.pers.game_helpchanged == GameBase.game.helpchanged))
+ {
+ ent.client.showhelp= false;
return;
}
- ent.client.showhelp = true;
- ent.client.pers.helpchanged = 0;
+ ent.client.showhelp= true;
+ ent.client.pers.helpchanged= 0;
GameAI.HelpComputer(ent);
}
@@ -944,12 +1045,13 @@ public final class Cmd extends PlayerView {
Cmd_Kill_f
=================
*/
- public static void Kill_f(edict_t ent) {
+ public static void Kill_f(edict_t ent)
+ {
if ((GameBase.level.time - ent.client.respawn_time) < 5)
return;
ent.flags &= ~Defines.FL_GODMODE;
- ent.health = 0;
- GameBase.meansOfDeath = Defines.MOD_SUICIDE;
+ ent.health= 0;
+ GameBase.meansOfDeath= Defines.MOD_SUICIDE;
GameAIAdapters.player_die.die(ent, ent, ent, 100000, GameBase.vec3_origin);
}
@@ -958,10 +1060,11 @@ public final class Cmd extends PlayerView {
Cmd_PutAway_f
=================
*/
- public static void PutAway_f(edict_t ent) {
- ent.client.showscores = false;
- ent.client.showhelp = false;
- ent.client.showinventory = false;
+ public static void PutAway_f(edict_t ent)
+ {
+ ent.client.showscores= false;
+ ent.client.showhelp= false;
+ ent.client.showinventory= false;
}
@@ -970,18 +1073,21 @@ public final class Cmd extends PlayerView {
Cmd_Players_f
=================
*/
- public static void Players_f(edict_t ent) {
+ public static void Players_f(edict_t ent)
+ {
int i;
int count;
String small;
String large;
- Integer index[] = new Integer[256];
+ Integer index[]= new Integer[256];
- count = 0;
- for (i = 0; i < GameBase.maxclients.value; i++) {
- if (GameBase.game.clients[i].pers.connected) {
- index[count] = new Integer(i);
+ count= 0;
+ for (i= 0; i < GameBase.maxclients.value; i++)
+ {
+ if (GameBase.game.clients[i].pers.connected)
+ {
+ index[count]= new Integer(i);
count++;
}
}
@@ -992,16 +1098,18 @@ public final class Cmd extends PlayerView {
Arrays.sort(index, 0, count - 1, GameAIAdapters.PlayerSort);
// print information
- large = "";
+ large= "";
- for (i = 0; i < count; i++) {
- small =
+ for (i= 0; i < count; i++)
+ {
+ small=
GameBase.game.clients[index[i].intValue()].ps.stats[Defines.STAT_FRAGS]
+ " "
+ GameBase.game.clients[index[i].intValue()].pers.netname
+ "\n";
- if (small.length() + large.length() > 1024 - 100) {
+ if (small.length() + large.length() > 1024 - 100)
+ {
// can't print all of them in one packet
large += "...\n";
break;
@@ -1017,10 +1125,11 @@ public final class Cmd extends PlayerView {
Cmd_Wave_f
=================
*/
- public static void Wave_f(edict_t ent) {
+ public static void Wave_f(edict_t ent)
+ {
int i;
- i = Lib.atoi(GameBase.gi.argv(1));
+ i= Lib.atoi(GameBase.gi.argv(1));
// can't wave when ducked
if ((ent.client.ps.pmove.pm_flags & Defines.PMF_DUCKED) != 0)
@@ -1029,34 +1138,35 @@ public final class Cmd extends PlayerView {
if (ent.client.anim_priority > Defines.ANIM_WAVE)
return;
- ent.client.anim_priority = Defines.ANIM_WAVE;
+ ent.client.anim_priority= Defines.ANIM_WAVE;
- switch (i) {
+ switch (i)
+ {
case 0 :
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "flipoff\n");
- ent.s.frame = M_Player.FRAME_flip01 - 1;
- ent.client.anim_end = M_Player.FRAME_flip12;
+ ent.s.frame= M_Player.FRAME_flip01 - 1;
+ ent.client.anim_end= M_Player.FRAME_flip12;
break;
case 1 :
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "salute\n");
- ent.s.frame = M_Player.FRAME_salute01 - 1;
- ent.client.anim_end = M_Player.FRAME_salute11;
+ ent.s.frame= M_Player.FRAME_salute01 - 1;
+ ent.client.anim_end= M_Player.FRAME_salute11;
break;
case 2 :
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "taunt\n");
- ent.s.frame = M_Player.FRAME_taunt01 - 1;
- ent.client.anim_end = M_Player.FRAME_taunt17;
+ ent.s.frame= M_Player.FRAME_taunt01 - 1;
+ ent.client.anim_end= M_Player.FRAME_taunt17;
break;
case 3 :
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "wave\n");
- ent.s.frame = M_Player.FRAME_wave01 - 1;
- ent.client.anim_end = M_Player.FRAME_wave11;
+ ent.s.frame= M_Player.FRAME_wave01 - 1;
+ ent.client.anim_end= M_Player.FRAME_wave11;
break;
case 4 :
default :
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "point\n");
- ent.s.frame = M_Player.FRAME_point01 - 1;
- ent.client.anim_end = M_Player.FRAME_point12;
+ ent.s.frame= M_Player.FRAME_point01 - 1;
+ ent.client.anim_end= M_Player.FRAME_point12;
break;
}
}
@@ -1066,7 +1176,8 @@ public final class Cmd extends PlayerView {
Cmd_Say_f
==================
*/
- public static void Say_f(edict_t ent, boolean team, boolean arg0) {
+ public static void Say_f(edict_t ent, boolean team, boolean arg0)
+ {
int i, j;
edict_t other;
@@ -1077,19 +1188,21 @@ public final class Cmd extends PlayerView {
return;
if (0 == ((int) (dmflags.value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
- team = false;
+ team= false;
if (team)
- text = "(" + ent.client.pers.netname + "): ";
+ text= "(" + ent.client.pers.netname + "): ";
else
- text = "" + ent.client.pers.netname + ": ";
+ text= "" + ent.client.pers.netname + ": ";
- if (arg0) {
+ if (arg0)
+ {
strcat(text, gi.argv(0));
strcat(text, " ");
strcat(text, gi.args());
}
- else {
+ else
+ {
if (gi.args().startsWith("\""))
text += gi.args().substring(1, gi.args().length() - 1);
else
@@ -1109,41 +1222,46 @@ public final class Cmd extends PlayerView {
// don't let text be too long for malicious reasons
if (text.length() > 150)
//text[150] = 0;
- text = text.substring(0, 150);
+ text= text.substring(0, 150);
strcat(text, "\n");
- if (flood_msgs.value != 0) {
- cl = ent.client;
+ if (flood_msgs.value != 0)
+ {
+ cl= ent.client;
- if (level.time < cl.flood_locktill) {
+ if (level.time < cl.flood_locktill)
+ {
gi.cprintf(ent, PRINT_HIGH, "You can't talk for " + (int) (cl.flood_locktill - level.time) + " more seconds\n");
return;
}
- i = (int) (cl.flood_whenhead - flood_msgs.value + 1);
+ i= (int) (cl.flood_whenhead - flood_msgs.value + 1);
if (i < 0)
//i = (sizeof(cl.flood_when) / sizeof(cl.flood_when[0])) + i;
- i = (10) + i;
- if (cl.flood_when[i] != 0 && level.time - cl.flood_when[i] < flood_persecond.value) {
- cl.flood_locktill = level.time + flood_waitdelay.value;
+ i= (10) + i;
+ if (cl.flood_when[i] != 0 && level.time - cl.flood_when[i] < flood_persecond.value)
+ {
+ cl.flood_locktill= level.time + flood_waitdelay.value;
gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for " + (int) flood_waitdelay.value + " seconds.\n");
return;
}
//cl.flood_whenhead = (cl.flood_whenhead + 1) % (sizeof(cl.flood_when) / sizeof(cl.flood_when[0]));
- cl.flood_whenhead = (cl.flood_whenhead + 1) % 10;
- cl.flood_when[cl.flood_whenhead] = level.time;
+ cl.flood_whenhead= (cl.flood_whenhead + 1) % 10;
+ cl.flood_when[cl.flood_whenhead]= level.time;
}
if (dedicated.value != 0)
gi.cprintf(null, PRINT_CHAT, "" + text + "");
- for (j = 1; j <= game.maxclients; j++) {
- other = g_edicts[j];
+ for (j= 1; j <= game.maxclients; j++)
+ {
+ other= g_edicts[j];
if (!other.inuse)
continue;
if (other.client == null)
continue;
- if (team) {
+ if (team)
+ {
if (!OnSameTeam(ent, other))
continue;
}
@@ -1154,23 +1272,25 @@ public final class Cmd extends PlayerView {
/**
* Returns the playerlist.
- * TODO: The list is badly formatted at the moment, RST.
+ * TODO: The list is badly formatted at the moment.
*/
- public static void PlayerList_f(edict_t ent) {
+ public static void PlayerList_f(edict_t ent)
+ {
int i;
String st;
String text;
edict_t e2;
// connect time, ping, score, name
- text = "";
+ text= "";
- for (i = 0; i < GameBase.maxclients.value; i++) {
- e2 = GameBase.g_edicts[1 + i];
+ for (i= 0; i < GameBase.maxclients.value; i++)
+ {
+ e2= GameBase.g_edicts[1 + i];
if (!e2.inuse)
continue;
- st =
+ st=
""
+ (GameBase.level.framenum - e2.client.resp.enterframe) / 600
+ ":"
@@ -1185,7 +1305,8 @@ public final class Cmd extends PlayerView {
+ (e2.client.resp.spectator ? " (spectator)" : "")
+ "\n";
- if (text.length() + st.length() > 1024 - 50) {
+ if (text.length() + st.length() > 1024 - 50)
+ {
text += "And more...\n";
GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "" + text + "");
return;
@@ -1196,7 +1317,7 @@ public final class Cmd extends PlayerView {
}
// ======================================================================
-
+
/*
===================
Cmd_ForwardToServer
@@ -1206,18 +1327,21 @@ public final class Cmd extends PlayerView {
so when they are typed in at the console, they will need to be forwarded.
===================
*/
- public static void ForwardToServer() {
+ public static void ForwardToServer()
+ {
String cmd;
-
- cmd = Cmd.Argv(0);
- if (Globals.cls.state <= Defines.ca_connected || cmd.charAt(0) == '-' || cmd.charAt(0) == '+') {
+
+ cmd= Cmd.Argv(0);
+ if (Globals.cls.state <= Defines.ca_connected || cmd.charAt(0) == '-' || cmd.charAt(0) == '+')
+ {
Com.Printf("Unknown command \"" + cmd + "\"\n");
return;
}
-
+
MSG.WriteByte(Globals.cls.netchan.message, Defines.clc_stringcmd);
SZ.Print(Globals.cls.netchan.message, cmd);
- if (Cmd.Argc() > 1) {
+ if (Cmd.Argc() > 1)
+ {
SZ.Print(Globals.cls.netchan.message, " ");
SZ.Print(Globals.cls.netchan.message, Cmd.Args());
}
diff --git a/src/jake2/game/GameBase.java b/src/jake2/game/GameBase.java
index ef1e1c9..871e084 100644
--- a/src/jake2/game/GameBase.java
+++ b/src/jake2/game/GameBase.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 30.11.2003 by RST.
-// $Id: GameBase.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: GameBase.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
/** Father of all Objects. */
@@ -817,24 +817,8 @@ public class GameBase extends Globals
continue;
}
- //TODO: RST: disabled for debugging;
- //if (!ent.classname.startsWith("monster") || ent.index == 312)
- G_RunEntity(ent);
-
- // if (ent == g_edicts[307])
- // G_RunEntity(ent);
- // else if (ent == g_edicts[1])
- // G_RunEntity(ent);
- //
- // else if (true)
- // if (ent.classname.startsWith("monster")
- // || ent.classname.startsWith("trigger")
- // || ent.classname.startsWith("target")
- // || ent.classname.startsWith(
- // "misc_explo") //ent.classname.startsWith("func_door")
- // ) //|| ent.classname.startsWith("monster"))
- // G_RunEntity(ent);
+ G_RunEntity(ent);
}
// see if it is time to end a deathmatch
diff --git a/src/jake2/game/GameFunc.java b/src/jake2/game/GameFunc.java
index 8860b00..091056f 100644
--- a/src/jake2/game/GameFunc.java
+++ b/src/jake2/game/GameFunc.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 18.11.2003 by RST.
-// $Id: GameFunc.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: GameFunc.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -38,9 +38,6 @@ public class GameFunc extends PlayerView
Math3D.VectorSubtract(dest, ent.s.origin, ent.moveinfo.dir);
ent.moveinfo.remaining_distance = Math3D.VectorNormalize(ent.moveinfo.dir);
- //TODO: BIG HACK !!!
- if (ent.moveinfo.remaining_distance == 2)
- ent.moveinfo.remaining_distance = 94;
ent.moveinfo.endfunc = func;
if (ent.moveinfo.speed == ent.moveinfo.accel && ent.moveinfo.speed == ent.moveinfo.decel)
diff --git a/src/jake2/game/GameSVCmds.java b/src/jake2/game/GameSVCmds.java
index dc0b4f9..1d1c244 100644
--- a/src/jake2/game/GameSVCmds.java
+++ b/src/jake2/game/GameSVCmds.java
@@ -19,22 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 01.02.2004 by RST.
-// $Id: GameSVCmds.java,v 1.1 2004-07-07 19:59:00 hzi Exp $
+// $Id: GameSVCmds.java,v 1.2 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
+import jake2.qcommon.Com;
+
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.StringTokenizer;
-import com.sun.corba.se.internal.ior.ByteBuffer;
-
-import jake2.*;
-import jake2.client.*;
-import jake2.qcommon.*;
-import jake2.render.*;
-import jake2.server.*;
-
public class GameSVCmds extends GameSpawn {
public static void Svcmd_Test_f() {
diff --git a/src/jake2/game/GameSpawn.java b/src/jake2/game/GameSpawn.java
index edb8cab..34412fd 100644
--- a/src/jake2/game/GameSpawn.java
+++ b/src/jake2/game/GameSpawn.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 18.11.2003 by RST.
-// $Id: GameSpawn.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: GameSpawn.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -305,7 +305,7 @@ public class GameSpawn extends GameSave {
e.teammaster = e;
c++;
c2++;
- Com.Printf("Team:" + e.team+" entity: " + e.index + "\n");
+ //Com.Printf("Team:" + e.team+" entity: " + e.index + "\n");
for (j = i + 1; j < globals.num_edicts; j++) {
e2 = g_edicts[j];
if (!e2.inuse)
@@ -427,7 +427,7 @@ public class GameSpawn extends GameSave {
ED_CallSpawn(ent);
}
//gi.dprintf("player skill level:" +skill.value + "\n");
- gi.dprintf(inhibit + " entities inhibited\n");
+ //gi.dprintf(inhibit + " entities inhibited\n");
i = 1;
G_FindTeams();
PlayerTrail.Init();
diff --git a/src/jake2/game/GameUtil.java b/src/jake2/game/GameUtil.java
index ee52a89..a5d81ad 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.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: GameUtil.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -280,7 +280,6 @@ public class GameUtil extends GameBase
return false;
}
- /** TODO: test, / replaced the string operations. */
static String ClientTeam(edict_t ent)
{
String value;
diff --git a/src/jake2/game/GameUtilAdapters.java b/src/jake2/game/GameUtilAdapters.java
index 4a3c320..6191270 100644
--- a/src/jake2/game/GameUtilAdapters.java
+++ b/src/jake2/game/GameUtilAdapters.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: GameUtilAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $
+// $Id: GameUtilAdapters.java,v 1.2 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -310,7 +310,7 @@ public class GameUtilAdapters
if (!taken)
return;
- Com.p("Picked up:" + ent.classname);
+ //Com.p("Picked up:" + ent.classname);
if (!((GameBase.coop.value != 0) && (ent.item.flags & Defines.IT_STAY_COOP) != 0)
|| 0 != (ent.spawnflags & (Defines.DROPPED_ITEM | Defines.DROPPED_PLAYER_ITEM)))
@@ -322,6 +322,7 @@ public class GameUtilAdapters
}
}
};
+
static EntTouchAdapter drop_temp_touch = new EntTouchAdapter()
{
public void touch(edict_t ent, edict_t other, cplane_t plane, csurface_t surf)
@@ -332,6 +333,7 @@ public class GameUtilAdapters
Touch_Item.touch(ent, other, plane, surf);
}
};
+
static EntThinkAdapter drop_make_touchable = new EntThinkAdapter()
{
public boolean think(edict_t ent)
@@ -398,7 +400,7 @@ public class GameUtilAdapters
ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]--;
//TODO: remove this line
- ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]=0;
+ //ent.client.pers.inventory[GameUtil.ITEM_INDEX(item)]=0;
GameUtil.ValidateSelectedItem(ent);
@@ -407,7 +409,7 @@ public class GameUtilAdapters
else
ent.client.breather_framenum = GameBase.level.framenum + 300;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
+ GameBase.gi.sound(ent, Defines.CHAN_ITEM, GameBase.gi.soundindex("items/damage.wav"), 1, Defines.ATTN_NORM, 0);
}
};
// ======================================================================
@@ -424,7 +426,7 @@ public class GameUtilAdapters
else
ent.client.enviro_framenum = GameBase.level.framenum + 300;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
+ GameBase.gi.sound(ent, Defines.CHAN_ITEM, GameBase.gi.soundindex("items/damage.wav"), 1, Defines.ATTN_NORM, 0);
}
};
// ======================================================================
@@ -458,7 +460,7 @@ public class GameUtilAdapters
GameUtil.ValidateSelectedItem(ent);
ent.client.silencer_shots += 30;
- // gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage.wav"), 1, ATTN_NORM, 0);
+ GameBase.gi.sound(ent, Defines.CHAN_ITEM, GameBase.gi.soundindex("items/damage.wav"), 1, Defines.ATTN_NORM, 0);
}
};
// ======================================================================
diff --git a/src/jake2/game/M_Actor.java b/src/jake2/game/M_Actor.java
index f48ff77..24484ab 100644
--- a/src/jake2/game/M_Actor.java
+++ b/src/jake2/game/M_Actor.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 11.11.2003 by RST.
-// $Id: M_Actor.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: M_Actor.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -731,7 +731,7 @@ public class M_Actor extends GameAI {
return;
self.pain_debounce_time= level.time + 3;
- // gi.sound (self, CHAN_VOICE, actor.sound_pain, 1, ATTN_NORM, 0);
+ //GameBase.gi.sound (self, CHAN_VOICE, actor.sound_pain, 1, ATTN_NORM, 0);
if ((other.client != null) && (Lib.random() < 0.4)) {
float v[]= { 0, 0, 0 };
diff --git a/src/jake2/game/PlayerHud.java b/src/jake2/game/PlayerHud.java
index b9622e3..244e398 100644
--- a/src/jake2/game/PlayerHud.java
+++ b/src/jake2/game/PlayerHud.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: PlayerHud.java,v 1.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: PlayerHud.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -100,13 +100,15 @@ public class PlayerHud extends GameTarget {
level.intermissiontime = level.time;
// TODO: BIG HACK TO IGNORE CINEMATIC
+
String xxx = targ.map;
int pos = xxx.indexOf(".cin");
if (pos != -1)
level.changemap = xxx.substring(pos + 5); // including "+"
else
level.changemap = xxx;
-
+ // ------------------------
+ //level.changemap = targ.map;
if (level.changemap.indexOf('*') > -1) {
if (coop.value != 0) {
for (i = 0; i < maxclients.value; i++) {
diff --git a/src/jake2/game/game_export_t.java b/src/jake2/game/game_export_t.java
index 792b785..9dabf51 100644
--- a/src/jake2/game/game_export_t.java
+++ b/src/jake2/game/game_export_t.java
@@ -19,7 +19,7 @@ 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.2 2004-07-08 15:58:44 hzi Exp $
+// $Id: game_export_t.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -58,8 +58,8 @@ public class game_export_t
// ReadGame is called on a loadgame.
public void WriteGame(String filename, boolean autosave)
{
- // TODO WriteGame not implemnted!
- Com.Println("WriteGame not implemnted!");
+ // TODO WriteGame not implemented.
+ Com.Println("WriteGame not implemented.");
}
public void ReadGame(String filename)
@@ -71,14 +71,14 @@ public class game_export_t
// loaded with SpawnEntities
public void WriteLevel(String filename)
{
- // TODO WriteLevel not implemented!
- Com.Println("WriteLevel not implemented!");
+ // TODO WriteLevel not implemented.
+ Com.Println("WriteLevel not implemented.");
}
public void ReadLevel(String filename)
{
- // TODO ReadLevel not implemnted!
- Com.Println("ReadLevel not implemnted!");
+ // TODO ReadLevel not implemented.
+ Com.Println("ReadLevel not implemented.");
}
public boolean ClientConnect(edict_t ent, String userinfo)
diff --git a/src/jake2/game/player_state_t.java b/src/jake2/game/player_state_t.java
index 3ecc17d..d4ecc72 100644
--- a/src/jake2/game/player_state_t.java
+++ b/src/jake2/game/player_state_t.java
@@ -19,7 +19,7 @@ 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.2 2004-07-08 20:24:29 hzi Exp $
+// $Id: player_state_t.java,v 1.3 2004-07-09 06:50:49 hzi Exp $
package jake2.game;
@@ -62,7 +62,6 @@ public class player_state_t {
/**
*
*/
- // TODO bugfix cwei
private static player_state_t prototype = new player_state_t();
public void clear() {