diff --git a/README.md b/README.md index 554488f..1bc69f5 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Thanks to [hunternet93](https://github.com/hunternet93) for the macOS and Linux * pixman * zlib (only ruby bindings) * OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`) +* Ruby (make sure to use 2.3 on macOS due to a formatting bug) +* Python 3 (journal reimplementation only) +* Qt5 (journal reimplementation only) +* PyQt5 (journal reimplementation only) *OneShot* employs Qt's qmake build system, so you'll need to install that beforehand. (The cmake build hasn't been maintained since the fork.) diff --git a/journal/setup-unix-remake.py b/journal/setup-unix-remake.py new file mode 100644 index 0000000..7bde49c --- /dev/null +++ b/journal/setup-unix-remake.py @@ -0,0 +1,34 @@ +""" +This is a setup.py script generated by py2applet + +Usage: + python3 setup-unix-remake.py py2app +""" + +from setuptools import setup + +APP = ['journal.py'] +APP_NAME = "_______" +DATA_FILES = ["images"] +OPTIONS = { + 'argv_emulation': True, + # 'plist': { + # 'CFBundleName': APP_NAME, + # 'CFBundleDisplayName': APP_NAME, + # 'CFBundleGetInfoString': "You only have one shot.", + # 'CFBundleIdentifier': 'com.oneshot-game.hunternet93.journal-remake', + # 'CFBundleVersion': '1.0', + # 'CFBundleShortVersionString': '1.0', + # 'LSApplicationCategoryType': 'public.app-category.games', + # 'LSMinimumSystemVersion': '10.7', + # 'NSHumanReadableCopyright': u"Copyright © 2017, hunternet93 and Vinyl Darkscratch, MIT License. https://github.com/hunternet93/OneShot-Journal" + # } +} + +setup( + name=APP_NAME, + app=APP, + data_files=DATA_FILES, + options={'py2app': OPTIONS}, + setup_requires=['py2app'], +) \ No newline at end of file diff --git a/journal/unix-remake/.gitignore b/journal/unix-remake/.gitignore new file mode 100644 index 0000000..72364f9 --- /dev/null +++ b/journal/unix-remake/.gitignore @@ -0,0 +1,89 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# IPython Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject diff --git a/journal/unix-remake/LICENSE b/journal/unix-remake/LICENSE new file mode 100644 index 0000000..6e8fead --- /dev/null +++ b/journal/unix-remake/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Isaac Smith + +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 without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/journal/unix-remake/README.md b/journal/unix-remake/README.md new file mode 100644 index 0000000..720312b --- /dev/null +++ b/journal/unix-remake/README.md @@ -0,0 +1,22 @@ +OneShot Journal +=============== + +This is a Linux-compatible reimplementation of the Author's Journal, a element in the game [OneShot](http://oneshot-game.com). + +Usage +----- + +This journal requires PyQt5 to run. On Debian/Ubuntu-based systems, install via the following command: + + sudo apt-get install python3-pyqt5 + +This will install PyQt5 and all necessary files. Next, extract the images from the original OneShot journal program using the instructions in the following section, then use the following command to start the journal: + + python3 journal.py + +Start OneShot and play normally. + +Extracting the images +--------------------- + +First, aquire a copy of the Windows-version journal executable. Next, download [ResourcesExtract](http://www.nirsoft.net/utils/resources_extract.html) and run it, either via Wine or from a Windows install. Set the filename to the journal executable and the destination to the images directory in your local copy of this repo. Set the program to extract only bitmaps, then press Start. Once extraction completes run the included Python script `renameandconvert.py` (requires ImageMagick), which will create the required PNGs. diff --git a/journal/unix-remake/images/.gitkeep b/journal/unix-remake/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/journal/unix-remake/images/c1.png b/journal/unix-remake/images/c1.png new file mode 100644 index 0000000..f403855 Binary files /dev/null and b/journal/unix-remake/images/c1.png differ diff --git a/journal/unix-remake/images/c2.png b/journal/unix-remake/images/c2.png new file mode 100644 index 0000000..f8abf60 Binary files /dev/null and b/journal/unix-remake/images/c2.png differ diff --git a/journal/unix-remake/images/c3.png b/journal/unix-remake/images/c3.png new file mode 100644 index 0000000..3321833 Binary files /dev/null and b/journal/unix-remake/images/c3.png differ diff --git a/journal/unix-remake/images/c4.png b/journal/unix-remake/images/c4.png new file mode 100644 index 0000000..7c9b241 Binary files /dev/null and b/journal/unix-remake/images/c4.png differ diff --git a/journal/unix-remake/images/c5.png b/journal/unix-remake/images/c5.png new file mode 100644 index 0000000..a0ad7fa Binary files /dev/null and b/journal/unix-remake/images/c5.png differ diff --git a/journal/unix-remake/images/c6.png b/journal/unix-remake/images/c6.png new file mode 100644 index 0000000..e5353f7 Binary files /dev/null and b/journal/unix-remake/images/c6.png differ diff --git a/journal/unix-remake/images/c7.png b/journal/unix-remake/images/c7.png new file mode 100644 index 0000000..7967886 Binary files /dev/null and b/journal/unix-remake/images/c7.png differ diff --git a/journal/unix-remake/images/default.png b/journal/unix-remake/images/default.png new file mode 100644 index 0000000..b79c1c9 Binary files /dev/null and b/journal/unix-remake/images/default.png differ diff --git a/journal/unix-remake/images/final.png b/journal/unix-remake/images/final.png new file mode 100644 index 0000000..57b7114 Binary files /dev/null and b/journal/unix-remake/images/final.png differ diff --git a/journal/unix-remake/images/niko1.png b/journal/unix-remake/images/niko1.png new file mode 100644 index 0000000..9316b1f Binary files /dev/null and b/journal/unix-remake/images/niko1.png differ diff --git a/journal/unix-remake/images/niko2.png b/journal/unix-remake/images/niko2.png new file mode 100644 index 0000000..72dae08 Binary files /dev/null and b/journal/unix-remake/images/niko2.png differ diff --git a/journal/unix-remake/images/niko3.png b/journal/unix-remake/images/niko3.png new file mode 100644 index 0000000..73ea0d8 Binary files /dev/null and b/journal/unix-remake/images/niko3.png differ diff --git a/journal/unix-remake/images/s1.png b/journal/unix-remake/images/s1.png new file mode 100644 index 0000000..c7e3d8a Binary files /dev/null and b/journal/unix-remake/images/s1.png differ diff --git a/journal/unix-remake/images/s2.png b/journal/unix-remake/images/s2.png new file mode 100644 index 0000000..185768a Binary files /dev/null and b/journal/unix-remake/images/s2.png differ diff --git a/journal/unix-remake/images/s3.png b/journal/unix-remake/images/s3.png new file mode 100644 index 0000000..8c92ea1 Binary files /dev/null and b/journal/unix-remake/images/s3.png differ diff --git a/journal/unix-remake/images/s4.png b/journal/unix-remake/images/s4.png new file mode 100644 index 0000000..26a0936 Binary files /dev/null and b/journal/unix-remake/images/s4.png differ diff --git a/journal/unix-remake/images/save.png b/journal/unix-remake/images/save.png new file mode 100644 index 0000000..c7faa04 Binary files /dev/null and b/journal/unix-remake/images/save.png differ diff --git a/journal/unix-remake/images/t1.png b/journal/unix-remake/images/t1.png new file mode 100644 index 0000000..e3e02a1 Binary files /dev/null and b/journal/unix-remake/images/t1.png differ diff --git a/journal/unix-remake/images/t10.png b/journal/unix-remake/images/t10.png new file mode 100644 index 0000000..f06b9da Binary files /dev/null and b/journal/unix-remake/images/t10.png differ diff --git a/journal/unix-remake/images/t11.png b/journal/unix-remake/images/t11.png new file mode 100644 index 0000000..c3bcbdc Binary files /dev/null and b/journal/unix-remake/images/t11.png differ diff --git a/journal/unix-remake/images/t12.png b/journal/unix-remake/images/t12.png new file mode 100644 index 0000000..dedfb18 Binary files /dev/null and b/journal/unix-remake/images/t12.png differ diff --git a/journal/unix-remake/images/t13.png b/journal/unix-remake/images/t13.png new file mode 100644 index 0000000..bcdd0dd Binary files /dev/null and b/journal/unix-remake/images/t13.png differ diff --git a/journal/unix-remake/images/t14.png b/journal/unix-remake/images/t14.png new file mode 100644 index 0000000..bb5fac4 Binary files /dev/null and b/journal/unix-remake/images/t14.png differ diff --git a/journal/unix-remake/images/t15.png b/journal/unix-remake/images/t15.png new file mode 100644 index 0000000..5fa873f Binary files /dev/null and b/journal/unix-remake/images/t15.png differ diff --git a/journal/unix-remake/images/t16.png b/journal/unix-remake/images/t16.png new file mode 100644 index 0000000..c23e7c9 Binary files /dev/null and b/journal/unix-remake/images/t16.png differ diff --git a/journal/unix-remake/images/t2.png b/journal/unix-remake/images/t2.png new file mode 100644 index 0000000..4ae3746 Binary files /dev/null and b/journal/unix-remake/images/t2.png differ diff --git a/journal/unix-remake/images/t3.png b/journal/unix-remake/images/t3.png new file mode 100644 index 0000000..2badc5e Binary files /dev/null and b/journal/unix-remake/images/t3.png differ diff --git a/journal/unix-remake/images/t4.png b/journal/unix-remake/images/t4.png new file mode 100644 index 0000000..48f148a Binary files /dev/null and b/journal/unix-remake/images/t4.png differ diff --git a/journal/unix-remake/images/t5.png b/journal/unix-remake/images/t5.png new file mode 100644 index 0000000..98718f0 Binary files /dev/null and b/journal/unix-remake/images/t5.png differ diff --git a/journal/unix-remake/images/t6.png b/journal/unix-remake/images/t6.png new file mode 100644 index 0000000..dd107cc Binary files /dev/null and b/journal/unix-remake/images/t6.png differ diff --git a/journal/unix-remake/images/t7.png b/journal/unix-remake/images/t7.png new file mode 100644 index 0000000..d06bc88 Binary files /dev/null and b/journal/unix-remake/images/t7.png differ diff --git a/journal/unix-remake/images/t8.png b/journal/unix-remake/images/t8.png new file mode 100644 index 0000000..7e629b0 Binary files /dev/null and b/journal/unix-remake/images/t8.png differ diff --git a/journal/unix-remake/images/t9.png b/journal/unix-remake/images/t9.png new file mode 100644 index 0000000..3f21f5a Binary files /dev/null and b/journal/unix-remake/images/t9.png differ diff --git a/journal/unix-remake/journal.py b/journal/unix-remake/journal.py new file mode 100644 index 0000000..1faf3f2 --- /dev/null +++ b/journal/unix-remake/journal.py @@ -0,0 +1,78 @@ +import os +import sys +import time + +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QRect, QRectF, QTimer +from PyQt5.QtWidgets import QApplication, QWidget, QLabel +from PyQt5.QtGui import QIcon, QPixmap, QPainter + +pipe_path = '/tmp/oneshot-pipe' + +try: base_path = sys._MEIPASS +except AttributeError: base_path = os.path.abspath('.') + +class WatchPipe(QThread): + change_image = pyqtSignal(str) + + def run(self): + while True: + if os.path.exists(pipe_path): break + else: time.sleep(0.1) + + pipe = open(pipe_path, 'r') + pipe.flush() + + while True: + message = os.read(pipe.fileno(), 256) + if len(message) > 0: + self.change_image.emit(message.decode()) + + time.sleep(0.05) + +class Journal(QWidget): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.label = QLabel(self) + self.change_image('default') + + self.setWindowFlags(self.windowFlags()) + self.setAttribute(Qt.WA_TranslucentBackground) + self.setWindowTitle('OneShot Journal') + self.setMinimumSize(800, 600) + self.setMaximumSize(800, 600) + self.setGeometry(0, 0, 800, 600) + self.show() + + def change_image(self, name): + self.pixmap = QPixmap(os.path.join(base_path, 'images', '{}.png'.format(name))) + self.label.setPixmap(self.pixmap) + +class Niko(QWidget): + def __init__(self, *args, **kwargs): + self.start_x, self.start_y = kwargs['start_x'], kwargs['start_y'] + del kwargs['start_x'], kwargs['start_y'] + + super().__init__(*args, **kwargs) + + self.frames = [QPixmap(os.path.join(base_path, 'images', 'niko{}.png'.format(n)) for n in range(1,4))] + + self.setBackgroundRole(QPalette.Base) + self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + +if __name__ == '__main__': + app = QApplication(sys.argv) + + if len(sys.argv) == 3: + # "Niko-leaves-the-screen" mode + x, y = int(sys.argv[1]), int(sys.argv[2]) + + else: + # Author's Journal mode + journal = Journal() + + thread = WatchPipe() + thread.change_image.connect(journal.change_image) + thread.start() + + app.exec_() diff --git a/journal/unix-remake/renameandconvert.py b/journal/unix-remake/renameandconvert.py new file mode 100644 index 0000000..7047053 --- /dev/null +++ b/journal/unix-remake/renameandconvert.py @@ -0,0 +1,3 @@ +import os +for filename in os.listdir('images'): + if filename[-4:] == '.bmp': os.system("convert images/{} -alpha on -transparent '#00ff00' images/{}.png".format(filename, filename.strip('_')[:-4].lower())) diff --git a/mkxp.pro b/mkxp.pro index c267703..859e605 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -2,7 +2,7 @@ TEMPLATE = app QT = -TARGET = oneshot +TARGET = OneShot DEPENDPATH += src shader assets INCLUDEPATH += . src @@ -42,7 +42,7 @@ unix { #CONFIG -= app_bundle INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers LIBS += -framework OpenAL - QMAKE_LFLAGS += -L/usr/local/opt/ruby21/lib -L/usr/local/opt/openal-soft/lib + QMAKE_LFLAGS += -L/usr/local/opt/ruby@2.3/lib -L/usr/local/opt/openal-soft/lib } !macx: { PKGCONFIG += openal zlib diff --git a/scripts/SaveLoad.rb b/scripts/SaveLoad.rb index 0977c4c..de7998d 100644 --- a/scripts/SaveLoad.rb +++ b/scripts/SaveLoad.rb @@ -2,6 +2,7 @@ SAVE_FILE_NAME = Oneshot::SAVE_PATH + '/save.dat' PERMA_FLAGS_NAME = Oneshot::SAVE_PATH + '/p-settings.dat' FAKE_SAVE_NAME = Oneshot::GAME_PATH + '/Oneshot/save_progress.oneshot' + def erase_game File.delete(SAVE_FILE_NAME) unless !File.exists?(SAVE_FILE_NAME) end @@ -42,31 +43,31 @@ def save write_save(SAVE_FILE_NAME) write_perma_flags(PERMA_FLAGS_NAME) - Dir.mkdir(Oneshot::SAVE_PATH + "\\save_backups") unless File.exists?(Oneshot::SAVE_PATH + "\\save_backups") + Dir.mkdir(Oneshot::SAVE_PATH + "/save_backups") unless File.exists?(Oneshot::SAVE_PATH + "/save_backups") i = 5 while i > 0 #delete save5.bk if it exists - if File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\save" + i.to_s + ".bk") - File.delete(Oneshot::SAVE_PATH + "\\save_backups\\save" + i.to_s + ".bk") + if File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk") + File.delete(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk") end #delete p-settings5.bk if it exists - if File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + i.to_s + ".bk") - File.delete(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + i.to_s + ".bk") + if File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk") + File.delete(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk") end #rename save4.bk to save5.bk if save4.bk exists - if File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\save" + (i-1).to_s + ".bk") - File.rename(Oneshot::SAVE_PATH + "\\save_backups\\save" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "\\save_backups\\save" + i.to_s + ".bk" ) + if File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk") + File.rename(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk" ) end #rename p-settings4.bk to p-settings5.bk if save4.bk exists - if File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + (i-1).to_s + ".bk") - File.rename(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + i.to_s + ".bk" ) + if File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk") + File.rename(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk" ) end i -= 1 end - write_save(Oneshot::SAVE_PATH + "\\save_backups\\save1.bk") - write_perma_flags(Oneshot::SAVE_PATH + "\\save_backups\\p-settings1.bk") + write_save(Oneshot::SAVE_PATH + "/save_backups/save1.bk") + write_perma_flags(Oneshot::SAVE_PATH + "/save_backups/p-settings1.bk") end @@ -166,7 +167,7 @@ def load_perma_flags puts "oops: #{e.message}" EdText.err("p-settings.dat corrupt. Attempting to load backup.") for i in 1..6 - if !File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + (i).to_s + ".bk") + if !File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i).to_s + ".bk") EdText.err("All p-settings backups corrupt! Deleting corrupt p-settings file and shutting down.") File.delete(PERMA_FLAGS_NAME) Oneshot.allow_exit true @@ -174,7 +175,7 @@ def load_perma_flags break end begin - read_perma_flags(Oneshot::SAVE_PATH + "\\save_backups\\p-settings" + (i).to_s + ".bk") + read_perma_flags(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i).to_s + ".bk") break rescue TypeError => e2 puts "oops: #{e2.message}" @@ -213,7 +214,7 @@ def real_load puts "oops: #{e.message}" EdText.err("save.dat corrupt. Attempting to load backup.") for i in 1..6 - if !File.exists?(Oneshot::SAVE_PATH + "\\save_backups\\save" + (i).to_s + ".bk") + if !File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk") EdText.err("All save backups corrupt! Deleting corrupt save and shutting down.") File.delete(SAVE_FILE_NAME) Oneshot.allow_exit true @@ -221,7 +222,7 @@ def real_load break end begin - load(Oneshot::SAVE_PATH + "\\save_backups\\save" + (i).to_s + ".bk") + load(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk") break rescue TypeError => e2 puts "oops: #{e2.message}" diff --git a/scripts/Script.rb b/scripts/Script.rb index 2036379..46f53fe 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -375,7 +375,7 @@ module Script def self.copy_journal Dir.mkdir(Oneshot::GAME_PATH) unless File.exists?(Oneshot::GAME_PATH) Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot") - if File.exists?(Oneshot::JOURNAL) + begin #if File.exists?(Oneshot::JOURNAL) File.open(Oneshot::JOURNAL, "rb") do |input| File.open(Oneshot::GAME_PATH + "/Oneshot/" + Oneshot::JOURNAL,"wb") do |output| while buff = input.read(4096) @@ -398,12 +398,12 @@ module Script end def self.create_boxes - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") + Dir.mkdir(Oneshot::GAME_PATH) unless File.exists?(Oneshot::GAME_PATH) + Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot") + Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal1") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal1") + Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal2") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal2") + Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal3") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal3") + Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/BigPortal") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/BigPortal") end def self.delete_if_exists(f_name) @@ -412,25 +412,25 @@ module Script def self.clear_boxes for i in 1..3 - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + i.to_s + portal_path = Oneshot::GAME_PATH + "/Oneshot/Portal" + i.to_s case i when 1 - delete_if_exists(portal_path + "\\blue_npc_prototype.png") - delete_if_exists(portal_path + "\\proto1.png") - delete_if_exists(portal_path + "\\keyB.txt") + delete_if_exists(portal_path + "/blue_npc_prototype.png") + delete_if_exists(portal_path + "/proto1.png") + delete_if_exists(portal_path + "/keyB.txt") when 2 - delete_if_exists(portal_path + "\\green_npc_cedric.png") - delete_if_exists(portal_path + "\\cedric.png") - delete_if_exists(portal_path + "\\keyG.txt") + delete_if_exists(portal_path + "/green_npc_cedric.png") + delete_if_exists(portal_path + "/cedric.png") + delete_if_exists(portal_path + "/keyG.txt") when 3 - delete_if_exists(portal_path + "\\red_rue.png") - delete_if_exists(portal_path + "\\rue.png") - delete_if_exists(portal_path + "\\keyR.txt") + delete_if_exists(portal_path + "/red_rue.png") + delete_if_exists(portal_path + "/rue.png") + delete_if_exists(portal_path + "/keyR.txt") end end - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyG.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt") + delete_if_exists(Oneshot::GAME_PATH + "/Oneshot/BigPortal/keyB.txt") + delete_if_exists(Oneshot::GAME_PATH + "/Oneshot/BigPortal/keyG.txt") + delete_if_exists(Oneshot::GAME_PATH + "/Oneshot/BigPortal/keyR.txt") end def self.copy_file(src, dst) @@ -454,71 +454,71 @@ module Script end def self.put_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::GAME_PATH + "/Oneshot/Portal" + numb.to_s case numb when 1 - copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png") - copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.png") - write_key(portal_path + "\\keyB.txt", PROTO_TEXT) + copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png") + copy_file("Graphics/Faces/proto1.png", portal_path + "/proto1.png") + write_key(portal_path + "/keyB.txt", PROTO_TEXT) when 2 - copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png") - copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\cedric.png") - write_key(portal_path + "\\keyG.txt", CEDRIC_TEXT) + copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png") + copy_file("Graphics/Faces/cedric.png", portal_path + "/cedric.png") + write_key(portal_path + "/keyG.txt", CEDRIC_TEXT) when 3 - copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png") - copy_file("Graphics\\Faces\\rue.png", portal_path + "\\rue.png") - write_key(portal_path + "\\keyR.txt", RUE_TEXT) + copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png") + copy_file("Graphics/Faces/rue.png", portal_path + "/rue.png") + write_key(portal_path + "/keyR.txt", RUE_TEXT) end end def self.password1 - copy_file("Graphics\\Fogs\\_\\scenario1\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario1/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario1/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario1/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario1/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end def self.password2 - copy_file("Graphics\\Fogs\\_\\scenario2\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario2/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario2/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario2/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario2/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end =begin def self.take_key_out_of_box(numb) - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") + File.delete(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") end - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png") + File.delete(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png") end end =end def self.is_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::GAME_PATH + "/Oneshot/Portal" + numb.to_s case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end def self.is_key_in_bigbox(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal" + portal_path = Oneshot::GAME_PATH + "/Oneshot/BigPortal" case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end