diff options
author | Rene Stoeckel <[email protected]> | 2004-09-22 19:22:16 +0000 |
---|---|---|
committer | Rene Stoeckel <[email protected]> | 2004-09-22 19:22:16 +0000 |
commit | c4fcffe436fbfb5b0f3b7be2e5ee103ec74932f7 (patch) | |
tree | 7c9439ab1d9f5a4fd61bd57c755069007b23e0b6 /src/jake2/client/CL_inv.java | |
parent | bcb4ac6eefb425d5b0a90009da506361d5739e75 (diff) |
major refactoring in game, server and client package
Diffstat (limited to 'src/jake2/client/CL_inv.java')
-rw-r--r-- | src/jake2/client/CL_inv.java | 93 |
1 files changed, 43 insertions, 50 deletions
diff --git a/src/jake2/client/CL_inv.java b/src/jake2/client/CL_inv.java index ba219c7..ee7764a 100644 --- a/src/jake2/client/CL_inv.java +++ b/src/jake2/client/CL_inv.java @@ -2,32 +2,33 @@ * CL_fx.java * Copyright (C) 2004 * - * $Id: CL_inv.java,v 1.1 2004-07-07 19:58:37 hzi Exp $ + * $Id: CL_inv.java,v 1.2 2004-09-22 19:22:08 salomo Exp $ */ /* -Copyright (C) 1997-2001 Id Software, Inc. + Copyright (C) 1997-2001 Id Software, Inc. -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -See the GNU General Public License for more details. + See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + */ // Created on 31.01.2004 by RST. - package jake2.client; +import jake2.Defines; +import jake2.Globals; import jake2.qcommon.Com; import jake2.qcommon.MSG; import jake2.util.Vargs; @@ -35,28 +36,24 @@ import jake2.util.Vargs; /** * CL_inv */ -public class CL_inv extends CL_newfx { +public class CL_inv { /* - ================ - CL_ParseInventory - ================ - */ + * ================ CL_ParseInventory ================ + */ static void ParseInventory() { int i; - for (i = 0; i < MAX_ITEMS; i++) - cl.inventory[i] = MSG.ReadShort(net_message); + for (i = 0; i < Defines.MAX_ITEMS; i++) + Globals.cl.inventory[i] = MSG.ReadShort(Globals.net_message); } /* - ================ - Inv_DrawString - ================ - */ + * ================ Inv_DrawString ================ + */ static void Inv_DrawString(int x, int y, String string) { for (int i = 0; i < string.length(); i++) { - re.DrawChar(x, y, string.charAt(i)); + Globals.re.DrawChar(x, y, string.charAt(i)); x += 8; } } @@ -70,16 +67,14 @@ public class CL_inv extends CL_newfx { } /* - ================ - CL_DrawInventory - ================ - */ + * ================ CL_DrawInventory ================ + */ static final int DISPLAY_ITEMS = 17; static void DrawInventory() { int i, j; int num, selected_num, item; - int[] index = new int[MAX_ITEMS]; + int[] index = new int[Defines.MAX_ITEMS]; String string; int x, y; String binding; @@ -87,14 +82,14 @@ public class CL_inv extends CL_newfx { int selected; int top; - selected = cl.frame.playerstate.stats[STAT_SELECTED_ITEM]; + selected = Globals.cl.frame.playerstate.stats[Defines.STAT_SELECTED_ITEM]; num = 0; selected_num = 0; - for (i = 0; i < MAX_ITEMS; i++) { + for (i = 0; i < Defines.MAX_ITEMS; i++) { if (i == selected) selected_num = num; - if (cl.inventory[i] != 0) { + if (Globals.cl.inventory[i] != 0) { index[num] = i; num++; } @@ -107,13 +102,13 @@ public class CL_inv extends CL_newfx { if (top < 0) top = 0; - x = (viddef.width - 256) / 2; - y = (viddef.height - 240) / 2; + x = (Globals.viddef.width - 256) / 2; + y = (Globals.viddef.height - 240) / 2; // repaint everything next frame SCR.DirtyScreen(); - re.DrawPic(x, y + 8, "inventory"); + Globals.re.DrawPic(x, y + 8, "inventory"); y += 24; x += 24; @@ -123,30 +118,28 @@ public class CL_inv extends CL_newfx { for (i = top; i < num && i < top + DISPLAY_ITEMS; i++) { item = index[i]; // search for a binding - //Com_sprintf (binding, sizeof(binding), "use %s", cl.configstrings[CS_ITEMS+item]); - binding = "use " + cl.configstrings[CS_ITEMS + item]; + //Com_sprintf (binding, sizeof(binding), "use %s", + // cl.configstrings[CS_ITEMS+item]); + binding = "use " + Globals.cl.configstrings[Defines.CS_ITEMS + item]; bind = ""; for (j = 0; j < 256; j++) - if (keybindings[j] != null && keybindings[j].equals(binding)) { + if (Globals.keybindings[j] != null && Globals.keybindings[j].equals(binding)) { bind = Key.KeynumToString(j); break; } - string = - Com.sprintf( - "%6s %3i %s", - new Vargs(3).add(bind).add(cl.inventory[item]).add(cl.configstrings[CS_ITEMS + item])); + string = Com.sprintf("%6s %3i %s", new Vargs(3).add(bind).add(Globals.cl.inventory[item]).add( + Globals.cl.configstrings[Defines.CS_ITEMS + item])); if (item != selected) SetStringHighBit(string); else // draw a blinky cursor by the selected item - { - if (((int) (cls.realtime * 10) & 1) != 0) - re.DrawChar(x - 8, y, 15); + { + if (((int) (Globals.cls.realtime * 10) & 1) != 0) + Globals.re.DrawChar(x - 8, y, 15); } Inv_DrawString(x, y, string); y += 8; } } - -} +}
\ No newline at end of file |