From: Holger Z. <hz...@us...> - 2004-08-19 20:56:51
|
Update of /cvsroot/jake2/jake2/src/jake2/game In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21198/src/jake2/game Modified Files: Cmd.java Log Message: command line completion remove references to GameBase.gi from Cmd Index: Cmd.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/game/Cmd.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Cmd.java 23 Jul 2004 10:07:14 -0000 1.4 --- Cmd.java 19 Aug 2004 20:56:41 -0000 1.5 *************** *** 29,35 **** --- 29,37 ---- import jake2.Globals; import jake2.qcommon.*; + import jake2.server.SV_GAME; import jake2.util.Lib; import java.util.Arrays; + import java.util.Vector; /** *************** *** 505,513 **** if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } ! name= GameBase.gi.args(); if (0 == Lib.Q_stricmp(name, "all")) --- 507,515 ---- 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"); return; } ! name= Cmd.Args(); if (0 == Lib.Q_stricmp(name, "all")) *************** *** 516,523 **** give_all= false; ! if (give_all || 0 == Lib.Q_stricmp(GameBase.gi.argv(1), "health")) { ! if (GameBase.gi.argc() == 3) ! ent.health= Lib.atoi(GameBase.gi.argv(2)); else ent.health= ent.max_health; --- 518,525 ---- give_all= false; ! if (give_all || 0 == Lib.Q_stricmp(Cmd.Argv(1), "health")) { ! if (Cmd.Argc() == 3) ! ent.health= Lib.atoi(Cmd.Argv(2)); else ent.health= ent.max_health; *************** *** 605,613 **** if (it == null) { ! name= GameBase.gi.argv(1); it= GameUtil.FindItem(name); if (it == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item\n"); return; } --- 607,615 ---- if (it == null) { ! name= Cmd.Argv(1); it= GameUtil.FindItem(name); if (it == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item\n"); return; } *************** *** 616,620 **** if (it.pickup == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "non-pickup item\n"); return; } --- 618,622 ---- if (it.pickup == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "non-pickup item\n"); return; } *************** *** 624,629 **** if ((it.flags & Defines.IT_AMMO) != 0) { ! if (GameBase.gi.argc() == 3) ! ent.client.pers.inventory[index]= Lib.atoi(GameBase.gi.argv(2)); else ent.client.pers.inventory[index] += it.quantity; --- 626,631 ---- if ((it.flags & Defines.IT_AMMO) != 0) { ! if (Cmd.Argc() == 3) ! ent.client.pers.inventory[index]= Lib.atoi(Cmd.Argv(2)); else ent.client.pers.inventory[index] += it.quantity; *************** *** 655,659 **** if (GameBase.deathmatch.value == 0 && GameBase.sv_cheats.value == 0) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } --- 657,661 ---- 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"); return; } *************** *** 665,669 **** msg= "godmode ON\n"; ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg); } --- 667,671 ---- msg= "godmode ON\n"; ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg); } *************** *** 683,687 **** if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } --- 685,689 ---- 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"); return; } *************** *** 693,697 **** msg= "notarget ON\n"; ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg); } --- 695,699 ---- msg= "notarget ON\n"; ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg); } *************** *** 709,713 **** if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n"); return; } --- 711,715 ---- 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"); return; } *************** *** 724,728 **** } ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, msg); } --- 726,730 ---- } ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg); } *************** *** 740,753 **** String s; ! s= GameBase.gi.args(); it= GameUtil.FindItem(s); if (it == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n"); return; } if (it.use == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; } --- 742,755 ---- String s; ! s= Cmd.Args(); it= GameUtil.FindItem(s); if (it == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n"); return; } if (it.use == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; } *************** *** 755,759 **** if (0 == ent.client.pers.inventory[index]) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n"); return; } --- 757,761 ---- if (0 == ent.client.pers.inventory[index]) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n"); return; } *************** *** 775,788 **** String s; ! s= GameBase.gi.args(); it= GameUtil.FindItem(s); if (it == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n"); return; } if (it.drop == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n"); return; } --- 777,790 ---- String s; ! s= Cmd.Args(); it= GameUtil.FindItem(s); if (it == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "unknown item: " + s + "\n"); return; } if (it.drop == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n"); return; } *************** *** 790,794 **** if (0 == ent.client.pers.inventory[index]) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n"); return; } --- 792,796 ---- if (0 == ent.client.pers.inventory[index]) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Out of item: " + s + "\n"); return; } *************** *** 841,845 **** if (ent.client.pers.selected_item == -1) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No item to use.\n"); return; } --- 843,847 ---- if (ent.client.pers.selected_item == -1) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "No item to use.\n"); return; } *************** *** 848,852 **** if (it.use == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; } --- 850,854 ---- if (it.use == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not usable.\n"); return; } *************** *** 971,975 **** if (ent.client.pers.selected_item == -1) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "No item to drop.\n"); return; } --- 973,977 ---- if (ent.client.pers.selected_item == -1) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "No item to drop.\n"); return; } *************** *** 978,982 **** if (it.drop == null) { ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n"); return; } --- 980,984 ---- if (it.drop == null) { ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n"); return; } *************** *** 1118,1122 **** } ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "" + large + "\n" + count + " players\n"); } --- 1120,1124 ---- } ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "" + large + "\n" + count + " players\n"); } *************** *** 1130,1134 **** int i; ! i= Lib.atoi(GameBase.gi.argv(1)); // can't wave when ducked --- 1132,1136 ---- int i; ! i= Lib.atoi(Cmd.Argv(1)); // can't wave when ducked *************** *** 1144,1163 **** { case 0 : ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "flipoff\n"); ent.s.frame= M_Player.FRAME_flip01 - 1; ent.client.anim_end= M_Player.FRAME_flip12; break; case 1 : ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "salute\n"); ent.s.frame= M_Player.FRAME_salute01 - 1; ent.client.anim_end= M_Player.FRAME_salute11; break; case 2 : ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "taunt\n"); ent.s.frame= M_Player.FRAME_taunt01 - 1; ent.client.anim_end= M_Player.FRAME_taunt17; break; case 3 : ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "wave\n"); ent.s.frame= M_Player.FRAME_wave01 - 1; ent.client.anim_end= M_Player.FRAME_wave11; --- 1146,1165 ---- { case 0 : ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "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"); 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"); 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"); ent.s.frame= M_Player.FRAME_wave01 - 1; ent.client.anim_end= M_Player.FRAME_wave11; *************** *** 1165,1169 **** case 4 : default : ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "point\n"); ent.s.frame= M_Player.FRAME_point01 - 1; ent.client.anim_end= M_Player.FRAME_point12; --- 1167,1171 ---- case 4 : default : ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "point\n"); ent.s.frame= M_Player.FRAME_point01 - 1; ent.client.anim_end= M_Player.FRAME_point12; *************** *** 1185,1189 **** gclient_t cl; ! if (gi.argc() < 2 && !arg0) return; --- 1187,1191 ---- gclient_t cl; ! if (Cmd.Argc() < 2 && !arg0) return; *************** *** 1198,1211 **** if (arg0) { ! text += gi.argv(0); text += " "; ! text += gi.args(); } else { ! if (gi.args().startsWith("\"")) ! text += gi.args().substring(1, gi.args().length() - 1); else ! text += gi.args(); /* p = gi.args(); --- 1200,1213 ---- if (arg0) { ! text += Cmd.Argv(0); text += " "; ! text += Cmd.Args(); } else { ! if (Cmd.Args().startsWith("\"")) ! text += Cmd.Args().substring(1, Cmd.Args().length() - 1); else ! text += Cmd.Args(); /* p = gi.args(); *************** *** 1233,1237 **** if (level.time < cl.flood_locktill) { ! gi.cprintf(ent, PRINT_HIGH, "You can't talk for " + (int) (cl.flood_locktill - level.time) + " more seconds\n"); return; } --- 1235,1239 ---- if (level.time < cl.flood_locktill) { ! SV_GAME.PF_cprintf(ent, PRINT_HIGH, "You can't talk for " + (int) (cl.flood_locktill - level.time) + " more seconds\n"); return; } *************** *** 1243,1247 **** { cl.flood_locktill= level.time + flood_waitdelay.value; ! gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for " + (int) flood_waitdelay.value + " seconds.\n"); return; } --- 1245,1249 ---- { cl.flood_locktill= level.time + flood_waitdelay.value; ! SV_GAME.PF_cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for " + (int) flood_waitdelay.value + " seconds.\n"); return; } *************** *** 1252,1256 **** if (dedicated.value != 0) ! gi.cprintf(null, PRINT_CHAT, "" + text + ""); for (j= 1; j <= game.maxclients; j++) --- 1254,1258 ---- if (dedicated.value != 0) ! SV_GAME.PF_cprintf(null, PRINT_CHAT, "" + text + ""); for (j= 1; j <= game.maxclients; j++) *************** *** 1266,1270 **** continue; } ! gi.cprintf(other, PRINT_CHAT, "" + text + ""); } --- 1268,1272 ---- continue; } ! SV_GAME.PF_cprintf(other, PRINT_CHAT, "" + text + ""); } *************** *** 1309,1318 **** { text += "And more...\n"; ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, "" + text + ""); return; } text += st; } ! GameBase.gi.cprintf(ent, Defines.PRINT_HIGH, text); } --- 1311,1320 ---- { text += "And more...\n"; ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "" + text + ""); return; } text += st; } ! SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, text); } *************** *** 1346,1350 **** SZ.Print(Globals.cls.netchan.message, Cmd.Args()); } ! }; } --- 1348,1372 ---- SZ.Print(Globals.cls.netchan.message, Cmd.Args()); } ! } ! ! /* ! ============ ! Cmd_CompleteCommand ! ============ ! */ ! public static Vector CompleteCommand(String partial) ! { ! Vector cmds = new Vector(); ! ! // check for match ! for (cmd_function_t cmd = cmd_functions; cmd != null ; cmd = cmd.next) ! if (cmd.name.startsWith(partial)) ! cmds.add(cmd.name); ! for (cmdalias_t a = cmd_alias; a != null; a=a.next) ! if (a.name.startsWith(partial)) ! cmds.add(a.name); ! ! return cmds; ! } } |