jcrossclient-cvs Mailing List for JCrossClient (Page 2)
Status: Alpha
Brought to you by:
cavesomething
You can subscribe to this list here.
2006 |
Jan
(23) |
Feb
(4) |
Mar
(4) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25625 Modified Files: CFclient.java Changelog PlayerStats.java Settings.java Spell.java Added Files: SettingsWin.java Skill.java Log Message: replace settings pane with settings tab, misc cleanups Index: Spell.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Spell.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Spell.java 10 Jan 2006 03:51:31 -0000 1.2 --- Spell.java 24 Jan 2006 18:56:31 -0000 1.3 *************** *** 19,41 **** - - - /* This class is used by CFObjectStore, and ALSO by any class - * using CFObjectStore. - * - * with the new protocol, it can represent a collection of 1 to 'N' of the - * same type of object. - */ - import java.lang.String; public class Spell { int tag, level, time, mana, grace, damage, path, face; ! skill skill_used; String name, message; PlayerStats stats; public Spell (int stag, int slevel, int stime, int smana, int sgrace, int sdamage, ! int spath, int sface, skill sskill, String sname, String smessage, PlayerStats sstats) { message = smessage; name = sname; --- 19,32 ---- import java.lang.String; public class Spell { int tag, level, time, mana, grace, damage, path, face; ! Skill skill; String name, message; PlayerStats stats; public Spell (int stag, int slevel, int stime, int smana, int sgrace, int sdamage, ! int spath, int sface, Skill sskill, String sname, String smessage, PlayerStats sstats) { message = smessage; name = sname; *************** *** 47,51 **** damage = sdamage; level = slevel; ! skill_used = sskill; path = spath; stats = sstats; --- 38,42 ---- damage = sdamage; level = slevel; ! skill = sskill; path = spath; stats = sstats; *************** *** 54,58 **** public String print() { StringBuffer retval = new StringBuffer(); ! retval.append(name + "\nA level " + level + " " + stats.skill_name(skill_used) +" spell"); if (path > 0) retval.append(" with path " + stats.get_path_name(path)); retval.append(" \nCosts "); --- 45,49 ---- public String print() { StringBuffer retval = new StringBuffer(); ! retval.append(name + "\nA level " + level + " " + skill.getName() +" spell"); if (path > 0) retval.append(" with path " + stats.get_path_name(path)); retval.append(" \nCosts "); Index: Settings.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Settings.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Settings.java 12 Jan 2006 02:03:20 -0000 1.3 --- Settings.java 24 Jan 2006 18:56:31 -0000 1.4 *************** *** 308,313 **** def.put("FireKey","Shift"); ! def.put("polldelay.map", "30"); // default to 30 ms between updates ! def.put("polldelay.server", "30"); } --- 308,313 ---- def.put("FireKey","Shift"); ! def.put("polldelay.map", "10"); /* we'll set these to default to 10ms, that should be enough */ ! def.put("polldelay.server", "10"); } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Changelog 23 Jan 2006 19:36:08 -0000 1.27 --- Changelog 24 Jan 2006 18:56:31 -0000 1.28 *************** *** 192,194 **** --- 192,215 ---- - adjust about text to meet TabPanel's credit requirements + 24/01/2006 - CFclient - remove ListSpells menu option + - remove Keyboard menu option + - remove server and map delay menu options + - add SettingsWin to tabbed panel + - remove settings menu + - Move 'save settings' option to file menu + - Change version string to 1.0-alpha-3CVS + + PlayerStats - rename class skill to Skills, make public and move into a seperate file. + - remove skill_name() function + - remove listspells() function + + Settings - reduce the default map and server delay by one-third + + Spell - remove irrelevant comment. + - use skill.getName() instead of stats.skill_name() + + SettingsWin - New file + + Skill - New file, split from PlayerStats + - added getName() function. --- NEW FILE: Skill.java --- /* * Copyright (c) 1997, Phil Brown, ph...@bo... * Copyright (c) 2005, Brendan Lally, bre...@gm... * * This file is part of jcrossclient. * * Jcrossclient 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. * * Jcrossclient 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. * * You should have received a copy of the GNU General Public License along with * Jcrossclient; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /* this class tracks skills, it is used by PlayerStats, SkillWin and Spell */ public class Skill { String name; int level; long exp; public Skill(String skillname) { name = skillname; level = 0; exp = 0; } void set_exp(long newexp) { exp = newexp; } void set_level(int newlevel) { level = newlevel; } String get_string() { return(name + " " + exp + " (" + level + ")"); } String getName() { return name; } int should_display() { if (level > 0) return 1; return 0; } } Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CFclient.java 23 Jan 2006 19:36:08 -0000 1.23 --- CFclient.java 24 Jan 2006 18:56:31 -0000 1.24 *************** *** 74,80 **** public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); ! if(cmd.equals("Connect to server") ! ||evt.getSource().equals(servername)) ! { setVisible(false); Parent.initConnection(getServerName()); --- 74,78 ---- public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); ! if(cmd.equals("Connect to server") ||evt.getSource().equals(servername)) { setVisible(false); Parent.initConnection(getServerName()); *************** *** 145,152 **** InvWin invwin; SpellWin spellwin; MapWin mapwin; ExamineWin examinewin; TalkWin talkwin; - // MiscWin miscwin; StatbarWin miscwin; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; --- 143,150 ---- InvWin invwin; SpellWin spellwin; + SettingsWin settingswin; MapWin mapwin; ExamineWin examinewin; TalkWin talkwin; StatbarWin miscwin; public ScrollPane iscrollp, escrollp, sscrollp, spscrollp; *************** *** 486,492 **** return; } - if(cmd.startsWith("List Spells")) { - playerstats.listspells(); - } // show all settings --- 484,487 ---- *************** *** 497,508 **** return; } - // keyboard prefs - if(cmd.startsWith("Keyb")) { - Popwin popup = new Popwin(params, "Key", this, null, - "keyboard.help"); - popup.pack(); - popup.setVisible(true); - return; - } if(cmd.startsWith("Save")) { if(cmd.indexOf("character") != -1) { --- 492,495 ---- *************** *** 536,555 **** } - if(cmd.startsWith("Mapms.")) { - String numstring=cmd.substring(6); - int ms=Integer.parseInt(numstring); - mapwin.changeUpdateDelay(ms); - params.setLegalValue("polldelay.map",numstring); - return; - } - if(cmd.startsWith("Serverms.")) { - String numstring=cmd.substring(9); - int ms=Integer.parseInt(numstring); - print("Setting server delay to "+ms+" ms."); - loopcheck.setSleepDelay(ms); - params.setLegalValue("polldelay.server", numstring); - return; - } - if(cmd.equals("Debug on")) { debugflag=true; --- 523,526 ---- *************** *** 1370,1381 **** void addWindows(Container parent) { ! statwin = new StatWin(playerstats); ! skillwin = new SkillWin(this); ! invwin = new InvWin(this, allobjects.getPlayerInv()); ! spellwin = new SpellWin(this, playerstats); ! mapwin = new MapWin(this); ! examinewin = new ExamineWin(this, allobjects.getObjsOnFloor()); ! talkwin = new TalkWin(this); ! miscwin = new StatbarWin(this); TabPanel leftside = new TabPanel(); --- 1341,1353 ---- void addWindows(Container parent) { ! statwin = new StatWin(playerstats); ! skillwin = new SkillWin(this); ! invwin = new InvWin(this, allobjects.getPlayerInv()); ! spellwin = new SpellWin(this, playerstats); ! settingswin = new SettingsWin(this); ! mapwin = new MapWin(this); ! examinewin = new ExamineWin(this, allobjects.getObjsOnFloor()); ! talkwin = new TalkWin(this); ! miscwin = new StatbarWin(this); TabPanel leftside = new TabPanel(); *************** *** 1419,1422 **** --- 1391,1395 ---- leftside.add("skills", sscrollp); leftside.add("spells", spscrollp); + leftside.add("settings", settingswin); topside.add (mapwin); topside.add (miscwin); *************** *** 1439,1482 **** void initMenus() { MenuBar mb = new MenuBar(); ! Menu file, edit, help, dmenu; file = new Menu("File"); dmenu = new Menu("Debug"); - edit = new Menu("Settings"); help = new Menu("Help"); //file.add(newMenuItem("Connect...")); // call server?? file.add(newMenuItem("Save character on *server*")); file.add(new MenuItem("-")); file.add(newMenuItem("Disconnect")); file.add(newMenuItem("Quit")); - edit.add(newMenuItem("Keybindings")); - - Menu maptweak=new Menu("Map delay (ms)"); - Menu servertweak=new Menu("Server delay (ms)"); - for(int m=5;m<40;m+=5) { - String userlabel=Integer.toString(m); - - MenuItem mi = new MenuItem(userlabel); - MenuItem mi2 = new MenuItem(userlabel); - mi.setActionCommand("Mapms."+userlabel); - mi2.setActionCommand("Serverms."+userlabel); - - mi.addActionListener(this); - mi2.addActionListener(this); - maptweak.add(mi); - servertweak.add(mi2); - } - edit.add(maptweak); - edit.add(servertweak); - edit.add(new MenuItem("-")); - edit.add(newMenuItem("Save ALL Settings to file")); - dmenu.add(newMenuItem("Show All Settings")); dmenu.add(newMenuItem("Debug on")); dmenu.add(newMenuItem("Local refresh")); dmenu.add(newMenuItem("Full redraw")); - dmenu.add(newMenuItem("List Spells")); help.add(newMenuItem("Help on jcrossclient")); --- 1412,1432 ---- void initMenus() { MenuBar mb = new MenuBar(); ! Menu file, help, dmenu; file = new Menu("File"); dmenu = new Menu("Debug"); help = new Menu("Help"); //file.add(newMenuItem("Connect...")); // call server?? file.add(newMenuItem("Save character on *server*")); + file.add(newMenuItem("Save ALL Settings to file")); file.add(new MenuItem("-")); file.add(newMenuItem("Disconnect")); file.add(newMenuItem("Quit")); dmenu.add(newMenuItem("Show All Settings")); dmenu.add(newMenuItem("Debug on")); dmenu.add(newMenuItem("Local refresh")); dmenu.add(newMenuItem("Full redraw")); help.add(newMenuItem("Help on jcrossclient")); *************** *** 1485,1489 **** mb.add(file); - mb.add(edit); mb.add(dmenu); mb.add(help); --- 1435,1438 ---- *************** *** 1585,1589 **** try { String inmsg; ! mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3"); /* make the server use the new map style commands */ mConnection.writeBytes("setup map1cmd 1 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); --- 1534,1538 ---- try { String inmsg; ! mConnection.writeBytes("version "+protocol_version + " 1027 JCrossclient 1.0 alpha-3CVS"); /* make the server use the new map style commands */ mConnection.writeBytes("setup map1cmd 1 exp64 1 spellmon 1 newmapcmd 1 mapsize " + mapwin.XMAX + "x" + mapwin.YMAX); Index: PlayerStats.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/PlayerStats.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PlayerStats.java 23 Jan 2006 19:36:08 -0000 1.5 --- PlayerStats.java 24 Jan 2006 18:56:31 -0000 1.6 *************** *** 1,3 **** ! /* * Copyright (c) 1997, Phil Brown, ph...@bo... * Copyright (c) 2005, Brendan Lally, bre...@gm... --- 1,3 ---- ! /* * Copyright (c) 1997, Phil Brown, ph...@bo... * Copyright (c) 2005, Brendan Lally, bre...@gm... *************** *** 69,99 **** } - class skill { - String name; - int level; - long exp; - - public skill(String skillname) { - name = skillname; - level = 0; - exp = 0; - } - - void set_exp(long newexp) { - exp = newexp; - } - void set_level(int newlevel) { - level = newlevel; - } - String get_string() { - return(name + " " + exp + " (" + level + ")"); - } - int should_display() { - if (level > 0) return 1; - return 0; - } - } - - public class PlayerStats { CFclient Parent; --- 69,72 ---- *************** *** 182,186 **** static public void addSkill(int skillnumber, String skillname) { if (skillnumber < minskillnum) minskillnum = skillnumber; ! Skills.put(new Integer(skillnumber), new skill(skillname)); } --- 155,159 ---- static public void addSkill(int skillnumber, String skillname) { if (skillnumber < minskillnum) minskillnum = skillnumber; ! Skills.put(new Integer(skillnumber), new Skill(skillname)); } *************** *** 192,197 **** } - public String skill_name(skill sk) { return sk.name;} - /* returns the count of the number of skills that are going to need displaying */ public int number_of_skills() { --- 165,168 ---- *************** *** 199,203 **** /* note that this makes the implicit assumption that the skill numbers are sequential */ for (int i = minskillnum; i<minskillnum+Skills.size();i++) ! skillcount += ((skill)Skills.get(new Integer(i))).should_display(); return skillcount; } --- 170,174 ---- /* note that this makes the implicit assumption that the skill numbers are sequential */ for (int i = minskillnum; i<minskillnum+Skills.size();i++) ! skillcount += ((Skill)Skills.get(new Integer(i))).should_display(); return skillcount; } *************** *** 207,212 **** int i; for (i = minskillnum; count < n; i++) ! count += ((skill)Skills.get(new Integer(i))).should_display(); ! return ((skill)Skills.get(new Integer(i-1))).name; } public String get_nth_data(int n) { --- 178,183 ---- int i; for (i = minskillnum; count < n; i++) ! count += ((Skill)Skills.get(new Integer(i))).should_display(); ! return ((Skill)Skills.get(new Integer(i-1))).name; } public String get_nth_data(int n) { *************** *** 214,219 **** int i; for (i = minskillnum; count < n; i++) ! count += ((skill)Skills.get(new Integer(i))).should_display(); ! return ((skill)Skills.get(new Integer(i-1))).get_string(); } --- 185,190 ---- int i; for (i = minskillnum; count < n; i++) ! count += ((Skill)Skills.get(new Integer(i))).should_display(); ! return ((Skill)Skills.get(new Integer(i-1))).get_string(); } *************** *** 281,288 **** scan += (mlen + 2); ! skill skill_used = (skill)Skills.get(new Integer(skillnum)); Spell new_spell = new Spell(tag, level, cast_time, mana, grace, damage, path, ! face, skill_used, name, message, this); spells.add(new_spell); --- 252,259 ---- scan += (mlen + 2); ! Skill skill = (Skill)Skills.get(new Integer(skillnum)); Spell new_spell = new Spell(tag, level, cast_time, mana, grace, damage, path, ! face, skill, name, message, this); spells.add(new_spell); *************** *** 302,316 **** } - public void listspells() { - int i; - Spell tmp; - Parent.talkwin.addDisplayLine("Known Spells\n"); - for (i = 0; i<spells.size();i++) { - tmp = (Spell)spells.get(i); - Parent.talkwin.addDisplayLine(tmp.get_tag() + "\n"); - Parent.talkwin.addDisplayLine(tmp.print() + "\n"); - } - } - public void removespell(DataInputStream spelldata) throws IOException { int i; --- 273,276 ---- *************** *** 469,473 **** scan +=3; } else { ! skill currentskill = (skill)Skills.get(new Integer(stattype)); if (currentskill != null) { skills_updated = true; --- 429,433 ---- scan +=3; } else { ! Skill currentskill = (Skill)Skills.get(new Integer(stattype)); if (currentskill != null) { skills_updated = true; --- NEW FILE: SettingsWin.java --- /* Copyright (c) 2005, Brendan Lally, bre...@gm... * * This file is part of jcrossclient. * * Jcrossclient 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. * * Jcrossclient 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. * * You should have received a copy of the GNU General Public License along with * Jcrossclient; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ import java.awt.*; import java.awt.event.*; class SettingsWin extends Panel implements ItemListener { CFclient Parent; Panel server_panel; Panel map_panel; Choice server_delay; Choice map_delay; static public void errmsg(String str) { System.out.println("ERROR:"+str); } public SettingsWin(CFclient parent) { super(); Parent = parent; /* set up the server delay */ server_delay = new Choice(); server_delay.add("5"); server_delay.add("10"); server_delay.add("15"); server_delay.add("20"); server_delay.add("25"); server_delay.add("30"); server_delay.add("35"); server_delay.add("40"); server_delay.addItemListener(this); server_delay.select(Parent.params.get("polldelay.server")); server_panel = new Panel(); server_panel.add(new Label("Server Delay(ms)")); server_panel.add(server_delay); add(server_panel); map_delay = new Choice(); map_delay.add("5"); map_delay.add("10"); map_delay.add("15"); map_delay.add("20"); map_delay.add("25"); map_delay.add("30"); map_delay.add("35"); map_delay.add("40"); map_delay.addItemListener(this); map_delay.select(Parent.params.get("polldelay.map")); map_panel = new Panel(); map_panel.add(new Label("Map Delay(ms)")); map_panel.add(map_delay); add(map_panel); } public void itemStateChanged(ItemEvent evt) { if (evt.getSource().equals(map_delay)) { Parent.mapwin.changeUpdateDelay(Integer.parseInt(map_delay.getSelectedItem())); Parent.params.setLegalValue("polldelay.map", map_delay.getSelectedItem()); } else if (evt.getSource().equals(server_delay)) { Parent.loopcheck.setSleepDelay(Integer.parseInt(map_delay.getSelectedItem())); Parent.params.setLegalValue("polldelay.map", map_delay.getSelectedItem()); } Parent.focusGained(null); /* hack to give back focus to mapwindow */ } } |
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23728 Modified Files: CFclient.java Changelog PlayerStats.java README SkillWin.java StatWin.java Added Files: TabPanel.java Log Message: tabify jcrossclient, some other minor cleanups Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Changelog 15 Jan 2006 00:16:18 -0000 1.26 --- Changelog 23 Jan 2006 19:36:08 -0000 1.27 *************** *** 174,175 **** --- 174,194 ---- ExamineWin - 'Pickup Some' command, showing a slider to choose how many items to drop. + + MapWin - Fix indentation + + 23/01/2006 - StatWin - Display resistances, increase spacing. + + SkillWin - Show in one column + + README - update for new layout + + PlayerStats - resistances_display() for use with extended stats window. + - Fix resistance formatting + + TabPanel - include from http://math.nist.gov/~BMiller/java/test/TabTest.html + + CFClient - use a tabpanel, to incorporate most existing panels. + - remove defunct 'Window Settings' and 'Logon Prefs' menu items + - adjust about text to meet TabPanel's credit requirements + + Index: SkillWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/SkillWin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SkillWin.java 3 Dec 2005 22:37:21 -0000 1.1 --- SkillWin.java 23 Jan 2006 19:36:08 -0000 1.2 *************** *** 29,33 **** public SkillWin(CFclient parent) { ! super(new GridLayout(0,2)); Parent = parent; playerstats = parent.playerstats; --- 29,33 ---- public SkillWin(CFclient parent) { ! super(new GridLayout(0,1)); Parent = parent; playerstats = parent.playerstats; Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CFclient.java 15 Jan 2006 00:16:18 -0000 1.22 --- CFclient.java 23 Jan 2006 19:36:08 -0000 1.23 *************** *** 414,425 **** ta.append("and now maintained by Brendan Lally (bre...@gm...)\n"); ta.append(" Copyright (C) 1997-2000 Philip Brown\n"); - ta.append(" Copyright (C) 2005 Brendan Lally\n"); ta.append("with portions contributed by Brian Thomas\n"); ta.append("and Isak Styf\n\n"); ta.append("If you have suggestions, bug reports, or questions\n"); ! ta.append("please email them to bre...@gm..., or create a tracker item \n"); ! ta.append("on the jcrossclient sourceforce project. \n"); Popwin popup = new Popwin(ta.toString(), false); - // Aboutjc popup = new Aboutjc(); popup.pack(); popup.setVisible(true); --- 414,429 ---- ta.append("and now maintained by Brendan Lally (bre...@gm...)\n"); ta.append(" Copyright (C) 1997-2000 Philip Brown\n"); ta.append("with portions contributed by Brian Thomas\n"); ta.append("and Isak Styf\n\n"); + ta.append(" Copyright (C) 2005 Brendan Lally\n"); + ta.append("with portions contributed by James Jackson\n"); + ta.append("Additionally, this program utilises the sixlegs java PNG library,\n"); + ta.append("and TabPanel, by Bruce R. Miller & NIST\n\n"); + ta.append("If you have suggestions, bug reports, or questions\n"); ! ta.append("please email them to jcr...@li...\n"); ! ta.append("or create a tracker item on the jcrossclient sourceforce project. \n"); ! Popwin popup = new Popwin(ta.toString(), false); popup.pack(); popup.setVisible(true); *************** *** 453,457 **** } Popwin popup = new Popwin(ta.toString(), false); - // Aboutjc popup = new Aboutjc(); popup.pack(); popup.setVisible(true); --- 457,460 ---- *************** *** 494,520 **** return; } - // window prefs - if (cmd.startsWith("Wind")) { - // Its pretty difficult to arrange the resetting - // of the window color, fonts while running. - // but we're trying. This will call us back, at - // PopupCallback(), with the param we specify - Popwin popup = new Popwin(params, "font TalkWin InvWin ExamineWin StatWin StatbarWin", - this, "Colors", - "winpref.help"); - popup.pack(); - popup.setVisible(true); - return; - } - // logon prefs (default server, etc) - if(cmd.startsWith("Logo")) { - Popwin popup = new Popwin(params, - "server name password", - this, null, "logon.help" - ); - popup.pack(); - popup.setVisible(true); - return; - } // keyboard prefs if(cmd.startsWith("Keyb")) { --- 497,500 ---- *************** *** 917,926 **** debug("DELETING ALL INVENTORY of object "+tag); ! if(tag==0) ! { allobjects.deleteAllOnFloor(); } ! else ! { allobjects.deleteCarriedBy(tag); } --- 897,904 ---- debug("DELETING ALL INVENTORY of object "+tag); ! if(tag==0) { allobjects.deleteAllOnFloor(); } ! else { allobjects.deleteCarriedBy(tag); } *************** *** 1111,1116 **** // sigh void REALLYYIELD() { ! try ! { Thread.yield(); Thread.sleep(1); --- 1089,1093 ---- // sigh void REALLYYIELD() { ! try { Thread.yield(); Thread.sleep(1); *************** *** 1402,1408 **** miscwin = new StatbarWin(this); ! Panel leftside = new VertPanel(); Panel topside = new VertPanel(); Panel rightside = new VertPanel(); iscrollp= new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); --- 1379,1387 ---- miscwin = new StatbarWin(this); ! TabPanel leftside = new TabPanel(); Panel topside = new VertPanel(); Panel rightside = new VertPanel(); + + Panel items = new VertPanel(); iscrollp= new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); *************** *** 1434,1445 **** sscrollp.add(skillwin); ! leftside.add(iscrollp); ! leftside.add(escrollp); ! topside.add (statwin); ! // topside.add (mapwin); ! topside.add (sscrollp); topside.add (mapwin); topside.add (miscwin); - rightside.add(spscrollp); rightside.add(talkwin); placeWindow(parent, leftside, 0, 0, 1, 3); --- 1413,1424 ---- sscrollp.add(skillwin); ! items.add(iscrollp); ! items.add(escrollp); ! leftside.add("items", items); ! leftside.add("stats", statwin); ! leftside.add("skills", sscrollp); ! leftside.add("spells", spscrollp); topside.add (mapwin); topside.add (miscwin); rightside.add(talkwin); placeWindow(parent, leftside, 0, 0, 1, 3); *************** *** 1473,1478 **** file.add(newMenuItem("Quit")); - edit.add(newMenuItem("Window Settings")); - edit.add(newMenuItem("Logon Prefs")); edit.add(newMenuItem("Keybindings")); --- 1452,1455 ---- Index: README =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/README,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README 5 Dec 2005 00:49:29 -0000 1.3 --- README 23 Jan 2006 19:36:08 -0000 1.4 *************** *** 83,96 **** Once it is done, then you can start playing. ! Your Inventory will be shown in the top left. ! In the window below that are any items on the ground. left click to examine and right click to interact with any of these items. ! In the top centre are a series of stats about your character, below that a panel ! with your skills in. You can ready a skill for use by clicking on it. ! The map view is below that, and your status bars are at the very bottom. You move around by using the number pad. holding down shift while pressing a --- 83,102 ---- Once it is done, then you can start playing. ! In the centre of the screen is the map view, this shows the squares around ! you, below this are your status bars. ! On the left of the screen is a tabbed pane, which shows items, stats, skills ! and spells + The item tab shows your inventory, and items on the ground. left click to examine and right click to interact with any of these items. ! The stats tab shows a series of stats about your character, ! The skills tab shows a panel with your skills in. ! You can ready a skill for use by clicking on it. ! ! The spells tab shows a list of spells, left click to examine these spells, right ! click to show a menu to let you utilise these spells. You move around by using the number pad. holding down shift while pressing a Index: PlayerStats.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/PlayerStats.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PlayerStats.java 10 Jan 2006 03:51:31 -0000 1.4 --- PlayerStats.java 23 Jan 2006 19:36:08 -0000 1.5 *************** *** 41,48 **** } String get_string() { String retstring; if (percentage == 0) return ""; ! retstring = type + " " + (percentage > 0 ?"+":"-") + percentage + "%"; return retstring; --- 41,52 ---- } + boolean should_display() { + return (percentage !=0 ?true:false); + } + String get_string() { String retstring; if (percentage == 0) return ""; ! retstring = type + " " + (percentage > 0 ?"+":"") + percentage + "%"; return retstring; *************** *** 166,169 **** --- 170,183 ---- } + public String resistances_display() { + int i; + StringBuffer buf = new StringBuffer(); + for (i=0; i< RESIST_TYPES; i++) { + if (resistances[i].should_display()) + buf.append(resistances[i].get_string() + "\n"); + } + return buf.toString(); + } + static public void addSkill(int skillnumber, String skillname) { if (skillnumber < minskillnum) minskillnum = skillnumber; --- NEW FILE: TabPanel.java --- /***************************************************************************** gui.TabPanel Container for a set of Tab Cards or Tab Folders. bru...@ni... Contribution of the National Institute of Standards and Technology, not subject to copyright. *****************************************************************************/ import java.applet.*; import java.awt.*; import java.util.*; /** ************************************************************************** TabPanel is a container for a set of tabbed cards, lying atop each other, but with the labelled tabs exposed at the top. That is, the classic Tab Folder. Each card is an awt.component of whatever design you wish. The topmost card can be selected programmatically (Using first(), last(), next(), previous(), or show(name)), or by clicking on the tab with the mouse. <P> Components should be added using add(name,component)); the name is used to label the tab. If you set the layout manager, it should be a subclass of CardLayout. You probably want to setBackground() to a color contrasting that of the parent and the components. <P> Whenever a card is selected (whether by software or mouse), an event with id = Event.WINDOW_EXPOSE is sent to the selected component. Handling this event may be useful for deferred initialization. @author Bruce R. Miller (bru...@ni...) @author Contribution of the National Institute of Standards and Technology, @author not subject to copyright. */ public class TabPanel extends Panel { /** The width of the margins around the cards. */ public int margin = 3; // width of margins around cards Font tabFont; // for tab labels FontMetrics metric; int nCards = 0; // total # of cards Vector names = new Vector(10,10); // contains the (interned) card names int pos[], width[]; // position & width of each tab int selected = 0; // index of selected (displayed) card int offset = 0; // left shift to allow for `too many' tabs int tabH; // height of tab (set from tabFont) int tabN = 12, // #points along edges: must = (2*int + 2) tabLeft[][] = new int[2][tabN], // coordinates of tab edge curves tabRight[][] = new int[2][tabN]; Image offscreen=null; /** Creates an empty TabPanel. */ public TabPanel() { setLayout(new CardLayout()); setTabFont(new Font("Helvetica",Font.BOLD,12)); } /*************************************************** internals */ int findComponent(Component c) { // find index of a given component for (int i=0; i<nCards; i++) if (getComponent(i) == c) return i; return -1; } /*************************************************** Adding & Removing components */ /** Add a card, component, to the TabPanel with a given name. */ public Component add(String name, Component component) { name = name.intern(); super.add(name,component); // Let layout manager do its job if (!names.contains(name)) { // if name isn't already present names.addElement(name); // but record our part nCards++; if (isShowing()) { // already showing? better rebuild! computeTabs(); repaint(); }} return component; } /** remove the card, component, from the TabPanel. */ public void remove(Component component) { int i = findComponent(component); super.remove(component); // Let layout manager do its job names.removeElementAt(i); // but we'll record our part. nCards--; if (i < selected) { setSelected(selected-1,true); } else if ((i == selected) && (nCards > 0)) { // was selected, select another setSelected(selected % nCards,true); } if (isShowing()) { // already showing? better rebuild! computeTabs(); repaint(); } } /** remove the card having the given name from the TabPanel. */ public void remove(String name) { int i = names.indexOf(name.intern()); if (i != -1) remove(getComponent(i)); } /** remove all cards from the TabPanel. */ public void removeAll() { super.removeAll(); names.removeAllElements(); repaint(); } /*************************************************** Component Selection */ void setSelected(int i, boolean force) { if (force || ((i != selected) && (i >= 0) && (i < nCards))) { if (nCards > 0) { selected = i % nCards;} ((CardLayout) getLayout()).show(this, (String) names.elementAt(i)); repaint(); Component c = getComponent(i); c.postEvent(new Event(c,Event.WINDOW_EXPOSE,this)); }} /** Select the first card in the Panel. */ public void first() { setSelected(0,false); } /** Select the last card in the Panel. */ public void last() { setSelected(nCards-1,false); } /** Select the next card in the Panel. */ public void next() { setSelected((selected+1) % nCards,false);} /** Select the previous card in the Panel. */ public void previous() { setSelected((selected-1+nCards) % nCards,false); } /** Select the named card in the Panel. */ public void show(String name) { setSelected(names.indexOf(name.intern()),false); } /** Select the card component in the Panel. */ public void show(Component component) { setSelected(findComponent(component),false); } int cardAt(int x, int y) { if (y <= tabH) { // inside tab section? x += offset; for(int i = 0; i < nCards; i++) if ((pos[i]<=x) && (x<pos[i+1])) return i; } return -1; } /** Return a mouse documentation string for selecting this card. * (ie. the applet status line (if there is an applet), for when * the mouse is over the tab). * This may be overridden by a subclass, if desired. The default * is to use the "Select tab card " + name. */ public String documentCard(String name) { return "Select tab card " + name; } Applet applet = null; /** Handle mouse clicks and documentation line for Tab selection. */ public boolean handleEvent(Event e) { if (e.id == Event.MOUSE_DOWN) { int i = cardAt(e.x,e.y); if (i != -1) { setSelected(i,false); return true; }} else if (e.id == Event.MOUSE_MOVE) { if (applet == null) { Component c = getParent(); while (c != null) { if (c instanceof Applet) applet = (Applet) c; c = c.getParent(); }} if (applet != null) { int i=cardAt(e.x,e.y); if (i != -1) applet.showStatus(documentCard((String) names.elementAt(i))); }} else if (e.id == Event.MOUSE_EXIT) { if (applet != null) applet.showStatus(""); } return super.handleEvent(e); } /*************************************************** Methods involving size and layout */ /** Allocates extra margins to give the cards some `body'. */ public Insets insets() { return new Insets(tabH+margin,margin,margin,margin); } /** Specify the Font to be used for labeling the Tabs. * This avoids getting in the way of cards inheriting default fonts from * the TabPanel's container. */ public void setTabFont(Font font) { tabFont = font; metric = getFontMetrics(font); int r = (metric.getHeight()+1)/2; tabH = 2*r; // Compute boundaries for the tab edges. int c,s,nn = (tabN-2)/2; double a; for(int i=0; i<=nn; i++) { a = Math.PI*i/2/nn; c = (int)(r*Math.cos(a)); s = (int)(r*Math.sin(a)); tabLeft[0][i] = s; tabLeft[1][i] = r + c; tabLeft[0][i+nn]= tabH -c; tabLeft[1][i+nn]= r - s; } tabLeft[0][2*nn+1] = tabH; tabLeft[1][2*nn+1] = tabH; for(int i=0; i< tabN; i++) { tabRight[0][i] = -tabLeft[0][i]; tabRight[1][i] = tabLeft[1][i]; } } void computeTabs() { // Compute positions of the tabs. if ((pos == null) || (pos.length <= nCards)) { width = new int[nCards+1]; pos = new int[nCards+1]; } // make sure pos & width are big enough. int x = tabH/2; for(int i=0; i<nCards; i++) { // size the tabs & reshape the panes. pos[i] = x; width[i] = tabH + metric.stringWidth((String) names.elementAt(i)); x += width[i]; } pos[nCards] = x; int w = size().width; if ((offscreen==null) || (offscreen.getHeight(this)<tabH) || (offscreen.getWidth(this)<w)){ offscreen=createImage(w,tabH); } } /** Computes tab geometry while laying out the panels components.*/ public void layout() { super.layout(); computeTabs(); } // make sure tabs are computed. /*************************************************** Painting the tabs */ void paintTabEdge(Graphics g, int x, int edges[][]) { g.translate(x,0); g.setColor(getBackground()); g.fillPolygon(edges[0],edges[1],tabN); g.setColor(getForeground()); for(int i=0; i<tabN-2;i++) g.drawLine(edges[0][i],edges[1][i],edges[0][i+1],edges[1][i+1]); g.translate(-x,0); } void paintTab(Graphics g, int x, int p) { int r = tabH/2, w = width[p]; paintTabEdge(g,x-r,tabLeft); paintTabEdge(g,x+w+r,tabRight); // for some reason, this draws in the wrong place on window `repair'!!! // g.clearRect(x+r,0,w-tabH,tabH); g.setColor(getBackground()); g.fillRect(x+r,0,w-tabH,tabH); g.setColor(getForeground()); g.drawLine(x+r,0,x+w-r,0); g.setFont(tabFont); g.drawString((String) names.elementAt(p),x+r,tabH-metric.getDescent());} /** Update (repaint) the TabPanel. Since paint handles the background, * we just call paint directly. */ public void update(Graphics g){ paint(g); } /** Paint the tabs in a row atop the cards. */ public void paint(Graphics gg) { Dimension sz = size(); Graphics g = offscreen.getGraphics(); int x,w = sz.width-1, h = sz.height-1, r = tabH/2; int j, s = selected; // These come into play when the tabs span more than the panel width. // Show some `shadow' tabs at the ends to represent those not displayed. int shadow = 4; // how wide of a shadow (pixels) to show int nShadows = 3; // max # of shadow tabs to show. Color backback= getParent().getBackground(); // Fill in tab area in the PARENT's color g.setColor(getParent().getBackground()); g.fillRect(0,0,w+1,tabH); g.setColor(getForeground()); if (nCards == 0) g.drawLine(0,tabH,w,tabH); else { // Possibly adjust the offset, so at least the selected tab is visible int offmax = pos[s] - r - Math.min(nShadows,s)*shadow, offmin = pos[s+1] - w + r + Math.min(nCards-s,nShadows)*shadow; if ((offset < offmin) || (offset > offmax)) offset = Math.min(Math.max(0,(offmin+offmax)/2),pos[nCards]+r-w); // Draw first tabs from the left (offscreen ones only partly visible) for(j = 0, x = offset+r;(j < s) && (pos[j] <= x); j++); // find visible if (j > 0) { x = 0; for(int i=Math.max(0,j-nShadows); i<j-1; i++, x+=shadow) paintTabEdge(g,x,tabLeft); paintTab(g,x+r,j-1); } for(int i = j; i < s; i++) { paintTab(g,pos[i]-offset,i); } // Draw last tabs from the right (offscreen ones only partly visible) for(j = nCards-1, x = offset+w-r; (j > s) && (pos[j+1] >= x); j--); if (j < nCards-1) { x = w; for(int i=Math.min(nCards-1,j+nShadows); i>j+1; i--, x-=shadow) paintTabEdge(g,x,tabRight); paintTab(g,x-r-width[j+1],j+1); } for(int i = j; i > s; i--) { paintTab(g,pos[i]-offset,i); } // now draw the selected tab on top of the others. g.clearRect(pos[s]-r-offset+2,tabH-1,width[s]+tabH-1,1); paintTab(g,pos[s]-offset,s); // and fixup the baseline so the selected is on `top'. g.drawLine(0,tabH-1,pos[s]-r-offset+1,tabH-1); g.drawLine(pos[s+1]+r-offset-1,tabH-1,w,tabH-1); } gg.drawImage(offscreen,0,0,this); gg.drawLine(w,tabH,w,h); gg.drawLine(w,h,0,h); gg.drawLine(0,h,0,tabH); } } Index: StatWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/StatWin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatWin.java 9 Jan 2006 18:59:28 -0000 1.2 --- StatWin.java 23 Jan 2006 19:36:08 -0000 1.3 *************** *** 24,54 **** PlayerStats playerstats; ! static public void errmsg(String str) ! { System.out.println("ERROR:"+str); } ! // update stats display. That's US! :-) ! // print out all the stats we know on the player ! public void updateStats() ! { StringBuffer newtext = new StringBuffer(); newtext.append(playerstats.playerTitle+"\n"); ! newtext.append("Score: "+playerstats.exp+" Level: "+playerstats.level+"\n"); newtext.append("Hp: "+playerstats.hp+" Mana: "+playerstats.mana+" Grace:"+playerstats.gr+"\n"); ! newtext.append("S"+playerstats.Str+" D"+playerstats.Dex+" Co"+playerstats.Con+" I"+playerstats.Int); ! newtext.append(" W"+playerstats.Wis+" P"+playerstats.Pow+" Ch"+playerstats.Char+"\n"); newtext.append(playerstats.rangeattack+"\n"); newtext.append("Wc: "+playerstats.Wc+" Dam: "+playerstats.Dam+" Ac: "+playerstats.Ac+" Arm: "+playerstats.Arm+"\n"); newtext.append("Speed: "+playerstats.speed+" ("+playerstats.weapspeed+") Food: "+playerstats.food+"\n"); - // newtext.append(statline+"\n"); newtext.append("\n"); ! setText(newtext.toString()); } ! public StatWin(PlayerStats pl) ! { // evil, evil! But no other way. sigh. super("", 0, 0, SCROLLBARS_NONE); --- 24,55 ---- PlayerStats playerstats; ! static public void errmsg(String str) { System.out.println("ERROR:"+str); } ! /* redraw the stats box */ ! public void updateStats() { StringBuffer newtext = new StringBuffer(); newtext.append(playerstats.playerTitle+"\n"); ! newtext.append("Exp: "+playerstats.exp+" Level: "+playerstats.level+"\n"); newtext.append("Hp: "+playerstats.hp+" Mana: "+playerstats.mana+" Grace:"+playerstats.gr+"\n"); ! newtext.append("Str: "+playerstats.Str + "\n"); ! newtext.append("Dex: "+playerstats.Dex+ "\n"); ! newtext.append("Con: "+playerstats.Con+ "\n"); ! newtext.append("Int: "+playerstats.Int+ "\n"); ! newtext.append("Wis: "+playerstats.Wis+ "\n"); ! newtext.append("Pow: "+playerstats.Pow+ "\n"); ! newtext.append("Cha: "+playerstats.Char+"\n"); newtext.append(playerstats.rangeattack+"\n"); newtext.append("Wc: "+playerstats.Wc+" Dam: "+playerstats.Dam+" Ac: "+playerstats.Ac+" Arm: "+playerstats.Arm+"\n"); newtext.append("Speed: "+playerstats.speed+" ("+playerstats.weapspeed+") Food: "+playerstats.food+"\n"); newtext.append("\n"); ! newtext.append("Resistances: \n"); ! newtext.append(playerstats.resistances_display()); setText(newtext.toString()); } ! public StatWin(PlayerStats pl) { // evil, evil! But no other way. sigh. super("", 0, 0, SCROLLBARS_NONE); |
From: <jcr...@li...> - 2006-01-15 00:30:17
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12133 Modified Files: MapWin.java Log Message: fix indentation Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MapWin.java 13 Jan 2006 01:56:19 -0000 1.5 --- MapWin.java 15 Jan 2006 00:30:08 -0000 1.6 *************** *** 474,882 **** } ! /* Check for cells containing layers bigger than 1x1. For each such cell ! Check if it overlaps any current dirty rectangles. If it does, add its ! extent to the dirty rectangles list. ! */ ! private synchronized void checkBigCells() { ! for (int y = 0; y < BUFFERY; y++) { ! for (int x = 0; x < BUFFERX; x++) { ! if (Cells[x][y].isBig()) { ! Iterator ri = dirtyRectangles.listIterator(); ! boolean intersected = false; ! while(ri.hasNext() && (!intersected) ) { ! Rectangle currentDirty = (Rectangle) ri.next(); ! Rectangle current = clippedRectangle(x, y, Cells[x][y].biggestX() + x - 1, ! Cells[x][y].biggestY() + y - 1); ! if (current.intersects(currentDirty) ) { ! addDirtyRectangle(current); ! intersected = true; ! } ! } ! } ! } ! } ! } ! /* ! This routine renders ONLY map squares that have changed, to ! our back buffer. It also clears the dirty rectangles list when it is ! finished. It returns true if we actually painted anything, ! false if nothing changed ! */ ! synchronized boolean updateMap() { ! if (fullmap == null) { ! debug("Calling initBackBuffer in updateMap()"); ! initBackBuffer(); ! } ! boolean changed = false; ! checkBigCells(); ! Iterator di = dirtyRectangles.listIterator(); ! while (di.hasNext()) { ! changed = true; ! drawRectangle((Rectangle) di.next()); ! } ! dirtyRectangles.clear(); ! return changed; ! } ! // mark all cells with this face as "dirty", so on the ! // next updateMap(), they get redrawn ! /* ! called by MapScrollCmd, in CFclient ! scroll the map! ! if x_change >0, means move pixmaps this way <<== ! etc, etc ! What we will do is copy the facenumbers across, from one cell to the ! one that it should be, then we will clear the cell, and mark both dirty ! */ ! public synchronized void mapScroll(int x_change, int y_change) { ! int i; ! int j; ! /* ! this isn't a particularly nice way to do this, but it should ! be quite fast. ! */ ! if (x_change >= 0) { ! if (y_change >= 0) { ! for (i = x_change; i < BUFFERX; i++) { ! for (j = y_change; j < BUFFERY; j++) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } else { ! for (i = x_change; i < BUFFERX; i++) { ! for (j = BUFFERY + y_change - 1; j >= 0; j--) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } ! } else { ! if (y_change >= 0) { ! for (i = BUFFERX + x_change - 1; i >= 0; i--) { ! for (j = y_change; j < BUFFERY; j++) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } else { ! for (i = BUFFERX + x_change - 1; i >= 0; i--) { ! for (j = BUFFERY + y_change - 1; j >= 0; j--) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } ! } ! addDirtyRectangle( new Rectangle(0, 0, BUFFERX - 1, BUFFERY - 1) ); ! } ! /* ! called by "Map1aCmd" in CFclient ! This processes a map update from the server ! This function is a mutation of the original mapRead and the map code ! from the mainstream cf client, and hacked to vaguely compile. Consider ! it a study in how to write C in an inferior language, look at the C ! client's common/commands.c for what this function wants to look like. ! */ ! public synchronized void map1aRead(DataInputStream mapdata) ! throws IOException { ! final int DARKNESS_MASK = 0x8; ! final int COORD_MASK = 0x3f; ! int maplen = mapdata.available(); ! int mask; ! int x; ! int y; ! int layer; ! int faces[] = new int[MapSquare.NUMBER_OF_LAYERS]; ! int pos = 0; ! int x_size; ! int y_size; ! Image next_face; ! // Layers are 0-indexed here and 1-indexed in MapSquare. Fix this? ! final int NUM_LAYERS = MapSquare.NUMBER_OF_LAYERS - 1; ! boolean bottom = false; ! int darkness; ! while (pos < maplen) { ! bottom = true; ! mask = (int) mapdata.readUnsignedShort(); ! pos += 2; ! x = (mask >> 10) & COORD_MASK; ! y = (mask >> 4) & COORD_MASK; ! if ((mask & 0xf)== 0) { ! /* ! by commenting this next line out, we get something ! close to fog of war support ! */ ! // Cells[x][y].clear(); ! continue; ! /* ! if empty mask, none of the checks will be true. ! */ ! } ! if ((mask & DARKNESS_MASK) != 0) { ! /* ! darkness bit ! */ ! darkness = mapdata.readUnsignedByte(); ! pos += 1; ! // System.out.println("darkness value is set, it is " + darkness); ! } ! else { ! darkness = -1; ! } ! /* correct? maybe we ought to leave ! darkness alone ! */ ! /* Reduce redundancy by putting the get image ! and flags in a common block. The layers ! are the inverse of the bit order unfortunately. ! */ ! for (layer = NUM_LAYERS; layer >= 0; layer--) { ! if ((mask & (1 << layer)) != 0) { ! faces[NUM_LAYERS - layer] ! = mapdata.readUnsignedShort(); ! pos += 2; ! } else { ! // set this face < 0, so it will be ignored ! // in the for loop below ! faces[NUM_LAYERS - layer] = -1; ! } ! } ! /* if you value your sanity, just give up on trying ! to follow this ! */ ! for (layer = 0; layer <= NUM_LAYERS; layer++) { ! if (faces[layer] < 0) { ! continue; ! } ! next_face = Parent.getPixmap(faces[layer]); ! /* ! had we an image < 32 pixels, the int ! division would give zero, but we will use ! 1 square at least. ! */ ! int width = next_face.getWidth(null); ! int height = next_face.getHeight(null); ! boolean is_off_map = (x > XMAX + MAX_FACE_SIZE ! || y > YMAX + MAX_FACE_SIZE); ! x_size = (width % pixwidth == 0 ? 0 : 1) ! + width / pixwidth; ! y_size = (height % pixheight == 0 ? 0 : 1) ! + height / pixheight; ! if (x_size > 1 || y_size > 1) { ! ! /* ! the faces are sent to their bottom ! right corner, but we store them in ! the top left corner, so we need to ! figure out what the new cell is ! */ ! int left = x + 1 - x_size + MAX_FACE_SIZE; ! int top = y + 1 - y_size + MAX_FACE_SIZE; ! addDirtyRectangle(clippedRectangle(left, top, ! Math.max(x, left + Cells[left][top].biggestX() - 1), ! Math.max(y, top + Cells[left][top].biggestY() - 1) ) ); ! Cells[left][top].setFace(faces[layer], ! layer + 1, x_size, ! y_size, is_off_map); ! } else if ((x < XMAX) && (y < YMAX)) { ! addDirtyRectangle(clippedRectangle(x + MAX_FACE_SIZE, ! y + MAX_FACE_SIZE, ! x + MAX_FACE_SIZE + Cells[x][y].biggestX() - 1, ! y + MAX_FACE_SIZE + Cells[x][y].biggestY() - 1) ); ! Cells[x + MAX_FACE_SIZE][y + MAX_FACE_SIZE].setFace(faces[layer], layer + 1); ! } ! } ! } ! } ! /* ! It sucks that we have to register for ALL THESE ! just to listen for mouse clicks. Sigh. ! */ ! public void mouseClicked(MouseEvent evt) { ! int dx = (evt.getX() / pixwidth) - XMAX / 2; ! int dy = (evt.getY() / pixheight) - YMAX / 2; ! int buttonmask = evt.getModifiers(); ! if ((buttonmask & InputEvent.BUTTON3_MASK) > 0) {} ! else if ((buttonmask & InputEvent.BUTTON1_MASK) > 0) { ! Parent.lookat(dx, dy); ! } ! } ! public void mouseEntered(MouseEvent evt) {} ! public void mouseExited(MouseEvent evt) {} ! public void mousePressed(MouseEvent evt) {} ! public void mouseReleased(MouseEvent evt) {} ! // given the cell coords, clear the cell on the ! // back-buffer ! public void clearCell(int cellx, int celly) { ! fullmapgc.clearRect((cellx - MAX_FACE_SIZE) * pixwidth, ! (celly - MAX_FACE_SIZE) * pixheight, ! pixwidth, pixheight); ! } ! // given the cell coordinates and a layer number ! // draw a single layer of the cell ! public void paintCellLayer(int cellx, int celly, int layer) { ! MapSquare cell = Cells[cellx][celly]; ! int imgindex = -1; ! Image img; ! imgindex = cell.getFace(layer); ! if (imgindex <= 0) { ! return; ! } ! img = Parent.getPixmap(imgindex); ! if (img == null) { ! debug("We need face " + imgindex); ! // get "?" image ! img = Parent.getPixmap(0); ! // put placeholder, so we dont request it ! // again, then request from server. ! Parent.addPixmap(imgindex, img); ! Parent.askForFace(imgindex); ! } ! fullmapgc.drawImage(img, (cellx - MAX_FACE_SIZE) * pixwidth, ! (celly - MAX_FACE_SIZE) * pixheight, ! this); ! } ! /* ! given the coordinates, paint all the layers of a cell, clearing the ! rectangle first. ! */ ! public void paintCell(int x, int y) { ! clearCell(x, y); ! for (int i = 1; i <= MapSquare.getLayerCount(); i++) { ! paintCellLayer(x, y, i); ! } ! } ! /* ! used when we get a newmap command ! */ ! public void clearmap() { ! for (int y = 0; y < BUFFERY; y++) { ! for (int x = 0; x < BUFFERX; x++) { ! Cells[x][y].clear(); ! } ! } ! addDirtyRectangle(new Rectangle(0, 0, BUFFERX -1 , BUFFERY - 1) ); ! } ! /* mark all the squares containing the given face */ ! public synchronized void dirtyFace(int face) { ! for (int y = 0; y < BUFFERY; y++) { ! for(int x = 0; x < BUFFERX; x++) { ! if (Cells[x][y].containsFace(face) ) { ! addDirtyRectangle(clippedRectangle(x, y, Cells[x][y].biggestX() + x - 1, ! Cells[x][y].biggestY() + y - 1) ); ! } ! } ! } ! } ! // paint the back-buffer to the screen ! public void paint(Graphics gc) { ! //debug("MapWin.paint(gc) called"); ! if (fullmap == null) { ! debug("oops.. fullmap null for paint(), trying init"); ! initBackBuffer(); ! if (fullmap == null) { ! debug("oops.. fullmap STILL null?"); ! return; ! } ! } ! gc.drawImage(fullmap, 0, 0, this); ! } ! /* ! This sets the image for the player. We will automatically ! draw this image at the center of the screen ! */ ! public synchronized void setPlayerImage(int facenum) { ! PlayerImage = Parent.getPixmap(facenum); ! PlayerImageNum = facenum; ! debug(" MapWin set PlayerImageNum to " + facenum); ! if (PlayerImage == null) { ! debug("(But image is null right now)"); ! } else { ! debug(" (Player image NOT null)"); ! addDirtyRectangle(new Rectangle(BUFFERX/2, BUFFERY/2, BUFFERX/2, BUFFERY/2) ); ! } ! } ! // Since paint(gc) draws Every Cell, there is no need for ! // the default update() behaviour of clearing the window first ! public void update(Graphics gc) { ! paint(gc); ! } ! public MapWin(CFclient parent) { ! Parent = parent; ! setSize(pixwidth * XMAX, pixheight * YMAX); ! setBackground(Color.black); ! setForeground(Color.white); ! // These should really be on parent. ! // but again, lets do this for debug now ! addKeyListener(Parent); ! addFocusListener(Parent); ! addMouseListener(this); ! // initBackBuffer(); ! mapthread = new MapUpdater(this, parent); ! mapthread.start(); ! } ! public void askForFocus() { ! debug("MapWin taking Keyboard Focus"); ! requestFocus(); ! } ! } --- 474,875 ---- } ! /* Check for cells containing layers bigger than 1x1. For each such cell ! Check if it overlaps any current dirty rectangles. If it does, add its ! extent to the dirty rectangles list. ! */ ! private synchronized void checkBigCells() { ! for (int y = 0; y < BUFFERY; y++) { ! for (int x = 0; x < BUFFERX; x++) { ! if (Cells[x][y].isBig()) { ! Iterator ri = dirtyRectangles.listIterator(); ! boolean intersected = false; ! while(ri.hasNext() && (!intersected) ) { ! Rectangle currentDirty = (Rectangle) ri.next(); ! Rectangle current = clippedRectangle(x, y, Cells[x][y].biggestX() + x - 1, ! Cells[x][y].biggestY() + y - 1); ! if (current.intersects(currentDirty) ) { ! addDirtyRectangle(current); ! intersected = true; ! } ! } ! } ! } ! } ! } ! /* ! This routine renders ONLY map squares that have changed, to ! our back buffer. It also clears the dirty rectangles list when it is ! finished. It returns true if we actually painted anything, ! false if nothing changed ! */ ! synchronized boolean updateMap() { ! if (fullmap == null) { ! debug("Calling initBackBuffer in updateMap()"); ! initBackBuffer(); ! } ! boolean changed = false; ! checkBigCells(); ! Iterator di = dirtyRectangles.listIterator(); ! while (di.hasNext()) { ! changed = true; ! drawRectangle((Rectangle) di.next()); ! } ! dirtyRectangles.clear(); ! return changed; ! } ! // mark all cells with this face as "dirty", so on the ! // next updateMap(), they get redrawn ! /* ! called by MapScrollCmd, in CFclient ! scroll the map! ! if x_change >0, means move pixmaps this way <<== ! etc, etc ! What we will do is copy the facenumbers across, from one cell to the ! one that it should be, then we will clear the cell, and mark both dirty ! */ ! public synchronized void mapScroll(int x_change, int y_change) { ! int i; ! int j; ! /* ! this isn't a particularly nice way to do this, but it should ! be quite fast. ! */ ! if (x_change >= 0) { ! if (y_change >= 0) { ! for (i = x_change; i < BUFFERX; i++) { ! for (j = y_change; j < BUFFERY; j++) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } else { ! for (i = x_change; i < BUFFERX; i++) { ! for (j = BUFFERY + y_change - 1; j >= 0; j--) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } ! } else { ! if (y_change >= 0) { ! for (i = BUFFERX + x_change - 1; i >= 0; i--) { ! for (j = y_change; j < BUFFERY; j++) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } else { ! for (i = BUFFERX + x_change - 1; i >= 0; i--) { ! for (j = BUFFERY + y_change - 1; j >= 0; j--) { ! Cells[i][j].copyTo(Cells[i - x_change][j - y_change]); ! Cells[i][j].clear(); ! } ! } ! } ! } ! addDirtyRectangle( new Rectangle(0, 0, BUFFERX - 1, BUFFERY - 1) ); ! } ! /* ! called by "Map1aCmd" in CFclient ! This processes a map update from the server ! This function is a mutation of the original mapRead and the map code ! from the mainstream cf client, and hacked to vaguely compile. Consider ! it a study in how to write C in an inferior language, look at the C ! client's common/commands.c for what this function wants to look like. ! */ ! public synchronized void map1aRead(DataInputStream mapdata) throws IOException { ! final int DARKNESS_MASK = 0x8; ! final int COORD_MASK = 0x3f; ! int maplen = mapdata.available(); ! int mask; ! int x; ! int y; ! int layer; ! int faces[] = new int[MapSquare.NUMBER_OF_LAYERS]; ! int pos = 0; ! int x_size; ! int y_size; ! Image next_face; ! // Layers are 0-indexed here and 1-indexed in MapSquare. Fix this? ! final int NUM_LAYERS = MapSquare.NUMBER_OF_LAYERS - 1; ! boolean bottom = false; ! int darkness; ! while (pos < maplen) { ! bottom = true; ! mask = (int) mapdata.readUnsignedShort(); ! pos += 2; ! x = (mask >> 10) & COORD_MASK; ! y = (mask >> 4) & COORD_MASK; ! if ((mask & 0xf)== 0) { ! /* ! by commenting this next line out, we get something ! close to fog of war support ! */ ! // Cells[x][y].clear(); ! continue; ! /* ! if empty mask, none of the checks will be true. ! */ ! } ! if ((mask & DARKNESS_MASK) != 0) { ! /* ! darkness bit ! */ ! darkness = mapdata.readUnsignedByte(); ! pos += 1; ! // System.out.println("darkness value is set, it is " + darkness); ! } ! else { ! darkness = -1; ! } ! /* correct? maybe we ought to leave ! darkness alone ! */ ! /* Reduce redundancy by putting the get image ! and flags in a common block. The layers ! are the inverse of the bit order unfortunately. ! */ ! for (layer = NUM_LAYERS; layer >= 0; layer--) { ! if ((mask & (1 << layer)) != 0) { ! faces[NUM_LAYERS - layer] ! = mapdata.readUnsignedShort(); ! pos += 2; ! } else { ! // set this face < 0, so it will be ignored ! // in the for loop below ! faces[NUM_LAYERS - layer] = -1; ! } ! } ! /* if you value your sanity, just give up on trying ! to follow this ! */ ! for (layer = 0; layer <= NUM_LAYERS; layer++) { ! if (faces[layer] < 0) { ! continue; ! } ! next_face = Parent.getPixmap(faces[layer]); ! /* ! had we an image < 32 pixels, the int ! division would give zero, but we will use ! 1 square at least. ! */ ! int width = next_face.getWidth(null); ! int height = next_face.getHeight(null); ! boolean is_off_map = (x > XMAX + MAX_FACE_SIZE || y > YMAX + MAX_FACE_SIZE); ! x_size = (width % pixwidth == 0 ? 0 : 1) + width / pixwidth; ! y_size = (height % pixheight == 0 ? 0 : 1) + height / pixheight; ! if (x_size > 1 || y_size > 1) { ! ! /* ! the faces are sent to their bottom ! right corner, but we store them in ! the top left corner, so we need to ! figure out what the new cell is ! */ ! int left = x + 1 - x_size + MAX_FACE_SIZE; ! int top = y + 1 - y_size + MAX_FACE_SIZE; ! addDirtyRectangle(clippedRectangle(left, top, ! Math.max(x, left + Cells[left][top].biggestX() - 1), ! Math.max(y, top + Cells[left][top].biggestY() - 1) ) ); ! Cells[left][top].setFace(faces[layer], layer + 1, x_size, ! y_size, is_off_map); ! } else if ((x < XMAX) && (y < YMAX)) { ! addDirtyRectangle(clippedRectangle(x + MAX_FACE_SIZE, ! y + MAX_FACE_SIZE, ! x + MAX_FACE_SIZE + Cells[x][y].biggestX() - 1, ! y + MAX_FACE_SIZE + Cells[x][y].biggestY() - 1) ); ! Cells[x + MAX_FACE_SIZE][y + MAX_FACE_SIZE].setFace(faces[layer], layer + 1); ! } ! } ! } ! } ! /* ! It sucks that we have to register for ALL THESE ! just to listen for mouse clicks. Sigh. ! */ ! public void mouseClicked(MouseEvent evt) { ! int dx = (evt.getX() / pixwidth) - XMAX / 2; ! int dy = (evt.getY() / pixheight) - YMAX / 2; ! int buttonmask = evt.getModifiers(); ! if ((buttonmask & InputEvent.BUTTON3_MASK) > 0) {} ! else if ((buttonmask & InputEvent.BUTTON1_MASK) > 0) { ! Parent.lookat(dx, dy); ! } ! } ! public void mouseEntered(MouseEvent evt) {} ! public void mouseExited(MouseEvent evt) {} ! public void mousePressed(MouseEvent evt) {} ! public void mouseReleased(MouseEvent evt) {} ! // given the cell coords, clear the cell on the ! // back-buffer ! public void clearCell(int cellx, int celly) { ! fullmapgc.clearRect((cellx - MAX_FACE_SIZE) * pixwidth, ! (celly - MAX_FACE_SIZE) * pixheight, pixwidth, pixheight); ! } ! // given the cell coordinates and a layer number ! // draw a single layer of the cell ! public void paintCellLayer(int cellx, int celly, int layer) { ! MapSquare cell = Cells[cellx][celly]; ! int imgindex = -1; ! Image img; ! imgindex = cell.getFace(layer); ! if (imgindex <= 0) { ! return; ! } ! img = Parent.getPixmap(imgindex); ! if (img == null) { ! debug("We need face " + imgindex); ! // get "?" image ! img = Parent.getPixmap(0); ! // put placeholder, so we dont request it ! // again, then request from server. ! Parent.addPixmap(imgindex, img); ! Parent.askForFace(imgindex); ! } ! fullmapgc.drawImage(img, (cellx - MAX_FACE_SIZE) * pixwidth, ! (celly - MAX_FACE_SIZE) * pixheight, this); ! } ! /* ! given the coordinates, paint all the layers of a cell, clearing the ! rectangle first. ! */ ! public void paintCell(int x, int y) { ! clearCell(x, y); ! for (int i = 1; i <= MapSquare.getLayerCount(); i++) { ! paintCellLayer(x, y, i); ! } ! } ! /* ! used when we get a newmap command ! */ ! public void clearmap() { ! for (int y = 0; y < BUFFERY; y++) { ! for (int x = 0; x < BUFFERX; x++) { ! Cells[x][y].clear(); ! } ! } ! addDirtyRectangle(new Rectangle(0, 0, BUFFERX -1 , BUFFERY - 1) ); ! } ! /* mark all the squares containing the given face */ ! public synchronized void dirtyFace(int face) { ! for (int y = 0; y < BUFFERY; y++) { ! for(int x = 0; x < BUFFERX; x++) { ! if (Cells[x][y].containsFace(face) ) { ! addDirtyRectangle(clippedRectangle(x, y, Cells[x][y].biggestX() + x - 1, ! Cells[x][y].biggestY() + y - 1) ); ! } ! } ! } ! } ! // paint the back-buffer to the screen ! public void paint(Graphics gc) { ! //debug("MapWin.paint(gc) called"); ! if (fullmap == null) { ! debug("oops.. fullmap null for paint(), trying init"); ! initBackBuffer(); ! if (fullmap == null) { ! debug("oops.. fullmap STILL null?"); ! return; ! } ! } ! gc.drawImage(fullmap, 0, 0, this); ! } ! /* ! This sets the image for the player. We will automatically ! draw this image at the center of the screen ! */ ! public synchronized void setPlayerImage(int facenum) { ! PlayerImage = Parent.getPixmap(facenum); ! PlayerImageNum = facenum; ! debug(" MapWin set PlayerImageNum to " + facenum); ! if (PlayerImage == null) { ! debug("(But image is null right now)"); ! } else { ! debug(" (Player image NOT null)"); ! addDirtyRectangle(new Rectangle(BUFFERX/2, BUFFERY/2, BUFFERX/2, BUFFERY/2) ); ! } ! } ! // Since paint(gc) draws Every Cell, there is no need for ! // the default update() behaviour of clearing the window first ! public void update(Graphics gc) { ! paint(gc); ! } ! public MapWin(CFclient parent) { ! Parent = parent; ! setSize(pixwidth * XMAX, pixheight * YMAX); ! setBackground(Color.black); ! setForeground(Color.white); ! // These should really be on parent. ! // but again, lets do this for debug now ! addKeyListener(Parent); ! addFocusListener(Parent); ! addMouseListener(this); ! // initBackBuffer(); ! mapthread = new MapUpdater(this, parent); ! mapthread.start(); ! } ! public void askForFocus() { ! debug("MapWin taking Keyboard Focus"); ! requestFocus(); ! } ! } |
From: <jcr...@li...> - 2006-01-15 00:16:30
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8617 Modified Files: CFObject.java CFclient.java Changelog ExamineWin.java InvWin.java Log Message: slider bars for dropping only a limited quantity in a stack Index: CFObject.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFObject.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CFObject.java 12 Jan 2006 02:03:20 -0000 1.5 --- CFObject.java 15 Jan 2006 00:16:18 -0000 1.6 *************** *** 147,150 **** --- 147,153 ---- return Name; } + public String getObjNamePl() { + return Name_pl; + } public boolean onFloor() { Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CFclient.java 13 Jan 2006 04:31:29 -0000 1.21 --- CFclient.java 15 Jan 2006 00:16:18 -0000 1.22 *************** *** 1419,1429 **** --- 1419,1435 ---- iscrollp.add(invwin); invwin.setForeground(Color.black); + /* make the inventory window scroll down by one object each time */ + (iscrollp.getVAdjustable()).setUnitIncrement(10); /* yay for magic numbers! */ escrollp.setSize(290,210); escrollp.add(examinewin); examinewin.setForeground(Color.black); + (escrollp.getVAdjustable()).setUnitIncrement(10); + spscrollp.setSize(290,210); spscrollp.add(spellwin); + (spscrollp.getVAdjustable()).setUnitIncrement(10); + sscrollp.add(skillwin); *************** *** 1814,1827 **** public void dropObj(int tag) { try { ! mConnection.writeBytes("move 0 "+ tag +" 0"); ! //mConnection.writeBytes("move 0 "+Integer.toString(tag)+" 1"); ! //debug("DROPPING only one of object "+tag); ! // we always drop ALL we have of an object. ! //allobjects.delCFObject(tag); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); } } /* these two commands are speshul, they take the item number in binary form, --- 1820,1835 ---- public void dropObj(int tag) { + dropObj(tag, 0); + } + + public void dropObj(int tag, int quantity) { try { ! mConnection.writeBytes("move 0 "+ tag + " " + quantity ); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); } } + + /* these two commands are speshul, they take the item number in binary form, *************** *** 1850,1856 **** public void pickupObj(int tag) { int playertag=allobjects.getPlayerTag(); try { ! mConnection.writeBytes("move "+Integer.toString(playertag)+" "+Integer.toString(tag)+" 0"); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); --- 1858,1868 ---- public void pickupObj(int tag) { + pickupObj(tag, 0); + } + + public void pickupObj(int tag, int quantity) { int playertag=allobjects.getPlayerTag(); try { ! mConnection.writeBytes("move "+Integer.toString(playertag)+" "+Integer.toString(tag)+" " + quantity); } catch (Exception e) { errmsg("oops. error writing to server: "+e.getMessage()); Index: ExamineWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/ExamineWin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExamineWin.java 12 Jan 2006 02:03:20 -0000 1.6 --- ExamineWin.java 15 Jan 2006 00:16:18 -0000 1.7 *************** *** 22,28 **** --- 22,84 ---- import java.awt.event.*; + class Picksome extends Dialog implements ActionListener, AdjustmentListener { + CFclient Parent; + CFObject item; + int tag; + Scrollbar quantity; + Label count; + Panel bottom; + + public void actionPerformed(ActionEvent evt) { + String cmd = evt.getActionCommand(); + if (cmd.equals("Pick Up")) { + setVisible(false); + if (quantity.getValue() > 0) + Parent.pickupObj(item.getTag(), quantity.getValue()); + return; + } + } + + public void adjustmentValueChanged(AdjustmentEvent e) { + /* because there is only one widget registered to this class + * as an adjustment event, we know what to do here + */ + count.setText(Integer.toString(quantity.getValue())); + } + + public Picksome(CFclient parent, CFObject object) { + /* because there are so many widgets here, we create a sub-panel for the bottom two */ + super(parent); // Dialog(Frame) call. + item = object; + Parent = parent; + setTitle(new String("Pick Up Objects")); + bottom = new Panel(new BorderLayout()); + + add(new Label("How many " + object.getObjNamePl() + " do you want to pick up?"), "North"); + quantity = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, item.getNumObjs()+1); + + quantity.addAdjustmentListener(this); + add(quantity); + + count = new Label(Integer.toString(quantity.getValue()), Label.CENTER); + bottom.add(count, "North"); + + Button pickup; + pickup=new Button("Pick Up"); + Panel buttonholder=new Panel(); + buttonholder.setLayout(new FlowLayout()); + pickup.addActionListener(this); + buttonholder.add(pickup); + + bottom.add(buttonholder, "South"); + add(bottom, "South"); + } + } + + class ExamineWin extends Canvas implements MouseListener, ActionListener { CFclient toplevel; // need this for pixmap handling; PopupMenu ritem; + Picksome pickupsome; CFObject last_clicked_object; *************** *** 40,44 **** ritem.add(newMenuItem("Examine")); ritem.add(newMenuItem("Use")); ! ritem.add(newMenuItem("Pick up")); this.add(ritem); } --- 96,101 ---- ritem.add(newMenuItem("Examine")); ritem.add(newMenuItem("Use")); ! ritem.add(newMenuItem("Pick Up")); ! ritem.add(newMenuItem("Pick Up Some")); this.add(ritem); } *************** *** 90,94 **** toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Pick up")) { toplevel.pickupObj(last_clicked_object.getTag()); updateDisplay(); --- 147,151 ---- toplevel.examineObj(last_clicked_object.getTag()); } ! else if (cmd.equals("Pick Up")) { toplevel.pickupObj(last_clicked_object.getTag()); updateDisplay(); *************** *** 97,100 **** --- 154,162 ---- toplevel.applyObj(last_clicked_object.getTag()); } + else if (cmd.equals("Pick Up Some")) { + pickupsome = new Picksome(toplevel, last_clicked_object); + pickupsome.pack(); + pickupsome.setVisible(true); + } } Index: InvWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/InvWin.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** InvWin.java 12 Jan 2006 02:03:20 -0000 1.9 --- InvWin.java 15 Jan 2006 00:16:18 -0000 1.10 *************** *** 24,29 **** import java.awt.event.*; ! class rename_item extends Dialog implements ActionListener ! { TextField newname; CFclient Parent; --- 24,28 ---- import java.awt.event.*; ! class rename_item extends Dialog implements ActionListener { TextField newname; CFclient Parent; *************** *** 55,59 **** Parent = parent; - // I dont believe in model dialogs setTitle(new String("Rename Object")); --- 54,57 ---- *************** *** 81,84 **** --- 79,137 ---- } + class Dropsome extends Dialog implements ActionListener, AdjustmentListener { + CFclient Parent; + CFObject item; + int tag; + Scrollbar quantity; + Label count; + Panel bottom; + + public void actionPerformed(ActionEvent evt) { + String cmd = evt.getActionCommand(); + if (cmd.equals("drop")) { + setVisible(false); + if (quantity.getValue() > 0) + Parent.dropObj(item.getTag(), quantity.getValue()); + return; + } + } + + public void adjustmentValueChanged(AdjustmentEvent e) { + /* because there is only one widget registered to this class + * as an adjustment event, we know what to do here + */ + count.setText(Integer.toString(quantity.getValue())); + } + + public Dropsome(CFclient parent, CFObject object) { + /* because there are so many widgets here, we create a sub-panel for the bottom two */ + super(parent); // Dialog(Frame) call. + item = object; + Parent = parent; + setTitle(new String("Drop Objects")); + bottom = new Panel(new BorderLayout()); + + add(new Label("How many " + object.getObjNamePl() + " do you want to drop?"), "North"); + quantity = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, item.getNumObjs()+1); + + quantity.addAdjustmentListener(this); + add(quantity); + + count = new Label(Integer.toString(quantity.getValue()), Label.CENTER); + bottom.add(count, "North"); + + Button drop; + drop=new Button("drop"); + Panel buttonholder=new Panel(); + buttonholder.setLayout(new FlowLayout()); + drop.addActionListener(this); + buttonholder.add(drop); + + bottom.add(buttonholder, "South"); + add(bottom, "South"); + } + } + + // displays, AND HOLDS actual inventory of player class InvWin extends Canvas implements MouseListener, ActionListener { *************** *** 88,91 **** --- 141,145 ---- CFObject last_clicked_object; rename_item rename_menu; + Dropsome dropsome; Vector PlayerInventory; *************** *** 102,105 **** --- 156,160 ---- ritem.add(newMenuItem("Use")); ritem.add(newMenuItem("Drop")); + ritem.add(newMenuItem("Drop Some")); ritem.add(newMenuItem("Lock")); ritem.add(newMenuItem("Mark")); *************** *** 123,126 **** --- 178,186 ---- toplevel.dropObj(last_clicked_object.getTag()); } + else if (cmd.equals("Drop Some")) { + dropsome=new Dropsome(toplevel, last_clicked_object); + dropsome.pack(); + dropsome.setVisible(true); + } else if (cmd.equals("Use")) { toplevel.applyObj(last_clicked_object.getTag()); Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Changelog 14 Jan 2006 16:41:07 -0000 1.25 --- Changelog 15 Jan 2006 00:16:18 -0000 1.26 *************** *** 165,166 **** --- 165,175 ---- INSTALL - update compile instructions to reflect this + + 15/01/2006 - CFObject - getObjNamePl to get the plural name of the object. + + CFClient - Make the inventory, examine and spell scrollbars scroll quicker + - new drop and pickup wrappers to cope with arbitrary numbers of items. + + InvWin - 'Drop Some' command, showing a slider to choose how many items to drop. + + ExamineWin - 'Pickup Some' command, showing a slider to choose how many items to drop. |
From: <jcr...@li...> - 2006-01-14 16:54:08
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9304 Removed Files: javapng-2.0-rc3-src.jar Log Message: removed javapng jar file, it is now redundant --- javapng-2.0-rc3-src.jar DELETED --- |
Update of /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8041 Removed Files: BasicPixelProcessor.class Chunk_IEND.class Chunk_IHDR.class Chunk_PLTE.class Chunk_bKGD.class Chunk_cHRM.class Chunk_gAMA.class Chunk_hIST.class Chunk_iCCP.class Chunk_pHYs.class Chunk_sBIT.class Chunk_sPLT.class Chunk_sRGB.class Chunk_tIME.class Chunk_tRNS.class Defilterer.class GammaPixelProcessor.class ImageDataInputStream.class ImageFactory.class Integers.class PixelProcessor.class PngChunk.class PngConfig.class PngConstants.class PngError.class PngException.class PngImage.class PngInputStream.class PngUtils.class PngWarning.class ProgressUpdater.class ProgressivePixelProcessor.class StateMachine.class SuggestedPalette.class TextChunk.class TextChunkReader.class TransGammaPixelProcessor.class Log Message: oops, accidentally commited the class files too --- PngError.class DELETED --- --- PngConfig.class DELETED --- --- Chunk_PLTE.class DELETED --- --- PngChunk.class DELETED --- --- Chunk_iCCP.class DELETED --- --- BasicPixelProcessor.class DELETED --- --- Chunk_hIST.class DELETED --- --- ProgressUpdater.class DELETED --- --- PngInputStream.class DELETED --- --- Chunk_pHYs.class DELETED --- --- Chunk_cHRM.class DELETED --- --- GammaPixelProcessor.class DELETED --- --- Chunk_sBIT.class DELETED --- --- ImageDataInputStream.class DELETED --- --- Chunk_tRNS.class DELETED --- --- Chunk_sPLT.class DELETED --- --- PngImage.class DELETED --- --- TextChunk.class DELETED --- --- PixelProcessor.class DELETED --- --- PngUtils.class DELETED --- --- PngException.class DELETED --- --- PngConstants.class DELETED --- --- Chunk_bKGD.class DELETED --- --- TextChunkReader.class DELETED --- --- Chunk_tIME.class DELETED --- --- ProgressivePixelProcessor.class DELETED --- --- StateMachine.class DELETED --- --- TransGammaPixelProcessor.class DELETED --- --- SuggestedPalette.class DELETED --- --- Chunk_IEND.class DELETED --- --- Integers.class DELETED --- --- ImageFactory.class DELETED --- --- Chunk_sRGB.class DELETED --- --- PngWarning.class DELETED --- --- Chunk_gAMA.class DELETED --- --- Defilterer.class DELETED --- --- Chunk_IHDR.class DELETED --- |
From: <jcr...@li...> - 2006-01-14 16:41:16
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6728 Modified Files: Changelog INSTALL build.xml Log Message: simplified build system, moved javapng library into a directory Index: build.xml =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/build.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build.xml 11 Jan 2006 02:32:12 -0000 1.3 --- build.xml 14 Jan 2006 16:41:07 -0000 1.4 *************** *** 6,10 **** <property name="src" location="."/> <property name="dist" location="dist"/> - <property name="javapng" location="${src}/javapng-2.0-rc3.jar"/> <target name="init"> <!-- Create the time stamp --> --- 6,9 ---- *************** *** 26,32 **** <jar jarfile="${dist}/jcrossclient.jar" basedir="${src}" ! includes="*.class, javapng-2.0-rc3.jar, COPYING, README, Changelog"> <manifest> - <attribute name="Class-Path" value="${javapng}"/> <attribute name="Main-Class" value="CFclient"/> </manifest> --- 25,30 ---- <jar jarfile="${dist}/jcrossclient.jar" basedir="${src}" ! includes="*.class, com/sixlegs/png/*.class, COPYING, README, Changelog"> <manifest> <attribute name="Main-Class" value="CFclient"/> </manifest> *************** *** 40,43 **** --- 38,42 ---- <delete> <fileset dir="${src}" includes="*.class, *~"/> + <fileset dir="${src}/com/sixlegs/png" includes="*.class, *~"/> </delete> </target> Index: INSTALL =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/INSTALL,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** INSTALL 7 Jan 2006 14:43:28 -0000 1.2 --- INSTALL 14 Jan 2006 16:41:07 -0000 1.3 *************** *** 1,13 **** ! To compile: ! 1) unzip the javapng jar file. ! 2) cd into the directory containing it. ! 3) run ant jar ! 4) copy the newly created jar file somewhere suitable. ! 5) return to the base jcrossclient directory ! 6) remove the uncompressed javapng files ! 7) run ant ! To run: ! java -jar dist/JClient.jar --- 1,29 ---- ! Short Version: ! run ant, the jar will be dists/jcrossclient.jar ! Long Version: ! Requirements: ! ! In order to run jcrossclient, you need a java runtime environment. ! In order to compile it, you need a java compiler, and apache ant. ! ! 1) Ensure you have a java compiler installed and configured correctly: ! 2) if you do not have it already, get apache ant, either from http://ant.apache.org/ ! or your distro provider ! 3) ensure ant is in your path, and that you have JAVA_HOME pointing to your ! java compiler's directory ! ! To compile: ! ! ant ! ! To run: ! ! java -jar dist/jcrossclient.jar ! ! ! ! If you have any problems, suggestions, questions, etc, please post them to ! the mailing list jcr...@li... Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Changelog 13 Jan 2006 04:31:29 -0000 1.24 --- Changelog 14 Jan 2006 16:41:07 -0000 1.25 *************** *** 158,160 **** - All by James Jackson ! CFclient - Remove obsolete call to mapwin.DebugMode() \ No newline at end of file --- 158,166 ---- - All by James Jackson ! CFclient - Remove obsolete call to mapwin.DebugMode() ! ! 14/01/2006 - com/* - move PNG library out into its own directory. ! ! build.xml - adjust build system to suit ! ! INSTALL - update compile instructions to reflect this |
From: <jcr...@li...> - 2006-01-14 16:39:26
|
Update of /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6355/com/sixlegs/png Log Message: Directory /cvsroot/jcrossclient/jcrossclient/com/sixlegs/png added to the repository |
From: <jcr...@li...> - 2006-01-14 16:39:20
|
Update of /cvsroot/jcrossclient/jcrossclient/com/sixlegs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6297/com/sixlegs Log Message: Directory /cvsroot/jcrossclient/jcrossclient/com/sixlegs added to the repository |
From: <jcr...@li...> - 2006-01-14 16:38:26
|
Update of /cvsroot/jcrossclient/jcrossclient/com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6118/com Log Message: Directory /cvsroot/jcrossclient/jcrossclient/com added to the repository |
From: <jcr...@li...> - 2006-01-13 04:31:37
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20522 Modified Files: Changelog CFclient.java Log Message: compile fix Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CFclient.java 12 Jan 2006 18:14:14 -0000 1.20 --- CFclient.java 13 Jan 2006 04:31:29 -0000 1.21 *************** *** 247,253 **** askForMapRedraw(); // ask SERVER for map again break; - case KeyEvent.VK_F10: // was 'D', but needed that for disarm - mapwin.DebugMode(); - break; // This is really to handle "control"-L, but... case KeyEvent.VK_F11: // was 'L' --- 247,250 ---- Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Changelog 12 Jan 2006 18:14:14 -0000 1.23 --- Changelog 13 Jan 2006 04:31:29 -0000 1.24 *************** *** 153,154 **** --- 153,160 ---- CFClient - fix compile error + 13/01/2006 - MapWin - New dirty-rectangle-based MapWin.updateMap() + - Lots of whitespace changes + - removal of obsolete code + - All by James Jackson + + CFclient - Remove obsolete call to mapwin.DebugMode() \ No newline at end of file |
From: <jcr...@li...> - 2006-01-13 01:56:27
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26159 Modified Files: MapWin.java Log Message: new dirty-rectangle-based MapWin.updateMap(). Index: MapWin.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/MapWin.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MapWin.java 1 Dec 2005 18:55:48 -0000 1.4 --- MapWin.java 13 Jan 2006 01:56:19 -0000 1.5 *************** *** 1,214 **** /* ! * Copyright (c) 1997, Phil Brown, ph...@bo... ! * Copyright (c) 2005, Brendan Lally, bre...@gm... ! * ! * This file is part of jcrossclient. ! * ! * Jcrossclient 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. ! * [...1636 lines suppressed...] + // These should really be on parent. + // but again, lets do this for debug now + + addKeyListener(Parent); + addFocusListener(Parent); + + addMouseListener(this); + + // initBackBuffer(); + mapthread = new MapUpdater(this, parent); + mapthread.start(); + } + + + public void askForFocus() { + debug("MapWin taking Keyboard Focus"); + requestFocus(); + } + } |
From: <jcr...@li...> - 2006-01-12 18:14:24
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14762 Modified Files: CFclient.java Changelog Log Message: fix compile error Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CFclient.java 12 Jan 2006 04:12:40 -0000 1.19 --- CFclient.java 12 Jan 2006 18:14:14 -0000 1.20 *************** *** 1226,1230 **** } if(cmd.startsWith("map1")) { /* this includes map1a */ ! mapwin.map1aRead(mapdata); return; } --- 1226,1230 ---- } if(cmd.startsWith("map1")) { /* this includes map1a */ ! mapwin.map1aRead(data); return; } Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Changelog 12 Jan 2006 04:12:40 -0000 1.22 --- Changelog 12 Jan 2006 18:14:14 -0000 1.23 *************** *** 150,151 **** --- 150,154 ---- CFclient - Change version number + + CFClient - fix compile error + |
From: Brendan L. <cav...@us...> - 2006-01-12 04:12:48
|
Update of /cvsroot/jcrossclient/jcrossclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2785 Modified Files: CFclient.java Changelog Log Message: update Changelog with new Release, change version number Index: CFclient.java =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/CFclient.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CFclient.java 12 Jan 2006 02:03:20 -0000 1.18 --- CFclient.java 12 Jan 2006 04:12:40 -0000 1.19 *************** *** 122,126 **** String servername; ! static String versionstring="1.00 ALPHA-2"; PlayerStats playerstats; --- 122,126 ---- String servername; ! static String versionstring="1.00 ALPHA-3-CVS"; PlayerStats playerstats; Index: Changelog =================================================================== RCS file: /cvsroot/jcrossclient/jcrossclient/Changelog,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Changelog 12 Jan 2006 02:03:20 -0000 1.21 --- Changelog 12 Jan 2006 04:12:40 -0000 1.22 *************** *** 146,147 **** --- 146,151 ---- Talkwin - Remove horrible green colouring that shows in java 1.4 + + 12/01/2006 - RELEASE 1.00 alpha 3 + + CFclient - Change version number |