diff options
author | Rene Stoeckel <[email protected]> | 2006-01-21 21:53:32 +0000 |
---|---|---|
committer | Rene Stoeckel <[email protected]> | 2006-01-21 21:53:32 +0000 |
commit | b1687ff6524d137d98d8b980bc3f145d33dd9210 (patch) | |
tree | 5a83d18cce4ec8548235779cf9b1fdb2f15d38aa /src/jake2/game | |
parent | 9fe15bb8be084d5e580555877638d320482a3cfb (diff) |
comment beautification
Diffstat (limited to 'src/jake2/game')
-rw-r--r-- | src/jake2/game/Cmd.java | 327 | ||||
-rw-r--r-- | src/jake2/game/GameBase.java | 106 | ||||
-rw-r--r-- | src/jake2/game/GameChase.java | 3 | ||||
-rw-r--r-- | src/jake2/game/GameCombat.java | 26 | ||||
-rw-r--r-- | src/jake2/game/GameFunc.java | 38 | ||||
-rw-r--r-- | src/jake2/game/GameItemList.java | 8 | ||||
-rw-r--r-- | src/jake2/game/GameItems.java | 14 | ||||
-rw-r--r-- | src/jake2/game/GameMisc.java | 15 | ||||
-rw-r--r-- | src/jake2/game/GameSVCmds.java | 45 | ||||
-rw-r--r-- | src/jake2/game/GameSave.java | 26 | ||||
-rw-r--r-- | src/jake2/game/GameSpawn.java | 81 | ||||
-rw-r--r-- | src/jake2/game/GameTarget.java | 67 | ||||
-rw-r--r-- | src/jake2/game/GameTrigger.java | 22 | ||||
-rw-r--r-- | src/jake2/game/GameTurret.java | 28 | ||||
-rw-r--r-- | src/jake2/game/game_import_t.java | 8 | ||||
-rw-r--r-- | src/jake2/game/gclient_t.java | 7 |
16 files changed, 281 insertions, 540 deletions
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(); |