From 822099c90c8a3055346db0db3e4f380921bbef86 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Tue, 24 Nov 2015 22:40:50 -0300 Subject: [PATCH] Updated folder hierarchy and save and restore --- INSTALL | 10 ++ README.md | 3 + .../resources/chips => chips}/4NodeL2R.chip | Bin .../resources/chips => chips}/4NodeR2L.chip | Bin .../resources/chips => chips}/4ORL2R.chip | Bin .../resources/chips => chips}/4ORR2L.chip | Bin .../chips => chips}/6BitCounter.chip | Bin {src/main/resources/chips => chips}/Bus.chip | Bin .../main/resources/chips => chips}/Clock.chip | Bin chips/CountToN.chip | Bin 0 -> 2691 bytes .../main/resources/chips => chips}/Delay.chip | Bin .../resources/chips => chips}/FullAdder.chip | Bin .../resources/chips => chips}/Monomer.chip | Bin .../resources/chips => chips}/OneShot.chip | Bin .../resources/chips => chips}/RSflipflop.chip | Bin .../main/resources/chips => chips}/Token.chip | Bin chips/WallHugger.chip | Bin 0 -> 4187 bytes chips/gates.chip | Bin 0 -> 509 bytes .../chips => chips}/old_WallHugger.chip | Bin chips/oscillator.chip | Bin 0 -> 195 bytes .../resources/chips => chips}/quarter.chip | Bin src/com/droidquest/DQ.java | 3 +- src/com/droidquest/avatars/Player.java | 4 +- src/com/droidquest/devices/SmallChip.java | 106 +----------------- src/com/droidquest/levels/MainMenu.java | 2 +- 25 files changed, 19 insertions(+), 109 deletions(-) create mode 100644 INSTALL rename {src/main/resources/chips => chips}/4NodeL2R.chip (100%) rename {src/main/resources/chips => chips}/4NodeR2L.chip (100%) rename {src/main/resources/chips => chips}/4ORL2R.chip (100%) rename {src/main/resources/chips => chips}/4ORR2L.chip (100%) rename {src/main/resources/chips => chips}/6BitCounter.chip (100%) rename {src/main/resources/chips => chips}/Bus.chip (100%) rename {src/main/resources/chips => chips}/Clock.chip (100%) create mode 100644 chips/CountToN.chip rename {src/main/resources/chips => chips}/Delay.chip (100%) rename {src/main/resources/chips => chips}/FullAdder.chip (100%) rename {src/main/resources/chips => chips}/Monomer.chip (100%) rename {src/main/resources/chips => chips}/OneShot.chip (100%) rename {src/main/resources/chips => chips}/RSflipflop.chip (100%) rename {src/main/resources/chips => chips}/Token.chip (100%) create mode 100644 chips/WallHugger.chip create mode 100644 chips/gates.chip rename {src/main/resources/chips => chips}/old_WallHugger.chip (100%) create mode 100644 chips/oscillator.chip rename {src/main/resources/chips => chips}/quarter.chip (100%) diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..58b616c --- /dev/null +++ b/INSTALL @@ -0,0 +1,10 @@ +To compile the game you must run: + $ make + +To install the game use the command: + # make install + +To uninstall: + # make uninstall + +The compilation requires gcc and maven to be installed on the system. diff --git a/README.md b/README.md index 1208436..3aa46c6 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ A Java recreation of the classic game Robot Odyssey I Copyright (c) 2000 Thomas Foote +Optimization to compile, install, and run under linux: +Copyright (c) 2015 Chris Cromer + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff --git a/src/main/resources/chips/4NodeL2R.chip b/chips/4NodeL2R.chip similarity index 100% rename from src/main/resources/chips/4NodeL2R.chip rename to chips/4NodeL2R.chip diff --git a/src/main/resources/chips/4NodeR2L.chip b/chips/4NodeR2L.chip similarity index 100% rename from src/main/resources/chips/4NodeR2L.chip rename to chips/4NodeR2L.chip diff --git a/src/main/resources/chips/4ORL2R.chip b/chips/4ORL2R.chip similarity index 100% rename from src/main/resources/chips/4ORL2R.chip rename to chips/4ORL2R.chip diff --git a/src/main/resources/chips/4ORR2L.chip b/chips/4ORR2L.chip similarity index 100% rename from src/main/resources/chips/4ORR2L.chip rename to chips/4ORR2L.chip diff --git a/src/main/resources/chips/6BitCounter.chip b/chips/6BitCounter.chip similarity index 100% rename from src/main/resources/chips/6BitCounter.chip rename to chips/6BitCounter.chip diff --git a/src/main/resources/chips/Bus.chip b/chips/Bus.chip similarity index 100% rename from src/main/resources/chips/Bus.chip rename to chips/Bus.chip diff --git a/src/main/resources/chips/Clock.chip b/chips/Clock.chip similarity index 100% rename from src/main/resources/chips/Clock.chip rename to chips/Clock.chip diff --git a/chips/CountToN.chip b/chips/CountToN.chip new file mode 100644 index 0000000000000000000000000000000000000000..1ce1997054dafe856f41a5bd2425348b80d5eb03 GIT binary patch literal 2691 zcmds(%TB^T6ov;2BI5-W?{4bC2f%w+m=Fw!8%T_AU`TW!-i9=BVd8W63ci}ppyzAn zl%giEkcIrD{ZD63&$J(HXWlR?yC@KbRL2^z*pzAlt986l}FGqg{%Tl-G{$ zP63LVgg1ABxElmlq`X%p=B^jKm%MYqw8y+9>NA(dRAiw4#k)90-f%;3L~upQdre}f zmAzZ|Fe+P7?>l6 z6-?G6ul%FBQetI<23AbN>PS8{P__+GI3U38v0&hFR3cF&PgwFhauXAjeO-yWs$fjv&+Lwl0OM-h|h F%oq9cAin?r literal 0 HcmV?d00001 diff --git a/src/main/resources/chips/Delay.chip b/chips/Delay.chip similarity index 100% rename from src/main/resources/chips/Delay.chip rename to chips/Delay.chip diff --git a/src/main/resources/chips/FullAdder.chip b/chips/FullAdder.chip similarity index 100% rename from src/main/resources/chips/FullAdder.chip rename to chips/FullAdder.chip diff --git a/src/main/resources/chips/Monomer.chip b/chips/Monomer.chip similarity index 100% rename from src/main/resources/chips/Monomer.chip rename to chips/Monomer.chip diff --git a/src/main/resources/chips/OneShot.chip b/chips/OneShot.chip similarity index 100% rename from src/main/resources/chips/OneShot.chip rename to chips/OneShot.chip diff --git a/src/main/resources/chips/RSflipflop.chip b/chips/RSflipflop.chip similarity index 100% rename from src/main/resources/chips/RSflipflop.chip rename to chips/RSflipflop.chip diff --git a/src/main/resources/chips/Token.chip b/chips/Token.chip similarity index 100% rename from src/main/resources/chips/Token.chip rename to chips/Token.chip diff --git a/chips/WallHugger.chip b/chips/WallHugger.chip new file mode 100644 index 0000000000000000000000000000000000000000..dd77ae89806238e51a4281c5e329c8edb2736279 GIT binary patch literal 4187 zcmdUyO-~b16ozkG3bfE76u-ZUBI=?Gzuk(4xG<0q5)*eWu#iBgIHWt*?p*o{-1%Sp zCH@9I&pqePR5~-ACXKAEAGxWQd;7iqcSaXE2xgUB&A4uSNtk)7#%<$k#?9FFz_RSgB8j2Tc5cS5 zOdHP&b1(3ejmyTh$W>l!zUr^Y*rOuH^6wOgaC2)%g;=blX#Ay*?z1Z;2GLHXX(LzO z+D`0MMK_zK!(K&oyd7^=P1A|Jjg92FczjO&8>h7c_Ts3V)-Xm_R(nLPo~8-9QvZ%f z{PT$He419SSFq_cGtM(XKxDv@l3OsoB8=~D7_S-MGM3B;nMi7A?wJdaGov992IrJq%lLxvZDD+O)A*|KUE`+a!*G81St2rE1DuhXQJZjP z%oWd!;ECLtVfIF5M!jHW)W*+@rUuL{8ZR4D=Kw{BcUdvMZhYBTG9%Q9|EXp)CY%`y z#WO=3=aHKkW^ZI>Gz(@%W30^h#sb@Zl^S_Y*(CtA0^Cy?V!nMcW=4*KewTnLe^hh9URb)QT|0`ZeM%i7V_;Cq-TJ`FGIRc##x>TbtCz{P=g`P@rKUOW2ijL4>m$w4Am*@ zPa#`EeEe!6_vP*TgM;?#lWuqSxL$wI**WU9clM4?K1DKq*m<-2A!@Im9QI`NNJsJA m$DQ?~C^|X}_n(Auta#el-tX?k2A}mPR;jOQ27tV8rBN{ literal 0 HcmV?d00001 diff --git a/chips/gates.chip b/chips/gates.chip new file mode 100644 index 0000000000000000000000000000000000000000..a3aeb9ef76ca3db7f667cbd6dfdf6672a4dd72ae GIT binary patch literal 509 zcmZ4UmVvcgjDdlHoq>^&kpTf27+6XenEm`i${m5SaKH#+{RaY4XrMukel8G$n4v~7 zL1`A!3}W&R!fp;LY349T01avc=|Oi88z}~X)ItG@InWRSc@ktEDAYg>1koT5gJ>`= zVJLM^EJ-a^a7oS0=i)N7Qt-?xC@oQN(NCLo+2P(0EivXik!Lc0d3IGo)gl+%; literal 0 HcmV?d00001 diff --git a/src/main/resources/chips/old_WallHugger.chip b/chips/old_WallHugger.chip similarity index 100% rename from src/main/resources/chips/old_WallHugger.chip rename to chips/old_WallHugger.chip diff --git a/chips/oscillator.chip b/chips/oscillator.chip new file mode 100644 index 0000000000000000000000000000000000000000..9bc0964fbfa2bfaf6d566c10170ab3bd89ea10df GIT binary patch literal 195 zcmZ4UmVvdLi-CcG5eR`~2?MjAe@J;Fkc|rd0|7{cSQ@IE5vrbvRJw#g(Z4u3Gbbmp jB)>?(IU}=xi_6eT!N0VmptM9GI5RyjF{hjbXbU3%s&+)( literal 0 HcmV?d00001 diff --git a/src/main/resources/chips/quarter.chip b/chips/quarter.chip similarity index 100% rename from src/main/resources/chips/quarter.chip rename to chips/quarter.chip diff --git a/src/com/droidquest/DQ.java b/src/com/droidquest/DQ.java index d040ce2..9bb9086 100644 --- a/src/com/droidquest/DQ.java +++ b/src/com/droidquest/DQ.java @@ -11,6 +11,8 @@ import java.awt.*; import java.awt.event.*; import java.util.Set; +import java.io.*; + public class DQ extends JFrame implements ActionListener { private RoomDisplay myRoom; @@ -276,7 +278,6 @@ public class DQ extends JFrame implements ActionListener { } } - public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Save Level")) { FileDialog fd = new FileDialog(this, "Save Level", FileDialog.SAVE); diff --git a/src/com/droidquest/avatars/Player.java b/src/com/droidquest/avatars/Player.java index 2c846c1..a7f20ac 100644 --- a/src/com/droidquest/avatars/Player.java +++ b/src/com/droidquest/avatars/Player.java @@ -136,8 +136,8 @@ public class Player extends Item implements Avatar { + fd.getFile()); if (fd.getFile() != null) { ((SmallChip) carrying).Empty(); - //((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile()); - ((SmallChip) carrying).LoadChip(fd.getFile(), false); + ((SmallChip) carrying).LoadChip(fd.getDirectory() + fd.getFile(), false); + //((SmallChip) carrying).LoadChip(fd.getFile(), false); } return true; } diff --git a/src/com/droidquest/devices/SmallChip.java b/src/com/droidquest/devices/SmallChip.java index f06a6d3..66d8c6b 100644 --- a/src/com/droidquest/devices/SmallChip.java +++ b/src/com/droidquest/devices/SmallChip.java @@ -239,111 +239,7 @@ public class SmallChip extends GenericChip { File file; InputStream link; - if (!gameChip) { - filename = System.getProperty("user.home") + "/.DroidQuest/chips/" + filename; - - /* Create default chips for user */ - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/"); - if (!file.exists()) { - file.mkdirs(); - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/CountToN.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/CountToN.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/gates.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/gates.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/oscillator.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/oscillator.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/WallHugger.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/WallHugger.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/4NodeL2R.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/4NodeL2R.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/4NodeR2L.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/4NodeR2L.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/4ORL2R.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/4ORL2R.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/4ORR2L.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/4ORR2L.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/6BitCounter.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/6BitCounter.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/Bus.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/Bus.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/Clock.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/Clock.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/Delay.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/Delay.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/FullAdder.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/FullAdder.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/Monomer.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/Monomer.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/old_WallHugger.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/old_WallHugger.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/OneShot.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/OneShot.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/quarter.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/quarter.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/RSflipflop.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/RSflipflop.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - file = new File(System.getProperty("user.home") + "/.DroidQuest/chips/Token.chip"); - if (!file.exists()) { - link = getClass().getResourceAsStream("/chips/Token.chip"); - Files.copy(link, file.getAbsoluteFile().toPath()); - } - } - } - else { + if (gameChip) { filename = "/usr/share/DroidQuest/chips/" + filename; } diff --git a/src/com/droidquest/levels/MainMenu.java b/src/com/droidquest/levels/MainMenu.java index 2f215ba..35e7094 100644 --- a/src/com/droidquest/levels/MainMenu.java +++ b/src/com/droidquest/levels/MainMenu.java @@ -267,7 +267,7 @@ public class MainMenu extends Level { player = gameCursor; currentViewer = player; - File f = new File(System.getProperty("user.home") + "/.DroidQuest/" + "ROlevels/"); + File f = new File(System.getProperty("user.home") + "/.DroidQuest/ROlevels/"); if (!f.exists()) { f.mkdir(); }