aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2')
-rw-r--r--src/jake2/client/M.java27
-rw-r--r--src/jake2/game/Cmd.java327
-rw-r--r--src/jake2/game/GameBase.java106
-rw-r--r--src/jake2/game/GameChase.java3
-rw-r--r--src/jake2/game/GameCombat.java26
-rw-r--r--src/jake2/game/GameFunc.java38
-rw-r--r--src/jake2/game/GameItemList.java8
-rw-r--r--src/jake2/game/GameItems.java14
-rw-r--r--src/jake2/game/GameMisc.java15
-rw-r--r--src/jake2/game/GameSVCmds.java45
-rw-r--r--src/jake2/game/GameSave.java26
-rw-r--r--src/jake2/game/GameSpawn.java81
-rw-r--r--src/jake2/game/GameTarget.java67
-rw-r--r--src/jake2/game/GameTrigger.java22
-rw-r--r--src/jake2/game/GameTurret.java28
-rw-r--r--src/jake2/game/game_import_t.java8
-rw-r--r--src/jake2/game/gclient_t.java7
-rw-r--r--src/jake2/qcommon/PMove.java7
-rw-r--r--src/jake2/server/SV.java157
-rw-r--r--src/jake2/server/SV_GAME.java10
20 files changed, 371 insertions, 651 deletions
diff --git a/src/jake2/client/M.java b/src/jake2/client/M.java
index ef33bff..dd6e853 100644
--- a/src/jake2/client/M.java
+++ b/src/jake2/client/M.java
@@ -2,7 +2,7 @@
* M.java
* Copyright (C) 2003
*
- * $Id: M.java,v 1.8 2005-11-20 22:18:34 salomo Exp $
+ * $Id: M.java,v 1.9 2006-01-21 21:53:32 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -75,6 +75,11 @@ public final class M {
ent.velocity[2] = 0;
}
}
+
+ /**
+ * Returns false if any part of the bottom of the entity is off an edge that
+ * is not a staircase.
+ */
public static boolean M_CheckBottom(edict_t ent) {
float[] mins = { 0, 0, 0 };
@@ -143,11 +148,9 @@ public final class M {
return true; // we got out easy
}
- /*
- * ===============
- * M_ChangeYaw
- * ===============
- *///ok
+ /**
+ * M_ChangeYaw.
+ */
public static void M_ChangeYaw(edict_t ent) {
float ideal;
float current;
@@ -180,10 +183,8 @@ public final class M {
ent.s.angles[Defines.YAW] = Math3D.anglemod(current + move);
}
- /*
- * ======================
- * M_MoveToGoal
- * ======================
+ /**
+ * M_MoveToGoal.
*/
public static void M_MoveToGoal(edict_t ent, float dist) {
edict_t goal = ent.goalentity;
@@ -204,10 +205,8 @@ public final class M {
}
}
- /*
- * ===============
- * M_walkmove
- * ===============
+ /**
+ * M_walkmove.
*/
public static boolean M_walkmove(edict_t ent, float yaw, float dist) {
float[] move = { 0, 0, 0 };
diff --git a/src/jake2/game/Cmd.java b/src/jake2/game/Cmd.java
index 7060fdd..f62136c 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.17 2005-12-18 17:08:27 salomo Exp $
+ * $Id: Cmd.java,v 1.18 2006-01-21 21:53:32 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -147,7 +147,7 @@ public final class Cmd {
public static final int ALIAS_LOOP_COUNT = 16;
/**
- * register our commands
+ * Register our commands.
*/
public static void Init() {
@@ -178,10 +178,8 @@ public final class Cmd {
}
};
- /*
- * ======================
- * Cmd_MacroExpandString
- * ======================
+ /**
+ * Cmd_MacroExpandString.
*/
public static char[] MacroExpandString(char text[], int len) {
int i, j, count;
@@ -231,20 +229,13 @@ public final class Cmd {
return null;
}
- //strncpy(temporary, scan, i);
System.arraycopy(scan, 0, temporary, 0, i);
-
- //strcpy(temporary + i, token);
System.arraycopy(token.toCharArray(), 0, temporary, i, token.length());
-
- //strcpy(temporary + i + j, start);
System.arraycopy(ph.data, ph.index, temporary, i + j, len - ph.index - j);
- //strcpy(expanded, temporary);
System.arraycopy(temporary, 0, expanded, 0, 0);
scan = expanded;
i--;
-
if (++count == 100) {
Com.Printf("Macro expansion loop, discarded.\n");
return null;
@@ -259,13 +250,11 @@ public final class Cmd {
return scan;
}
- /*
- * ============
+ /**
* Cmd_TokenizeString
*
* Parses the given string into command line tokens. $Cvars will be expanded
- * unless they are in a quoted token
- * ============
+ * unless they are in a quoted token.
*/
public static void TokenizeString(char text[], boolean macroExpand) {
String com_token;
@@ -345,10 +334,8 @@ public final class Cmd {
cmd_functions = cmd;
}
- /*
- * ============
+ /**
* Cmd_RemoveCommand
- * ============
*/
public static void RemoveCommand(String cmd_name) {
cmd_function_t cmd, back = null;
@@ -373,10 +360,8 @@ public final class Cmd {
}
}
- /*
- * ============
+ /**
* Cmd_Exists
- * ============
*/
public static boolean Exists(String cmd_name) {
cmd_function_t cmd;
@@ -403,13 +388,11 @@ public final class Cmd {
return new String(cmd_args);
}
- /*
- * ============
+ /**
* Cmd_ExecuteString
*
* A complete command line has been parsed, so try to execute it
* FIXME: lookupnoadd the token to speed search?
- * ============
*/
public static void ExecuteString(String text) {
@@ -418,13 +401,6 @@ public final class Cmd {
TokenizeString(text.toCharArray(), true);
- // 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
@@ -463,12 +439,10 @@ public final class Cmd {
Cmd.ForwardToServer();
}
- /*
- * ==================
+ /**
* Cmd_Give_f
*
- * Give items to a client
- * ==================
+ * Give items to a client.
*/
public static void Give_f(edict_t ent) {
String name;
@@ -479,9 +453,8 @@ public final class Cmd {
edict_t it_ent;
if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
- SV_GAME
- .PF_cprintf(ent, Defines.PRINT_HIGH,
- "You must run the server with '+set cheats 1' to enable this command.\n");
+ SV_GAME.PF_cprintfhigh(ent,
+ "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
@@ -601,22 +574,19 @@ public final class Cmd {
}
}
- /*
- * ==================
+ /**
* Cmd_God_f
*
* Sets client to godmode
*
- * argv(0) god
- * ==================
+ * argv(0) god
*/
public static void God_f(edict_t ent) {
String msg;
if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
- SV_GAME
- .PF_cprintf(ent, Defines.PRINT_HIGH,
- "You must run the server with '+set cheats 1' to enable this command.\n");
+ SV_GAME.PF_cprintfhigh(ent,
+ "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
@@ -629,22 +599,19 @@ public final class Cmd {
SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg);
}
- /*
- * ==================
+ /**
* Cmd_Notarget_f
*
* Sets client to notarget
*
- * argv(0) notarget
- * ==================
+ * argv(0) notarget.
*/
public static void Notarget_f(edict_t ent) {
String msg;
if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
- SV_GAME
- .PF_cprintf(ent, Defines.PRINT_HIGH,
- "You must run the server with '+set cheats 1' to enable this command.\n");
+ SV_GAME.PF_cprintfhigh(ent,
+ "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
@@ -654,23 +621,20 @@ public final class Cmd {
else
msg = "notarget ON\n";
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg);
+ SV_GAME.PF_cprintfhigh(ent, msg);
}
- /*
- * ==================
+ /**
* Cmd_Noclip_f
*
- * argv(0) noclip
- * ==================
+ * argv(0) noclip.
*/
public static void Noclip_f(edict_t ent) {
String msg;
if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) {
- SV_GAME
- .PF_cprintf(ent, Defines.PRINT_HIGH,
- "You must run the server with '+set cheats 1' to enable this command.\n");
+ SV_GAME.PF_cprintfhigh(ent,
+ "You must run the server with '+set cheats 1' to enable this command.\n");
return;
}
@@ -682,15 +646,13 @@ public final class Cmd {
msg = "noclip ON\n";
}
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg);
+ SV_GAME.PF_cprintfhigh(ent, msg);
}
- /*
- * ==================
+ /**
* Cmd_Use_f
*
- * Use an inventory item
- * ==================
+ * Use an inventory item.
*/
public static void Use_f(edict_t ent) {
int index;
@@ -702,31 +664,26 @@ public final class Cmd {
it = GameItems.FindItem(s);
Com.dprintln("using:" + s);
if (it == null) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s
- + "\n");
+ SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\n");
return;
}
if (it.use == null) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH,
- "Item is not usable.\n");
+ SV_GAME.PF_cprintfhigh(ent, "Item is not usable.\n");
return;
}
index = GameItems.ITEM_INDEX(it);
if (0 == ent.client.pers.inventory[index]) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s
- + "\n");
+ SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\n");
return;
}
it.use.use(ent, it);
}
- /*
- * ==================
+ /**
* Cmd_Drop_f
*
- * Drop an inventory item
- * ==================
+ * Drop an inventory item.
*/
public static void Drop_f(edict_t ent) {
int index;
@@ -736,8 +693,7 @@ public final class Cmd {
s = Cmd.Args();
it = GameItems.FindItem(s);
if (it == null) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s
- + "\n");
+ SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\n");
return;
}
if (it.drop == null) {
@@ -747,16 +703,15 @@ public final class Cmd {
}
index = GameItems.ITEM_INDEX(it);
if (0 == ent.client.pers.inventory[index]) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s
- + "\n");
+ SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\n");
return;
}
it.drop.drop(ent, it);
}
- /*
- * ================= Cmd_Inven_f =================
+ /**
+ * Cmd_Inven_f.
*/
public static void Inven_f(edict_t ent) {
int i;
@@ -781,12 +736,8 @@ public final class Cmd {
GameBase.gi.unicast(ent, true);
}
- /*
- * =================
- *
- * Cmd_InvUse_f
- *
- * =================
+ /**
+ * Cmd_InvUse_f.
*/
public static void InvUse_f(edict_t ent) {
gitem_t it;
@@ -794,26 +745,20 @@ public final class Cmd {
Cmd.ValidateSelectedItem(ent);
if (ent.client.pers.selected_item == -1) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "No item to use.\n");
+ SV_GAME.PF_cprintfhigh(ent, "No item to use.\n");
return;
}
it = GameItemList.itemlist[ent.client.pers.selected_item];
if (it.use == null) {
- SV_GAME
- .PF_cprintf(ent, Defines.PRINT_HIGH,
- "Item is not usable.\n");
+ SV_GAME.PF_cprintfhigh(ent, "Item is not usable.\n");
return;
}
it.use.use(ent, it);
}
- /*
- * =================
- *
- * Cmd_WeapPrev_f
- *
- * =================
+ /**
+ * Cmd_WeapPrev_f.
*/
public static void WeapPrev_f(edict_t ent) {
gclient_t cl;
@@ -846,12 +791,8 @@ public final class Cmd {
}
}
- /*
- * =================
- *
- * Cmd_WeapNext_f
- *
- * =================
+ /**
+ * Cmd_WeapNext_f.
*/
public static void WeapNext_f(edict_t ent) {
gclient_t cl;
@@ -886,12 +827,8 @@ public final class Cmd {
}
}
- /*
- * =================
- *
- * Cmd_WeapLast_f
- *
- * =================
+ /**
+ * Cmd_WeapLast_f.
*/
public static void WeapLast_f(edict_t ent) {
gclient_t cl;
@@ -914,12 +851,8 @@ public final class Cmd {
it.use.use(ent, it);
}
- /*
- * =================
- *
+ /**
* Cmd_InvDrop_f
- *
- * =================
*/
public static void InvDrop_f(edict_t ent) {
gitem_t it;
@@ -927,26 +860,23 @@ public final class Cmd {
Cmd.ValidateSelectedItem(ent);
if (ent.client.pers.selected_item == -1) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "No item to drop.\n");
+ SV_GAME.PF_cprintfhigh(ent, "No item to drop.\n");
return;
}
it = GameItemList.itemlist[ent.client.pers.selected_item];
if (it.drop == null) {
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH,
- "Item is not dropable.\n");
+ SV_GAME.PF_cprintfhigh(ent, "Item is not dropable.\n");
return;
}
it.drop.drop(ent, it);
}
- /*
- * ==================
+ /**
* Cmd_Score_f
*
- * Display the scoreboard
+ * Display the scoreboard.
*
- * ==================
*/
public static void Score_f(edict_t ent) {
ent.client.showinventory = false;
@@ -964,12 +894,11 @@ public final class Cmd {
PlayerHud.DeathmatchScoreboard(ent);
}
- /*
- * ==================
+ /**
* Cmd_Help_f
*
- * Display the current help message
- * ==================
+ * Display the current help message.
+ *
*/
public static void Help_f(edict_t ent) {
// this is for backwards compatability
@@ -992,10 +921,8 @@ public final class Cmd {
PlayerHud.HelpComputer(ent);
}
- //=======================================================================
-
- /*
- * ================= Cmd_Kill_f =================
+ /**
+ * Cmd_Kill_f
*/
public static void Kill_f(edict_t ent) {
if ((GameBase.level.time - ent.client.respawn_time) < 5)
@@ -1006,8 +933,8 @@ public final class Cmd {
PlayerClient.player_die.die(ent, ent, ent, 100000, Globals.vec3_origin);
}
- /*
- * ================= Cmd_PutAway_f =================
+ /**
+ * Cmd_PutAway_f
*/
public static void PutAway_f(edict_t ent) {
ent.client.showscores = false;
@@ -1015,8 +942,8 @@ public final class Cmd {
ent.client.showinventory = false;
}
- /*
- * ================= Cmd_Players_f =================
+ /**
+ * Cmd_Players_f
*/
public static void Players_f(edict_t ent) {
int i;
@@ -1035,8 +962,6 @@ public final class Cmd {
}
// sort by frags
- //qsort(index, count, sizeof(index[0]), PlayerSort);
- //replaced by:
Arrays.sort(index, 0, count - 1, Cmd.PlayerSort);
// print information
@@ -1056,12 +981,11 @@ public final class Cmd {
large += small;
}
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "" + large + "\n" + count
- + " players\n");
+ SV_GAME.PF_cprintfhigh(ent, large + "\n" + count + " players\n");
}
- /*
- * ================= Cmd_Wave_f =================
+ /**
+ * Cmd_Wave_f
*/
public static void Wave_f(edict_t ent) {
int i;
@@ -1079,36 +1003,43 @@ public final class Cmd {
switch (i) {
case 0:
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "flipoff\n");
+ SV_GAME.PF_cprintfhigh(ent, "flipoff\n");
ent.s.frame = M_Player.FRAME_flip01 - 1;
ent.client.anim_end = M_Player.FRAME_flip12;
break;
case 1:
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "salute\n");
+ SV_GAME.PF_cprintfhigh(ent, "salute\n");
ent.s.frame = M_Player.FRAME_salute01 - 1;
ent.client.anim_end = M_Player.FRAME_salute11;
break;
case 2:
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "taunt\n");
+ SV_GAME.PF_cprintfhigh(ent, "taunt\n");
ent.s.frame = M_Player.FRAME_taunt01 - 1;
ent.client.anim_end = M_Player.FRAME_taunt17;
break;
case 3:
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "wave\n");
+ SV_GAME.PF_cprintfhigh(ent, "wave\n");
ent.s.frame = M_Player.FRAME_wave01 - 1;
ent.client.anim_end = M_Player.FRAME_wave11;
break;
case 4:
default:
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "point\n");
+ SV_GAME.PF_cprintfhigh(ent, "point\n");
ent.s.frame = M_Player.FRAME_point01 - 1;
ent.client.anim_end = M_Player.FRAME_point12;
break;
}
}
- /*
- * ================== Cmd_Say_f ==================
+ /**
+ * Command to print the players own position.
+ */
+ public static void ShowPosition_f(edict_t ent) {
+ SV_GAME.PF_cprintfhigh(ent, "pos=" + Lib.vtofsbeaty(ent.s.origin) + "\n");
+ }
+
+ /**
+ * Cmd_Say_f
*/
public static void Say_f(edict_t ent, boolean team, boolean arg0) {
@@ -1137,10 +1068,6 @@ public final class Cmd {
text += Cmd.Args().substring(1, Cmd.Args().length() - 1);
else
text += Cmd.Args();
- /*
- * p = gi.args(); // *p == if (p == '"') { p++; p[strlen(p) - 1] =
- * 0; } strcat(text, p);
- */
}
// don't let text be too long for malicious reasons
@@ -1154,31 +1081,24 @@ public final class Cmd {
cl = ent.client;
if (GameBase.level.time < cl.flood_locktill) {
- SV_GAME
- .PF_cprintf(
- ent,
- Defines.PRINT_HIGH,
- "You can't talk for "
+ SV_GAME.PF_cprintfhigh(ent, "You can't talk for "
+ (int) (cl.flood_locktill - GameBase.level.time)
+ " more seconds\n");
return;
}
i = (int) (cl.flood_whenhead - GameBase.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
&& GameBase.level.time - cl.flood_when[i] < GameBase.flood_persecond.value) {
- cl.flood_locktill = GameBase.level.time
- + GameBase.flood_waitdelay.value;
+ cl.flood_locktill = GameBase.level.time + GameBase.flood_waitdelay.value;
SV_GAME.PF_cprintf(ent, Defines.PRINT_CHAT,
"Flood protection: You can't talk for "
+ (int) GameBase.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] = GameBase.level.time;
}
@@ -1229,23 +1149,18 @@ public final class Cmd {
if (text.length() + st.length() > 1024 - 50) {
text += "And more...\n";
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "" + text + "");
+ SV_GAME.PF_cprintfhigh(ent, "" + text + "");
return;
}
text += st;
}
- SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, text);
+ SV_GAME.PF_cprintfhigh(ent, text);
}
- // ======================================================================
-
- /*
- * =================== Cmd_ForwardToServer
- *
- * adds the current command line as a clc_stringcmd to the client message.
+ /**
+ * Adds the current command line as a clc_stringcmd to the client message.
* things like godmode, noclip, etc, are commands directed to the server, so
* when they are typed in at the console, they will need to be forwarded.
- * ===================
*/
public static void ForwardToServer() {
String cmd;
@@ -1265,8 +1180,8 @@ public final class Cmd {
}
}
- /*
- * ============ Cmd_CompleteCommand ============
+ /**
+ * Cmd_CompleteCommand.
*/
public static Vector CompleteCommand(String partial) {
Vector cmds = new Vector();
@@ -1284,7 +1199,6 @@ public final class Cmd {
/**
* Processes the commands the player enters in the quake console.
- *
*/
public static void ClientCommand(edict_t ent) {
String cmd;
@@ -1292,25 +1206,25 @@ public final class Cmd {
if (ent.client == null)
return; // not fully in game yet
- cmd = GameBase.gi.argv(0);
+ cmd = GameBase.gi.argv(0).toLowerCase();
- if (Lib.Q_stricmp(cmd, "players") == 0) {
+ if (cmd.equals("players")) {
Players_f(ent);
return;
}
- if (Lib.Q_stricmp(cmd, "say") == 0) {
+ if (cmd.equals("say")) {
Say_f(ent, false, false);
return;
}
- if (Lib.Q_stricmp(cmd, "say_team") == 0) {
+ if (cmd.equals("say_team")) {
Say_f(ent, true, false);
return;
}
- if (Lib.Q_stricmp(cmd, "score") == 0) {
+ if (cmd.equals("score")) {
Score_f(ent);
return;
}
- if (Lib.Q_stricmp(cmd, "help") == 0) {
+ if (cmd.equals("help")) {
Help_f(ent);
return;
}
@@ -1318,60 +1232,59 @@ public final class Cmd {
if (GameBase.level.intermissiontime != 0)
return;
- if (Lib.Q_stricmp(cmd, "use") == 0)
+ if (cmd.equals("use"))
Use_f(ent);
-
- else if (Lib.Q_stricmp(cmd, "drop") == 0)
+ else if (cmd.equals("drop"))
Drop_f(ent);
- else if (Lib.Q_stricmp(cmd, "give") == 0)
+ else if (cmd.equals("give"))
Give_f(ent);
- else if (Lib.Q_stricmp(cmd, "god") == 0)
+ else if (cmd.equals("god"))
God_f(ent);
- else if (Lib.Q_stricmp(cmd, "notarget") == 0)
+ else if (cmd.equals("notarget"))
Notarget_f(ent);
- else if (Lib.Q_stricmp(cmd, "noclip") == 0)
+ else if (cmd.equals("noclip"))
Noclip_f(ent);
- else if (Lib.Q_stricmp(cmd, "inven") == 0)
+ else if (cmd.equals("inven"))
Inven_f(ent);
- else if (Lib.Q_stricmp(cmd, "invnext") == 0)
+ else if (cmd.equals("invnext"))
GameItems.SelectNextItem(ent, -1);
- else if (Lib.Q_stricmp(cmd, "invprev") == 0)
+ else if (cmd.equals("invprev"))
GameItems.SelectPrevItem(ent, -1);
- else if (Lib.Q_stricmp(cmd, "invnextw") == 0)
+ else if (cmd.equals("invnextw"))
GameItems.SelectNextItem(ent, Defines.IT_WEAPON);
- else if (Lib.Q_stricmp(cmd, "invprevw") == 0)
+ else if (cmd.equals("invprevw"))
GameItems.SelectPrevItem(ent, Defines.IT_WEAPON);
- else if (Lib.Q_stricmp(cmd, "invnextp") == 0)
+ else if (cmd.equals("invnextp"))
GameItems.SelectNextItem(ent, Defines.IT_POWERUP);
- else if (Lib.Q_stricmp(cmd, "invprevp") == 0)
+ else if (cmd.equals("invprevp"))
GameItems.SelectPrevItem(ent, Defines.IT_POWERUP);
- else if (Lib.Q_stricmp(cmd, "invuse") == 0)
+ else if (cmd.equals("invuse"))
InvUse_f(ent);
- else if (Lib.Q_stricmp(cmd, "invdrop") == 0)
+ else if (cmd.equals("invdrop"))
InvDrop_f(ent);
- else if (Lib.Q_stricmp(cmd, "weapprev") == 0)
+ else if (cmd.equals("weapprev"))
WeapPrev_f(ent);
- else if (Lib.Q_stricmp(cmd, "weapnext") == 0)
+ else if (cmd.equals("weapnext"))
WeapNext_f(ent);
- else if (Lib.Q_stricmp(cmd, "weaplast") == 0)
+ else if (cmd.equals("weaplast"))
WeapLast_f(ent);
- else if (Lib.Q_stricmp(cmd, "kill") == 0)
+ else if (cmd.equals("kill"))
Kill_f(ent);
- else if (Lib.Q_stricmp(cmd, "putaway") == 0)
+ else if (cmd.equals("putaway"))
PutAway_f(ent);
- else if (Lib.Q_stricmp(cmd, "wave") == 0)
+ else if (cmd.equals("wave"))
Wave_f(ent);
- else if (Lib.Q_stricmp(cmd, "playerlist") == 0)
+ else if (cmd.equals("playerlist"))
PlayerList_f(ent);
+ else if (cmd.equals("showposition"))
+ ShowPosition_f(ent);
else
// anything that doesn't match a command will be a chat
Say_f(ent, false, true);
}
- public static void ValidateSelectedItem(edict_t ent) {
- gclient_t cl;
-
- cl = ent.client;
+ public static void ValidateSelectedItem(edict_t ent) {
+ gclient_t cl = ent.client;
if (cl.pers.inventory[cl.pers.selected_item] != 0)
return; // valid
diff --git a/src/jake2/game/GameBase.java b/src/jake2/game/GameBase.java
index b711f6e..18b861a 100644
--- a/src/jake2/game/GameBase.java
+++ b/src/jake2/game/GameBase.java
@@ -20,7 +20,7 @@
// Created on 30.11.2003 by RST.
-// $Id: GameBase.java,v 1.12 2005-12-16 21:15:50 salomo Exp $
+// $Id: GameBase.java,v 1.13 2006-01-21 21:53:31 salomo Exp $
/** Father of all GameObjects. */
@@ -151,30 +151,14 @@ public class GameBase {
return blocked;
}
- /**
- * SV_FlyMove
- *
- * The basic solid body movement clip that slides along multiple planes
- * Returns the clipflags if the velocity was modified (hit something solid)
- * 1 = floor 2 = wall / step 4 = dead stop
- */
- public final static int MAX_CLIP_PLANES = 5;
- /*
- * ============= G_Find
- *
+ /**
* Searches all active entities for the next one that holds the matching
* string at fieldofs (use the FOFS() macro) in the structure.
*
* Searches beginning at the edict after from, or the beginning if null null
* will be returned if the end of the list is reached.
*
- * =============
- */
-
- /**
- * Finds an edict. Call with null as from parameter to search from array
- * beginning.
*/
public static EdictIterator G_Find(EdictIterator from, EdictFindFilter eff,
@@ -303,10 +287,8 @@ public class GameBase {
return new String(in);
}
- /*
- * ============ G_TouchTriggers
- *
- * ============
+ /**
+ * G_TouchTriggers
*/
static edict_t touch[] = new edict_t[Defines.MAX_EDICTS];
@@ -334,10 +316,6 @@ public class GameBase {
if (hit.touch == null)
continue;
- //rst: just for debugging player triggers
- //if (ent.index == 1)
- //Com.Printf("trigger:" + hit.classname + "(" + hit.index + ")\n");
-
hit.touch.touch(hit, ent, dummyplane, null);
}
}
@@ -352,23 +330,12 @@ public class GameBase {
public static edict_t obstacle;
- /*
- * ============= M_CheckBottom
- *
- * Returns false if any part of the bottom of the entity is off an edge that
- * is not a staircase.
- *
- * =============
- */
public static int c_yes, c_no;
public static int STEPSIZE = 18;
- // ============================================================================
- /*
- * ================ G_RunEntity
- *
- * ================
+ /**
+ * G_RunEntity
*/
public static void G_RunEntity(edict_t ent) {
@@ -400,13 +367,6 @@ public class GameBase {
}
}
- /*
- * ================ SV_NewChaseDir
- *
- * ================
- */
- public static int DI_NODIR = -1;
-
public static void ClearBounds(float[] mins, float[] maxs) {
mins[0] = mins[1] = mins[2] = 99999;
maxs[0] = maxs[1] = maxs[2] = -99999;
@@ -439,16 +399,12 @@ public class GameBase {
}
};
- //===================================================================
-
public static void ShutdownGame() {
gi.dprintf("==== ShutdownGame ====\n");
}
- //======================================================================
-
- /*
- * ================= ClientEndServerFrames =================
+ /**
+ * ClientEndServerFrames.
*/
public static void ClientEndServerFrames() {
int i;
@@ -465,10 +421,8 @@ public class GameBase {
}
- /*
- * ================= CreateTargetChangeLevel
- *
- * Returns the created target changelevel =================
+ /**
+ * Returns the created target changelevel.
*/
public static edict_t CreateTargetChangeLevel(String map) {
edict_t ent;
@@ -480,10 +434,8 @@ public class GameBase {
return ent;
}
- /*
- * ================= EndDMLevel
- *
- * The timelimit or fraglimit has been exceeded =================
+ /**
+ * The timelimit or fraglimit has been exceeded.
*/
public static void EndDMLevel() {
edict_t ent;
@@ -543,8 +495,8 @@ public class GameBase {
}
}
- /*
- * ================= CheckNeedPass =================
+ /**
+ * CheckNeedPass.
*/
public static void CheckNeedPass() {
int need;
@@ -567,8 +519,8 @@ public class GameBase {
}
}
- /*
- * ================= CheckDMRules =================
+ /**
+ * CheckDMRules.
*/
public static void CheckDMRules() {
int i;
@@ -603,16 +555,14 @@ public class GameBase {
}
}
- /*
- * ============= ExitLevel =============
+ /**
+ * Exits a level.
*/
public static void ExitLevel() {
int i;
edict_t ent;
- //char command[256];
- String command;
- command = "gamemap \"" + level.changemap + "\"\n";
+ String command = "gamemap \"" + level.changemap + "\"\n";
gi.AddCommandString(command);
level.changemap = null;
level.exitintermission = false;
@@ -627,13 +577,12 @@ public class GameBase {
if (ent.health > ent.client.pers.max_health)
ent.health = ent.client.pers.max_health;
}
-
}
- /*
- * ================ G_RunFrame
- *
- * Advances the world by 0.1 seconds ================
+ /**
+ * G_RunFrame
+ *
+ * Advances the world by Defines.FRAMETIME (0.1) seconds.
*/
public static void G_RunFrame() {
int i;
@@ -694,16 +643,13 @@ public class GameBase {
ClientEndServerFrames();
}
- /*
- * ================= GetGameAPI
- *
- * Returns a pointer to the structure with all entry points and global
- * variables =================
+ /**
+ * This return a pointer to the structure with all entry points and global
+ * variables.
*/
public static void GetGameApi(game_import_t imp) {
gi = imp;
-
gi.pointcontents = new pmove_t.PointContentsAdapter() {
public int pointcontents(float[] o) {
return SV_WORLD.SV_PointContents(o);
diff --git a/src/jake2/game/GameChase.java b/src/jake2/game/GameChase.java
index d6f49b7..1759e96 100644
--- a/src/jake2/game/GameChase.java
+++ b/src/jake2/game/GameChase.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 16.11.2005 by RST.
-// $Id: GameChase.java,v 1.1 2005-11-16 22:24:52 salomo Exp $
+// $Id: GameChase.java,v 1.2 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -190,5 +190,4 @@ public class GameChase {
}
GameBase.gi.centerprintf(ent, "No other players to chase.");
}
-
}
diff --git a/src/jake2/game/GameCombat.java b/src/jake2/game/GameCombat.java
index 721c65d..16ae440 100644
--- a/src/jake2/game/GameCombat.java
+++ b/src/jake2/game/GameCombat.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 16.11.2005 by RST.
-// $Id: GameCombat.java,v 1.2 2005-12-10 22:45:01 salomo Exp $
+// $Id: GameCombat.java,v 1.3 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -30,11 +30,11 @@ import jake2.util.Math3D;
public class GameCombat {
- /*
- * ============ CanDamage
+ /**
+ * CanDamage
*
* Returns true if the inflictor can directly damage the target. Used for
- * explosions and melee attacks. ============
+ * explosions and melee attacks.
*/
static boolean CanDamage(edict_t targ, edict_t inflictor) {
float[] dest = { 0, 0, 0 };
@@ -94,8 +94,8 @@ public class GameCombat {
return false;
}
- /*
- * ============ Killed ============
+ /**
+ * Killed.
*/
public static void Killed(edict_t targ, edict_t inflictor,
edict_t attacker, int damage, float[] point) {
@@ -103,7 +103,6 @@ public class GameCombat {
if (targ.health < -999)
targ.health = -999;
- //Com.Println("Killed:" + targ.classname);
targ.enemy = attacker;
if ((targ.svflags & Defines.SVF_MONSTER) != 0
@@ -137,8 +136,8 @@ public class GameCombat {
targ.die.die(targ, inflictor, attacker, damage, point);
}
- /*
- * ================ SpawnDamage ================
+ /**
+ * SpawnDamage.
*/
static void SpawnDamage(int type, float[] origin, float[] normal, int damage) {
if (damage > 255)
@@ -351,8 +350,8 @@ public class GameCombat {
return false;
}
- /*
- * ============ T_RadiusDamage ============
+ /**
+ * T_RadiusDamage.
*/
static void T_RadiusDamage(edict_t inflictor, edict_t attacker,
float damage, edict_t ignore, float radius, int mod) {
@@ -431,7 +430,7 @@ public class GameCombat {
Math3D.VectorNormalize(dir);
- // bonus damage for suprising a monster
+ // bonus damage for suprising a monster
if (0 == (dflags & Defines.DAMAGE_RADIUS)
&& (targ.svflags & Defines.SVF_MONSTER) != 0
&& (attacker.client != null) && (targ.enemy == null)
@@ -441,7 +440,7 @@ public class GameCombat {
if ((targ.flags & Defines.FL_NO_KNOCKBACK) != 0)
knockback = 0;
- // figure momentum add
+ // figure momentum add
if (0 == (dflags & Defines.DAMAGE_NO_KNOCKBACK)) {
if ((knockback != 0) && (targ.movetype != Defines.MOVETYPE_NONE)
&& (targ.movetype != Defines.MOVETYPE_BOUNCE)
@@ -551,5 +550,4 @@ public class GameCombat {
Math3D.VectorCopy(point, client.damage_from);
}
}
-
}
diff --git a/src/jake2/game/GameFunc.java b/src/jake2/game/GameFunc.java
index 7abf9b3..7f81375 100644
--- a/src/jake2/game/GameFunc.java
+++ b/src/jake2/game/GameFunc.java
@@ -19,7 +19,7 @@
*/
// Created on 18.11.2003 by RST.
-// $Id: GameFunc.java,v 1.8 2005-11-20 22:18:33 salomo Exp $
+// $Id: GameFunc.java,v 1.9 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -66,11 +66,11 @@ public class GameFunc {
}
}
- /*
- * ============== Think_AccelMove
+ /**
+ * Think_AccelMove
*
* The team has completed a frame of movement, so change the speed for the
- * next frame ==============
+ * next frame.
*/
static float AccelerationDistance(float target, float rate) {
return target * ((target / rate) + 1) / 2;
@@ -230,7 +230,7 @@ public class GameFunc {
GameBase.gi.linkentity(trigger);
}
- /*
+ /**
* QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER speed default 150
*
* Plats are always drawn in the extended position, so they will light
@@ -313,18 +313,15 @@ public class GameFunc {
ent.moveinfo.sound_end = GameBase.gi.soundindex("plats/pt1_end.wav");
}
- /*
- * ======================================================================
- *
+ /**
* DOORS
*
* spawn a trigger surrounding the entire team unless it is already targeted
- * by another
+ * by another.
*
- * ======================================================================
*/
- /*
+ /**
* QUAKED func_door (0 .5 .8) ? START_OPEN x CRUSHER NOMONSTER ANIMATED
* TOGGLE ANIMATED_FAST TOGGLE wait in both the start and end states for a
* trigger event. START_OPEN the door to moves to its destination when
@@ -387,7 +384,7 @@ public class GameFunc {
door_use_areaportals(self, true);
}
- /*
+ /**
* QUAKED func_water (0 .5 .8) ? START_OPEN func_water is a moveable water
* brush. It must be targeted to operate. Use a non-water texture at your
* own risk.
@@ -548,9 +545,7 @@ public class GameFunc {
self.svflags = Defines.SVF_NOCLIENT;
}
- /*
- * =========================================================
- *
+ /**
* PLATS
*
* movement options:
@@ -565,8 +560,6 @@ public class GameFunc {
* movetype_stop action when touched action when blocked action when used
* disabled? auto trigger spawning
*
- *
- * =========================================================
*/
public final static int PLAT_LOW_TRIGGER = 1;
@@ -857,9 +850,7 @@ public class GameFunc {
}
};
- // ====================================================================
-
- /*
+ /**
* QUAKED func_rotating (0 .5 .8) ? START_ON REVERSE X_AXIS Y_AXIS
* TOUCH_PAIN STOP ANIMATED ANIMATED_FAST You need to have an origin brush
* as part of this entity. The center of that brush will be the point around
@@ -1359,9 +1350,9 @@ public class GameFunc {
if ((self.spawnflags & DOOR_CRUSHER) != 0)
return;
- // if a door has a negative wait, it would never come back if
+ // if a door has a negative wait, it would never come back if
// blocked,
- // so let it just squash the object to death real fast
+ // so let it just squash the object to death real fast
if (self.moveinfo.wait >= 0) {
if (self.moveinfo.state == STATE_DOWN) {
for (ent = self.teammaster; ent != null; ent = ent.teamchain)
@@ -2076,7 +2067,6 @@ public class GameFunc {
static EntThinkAdapter door_secret_move6 = new EntThinkAdapter() {
public String getID() { return "door_secret_move6";}
public boolean think(edict_t self) {
-
Move_Calc(self, Globals.vec3_origin, door_secret_done);
return true;
}
@@ -2197,7 +2187,7 @@ public class GameFunc {
}
};
- /*
+ /**
* QUAKED func_killbox (1 0 0) ? Kills everything inside when fired,
* irrespective of protection.
*/
diff --git a/src/jake2/game/GameItemList.java b/src/jake2/game/GameItemList.java
index 2aa6676..03778d0 100644
--- a/src/jake2/game/GameItemList.java
+++ b/src/jake2/game/GameItemList.java
@@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 20.11.2005 by RST.
-// $Id: GameItemList.java,v 1.1 2005-11-20 22:18:34 salomo Exp $
+// $Id: GameItemList.java,v 1.2 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -42,7 +42,8 @@ public class GameItemList {
// ARMOR
//
new gitem_t(
- /*
+
+ /**
* QUAKED item_armor_body (.3 .3 1) (-16 -16 -16) (16 16 16)
*/
@@ -756,7 +757,4 @@ public class GameItemList {
// end of list marker
null };
-
- public static void main(String[] args) {
- }
}
diff --git a/src/jake2/game/GameItems.java b/src/jake2/game/GameItems.java
index a8d3e54..d2faf30 100644
--- a/src/jake2/game/GameItems.java
+++ b/src/jake2/game/GameItems.java
@@ -19,22 +19,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Created on 16.11.2005 by RST.
-// $Id: GameItems.java,v 1.3 2005-12-17 20:32:29 salomo Exp $
+// $Id: GameItems.java,v 1.4 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
-import java.util.StringTokenizer;
-
-import jake2.*;
-import jake2.client.*;
-import jake2.game.*;
-import jake2.qcommon.*;
-import jake2.render.*;
-import jake2.server.*;
+import jake2.Defines;
+import jake2.qcommon.Com;
import jake2.util.Lib;
import jake2.util.Math3D;
+import java.util.StringTokenizer;
+
public class GameItems {
diff --git a/src/jake2/game/GameMisc.java b/src/jake2/game/GameMisc.java
index 4ec43f1..8dc26f3 100644
--- a/src/jake2/game/GameMisc.java
+++ b/src/jake2/game/GameMisc.java
@@ -19,7 +19,7 @@
*/
// Created on 27.12.2003 by RST.
-// $Id: GameMisc.java,v 1.6 2005-11-20 22:18:33 salomo Exp $
+// $Id: GameMisc.java,v 1.7 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
import java.util.Calendar;
@@ -661,7 +661,7 @@ public class GameMisc {
self.nextthink = GameBase.level.time + 1;
}
- /*
+ /**
* QUAKED misc_teleporter (1 0 0) (-32 -32 -24) (32 32 -16) Stepping onto
* this disc will teleport players to the targeted misc_teleporter_dest
* object.
@@ -696,7 +696,7 @@ public class GameMisc {
GameBase.gi.linkentity(trig);
}
- /*
+ /**
* QUAKED func_group (0 0 0) ? Used to group brushes together just for
* editor convenience.
*/
@@ -902,7 +902,6 @@ public class GameMisc {
ent.velocity[2] = 500;
}
- //=====================================================
public static EntUseAdapter Use_Areaportal = new EntUseAdapter() {
public String getID() { return "use_areaportal";}
public void use(edict_t ent, edict_t other, edict_t activator) {
@@ -912,7 +911,7 @@ public class GameMisc {
}
};
- /*
+ /**
* QUAKED func_areaportal (0 0 0) ?
*
* This is a non-visible object that divides the world into areas that are
@@ -929,7 +928,7 @@ public class GameMisc {
}
};
- /*
+ /**
* QUAKED path_corner (.5 .3 0) (-8 -8 -8) (8 8 8) TELEPORT Target: next
* path corner Pathtarget: gets used when an entity that has this
* path_corner targeted touches it
@@ -1932,8 +1931,8 @@ public class GameMisc {
}
};
- /*
- * ================= debris =================
+ /**
+ * Debris
*/
public static EntDieAdapter debris_die = new EntDieAdapter() {
public String getID() { return "debris_die";}
diff --git a/src/jake2/game/GameSVCmds.java b/src/jake2/game/GameSVCmds.java
index 050b507..0adc9c7 100644
--- a/src/jake2/game/GameSVCmds.java
+++ b/src/jake2/game/GameSVCmds.java
@@ -19,7 +19,7 @@
*/
// Created on 01.02.2004 by RST.
-// $Id: GameSVCmds.java,v 1.3 2004-09-22 19:22:05 salomo Exp $
+// $Id: GameSVCmds.java,v 1.4 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -33,8 +33,7 @@ import java.util.StringTokenizer;
public class GameSVCmds {
- /*
- * ==============================================================================
+ /**
*
* PACKET FILTERING
*
@@ -65,8 +64,6 @@ public class GameSVCmds {
* you easily set up a private game, or a game that only allows players from
* your local network.
*
- *
- * ==============================================================================
*/
public static class ipfilter_t {
@@ -89,14 +86,12 @@ public class GameSVCmds {
GameSVCmds.ipfilters[n] = new ipfilter_t();
}
- /*
- * ================= StringToFilter =================
+ /**
+ * StringToFilter.
*/
static boolean StringToFilter(String s, GameSVCmds.ipfilter_t f) {
- //char num[128];
- String num;
- int i, j;
- byte b[] = { 0, 0, 0, 0 };
+
+ byte b[] = { 0, 0, 0, 0 };
byte m[] = { 0, 0, 0, 0 };
try {
@@ -119,8 +114,8 @@ public class GameSVCmds {
return true;
}
- /*
- * ================= SV_FilterPacket =================
+ /**
+ * SV_FilterPacket.
*/
static boolean SV_FilterPacket(String from) {
int i;
@@ -157,8 +152,8 @@ public class GameSVCmds {
return ((int) 1 - GameBase.filterban.value) != 0;
}
- /*
- * ================= SV_AddIP_f =================
+ /**
+ * SV_AddIP_f.
*/
static void SVCmd_AddIP_f() {
int i;
@@ -185,8 +180,8 @@ public class GameSVCmds {
ipfilters[i].compare = 0xffffffff;
}
- /*
- * ================= SV_RemoveIP_f =================
+ /**
+ * SV_RemoveIP_f.
*/
static void SVCmd_RemoveIP_f() {
GameSVCmds.ipfilter_t f = new GameSVCmds.ipfilter_t();
@@ -214,8 +209,8 @@ public class GameSVCmds {
+ GameBase.gi.argv(2) + ".\n");
}
- /*
- * ================= SV_ListIP_f =================
+ /**
+ * SV_ListIP_f.
*/
static void SVCmd_ListIP_f() {
int i;
@@ -231,8 +226,8 @@ public class GameSVCmds {
}
}
- /*
- * ================= SV_WriteIP_f =================
+ /**
+ * SV_WriteIP_f.
*/
static void SVCmd_WriteIP_f() {
RandomAccessFile f;
@@ -250,8 +245,7 @@ public class GameSVCmds {
else
name = game.string + "/listip.cfg";
- GameBase.gi
- .cprintf(null, Defines.PRINT_HIGH, "Writing " + name + ".\n");
+ GameBase.gi.cprintf(null, Defines.PRINT_HIGH, "Writing " + name + ".\n");
f = Lib.fopen(name, "rw");
if (f == null) {
@@ -277,12 +271,11 @@ public class GameSVCmds {
Lib.fclose(f);
}
- /*
- * ================= ServerCommand
+ /**
+ * ServerCommand
*
* ServerCommand will be called when an "sv" command is issued. The game can
* issue gi.argc() / gi.argv() commands to get the rest of the parameters
- * =================
*/
public static void ServerCommand() {
String cmd;
diff --git a/src/jake2/game/GameSave.java b/src/jake2/game/GameSave.java
index a1415e2..eddd890 100644
--- a/src/jake2/game/GameSave.java
+++ b/src/jake2/game/GameSave.java
@@ -19,7 +19,7 @@
*/
// Created on 29.12.2003 by RST.
-// $Id: GameSave.java,v 1.10 2005-11-20 22:18:33 salomo Exp $
+// $Id: GameSave.java,v 1.11 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -112,13 +112,11 @@ public class GameSave {
"jake2.game.GameItemList"
};
- /*
- * ============
+ /**
* InitGame
*
* This will be called when the dll is first loaded, which only happens when
* a new game is started or a save game is loaded.
- * ============
*/
public static void InitGame() {
GameBase.gi.dprintf("==== InitGame ====\n");
@@ -220,8 +218,8 @@ public class GameSave {
GameBase.num_edicts = GameBase.game.maxclients + 1;
}
- /*
- * ============ WriteGame
+ /**
+ * WriteGame
*
* This will be called whenever the game goes to a new level, and when the
* user explicitly saves the game.
@@ -230,7 +228,7 @@ public class GameSave {
* help computer info, and all client states.
*
* A single player death will automatically restore from the last save
- * position. ============
+ * position.
*/
public static void WriteGame(String filename, boolean autosave) {
try {
@@ -281,10 +279,8 @@ public class GameSave {
}
}
- /*
- * ================= WriteLevel
- *
- * =================
+ /**
+ * WriteLevel
*/
public static void WriteLevel(String filename) {
try {
@@ -306,7 +302,6 @@ public class GameSave {
continue;
f.writeInt(i);
ent.write(f);
-
}
i = -1;
@@ -318,8 +313,8 @@ public class GameSave {
}
}
- /*
- * ================= ReadLevel
+ /**
+ * ReadLevel
*
* SpawnEntities will allready have been called on the level the same way it
* was when the level was saved.
@@ -329,8 +324,7 @@ public class GameSave {
* The server will have cleared all of the world links before calling
* ReadLevel.
*
- * No clients are connected yet.
- * =================
+ * No clients are connected yet.
*/
public static void ReadLevel(String filename) {
try {
diff --git a/src/jake2/game/GameSpawn.java b/src/jake2/game/GameSpawn.java
index 463cdba..f983275 100644
--- a/src/jake2/game/GameSpawn.java
+++ b/src/jake2/game/GameSpawn.java
@@ -20,7 +20,7 @@
// Created on 18.11.2003 by RST.
-// $Id: GameSpawn.java,v 1.16 2005-12-12 21:47:30 salomo Exp $
+// $Id: GameSpawn.java,v 1.17 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -104,16 +104,7 @@ public class GameSpawn {
}
};
- // static EntThinkAdapter SP_func_rotating = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_button = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_door = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_door_secret = new EntThinkAdapter()
- // {public boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_door_rotating = new EntThinkAdapter()
- // {public boolean think(edict_t ent){ return true;}};
+
static EntThinkAdapter SP_func_water = new EntThinkAdapter() {
public String getID(){ return "SP_func_water"; }
public boolean think(edict_t ent) {
@@ -130,18 +121,6 @@ public class GameSpawn {
}
};
- // static EntThinkAdapter SP_func_conveyor = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_wall = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_object = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_explosive = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_timer = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
- // static EntThinkAdapter SP_func_areaportal = new EntThinkAdapter() {public
- // boolean think(edict_t ent){ return true;}};
static EntThinkAdapter SP_func_clock = new EntThinkAdapter() {
public String getID(){ return "SP_func_clock"; }
public boolean think(edict_t ent) {
@@ -150,7 +129,7 @@ public class GameSpawn {
}
};
- /*
+ /**
* QUAKED worldspawn (0 0 0) ?
*
* Only used for the world. "sky" environment map name "skyaxis" vector axis
@@ -285,7 +264,7 @@ public class GameSpawn {
GameBase.gi.modelindex("models/objects/gibs/skull/tris.md2");
GameBase.gi.modelindex("models/objects/gibs/head2/tris.md2");
//
- // Setup light animation tables. 'a' is total darkness, 'z' is
+ // Setup light animation tables. 'a' is total darkness, 'z' is
// doublebright.
//
// 0 normal
@@ -329,10 +308,8 @@ public class GameSpawn {
}
};
- /*
- * =============
- * ED_NewString
- * =============
+ /**
+ * ED_NewString.
*/
static String ED_NewString(String string) {
@@ -354,17 +331,12 @@ public class GameSpawn {
return newb.toString();
}
- /*
- * ===============
+ /**
* ED_ParseField
*
- * Takes a key/value pair and sets the binary values in an edict
- * ===============
+ * Takes a key/value pair and sets the binary values in an edict.
*/
static void ED_ParseField(String key, String value, edict_t ent) {
- byte b;
- float v;
- float[] vec = { 0, 0, 0 };
if (key.equals("nextmap"))
Com.Println("nextmap: " + value);
@@ -375,13 +347,11 @@ public class GameSpawn {
}
- /*
- * ====================
+ /**
* ED_ParseEdict
*
* Parses an edict out of the given string, returning the new position ed
- * should be a properly initialized empty edict.
- * ====================
+ * should be a properly initialized empty edict.
*/
static void ED_ParseEdict(Com.ParseHelp ph, edict_t ent) {
@@ -430,15 +400,13 @@ public class GameSpawn {
return;
}
- /*
- * ================
+ /**
* G_FindTeams
*
* Chain together all entities with a matching team field.
*
* All but the first will have the FL_TEAMSLAVE flag set. All but the last
- * will have the teamchain field set to the next one
- * ================
+ * will have the teamchain field set to the next one.
*/
static void G_FindTeams() {
@@ -460,7 +428,7 @@ public class GameSpawn {
e.teammaster = e;
c++;
c2++;
- //Com.Printf("Team:" + e.team+" entity: " + e.index + "\n");
+
for (j = i + 1; j < GameBase.num_edicts; j++) {
e2 = GameBase.g_edicts[j];
if (!e2.inuse)
@@ -479,16 +447,13 @@ public class GameSpawn {
}
}
}
- //gi.dprintf("" + c + " teams with " + c2 + " entities\n");
}
- /*
- * ==============
+ /**
* SpawnEntities
*
* Creates a server's entity / program execution context by parsing textual
- * entity definitions out of an ent file.
- * ==============
+ * entity definitions out of an ent file.
*/
public static void SpawnEntities(String mapname, String entities,
@@ -512,25 +477,20 @@ public class GameSpawn {
PlayerClient.SaveClientData();
- //level.clear();
GameBase.level = new level_locals_t();
for (int n = 0; n < GameBase.game.maxentities; n++) {
GameBase.g_edicts[n] = new edict_t(n);
}
- //memset(g_edicts, 0, game.maxentities * sizeof(g_edicts[0]));
+
GameBase.level.mapname = mapname;
GameBase.game.spawnpoint = spawnpoint;
+
// set client fields on player ents
for (i = 0; i < GameBase.game.maxclients; i++)
GameBase.g_edicts[i + 1].client = GameBase.game.clients[i];
ent = null;
inhibit = 0;
- // parse ents
- //Com.Printf("========================\n");
- //Com.Printf("entities(" + entities.length() + ") = \n" + entities +
- // "\n");
- //Com.Printf("========================\n");
Com.ParseHelp ph = new Com.ParseHelp(entities);
@@ -1203,12 +1163,10 @@ public class GameSpawn {
}
}), new spawn_t(null, null) };
- /*
- * ===============
+ /**
* ED_CallSpawn
*
- * Finds the spawn function for the entity and calls it
- * ===============
+ * Finds the spawn function for the entity and calls it.
*/
public static void ED_CallSpawn(edict_t ent) {
@@ -1245,5 +1203,4 @@ public class GameSpawn {
}
GameBase.gi.dprintf(ent.classname + " doesn't have a spawn function\n");
}
-
} \ No newline at end of file
diff --git a/src/jake2/game/GameTarget.java b/src/jake2/game/GameTarget.java
index b25b72f..9e5bb24 100644
--- a/src/jake2/game/GameTarget.java
+++ b/src/jake2/game/GameTarget.java
@@ -19,7 +19,7 @@
*/
// Created on 28.12.2003 by RST.
-// $Id: GameTarget.java,v 1.7 2005-11-20 22:18:33 salomo Exp $
+// $Id: GameTarget.java,v 1.8 2006-01-21 21:53:31 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -44,9 +44,7 @@ public class GameTarget {
}
if (GameBase.st.noise.indexOf(".wav") < 0)
buffer = "" + GameBase.st.noise + ".wav";
- //Com_sprintf(buffer, sizeof(buffer), "%s.wav", st.noise);
else
- //strncpy(buffer, st.noise, sizeof(buffer));
buffer = GameBase.st.noise;
ent.noise_index = GameBase.gi.soundindex(buffer);
@@ -70,7 +68,7 @@ public class GameTarget {
GameBase.gi.linkentity(ent);
}
- /*
+ /**
* QUAKED target_help (1 0 1) (-16 -16 -24) (16 16 24) help1 When fired, the
* "message" key becomes the current personal computer string, and the
* message light will be set on all clients status bars.
@@ -262,7 +260,7 @@ public class GameTarget {
self.noise_index = GameBase.gi.soundindex("world/quake.wav");
}
- /*
+ /**
* QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8) Fire an origin based
* temp entity event to the clients. "style" type byte
*/
@@ -276,9 +274,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_speaker (1 0 0) (-8 -8 -8) (8 8 8) looped-on looped-off
* reliable "noise" wav file to play "attenuation" -1 = none, send to whole
* level 1 = normal fighting sounds 2 = idle sound level 3 = ambient sound
@@ -315,7 +311,7 @@ public class GameTarget {
}
};
- //==========================================================
+
public static EntUseAdapter Use_Target_Help = new EntUseAdapter() {
public String getID() { return "Use_Target_Help"; }
public void use(edict_t ent, edict_t other, edict_t activator) {
@@ -329,9 +325,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_secret (1 0 1) (-8 -8 -8) (8 8 8) Counts a secret found.
* These are single use targets.
*/
@@ -347,10 +341,8 @@ public class GameTarget {
GameUtil.G_FreeEdict(ent);
}
};
-
- //==========================================================
-
- /*
+
+ /**
* QUAKED target_goal (1 0 1) (-8 -8 -8) (8 8 8) Counts a goal completed.
* These are single use targets.
*/
@@ -370,9 +362,8 @@ public class GameTarget {
}
};
- //==========================================================
- /*
+ /**
* QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8) Spawns an explosion
* temporary entity when used.
*
@@ -416,9 +407,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_changelevel (1 0 0) (-8 -8 -8) (8 8 8) Changes level to
* "map" when fired
*/
@@ -460,9 +449,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_splash (1 0 0) (-8 -8 -8) (8 8 8) Creates a particle splash
* effect when used.
*
@@ -489,9 +476,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_spawner (1 0 0) (-8 -8 -8) (8 8 8) Set target to the type
* of entity you want spawned. Useful for spawning monsters and gibs in the
* factory levels.
@@ -520,9 +505,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_blaster (1 0 0) (-8 -8 -8) (8 8 8) NOTRAIL NOEFFECTS Fires
* a blaster bolt in the set direction when triggered.
*
@@ -550,9 +533,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_crosslevel_trigger (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1
* trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 Once this
* trigger is touched/used, any trigger_crosslevel_target with the same
@@ -568,7 +549,7 @@ public class GameTarget {
}
};
- /*
+ /**
* QUAKED target_crosslevel_target (.5 .5 .5) (-8 -8 -8) (8 8 8) trigger1
* trigger2 trigger3 trigger4 trigger5 trigger6 trigger7 trigger8 Triggered
* by a trigger_crosslevel elsewhere within a unit. If multiple triggers are
@@ -589,9 +570,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_laser (0 .5 .8) (-8 -8 -8) (8 8 8) START_ON RED GREEN BLUE
* YELLOW ORANGE FAT When triggered, fires a laser. You can either set a
* target or a direction.
@@ -615,9 +594,7 @@ public class GameTarget {
if (self.enemy != null) {
Math3D.VectorCopy(self.movedir, last_movedir);
- Math3D
- .VectorMA(self.enemy.absmin, 0.5f, self.enemy.size,
- point);
+ Math3D.VectorMA(self.enemy.absmin, 0.5f, self.enemy.size, point);
Math3D.VectorSubtract(point, self.s.origin, self.movedir);
Math3D.VectorNormalize(self.movedir);
if (!Math3D.VectorEquals(self.movedir, last_movedir))
@@ -687,8 +664,6 @@ public class GameTarget {
public String getID() { return "target_laser_start"; }
public boolean think(edict_t self) {
- edict_t ent;
-
self.movetype = Defines.MOVETYPE_NONE;
self.solid = Defines.SOLID_NOT;
self.s.renderfx |= Defines.RF_BEAM | Defines.RF_TRANSLUCENT;
@@ -743,9 +718,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_lightramp (0 .5 .8) (-8 -8 -8) (8 8 8) TOGGLE speed How
* many seconds the ramping will take message two letters; starting
* lightlevel and ending lightlevel
@@ -820,9 +793,7 @@ public class GameTarget {
}
};
- //==========================================================
-
- /*
+ /**
* QUAKED target_earthquake (1 0 0) (-8 -8 -8) (8 8 8) When triggered, this
* initiates a level-wide earthquake. All players and monsters are affected.
* "speed" severity of the quake (default:200) "count" duration of the quake
diff --git a/src/jake2/game/GameTrigger.java b/src/jake2/game/GameTrigger.java
index 75dbf62..1e23752 100644
--- a/src/jake2/game/GameTrigger.java
+++ b/src/jake2/game/GameTrigger.java
@@ -20,7 +20,7 @@
// Created on 27.12.2003 by RST.
-// $Id: GameTrigger.java,v 1.7 2005-12-14 21:08:03 salomo Exp $
+// $Id: GameTrigger.java,v 1.8 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -46,8 +46,7 @@ public class GameTrigger {
// the trigger was just activated
// ent.activator should be set to the activator so it can be held through a
- // delay
- // so wait for the delay time before firing
+ // delay so wait for the delay time before firing
public static void multi_trigger(edict_t ent) {
if (ent.nextthink != 0)
return; // already been triggered
@@ -96,7 +95,7 @@ public class GameTrigger {
GameBase.gi.linkentity(ent);
}
- /*
+ /**
* QUAKED trigger_once (.5 .5 .5) ? x x TRIGGERED Triggers once, then
* removes itself. You must set the key "target" to the name of another
* object in the level that has a matching "targetname".
@@ -285,7 +284,7 @@ public class GameTrigger {
}
};
- /*
+ /**
* QUAKED trigger_multiple (.5 .5 .5) ? MONSTER NOT_PLAYER TRIGGERED
* Variable sized repeatable trigger. Must be targeted at one or more
* entities. If "delay" is set, the trigger waits some time after activating
@@ -301,7 +300,7 @@ public class GameTrigger {
}
};
- /*
+ /**
* QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) This fixed size
* trigger cannot be touched, it can only be fired by other events.
*/
@@ -320,7 +319,7 @@ public class GameTrigger {
* ==============================================================================
*/
- /*
+ /**
* QUAKED trigger_key (.5 .5 .5) (-8 -8 -8) (8 8 8) A relay trigger that
* only fires it's targets if player has the proper key. Use "item" to
* specify the required key, for example "key_data_cd"
@@ -343,9 +342,8 @@ public class GameTrigger {
self.touch_debounce_time = GameBase.level.time + 5.0f;
GameBase.gi.centerprintf(activator, "You need the "
+ self.item.pickup_name);
- GameBase.gi
- .sound(activator, Defines.CHAN_AUTO, GameBase.gi
- .soundindex("misc/keytry.wav"), 1,
+ GameBase.gi.sound(activator, Defines.CHAN_AUTO,
+ GameBase.gi.soundindex("misc/keytry.wav"), 1,
Defines.ATTN_NORM, 0);
return;
}
@@ -540,7 +538,7 @@ public class GameTrigger {
* ==============================================================================
*/
- /*
+ /**
* QUAKED trigger_gravity (.5 .5 .5) ? Changes the touching entites gravity
* to the value of "gravity". 1.0 is standard gravity for the level.
*/
@@ -562,7 +560,7 @@ public class GameTrigger {
* ==============================================================================
*/
- /*
+ /**
* QUAKED trigger_monsterjump (.5 .5 .5) ? Walking monsters that touch this
* will jump in the direction of the trigger's angle "speed" default to 200,
* the speed thrown forward "height" default to 200, the speed thrown
diff --git a/src/jake2/game/GameTurret.java b/src/jake2/game/GameTurret.java
index a72a48e..65d48cc 100644
--- a/src/jake2/game/GameTurret.java
+++ b/src/jake2/game/GameTurret.java
@@ -19,7 +19,7 @@
*/
// Created on 28.12.2003 by RST.
-// $Id: GameTurret.java,v 1.6 2005-11-20 22:18:34 salomo Exp $
+// $Id: GameTurret.java,v 1.7 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
import jake2.*;
@@ -53,7 +53,7 @@ public class GameTurret {
return 0.125f * (int) x;
}
- /*
+ /**
* QUAKED turret_breach (0 0 0) ? This portion of the turret can change both
* pitch and yaw. The model should be made with a flat pitch. It (and the
* associated base) need to be oriented towards 0. Use "angle" to set the
@@ -118,7 +118,7 @@ public class GameTurret {
GameBase.gi.linkentity(self);
}
- /*
+ /**
* QUAKED turret_base (0 0 0) ? This portion of the turret changes yaw only.
* MUST be teamed with a turret_breach.
*/
@@ -280,14 +280,10 @@ public class GameTurret {
// x & y
angle = self.s.angles[1] + self.owner.move_origin[1];
angle *= (Math.PI * 2 / 360);
- target[0] = GameTurret
- .SnapToEights((float) (self.s.origin[0] + Math
- .cos(angle)
- * self.owner.move_origin[0]));
- target[1] = GameTurret
- .SnapToEights((float) (self.s.origin[1] + Math
- .sin(angle)
- * self.owner.move_origin[0]));
+ target[0] = GameTurret.SnapToEights((float) (self.s.origin[0] +
+ Math.cos(angle) * self.owner.move_origin[0]));
+ target[1] = GameTurret.SnapToEights((float) (self.s.origin[1] +
+ Math.sin(angle) * self.owner.move_origin[0]));
target[2] = self.owner.s.origin[2];
Math3D.VectorSubtract(target, self.owner.s.origin, dir);
@@ -295,10 +291,8 @@ public class GameTurret {
self.owner.velocity[1] = dir[1] * 1.0f / Defines.FRAMETIME;
// z
- angle = self.s.angles[Defines.PITCH]
- * (float) (Math.PI * 2f / 360f);
- target_z = GameTurret
- .SnapToEights((float) (self.s.origin[2]
+ angle = self.s.angles[Defines.PITCH] * (float) (Math.PI * 2f / 360f);
+ target_z = GameTurret.SnapToEights((float) (self.s.origin[2]
+ self.owner.move_origin[0] * Math.tan(angle) + self.owner.move_origin[2]));
diff = target_z - self.owner.s.origin[2];
@@ -360,9 +354,7 @@ public class GameTurret {
self.target_ent.owner = null;
self.target_ent.teammaster.owner = null;
- //TODO: null appended as last missing argument, was unclean. rst
- M_Infantry.infantry_die
- .die(self, inflictor, attacker, damage, null);
+ M_Infantry.infantry_die.die(self, inflictor, attacker, damage, null);
}
};
diff --git a/src/jake2/game/game_import_t.java b/src/jake2/game/game_import_t.java
index 21a0736..2536a57 100644
--- a/src/jake2/game/game_import_t.java
+++ b/src/jake2/game/game_import_t.java
@@ -19,7 +19,7 @@
*/
// Created on 31.10.2003 by RST.
-// $Id: game_import_t.java,v 1.6 2006-01-14 16:06:11 hzi Exp $
+// $Id: game_import_t.java,v 1.7 2006-01-21 21:53:31 salomo Exp $
package jake2.game;
import jake2.Defines;
@@ -65,7 +65,6 @@ public class game_import_t {
// All of the current configstrings are sent to clients when
// they connect, and changes are sent to all connected clients.
public void configstring(int num, String string) {
- //Com.Error(Defines.ERR_FATAL,"method is not implemented!");
SV_GAME.PF_Configstring(num, string);
}
@@ -176,11 +175,12 @@ public class game_import_t {
return Cvar.Get(var_name, value, flags);
}
+ // console variable interaction
public cvar_t cvar_set(String var_name, String value) {
return Cvar.Set(var_name, value);
- //return null;
}
+ // console variable interaction
public cvar_t cvar_forceset(String var_name, String value) {
return Cvar.ForceSet(var_name, value);
}
@@ -190,12 +190,12 @@ public class game_import_t {
return Cmd.Argc();
}
+
public String argv(int n) {
return Cmd.Argv(n);
}
// concatenation of all argv >= 1
-
public String args() {
return Cmd.Args();
}
diff --git a/src/jake2/game/gclient_t.java b/src/jake2/game/gclient_t.java
index 4ce9442..d8481ed 100644
--- a/src/jake2/game/gclient_t.java
+++ b/src/jake2/game/gclient_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: gclient_t.java,v 1.6 2006-01-21 14:00:53 salomo Exp $
+// $Id: gclient_t.java,v 1.7 2006-01-21 21:53:32 salomo Exp $
package jake2.game;
@@ -125,12 +125,9 @@ public class gclient_t
public int index;
-
-
-
+ /** Clears the game client structure. */
public void clear()
{
- player_state_t ps = new player_state_t();
ping =0;
pers = new client_persistant_t();
diff --git a/src/jake2/qcommon/PMove.java b/src/jake2/qcommon/PMove.java
index 4330a23..5274d1c 100644
--- a/src/jake2/qcommon/PMove.java
+++ b/src/jake2/qcommon/PMove.java
@@ -19,12 +19,13 @@
*/
// Created on 25.01.2004 by RST.
-// $Id: PMove.java,v 1.7 2005-12-27 21:02:30 salomo Exp $
+// $Id: PMove.java,v 1.8 2006-01-21 21:53:32 salomo Exp $
package jake2.qcommon;
import jake2.Defines;
import jake2.Globals;
import jake2.game.*;
+import jake2.server.SV;
import jake2.util.Math3D;
public class PMove {
@@ -100,7 +101,7 @@ public class PMove {
}
}
- static float[] planes[] = new float[GameBase.MAX_CLIP_PLANES][3];
+ static float[] planes[] = new float[SV.MAX_CLIP_PLANES][3];
public static void PM_StepSlideMove_() {
int bumpcount, numbumps;
@@ -151,7 +152,7 @@ public class PMove {
time_left -= time_left * trace.fraction;
// slide along this plane
- if (numplanes >= GameBase.MAX_CLIP_PLANES) {
+ if (numplanes >= SV.MAX_CLIP_PLANES) {
// this shouldn't really happen
Math3D.VectorCopy(Globals.vec3_origin, pml.velocity);
break;
diff --git a/src/jake2/server/SV.java b/src/jake2/server/SV.java
index 1273025..5a949d4 100644
--- a/src/jake2/server/SV.java
+++ b/src/jake2/server/SV.java
@@ -2,7 +2,7 @@
* SV.java
* Copyright (C) 2003
*
- * $Id: SV.java,v 1.11 2005-02-20 21:50:37 salomo Exp $
+ * $Id: SV.java,v 1.12 2006-01-21 21:53:32 salomo Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -111,6 +111,15 @@ public final class SV {
if (e2.touch != null && e2.solid != Defines.SOLID_NOT)
e2.touch.touch(e2, e1, GameBase.dummyplane, null);
}
+
+ /**
+ * SV_FlyMove
+ *
+ * The basic solid body movement clip that slides along multiple planes
+ * Returns the clipflags if the velocity was modified (hit something solid)
+ * 1 = floor 2 = wall / step 4 = dead stop
+ */
+ public final static int MAX_CLIP_PLANES = 5;
public static int SV_FlyMove(edict_t ent, float time, int mask) {
edict_t hit;
@@ -118,7 +127,7 @@ public final class SV {
float[] dir = { 0.0f, 0.0f, 0.0f };
float d;
int numplanes;
- float[][] planes = new float[GameBase.MAX_CLIP_PLANES][3];
+ float[][] planes = new float[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 };
@@ -182,7 +191,7 @@ public final class SV {
time_left -= time_left * trace.fraction;
// cliped to another plane
- if (numplanes >= GameBase.MAX_CLIP_PLANES) { // this shouldn't
+ if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't
// really happen
Math3D.VectorCopy(Globals.vec3_origin, ent.velocity);
return 3;
@@ -235,10 +244,8 @@ public final class SV {
return blocked;
}
- /*
- * ============ SV_AddGravity
- *
- * ============
+ /**
+ * SV_AddGravity.
*/
public static void SV_AddGravity(edict_t ent) {
ent.velocity[2] -= ent.gravity * GameBase.sv_gravity.value
@@ -294,11 +301,9 @@ public final class SV {
return trace;
}
- /*
- * ============ SV_Push
- *
+ /**
* Objects need to be moved back on a failed push, otherwise riders would
- * continue to slide. ============
+ * continue to slide.
*/
public static boolean SV_Push(edict_t pusher, float[] move, float[] amove) {
int i, e;
@@ -457,11 +462,9 @@ public final class SV {
return true;
}
- /*
- * ================ SV_Physics_Pusher
+ /**
*
- * Bmodel objects don't interact with each other, but push all box objects
- * ================
+ * Bmodel objects don't interact with each other, but push all box objects.
*/
public static void SV_Physics_Pusher(edict_t ent) {
float[] move = { 0, 0, 0 };
@@ -512,22 +515,17 @@ public final class SV {
}
}
- // ==================================================================
- /*
- * ============= SV_Physics_None
- *
- * Non moving objects can only think =============
+ /**
+ * Non moving objects can only think.
*/
public static void SV_Physics_None(edict_t ent) {
- // regular thinking
+ // regular thinking
SV_RunThink(ent);
}
- /*
- * ============= SV_Physics_Noclip
- *
- * A moving object that doesn't obey physics =============
+ /**
+ * A moving object that doesn't obey physics.
*/
public static void SV_Physics_Noclip(edict_t ent) {
// regular thinking
@@ -542,18 +540,8 @@ public final class SV {
GameBase.gi.linkentity(ent);
}
- /*
- * ==============================================================================
- *
- * TOSS / BOUNCE
- *
- * ==============================================================================
- */
-
- /*
- * ============= SV_Physics_Toss
- *
- * Toss, bounce, and fly movement. When onground, do nothing. =============
+ /**
+ * Toss, bounce, and fly movement. When onground, do nothing.
*/
public static void SV_Physics_Toss(edict_t ent) {
@@ -623,8 +611,8 @@ public final class SV {
}
}
- // if (ent.touch)
- // ent.touch (ent, trace.ent, &trace.plane, trace.surface);
+ // if (ent.touch)
+ // ent.touch (ent, trace.ent, &trace.plane, trace.surface);
}
// check for water transition
@@ -651,26 +639,8 @@ public final class SV {
}
}
- /*
- * ===============================================================================
- *
- * STEPPING MOVEMENT
- *
- * ===============================================================================
- */
- /*
- * ============= SV_Physics_Step
- *
- * Monsters freefall when they don't have a ground entity, otherwise all
- * movement is done with discrete steps.
- *
- * This is also used for objects that have become still on the ground, but
- * will fall if the floor is pulled out from under them. FIXME: is this
- * true? =============
- */
-
- // FIXME: hacked in for E3 demo
+ // FIXME: hacked in for E3 demo
public static void SV_AddRotationalFriction(edict_t ent) {
int n;
float adjustment;
@@ -691,6 +661,15 @@ public final class SV {
}
}
}
+
+ /**
+ * Monsters freefall when they don't have a ground entity, otherwise all
+ * movement is done with discrete steps.
+ *
+ * This is also used for objects that have become still on the ground, but
+ * will fall if the floor is pulled out from under them. FIXME: is this
+ * true?
+ */
public static void SV_Physics_Step(edict_t ent) {
boolean wasonground;
@@ -798,25 +777,23 @@ public final class SV {
if (ent.groundentity != null)
if (!wasonground)
if (hitsound)
- GameBase.gi.sound(ent, 0, GameBase.gi
- .soundindex("world/land.wav"), 1, 1, 0);
+ GameBase.gi.sound(ent, 0,
+ GameBase.gi.soundindex("world/land.wav"), 1, 1, 0);
}
// regular thinking
SV_RunThink(ent);
}
- /*
- * ============= SV_movestep
- *
+ /**
* Called by monster program code. The move will be adjusted for slopes and
* stairs, but if the move isn't possible, no move is done, false is
* returned, and pr_global_struct.trace_normal is set to the normal of the
- * blocking wall =============
+ * blocking wall.
*/
- // FIXME since we need to test end position contents here, can we avoid
- // doing
- // it again later in catagorize position?
+
+ // 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) {
float dz;
float[] oldorg = { 0, 0, 0 };
@@ -868,8 +845,7 @@ public final class SV {
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);
+ contents = GameBase.gi.pointcontents.pointcontents(test);
if ((contents & Defines.MASK_WATER) != 0)
return false;
}
@@ -881,8 +857,7 @@ public final class SV {
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);
+ contents = GameBase.gi.pointcontents.pointcontents(test);
if ((contents & Defines.MASK_WATER) == 0)
return false;
}
@@ -985,13 +960,9 @@ public final class SV {
return true;
}
- /*
- * ====================== SV_StepDirection
- *
+ /**
* Turns to the movement direction, and walks the current distance if facing
* it.
- *
- * ======================
*/
public static boolean SV_StepDirection(edict_t ent, float yaw, float dist) {
float[] move = { 0, 0, 0 };
@@ -1022,10 +993,9 @@ public final class SV {
return false;
}
- /*
- * ====================== SV_FixCheckBottom
+ /**
+ * SV_FixCheckBottom
*
- * ======================
*/
public static void SV_FixCheckBottom(edict_t ent) {
ent.flags |= Defines.FL_PARTIALGROUND;
@@ -1051,16 +1021,16 @@ public final class SV {
else if (deltax < -10)
d[1] = 180;
else
- d[1] = GameBase.DI_NODIR;
+ d[1] = DI_NODIR;
if (deltay < -10)
d[2] = 270;
else if (deltay > 10)
d[2] = 90;
else
- d[2] = GameBase.DI_NODIR;
+ d[2] = DI_NODIR;
// try direct route
- if (d[1] != GameBase.DI_NODIR && d[2] != GameBase.DI_NODIR) {
+ if (d[1] != DI_NODIR && d[2] != DI_NODIR) {
if (d[1] == 0)
tdir = d[2] == 90 ? 45 : 315;
else
@@ -1077,17 +1047,17 @@ public final class SV {
d[2] = tdir;
}
- if (d[1] != GameBase.DI_NODIR && d[1] != turnaround
+ if (d[1] != DI_NODIR && d[1] != turnaround
&& SV_StepDirection(actor, d[1], dist))
return;
- if (d[2] != GameBase.DI_NODIR && d[2] != turnaround
+ if (d[2] != 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
+ if (olddir != DI_NODIR
&& SV_StepDirection(actor, olddir, dist))
return;
@@ -1101,24 +1071,23 @@ public final class SV {
return;
}
- if (turnaround != GameBase.DI_NODIR
+ if (turnaround != DI_NODIR
&& SV_StepDirection(actor, turnaround, dist))
return;
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 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);
}
- /*
- * ====================== SV_CloseEnough
- *
- * ======================
- *///ok
+ /**
+ * SV_CloseEnough - returns true if distance between 2 ents is smaller than
+ * given dist.
+ */
public static boolean SV_CloseEnough(edict_t ent, edict_t goal, float dist) {
int i;
@@ -1130,4 +1099,6 @@ public final class SV {
}
return true;
}
+
+ public static int DI_NODIR = -1;
} \ No newline at end of file
diff --git a/src/jake2/server/SV_GAME.java b/src/jake2/server/SV_GAME.java
index b930136..b295462 100644
--- a/src/jake2/server/SV_GAME.java
+++ b/src/jake2/server/SV_GAME.java
@@ -19,7 +19,7 @@
*/
// Created on 14.01.2004 by RST.
-// $Id: SV_GAME.java,v 1.9 2006-01-20 22:44:07 salomo Exp $
+// $Id: SV_GAME.java,v 1.10 2006-01-21 21:53:32 salomo Exp $
package jake2.server;
import jake2.Defines;
@@ -67,6 +67,14 @@ public class SV_GAME {
Com.Printf(fmt);
}
+
+ /**
+ * Centerprintf for critical messages.
+ */
+ public static void PF_cprintfhigh(edict_t ent, String fmt) {
+ PF_cprintf(ent, Defines.PRINT_HIGH, fmt);
+ }
+
/**
* PF_cprintf
*